Functions and definitions for advanced audio management in OSLib.
More...
|
typedef int(* | oslAudioThreadfunc_t) (int args, void *argp) |
| Defines a function type for audio threading.
|
|
|
int | oslGetSoundChannel (OSL_SOUND *s) |
| Retrieves the channel number on which a specific sound is currently being played.
|
|
int | oslAudioCreateChannel (int i, int format, int numSamples, OSL_SOUND *s) |
| Creates an audio channel.
|
|
int | oslAudioRecreateChannel (int i, int format, int numSamples, OSL_SOUND *s) |
| Recreates an existing audio channel with new parameters.
|
|
void | oslAudioDeleteChannel (int i) |
| Deletes an audio channel.
|
|
int | oslAudioOutBlocking (unsigned int channel, unsigned int vol1, unsigned int vol2, void *buf) |
| Outputs audio to a channel, blocking until completion.
|
|
int | oslSoundLoopFunc (OSL_SOUND *s, int voice) |
| Callback function that loops a sound indefinitely.
|
|
Functions and definitions for advanced audio management in OSLib.
◆ oslAudioThreadfunc_t
typedef int(* oslAudioThreadfunc_t) (int args, void *argp) |
Defines a function type for audio threading.
- Parameters
-
args | Number of arguments passed to the thread function. |
argp | Pointer to the argument list. |
- Returns
- Should return 0 on success or a negative error code on failure.
◆ oslGetSoundChannel()
Retrieves the channel number on which a specific sound is currently being played.
This function checks the active audio channels and returns the channel number where the specified sound is playing. If the sound is not active on any channel, it returns -1, indicating that the sound is not currently being played.
This is useful for managing audio dynamically within an application, allowing for checks on sound states before making decisions on audio control (such as stopping or altering playback).
- Parameters
-
s | Pointer to an OSL_SOUND structure representing the sound to check. The sound object should have been initialized and possibly started playing before calling this function. |
- Returns
- The channel number (ranging from 0 to the maximum number of channels minus one) on which the sound is playing, or -1 if the sound is not currently active.
This function can be part of the Advanced Audio Management group, as it provides essential information for advanced audio management tasks.
◆ oslAudioCreateChannel()
int oslAudioCreateChannel |
( |
int | i, |
|
|
int | format, |
|
|
int | numSamples, |
|
|
OSL_SOUND * | s ) |
|
extern |
Creates an audio channel.
- Parameters
-
i | Channel index to be created. |
format | Audio format for the channel (e.g., OSL_FMT_MONO, OSL_FMT_STEREO). |
numSamples | Number of samples to handle per audio frame. |
s | Pointer to the OSL_SOUND structure associated with the channel. |
- Returns
- Returns 0 on success or a negative error code on failure.
◆ oslAudioRecreateChannel()
int oslAudioRecreateChannel |
( |
int | i, |
|
|
int | format, |
|
|
int | numSamples, |
|
|
OSL_SOUND * | s ) |
|
extern |
Recreates an existing audio channel with new parameters.
- Parameters
-
i | Channel index to be recreated. |
format | New audio format for the channel. |
numSamples | New number of samples to handle per audio frame. |
s | Pointer to the OSL_SOUND structure associated with the channel. |
- Returns
- Returns 0 on success or a negative error code on failure.
◆ oslAudioDeleteChannel()
void oslAudioDeleteChannel |
( |
int | i | ) |
|
|
extern |
Deletes an audio channel.
- Parameters
-
i | Channel index to be deleted. |
◆ oslAudioOutBlocking()
int oslAudioOutBlocking |
( |
unsigned int | channel, |
|
|
unsigned int | vol1, |
|
|
unsigned int | vol2, |
|
|
void * | buf ) |
|
extern |
Outputs audio to a channel, blocking until completion.
- Parameters
-
channel | Channel index where audio should be output. |
vol1 | Volume level for the left audio channel. |
vol2 | Volume level for the right audio channel. |
buf | Pointer to the buffer containing audio data to be played. |
- Returns
- Returns the number of samples played.
◆ oslSoundLoopFunc()
int oslSoundLoopFunc |
( |
OSL_SOUND * | s, |
|
|
int | voice ) |
|
extern |
Callback function that loops a sound indefinitely.
This standard callback function is designed to loop a sound. It can be set as the sound end callback for a sound object using oslSetSoundLoop. When the sound reaches the end, this function is invoked to immediately restart it, creating a continuous loop effect.
- Parameters
-
s | Pointer to the OSL_SOUND structure of the sound that finished playing. |
voice | The channel number on which the sound was playing. |
- Returns
- Always returns 1 to indicate that the sound should continue playing.
◆ osl_audioVoices
Array of OSL_AUDIO_VOICE structures, representing each audio channel's current properties.
This array holds information about all active audio voices within the system. Each entry in the array represents a channel and includes properties such as the currently playing sound.