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


Java AL.create方法代码示例

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


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

示例1: init

import org.lwjgl.openal.AL; //导入方法依赖的package包/类
/**
* Initialise OpenAL LWJGL styley
*/
  public void init() {
  	try {
	AL.create();
	soundWorks = true;
} catch (LWJGLException e) {
	System.err.println("Failed to initialise LWJGL OpenAL");
	soundWorks = false;
	return;
}

if (soundWorks) {
	IntBuffer sources = BufferUtils.createIntBuffer(1);
	AL10.alGenSources(sources);
	
	if (AL10.alGetError() != AL10.AL_NO_ERROR) {
		System.err.println("Failed to create sources");
		soundWorks = false;
	} else {
		source = sources.get(0);
	}
	
}
  }
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:27,代码来源:OpenALMODPlayer.java

示例2: init

import org.lwjgl.openal.AL; //导入方法依赖的package包/类
@Override
public void init() {
    if (!AL.isCreated()) {
        try {
            AL.create();
        } catch (LWJGLException e) {
            e.printStackTrace();
        }
        allSources = new IntArray(SIMULTANEOUS_SOURCES_COUNT);
        for (int i = 0; i < SIMULTANEOUS_SOURCES_COUNT; i++) {
            int sourceID = AL10.alGenSources();
            if (AL10.alGetError() == AL10.AL_NO_ERROR) {
                allSources.add(sourceID);
            }
        }
        idleSources = new IntArray(allSources);
        recentSounds = new SoundPoolImpl[SIMULTANEOUS_SOURCES_COUNT];
        AL10.alListener(AL10.AL_ORIENTATION, orientation);
        AL10.alListener(AL10.AL_VELOCITY, velocity);
        AL10.alListener(AL10.AL_POSITION, position);
    }
}
 
开发者ID:dmitrykolesnikovich,项目名称:featurea,代码行数:23,代码来源:OpenALImpl.java

示例3: initialize

import org.lwjgl.openal.AL; //导入方法依赖的package包/类
/**
 * Initializes the SoundManager
 *
 * @param channels Number of channels to create
 */
