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


Java AL11.alSource3i方法代码示例

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


在下文中一共展示了AL11.alSource3i方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: 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

示例3: 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

示例4: playbackTest

import org.lwjgl.openal.AL11; //导入方法依赖的package包/类
/**
 * 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();
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:78,代码来源:EFX10Test.java


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