Java Code Examples for org.lwjgl.openal.EFX10#alFilteri()

The following examples show how to use org.lwjgl.openal.EFX10#alFilteri() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: LwjglAudioRenderer.java    From MikuMikuStudio with BSD 2-Clause "Simplified" License 6 votes vote down vote up
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();
}
 
Example 2
Source File: SoundPhysics.java    From Sound-Physics with GNU General Public License v3.0 4 votes vote down vote up
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		
}
 
Example 3
Source File: LwjglEFX.java    From jmonkeyengine with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
@Override
public void alFilteri(int filter, int param, int value) {
    EFX10.alFilteri(filter, param, value);
}