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


Java ALC10.alcIsExtensionPresent方法代码示例

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


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

示例1: BasicTest

import org.lwjgl.openal.ALC10; //导入方法依赖的package包/类
/**
 * Creates an instance of PlayTest
 */
protected BasicTest() {
  try {
  	AL.create();

  	System.out.println("Default device: " + ALC10.alcGetString(null, ALC10.ALC_DEFAULT_DEVICE_SPECIFIER));

  	if(ALC10.alcIsExtensionPresent(null, "ALC_ENUMERATION_EXT")) {
  		String[] devices = ALC10.alcGetString(null, ALC10.ALC_DEVICE_SPECIFIER).split("\0");
	System.out.println("Available devices: ");
  		for(int i=0; i<devices.length; i++) {
  			System.out.println(i +": " + devices[i]);
  		}
  	}
  } catch (Exception e) {
  	System.out.println("Unable to create OpenAL.\nPlease make sure that OpenAL is available on this system. Exception: " + e);
  	return;
  }
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:22,代码来源:BasicTest.java

示例2: printALCInfo

import org.lwjgl.openal.ALC10; //导入方法依赖的package包/类
private void printALCInfo() {
	IntBuffer version = BufferUtils.createIntBuffer(2);
	ALCdevice device;

	if(ALC10.alcIsExtensionPresent(null, "ALC_ENUMERATION_EXT")) {
        if(ALC10.alcIsExtensionPresent(null, "ALC_ENUMERATE_ALL_EXT")) {
            printDevices(ALC11.ALC_ALL_DEVICES_SPECIFIER, "playback");
        } else {
            printDevices(ALC10.ALC_DEVICE_SPECIFIER, "playback");
        }
        printDevices(ALC11.ALC_CAPTURE_DEVICE_SPECIFIER, "capture");
    } else {
      System.out.println("No device enumeration available");
	}

	device = ALC10.alcGetContextsDevice(ALC10.alcGetCurrentContext());
	checkForErrors();

    System.out.println("Default playback device: " + ALC10.alcGetString(device, ALC10.ALC_DEFAULT_DEVICE_SPECIFIER));

    System.out.println("Default capture device: " + ALC10.alcGetString(device, ALC11.ALC_CAPTURE_DEFAULT_DEVICE_SPECIFIER));

   	ALC10.alcGetInteger(AL.getDevice(), ALC10.ALC_MAJOR_VERSION, version);
   	ALC10.alcGetInteger(AL.getDevice(), ALC10.ALC_MINOR_VERSION, (IntBuffer) version.position(1));
    checkForErrors();

    System.out.println("ALC version: " + version.get(0) + "." + version.get(1));

    System.out.println("ALC extensions:");
    String[] extensions = ALC10.alcGetString(device, ALC10.ALC_EXTENSIONS).split(" ");
	for ( String extension : extensions ) {
		if ( extension.trim().length() == 0 ) {
			continue;
		}
		System.out.println("    " + extension);
	}
    checkForErrors();
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:39,代码来源:OpenALInfo.java

示例3: setupEfx

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

示例4: setupEFX

import org.lwjgl.openal.ALC10; //导入方法依赖的package包/类
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		
}
 
开发者ID:sonicether,项目名称:Sound-Physics,代码行数:74,代码来源:SoundPhysics.java

示例5: execute

import org.lwjgl.openal.ALC10; //导入方法依赖的package包/类
/**
 * Runs the actual test, using supplied arguments
 */
protected void execute(String[] args) {
	int lastError = ALC10.ALC_NO_ERROR;
	IntBuffer sampleCount = BufferUtils.createIntBuffer(1);
	
	int state = AL10.AL_PLAYING;
	int FMT = AL10.AL_FORMAT_MONO16;
	int FMTSIZE  = 16/8;
	int FREQ = 44100;
	int TIME = 5;
	int SAMPS = (FREQ * TIME);
	ByteBuffer buf = BufferUtils.createByteBuffer(SAMPS * FMTSIZE);		

	// check that capture is available
	if(!ALC10.alcIsExtensionPresent(AL.getDevice(), "ALC_EXT_CAPTURE")) {
		throw new OpenALException("ALC_EXT_CAPTURE extension not available");
	}
	
	// get list of devices
	String[] captureDevices = ALC10.alcGetString(null, ALC11.ALC_CAPTURE_DEVICE_SPECIFIER).split("\0");
	System.out.println("Available Capture Devices: ");
	for(int i=0; i<captureDevices.length; i++) {
		System.out.println(i + ": " + captureDevices[i]);
	}
	
	String defaultRecorder = ALC10.alcGetString(AL.getDevice(), ALC11.ALC_CAPTURE_DEFAULT_DEVICE_SPECIFIER);
	System.out.println("Default capture device: " + defaultRecorder);
	
	ALCdevice device = ALC11.alcCaptureOpenDevice(null, FREQ, FMT, SAMPS);

	if(device != null) {
		// record some sound
		// =====================================
		System.out.print("Recording using " + ALC10.alcGetString(device, ALC11.ALC_CAPTURE_DEVICE_SPECIFIER) + "...");
		ALC11.alcCaptureStart(device);
		while (sampleCount.get(0) < SAMPS) {
			pause(1000);
			ALC10.alcGetInteger(device, ALC11.ALC_CAPTURE_SAMPLES, sampleCount);
		}
		System.out.println("done");
		ALC11.alcCaptureStop(device);

		// capure the samples
		ALC11.alcCaptureSamples(device, buf, SAMPS);
		ALC11.alcCaptureCloseDevice(device);
		// -------------------------------------
		
		// play back recording
		// ===================
        IntBuffer buffers = BufferUtils.createIntBuffer(1);
        IntBuffer sources = BufferUtils.createIntBuffer(1);        
        
        buffers.position(0).limit(1);
        AL10.alGenBuffers(buffers);

        sources.position(0).limit(1);
        AL10.alGenSources(sources);

        System.out.print("Playing...");

	    AL10.alBufferData(buffers.get(0), FMT, buf, FREQ);
	    AL10.alSourcei(sources.get(0), AL10.AL_BUFFER, buffers.get(0));
	    AL10.alSourcei(sources.get(0), AL10.AL_LOOPING, AL10.AL_FALSE);
	    AL10.alSourcePlay(sources.get(0));

	    while (state == AL10.AL_PLAYING)
	    {
	        pause(100);
	        state = AL10.alGetSourcei(sources.get(0), AL10.AL_SOURCE_STATE);
	    }

	    System.out.println("done");

	    AL10.alDeleteSources(sources);
	    AL10.alDeleteBuffers(buffers);
	}		

	alExit();
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:82,代码来源:ALCCaptureTest.java


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