mirror of
https://github.com/libsdl-org/SDL.git
synced 2026-06-22 14:01:55 +00:00
audio: allow backends to set the volume themselves for physical devices
this allows system per-app volume sliders to work as expected
This commit is contained in:
parent
dc8b189491
commit
37515a9fea
4 changed files with 111 additions and 34 deletions
|
|
@ -862,8 +862,8 @@ extern SDL_DECLSPEC bool SDLCALL SDL_AudioDevicePaused(SDL_AudioDeviceID devid);
|
|||
*
|
||||
* Audio devices default to a gain of 1.0f (no change in output).
|
||||
*
|
||||
* Physical devices may not have their gain changed, only logical devices, and
|
||||
* this function will always return -1.0f when used on physical devices.
|
||||
* Physical device gain support depends on the backend. -1.0f will be returned
|
||||
* if it is not supported.
|
||||
*
|
||||
* \param devid the audio device to query.
|
||||
* \returns the gain of the device or -1.0f on failure; call SDL_GetError()
|
||||
|
|
@ -885,18 +885,16 @@ extern SDL_DECLSPEC float SDLCALL SDL_GetAudioDeviceGain(SDL_AudioDeviceID devid
|
|||
*
|
||||
* Audio devices default to a gain of 1.0f (no change in output).
|
||||
*
|
||||
* Physical devices may not have their gain changed, only logical devices, and
|
||||
* this function will always return false when used on physical devices. While
|
||||
* it might seem attractive to adjust several logical devices at once in this
|
||||
* way, it would allow an app or library to interfere with another portion of
|
||||
* the program's otherwise-isolated devices.
|
||||
* Support for gain changes of physical devices depends on the backend. It will
|
||||
* return false if it is not supported; likely you should fall back to changing
|
||||
* the logical device gain in that case.
|
||||
*
|
||||
* This is applied, along with any per-audiostream gain, during playback to
|
||||
* the hardware, and can be continuously changed to create various effects. On
|
||||
* recording devices, this will adjust the gain before passing the data into
|
||||
* an audiostream; that recording audiostream can then adjust its gain further
|
||||
* when outputting the data elsewhere, if it likes, but that second gain is
|
||||
* not applied until the data leaves the audiostream again.
|
||||
* For logical devices this is applied, along with any per-audiostream gain,
|
||||
* during playback to the hardware, and can be continuously changed to create
|
||||
* various effects. On recording devices, this will adjust the gain before
|
||||
* passing the data into an audiostream; that recording audiostream can then
|
||||
* adjust its gain further when outputting the data elsewhere, if it likes, but
|
||||
* that second gain is not applied until the data leaves the audiostream again.
|
||||
*
|
||||
* \param devid the audio device on which to change gain.
|
||||
* \param gain the gain. 1.0f is no change, 0.0f is silence.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue