ALmixer  0.0.5
Functions
Volume and Fading

Fade and volume functions directly call OpenAL functions related to AL_GAIN. More...

Functions

ALint ALmixer_FadeInChannelTimed (ALint which_channel, ALmixer_Data *almixer_data, ALint number_of_loops, ALuint fade_ticks, ALint expire_ticks)
 Similar to ALmixer_PlayChannelTimed except that sound volume fades in from the minimum volume to the current AL_GAIN over the specified amount of time. More...
 
ALint ALmixer_FadeInChannel (ALint which_channel, ALmixer_Data *almixer_data, ALint number_of_loops, ALuint fade_ticks)
 The same as ALmixer_FadeInChannelTimed, but the sound is played without time limits. More...
 
ALuint ALmixer_FadeInSourceTimed (ALuint al_source, ALmixer_Data *almixer_data, ALint number_of_loops, ALuint fade_ticks, ALint expire_ticks)
 Similar to ALmixer_PlaySourceTimed except that sound volume fades in from the minimum volume to the max volume over the specified amount of time. More...
 
ALuint ALmixer_FadeInSource (ALuint al_source, ALmixer_Data *almixer_data, ALint number_of_loops, ALuint fade_ticks)
 The same as ALmixer_FadeInSourceTimed, but the sound is played without time limits. More...
 
ALint ALmixer_FadeOutChannel (ALint which_channel, ALuint fade_ticks)
 Fade out a current playing channel. More...
 
ALint ALmixer_FadeOutSource (ALuint al_source, ALuint fade_ticks)
 Fade out a current playing source. More...
 
ALint ALmixer_FadeChannel (ALint which_channel, ALuint fade_ticks, ALfloat volume)
 Gradually changes the volume from the current AL_GAIN to the specified volume. More...
 
ALint ALmixer_FadeSource (ALuint al_source, ALuint fade_ticks, ALfloat volume)
 Gradually changes the volume from the current AL_GAIN to the specified volume. More...
 
ALboolean ALmixer_SetVolumeChannel (ALint which_channel, ALfloat volume)
 Sets the volume via the AL_GAIN source property. More...
 
ALboolean ALmixer_SetVolumeSource (ALuint al_source, ALfloat volume)
 Sets the volume via the AL_GAIN source property. More...
 
ALfloat ALmixer_GetVolumeChannel (ALint which_channel)
 Gets the volume via the AL_GAIN source property. More...
 
ALfloat ALmixer_GetVolumeSource (ALuint al_source)
 Gets the volume via the AL_GAIN source property. More...
 
ALboolean ALmixer_SetMaxVolumeChannel (ALint which_channel, ALfloat volume)
 Sets the maximum volume via the AL_MAX_GAIN source property. More...
 
ALboolean ALmixer_SetMaxVolumeSource (ALuint al_source, ALfloat volume)
 Sets the maximum volume via the AL_MAX_GAIN source property. More...
 
ALfloat ALmixer_GetMaxVolumeChannel (ALint which_channel)
 Gets the max volume via the AL_MAX_GAIN source property. More...
 
ALfloat ALmixer_GetMaxVolumeSource (ALuint al_source)
 Gets the maximum volume via the AL_MAX_GAIN source property. More...
 
ALboolean ALmixer_SetMinVolumeChannel (ALint which_channel, ALfloat volume)
 Sets the minimum volume via the AL_MIN_GAIN source property. More...
 
ALboolean ALmixer_SetMinVolumeSource (ALuint al_source, ALfloat volume)
 Sets the minimum volume via the AL_MIN_GAIN source property. More...
 
ALfloat ALmixer_GetMinVolumeChannel (ALint which_channel)
 Gets the min volume via the AL_MIN_GAIN source property. More...
 
ALfloat ALmixer_GetMinVolumeSource (ALuint al_source)
 Gets the min volume via the AL_MIN_GAIN source property. More...
 
ALboolean ALmixer_SetMasterVolume (ALfloat new_volume)
 Sets the OpenAL listener AL_GAIN which can be thought of as the "master volume". More...
 
ALfloat ALmixer_GetMasterVolume (void)
 Gets the OpenAL listener AL_GAIN which can be thought of as the "master volume". More...
 

Detailed Description

Fade and volume functions directly call OpenAL functions related to AL_GAIN.

These functions are provided mostly for those who just want to play audio but are not planning to use OpenAL features directly. If you are using OpenAL directly (e.g. for 3D effects), you may want to be careful about using these as they may fight/override values you directly set yourself.

Function Documentation

◆ ALmixer_FadeChannel()

ALint ALmixer_FadeChannel ( ALint  which_channel,
ALuint  fade_ticks,
ALfloat  volume 
)

Gradually changes the volume from the current AL_GAIN to the specified volume.

Gradually changes the volume from the current AL_GAIN to the specified volume over the specified period of time. This is some times referred to as volume ducking. Note that this function works for setting the volume higher as well as lower.

Parameters
which_channelThe channel to fade or -1 to fade all playing channels.
fade_ticksIn milliseconds, the amount of time the volume change should take to complete.
volumeThe volume to change to. Valid values are 0.0 to 1.0.
Returns
Returns -1 on error or the number of channels faded.

