ALmixer  0.0.5
Functions
Functions useful for playback.

These are core functions that are useful for controlling playback. More...

Functions

ALint ALmixer_GetTotalTime (ALmixer_Data *almixer_data)
 Returns the total time in milliseconds of the audio resource. More...
 
ALuint ALmixer_GetSource (ALint which_channel)
 This function will look up the OpenAL source id for the corresponding channel number. More...
 
ALint ALmixer_GetChannel (ALuint al_source)
 This function will look up the channel for the corresponding source. More...
 
ALint ALmixer_FindFreeChannel (ALint start_channel)
 Will look for a channel available for playback. More...
 
ALint ALmixer_PlayChannelTimed (ALint which_channel, ALmixer_Data *almixer_data, ALint number_of_loops, ALint number_of_milliseconds)
 Play a sound on a channel with a time limit. More...
 
ALint ALmixer_PlayChannel (ALint which_channel, ALmixer_Data *almixer_data, ALint number_of_loops)
 The same as ALmixer_PlayChannelTimed, but the sound is played without time limits. More...
 
ALuint ALmixer_PlaySourceTimed (ALuint al_source, ALmixer_Data *almixer_data, ALint number_of_loops, ALint number_of_milliseconds)
 Play a sound on an OpenAL source with a time limit. More...
 
ALuint ALmixer_PlaySource (ALuint al_source, ALmixer_Data *almixer_data, ALint number_of_loops)
 The same as ALmixer_PlaySourceTimed, but the sound is played without time limits. More...
 
ALint ALmixer_HaltChannel (ALint which_channel)
 Stops playback on a channel. More...
 
ALint ALmixer_HaltSource (ALuint al_source)
 Stops playback on a channel. More...
 
ALboolean ALmixer_RewindData (ALmixer_Data *almixer_data)
 Rewinds the sound to the beginning for a given data. More...
 
ALint ALmixer_RewindChannel (ALint which_channel)
 Rewinds the sound to the beginning that is playing on a specific channel. More...
 
ALint ALmixer_RewindSource (ALuint al_source)
 Rewinds the sound to the beginning that is playing on a specific source. More...
 
ALboolean ALmixer_SeekData (ALmixer_Data *almixer_data, ALuint msec_pos)
 Seek the sound for a given data. More...
 
ALint ALmixer_SeekChannel (ALint which_channel, ALuint msec_pos)
 Seeks the sound to the beginning that is playing on a specific channel. More...
 
ALint ALmixer_SeekSource (ALuint al_source, ALuint msec_pos)
 Seeks the sound to the beginning that is playing on a specific source. More...
 
ALint ALmixer_PauseChannel (ALint which_channel)
 Pauses playback on a channel. More...
 
ALint ALmixer_PauseSource (ALuint al_source)
 Pauses playback on a source. More...
 
ALint ALmixer_ResumeChannel (ALint which_channel)
 Resumes playback on a channel that is paused. More...
 
ALint ALmixer_ResumeSource (ALuint al_source)
 Resumes playback on a source that is paused. More...
 
ALint ALmixer_ExpireChannel (ALint which_channel, ALint number_of_milliseconds)
 Will cause a currently playing channel to stop playing in the specified number of milliseconds. More...
 
ALint ALmixer_ExpireSource (ALuint al_source, ALint number_of_milliseconds)
 Will cause a currently playing source to stop playing in the specified number of milliseconds. More...
 

Detailed Description

These are core functions that are useful for controlling playback.

Also see the Volume functions for additional playback functions and Query functions for additional information.

Function Documentation

◆ ALmixer_ExpireChannel()

ALint ALmixer_ExpireChannel ( ALint  which_channel,
ALint  number_of_milliseconds 
)

Will cause a currently playing channel to stop playing in the specified number of milliseconds.

Will cause a currently playing channel to stop playing in the specified number of milliseconds. This will override the value that was set when PlayChannelTimed or PlaySourceTimed was called or override any previous calls to ExpireChannel or ExpireSource.

Parameters
which_channelThe channel to expire or -1 to apply to all channels.
number_of_millisecondsHow many milliseconds from now until the expire triggers.
Returns
The actual number of channels this action is applied to on success or -1 on error.

◆ ALmixer_ExpireSource()

ALint ALmixer_ExpireSource ( ALuint  al_source,
ALint  number_of_milliseconds 
)

Will cause a currently playing source to stop playing in the specified number of milliseconds.

Will cause a currently playing source to stop playing in the specified number of milliseconds. This will override the value that was set when PlayChannelTimed or PlaySourceTimed was called or override any previous calls to ExpireChannel or ExpireSource.

Parameters
al_sourceThe source to expire or 0 to apply to all sources.
number_of_millisecondsHow many milliseconds from now until the expire triggers.
Returns
The actual number of sources this action is applied to on success or -1 on error.

◆ ALmixer_FindFreeChannel()

