Java 类org.lwjgl.openal.EFX10 实例源码

项目:Sound-Physics    文件:SoundPhysics.java   
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);
}
项目:PhET    文件:LwjglAudioRenderer.java   
public void cleanupInThread(){
    if (audioDisabled){
        AL.destroy();
        return;
    }

    // delete channel-based sources
    ib.clear();
    ib.put(channels);
    ib.flip();
    alDeleteSources(ib);

    if (supportEfx){
        ib.position(0).limit(1);
        ib.put(0, reverbFx);
        EFX10.alDeleteEffects(ib);

        ib.position(0).limit(1);
        ib.put(0, reverbFxSlot);
        EFX10.alDeleteAuxiliaryEffectSlots(ib);
    }

    // XXX: Delete other buffers/sources
    AL.destroy();
}
项目:PhET    文件:LwjglAudioRenderer.java   
private void updateFilter(Filter f){
    int id = f.getId();
    if (id == -1){
        ib.position(0).limit(1);
        EFX10.alGenFilters(ib);
        id = ib.get(0);
        f.setId(id);
    }

    if (f instanceof LowPassFilter){
        LowPassFilter lpf = (LowPassFilter) f;
        EFX10.alFilteri(id, EFX10.AL_FILTER_TYPE,    EFX10.AL_FILTER_LOWPASS);
        EFX10.alFilterf(id, EFX10.AL_LOWPASS_GAIN,   lpf.getVolume());
        EFX10.alFilterf(id, EFX10.AL_LOWPASS_GAINHF, lpf.getHighFreqVolume());
    }else{
        throw new UnsupportedOperationException("Filter type unsupported: "+
                                                f.getClass().getName());
    }

    f.clearUpdateNeeded();
}
项目:MikuMikuStudio    文件:LwjglAudioRenderer.java   
private void updateFilter(Filter f){
    int id = f.getId();
    if (id == -1){
        ib.position(0).limit(1);
        EFX10.alGenFilters(ib);
        id = ib.get(0);
        f.setId(id);

        objManager.registerForCleanup(f);
    }

    if (f instanceof LowPassFilter){
        LowPassFilter lpf = (LowPassFilter) f;
        EFX10.alFilteri(id, EFX10.AL_FILTER_TYPE,    EFX10.AL_FILTER_LOWPASS);
        EFX10.alFilterf(id, EFX10.AL_LOWPASS_GAIN,   lpf.getVolume());
        EFX10.alFilterf(id, EFX10.AL_LOWPASS_GAINHF, lpf.getHighFreqVolume());
    }else{
        throw new UnsupportedOperationException("Filter type unsupported: "+
                                                f.getClass().getName());
    }

    f.clearUpdateNeeded();
}
项目:PhET    文件:EFX10Test.java   
/**
 * Loads OpenAL and makes sure ALC_EXT_EFX is supported.
 */
private static void setupEfx() throws Exception {
    // Load and create OpenAL
    if (!AL.isCreated()) {
        AL.create();
    }
    // Query for Effect Extension
    if (!ALC10.alcIsExtensionPresent(AL.getDevice(), EFX10.ALC_EXT_EFX_NAME)) {
        throw new Exception("No ALC_EXT_EFX supported by driver.");
    }
    System.out.println("ALC_EXT_EFX found.");
}
项目:PhET    文件:LwjglAudioRenderer.java   
public void setEnvironment(Environment env){
    checkDead();
    synchronized (threadLock){
        while (!threadLock.get()){
            try {
                threadLock.wait();
            } catch (InterruptedException ex) {
            }
        }
        if (audioDisabled)
            return;

        EFX10.alEffectf(reverbFx, EFX10.AL_REVERB_DENSITY,             env.getDensity());
        EFX10.alEffectf(reverbFx, EFX10.AL_REVERB_DIFFUSION,           env.getDiffusion());
        EFX10.alEffectf(reverbFx, EFX10.AL_REVERB_GAIN,                env.getGain());
        EFX10.alEffectf(reverbFx, EFX10.AL_REVERB_GAINHF,              env.getGainHf());
        EFX10.alEffectf(reverbFx, EFX10.AL_REVERB_DECAY_TIME,          env.getDecayTime());
        EFX10.alEffectf(reverbFx, EFX10.AL_REVERB_DECAY_HFRATIO,       env.getDecayHFRatio());
        EFX10.alEffectf(reverbFx, EFX10.AL_REVERB_REFLECTIONS_GAIN,    env.getReflectGain());
        EFX10.alEffectf(reverbFx, EFX10.AL_REVERB_REFLECTIONS_DELAY,   env.getReflectDelay());
        EFX10.alEffectf(reverbFx, EFX10.AL_REVERB_LATE_REVERB_GAIN,    env.getLateReverbGain());
        EFX10.alEffectf(reverbFx, EFX10.AL_REVERB_LATE_REVERB_DELAY,   env.getLateReverbDelay());
        EFX10.alEffectf(reverbFx, EFX10.AL_REVERB_AIR_ABSORPTION_GAINHF, env.getAirAbsorbGainHf());
        EFX10.alEffectf(reverbFx, EFX10.AL_REVERB_ROOM_ROLLOFF_FACTOR, env.getRoomRolloffFactor());

        // attach effect to slot
        EFX10.alAuxiliaryEffectSloti(reverbFxSlot, EFX10.AL_EFFECTSLOT_EFFECT, reverbFx);
    }
}
项目:PhET    文件:LwjglAudioRenderer.java   
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;
    }
}
项目:Wolf_game    文件:EFX10Test.java   
/**
 * Loads OpenAL and makes sure ALC_EXT_EFX is supported.
 */
private static void setupEfx() throws Exception {
    // Load and create OpenAL
    if (!AL.isCreated()) {
        AL.create();
    }
    // Query for Effect Extension
    if (!ALC10.alcIsExtensionPresent(AL.getDevice(), EFX10.ALC_EXT_EFX_NAME)) {
        throw new Exception("No ALC_EXT_EFX supported by driver.");
    }
    System.out.println("ALC_EXT_EFX found.");
}
项目:GPVM    文件:EFX10Test.java   
/**
 * Loads OpenAL and makes sure ALC_EXT_EFX is supported.
 */
private static void setupEfx() throws Exception {
    // Load and create OpenAL
    if (!AL.isCreated()) {
        AL.create();
    }
    // Query for Effect Extension
    if (!ALC10.alcIsExtensionPresent(AL.getDevice(), EFX10.ALC_EXT_EFX_NAME)) {
        throw new Exception("No ALC_EXT_EFX supported by driver.");
    }
    System.out.println("ALC_EXT_EFX found.");
}
项目:GPVM    文件:EFX10Test.java   
/**
 * Loads OpenAL and makes sure ALC_EXT_EFX is supported.
 */
