当前位置: 首页>>代码示例>>Java>>正文


Java AL11类代码示例

本文整理汇总了Java中org.lwjgl.openal.AL11的典型用法代码示例。如果您正苦于以下问题:Java AL11类的具体用法?Java AL11怎么用?Java AL11使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


AL11类属于org.lwjgl.openal包,在下文中一共展示了AL11类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: setEnvironment

import org.lwjgl.openal.AL11; //导入依赖的package包/类
private static void setEnvironment(int sourceID, float sendGain0, float sendGain1, float sendGain2, float sendGain3, float sendCutoff0, float sendCutoff1,
		float sendCutoff2, float sendCutoff3, float directCutoff, float directGain)
{
	//Set reverb send filter values and set source to send to all reverb fx slots
	EFX10.alFilterf(sendFilter0, EFX10.AL_LOWPASS_GAIN, sendGain0);
	EFX10.alFilterf(sendFilter0, EFX10.AL_LOWPASS_GAINHF, sendCutoff0);
	AL11.alSource3i(sourceID, EFX10.AL_AUXILIARY_SEND_FILTER, auxFXSlot0, 0, sendFilter0);	
	
	EFX10.alFilterf(sendFilter1, EFX10.AL_LOWPASS_GAIN, sendGain1);
	EFX10.alFilterf(sendFilter1, EFX10.AL_LOWPASS_GAINHF, sendCutoff1);
	AL11.alSource3i(sourceID, EFX10.AL_AUXILIARY_SEND_FILTER, auxFXSlot1, 1, sendFilter1);	
	
	EFX10.alFilterf(sendFilter2, EFX10.AL_LOWPASS_GAIN, sendGain2);
	EFX10.alFilterf(sendFilter2, EFX10.AL_LOWPASS_GAINHF, sendCutoff2);
	AL11.alSource3i(sourceID, EFX10.AL_AUXILIARY_SEND_FILTER, auxFXSlot2, 2, sendFilter2);	
	
	EFX10.alFilterf(sendFilter3, EFX10.AL_LOWPASS_GAIN, sendGain3);
	EFX10.alFilterf(sendFilter3, EFX10.AL_LOWPASS_GAINHF, sendCutoff3);
	AL11.alSource3i(sourceID, EFX10.AL_AUXILIARY_SEND_FILTER, auxFXSlot3, 3, sendFilter3);	
	
	EFX10.alFilterf(directFilter0, EFX10.AL_LOWPASS_GAIN, directGain);
	EFX10.alFilterf(directFilter0, EFX10.AL_LOWPASS_GAINHF, directCutoff);
	AL10.alSourcei(sourceID, EFX10.AL_DIRECT_FILTER, directFilter0);
	
	AL10.alSourcef(sourceID, EFX10.AL_AIR_ABSORPTION_FACTOR, SoundPhysicsCore.Config.airAbsorption);
}
 
开发者ID:sonicether,项目名称:Sound-Physics,代码行数:27,代码来源:SoundPhysics.java

示例2: initAudioApp

