public class STBVorbis
extends java.lang.Object
Ogg Vorbis audio decoder.
Individual stb_vorbis* handles are not thread-safe; you cannot decode from them from multiple threads at the same time. However, you can have multiple
stb_vorbis* handles and decode from them independently in multiple threads.
This API allows you to get blocks of data from any source and hand them to stb_vorbis. you have to buffer them; stb_vorbis will tell you how much it used, and you have to give it the rest next time; and stb_vorbis may not have enough data to work with and you will need to give it the same data again PLUS more. Note that the Vorbis specification does not bound the size of an individual frame.
This API assumes stb_vorbis is allowed to pull data from a source -- either a block of memory containing the _entire_ vorbis stream, or a FILE * that you or it create, or possibly some other reading mechanism if you go modify the source to replace the FILE * case with some kind of callback to your code. (But if you don't support seeking, you may just want to go ahead and use pushdata.)
| Modifier and Type | Field and Description |
|---|---|
static int |
VORBIS__no_error
Error code.
|
static int |
VORBIS_bad_packet_type
Error code.
|
static int |
VORBIS_cant_find_last_page
Error code.
|
static int |
VORBIS_continued_packet_flag_invalid
Error code.
|
static int |
VORBIS_feature_not_supported
Error code.
|
static int |
VORBIS_file_open_failure
Error code.
|
static int |
VORBIS_incorrect_stream_serial_number
Error code.
|
static int |
VORBIS_invalid_api_mixing
Error code.
|
static int |
VORBIS_invalid_first_page
Error code.
|
static int |
VORBIS_invalid_setup
Error code.
|
static int |
VORBIS_invalid_stream
Error code.
|
static int |
VORBIS_invalid_stream_structure_version
Error code.
|
static int |
VORBIS_missing_capture_pattern
Error code.
|
static int |
VORBIS_need_more_data
Error code.
|
static int |
VORBIS_ogg_skeleton_not_supported
Error code.
|
static int |
VORBIS_outofmem
Error code.
|
static int |
VORBIS_seek_failed
Error code.
|
static int |
VORBIS_seek_invalid
Error code.
|
static int |
VORBIS_seek_without_length
Error code.
|
static int |
VORBIS_too_many_channels
Error code.
|
static int |
VORBIS_unexpected_eof
Error code.
|
| Modifier and Type | Method and Description |
|---|---|
static void |
nstb_vorbis_close(long f)
Unsafe version of:
close |
static int |
nstb_vorbis_decode_filename(long filename,
int[] channels,
int[] sample_rate,
long output)
Array version of:
nstb_vorbis_decode_filename(long, long, long, long) |
static int |
nstb_vorbis_decode_filename(long filename,
long channels,
long sample_rate,
long output)
Unsafe version of:
decode_filename |
static int |
nstb_vorbis_decode_frame_pushdata(long f,
long datablock,
int datablock_length_in_bytes,
int[] channels,
long output,
int[] samples)
Array version of:
nstb_vorbis_decode_frame_pushdata(long, long, int, long, long, long) |
static int |
nstb_vorbis_decode_frame_pushdata(long f,
long datablock,
int datablock_length_in_bytes,
long channels,
long output,
long samples)
Unsafe version of:
decode_frame_pushdata |
static int |
nstb_vorbis_decode_memory(long mem,
int len,
int[] channels,
int[] sample_rate,
long output)
Array version of:
nstb_vorbis_decode_memory(long, int, long, long, long) |
static int |
nstb_vorbis_decode_memory(long mem,
int len,
long channels,
long sample_rate,
long output)
Unsafe version of:
decode_memory |
static void |
nstb_vorbis_flush_pushdata(long f)
Unsafe version of:
flush_pushdata |
static int |
nstb_vorbis_get_error(long f)
Unsafe version of:
get_error |
static int |
nstb_vorbis_get_file_offset(long f)
Unsafe version of:
get_file_offset |
static int |
nstb_vorbis_get_frame_float(long f,
int[] channels,
long output)
Array version of:
nstb_vorbis_get_frame_float(long, long, long) |
static int |
nstb_vorbis_get_frame_float(long f,
long channels,
long output)
Unsafe version of:
get_frame_float |
static int |
nstb_vorbis_get_frame_short_interleaved(long f,
int num_c,
long buffer,
int num_shorts)
Unsafe version of:
get_frame_short_interleaved |
static int |
nstb_vorbis_get_frame_short_interleaved(long f,
int num_c,
short[] buffer,
int num_shorts)
Array version of:
nstb_vorbis_get_frame_short_interleaved(long, int, long, int) |
static int |
nstb_vorbis_get_frame_short(long f,
int num_c,
long buffer,
int num_samples)
Unsafe version of:
get_frame_short |
static void |
nstb_vorbis_get_info(long f,
long __result)
Unsafe version of:
get_info |
static int |
nstb_vorbis_get_sample_offset(long f)
Unsafe version of:
get_sample_offset |
static int |
nstb_vorbis_get_samples_float_interleaved(long f,
int channels,
float[] buffer,
int num_floats)
Array version of:
nstb_vorbis_get_samples_float_interleaved(long, int, long, int) |
static int |
nstb_vorbis_get_samples_float_interleaved(long f,
int channels,
long buffer,
int num_floats)
Unsafe version of:
get_samples_float_interleaved |
static int |
nstb_vorbis_get_samples_float(long f,
int channels,
long buffer,
int num_samples)
Unsafe version of:
get_samples_float |
static int |
nstb_vorbis_get_samples_short_interleaved(long f,
int channels,
long buffer,
int num_shorts)
Unsafe version of:
get_samples_short_interleaved |
static int |
nstb_vorbis_get_samples_short_interleaved(long f,
int channels,
short[] buffer,
int num_shorts)
Array version of:
nstb_vorbis_get_samples_short_interleaved(long, int, long, int) |
static int |
nstb_vorbis_get_samples_short(long f,
int channels,
long buffer,
int num_samples)
Unsafe version of:
get_samples_short |
static long |
nstb_vorbis_open_filename(long filename,
int[] error,
long alloc_buffer)
Array version of:
nstb_vorbis_open_filename(long, long, long) |
static long |
nstb_vorbis_open_filename(long filename,
long error,
long alloc_buffer)
Unsafe version of:
open_filename |
static long |
nstb_vorbis_open_memory(long mem,
int len,
int[] error,
long alloc_buffer)
Array version of:
nstb_vorbis_open_memory(long, int, long, long) |
static long |
nstb_vorbis_open_memory(long mem,
int len,
long error,
long alloc_buffer)
Unsafe version of:
open_memory |
static long |
nstb_vorbis_open_pushdata(long datablock,
int datablock_length_in_bytes,
int[] datablock_memory_consumed_in_bytes,
int[] error,
long alloc_buffer)
Array version of:
nstb_vorbis_open_pushdata(long, int, long, long, long) |
static long |
nstb_vorbis_open_pushdata(long datablock,
int datablock_length_in_bytes,
long datablock_memory_consumed_in_bytes,
long error,
long alloc_buffer)
Unsafe version of:
open_pushdata |
static int |
nstb_vorbis_seek_frame(long f,
int sample_number)
Unsafe version of:
seek_frame |
static int |
nstb_vorbis_seek_start(long f)
Unsafe version of:
seek_start |
static int |
nstb_vorbis_seek(long f,
int sample_number)
Unsafe version of:
seek |
static int |
nstb_vorbis_stream_length_in_samples(long f)
Unsafe version of:
stream_length_in_samples |
static float |
nstb_vorbis_stream_length_in_seconds(long f)
Unsafe version of:
stream_length_in_seconds |
static void |
stb_vorbis_close(long f)
Closes an ogg vorbis file and free all memory in use
|
static int |
stb_vorbis_decode_filename(java.nio.ByteBuffer filename,
int[] channels,
int[] sample_rate,
org.lwjgl.PointerBuffer output)
Array version of:
decode_filename |
static int |
stb_vorbis_decode_filename(java.nio.ByteBuffer filename,
java.nio.IntBuffer channels,
java.nio.IntBuffer sample_rate,
org.lwjgl.PointerBuffer output)
Decode an entire file and output the data interleaved into a
malloc()ed buffer stored in *output. |
static int |
stb_vorbis_decode_filename(java.lang.CharSequence filename,
int[] channels,
int[] sample_rate,
org.lwjgl.PointerBuffer output)
Array version of:
decode_filename |
static java.nio.ShortBuffer |
stb_vorbis_decode_filename(java.lang.CharSequence filename,
java.nio.IntBuffer channels,
java.nio.IntBuffer sample_rate)
Decode an entire file and output the data interleaved into a
malloc()ed buffer stored in *output. |
static int |
stb_vorbis_decode_filename(java.lang.CharSequence filename,
java.nio.IntBuffer channels,
java.nio.IntBuffer sample_rate,
org.lwjgl.PointerBuffer output)
Decode an entire file and output the data interleaved into a
malloc()ed buffer stored in *output. |
static int |
stb_vorbis_decode_frame_pushdata(long f,
java.nio.ByteBuffer datablock,
int[] channels,
org.lwjgl.PointerBuffer output,
int[] samples)
Array version of:
decode_frame_pushdata |
static int |
stb_vorbis_decode_frame_pushdata(long f,
java.nio.ByteBuffer datablock,
java.nio.IntBuffer channels,
org.lwjgl.PointerBuffer output,
java.nio.IntBuffer samples)
Decodes a frame of audio sample data if possible from the passed-in data block.
|
static int |
stb_vorbis_decode_memory(java.nio.ByteBuffer mem,
int[] channels,
int[] sample_rate,
org.lwjgl.PointerBuffer output)
Array version of:
decode_memory |
static java.nio.ShortBuffer |
stb_vorbis_decode_memory(java.nio.ByteBuffer mem,
java.nio.IntBuffer channels,
java.nio.IntBuffer sample_rate)
In-memory version of
decode_filename. |
static int |
stb_vorbis_decode_memory(java.nio.ByteBuffer mem,
java.nio.IntBuffer channels,
java.nio.IntBuffer sample_rate,
org.lwjgl.PointerBuffer output)
In-memory version of
decode_filename. |
static void |
stb_vorbis_flush_pushdata(long f)
Inform stb_vorbis that your next datablock will not be contiguous with previous ones (e.g.
|
static int |
stb_vorbis_get_error(long f)
Returns the last error detected (clears it, too).
|
static int |
stb_vorbis_get_file_offset(long f)
Returns the current seek point within the file, or offset from the beginning of the memory buffer.
|
static int |
stb_vorbis_get_frame_float(long f,
int[] channels,
org.lwjgl.PointerBuffer output)
Array version of:
get_frame_float |
static int |
stb_vorbis_get_frame_float(long f,
java.nio.IntBuffer channels,
org.lwjgl.PointerBuffer output)
Decodes the next frame and return the number of samples.
|
static int |
stb_vorbis_get_frame_short_interleaved(long f,
int num_c,
short[] buffer)
Array version of:
get_frame_short_interleaved |
static int |
stb_vorbis_get_frame_short_interleaved(long f,
int num_c,
java.nio.ShortBuffer buffer)
Interleaved version of
get_frame_short. |
static int |
stb_vorbis_get_frame_short(long f,
org.lwjgl.PointerBuffer buffer,
int num_samples)
Decodes the next frame and returns the number of samples per channel.
|
static STBVorbisInfo |
stb_vorbis_get_info(long f,
STBVorbisInfo __result)
Returns general information about the specified file.
|
static int |
stb_vorbis_get_sample_offset(long f)
Returns the offset (in samples) from the beginning of the file that will be returned by the next decode, if it is known, or -1 otherwise.
|
static int |
stb_vorbis_get_samples_float_interleaved(long f,
int channels,
float[] buffer)
Array version of:
get_samples_float_interleaved |
static int |
stb_vorbis_get_samples_float_interleaved(long f,
int channels,
java.nio.FloatBuffer buffer)
Interleaved version of
get_samples_float. |
static int |
stb_vorbis_get_samples_float(long f,
org.lwjgl.PointerBuffer buffer,
int num_samples)
Gets
num_samples samples, not necessarily on a frame boundary -- this requires buffering so you have to supply the buffers. |
static int |
stb_vorbis_get_samples_short_interleaved(long f,
int channels,
short[] buffer)
Array version of:
get_samples_short_interleaved |
static int |
stb_vorbis_get_samples_short_interleaved(long f,
int channels,
java.nio.ShortBuffer buffer)
Interleaved version of
get_samples_short. |
static int |
stb_vorbis_get_samples_short(long f,
org.lwjgl.PointerBuffer buffer,
int num_samples)
Gets
num_samples samples, not necessarily on a frame boundary -- this requires buffering so you have to supply the buffers. |
static long |
stb_vorbis_open_filename(java.nio.ByteBuffer filename,
int[] error,
STBVorbisAlloc alloc_buffer)
Array version of:
open_filename |
static long |
stb_vorbis_open_filename(java.nio.ByteBuffer filename,
java.nio.IntBuffer error,
STBVorbisAlloc alloc_buffer)
Creates an ogg vorbis decoder from a file name.
|
static long |
stb_vorbis_open_filename(java.lang.CharSequence filename,
int[] error,
STBVorbisAlloc alloc_buffer)
Array version of:
open_filename |
static long |
stb_vorbis_open_filename(java.lang.CharSequence filename,
java.nio.IntBuffer error,
STBVorbisAlloc alloc_buffer)
Creates an ogg vorbis decoder from a file name.
|
static long |
stb_vorbis_open_memory(java.nio.ByteBuffer mem,
int[] error,
STBVorbisAlloc alloc_buffer)
Array version of:
open_memory |
static long |
stb_vorbis_open_memory(java.nio.ByteBuffer mem,
java.nio.IntBuffer error,
STBVorbisAlloc alloc_buffer)
Creates an ogg vorbis decoder from an ogg vorbis stream in memory (note this must be the entire stream!).
|
static long |
stb_vorbis_open_pushdata(java.nio.ByteBuffer datablock,
int[] datablock_memory_consumed_in_bytes,
int[] error,
STBVorbisAlloc alloc_buffer)
Array version of:
open_pushdata |
static long |
stb_vorbis_open_pushdata(java.nio.ByteBuffer datablock,
java.nio.IntBuffer datablock_memory_consumed_in_bytes,
java.nio.IntBuffer error,
STBVorbisAlloc alloc_buffer)
Creates a vorbis decoder by passing in the initial data block containing the ogg&vorbis headers (you don't need to do parse them, just provide the
first N bytes of the file -- you're told if it's not enough, see below)
|
static boolean |
stb_vorbis_seek_frame(long f,
int sample_number)
Seeks in the Vorbis file to (approximately)
sample_number. |
static boolean |
stb_vorbis_seek_start(long f)
This function is equivalent to
seek(f,0). |
static boolean |
stb_vorbis_seek(long f,
int sample_number)
Seeks in the Vorbis file to (approximately)
sample_number. |
static int |
stb_vorbis_stream_length_in_samples(long f)
Returns the total length of the vorbis stream, in samples.
|
static float |
stb_vorbis_stream_length_in_seconds(long f)
Returns the total length of the vorbis stream, in samples.
|
public static final int VORBIS__no_error
_no_errorneed_more_datainvalid_api_mixingoutofmemfeature_not_supportedtoo_many_channelsfile_open_failureseek_without_lengthunexpected_eofseek_invalidinvalid_setupinvalid_streammissing_capture_patterninvalid_stream_structure_versioncontinued_packet_flag_invalidincorrect_stream_serial_numberinvalid_first_pagebad_packet_typecant_find_last_pageseek_failedogg_skeleton_not_supportedpublic static final int VORBIS_need_more_data
_no_errorneed_more_datainvalid_api_mixingoutofmemfeature_not_supportedtoo_many_channelsfile_open_failureseek_without_lengthunexpected_eofseek_invalidinvalid_setupinvalid_streammissing_capture_patterninvalid_stream_structure_versioncontinued_packet_flag_invalidincorrect_stream_serial_numberinvalid_first_pagebad_packet_typecant_find_last_pageseek_failedogg_skeleton_not_supportedpublic static final int VORBIS_invalid_api_mixing
_no_errorneed_more_datainvalid_api_mixingoutofmemfeature_not_supportedtoo_many_channelsfile_open_failureseek_without_lengthunexpected_eofseek_invalidinvalid_setupinvalid_streammissing_capture_patterninvalid_stream_structure_versioncontinued_packet_flag_invalidincorrect_stream_serial_numberinvalid_first_pagebad_packet_typecant_find_last_pageseek_failedogg_skeleton_not_supportedpublic static final int VORBIS_outofmem
_no_errorneed_more_datainvalid_api_mixingoutofmemfeature_not_supportedtoo_many_channelsfile_open_failureseek_without_lengthunexpected_eofseek_invalidinvalid_setupinvalid_streammissing_capture_patterninvalid_stream_structure_versioncontinued_packet_flag_invalidincorrect_stream_serial_numberinvalid_first_pagebad_packet_typecant_find_last_pageseek_failedogg_skeleton_not_supportedpublic static final int VORBIS_feature_not_supported
_no_errorneed_more_datainvalid_api_mixingoutofmemfeature_not_supportedtoo_many_channelsfile_open_failureseek_without_lengthunexpected_eofseek_invalidinvalid_setupinvalid_streammissing_capture_patterninvalid_stream_structure_versioncontinued_packet_flag_invalidincorrect_stream_serial_numberinvalid_first_pagebad_packet_typecant_find_last_pageseek_failedogg_skeleton_not_supportedpublic static final int VORBIS_too_many_channels
_no_errorneed_more_datainvalid_api_mixingoutofmemfeature_not_supportedtoo_many_channelsfile_open_failureseek_without_lengthunexpected_eofseek_invalidinvalid_setupinvalid_streammissing_capture_patterninvalid_stream_structure_versioncontinued_packet_flag_invalidincorrect_stream_serial_numberinvalid_first_pagebad_packet_typecant_find_last_pageseek_failedogg_skeleton_not_supportedpublic static final int VORBIS_file_open_failure
_no_errorneed_more_datainvalid_api_mixingoutofmemfeature_not_supportedtoo_many_channelsfile_open_failureseek_without_lengthunexpected_eofseek_invalidinvalid_setupinvalid_streammissing_capture_patterninvalid_stream_structure_versioncontinued_packet_flag_invalidincorrect_stream_serial_numberinvalid_first_pagebad_packet_typecant_find_last_pageseek_failedogg_skeleton_not_supportedpublic static final int VORBIS_seek_without_length
_no_errorneed_more_datainvalid_api_mixingoutofmemfeature_not_supportedtoo_many_channelsfile_open_failureseek_without_lengthunexpected_eofseek_invalidinvalid_setupinvalid_streammissing_capture_patterninvalid_stream_structure_versioncontinued_packet_flag_invalidincorrect_stream_serial_numberinvalid_first_pagebad_packet_typecant_find_last_pageseek_failedogg_skeleton_not_supportedpublic static final int VORBIS_unexpected_eof
_no_errorneed_more_datainvalid_api_mixingoutofmemfeature_not_supportedtoo_many_channelsfile_open_failureseek_without_lengthunexpected_eofseek_invalidinvalid_setupinvalid_streammissing_capture_patterninvalid_stream_structure_versioncontinued_packet_flag_invalidincorrect_stream_serial_numberinvalid_first_pagebad_packet_typecant_find_last_pageseek_failedogg_skeleton_not_supportedpublic static final int VORBIS_seek_invalid
_no_errorneed_more_datainvalid_api_mixingoutofmemfeature_not_supportedtoo_many_channelsfile_open_failureseek_without_lengthunexpected_eofseek_invalidinvalid_setupinvalid_streammissing_capture_patterninvalid_stream_structure_versioncontinued_packet_flag_invalidincorrect_stream_serial_numberinvalid_first_pagebad_packet_typecant_find_last_pageseek_failedogg_skeleton_not_supportedpublic static final int VORBIS_invalid_setup
_no_errorneed_more_datainvalid_api_mixingoutofmemfeature_not_supportedtoo_many_channelsfile_open_failureseek_without_lengthunexpected_eofseek_invalidinvalid_setupinvalid_streammissing_capture_patterninvalid_stream_structure_versioncontinued_packet_flag_invalidincorrect_stream_serial_numberinvalid_first_pagebad_packet_typecant_find_last_pageseek_failedogg_skeleton_not_supportedpublic static final int VORBIS_invalid_stream
_no_errorneed_more_datainvalid_api_mixingoutofmemfeature_not_supportedtoo_many_channelsfile_open_failureseek_without_lengthunexpected_eofseek_invalidinvalid_setupinvalid_streammissing_capture_patterninvalid_stream_structure_versioncontinued_packet_flag_invalidincorrect_stream_serial_numberinvalid_first_pagebad_packet_typecant_find_last_pageseek_failedogg_skeleton_not_supportedpublic static final int VORBIS_missing_capture_pattern
_no_errorneed_more_datainvalid_api_mixingoutofmemfeature_not_supportedtoo_many_channelsfile_open_failureseek_without_lengthunexpected_eofseek_invalidinvalid_setupinvalid_streammissing_capture_patterninvalid_stream_structure_versioncontinued_packet_flag_invalidincorrect_stream_serial_numberinvalid_first_pagebad_packet_typecant_find_last_pageseek_failedogg_skeleton_not_supportedpublic static final int VORBIS_invalid_stream_structure_version
_no_errorneed_more_datainvalid_api_mixingoutofmemfeature_not_supportedtoo_many_channelsfile_open_failureseek_without_lengthunexpected_eofseek_invalidinvalid_setupinvalid_streammissing_capture_patterninvalid_stream_structure_versioncontinued_packet_flag_invalidincorrect_stream_serial_numberinvalid_first_pagebad_packet_typecant_find_last_pageseek_failedogg_skeleton_not_supportedpublic static final int VORBIS_continued_packet_flag_invalid
_no_errorneed_more_datainvalid_api_mixingoutofmemfeature_not_supportedtoo_many_channelsfile_open_failureseek_without_lengthunexpected_eofseek_invalidinvalid_setupinvalid_streammissing_capture_patterninvalid_stream_structure_versioncontinued_packet_flag_invalidincorrect_stream_serial_numberinvalid_first_pagebad_packet_typecant_find_last_pageseek_failedogg_skeleton_not_supportedpublic static final int VORBIS_incorrect_stream_serial_number
_no_errorneed_more_datainvalid_api_mixingoutofmemfeature_not_supportedtoo_many_channelsfile_open_failureseek_without_lengthunexpected_eofseek_invalidinvalid_setupinvalid_streammissing_capture_patterninvalid_stream_structure_versioncontinued_packet_flag_invalidincorrect_stream_serial_numberinvalid_first_pagebad_packet_typecant_find_last_pageseek_failedogg_skeleton_not_supportedpublic static final int VORBIS_invalid_first_page
_no_errorneed_more_datainvalid_api_mixingoutofmemfeature_not_supportedtoo_many_channelsfile_open_failureseek_without_lengthunexpected_eofseek_invalidinvalid_setupinvalid_streammissing_capture_patterninvalid_stream_structure_versioncontinued_packet_flag_invalidincorrect_stream_serial_numberinvalid_first_pagebad_packet_typecant_find_last_pageseek_failedogg_skeleton_not_supportedpublic static final int VORBIS_bad_packet_type
_no_errorneed_more_datainvalid_api_mixingoutofmemfeature_not_supportedtoo_many_channelsfile_open_failureseek_without_lengthunexpected_eofseek_invalidinvalid_setupinvalid_streammissing_capture_patterninvalid_stream_structure_versioncontinued_packet_flag_invalidincorrect_stream_serial_numberinvalid_first_pagebad_packet_typecant_find_last_pageseek_failedogg_skeleton_not_supportedpublic static final int VORBIS_cant_find_last_page
_no_errorneed_more_datainvalid_api_mixingoutofmemfeature_not_supportedtoo_many_channelsfile_open_failureseek_without_lengthunexpected_eofseek_invalidinvalid_setupinvalid_streammissing_capture_patterninvalid_stream_structure_versioncontinued_packet_flag_invalidincorrect_stream_serial_numberinvalid_first_pagebad_packet_typecant_find_last_pageseek_failedogg_skeleton_not_supportedpublic static final int VORBIS_seek_failed
_no_errorneed_more_datainvalid_api_mixingoutofmemfeature_not_supportedtoo_many_channelsfile_open_failureseek_without_lengthunexpected_eofseek_invalidinvalid_setupinvalid_streammissing_capture_patterninvalid_stream_structure_versioncontinued_packet_flag_invalidincorrect_stream_serial_numberinvalid_first_pagebad_packet_typecant_find_last_pageseek_failedogg_skeleton_not_supportedpublic static final int VORBIS_ogg_skeleton_not_supported
_no_errorneed_more_datainvalid_api_mixingoutofmemfeature_not_supportedtoo_many_channelsfile_open_failureseek_without_lengthunexpected_eofseek_invalidinvalid_setupinvalid_streammissing_capture_patterninvalid_stream_structure_versioncontinued_packet_flag_invalidincorrect_stream_serial_numberinvalid_first_pagebad_packet_typecant_find_last_pageseek_failedogg_skeleton_not_supportedpublic static void nstb_vorbis_get_info(long f,
long __result)
get_infopublic static STBVorbisInfo stb_vorbis_get_info(long f, STBVorbisInfo __result)
f - an ogg vorbis file decoderpublic static int nstb_vorbis_get_error(long f)
get_errorpublic static int stb_vorbis_get_error(long f)
f - an ogg vorbis file decoderpublic static void nstb_vorbis_close(long f)
closepublic static void stb_vorbis_close(long f)
f - an ogg vorbis file decoderpublic static int nstb_vorbis_get_sample_offset(long f)
get_sample_offsetpublic static int stb_vorbis_get_sample_offset(long f)
flush_pushdata call, this may take a while before it becomes valid again.
NOT WORKING YET after a seek with PULLDATA API.
f - an ogg vorbis file decoderpublic static int nstb_vorbis_get_file_offset(long f)
get_file_offsetpublic static int stb_vorbis_get_file_offset(long f)
f - an ogg vorbis file decoderpublic static long nstb_vorbis_open_pushdata(long datablock,
int datablock_length_in_bytes,
long datablock_memory_consumed_in_bytes,
long error,
long alloc_buffer)
open_pushdatadatablock_length_in_bytes - the length of datablock, in bytespublic static long stb_vorbis_open_pushdata(java.nio.ByteBuffer datablock,
java.nio.IntBuffer datablock_memory_consumed_in_bytes,
java.nio.IntBuffer error,
@Nullable
STBVorbisAlloc alloc_buffer)
datablock - the data block containing the ogg vorbis headersdatablock_memory_consumed_in_bytes - returns the amount of data parsed/consumed, in byteserror - returns the error codealloc_buffer - an STBVorbisAlloc structstb_vorbis *, does not set error, returns the amount of data parsed/consumed on this call in
*datablock_memory_consumed_in_bytes; On failure, returns NULL on error and sets *error, does not change
*datablock_memory_consumed. If it returns NULL and *error is need_more_data, then the input block was incomplete and you need to pass
in a larger block from the start of the file.public static int nstb_vorbis_decode_frame_pushdata(long f,
long datablock,
int datablock_length_in_bytes,
long channels,
long output,
long samples)
decode_frame_pushdatadatablock_length_in_bytes - the length of datablock, in bytespublic static int stb_vorbis_decode_frame_pushdata(long f,
java.nio.ByteBuffer datablock,
@Nullable
java.nio.IntBuffer channels,
org.lwjgl.PointerBuffer output,
java.nio.IntBuffer samples)
Note that on resynch, stb_vorbis will rarely consume all of the buffer, instead only datablock_length_in_bytes-3 or less. This is because it
wants to avoid missing parts of a page header if they cross a datablock boundary, without writing state-machiney code to record a partial detection.
The number of channels returned are stored in *channels (which can be NULL -- it is always the same as the number of channels reported by get_info).
*output will contain an array of float* buffers, one per channel. In other words, (*output)[0][0] contains the first sample
from the first channel, and (*output)[1][0] contains the first sample from the second channel.
f - an ogg vorbis file decoderdatablock - the data block containing the audio sample datachannels - place to write number of float * buffersoutput - place to write float ** array of float * bufferssamples - place to write number of output samplesNote that after opening a file, you will ALWAYS get one N-bytes,0-sample frame, because Vorbis always "discards" the first frame.
public static void nstb_vorbis_flush_pushdata(long f)
flush_pushdatapublic static void stb_vorbis_flush_pushdata(long f)
If you want to seek using pushdata, you need to seek in your file, then call stb_vorbis_flush_pushdata(), then start calling decoding, then once
decoding is returning you data, call get_sample_offset, and if you don't like the result, seek your file again and repeat.
f - an ogg vorbis file decoderpublic static int nstb_vorbis_decode_filename(long filename,
long channels,
long sample_rate,
long output)
decode_filenamepublic static int stb_vorbis_decode_filename(java.nio.ByteBuffer filename,
java.nio.IntBuffer channels,
java.nio.IntBuffer sample_rate,
org.lwjgl.PointerBuffer output)
malloc()ed buffer stored in *output. When you're done with it, just
LibCStdlib.free(java.nio.ByteBuffer) the pointer returned in *output.filename - the file namechannels - returns the number of channelssample_rate - returns the sample rateoutput - returns a pointer to the decoded datapublic static int stb_vorbis_decode_filename(java.lang.CharSequence filename,
java.nio.IntBuffer channels,
java.nio.IntBuffer sample_rate,
org.lwjgl.PointerBuffer output)
malloc()ed buffer stored in *output. When you're done with it, just
LibCStdlib.free(java.nio.ByteBuffer) the pointer returned in *output.filename - the file namechannels - returns the number of channelssample_rate - returns the sample rateoutput - returns a pointer to the decoded data@Nullable
public static java.nio.ShortBuffer stb_vorbis_decode_filename(java.lang.CharSequence filename,
java.nio.IntBuffer channels,
java.nio.IntBuffer sample_rate)
malloc()ed buffer stored in *output. When you're done with it, just
LibCStdlib.free(java.nio.ByteBuffer) the pointer returned in *output.filename - the file namechannels - returns the number of channelssample_rate - returns the sample ratepublic static int nstb_vorbis_decode_memory(long mem,
int len,
long channels,
long sample_rate,
long output)
decode_memorylen - the data length, in bytespublic static int stb_vorbis_decode_memory(java.nio.ByteBuffer mem,
java.nio.IntBuffer channels,
java.nio.IntBuffer sample_rate,
org.lwjgl.PointerBuffer output)
decode_filename.mem - the data to decodechannels - returns the number of channelssample_rate - returns the sample rateoutput - returns a pointer to the decoded data@Nullable
public static java.nio.ShortBuffer stb_vorbis_decode_memory(java.nio.ByteBuffer mem,
java.nio.IntBuffer channels,
java.nio.IntBuffer sample_rate)
decode_filename.mem - the data to decodechannels - returns the number of channelssample_rate - returns the sample ratepublic static long nstb_vorbis_open_memory(long mem,
int len,
long error,
long alloc_buffer)
open_memorylen - the data length, in bytespublic static long stb_vorbis_open_memory(java.nio.ByteBuffer mem,
java.nio.IntBuffer error,
@Nullable
STBVorbisAlloc alloc_buffer)
mem - the data to decodeerror - returns an error codealloc_buffer - an STBVorbisAlloc structNULL and sets *error.public static long nstb_vorbis_open_filename(long filename,
long error,
long alloc_buffer)
open_filenamepublic static long stb_vorbis_open_filename(java.nio.ByteBuffer filename,
java.nio.IntBuffer error,
@Nullable
STBVorbisAlloc alloc_buffer)
filename - the file nameerror - returns an error codealloc_buffer - an STBVorbisAlloc structNULL and sets *error.public static long stb_vorbis_open_filename(java.lang.CharSequence filename,
java.nio.IntBuffer error,
@Nullable
STBVorbisAlloc alloc_buffer)
filename - the file nameerror - returns an error codealloc_buffer - an STBVorbisAlloc structNULL and sets *error.public static int nstb_vorbis_seek_frame(long f,
int sample_number)
seek_framepublic static boolean stb_vorbis_seek_frame(long f,
int sample_number)
sample_number. After calling seek_frame(), the next call to get_frame_*() will include the
specified sample.f - an ogg vorbis file decodersample_number - the sample indexpublic static int nstb_vorbis_seek(long f,
int sample_number)
seekpublic static boolean stb_vorbis_seek(long f,
int sample_number)
sample_number. After calling stb_vorbis_seek(), the next call to stb_vorbis_get_samples_*
will start with the specified sample.f - an ogg vorbis file decodersample_number - the sample indexpublic static int nstb_vorbis_seek_start(long f)
seek_startpublic static boolean stb_vorbis_seek_start(long f)
seek(f,0).f - an ogg vorbis file decoderpublic static int nstb_vorbis_stream_length_in_samples(long f)
stream_length_in_samplespublic static int stb_vorbis_stream_length_in_samples(long f)
f - an ogg vorbis file decoderpublic static float nstb_vorbis_stream_length_in_seconds(long f)
stream_length_in_secondspublic static float stb_vorbis_stream_length_in_seconds(long f)
f - an ogg vorbis file decoderpublic static int nstb_vorbis_get_frame_float(long f,
long channels,
long output)
get_frame_floatpublic static int stb_vorbis_get_frame_float(long f,
@Nullable
java.nio.IntBuffer channels,
org.lwjgl.PointerBuffer output)
You generally should not intermix calls to stb_vorbis_get_frame_*() and stb_vorbis_get_samples_*(), since the latter calls the former.
f - an ogg vorbis file decoderchannels - returns the number of channels. Can be NULL -- it is always the same as the number of channels reported by get_info.output - returns a pointer to an array of float* buffers, one per channel. These outputs will be overwritten on the next call to
stb_vorbis_get_frame_*.public static int nstb_vorbis_get_frame_short(long f,
int num_c,
long buffer,
int num_samples)
get_frame_shortnum_c - the number of channelspublic static int stb_vorbis_get_frame_short(long f,
org.lwjgl.PointerBuffer buffer,
int num_samples)
The data is coerced to the number of channels you request according to the channel coercion rules (see below). You must pass in the size of your
buffer(s) so that stb_vorbis will not overwrite the end of the buffer. The maximum buffer size needed can be gotten from get_info; however, the
Vorbis I specification implies an absolute maximum of 4096 samples per channel.
Let M be the number of channels requested, and N the number of channels present, and Cn be the nth channel; let stereo L be the sum of all L and center channels, and stereo R be the sum of all R and center channels (channel assignment from the vorbis spec).
M N output
1 k sum(Ck) for all k
2 * stereo L, stereo R
k l k > l, the first l channels, then 0s
k l k <= l, the first k channels
Note that this is not good surround etc. mixing at all! It's just so you get something useful.
f - an ogg vorbis file decoderbuffer - the output buffer, an array of pointers with length num_c, each pointing to a short array with length num_samplesnum_samples - the number of samplespublic static int nstb_vorbis_get_frame_short_interleaved(long f,
int num_c,
long buffer,
int num_shorts)
get_frame_short_interleavednum_shorts - the size of bufferpublic static int stb_vorbis_get_frame_short_interleaved(long f,
int num_c,
java.nio.ShortBuffer buffer)
get_frame_short.
Note that for interleaved data, you pass in the number of shorts (the size of your array), but the return value is the number of samples per channel, not the total number of samples.
f - an ogg vorbis file decodernum_c - the number of channelsbuffer - the output bufferpublic static int nstb_vorbis_get_samples_float(long f,
int channels,
long buffer,
int num_samples)
get_samples_floatchannels - the number of channels to decodepublic static int stb_vorbis_get_samples_float(long f,
org.lwjgl.PointerBuffer buffer,
int num_samples)
num_samples samples, not necessarily on a frame boundary -- this requires buffering so you have to supply the buffers. DOES NOT APPLY THE
COERCION RULES.f - an ogg vorbis file decoderbuffer - the output buffer, an array of pointers with length channels, each pointing to a float array with length num_samplesnum_samples - the number of samples to decodepublic static int nstb_vorbis_get_samples_float_interleaved(long f,
int channels,
long buffer,
int num_floats)
get_samples_float_interleavednum_floats - the size of bufferpublic static int stb_vorbis_get_samples_float_interleaved(long f,
int channels,
java.nio.FloatBuffer buffer)
get_samples_float.f - an ogg vorbis file decoderchannels - the number of channelsbuffer - the output bufferpublic static int nstb_vorbis_get_samples_short(long f,
int channels,
long buffer,
int num_samples)
get_samples_shortchannels - the number of channelspublic static int stb_vorbis_get_samples_short(long f,
org.lwjgl.PointerBuffer buffer,
int num_samples)
num_samples samples, not necessarily on a frame boundary -- this requires buffering so you have to supply the buffers. Applies the
coercion rules above to produce channels channels.f - an ogg vorbis file decoderbuffer - the output buffer, an array of pointers with length channels, each pointing to a short array with length num_samplesnum_samples - the number of samplespublic static int nstb_vorbis_get_samples_short_interleaved(long f,
int channels,
long buffer,
int num_shorts)
get_samples_short_interleavednum_shorts - the size of bufferpublic static int stb_vorbis_get_samples_short_interleaved(long f,
int channels,
java.nio.ShortBuffer buffer)
get_samples_short.f - an ogg vorbis file decoderchannels - the number of channelsbuffer - the output bufferpublic static long nstb_vorbis_open_pushdata(long datablock,
int datablock_length_in_bytes,
int[] datablock_memory_consumed_in_bytes,
int[] error,
long alloc_buffer)
nstb_vorbis_open_pushdata(long, int, long, long, long)public static long stb_vorbis_open_pushdata(java.nio.ByteBuffer datablock,
int[] datablock_memory_consumed_in_bytes,
int[] error,
@Nullable
STBVorbisAlloc alloc_buffer)
open_pushdatapublic static int nstb_vorbis_decode_frame_pushdata(long f,
long datablock,
int datablock_length_in_bytes,
int[] channels,
long output,
int[] samples)
nstb_vorbis_decode_frame_pushdata(long, long, int, long, long, long)public static int stb_vorbis_decode_frame_pushdata(long f,
java.nio.ByteBuffer datablock,
@Nullable
int[] channels,
org.lwjgl.PointerBuffer output,
int[] samples)
decode_frame_pushdatapublic static int nstb_vorbis_decode_filename(long filename,
int[] channels,
int[] sample_rate,
long output)
nstb_vorbis_decode_filename(long, long, long, long)public static int stb_vorbis_decode_filename(java.nio.ByteBuffer filename,
int[] channels,
int[] sample_rate,
org.lwjgl.PointerBuffer output)
decode_filenamepublic static int stb_vorbis_decode_filename(java.lang.CharSequence filename,
int[] channels,
int[] sample_rate,
org.lwjgl.PointerBuffer output)
decode_filenamepublic static int nstb_vorbis_decode_memory(long mem,
int len,
int[] channels,
int[] sample_rate,
long output)
nstb_vorbis_decode_memory(long, int, long, long, long)public static int stb_vorbis_decode_memory(java.nio.ByteBuffer mem,
int[] channels,
int[] sample_rate,
org.lwjgl.PointerBuffer output)
decode_memorypublic static long nstb_vorbis_open_memory(long mem,
int len,
int[] error,
long alloc_buffer)
nstb_vorbis_open_memory(long, int, long, long)public static long stb_vorbis_open_memory(java.nio.ByteBuffer mem,
int[] error,
@Nullable
STBVorbisAlloc alloc_buffer)
open_memorypublic static long nstb_vorbis_open_filename(long filename,
int[] error,
long alloc_buffer)
nstb_vorbis_open_filename(long, long, long)public static long stb_vorbis_open_filename(java.nio.ByteBuffer filename,
int[] error,
@Nullable
STBVorbisAlloc alloc_buffer)
open_filenamepublic static long stb_vorbis_open_filename(java.lang.CharSequence filename,
int[] error,
@Nullable
STBVorbisAlloc alloc_buffer)
open_filenamepublic static int nstb_vorbis_get_frame_float(long f,
int[] channels,
long output)
nstb_vorbis_get_frame_float(long, long, long)public static int stb_vorbis_get_frame_float(long f,
@Nullable
int[] channels,
org.lwjgl.PointerBuffer output)
get_frame_floatpublic static int nstb_vorbis_get_frame_short_interleaved(long f,
int num_c,
short[] buffer,
int num_shorts)
nstb_vorbis_get_frame_short_interleaved(long, int, long, int)public static int stb_vorbis_get_frame_short_interleaved(long f,
int num_c,
short[] buffer)
get_frame_short_interleavedpublic static int nstb_vorbis_get_samples_float_interleaved(long f,
int channels,
float[] buffer,
int num_floats)
nstb_vorbis_get_samples_float_interleaved(long, int, long, int)public static int stb_vorbis_get_samples_float_interleaved(long f,
int channels,
float[] buffer)
get_samples_float_interleavedpublic static int nstb_vorbis_get_samples_short_interleaved(long f,
int channels,
short[] buffer,
int num_shorts)
nstb_vorbis_get_samples_short_interleaved(long, int, long, int)public static int stb_vorbis_get_samples_short_interleaved(long f,
int channels,
short[] buffer)
get_samples_short_interleavedCopyright LWJGL. All Rights Reserved. License terms.