mixVolume function

int mixVolume(
  1. int channel,
  2. int volume
)

Set the volume for a specific channel.

The volume must be between 0 (silence) and MIX_MAX_VOLUME (full volume). Note that MIX_MAX_VOLUME is 128. Values greater than MIX_MAX_VOLUME are clamped to MIX_MAX_VOLUME.

Specifying a negative volume will not change the current volume; as such, this can be used to query the current volume without making changes, as this function returns the previous (in this case, still-current) value.

If the specified channel is -1, this function sets the volume for all channels, and returns the average of all channels' volumes prior to this call.

The default volume for a channel is MIX_MAX_VOLUME (no attenuation).

\param channel the channel on set/query the volume on, or -1 for all channels. \param volume the new volume, between 0 and MIX_MAX_VOLUME, or -1 to query. \returns the previous volume. If the specified volume is -1, this returns the current volume. If channel is -1, this returns the average of all channels.

\since This function is available since SDL_mixer 2.0.0.

extern DECLSPEC int SDLCALL Mix_Volume(int channel, int volume)

Implementation

int mixVolume(int channel, int volume) {
  final mixVolumeLookupFunction = libSdl2Mixer.lookupFunction<
      Int32 Function(Int32 channel, Int32 volume),
      int Function(int channel, int volume)>('Mix_Volume');
  return mixVolumeLookupFunction(channel, volume);
}