本文整理匯總了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;
}
示例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();
}
}