ALmixer
0.0.5
|
Functions for loading and unloading audio data. More...
Data Structures | |
struct | ALmixer_AudioInfo |
Roughly the equvialent to the Sound_AudioInfo struct in SDL_sound. More... | |
Macros | |
#define | ALMIXER_DEFAULT_BUFFERSIZE 16384 |
#define | ALMIXER_DEFAULT_PREDECODED_BUFFERSIZE ALMIXER_DEFAULT_BUFFERSIZE * 4 |
#define | ALMIXER_DEFAULT_QUEUE_BUFFERS 12 |
Specifies the maximum number of queue buffers to use for a sound stream. More... | |
#define | ALMIXER_DEFAULT_STARTUP_BUFFERS 4 |
Specifies the number of queue buffers initially filled when first loading a stream. More... | |
#define | ALMIXER_DEFAULT_BUFFERS_TO_QUEUE_PER_UPDATE_PASS 2 |
Typedefs | |
typedef struct ALmixer_Data | ALmixer_Data |
Functions | |
ALmixer_Data * | ALmixer_LoadSample_RW (struct ALmixer_RWops *rw_ops, const char *file_ext, ALuint buffer_size, ALboolean decode_mode_is_predecoded, ALuint max_queue_buffers, ALuint num_startup_buffers, ALuint suggested_number_of_buffers_to_queue_per_update_pass, ALuint access_data) |
This is a general loader function to load an audio resource from an RWops. More... | |
ALmixer_Data * | ALmixer_LoadStream_RW (struct ALmixer_RWops *rw_ops, const char *file_ext, ALuint buffer_size, ALuint max_queue_buffers, ALuint num_startup_buffers, ALuint suggested_number_of_buffers_to_queue_per_update_pass, ALuint access_data) |
This is the loader function to load an audio resource from an RWops as a stream. More... | |
ALmixer_Data * | ALmixer_LoadAll_RW (struct ALmixer_RWops *rw_ops, const char *file_ext, ALuint access_data) |
This is the loader function to completely preload an audio resource from an RWops into RAM. More... | |
ALmixer_Data * | ALmixer_LoadSample (const char *file_name, ALuint buffer_size, ALboolean decode_mode_is_predecoded, ALuint max_queue_buffers, ALuint num_startup_buffers, ALuint suggested_number_of_buffers_to_queue_per_update_pass, ALuint access_data) |
This is a general loader function to load an audio resource from a file. More... | |
ALmixer_Data * | ALmixer_LoadStream (const char *file_name, ALuint buffer_size, ALuint max_queue_buffers, ALuint num_startup_buffers, ALuint suggested_number_of_buffers_to_queue_per_update_pass, ALuint access_data) |
This is the loader function to load an audio resource from a file. More... | |
ALmixer_Data * | ALmixer_LoadAll (const char *file_name, ALuint access_data) |
This is the loader function to completely preload an audio resource from a file into RAM. More... | |
ALmixer_Data * | ALmixer_LoadSample_RAW_RW (struct ALmixer_RWops *rw_ops, const char *file_ext, ALmixer_AudioInfo *desired_format, ALuint buffer_size, ALboolean decode_mode_is_predecoded, ALuint max_queue_buffers, ALuint num_startup_buffers, ALuint suggested_number_of_buffers_to_queue_per_update_pass, ALuint access_data) |
This is a back door general loader function for RAW samples or if you need to specify the ALmixer_AudioInfo field. More... | |
ALmixer_Data * | ALmixer_LoadStream_RAW_RW (struct ALmixer_RWops *rw_ops, const char *file_ext, ALmixer_AudioInfo *desired_format, ALuint buffer_size, ALuint max_queue_buffers, ALuint num_startup_buffers, ALuint suggested_number_of_buffers_to_queue_per_update_pass, ALuint access_data) |
This is a back door stream loader function for RAW samples or if you need to specify the ALmixer_AudioInfo field. More... | |
ALmixer_Data * | ALmixer_LoadAll_RAW_RW (struct ALmixer_RWops *rw_ops, const char *file_ext, ALmixer_AudioInfo *desired_format, ALuint access_data) |
This is a back door loader function for complete preloading RAW samples into RAM or if you need to specify the ALmixer_AudioInfo field. More... | |
ALmixer_Data * | ALmixer_LoadSample_RAW (const char *file_name, ALmixer_AudioInfo *desired_format, ALuint buffer_size, ALboolean decode_mode_is_predecoded, ALuint max_queue_buffers, ALuint num_startup_buffers, ALuint suggested_number_of_buffers_to_queue_per_update_pass, ALuint access_data) |
This is a back door general loader function for RAW samples or if you need to specify the ALmixer_AudioInfo field. More... | |
ALmixer_Data * | ALmixer_LoadStream_RAW (const char *file_name, ALmixer_AudioInfo *desired_format, ALuint buffer_size, ALuint max_queue_buffers, ALuint num_startup_buffers, ALuint suggested_number_of_buffers_to_queue_per_update_pass, ALuint access_data) |
This is a back door stream loader function for RAW samples or if you need to specify the ALmixer_AudioInfo field. More... | |
ALmixer_Data * | ALmixer_LoadAll_RAW (const char *file_name, ALmixer_AudioInfo *desired_format, ALuint access_data) |
This is a back door loader function for complete preloading RAW samples into RAM or if you need to specify the ALmixer_AudioInfo field. More... | |
void | ALmixer_FreeData (ALmixer_Data *almixer_data) |
Frees an ALmixer_Data. More... | |
ALboolean | ALmixer_IsPredecoded (ALmixer_Data *almixer_data) |
Returns true if the almixer_data was completely loaded into memory or false if it was loaded as a stream. More... | |
Functions for loading and unloading audio data.
#define ALMIXER_DEFAULT_BUFFERS_TO_QUEUE_PER_UPDATE_PASS 2 |
#define ALMIXER_DEFAULT_BUFFERSIZE 16384 |
#define ALMIXER_DEFAULT_PREDECODED_BUFFERSIZE ALMIXER_DEFAULT_BUFFERSIZE * 4 |
#define ALMIXER_DEFAULT_QUEUE_BUFFERS 12 |
Specifies the maximum number of queue buffers to use for a sound stream.
Default Queue Buffers must be at least 2.
#define ALMIXER_DEFAULT_STARTUP_BUFFERS 4 |
Specifies the number of queue buffers initially filled when first loading a stream.
Default startup buffers should be at least 1.
typedef struct ALmixer_Data ALmixer_Data |
void ALmixer_FreeData | ( | ALmixer_Data * | almixer_data | ) |
Frees an ALmixer_Data.
Releases the memory associated with a ALmixer_Data. Use this when you are done playing the audio sample and wish to release the memory.
almixer_data | The ALmixer_Data* you want to free. |
ALboolean ALmixer_IsPredecoded | ( | ALmixer_Data * | almixer_data | ) |
Returns true if the almixer_data was completely loaded into memory or false if it was loaded as a stream.
almixer_data | The audio resource you want to know about. |
ALmixer_Data* ALmixer_LoadAll | ( | const char * | file_name, |
ALuint | access_data | ||
) |
This is the loader function to completely preload an audio resource from a file into RAM.
file_name | The file to the audio resource you want to load. |
access_data | A boolean that specifies if you want the data contained in the currently playing buffer to be handed to you in a callback function. Note that for predecoded data, you get back the entire buffer in one callback when the audio first starts playing. With streamed data, you get the data in buffer_size chunks. Callbacks are not guarnanteed to be perfectly in-sync as this is a best-effort implementaiton. There are memory and performance considerations for using this feature, so if you don't need data callbacks, you should pass false to this function. |
ALmixer_Data* ALmixer_LoadAll_RAW | ( | const char * | file_name, |
ALmixer_AudioInfo * | desired_format, | ||
ALuint | access_data | ||
) |
This is a back door loader function for complete preloading RAW samples into RAM or if you need to specify the ALmixer_AudioInfo field.
Use at your own risk.
file_name | The file to the audio resource you want to load. Extension should be "raw" for raw formats. |
desired_format | The format you want audio decoded to. NULL will pick a default for you. |
access_data | A boolean that specifies if you want the data contained in the currently playing buffer to be handed to you in a callback function. Note that for predecoded data, you get back the entire buffer in one callback when the audio first starts playing. With streamed data, you get the data in buffer_size chunks. Callbacks are not guarnanteed to be perfectly in-sync as this is a best-effort implementaiton. There are memory and performance considerations for using this feature, so if you don't need data callbacks, you should pass false to this function. |
ALmixer_Data* ALmixer_LoadAll_RAW_RW | ( | struct ALmixer_RWops * | rw_ops, |
const char * | file_ext, | ||
ALmixer_AudioInfo * | desired_format, | ||
ALuint | access_data | ||
) |
This is a back door loader function for complete preloading RAW samples into RAM or if you need to specify the ALmixer_AudioInfo field.
Use at your own risk.
rw_ops | The rwops pointing to the audio resource you want to load. Note: The RWops will automatically be closed for you. Do not call RW_Close yourself. |
file_ext | The file extension of your audio type which is used as a hint by the backend to decide which decoder to use. Pass "raw" for raw formats. |
desired_format | The format you want audio decoded to. NULL will pick a default for you. |
access_data | A boolean that specifies if you want the data contained in the currently playing buffer to be handed to you in a callback function. Note that for predecoded data, you get back the entire buffer in one callback when the audio first starts playing. With streamed data, you get the data in buffer_size chunks. Callbacks are not guarnanteed to be perfectly in-sync as this is a best-effort implementaiton. There are memory and performance considerations for using this feature, so if you don't need data callbacks, you should pass false to this function. |
ALmixer_Data* ALmixer_LoadAll_RW | ( | struct ALmixer_RWops * | rw_ops, |
const char * | file_ext, | ||
ALuint | access_data | ||
) |
This is the loader function to completely preload an audio resource from an RWops into RAM.
rw_ops | The rwops pointing to the audio resource you want to load. Note: The RWops will automatically be closed for you. Do not call RW_Close yourself. |
file_ext | The file extension of your audio type which is used as a hint by the backend to decide which decoder to use. |
access_data | A boolean that specifies if you want the data contained in the currently playing buffer to be handed to you in a callback function. Note that for predecoded data, you get back the entire buffer in one callback when the audio first starts playing. With streamed data, you get the data in buffer_size chunks. Callbacks are not guarnanteed to be perfectly in-sync as this is a best-effort implementaiton. There are memory and performance considerations for using this feature, so if you don't need data callbacks, you should pass false to this function. |
ALmixer_Data* ALmixer_LoadSample | ( | const char * | file_name, |
ALuint | buffer_size, | ||
ALboolean | decode_mode_is_predecoded, | ||
ALuint | max_queue_buffers, | ||
ALuint | num_startup_buffers, | ||
ALuint | suggested_number_of_buffers_to_queue_per_update_pass, | ||
ALuint | access_data | ||
) |
This is a general loader function to load an audio resource from a file.
Generally, you should use the LoadStream and LoadAll specializations of this function instead which call this.
file_name | The file of the audio resource you want to load. |
buffer_size | The size of a buffer to allocate for read chunks. This number should be in quantized with the valid frame sizes of your audio data. If the data is streamed, the data will be read in buffer_size chunks. If the file is to be predecoded, optimizations may occur and this value might be ignored. |
decode_mode_is_predecoded | Specifies whether you want to completely preload the data or stream the data in chunks. |
max_queue_buffers | For streamed data, specifies the maximum number of buffers that can be queued at any given time. |
num_startup_buffers | For streamed data, specifies the number of buffers to fill before playback starts. Buffer underrun conditions will also attempt to restart using this value. |
suggested_number_of_buffers_to_queue_per_update_pass | For each ALmixer_Update() pass, this is the targeted number of buffers that will be queued. |
access_data | A boolean that specifies if you want the data contained in the currently playing buffer to be handed to you in a callback function. Note that for predecoded data, you get back the entire buffer in one callback when the audio first starts playing. With streamed data, you get the data in buffer_size chunks. Callbacks are not guarnanteed to be perfectly in-sync as this is a best-effort implementaiton. There are memory and performance considerations for using this feature, so if you don't need data callbacks, you should pass false to this function. |
ALmixer_Data* ALmixer_LoadSample_RAW | ( | const char * | file_name, |
ALmixer_AudioInfo * | desired_format, | ||
ALuint | buffer_size, | ||
ALboolean | decode_mode_is_predecoded, | ||
ALuint | max_queue_buffers, | ||
ALuint | num_startup_buffers, | ||
ALuint | suggested_number_of_buffers_to_queue_per_update_pass, | ||
ALuint | access_data | ||
) |
This is a back door general loader function for RAW samples or if you need to specify the ALmixer_AudioInfo field.
Use at your own risk. Generally, you should use the LoadStream and LoadAll specializations of this function instead which call this.
file_name | The file to the audio resource you want to load. Extension should be "raw" for raw formats. |
desired_format | The format you want audio decoded to. NULL will pick a default for you. |
buffer_size | The size of a buffer to allocate for read chunks. This number should be in quantized with the valid frame sizes of your audio data. If the data is streamed, the data will be read in buffer_size chunks. If the file is to be predecoded, optimizations may occur and this value might be ignored. |
decode_mode_is_predecoded | Specifies whether you want to completely preload the data or stream the data in chunks. |
max_queue_buffers | For streamed data, specifies the maximum number of buffers that can be queued at any given time. |
num_startup_buffers | For streamed data, specifies the number of buffers to fill before playback starts. Buffer underrun conditions will also attempt to restart using this value. |
suggested_number_of_buffers_to_queue_per_update_pass | For each ALmixer_Update() pass, this is the targeted number of buffers that will be queued. |
access_data | A boolean that specifies if you want the data contained in the currently playing buffer to be handed to you in a callback function. Note that for predecoded data, you get back the entire buffer in one callback when the audio first starts playing. With streamed data, you get the data in buffer_size chunks. Callbacks are not guarnanteed to be perfectly in-sync as this is a best-effort implementaiton. There are memory and performance considerations for using this feature, so if you don't need data callbacks, you should pass false to this function. |
ALmixer_Data* ALmixer_LoadSample_RAW_RW | ( | struct ALmixer_RWops * | rw_ops, |
const char * | file_ext, | ||
ALmixer_AudioInfo * | desired_format, | ||
ALuint | buffer_size, | ||
ALboolean | decode_mode_is_predecoded, | ||
ALuint | max_queue_buffers, | ||
ALuint | num_startup_buffers, | ||
ALuint | suggested_number_of_buffers_to_queue_per_update_pass, | ||
ALuint | access_data | ||
) |
This is a back door general loader function for RAW samples or if you need to specify the ALmixer_AudioInfo field.
Use at your own risk. Generally, you should use the LoadStream and LoadAll specializations of this function instead which call this.
rw_ops | The rwops pointing to the audio resource you want to load. Note: The RWops will automatically be closed for you. Do not call RW_Close yourself. |
file_ext | The file extension of your audio type which is used as a hint by the backend to decide which decoder to use. Pass "raw" for raw formats. |
desired_format | The format you want audio decoded to. NULL will pick a default for you. |
buffer_size | The size of a buffer to allocate for read chunks. This number should be in quantized with the valid frame sizes of your audio data. If the data is streamed, the data will be read in buffer_size chunks. If the file is to be predecoded, optimizations may occur and this value might be ignored. |
decode_mode_is_predecoded | Specifies whether you want to completely preload the data or stream the data in chunks. |
max_queue_buffers | For streamed data, specifies the maximum number of buffers that can be queued at any given time. |
num_startup_buffers | For streamed data, specifies the number of buffers to fill before playback starts. Buffer underrun conditions will also attempt to restart using this value. |
suggested_number_of_buffers_to_queue_per_update_pass | For each ALmixer_Update() pass, this is the targeted number of buffers that will be queued. |
access_data | A boolean that specifies if you want the data contained in the currently playing buffer to be handed to you in a callback function. Note that for predecoded data, you get back the entire buffer in one callback when the audio first starts playing. With streamed data, you get the data in buffer_size chunks. Callbacks are not guarnanteed to be perfectly in-sync as this is a best-effort implementaiton. There are memory and performance considerations for using this feature, so if you don't need data callbacks, you should pass false to this function. |
ALmixer_Data* ALmixer_LoadSample_RW | ( | struct ALmixer_RWops * | rw_ops, |
const char * | file_ext, | ||
ALuint | buffer_size, | ||
ALboolean | decode_mode_is_predecoded, | ||
ALuint | max_queue_buffers, | ||
ALuint | num_startup_buffers, | ||
ALuint | suggested_number_of_buffers_to_queue_per_update_pass, | ||
ALuint | access_data | ||
) |
This is a general loader function to load an audio resource from an RWops.
Generally, you should use the LoadStream and LoadAll specializations of this function instead which call this.
rw_ops | The rwops pointing to the audio resource you want to load. Note: The RWops will automatically be closed for you. Do not call RW_Close yourself. |
file_ext | The file extension of your audio type which is used as a hint by the backend to decide which decoder to use. |
buffer_size | The size of a buffer to allocate for read chunks. This number should be in quantized with the valid frame sizes of your audio data. If the data is streamed, the data will be read in buffer_size chunks. If the file is to be predecoded, optimizations may occur and this value might be ignored. |
decode_mode_is_predecoded | Specifies whether you want to completely preload the data or stream the data in chunks. |
max_queue_buffers | For streamed data, specifies the maximum number of buffers that can be queued at any given time. |
num_startup_buffers | For streamed data, specifies the number of buffers to fill before playback starts. Buffer underrun conditions will also attempt to restart using this value. |
suggested_number_of_buffers_to_queue_per_update_pass | For each ALmixer_Update() pass, this is the targeted number of buffers that will be queued. |
access_data | A boolean that specifies if you want the data contained in the currently playing buffer to be handed to you in a callback function. Note that for predecoded data, you get back the entire buffer in one callback when the audio first starts playing. With streamed data, you get the data in buffer_size chunks. Callbacks are not guarnanteed to be perfectly in-sync as this is a best-effort implementaiton. There are memory and performance considerations for using this feature, so if you don't need data callbacks, you should pass false to this function. |
ALmixer_Data* ALmixer_LoadStream | ( | const char * | file_name, |
ALuint | buffer_size, | ||
ALuint | max_queue_buffers, | ||
ALuint | num_startup_buffers, | ||
ALuint | suggested_number_of_buffers_to_queue_per_update_pass, | ||
ALuint | access_data | ||
) |
This is the loader function to load an audio resource from a file.
file_name | The file to the audio resource you want to load. |
buffer_size | The size of a buffer to allocate for read chunks. This number should be in quantized with the valid frame sizes of your audio data. If the data is streamed, the data will be read in buffer_size chunks. |
max_queue_buffers | For streamed data, specifies the maximum number of buffers that can be queued at any given time. |
num_startup_buffers | For streamed data, specifies the number of buffers to fill before playback starts. Buffer underrun conditions will also attempt to restart using this value. |
suggested_number_of_buffers_to_queue_per_update_pass | For each ALmixer_Update() pass, this is the targeted number of buffers that will be queued. * |
num_startup_buffers | For streamed data, specifies the number of buffers to fill before playback starts. Buffer underrun conditions will also attempt to restart using this value. |
suggested_number_of_buffers_to_queue_per_update_pass | For each ALmixer_Update() pass, this is the targeted number of buffers that will be queued. |
access_data | A boolean that specifies if you want the data contained in the currently playing buffer to be handed to you in a callback function. Note that for predecoded data, you get back the entire buffer in one callback when the audio first starts playing. With streamed data, you get the data in buffer_size chunks. Callbacks are not guarnanteed to be perfectly in-sync as this is a best-effort implementaiton. There are memory and performance considerations for using this feature, so if you don't need data callbacks, you should pass false to this function. |
ALmixer_Data* ALmixer_LoadStream_RAW | ( | const char * | file_name, |
ALmixer_AudioInfo * | desired_format, | ||
ALuint | buffer_size, | ||
ALuint | max_queue_buffers, | ||
ALuint | num_startup_buffers, | ||
ALuint | suggested_number_of_buffers_to_queue_per_update_pass, | ||
ALuint | access_data | ||
) |
This is a back door stream loader function for RAW samples or if you need to specify the ALmixer_AudioInfo field.
Use at your own risk.
file_name | The file to the audio resource you want to load.Extension should be "raw" for raw formats. |
desired_format | The format you want audio decoded to. NULL will pick a default for you. |
buffer_size | The size of a buffer to allocate for read chunks. This number should be in quantized with the valid frame sizes of your audio data. If the data is streamed, the data will be read in buffer_size chunks. If the file is to be predecoded, optimizations may occur and this value might be ignored. |
max_queue_buffers | For streamed data, specifies the maximum number of buffers that can be queued at any given time. |
num_startup_buffers | For streamed data, specifies the number of buffers to fill before playback starts. Buffer underrun conditions will also attempt to restart using this value. |
suggested_number_of_buffers_to_queue_per_update_pass | For each ALmixer_Update() pass, this is the targeted number of buffers that will be queued. |
access_data | A boolean that specifies if you want the data contained in the currently playing buffer to be handed to you in a callback function. Note that for predecoded data, you get back the entire buffer in one callback when the audio first starts playing. With streamed data, you get the data in buffer_size chunks. Callbacks are not guarnanteed to be perfectly in-sync as this is a best-effort implementaiton. There are memory and performance considerations for using this feature, so if you don't need data callbacks, you should pass false to this function. |
ALmixer_Data* ALmixer_LoadStream_RAW_RW | ( | struct ALmixer_RWops * | rw_ops, |
const char * | file_ext, | ||
ALmixer_AudioInfo * | desired_format, | ||
ALuint | buffer_size, | ||
ALuint | max_queue_buffers, | ||
ALuint | num_startup_buffers, | ||
ALuint | suggested_number_of_buffers_to_queue_per_update_pass, | ||
ALuint | access_data | ||
) |
This is a back door stream loader function for RAW samples or if you need to specify the ALmixer_AudioInfo field.
Use at your own risk.
rw_ops | The rwops pointing to the audio resource you want to load. Note: The RWops will automatically be closed for you. Do not call RW_Close yourself. |
file_ext | The file extension of your audio type which is used as a hint by the backend to decide which decoder to use. Pass "raw" for raw formats. |
desired_format | The format you want audio decoded to. NULL will pick a default for you. |
buffer_size | The size of a buffer to allocate for read chunks. This number should be in quantized with the valid frame sizes of your audio data. If the data is streamed, the data will be read in buffer_size chunks. If the file is to be predecoded, optimizations may occur and this value might be ignored. |
max_queue_buffers | For streamed data, specifies the maximum number of buffers that can be queued at any given time. |
num_startup_buffers | For streamed data, specifies the number of buffers to fill before playback starts. Buffer underrun conditions will also attempt to restart using this value. |
suggested_number_of_buffers_to_queue_per_update_pass | For each ALmixer_Update() pass, this is the targeted number of buffers that will be queued. |
access_data | A boolean that specifies if you want the data contained in the currently playing buffer to be handed to you in a callback function. Note that for predecoded data, you get back the entire buffer in one callback when the audio first starts playing. With streamed data, you get the data in buffer_size chunks. Callbacks are not guarnanteed to be perfectly in-sync as this is a best-effort implementaiton. There are memory and performance considerations for using this feature, so if you don't need data callbacks, you should pass false to this function. |
ALmixer_Data* ALmixer_LoadStream_RW | ( | struct ALmixer_RWops * | rw_ops, |
const char * | file_ext, | ||
ALuint | buffer_size, | ||
ALuint | max_queue_buffers, | ||
ALuint | num_startup_buffers, | ||
ALuint | suggested_number_of_buffers_to_queue_per_update_pass, | ||
ALuint | access_data | ||
) |
This is the loader function to load an audio resource from an RWops as a stream.
rw_ops | The rwops pointing to the audio resource you want to load. Note: The RWops will automatically be closed for you. Do not call RW_Close yourself. |
file_ext | The file extension of your audio type which is used as a hint by the backend to decide which decoder to use. |
buffer_size | The size of a buffer to allocate for read chunks. This number should be in quantized with the valid frame sizes of your audio data. If the data is streamed, the data will be read in buffer_size chunks. |
max_queue_buffers | For streamed data, specifies the maximum number of buffers that can be queued at any given time. |
num_startup_buffers | For streamed data, specifies the number of buffers to fill before playback starts. Buffer underrun conditions will also attempt to restart using this value. |
suggested_number_of_buffers_to_queue_per_update_pass | For each ALmixer_Update() pass, this is the targeted number of buffers that will be queued. |
access_data | A boolean that specifies if you want the data contained in the currently playing buffer to be handed to you in a callback function. Note that for predecoded data, you get back the entire buffer in one callback when the audio first starts playing. With streamed data, you get the data in buffer_size chunks. Callbacks are not guarnanteed to be perfectly in-sync as this is a best-effort implementaiton. There are memory and performance considerations for using this feature, so if you don't need data callbacks, you should pass false to this function. |