private static void setupEfx() throws Exception {
    // Load and create OpenAL
    if (!AL.isCreated()) {
        AL.create();
    }
    // Query for Effect Extension
    if (!ALC10.alcIsExtensionPresent(AL.getDevice(), EFX10.ALC_EXT_EFX_NAME)) {
        throw new Exception("No ALC_EXT_EFX supported by driver.");
    }
    System.out.println("ALC_EXT_EFX found.");
}
项目:SpaceStationAlpha    文件:EFX10Test.java   
/**
 * Loads OpenAL and makes sure ALC_EXT_EFX is supported.
 */
private static void setupEfx() throws Exception {
    // Load and create OpenAL
    if (!AL.isCreated()) {
        AL.create();
    }
    // Query for Effect Extension
    if (!ALC10.alcIsExtensionPresent(AL.getDevice(), EFX10.ALC_EXT_EFX_NAME)) {
        throw new Exception("No ALC_EXT_EFX supported by driver.");
    }
    System.out.println("ALC_EXT_EFX found.");
}
项目:TeacherSmash    文件:EFX10Test.java   
/**
 * Loads OpenAL and makes sure ALC_EXT_EFX is supported.
 */
private static void setupEfx() throws Exception {
    // Load and create OpenAL
    if (!AL.isCreated()) {
        AL.create();
    }
    // Query for Effect Extension
    if (!ALC10.alcIsExtensionPresent(AL.getDevice(), EFX10.ALC_EXT_EFX_NAME)) {
        throw new Exception("No ALC_EXT_EFX supported by driver.");
    }
    System.out.println("ALC_EXT_EFX found.");
}
项目:3d-Demo    文件:EFX10Test.java   
/**
 * Loads OpenAL and makes sure ALC_EXT_EFX is supported.
 */
private static void setupEfx() throws Exception {
    // Load and create OpenAL
    if (!AL.isCreated()) {
        AL.create();
    }
    // Query for Effect Extension
    if (!ALC10.alcIsExtensionPresent(AL.getDevice(), EFX10.ALC_EXT_EFX_NAME)) {
        throw new Exception("No ALC_EXT_EFX supported by driver.");
    }
    System.out.println("ALC_EXT_EFX found.");
}
项目:MikuMikuStudio    文件:LwjglAudioRenderer.java   
public void cleanupInThread(){
    if (audioDisabled){
        AL.destroy();
        return;
    }

    // stop any playing channels
    for (int i = 0; i < chanSrcs.length; i++){
        if (chanSrcs[i] != null){
            clearChannel(i);
        }
    }

    // delete channel-based sources
    ib.clear();
    ib.put(channels);
    ib.flip();
    alDeleteSources(ib);

    // delete audio buffers and filters
    objManager.deleteAllObjects(this);

    if (supportEfx){
        ib.position(0).limit(1);
        ib.put(0, reverbFx);
        EFX10.alDeleteEffects(ib);

        // If this is not allocated, why is it deleted?
        // Commented out to fix native crash in OpenAL.
        ib.position(0).limit(1);
        ib.put(0, reverbFxSlot);
        EFX10.alDeleteAuxiliaryEffectSlots(ib);
    }

    AL.destroy();
}
项目:MikuMikuStudio    文件:LwjglAudioRenderer.java   
public void setEnvironment(Environment env){
    checkDead();
    synchronized (threadLock){
        while (!threadLock.get()){
            try {
                threadLock.wait();
            } catch (InterruptedException ex) {
            }
        }
        if (audioDisabled || !supportEfx)
            return;

        EFX10.alEffectf(reverbFx, EFX10.AL_REVERB_DENSITY,             env.getDensity());
        EFX10.alEffectf(reverbFx, EFX10.AL_REVERB_DIFFUSION,           env.getDiffusion());
        EFX10.alEffectf(reverbFx, EFX10.AL_REVERB_GAIN,                env.getGain());
        EFX10.alEffectf(reverbFx, EFX10.AL_REVERB_GAINHF,              env.getGainHf());
        EFX10.alEffectf(reverbFx, EFX10.AL_REVERB_DECAY_TIME,          env.getDecayTime());
        EFX10.alEffectf(reverbFx, EFX10.AL_REVERB_DECAY_HFRATIO,       env.getDecayHFRatio());
        EFX10.alEffectf(reverbFx, EFX10.AL_REVERB_REFLECTIONS_GAIN,    env.getReflectGain());
        EFX10.alEffectf(reverbFx, EFX10.AL_REVERB_REFLECTIONS_DELAY,   env.getReflectDelay());
        EFX10.alEffectf(reverbFx, EFX10.AL_REVERB_LATE_REVERB_GAIN,    env.getLateReverbGain());
        EFX10.alEffectf(reverbFx, EFX10.AL_REVERB_LATE_REVERB_DELAY,   env.getLateReverbDelay());
        EFX10.alEffectf(reverbFx, EFX10.AL_REVERB_AIR_ABSORPTION_GAINHF, env.getAirAbsorbGainHf());
        EFX10.alEffectf(reverbFx, EFX10.AL_REVERB_ROOM_ROLLOFF_FACTOR, env.getRoomRolloffFactor());

        // attach effect to slot
        EFX10.alAuxiliaryEffectSloti(reverbFxSlot, EFX10.AL_EFFECTSLOT_EFFECT, reverbFx);
    }
}
项目:MikuMikuStudio    文件:LwjglAudioRenderer.java   
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;
    }
}
项目:Sound-Physics    文件:SoundPhysics.java   
private static void setupEFX()
{
    //Get current context and device
    ALCcontext currentContext = ALC10.alcGetCurrentContext();
    ALCdevice currentDevice = ALC10.alcGetContextsDevice(currentContext);       

    if (ALC10.alcIsExtensionPresent(currentDevice, "ALC_EXT_EFX"))
    {
        log("EFX Extension recognized.");
    }
    else
    {
        logError("EFX Extension not found on current device. Aborting.");
        return;
    }

    //Create auxiliary effect slots
    auxFXSlot0 = EFX10.alGenAuxiliaryEffectSlots();
    log("Aux slot " + auxFXSlot0 + " created");
    EFX10.alAuxiliaryEffectSloti(auxFXSlot0, EFX10.AL_EFFECTSLOT_AUXILIARY_SEND_AUTO, AL10.AL_TRUE);

    auxFXSlot1 = EFX10.alGenAuxiliaryEffectSlots();
    log("Aux slot " + auxFXSlot1 + " created");
    EFX10.alAuxiliaryEffectSloti(auxFXSlot1, EFX10.AL_EFFECTSLOT_AUXILIARY_SEND_AUTO, AL10.AL_TRUE);

    auxFXSlot2 = EFX10.alGenAuxiliaryEffectSlots();
    log("Aux slot " + auxFXSlot2 + " created");
    EFX10.alAuxiliaryEffectSloti(auxFXSlot2, EFX10.AL_EFFECTSLOT_AUXILIARY_SEND_AUTO, AL10.AL_TRUE);

    auxFXSlot3 = EFX10.alGenAuxiliaryEffectSlots();
    log("Aux slot " + auxFXSlot3 + " created");
    EFX10.alAuxiliaryEffectSloti(auxFXSlot3, EFX10.AL_EFFECTSLOT_AUXILIARY_SEND_AUTO, AL10.AL_TRUE);    
    checkErrorLog("Failed creating auxiliary effect slots!");


    //Create effect objects
    reverb0 = EFX10.alGenEffects();                                             //Create effect object
    EFX10.alEffecti(reverb0, EFX10.AL_EFFECT_TYPE, EFX10.AL_EFFECT_EAXREVERB);      //Set effect object to be reverb
    checkErrorLog("Failed creating reverb effect slot 0!");
    reverb1 = EFX10.alGenEffects();                                             //Create effect object
    EFX10.alEffecti(reverb1, EFX10.AL_EFFECT_TYPE, EFX10.AL_EFFECT_EAXREVERB);      //Set effect object to be reverb
    checkErrorLog("Failed creating reverb effect slot 1!");
    reverb2 = EFX10.alGenEffects();                                             //Create effect object
    EFX10.alEffecti(reverb2, EFX10.AL_EFFECT_TYPE, EFX10.AL_EFFECT_EAXREVERB);      //Set effect object to be reverb
    checkErrorLog("Failed creating reverb effect slot 2!");
    reverb3 = EFX10.alGenEffects();                                             //Create effect object
    EFX10.alEffecti(reverb3, EFX10.AL_EFFECT_TYPE, EFX10.AL_EFFECT_EAXREVERB);      //Set effect object to be reverb
    checkErrorLog("Failed creating reverb effect slot 3!");

    //Create filters
    directFilter0 = EFX10.alGenFilters();
    EFX10.alFilteri(directFilter0, EFX10.AL_FILTER_TYPE, EFX10.AL_FILTER_LOWPASS);

    sendFilter0 = EFX10.alGenFilters();
    EFX10.alFilteri(sendFilter0, EFX10.AL_FILTER_TYPE, EFX10.AL_FILTER_LOWPASS);

    sendFilter1 = EFX10.alGenFilters();
    EFX10.alFilteri(sendFilter1, EFX10.AL_FILTER_TYPE, EFX10.AL_FILTER_LOWPASS);

    sendFilter2 = EFX10.alGenFilters();
    EFX10.alFilteri(sendFilter2, EFX10.AL_FILTER_TYPE, EFX10.AL_FILTER_LOWPASS);

    sendFilter3 = EFX10.alGenFilters();
    EFX10.alFilteri(sendFilter3, EFX10.AL_FILTER_TYPE, EFX10.AL_FILTER_LOWPASS);
    checkErrorLog("Error creating lowpass filters!");

    applyConfigChanges();

    //setReverbParams(ReverbParams.getReverb0(), auxFXSlot0, reverb0);      //Set the global reverb parameters and apply them to the effect and effectslot      
    //setReverbParams(ReverbParams.getReverb1(), auxFXSlot1, reverb1);      //Set the global reverb parameters and apply them to the effect and effectslot      
    //setReverbParams(ReverbParams.getReverb2(), auxFXSlot2, reverb2);      //Set the global reverb parameters and apply them to the effect and effectslot      
    //setReverbParams(ReverbParams.getReverb3(), auxFXSlot3, reverb3);      //Set the global reverb parameters and apply them to the effect and effectslot      
}
项目:Sound-Physics    文件:SoundPhysics.java   
/**
 * Applies the parameters in the enum ReverbParams to the main reverb effect.
 */