ALint ALmixer_FindFreeChannel ( ALint  start_channel)

Will look for a channel available for playback.

Given a start channel number, the search will increase to the highest channel until it finds one available.

Parameters
start_channelThe channel number you want to start looking at.
Returns
A channel available or -1 if none could be found.

◆ ALmixer_GetChannel()

ALint ALmixer_GetChannel ( ALuint  al_source)

This function will look up the channel for the corresponding source.

Parameters
al_sourceThe source id you want to find the corresponding channel number for. If 0 is supplied, it will try to return the first channel not in use. Returns -1 on error, or the channel.

◆ ALmixer_GetSource()

ALuint ALmixer_GetSource ( ALint  which_channel)

This function will look up the OpenAL source id for the corresponding channel number.

Parameters
which_channelThe channel which you want to find the corresponding OpenAL source id for. If -1 was specified, an available source for playback will be returned.
Returns
The OpenAL source id corresponding to the channel. 0 if you specified an illegal channel value. Or 0 if you specified -1 and no sources were currently available.
Note
ALmixer assumes your OpenAL implementation does not use 0 as a valid source ID. While the OpenAL spec does not disallow 0 for valid source ids, as of now, there are no known OpenAL implementations in use that use 0 as a valid source id (partly due to problems this has caused developers in the past).

◆ ALmixer_GetTotalTime()

ALint ALmixer_GetTotalTime ( ALmixer_Data almixer_data)

Returns the total time in milliseconds of the audio resource.

Returns the total time in milliseconds of the audio resource. If the total length cannot be determined, -1 will be returned.

Parameters
almixer_dataThe audio sample you want to know the total time of.
Returns
The total time in milliseconds or -1 if some kind of failure.

◆ ALmixer_HaltChannel()

ALint ALmixer_HaltChannel ( ALint  which_channel)

Stops playback on a channel.

Stops playback on a channel and clears the channel so it can be played on again.

Note
Callbacks will still be invoked, but the finished_naturally flag will be set to AL_FALSE.
Parameters
which_channelThe channel to halt or -1 to halt all channels.
Returns
The actual number of channels halted on success or -1 on error.

◆ ALmixer_HaltSource()

ALint ALmixer_HaltSource ( ALuint  al_source)

Stops playback on a channel.

Stops playback on a channel and clears the channel so it can be played on again.

Note
Callbacks will still be invoked, but the finished_naturally flag will be set to AL_FALSE.
Parameters
al_sourceThe source to halt or 0 to halt all sources.
Returns
The actual number of sources halted on success or -1 on error.

◆ ALmixer_PauseChannel()

ALint ALmixer_PauseChannel ( ALint  which_channel)

Pauses playback on a channel.

Pauses playback on a channel. Should have no effect on channels that aren't playing.

Parameters
which_channelThe channel to pause or -1 to pause all channels.
Returns
The actual number of channels paused on success or -1 on error.

◆ ALmixer_PauseSource()

ALint ALmixer_PauseSource ( ALuint  al_source)

Pauses playback on a source.

Pauses playback on a source. Should have no effect on source that aren't playing.

Parameters
al_sourceThe source to pause or -1 to pause all source.
Returns
The actual number of source paused on success or -1 on error.

◆ ALmixer_PlayChannel()

ALint ALmixer_PlayChannel ( ALint  which_channel,
ALmixer_Data almixer_data,
ALint  number_of_loops 
)

The same as ALmixer_PlayChannelTimed, but the sound is played without time limits.

See also
ALmixer_PlayChannelTimed.

◆ ALmixer_PlayChannelTimed()

ALint ALmixer_PlayChannelTimed ( ALint  which_channel,
ALmixer_Data almixer_data,
ALint  number_of_loops,
ALint  number_of_milliseconds 
)

Play a sound on a channel with a time limit.

Plays a sound on a channel and will auto-stop after a specified number of milliseconds.

Parameters
which_channelAllows you to specify the specific channel you want to play on. Channels range from 0 to the (Number of allocated channels - 1). If you specify -1, an available channel will be chosen automatically for you.
Note
While paused, the auto-stop clock will also be paused. This makes it easy to always stop a sample by a predesignated length without worrying about whether the user paused playback which would throw off your calculations.
Parameters
almixer_dataThe audio resource you want to play.
number_of_loopsThe number of times to loop (repeat) playing the data. 0 means the data will play exactly once without repeat. -1 means infinitely loop.
number_of_millisecondsThe number of milliseconds that should be played until the sample is auto-stopped. -1 means don't auto-stop playing and let the sample finish playing normally (or if looping is set to infinite, the sample will never stop playing).
Returns
Returns the channel that was selected for playback or -1 if no channels were available.

◆ ALmixer_PlaySource()

ALuint ALmixer_PlaySource ( ALuint  al_source,
ALmixer_Data almixer_data,
ALint  number_of_loops 
)

