當前位置: 首頁>>代碼示例>>Java>>正文


Java AL10.AL_FORMAT_STEREO16屬性代碼示例

本文整理匯總了Java中org.lwjgl.openal.AL10.AL_FORMAT_STEREO16屬性的典型用法代碼示例。如果您正苦於以下問題:Java AL10.AL_FORMAT_STEREO16屬性的具體用法?Java AL10.AL_FORMAT_STEREO16怎麽用?Java AL10.AL_FORMAT_STEREO16使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在org.lwjgl.openal.AL10的用法示例。


在下文中一共展示了AL10.AL_FORMAT_STEREO16屬性的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: Decoder

public Decoder(String path, IntBuffer buffers){
	this.buffers = buffers;
	
	vorbis = ResourceLoader.getBytes(path);
	IntBuffer error = BufferUtils.createIntBuffer(1);
	handle = stb_vorbis_open_memory(vorbis, error, null);
	
	if(handle == 0L){
		throw new RuntimeException("Unable to open stb");
	}
	
	STBVorbisInfo info = STBVorbisInfo.malloc();
	stb_vorbis_get_info(handle, info);
	channels = info.channels();
	sampleRate = info.sample_rate();

	format = (channels == 1) ? AL10.AL_FORMAT_MONO16 : AL10.AL_FORMAT_STEREO16;
	
	lengthSamples = stb_vorbis_stream_length_in_samples(handle);
	lengthSeconds = stb_vorbis_stream_length_in_seconds(handle);
	
	pcm = BufferUtils.createShortBuffer(BUFFER_SIZE);
	
	samplesLeft = lengthSamples;
}
 
開發者ID:tek256,項目名稱:LD38,代碼行數:25,代碼來源:Music.java

示例2: reset

private synchronized void reset() {
    if (bitStream != null) {
        try {
            bitStream.close();
        } catch (BitstreamException skip) {
        }
    }
    bitStream = new Bitstream(vfs.getInputStream(filePath));
    decoder = new MP3Decoder();
    try {
        Header header = bitStream.readFrame();
        if (header != null) {
            int channels = header.mode() == Header.SINGLE_CHANNEL ? 1 : 2;
            outputBuffer = new OutputBuffer(channels, false);
            decoder.setOutputBuffer(outputBuffer);
            this.format = channels > 1 ? AL10.AL_FORMAT_STEREO16 : AL10.AL_FORMAT_MONO16;
            this.sampleRate = header.getSampleRate();
            secondsPerBuffer = (double) bufferSize / bytesPerSample / channels / sampleRate;
        } else {
            throw new RuntimeException("empty mp3");
        }
    } catch (BitstreamException e) {
        e.printStackTrace();
    }
}
 
開發者ID:dmitrykolesnikovich,項目名稱:featurea,代碼行數:25,代碼來源:MusicControllerImpl.java


注:本文中的org.lwjgl.openal.AL10.AL_FORMAT_STEREO16屬性示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。