protected static void setReverbParams(ReverbParams r, int auxFXSlot, int reverbSlot)
{
    /*
    EFX10.alEffectf(reverbSlot, EFX10.AL_REVERB_DECAY_TIME, r.decayTime);       //Set default parameters
    EFX10.alEffectf(reverbSlot, EFX10.AL_REVERB_DENSITY, r.density);
    EFX10.alEffectf(reverbSlot, EFX10.AL_REVERB_DIFFUSION, r.diffusion);
    EFX10.alEffectf(reverbSlot, EFX10.AL_REVERB_GAIN, r.gain);
    EFX10.alEffectf(reverbSlot, EFX10.AL_REVERB_GAINHF, r.gainHF);
    EFX10.alEffectf(reverbSlot, EFX10.AL_REVERB_DECAY_HFRATIO, r.decayHFRatio);
    EFX10.alEffectf(reverbSlot, EFX10.AL_REVERB_REFLECTIONS_GAIN, r.reflectionsGain);
    EFX10.alEffectf(reverbSlot, EFX10.AL_REVERB_REFLECTIONS_DELAY, r.reflectionsDelay);
    EFX10.alEffectf(reverbSlot, EFX10.AL_REVERB_LATE_REVERB_GAIN, r.lateReverbGain);
    EFX10.alEffectf(reverbSlot, EFX10.AL_REVERB_LATE_REVERB_DELAY, r.lateReverbDelay);
    EFX10.alEffectf(reverbSlot, EFX10.AL_REVERB_AIR_ABSORPTION_GAINHF, r.airAbsorptionGainHF);
    EFX10.alEffectf(reverbSlot, EFX10.AL_REVERB_ROOM_ROLLOFF_FACTOR, r.roomRolloffFactor);
    EFX10.alEffecti(reverbSlot, EFX10.AL_REVERB_DECAY_HFLIMIT, AL10.AL_TRUE);
    */

    EFX10.alEffectf(reverbSlot, EFX10.AL_EAXREVERB_DENSITY, r.density);     //Set default parameters
    checkErrorLog("Error while assigning reverb density: " + r.density);
    EFX10.alEffectf(reverbSlot, EFX10.AL_EAXREVERB_DIFFUSION, r.diffusion);     //Set default parameters
    checkErrorLog("Error while assigning reverb diffusion: " + r.diffusion);
    EFX10.alEffectf(reverbSlot, EFX10.AL_EAXREVERB_GAIN, r.gain);       //Set default parameters
    checkErrorLog("Error while assigning reverb gain: " + r.gain);
    EFX10.alEffectf(reverbSlot, EFX10.AL_EAXREVERB_GAINHF, r.gainHF);       //Set default parameters
    checkErrorLog("Error while assigning reverb gainHF: " + r.gainHF);
    EFX10.alEffectf(reverbSlot, EFX10.AL_EAXREVERB_DECAY_TIME, r.decayTime);        //Set default parameters
    checkErrorLog("Error while assigning reverb decayTime: " + r.decayTime);
    EFX10.alEffectf(reverbSlot, EFX10.AL_EAXREVERB_DECAY_HFRATIO, r.decayHFRatio);      //Set default parameters
    checkErrorLog("Error while assigning reverb decayHFRatio: " + r.decayHFRatio);
    EFX10.alEffectf(reverbSlot, EFX10.AL_EAXREVERB_REFLECTIONS_GAIN, r.reflectionsGain);        //Set default parameters
    checkErrorLog("Error while assigning reverb reflectionsGain: " + r.reflectionsGain);
    EFX10.alEffectf(reverbSlot, EFX10.AL_EAXREVERB_LATE_REVERB_GAIN, r.lateReverbGain);     //Set default parameters
    checkErrorLog("Error while assigning reverb lateReverbGain: " + r.lateReverbGain);
    EFX10.alEffectf(reverbSlot, EFX10.AL_EAXREVERB_LATE_REVERB_DELAY, r.lateReverbDelay);       //Set default parameters
    checkErrorLog("Error while assigning reverb lateReverbDelay: " + r.lateReverbDelay);
    EFX10.alEffectf(reverbSlot, EFX10.AL_EAXREVERB_AIR_ABSORPTION_GAINHF, r.airAbsorptionGainHF);       //Set default parameters
    checkErrorLog("Error while assigning reverb airAbsorptionGainHF: " + r.airAbsorptionGainHF);
    EFX10.alEffectf(reverbSlot, EFX10.AL_EAXREVERB_ROOM_ROLLOFF_FACTOR, r.roomRolloffFactor);       //Set default parameters
    checkErrorLog("Error while assigning reverb roomRolloffFactor: " + r.roomRolloffFactor);


    //Attach updated effect object
    EFX10.alAuxiliaryEffectSloti(auxFXSlot, EFX10.AL_EFFECTSLOT_EFFECT, reverbSlot);
}
项目:PhET    文件:EFX10Test.java   
/**
 * Plays a sound with various effects applied to it.
 */
private static void playbackTest() throws Exception {
    setupEfx();

    // Create a source and buffer audio data
    final int source = AL10.alGenSources();
    final int buffer = AL10.alGenBuffers();
    WaveData waveFile = WaveData.create("Footsteps.wav");
    if (waveFile == null) {
        System.out.println("Failed to load Footsteps.wav! Skipping playback test.");
        AL.destroy();
        return;
    }
    AL10.alBufferData(buffer, waveFile.format, waveFile.data, waveFile.samplerate);
    waveFile.dispose();
    AL10.alSourcei(source, AL10.AL_BUFFER, buffer);
    AL10.alSourcei(source, AL10.AL_LOOPING, AL10.AL_TRUE);

    System.out.println("Playing sound unaffected by EFX ...");
    AL10.alSourcePlay(source);
    Thread.sleep(7500);

    // Add reverb effect
    final int effectSlot = EFX10.alGenAuxiliaryEffectSlots();
    final int reverbEffect = EFX10.alGenEffects();
    EFX10.alEffecti(reverbEffect, EFX10.AL_EFFECT_TYPE, EFX10.AL_EFFECT_REVERB);
    EFX10.alEffectf(reverbEffect, EFX10.AL_REVERB_DECAY_TIME, 5.0f);
    EFX10.alAuxiliaryEffectSloti(effectSlot, EFX10.AL_EFFECTSLOT_EFFECT, reverbEffect);
    AL11.alSource3i(source, EFX10.AL_AUXILIARY_SEND_FILTER, effectSlot, 0,
            EFX10.AL_FILTER_NULL);

    System.out.println("Playing sound with reverb ...");
    AL10.alSourcePlay(source);
    Thread.sleep(7500);

    // Add low-pass filter directly to source
    final int filter = EFX10.alGenFilters();
    EFX10.alFilteri(filter, EFX10.AL_FILTER_TYPE, EFX10.AL_FILTER_LOWPASS);
    EFX10.alFilterf(filter, EFX10.AL_LOWPASS_GAIN, 0.5f);
    EFX10.alFilterf(filter, EFX10.AL_LOWPASS_GAINHF, 0.5f);
    AL10.alSourcei(source, EFX10.AL_DIRECT_FILTER, filter);

    System.out.println("Playing sound with reverb and direct low pass filter ...");
    AL10.alSourcePlay(source);
    Thread.sleep(7500);
    AL10.alSourcei(source, EFX10.AL_DIRECT_FILTER, EFX10.AL_FILTER_NULL);

    // Add low-pass filter to source send
    //AL11.alSource3i(source, EFX10.AL_AUXILIARY_SEND_FILTER, effectSlot, 0, filter);
    //
    //System.out.println("Playing sound with reverb and aux send low pass filter ...");
    //AL10.alSourcePlay(source);
    //Thread.sleep(7500);

    // Cleanup
    AL11.alSource3i(source, EFX10.AL_AUXILIARY_SEND_FILTER, EFX10.AL_EFFECTSLOT_NULL, 0,
            EFX10.AL_FILTER_NULL);
    EFX10.alAuxiliaryEffectSloti(effectSlot, EFX10.AL_EFFECTSLOT_EFFECT, EFX10.AL_EFFECT_NULL);
    EFX10.alDeleteEffects(reverbEffect);
    EFX10.alDeleteFilters(filter);

    // Echo effect
    final int echoEffect = EFX10.alGenEffects();
    EFX10.alEffecti(echoEffect, EFX10.AL_EFFECT_TYPE, EFX10.AL_EFFECT_ECHO);
    //EFX10.alEffectf(echoEffect, EFX10.AL_ECHO_DELAY, 5.0f);
    EFX10.alAuxiliaryEffectSloti(effectSlot, EFX10.AL_EFFECTSLOT_EFFECT, echoEffect);
    AL11.alSource3i(source, EFX10.AL_AUXILIARY_SEND_FILTER, effectSlot, 0,
            EFX10.AL_FILTER_NULL);

    System.out.println("Playing sound with echo effect ...");
    AL10.alSourcePlay(source);
    Thread.sleep(7500);

    AL.destroy();
}
项目:Wolf_game    文件:EFX10Test.java   
/**
 * Plays a sound with various effects applied to it.
 */
private static void playbackTest() throws Exception {
    setupEfx();

    // Create a source and buffer audio data
    final int source = AL10.alGenSources();
    final int buffer = AL10.alGenBuffers();
    WaveData waveFile = WaveData.create("Footsteps.wav");
    if (waveFile == null) {
        System.out.println("Failed to load Footsteps.wav! Skipping playback test.");
        AL.destroy();
        return;
    }
    AL10.alBufferData(buffer, waveFile.format, waveFile.data, waveFile.samplerate);
    waveFile.dispose();
    AL10.alSourcei(source, AL10.AL_BUFFER, buffer);
    AL10.alSourcei(source, AL10.AL_LOOPING, AL10.AL_TRUE);

    System.out.println("Playing sound unaffected by EFX ...");
    AL10.alSourcePlay(source);
    Thread.sleep(7500);

    // Add reverb effect
    final int effectSlot = EFX10.alGenAuxiliaryEffectSlots();
    final int reverbEffect = EFX10.alGenEffects();
    EFX10.alEffecti(reverbEffect, EFX10.AL_EFFECT_TYPE, EFX10.AL_EFFECT_REVERB);
    EFX10.alEffectf(reverbEffect, EFX10.AL_REVERB_DECAY_TIME, 5.0f);
    EFX10.alAuxiliaryEffectSloti(effectSlot, EFX10.AL_EFFECTSLOT_EFFECT, reverbEffect);
    AL11.alSource3i(source, EFX10.AL_AUXILIARY_SEND_FILTER, effectSlot, 0,
            EFX10.AL_FILTER_NULL);

    System.out.println("Playing sound with reverb ...");
    AL10.alSourcePlay(source);
    Thread.sleep(7500);

    // Add low-pass filter directly to source
    final int filter = EFX10.alGenFilters();
    EFX10.alFilteri(filter, EFX10.AL_FILTER_TYPE, EFX10.AL_FILTER_LOWPASS);
    EFX10.alFilterf(filter, EFX10.AL_LOWPASS_GAIN, 0.5f);
    EFX10.alFilterf(filter, EFX10.AL_LOWPASS_GAINHF, 0.5f);
    AL10.alSourcei(source, EFX10.AL_DIRECT_FILTER, filter);

    System.out.println("Playing sound with reverb and direct low pass filter ...");
    AL10.alSourcePlay(source);
    Thread.sleep(7500);
    AL10.alSourcei(source, EFX10.AL_DIRECT_FILTER, EFX10.AL_FILTER_NULL);

    // Add low-pass filter to source send
    //AL11.alSource3i(source, EFX10.AL_AUXILIARY_SEND_FILTER, effectSlot, 0, filter);
    //
    //System.out.println("Playing sound with reverb and aux send low pass filter ...");
    //AL10.alSourcePlay(source);
    //Thread.sleep(7500);

    // Cleanup
    AL11.alSource3i(source, EFX10.AL_AUXILIARY_SEND_FILTER, EFX10.AL_EFFECTSLOT_NULL, 0,
            EFX10.AL_FILTER_NULL);
    EFX10.alAuxiliaryEffectSloti(effectSlot, EFX10.AL_EFFECTSLOT_EFFECT, EFX10.AL_EFFECT_NULL);
    EFX10.alDeleteEffects(reverbEffect);
    EFX10.alDeleteFilters(filter);

    // Echo effect
    final int echoEffect = EFX10.alGenEffects();
    EFX10.alEffecti(echoEffect, EFX10.AL_EFFECT_TYPE, EFX10.AL_EFFECT_ECHO);
    //EFX10.alEffectf(echoEffect, EFX10.AL_ECHO_DELAY, 5.0f);
    EFX10.alAuxiliaryEffectSloti(effectSlot, EFX10.AL_EFFECTSLOT_EFFECT, echoEffect);
    AL11.alSource3i(source, EFX10.AL_AUXILIARY_SEND_FILTER, effectSlot, 0,
            EFX10.AL_FILTER_NULL);

    System.out.println("Playing sound with echo effect ...");
    AL10.alSourcePlay(source);
    Thread.sleep(7500);

    AL.destroy();
}
项目:GPVM    文件:EFX10Test.java   
/**
 * Plays a sound with various effects applied to it.
 */
private static void playbackTest() throws Exception {
    setupEfx();

    // Create a source and buffer audio data
    final int source = AL10.alGenSources();
    final int buffer = AL10.alGenBuffers();
    WaveData waveFile = WaveData.create("Footsteps.wav");
    if (waveFile == null) {
        System.out.println("Failed to load Footsteps.wav! Skipping playback test.");
        AL.destroy();
        return;
    }
    AL10.alBufferData(buffer, waveFile.format, waveFile.data, waveFile.samplerate);
    waveFile.dispose();
    AL10.alSourcei(source, AL10.AL_BUFFER, buffer);
    AL10.alSourcei(source, AL10.AL_LOOPING, AL10.AL_TRUE);

    System.out.println("Playing sound unaffected by EFX ...");
    AL10.alSourcePlay(source);
    Thread.sleep(7500);

    // Add reverb effect
    final int effectSlot = EFX10.alGenAuxiliaryEffectSlots();
    final int reverbEffect = EFX10.alGenEffects();
    EFX10.alEffecti(reverbEffect, EFX10.AL_EFFECT_TYPE, EFX10.AL_EFFECT_REVERB);
    EFX10.alEffectf(reverbEffect, EFX10.AL_REVERB_DECAY_TIME, 5.0f);
    EFX10.alAuxiliaryEffectSloti(effectSlot, EFX10.AL_EFFECTSLOT_EFFECT, reverbEffect);
    AL11.alSource3i(source, EFX10.AL_AUXILIARY_SEND_FILTER, effectSlot, 0,
            EFX10.AL_FILTER_NULL);

    System.out.println("Playing sound with reverb ...");
    AL10.alSourcePlay(source);
    Thread.sleep(7500);

    // Add low-pass filter directly to source
    final int filter = EFX10.alGenFilters();
    EFX10.alFilteri(filter, EFX10.AL_FILTER_TYPE, EFX10.AL_FILTER_LOWPASS);
    EFX10.alFilterf(filter, EFX10.AL_LOWPASS_GAIN, 0.5f);
    EFX10.alFilterf(filter, EFX10.AL_LOWPASS_GAINHF, 0.5f);
    AL10.alSourcei(source, EFX10.AL_DIRECT_FILTER, filter);

    System.out.println("Playing sound with reverb and direct low pass filter ...");
    AL10.alSourcePlay(source);
    Thread.sleep(7500);
    AL10.alSourcei(source, EFX10.AL_DIRECT_FILTER, EFX10.AL_FILTER_NULL);

    // Add low-pass filter to source send
    //AL11.alSource3i(source, EFX10.AL_AUXILIARY_SEND_FILTER, effectSlot, 0, filter);
    //
    //System.out.println("Playing sound with reverb and aux send low pass filter ...");
    //AL10.alSourcePlay(source);
    //Thread.sleep(7500);

    // Cleanup
    AL11.alSource3i(source, EFX10.AL_AUXILIARY_SEND_FILTER, EFX10.AL_EFFECTSLOT_NULL, 0,
            EFX10.AL_FILTER_NULL);
    EFX10.alAuxiliaryEffectSloti(effectSlot, EFX10.AL_EFFECTSLOT_EFFECT, EFX10.AL_EFFECT_NULL);
    EFX10.alDeleteEffects(reverbEffect);
    EFX10.alDeleteFilters(filter);

    // Echo effect
    final int echoEffect = EFX10.alGenEffects();
    EFX10.alEffecti(echoEffect, EFX10.AL_EFFECT_TYPE, EFX10.AL_EFFECT_ECHO);
    //EFX10.alEffectf(echoEffect, EFX10.AL_ECHO_DELAY, 5.0f);
    EFX10.alAuxiliaryEffectSloti(effectSlot, EFX10.AL_EFFECTSLOT_EFFECT, echoEffect);
    AL11.alSource3i(source, EFX10.AL_AUXILIARY_SEND_FILTER, effectSlot, 0,
            EFX10.AL_FILTER_NULL);

    System.out.println("Playing sound with echo effect ...");
    AL10.alSourcePlay(source);
    Thread.sleep(7500);

    AL.destroy();
}
项目:GPVM    文件:EFX10Test.java   
/**
 * Plays a sound with various effects applied to it.
 */
private static void playbackTest() throws Exception {
    setupEfx();

    // Create a source and buffer audio data
    final int source = AL10.alGenSources();
    final int buffer = AL10.alGenBuffers();
    WaveData waveFile = WaveData.create("Footsteps.wav");
    if (waveFile == null) {
        System.out.println("Failed to load Footsteps.wav! Skipping playback test.");
        AL.destroy();
        return;
    }
    AL10.alBufferData(buffer, waveFile.format, waveFile.data, waveFile.samplerate);
    waveFile.dispose();
    AL10.alSourcei(source, AL10.AL_BUFFER, buffer);
    AL10.alSourcei(source, AL10.AL_LOOPING, AL10.AL_TRUE);

    System.out.println("Playing sound unaffected by EFX ...");
    AL10.alSourcePlay(source);
    Thread.sleep(7500);

    // Add reverb effect
    final int effectSlot = EFX10.alGenAuxiliaryEffectSlots();
    final int reverbEffect = EFX10.alGenEffects();
    EFX10.alEffecti(reverbEffect, EFX10.AL_EFFECT_TYPE, EFX10.AL_EFFECT_REVERB);
    EFX10.alEffectf(reverbEffect, EFX10.AL_REVERB_DECAY_TIME, 5.0f);
    EFX10.alAuxiliaryEffectSloti(effectSlot, EFX10.AL_EFFECTSLOT_EFFECT, reverbEffect);
    AL11.alSource3i(source, EFX10.AL_AUXILIARY_SEND_FILTER, effectSlot, 0,
            EFX10.AL_FILTER_NULL);

    System.out.println("Playing sound with reverb ...");
    AL10.alSourcePlay(source);
    Thread.sleep(7500);

    // Add low-pass filter directly to source
    final int filter = EFX10.alGenFilters();
    EFX10.alFilteri(filter, EFX10.AL_FILTER_TYPE, EFX10.AL_FILTER_LOWPASS);
    EFX10.alFilterf(filter, EFX10.AL_LOWPASS_GAIN, 0.5f);
    EFX10.alFilterf(filter, EFX10.AL_LOWPASS_GAINHF, 0.5f);
    AL10.alSourcei(source, EFX10.AL_DIRECT_FILTER, filter);

    System.out.println("Playing sound with reverb and direct low pass filter ...");
    AL10.alSourcePlay(source);
    Thread.sleep(7500);
    AL10.alSourcei(source, EFX10.AL_DIRECT_FILTER, EFX10.AL_FILTER_NULL);

    // Add low-pass filter to source send
    //AL11.alSource3i(source, EFX10.AL_AUXILIARY_SEND_FILTER, effectSlot, 0, filter);
    //
    //System.out.println("Playing sound with reverb and aux send low pass filter ...");
    //AL10.alSourcePlay(source);
    //Thread.sleep(7500);

    // Cleanup
    AL11.alSource3i(source, EFX10.AL_AUXILIARY_SEND_FILTER, EFX10.AL_EFFECTSLOT_NULL, 0,
            EFX10.AL_FILTER_NULL);
    EFX10.alAuxiliaryEffectSloti(effectSlot, EFX10.AL_EFFECTSLOT_EFFECT, EFX10.AL_EFFECT_NULL);
    EFX10.alDeleteEffects(reverbEffect);
    EFX10.alDeleteFilters(filter);

    // Echo effect
    final int echoEffect = EFX10.alGenEffects();
    EFX10.alEffecti(echoEffect, EFX10.AL_EFFECT_TYPE, EFX10.AL_EFFECT_ECHO);
    //EFX10.alEffectf(echoEffect, EFX10.AL_ECHO_DELAY, 5.0f);
    EFX10.alAuxiliaryEffectSloti(effectSlot, EFX10.AL_EFFECTSLOT_EFFECT, echoEffect);
    AL11.alSource3i(source, EFX10.AL_AUXILIARY_SEND_FILTER, effectSlot, 0,
            EFX10.AL_FILTER_NULL);

    System.out.println("Playing sound with echo effect ...");
    AL10.alSourcePlay(source);
    Thread.sleep(7500);

    AL.destroy();
}
项目:SpaceStationAlpha    文件:EFX10Test.java   
/**
 * Plays a sound with various effects applied to it.
 */
private static void playbackTest() throws Exception {
    setupEfx();

    // Create a source and buffer audio data
    final int source = AL10.alGenSources();
    final int buffer = AL10.alGenBuffers();
    WaveData waveFile = WaveData.create("Footsteps.wav");
    if (waveFile == null) {
        System.out.println("Failed to load Footsteps.wav! Skipping playback test.");
        AL.destroy();
        return;
    }
    AL10.alBufferData(buffer, waveFile.format, waveFile.data, waveFile.samplerate);
    waveFile.dispose();
    AL10.alSourcei(source, AL10.AL_BUFFER, buffer);
    AL10.alSourcei(source, AL10.AL_LOOPING, AL10.AL_TRUE);

    System.out.println("Playing sound unaffected by EFX ...");
    AL10.alSourcePlay(source);
    Thread.sleep(7500);

    // Add reverb effect
    final int effectSlot = EFX10.alGenAuxiliaryEffectSlots();
    final int reverbEffect = EFX10.alGenEffects();
    EFX10.alEffecti(reverbEffect, EFX10.AL_EFFECT_TYPE, EFX10.AL_EFFECT_REVERB);
    EFX10.alEffectf(reverbEffect, EFX10.AL_REVERB_DECAY_TIME, 5.0f);
    EFX10.alAuxiliaryEffectSloti(effectSlot, EFX10.AL_EFFECTSLOT_EFFECT, reverbEffect);
    AL11.alSource3i(source, EFX10.AL_AUXILIARY_SEND_FILTER, effectSlot, 0,
            EFX10.AL_FILTER_NULL);

    System.out.println("Playing sound with reverb ...");
    AL10.alSourcePlay(source);
    Thread.sleep(7500);

    // Add low-pass filter directly to source
    final int filter = EFX10.alGenFilters();
    EFX10.alFilteri(filter, EFX10.AL_FILTER_TYPE, EFX10.AL_FILTER_LOWPASS);
    EFX10.alFilterf(filter, EFX10.AL_LOWPASS_GAIN, 0.5f);
    EFX10.alFilterf(filter, EFX10.AL_LOWPASS_GAINHF, 0.5f);
    AL10.alSourcei(source, EFX10.AL_DIRECT_FILTER, filter);

    System.out.println("Playing sound with reverb and direct low pass filter ...");
    AL10.alSourcePlay(source);
    Thread.sleep(7500);
    AL10.alSourcei(source, EFX10.AL_DIRECT_FILTER, EFX10.AL_FILTER_NULL);

    // Add low-pass filter to source send
    //AL11.alSource3i(source, EFX10.AL_AUXILIARY_SEND_FILTER, effectSlot, 0, filter);
    //
    //System.out.println("Playing sound with reverb and aux send low pass filter ...");
    //AL10.alSourcePlay(source);
    //Thread.sleep(7500);

    // Cleanup
    AL11.alSource3i(source, EFX10.AL_AUXILIARY_SEND_FILTER, EFX10.AL_EFFECTSLOT_NULL, 0,
            EFX10.AL_FILTER_NULL);
    EFX10.alAuxiliaryEffectSloti(effectSlot, EFX10.AL_EFFECTSLOT_EFFECT, EFX10.AL_EFFECT_NULL);
    EFX10.alDeleteEffects(reverbEffect);
    EFX10.alDeleteFilters(filter);

    // Echo effect
    final int echoEffect = EFX10.alGenEffects();
    EFX10.alEffecti(echoEffect, EFX10.AL_EFFECT_TYPE, EFX10.AL_EFFECT_ECHO);
    //EFX10.alEffectf(echoEffect, EFX10.AL_ECHO_DELAY, 5.0f);
    EFX10.alAuxiliaryEffectSloti(effectSlot, EFX10.AL_EFFECTSLOT_EFFECT, echoEffect);
    AL11.alSource3i(source, EFX10.AL_AUXILIARY_SEND_FILTER, effectSlot, 0,
            EFX10.AL_FILTER_NULL);

    System.out.println("Playing sound with echo effect ...");
    AL10.alSourcePlay(source);
    Thread.sleep(7500);

    AL.destroy();
}
项目:TeacherSmash    文件:EFX10Test.java   
/**
 * Plays a sound with various effects applied to it.
 */
private static void playbackTest() throws Exception {
    setupEfx();

    // Create a source and buffer audio data
    final int source = AL10.alGenSources();
    final int buffer = AL10.alGenBuffers();
    WaveData waveFile = WaveData.create("Footsteps.wav");
    if (waveFile == null) {
        System.out.println("Failed to load Footsteps.wav! Skipping playback test.");
        AL.destroy();
        return;
    }
    AL10.alBufferData(buffer, waveFile.format, waveFile.data, waveFile.samplerate);
    waveFile.dispose();
    AL10.alSourcei(source, AL10.AL_BUFFER, buffer);
    AL10.alSourcei(source, AL10.AL_LOOPING, AL10.AL_TRUE);

    System.out.println("Playing sound unaffected by EFX ...");
    AL10.alSourcePlay(source);
    Thread.sleep(7500);

    // Add reverb effect
    final int effectSlot = EFX10.alGenAuxiliaryEffectSlots();
    final int reverbEffect = EFX10.alGenEffects();
    EFX10.alEffecti(reverbEffect, EFX10.AL_EFFECT_TYPE, EFX10.AL_EFFECT_REVERB);
    EFX10.alEffectf(reverbEffect, EFX10.AL_REVERB_DECAY_TIME, 5.0f);
    EFX10.alAuxiliaryEffectSloti(effectSlot, EFX10.AL_EFFECTSLOT_EFFECT, reverbEffect);
    AL11.alSource3i(source, EFX10.AL_AUXILIARY_SEND_FILTER, effectSlot, 0,
            EFX10.AL_FILTER_NULL);

    System.out.println("Playing sound with reverb ...");
    AL10.alSourcePlay(source);
    Thread.sleep(7500);

    // Add low-pass filter directly to source
    final int filter = EFX10.alGenFilters();
    EFX10.alFilteri(filter, EFX10.AL_FILTER_TYPE, EFX10.AL_FILTER_LOWPASS);
    EFX10.alFilterf(filter, EFX10.AL_LOWPASS_GAIN, 0.5f);
    EFX10.alFilterf(filter, EFX10.AL_LOWPASS_GAINHF, 0.5f);
    AL10.alSourcei(source, EFX10.AL_DIRECT_FILTER, filter);

    System.out.println("Playing sound with reverb and direct low pass filter ...");
    AL10.alSourcePlay(source);
    Thread.sleep(7500);
    AL10.alSourcei(source, EFX10.AL_DIRECT_FILTER, EFX10.AL_FILTER_NULL);

    // Add low-pass filter to source send
    //AL11.alSource3i(source, EFX10.AL_AUXILIARY_SEND_FILTER, effectSlot, 0, filter);
    //
    //System.out.println("Playing sound with reverb and aux send low pass filter ...");
    //AL10.alSourcePlay(source);
    //Thread.sleep(7500);

    // Cleanup
    AL11.alSource3i(source, EFX10.AL_AUXILIARY_SEND_FILTER, EFX10.AL_EFFECTSLOT_NULL, 0,
            EFX10.AL_FILTER_NULL);
    EFX10.alAuxiliaryEffectSloti(effectSlot, EFX10.AL_EFFECTSLOT_EFFECT, EFX10.AL_EFFECT_NULL);
    EFX10.alDeleteEffects(reverbEffect);
    EFX10.alDeleteFilters(filter);

    // Echo effect
    final int echoEffect = EFX10.alGenEffects();
    EFX10.alEffecti(echoEffect, EFX10.AL_EFFECT_TYPE, EFX10.AL_EFFECT_ECHO);
    //EFX10.alEffectf(echoEffect, EFX10.AL_ECHO_DELAY, 5.0f);
    EFX10.alAuxiliaryEffectSloti(effectSlot, EFX10.AL_EFFECTSLOT_EFFECT, echoEffect);
    AL11.alSource3i(source, EFX10.AL_AUXILIARY_SEND_FILTER, effectSlot, 0,
            EFX10.AL_FILTER_NULL);

    System.out.println("Playing sound with echo effect ...");
    AL10.alSourcePlay(source);
    Thread.sleep(7500);

    AL.destroy();
}
项目:3d-Demo    文件:EFX10Test.java   
/**
 * Plays a sound with various effects applied to it.
 */
private static void playbackTest() throws Exception {
    setupEfx();

    // Create a source and buffer audio data
    final int source = AL10.alGenSources();
    final int buffer = AL10.alGenBuffers();
    WaveData waveFile = WaveData.create("Footsteps.wav");
    if (waveFile == null) {
        System.out.println("Failed to load Footsteps.wav! Skipping playback test.");
        AL.destroy();
        return;
    }
    AL10.alBufferData(buffer, waveFile.format, waveFile.data, waveFile.samplerate);
    waveFile.dispose();
    AL10.alSourcei(source, AL10.AL_BUFFER, buffer);
    AL10.alSourcei(source, AL10.AL_LOOPING, AL10.AL_TRUE);

    System.out.println("Playing sound unaffected by EFX ...");
    AL10.alSourcePlay(source);
    Thread.sleep(7500);

    // Add reverb effect
    final int effectSlot = EFX10.alGenAuxiliaryEffectSlots();
    final int reverbEffect = EFX10.alGenEffects();
    EFX10.alEffecti(reverbEffect, EFX10.AL_EFFECT_TYPE, EFX10.AL_EFFECT_REVERB);
    EFX10.alEffectf(reverbEffect, EFX10.AL_REVERB_DECAY_TIME, 5.0f);
    EFX10.alAuxiliaryEffectSloti(effectSlot, EFX10.AL_EFFECTSLOT_EFFECT, reverbEffect);
    AL11.alSource3i(source, EFX10.AL_AUXILIARY_SEND_FILTER, effectSlot, 0,
            EFX10.AL_FILTER_NULL);

    System.out.println("Playing sound with reverb ...");
    AL10.alSourcePlay(source);
    Thread.sleep(7500);

    // Add low-pass filter directly to source
    final int filter = EFX10.alGenFilters();
    EFX10.alFilteri(filter, EFX10.AL_FILTER_TYPE, EFX10.AL_FILTER_LOWPASS);
    EFX10.alFilterf(filter, EFX10.AL_LOWPASS_GAIN, 0.5f);
    EFX10.alFilterf(filter, EFX10.AL_LOWPASS_GAINHF, 0.5f);
    AL10.alSourcei(source, EFX10.AL_DIRECT_FILTER, filter);

    System.out.println("Playing sound with reverb and direct low pass filter ...");
    AL10.alSourcePlay(source);
    Thread.sleep(7500);
    AL10.alSourcei(source, EFX10.AL_DIRECT_FILTER, EFX10.AL_FILTER_NULL);

    // Add low-pass filter to source send
    //AL11.alSource3i(source, EFX10.AL_AUXILIARY_SEND_FILTER, effectSlot, 0, filter);
    //
    //System.out.println("Playing sound with reverb and aux send low pass filter ...");
    //AL10.alSourcePlay(source);
    //Thread.sleep(7500);

    // Cleanup
    AL11.alSource3i(source, EFX10.AL_AUXILIARY_SEND_FILTER, EFX10.AL_EFFECTSLOT_NULL, 0,
            EFX10.AL_FILTER_NULL);
    EFX10.alAuxiliaryEffectSloti(effectSlot, EFX10.AL_EFFECTSLOT_EFFECT, EFX10.AL_EFFECT_NULL);
    EFX10.alDeleteEffects(reverbEffect);
    EFX10.alDeleteFilters(filter);

    // Echo effect
    final int echoEffect = EFX10.alGenEffects();
    EFX10.alEffecti(echoEffect, EFX10.AL_EFFECT_TYPE, EFX10.AL_EFFECT_ECHO);
    //EFX10.alEffectf(echoEffect, EFX10.AL_ECHO_DELAY, 5.0f);
    EFX10.alAuxiliaryEffectSloti(effectSlot, EFX10.AL_EFFECTSLOT_EFFECT, echoEffect);
    AL11.alSource3i(source, EFX10.AL_AUXILIARY_SEND_FILTER, effectSlot, 0,
            EFX10.AL_FILTER_NULL);

    System.out.println("Playing sound with echo effect ...");
    AL10.alSourcePlay(source);
    Thread.sleep(7500);

    AL.destroy();
}
项目:MikuMikuStudio    文件:LwjglAudioRenderer.java   
public void deleteFilter(Filter filter) {
    int id = filter.getId();
    if (id != -1){
        EFX10.alDeleteFilters(id);
    }
}