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

项目:gdx-backend-jglfw    文件:OpenALAudio.java   
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);

    alContext = ALContext.create();

    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();
    alListenerfv(AL_ORIENTATION, orientation);
    FloatBuffer velocity = (FloatBuffer)BufferUtils.createFloatBuffer(3).put(new float[] {0.0f, 0.0f, 0.0f}).flip();
    alListenerfv(AL_VELOCITY, velocity);
    FloatBuffer position = (FloatBuffer)BufferUtils.createFloatBuffer(3).put(new float[] {0.0f, 0.0f, 0.0f}).flip();
    alListenerfv(AL_POSITION, position);

    recentSounds = new OpenALSound[simultaneousSources];
}
项目:2DPlatformer    文件:OpenALAudioDevice.java   
/**
 * Creates a new OpenALAudioDevice.
 */
public OpenALAudioDevice() {
    context = ALContext.create();
    channels = new HashMap<>();
    objects = new HashMap<>();
    currentObjectId = 1;
}
项目:DareEngine    文件:OpenALAudioDevice.java   
/**
 * Creates a new OpenALAudioDevice.
 */
public OpenALAudioDevice() {
    context = ALContext.create();
    channels = new HashMap<>();
    objects = new HashMap<>();
    currentObjectId = 1;
}
项目:x00FA9A    文件:x00FA9AClient.java   
public static void init() {
    if(glfwInit() != GL_TRUE) {
        throw new IllegalStateException("Unable to initialize GLFW");
    }
    glfwDefaultWindowHints();
    glfwWindowHint(GLFW_VISIBLE, GL_FALSE);
    glfwWindowHint(GLFW_RESIZABLE, GL_TRUE);
    long primaryMonitor = glfwGetPrimaryMonitor();
    Settings settings = Settings.getInstance();
    VideoMode videoMode = settings.getVideoMode();
    int initialWindowWidth;
    int initialWindowHeight;
    if(videoMode == null) {
        int scale = "true".equals(System.getProperty("retina")) ? 2 : 1;
        GLFWVidMode vidMode = glfwGetVideoMode(primaryMonitor);
        videoMode = VideoMode.getAutoDetectedVideoMode(vidMode.width() * scale, vidMode.height() * scale);
        settings.setVideoMode(videoMode);
        settings.save();
        initialWindowWidth = videoMode.getWidth();
        initialWindowHeight = videoMode.getHeight();
    } else {
        initialWindowWidth = videoMode.getWidth();
        initialWindowHeight = videoMode.getHeight();
    }
    window = glfwCreateWindow(initialWindowWidth, initialWindowHeight, "Beat Party", primaryMonitor, NULL);
    glfwMakeContextCurrent(window);
    glfwSwapInterval(0);
    glfwShowWindow(window);
    GL.createCapabilities(false);
    context = ALContext.create();
    if(!context.getCapabilities().OpenAL10) {
        throw new IllegalStateException("Failed to create OpenAL context");
    }
    context.makeCurrent();
    alListener3f(AL_POSITION, 0.0f, 0.0f, 0.0f);
    alListener3f(AL_VELOCITY, 0.0f, 0.0f, 0.0f);
    ViewManager.init(initialWindowWidth, initialWindowHeight, new SongMenu());
    glfwSetKeyCallback(window, ViewManager.getGlfwKeyCallback());
    glfwSetCursorPosCallback(window, ViewManager.getGlfwCursorPosCallback());
    glfwSetMouseButtonCallback(window, ViewManager.getGlfwMouseButtonCallback());
    glfwSetScrollCallback(window, ViewManager.getGlfwScrollCallback());
}
项目:JCaelum    文件:SoundClient.java   
public void initiate()
{
    this.context = ALContext.create();

}