private ShortBuffer readVorbis(String resource, int bufferSize, STBVorbisInfo info) throws Exception { try (MemoryStack stack = MemoryStack.stackPush()) { vorbis = Utils.ioResourceToByteBuffer(resource, bufferSize); IntBuffer error = stack.mallocInt(1); long decoder = stb_vorbis_open_memory(vorbis, error, null); if (decoder == NULL) { throw new RuntimeException("Failed to open Ogg Vorbis file. Error: " + error.get(0)); } stb_vorbis_get_info(decoder, info); int channels = info.channels(); int lengthSamples = stb_vorbis_stream_length_in_samples(decoder); pcm = MemoryUtil.memAllocShort(lengthSamples); pcm.limit(stb_vorbis_get_samples_short_interleaved(decoder, channels, pcm) * channels); stb_vorbis_close(decoder); return pcm; } } }
private ShortBuffer readVorbis(String resource, int bufferSize, STBVorbisInfo info) throws Exception { try (MemoryStack stack = MemoryStack.stackPush()) { vorbis = Utils.ioResourceToByteBuffer(resource, bufferSize); IntBuffer error = stack.mallocInt(1); long decoder = stb_vorbis_open_memory(vorbis, error, null); if (decoder == NULL) { throw new RuntimeException("Failed to open Ogg Vorbis file. Error: " + error.get(0)); } stb_vorbis_get_info(decoder, info); int channels = info.channels(); int lengthSamples = stb_vorbis_stream_length_in_samples(decoder); pcm = MemoryUtil.memAllocShort(lengthSamples); pcm.limit(stb_vorbis_get_samples_short_interleaved(decoder, channels, pcm) * channels); stb_vorbis_close(decoder); return pcm; } } }
private ShortBuffer readVorbis(String resource, int bufferSize, STBVorbisInfo info) throws Exception { try (MemoryStack stack = MemoryStack.stackPush()) { vorbis = Utils.ioResourceToByteBuffer(resource, bufferSize); IntBuffer error = stack.mallocInt(1); long decoder = stb_vorbis_open_memory(vorbis, error, null); if (decoder == NULL) { throw new RuntimeException("Failed to open Ogg Vorbis file. Error: " + error.get(0)); } stb_vorbis_get_info(decoder, info); int channels = info.channels(); int lengthSamples = stb_vorbis_stream_length_in_samples(decoder); pcm = MemoryUtil.memAllocShort(lengthSamples); pcm.limit(stb_vorbis_get_samples_short_interleaved(decoder, channels, pcm) * channels); stb_vorbis_close(decoder); return pcm; } } }
private ShortBuffer readVorbis(String resource, int bufferSize, STBVorbisInfo info) throws Exception { try (MemoryStack stack = MemoryStack.stackPush()) { vorbis = Utils.ioResourceToByteBuffer(resource, bufferSize); IntBuffer error = stack.mallocInt(1); long decoder = stb_vorbis_open_memory(vorbis, error, null); if (decoder == NULL) { throw new RuntimeException("Failed to open Ogg Vorbis file. Error: " + error.get(0)); } stb_vorbis_get_info(decoder, info); int channels = info.channels(); int lengthSamples = stb_vorbis_stream_length_in_samples(decoder); pcm = MemoryUtil.memAllocShort(lengthSamples); pcm.limit(stb_vorbis_get_samples_short_interleaved(decoder, channels, pcm) * channels); stb_vorbis_close(decoder); return pcm; } } }
private ShortBuffer readVorbis(String resource, int bufferSize, STBVorbisInfo info) throws Exception { try (MemoryStack stack = MemoryStack.stackPush()) { vorbis = Utils.ioResourceToByteBuffer(resource, bufferSize); IntBuffer error = stack.mallocInt(1); long decoder = stb_vorbis_open_memory(vorbis, error, null); if (decoder == NULL) { throw new RuntimeException("Failed to open Ogg Vorbis file. Error: " + error.get(0)); } stb_vorbis_get_info(decoder, info); int channels = info.channels(); int lengthSamples = stb_vorbis_stream_length_in_samples(decoder); pcm = MemoryUtil.memAllocShort(lengthSamples); pcm.limit(stb_vorbis_get_samples_short_interleaved(decoder, channels, pcm) * channels); stb_vorbis_close(decoder); return pcm; } } }
private ShortBuffer readVorbis(String resource, int bufferSize, STBVorbisInfo info) throws Exception { try (MemoryStack stack = MemoryStack.stackPush()) { vorbis = Utils.ioResourceToByteBuffer(resource, bufferSize); IntBuffer error = stack.mallocInt(1); long decoder = stb_vorbis_open_memory(vorbis, error, null); if (decoder == NULL) { throw new RuntimeException("Failed to open Ogg Vorbis file. Error: " + error.get(0)); } stb_vorbis_get_info(decoder, info); int channels = info.channels(); int lengthSamples = stb_vorbis_stream_length_in_samples(decoder); pcm = MemoryUtil.memAllocShort(lengthSamples); pcm.limit(stb_vorbis_get_samples_short_interleaved(decoder, channels, pcm) * channels); stb_vorbis_close(decoder); return pcm; } } }
private ShortBuffer readVorbis(String resource, int bufferSize, STBVorbisInfo info) throws Exception { try (MemoryStack stack = MemoryStack.stackPush()) { vorbis = Utils.ioResourceToByteBuffer(resource, bufferSize); IntBuffer error = stack.mallocInt(1); long decoder = stb_vorbis_open_memory(vorbis, error, null); if (decoder == NULL) { throw new RuntimeException("Failed to open Ogg Vorbis file. Error: " + error.get(0)); } stb_vorbis_get_info(decoder, info); int channels = info.channels(); int lengthSamples = stb_vorbis_stream_length_in_samples(decoder); pcm = MemoryUtil.memAllocShort(lengthSamples); pcm.limit(stb_vorbis_get_samples_short_interleaved(decoder, channels, pcm) * channels); stb_vorbis_close(decoder); return pcm; } } }
private ShortBuffer readVorbis(String resource, int bufferSize, STBVorbisInfo info) throws Exception { try (MemoryStack stack = MemoryStack.stackPush()) { vorbis = Utils.ioResourceToByteBuffer(resource, bufferSize); IntBuffer error = stack.mallocInt(1); long decoder = stb_vorbis_open_memory(vorbis, error, null); if (decoder == NULL) { throw new RuntimeException("Failed to open Ogg Vorbis file. Error: " + error.get(0)); } stb_vorbis_get_info(decoder, info); int channels = info.channels(); int lengthSamples = stb_vorbis_stream_length_in_samples(decoder); pcm = MemoryUtil.memAllocShort(lengthSamples); pcm.limit(stb_vorbis_get_samples_short_interleaved(decoder, channels, pcm) * channels); stb_vorbis_close(decoder); return pcm; } } }
private ShortBuffer readVorbis(String resource, int bufferSize, STBVorbisInfo info) throws Exception { try (MemoryStack stack = MemoryStack.stackPush()) { vorbis = Utils.ioResourceToByteBuffer(resource, bufferSize); IntBuffer error = stack.mallocInt(1); long decoder = stb_vorbis_open_memory(vorbis, error, null); if (decoder == NULL) { throw new RuntimeException("Failed to open Ogg Vorbis file. Error: " + error.get(0)); } stb_vorbis_get_info(decoder, info); int channels = info.channels(); int lengthSamples = stb_vorbis_stream_length_in_samples(decoder); pcm = MemoryUtil.memAllocShort(lengthSamples); pcm.limit(stb_vorbis_get_samples_short_interleaved(decoder, channels, pcm) * channels); stb_vorbis_close(decoder); return pcm; } } }
private ShortBuffer readVorbis(String resource, int bufferSize, STBVorbisInfo info) throws Exception { try (MemoryStack stack = MemoryStack.stackPush()) { vorbis = Utils.ioResourceToByteBuffer(resource, bufferSize); IntBuffer error = stack.mallocInt(1); long decoder = stb_vorbis_open_memory(vorbis, error, null); if (decoder == NULL) { throw new RuntimeException("Failed to open Ogg Vorbis file. Error: " + error.get(0)); } stb_vorbis_get_info(decoder, info); int channels = info.channels(); int lengthSamples = stb_vorbis_stream_length_in_samples(decoder); pcm = MemoryUtil.memAllocShort(lengthSamples); pcm.limit(stb_vorbis_get_samples_short_interleaved(decoder, channels, pcm) * channels); stb_vorbis_close(decoder); return pcm; } } }