public void initialize(int channels) {
  try {
   AL.create();

   // allocate sources
   scratchBuffer.limit(channels);
   AL10.alGenSources(scratchBuffer);
   scratchBuffer.rewind();
   scratchBuffer.get(sources = new int[channels]);

   // could we allocate all channels?
   if(AL10.alGetError() != AL10.AL_NO_ERROR) {
   	throw new LWJGLException("Unable to allocate " + channels + " sources");
   }

   // we have sound
   soundOutput = true;
  } catch (LWJGLException le) {
  	le.printStackTrace();
    System.out.println("Sound disabled");
  }
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:28,代码来源:SoundManager.java

示例4: BasicTest

import org.lwjgl.openal.AL; //导入方法依赖的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

示例5: execute

import org.lwjgl.openal.AL; //导入方法依赖的package包/类
/**
 * Runs the actual test, using supplied arguments
 */
protected void execute(String[] args) {
	try {
		AL.create(null, -1, 60, false);
		checkForErrors();
	} catch (LWJGLException le) {
		die("Init", le.getMessage());
	}

	printALCInfo();
	printALInfo();
	printEFXInfo();

	checkForErrors();

	AL.destroy();
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:20,代码来源:OpenALInfo.java

示例6: OpenAL

import org.lwjgl.openal.AL; //导入方法依赖的package包/类
public OpenAL() throws LWJGLException {

		try {
			AL.create();
		} catch (Exception e) {
			System.out.println("Unable to create OpenAL.\nPlease make sure that OpenAL is available on this system. Exception: " + e);
			return;
		}

		Thread t = new Thread() {

			public void run() {
				while (true) {
					if (isVisible())
						repaint();
					Display.sync(60);
				}
			}
		};
		t.setDaemon(true);
		t.start();
	}
 
开发者ID:mleoking,项目名称:PhET,代码行数:23,代码来源:OpenAL.java

示例7: init

import org.lwjgl.openal.AL; //导入方法依赖的package包/类
public static final void init() throws InstantiationException {
	if (init) {
		throw new InstantiationException("[WARNING] Jumbo Audio Player was already initialized!"); //$NON-NLS-1$
	}
	try {
		AL.create();
	} catch (LWJGLException le) {
		le.printStackTrace();
		return;
	}
	buffer = BufferUtils.createIntBuffer(SOUND_NUM);
	AL10.alGenSources(source);
	AL10.alGenBuffers(buffer);
	buffer.limit(1);
	AL10.alDopplerFactor(1.0f);
	AL10.alDopplerVelocity(1.0f);
	check();
	init = true;
}
 
开发者ID:liavt,项目名称:Jumbo-Engine,代码行数:20,代码来源:JumboAudioHandler.java

示例8: Sound

import org.lwjgl.openal.AL; //导入方法依赖的package包/类
public Sound()
{
	System.out.print("SFX initialisation");

	try
	{
		AL.create();
		IntSource = alGenSources();
	}
	catch (LWJGLException e)
	{
		e.printStackTrace();
	}

	System.out.println(".");
}
 
开发者ID:AXDOOMER,项目名称:KillBox,代码行数:17,代码来源:Sound.java

示例9: create

import org.lwjgl.openal.AL; //导入方法依赖的package包/类
@Override
public void create(String title) {
    setTitle(title);
    enableResize(true);

    PixelFormat pixelFormat = new PixelFormat();
    ContextAttribs contextAtrributes = new ContextAttribs(3, 2)
            .withForwardCompatible(true)
            .withProfileCore(true);

    try {
        Display.setDisplayMode(new DisplayMode(getWidth(), getHeight()));
        Display.create(pixelFormat, contextAtrributes);
        Keyboard.create();
        Mouse.create();
        AL.create();
        drawBuffer = glGetInteger(GL_DRAW_BUFFER);
        readBuffer = glGetInteger(GL_READ_BUFFER);
    } catch (LWJGLException e) {
        LOGGER.error("Error setting up input and window", e);
    }
}
 
开发者ID:achtern,项目名称:AchternEngine,代码行数:23,代码来源:LWJGLWindow.java

示例10: main

import org.lwjgl.openal.AL; //导入方法依赖的package包/类
public static void main(String[] args) throws FileNotFoundException {
    try {
        Display.setDisplayMode(new DisplayMode(640, 480));
        Display.setTitle("OpenAL Demo");
        Display.create();
        AL.create();
    } catch (LWJGLException e) {
        e.printStackTrace();
        Display.destroy();
        AL.destroy();
        System.exit(1);
    }
    WaveData data = WaveData.create(new BufferedInputStream(new FileInputStream("res" + File.separatorChar +
            "sounds" + File.separatorChar + "thump.wav")));
    int buffer = alGenBuffers();
    alBufferData(buffer, data.format, data.data, data.samplerate);
    data.dispose();
    int source = alGenSources();
    alSourcei(source, AL_BUFFER, buffer);
    while (!Display.isCloseRequested()) {
        while (Keyboard.next()) {
            if (Keyboard.isKeyDown(Keyboard.KEY_SPACE)) {
                alSourcePlay(source);
            }
        }
        Display.update();
        Display.sync(60);
    }
    alDeleteBuffers(buffer);
    AL.destroy();
    Display.destroy();
    System.exit(0);
}
 
开发者ID:nitrodragon,项目名称:lwjgl_collection,代码行数:34,代码来源:OpenALDemo.java

示例11: init

import org.lwjgl.openal.AL; //导入方法依赖的package包/类
/**
 * Initialise the game
 * @throws Exception if init fails
 */
private static void init() throws Exception {
	// Create a fullscreen window with 1:1 orthographic 2D projection, and with
	// mouse, keyboard, and gamepad inputs.
   Display.setTitle(GAME_TITLE);
   Display.setFullscreen(true);

   // Enable vsync if we can
   Display.setVSyncEnabled(true);

   Display.create();

	// Start up the sound system
	AL.create();

	// TODO: Load in your textures etc here

	// Put the window into orthographic projection mode with 1:1 pixel ratio.
	// We haven't used GLU here to do this to avoid an unnecessary dependency.
	glMatrixMode(GL_PROJECTION);
	glLoadIdentity();
	glOrtho(0.0, Display.getDisplayMode().getWidth(), 0.0, Display.getDisplayMode().getHeight(), -1.0, 1.0);
	glMatrixMode(GL_MODELVIEW);
	glLoadIdentity();
	glViewport(0, 0, Display.getDisplayMode().getWidth(), Display.getDisplayMode().getHeight());

}
 
开发者ID:mleoking,项目名称:PhET,代码行数:31,代码来源:Game.java

示例12: alInitialize

import org.lwjgl.openal.AL; //导入方法依赖的package包/类
public void alInitialize() {
	try {
		AL.create();
	} catch (Exception e) {
		e.printStackTrace();
		return;
	}
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:9,代码来源:OpenALCreationTest.java

示例13: setupEfx

import org.lwjgl.openal.AL; //导入方法依赖的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

示例14: Sonics

import org.lwjgl.openal.AL; //导入方法依赖的package包/类
public Sonics()
{
    // Initialize OpenAL and clear the error bit.
    try
    {
        AL.create();
    }
    catch (LWJGLException e)
    {
        e.printStackTrace();
        return;
    }
    AL10.alGetError();

}
 
开发者ID:relminator,项目名称:AnyaBasic,代码行数:16,代码来源:Sonics.java

示例15: OpenALAudio

import org.lwjgl.openal.AL; //导入方法依赖的package包/类
public OpenALAudio (int simultaneousSources, int deviceBufferCount, int deviceBufferSize) {
	this.deviceBufferSize = deviceBufferSize;
	this.deviceBufferCount = deviceBufferCount;

	registerSound("ogg", Ogg.Sound.class);
	registerMusic("ogg", Ogg.Music.class);
	registerSound("wav", Wav.Sound.class);
	registerMusic("wav", Wav.Music.class);
	registerSound("mp3", Mp3.Sound.class);
	registerMusic("mp3", Mp3.Music.class);

	try {
		AL.create();
	} catch (LWJGLException ex) {
		noDevice = true;
		ex.printStackTrace();
		return;
	}

	allSources = new IntArray(false, simultaneousSources);
	for (int i = 0; i < simultaneousSources; i++) {
		int sourceID = alGenSources();
		if (alGetError() != AL_NO_ERROR) break;
		allSources.add(sourceID);
	}
	idleSources = new IntArray(allSources);
	soundIdToSource = new LongMap<Integer>();
	sourceToSoundId = new IntMap<Long>();

	FloatBuffer orientation = (FloatBuffer)BufferUtils.createFloatBuffer(6)
		.put(new float[] {0.0f, 0.0f, -1.0f, 0.0f, 1.0f, 0.0f}).flip();
	alListener(AL_ORIENTATION, orientation);
	FloatBuffer velocity = (FloatBuffer)BufferUtils.createFloatBuffer(3).put(new float[] {0.0f, 0.0f, 0.0f}).flip();
	alListener(AL_VELOCITY, velocity);
	FloatBuffer position = (FloatBuffer)BufferUtils.createFloatBuffer(3).put(new float[] {0.0f, 0.0f, 0.0f}).flip();
	alListener(AL_POSITION, position);
	
	recentSounds = new OpenALSound[simultaneousSources];
}
 
开发者ID:Xemiru,项目名称:Undertailor,代码行数:40,代码来源:OpenALAudio.java


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