◆ ALmixer_FadeInChannel()

ALint ALmixer_FadeInChannel ( ALint  which_channel,
ALmixer_Data almixer_data,
ALint  number_of_loops,
ALuint  fade_ticks 
)

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

See also
ALmixer_FadeInChannelTimed, ALmixer_PlayChannel.

◆ ALmixer_FadeInChannelTimed()

ALint ALmixer_FadeInChannelTimed ( ALint  which_channel,
ALmixer_Data almixer_data,
ALint  number_of_loops,
ALuint  fade_ticks,
ALint  expire_ticks 
)

Similar to ALmixer_PlayChannelTimed except that sound volume fades in from the minimum volume to the current AL_GAIN over the specified amount of time.

See also
ALmixer_PlayChannelTimed.

◆ ALmixer_FadeInSource()

ALuint ALmixer_FadeInSource ( ALuint  al_source,
ALmixer_Data almixer_data,
ALint  number_of_loops,
ALuint  fade_ticks 
)

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

See also
ALmixer_FadeInSourceTimed, ALmixer_PlaySource.

◆ ALmixer_FadeInSourceTimed()

ALuint ALmixer_FadeInSourceTimed ( ALuint  al_source,
ALmixer_Data almixer_data,
ALint  number_of_loops,
ALuint  fade_ticks,
ALint  expire_ticks 
)

Similar to ALmixer_PlaySourceTimed except that sound volume fades in from the minimum volume to the max volume over the specified amount of time.

See also
ALmixer_PlaySourceTimed.

◆ ALmixer_FadeOutChannel()

ALint ALmixer_FadeOutChannel ( ALint  which_channel,
ALuint  fade_ticks 
)

Fade out a current playing channel.

Will fade out a currently playing channel over the specified period of time starting from now. The volume will be changed from the current AL_GAIN level to the AL_MIN_GAIN. The volume fade will interpolate over the specified period of time. The playback will halt at the end of the time period.

Parameters
which_channelThe channel to fade or -1 to fade all playing channels.
fade_ticksIn milliseconds, the amount of time the fade out should take to complete.
Returns
Returns -1 on error or the number of channels faded.

◆ ALmixer_FadeOutSource()

ALint ALmixer_FadeOutSource ( ALuint  al_source,
ALuint  fade_ticks 
)

Fade out a current playing source.

Will fade out a currently playing source over the specified period of time starting from now. The volume will be changed from the current AL_GAIN level to the AL_MIN_GAIN. The volume fade will interpolate over the specified period of time. The playback will halt at the end of the time period.

Parameters
al_sourceThe source to fade or -1 to fade all playing sources.
fade_ticksIn milliseconds, the amount of time the fade out should take to complete.
Returns
Returns -1 on error or the number of sources faded.

◆ ALmixer_FadeSource()

ALint ALmixer_FadeSource ( ALuint  al_source,
ALuint  fade_ticks,
ALfloat  volume 
)

Gradually changes the volume from the current AL_GAIN to the specified volume.

Gradually changes the volume from the current AL_GAIN to the specified volume over the specified period of time. This is some times referred to as volume ducking. Note that this function works for setting the volume higher as well as lower.

Parameters
al_sourceThe source to fade or -1 to fade all playing sources.
fade_ticksIn milliseconds, the amount of time the volume change should take to complete.
volumeThe volume to change to. Valid values are 0.0 to 1.0.
Returns
Returns -1 on error or the number of sources faded.

◆ ALmixer_GetMasterVolume()

ALfloat ALmixer_GetMasterVolume ( void  )

Gets the OpenAL listener AL_GAIN which can be thought of as the "master volume".

Gets the OpenAL listener AL_GAIN which can be thought of as the "master volume".

Returns
The current volume level on the listener. -1.0 will be returned on an error.

◆ ALmixer_GetMaxVolumeChannel()

ALfloat ALmixer_GetMaxVolumeChannel ( ALint  which_channel)

Gets the max volume via the AL_MAX_GAIN source property.

Gets the max volume for a given channel via the AL_MAX_GAIN source property.

Parameters
which_channelThe channel to get the volume from. -1 will return the average volume set across all channels.
Returns
Returns the volume for the specified channel, or the average set volume for all channels, or -1.0 on error.

◆ ALmixer_GetMaxVolumeSource()

ALfloat ALmixer_GetMaxVolumeSource ( ALuint  al_source)

Gets the maximum volume via the AL_MAX_GAIN source property.

Gets the maximum volume for a given source via the AL_MAX_GAIN source property.

Parameters
al_sourceThe source to set the volume to or 0 to set on all sources. 0 will return the average volume set across all channels.
Returns
Returns the volume for the specified channel, or the average set volume for all channels, or -1.0 on error.

◆ ALmixer_GetMinVolumeChannel()

ALfloat ALmixer_GetMinVolumeChannel ( ALint  which_channel)

Gets the min volume via the AL_MIN_GAIN source property.

Gets the min volume for a given channel via the AL_MIN_GAIN source property.