import org.lwjgl.openal.AL11; //导入依赖的package包/类
@Override
public void initAudioApp(){
    assetManager.registerLocator("C:\\", FileLocator.class);
    
    Quaternion q = new Quaternion();
    q.lookAt(new Vector3f(0, 0, -1f), Vector3f.UNIT_Y);
    listener.setRotation(q);
    
    audioRenderer.setEnvironment(Environment.Dungeon);
    AL10.alDistanceModel(AL11.AL_EXPONENT_DISTANCE);
    
    ufo  = new AudioNode(audioRenderer, assetManager, "test.ogg", false);
    ufo.setPositional(true);
    ufo.setLooping(true);
    ufo.setReverbEnabled(true);
    ufo.setRefDistance(100000000);
    ufo.setMaxDistance(100000000);
    audioRenderer.playSource(ufo);
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:20,代码来源:TestDoppler.java

示例3: setPlaybackPosition

import org.lwjgl.openal.AL11; //导入依赖的package包/类
@Override
public SoundSource setPlaybackPosition(int position) {
    boolean playing = isPlaying();
    if (playing) {
        AL10.alSourceStop(getSourceId());
    }

    AL10.alSourceRewind(getSourceId());
    AL10.alSourcei(getSourceId(), AL11.AL_SAMPLE_OFFSET, audio.getSamplingRate() * position);

    OpenALException.checkState("Setting sound playback absolute position");

    if (playing) {
        play();
    }

    return this;
}
 
开发者ID:zoneXcoding,项目名称:Mineworld,代码行数:19,代码来源:BasicSoundSource.java

示例4: setPosition

import org.lwjgl.openal.AL11; //导入依赖的package包/类
/**
 * @see org.newdawn.slick.openal.Audio#setPosition(float)
 */
public boolean setPosition(float position) {
	position = position % length;
	
	AL10.alSourcef(store.getSource(index), AL11.AL_SEC_OFFSET, position);
	if (AL10.alGetError() != 0) {
		return false;
	}
	return true;
}
 
开发者ID:j-dong,项目名称:trashjam2017,代码行数:13,代码来源:AudioImpl.java

示例5: clearChannel

import org.lwjgl.openal.AL11; //导入依赖的package包/类
private void clearChannel(int index){
    // make room at this channel
    if (chanSrcs[index] != null){
        AudioNode src = chanSrcs[index];

        int sourceId = channels[index];
        alSourceStop(sourceId);

        if (src.getAudioData() instanceof AudioStream){
            AudioStream str = (AudioStream) src.getAudioData();
            ib.position(0).limit(STREAMING_BUFFER_COUNT);
            ib.put(str.getIds()).flip();
            alSourceUnqueueBuffers(sourceId, ib);
        }else if (src.getAudioData() instanceof AudioBuffer){
            alSourcei(sourceId, AL_BUFFER, 0);
        }

        if (src.getDryFilter() != null){
            // detach filter
            alSourcei(sourceId, EFX10.AL_DIRECT_FILTER, EFX10.AL_FILTER_NULL);
        }
        if (src.isPositional()){
            AudioNode pas = (AudioNode) src;
            if (pas.isReverbEnabled()) {
                AL11.alSource3i(sourceId, EFX10.AL_AUXILIARY_SEND_FILTER, 0, 0, EFX10.AL_FILTER_NULL);
            }
        }

        chanSrcs[index] = null;
    }
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:32,代码来源:LwjglAudioRenderer.java

示例6: setPosition

import org.lwjgl.openal.AL11; //导入依赖的package包/类
public void setPosition (float position) {
	if (audio.noDevice) return;
	if (sourceID == -1) return;
	boolean wasPlaying = isPlaying;
	isPlaying = false;
	alSourceStop(sourceID);
	alSourceUnqueueBuffers(sourceID, buffers);
	renderedSeconds += (secondsPerBuffer * bufferCount);
	if (position <= renderedSeconds) {
		reset();
		renderedSeconds = 0;
	}
	while (renderedSeconds < (position - secondsPerBuffer)) {
		if (read(tempBytes) <= 0) break;
		renderedSeconds += secondsPerBuffer;
	}
	boolean filled = false;
	for (int i = 0; i < bufferCount; i++) {
		int bufferID = buffers.get(i);
		if (!fill(bufferID)) break;
		filled = true;
		alSourceQueueBuffers(sourceID, bufferID);
	}
	if (!filled) {
		stop();
		if (onCompletionListener != null) onCompletionListener.onCompletion(this);
	}
	alSourcef(sourceID, AL11.AL_SEC_OFFSET, position - renderedSeconds);
	if (wasPlaying) {
		alSourcePlay(sourceID);
		isPlaying = true;
	}
}
 
开发者ID:Xemiru,项目名称:Undertailor,代码行数:34,代码来源:OpenALMusic.java

示例7: playAt

import org.lwjgl.openal.AL11; //导入依赖的package包/类
/** play a sound relative to the listener */
public void playAt(ALSound sound, Vector3f pos, Vector3f velocity) {
	this.setInteger(AL10.AL_DISTANCE_MODEL, AL11.AL_LINEAR_DISTANCE);
	this.setFloatVector(AL10.AL_POSITION, pos);
	this.setFloatVector(AL10.AL_VELOCITY, velocity);
	this.play(sound, AL10.AL_TRUE);
}
 
开发者ID:rpereira-dev,项目名称:CubeEngine,代码行数:8,代码来源:ALSource.java

示例8: setPosition

import org.lwjgl.openal.AL11; //导入依赖的package包/类
@Override
public void setPosition(float position) {
    if (audio.noDevice) {
        return;
    }
    if (sourceID == -1) {
        return;
    }
    boolean wasPlaying = isPlaying;
    isPlaying = false;
    alSourceStop(sourceID);
    renderedSeconds += secondsPerBuffer;
    if (position <= renderedSeconds) {
        reset();
        renderedSeconds = 0;
    }
    while (renderedSeconds < (position - secondsPerBuffer)) {
        if (read(tempBytes) <= 0) {
            break;
        }
        renderedSeconds += secondsPerBuffer;
    }
    update();
    alSourcef(sourceID, AL11.AL_SEC_OFFSET, position - renderedSeconds);
    if (wasPlaying) {
        alSourcePlay(sourceID);
        isPlaying = true;
    }
}
 
开发者ID:kovertopz,项目名称:libGDX-LWJGL-Audio,代码行数:30,代码来源:OpenALMusic.java

示例9: getPosition

import org.lwjgl.openal.AL11; //导入依赖的package包/类
@Override
public float getPosition() {
    if (audio.noDevice) {
        return 0;
    }
    if (sourceID == -1) {
        return 0;
    }
    return renderedSeconds + alGetSourcef(sourceID, AL11.AL_SEC_OFFSET);
}
 
开发者ID:kovertopz,项目名称:libGDX-LWJGL-Audio,代码行数:11,代码来源:OpenALMusic.java

示例10: millisecondsPlayed

import org.lwjgl.openal.AL11; //导入依赖的package包/类
/**
* Calculates the number of milliseconds since the channel began playing.
* @return Milliseconds, or -1 if unable to calculate.
*/
   @Override
   public float millisecondsPlayed()
   {
       // get number of samples played in current buffer
       float offset = (float)AL10.alGetSourcei( ALSource.get( 0 ),
                                              AL11.AL_BYTE_OFFSET );

       float bytesPerFrame = 1f;
       switch( ALformat )
       {
           case AL10.AL_FORMAT_MONO8 :
               bytesPerFrame = 1f;
               break;
           case AL10.AL_FORMAT_MONO16 :
               bytesPerFrame = 2f;
               break;
           case AL10.AL_FORMAT_STEREO8 :
               bytesPerFrame = 2f;
               break;
           case AL10.AL_FORMAT_STEREO16 :
               bytesPerFrame = 4f;
               break;
           default :
               break;
       }

       offset = ( ( (float) offset / bytesPerFrame ) / (float) sampleRate )
                                                                        * 1000;

       // add the milliseconds from stream-buffers that played previously
       if( channelType == SoundSystemConfig.TYPE_STREAMING )
           offset += millisPreviouslyPlayed;

       // Return millis played:
       return( offset );
   }
 
开发者ID:kovertopz,项目名称:Paulscode-SoundSystem,代码行数:41,代码来源:ChannelLWJGLOpenAL.java

示例11: sourceSeek

import org.lwjgl.openal.AL11; //导入依赖的package包/类
public static boolean sourceSeek(int source, float secOffset) {
if (source==-1)
    return false;
AL10.alSourcef(source, AL11.AL_SEC_OFFSET, secOffset);
if (AL10.alGetError() != 0) {
    return false;
}
return true;
   }
 
开发者ID:Cr0s,项目名称:JavaRA,代码行数:10,代码来源:Soundly.java

示例12: clearChannel

import org.lwjgl.openal.AL11; //导入依赖的package包/类
private void clearChannel(int index){
    // make room at this channel
    if (chanSrcs[index] != null){
        AudioNode src = chanSrcs[index];

        int sourceId = channels[index];
        alSourceStop(sourceId);

        if (src.getAudioData() instanceof AudioStream){
            AudioStream str = (AudioStream) src.getAudioData();
            ib.position(0).limit(STREAMING_BUFFER_COUNT);
            ib.put(str.getIds()).flip();
            alSourceUnqueueBuffers(sourceId, ib);
        }else if (src.getAudioData() instanceof AudioBuffer){
            alSourcei(sourceId, AL_BUFFER, 0);
        }

        if (src.getDryFilter() != null && supportEfx){
            // detach filter
            alSourcei(sourceId, EFX10.AL_DIRECT_FILTER, EFX10.AL_FILTER_NULL);
        }
        if (src.isPositional()){
            AudioNode pas = (AudioNode) src;
            if (pas.isReverbEnabled() && supportEfx) {
                AL11.alSource3i(sourceId, EFX10.AL_AUXILIARY_SEND_FILTER, 0, 0, EFX10.AL_FILTER_NULL);
            }
        }

        chanSrcs[index] = null;
    }
}
 
开发者ID:chototsu,项目名称:MikuMikuStudio,代码行数:32,代码来源:LwjglAudioRenderer.java

示例13: simpleInitApp

import org.lwjgl.openal.AL11; //导入依赖的package包/类
@Override
public void simpleInitApp(){
    audioRenderer.setEnvironment(Environment.Dungeon);
    AL10.alDistanceModel(AL11.AL_EXPONENT_DISTANCE);
    
    ufo  = new AudioNode(assetManager, "Sound/Effects/Beep.ogg", false);
    ufo.setPositional(true);
    ufo.setLooping(true);
    ufo.setReverbEnabled(true);
    ufo.setRefDistance(100000000);
    ufo.setMaxDistance(100000000);
    ufo.play();
}
 
开发者ID:chototsu,项目名称:MikuMikuStudio,代码行数:14,代码来源:TestDoppler.java

示例14: getPosition

import org.lwjgl.openal.AL11; //导入依赖的package包/类
/**
 * @see org.newdawn.slick.openal.Audio#getPosition()
 */
public float getPosition() {
	return AL10.alGetSourcef(store.getSource(index), AL11.AL_SEC_OFFSET);
}
 
开发者ID:j-dong,项目名称:trashjam2017,代码行数:7,代码来源:AudioImpl.java

示例15: getALPosition

import org.lwjgl.openal.AL11; //导入依赖的package包/类
/**
 * Return the current playing position in the sound
 * 
 * @return The current position in seconds.
 */
public float getALPosition() {
	float playedTime = ((float) playedPos / (float) sampleSize) / sampleRate;
	float timePosition = playedTime + AL10.alGetSourcef(source, AL11.AL_SEC_OFFSET);
	return timePosition;
}
 
开发者ID:yugecin,项目名称:opsu-dance,代码行数:11,代码来源:OpenALStreamPlayer.java


注:本文中的org.lwjgl.openal.AL11类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。