The same as ALmixer_PlaySourceTimed, but the sound is played without time limits.

See also
ALmixer_PlaySourceTimed.

◆ ALmixer_PlaySourceTimed()

ALuint ALmixer_PlaySourceTimed ( ALuint  al_source,
ALmixer_Data almixer_data,
ALint  number_of_loops,
ALint  number_of_milliseconds 
)

Play a sound on an OpenAL source with a time limit.

Plays a sound on an OpenAL source and will auto-stop after a specified number of milliseconds.

Parameters
al_sourceAllows you to specify the OpenAL source you want to play on. If you specify 0, an available source will be chosen automatically for you.
Note
Source values are not necessarily continguous and their values are implementation dependent. Always use ALmixer functions to determine source values.
While paused, the auto-stop clock will also be paused. This makes it easy to always stop a sample by a predesignated length without worrying about whether the user paused playback which would throw off your calculations.
Parameters
almixer_dataThe audio resource you want to play.
number_of_loopsThe number of times to loop (repeat) playing the data. 0 means the data will play exactly once without repeat. -1 means infinitely loop.
number_of_millisecondsThe number of milliseconds that should be played until the sample is auto-stopped. -1 means don't auto-stop playing and let the sample finish playing normally (or if looping is set to infinite, the sample will never stop playing).
Returns
Returns the OpenAL source that was selected for playback or 0 if no sources were available.

◆ ALmixer_ResumeChannel()

ALint ALmixer_ResumeChannel ( ALint  which_channel)

Resumes playback on a channel that is paused.

Resumes playback on a channel that is paused. Should have no effect on channels that aren't paused.

Parameters
which_channelThe channel to resume or -1 to resume all channels.
Returns
The actual number of channels resumed on success or -1 on error.

◆ ALmixer_ResumeSource()

ALint ALmixer_ResumeSource ( ALuint  al_source)

Resumes playback on a source that is paused.

Resumes playback on a source that is paused. Should have no effect on sources that aren't paused.

Parameters
al_sourceThe source to resume or -1 to resume all sources.
Returns
The actual number of sources resumed on success or -1 on error.

◆ ALmixer_RewindChannel()

ALint ALmixer_RewindChannel ( ALint  which_channel)

Rewinds the sound to the beginning that is playing on a specific channel.

If decoded all, rewind will instantly rewind it. Data is not affected, so it will start at the "Seek"'ed positiond. Streamed data will rewind the actual data, but the effect may not be noticed until the currently buffered data is played.

Parameters
which_channelThe channel to rewind or -1 to rewind all channels.
Returns
The actual number of channels rewound on success or -1 on error.

◆ ALmixer_RewindData()

ALboolean ALmixer_RewindData ( ALmixer_Data almixer_data)

Rewinds the sound to the beginning for a given data.

Rewinds the actual data, but the effect may not be noticed until the currently buffered data is played.

Parameters
almixer_dataThe data to rewind.
Returns
true on success or false on error.

◆ ALmixer_RewindSource()

ALint ALmixer_RewindSource ( ALuint  al_source)

Rewinds the sound to the beginning that is playing on a specific source.

If decoded all, rewind will instantly rewind it. Data is not affected, so it will start at the "Seek"'ed positiond. Streamed data will rewind the actual data, but the effect may not be noticed until the currently buffered data is played.

Parameters
al_sourceThe source to rewind or 0 to rewind all sources.
Returns
The actual number of sources rewound on success or -1 on error.

◆ ALmixer_SeekChannel()

ALint ALmixer_SeekChannel ( ALint  which_channel,
ALuint  msec_pos 
)

Seeks the sound to the beginning that is playing on a specific channel.

If decoded all, seek will instantly seek it. Data is not affected, so it will start at the "Seek"'ed positiond. Streamed data will seek the actual data, but the effect may not be noticed until the currently buffered data is played.

Parameters
which_channelThe channel to seek or -1 to seek all channels.
Returns
The actual number of channels rewound on success or -1 on error.

◆ ALmixer_SeekData()

ALboolean ALmixer_SeekData ( ALmixer_Data almixer_data,
ALuint  msec_pos 
)

Seek the sound for a given data.

Seeks the actual data to the given millisecond. It may not be noticed until the currently buffered data is played.

Parameters
almixer_dataThe data to seek on.
msec_posThe time position to seek to in the audio in milliseconds.
Returns
true on success or false on error.

◆ ALmixer_SeekSource()

ALint ALmixer_SeekSource ( ALuint  al_source,
ALuint  msec_pos 
)

Seeks the sound to the beginning that is playing on a specific source.

If decoded all, seek will instantly seek it. Data is not affected, so it will start at the "Seek"'ed positiond. Streamed data will seek the actual data, but the effect may not be noticed until the currently buffered data is played.

Parameters
al_sourceThe source to seek or 0 to seek all sources.
Returns
The actual number of sources rewound on success or -1 on error.