Parameters
which_channelThe channel to get the volume from. -1 will return the average volume set across all channels.
Returns
Returns the volume for the specified channel, or the average set volume for all channels, or -1.0 on error.

◆ ALmixer_GetMinVolumeSource()

ALfloat ALmixer_GetMinVolumeSource ( ALuint  al_source)

Gets the min volume via the AL_MIN_GAIN source property.

Gets the min volume for a given source via the AL_MIN_GAIN source property.

Parameters
al_sourceThe source to set the volume to or 0 to set on all sources. 0 will return the average volume set across all channels.
Returns
Returns the volume for the specified channel, or the average set volume for all channels, or -1.0 on error.

◆ ALmixer_GetVolumeChannel()

ALfloat ALmixer_GetVolumeChannel ( ALint  which_channel)

Gets the volume via the AL_GAIN source property.

Gets the volume for a given channel via the AL_GAIN source property.

Parameters
which_channelThe channel to get the volume from. -1 will return the average volume set across all channels.
Returns
Returns the volume for the specified channel, or the average set volume for all channels, or -1.0 on error.

◆ ALmixer_GetVolumeSource()

ALfloat ALmixer_GetVolumeSource ( ALuint  al_source)

Gets the volume via the AL_GAIN source property.

Gets the volume for a given source via the AL_GAIN source property.

Parameters
al_sourceThe source to get the volume from. -1 will return the average volume set across all source.
Returns
Returns the volume for the specified source, or the average set volume for all sources, or -1.0 on error.

◆ ALmixer_SetMasterVolume()

ALboolean ALmixer_SetMasterVolume ( ALfloat  new_volume)

Sets the OpenAL listener AL_GAIN which can be thought of as the "master volume".

Sets the OpenAL listener AL_GAIN which can be thought of as the "master volume".

Parameters
new_volumeThe new volume level to be set. Range is 0.0 to 1.0 where 1.0 is the max volume.
Returns
AL_TRUE on success or AL_FALSE on an error.

◆ ALmixer_SetMaxVolumeChannel()

ALboolean ALmixer_SetMaxVolumeChannel ( ALint  which_channel,
ALfloat  volume 
)

Sets the maximum volume via the AL_MAX_GAIN source property.

Sets the maximum volume for a given channel via the AL_MAX_GAIN source property. Max volumes will be clamped to this value.

Parameters
which_channelThe channel to set the volume to or -1 to set on all channels.
volumeThe new volume to use. Valid values are 0.0 to 1.0.
Returns
AL_TRUE on success or AL_FALSE on error.

◆ ALmixer_SetMaxVolumeSource()

ALboolean ALmixer_SetMaxVolumeSource ( ALuint  al_source,
ALfloat  volume 
)

Sets the maximum volume via the AL_MAX_GAIN source property.

Sets the maximum volume for a given source via the AL_MAX_GAIN source property.

Parameters
al_sourceThe source to set the volume to or 0 to set on all sources.
volumeThe new volume to use. Valid values are 0.0 to 1.0.
Returns
AL_TRUE on success or AL_FALSE on error.

◆ ALmixer_SetMinVolumeChannel()

ALboolean ALmixer_SetMinVolumeChannel ( ALint  which_channel,
ALfloat  volume 
)

Sets the minimum volume via the AL_MIN_GAIN source property.

Sets the minimum volume for a given channel via the AL_MIN_GAIN source property. Min volumes will be clamped to this value.

Parameters
which_channelThe channel to set the volume to or -1 to set on all channels.
volumeThe new volume to use. Valid values are 0.0 to 1.0.
Returns
AL_TRUE on success or AL_FALSE on error.

◆ ALmixer_SetMinVolumeSource()

ALboolean ALmixer_SetMinVolumeSource ( ALuint  al_source,
ALfloat  volume 
)

Sets the minimum volume via the AL_MIN_GAIN source property.

Sets the minimum volume for a given source via the AL_MIN_GAIN source property.

Parameters
al_sourceThe source to set the volume to or 0 to set on all sources.
volumeThe new volume to use. Valid values are 0.0 to 1.0.
Returns
AL_TRUE on success or AL_FALSE on error.

◆ ALmixer_SetVolumeChannel()

ALboolean ALmixer_SetVolumeChannel ( ALint  which_channel,
ALfloat  volume 
)

Sets the volume via the AL_GAIN source property.

Sets the volume for a given channel via the AL_GAIN source property.

Parameters
which_channelThe channel to set the volume to or -1 to set on all channels.
volumeThe new volume to use. Valid values are 0.0 to 1.0.
Returns
AL_TRUE on success or AL_FALSE on error.

◆ ALmixer_SetVolumeSource()

ALboolean ALmixer_SetVolumeSource ( ALuint  al_source,
ALfloat  volume 
)

Sets the volume via the AL_GAIN source property.

Sets the volume for a given source via the AL_GAIN source property.

Parameters
al_sourceThe source to set the volume to or 0 to set on all sources.
volumeThe new volume to use. Valid values are 0.0 to 1.0.
Returns
AL_TRUE on success or AL_FALSE on error.