summaryrefslogtreecommitdiffstats
path: root/audio/out/ao_wasapi.h
diff options
context:
space:
mode:
authorDiogo Franco (Kovensky) <diogomfranco@gmail.com>2014-03-11 02:50:49 -0300
committerDiogo Franco (Kovensky) <diogomfranco@gmail.com>2014-03-11 16:37:21 -0300
commitf8bdada77f992410deb4fc12652cf406d95e3657 (patch)
tree7d47a7100c192cdbba55dbe05962e47d47b52ca6 /audio/out/ao_wasapi.h
parentf3e9b9462210021286bfbe98eef228ab74c8b490 (diff)
downloadmpv-f8bdada77f992410deb4fc12652cf406d95e3657.tar.bz2
mpv-f8bdada77f992410deb4fc12652cf406d95e3657.tar.xz
ao_wasapi: Implement per-application mixing
The volume controls in mpv now affect the session's volume (the application's volume in the mixer). Since we do not request a non-persistent session, the volume and mute status persist across mpv invocations and system reboots. In exclusive mode, WASAPI doesn't have access to a mixer so the endpoint (sound card)'s master volume is modified instead. Since by definition mpv is the only thing outputting audio in exclusive mode, this causes no conflict, and ao_wasapi restores the last user-set volume when it's uninitialized.
Diffstat (limited to 'audio/out/ao_wasapi.h')
-rwxr-xr-xaudio/out/ao_wasapi.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/audio/out/ao_wasapi.h b/audio/out/ao_wasapi.h
index a0ce654d4d..d17b2504a0 100755
--- a/audio/out/ao_wasapi.h
+++ b/audio/out/ao_wasapi.h
@@ -41,6 +41,8 @@ typedef struct wasapi_state {
/* volume control */
DWORD vol_hw_support, status;
float audio_volume;
+ float previous_volume;
+ float initial_volume;
/* Buffers */
size_t buffer_block_size; /* Size of each block in bytes */
@@ -54,6 +56,7 @@ typedef struct wasapi_state {
IMMDevice *pDevice;
IAudioClient *pAudioClient;
IAudioRenderClient *pRenderClient;
+ ISimpleAudioVolume *pAudioVolume;
IAudioEndpointVolume *pEndpointVolume;
HANDLE hFeed; /* wasapi event */
HANDLE hForceFeed; /* forces writing a buffer (e.g. before audio_resume) */
@@ -65,12 +68,14 @@ typedef struct wasapi_state {
/* WASAPI proxy handles, for Single-Threaded Apartment communication.
One is needed for each object that's accessed by a different thread. */
IAudioClient *pAudioClientProxy;
+ ISimpleAudioVolume *pAudioVolumeProxy;
IAudioEndpointVolume *pEndpointVolumeProxy;
/* Streams used to marshal the proxy objects. The thread owning the actual objects
needs to marshal proxy objects into these streams, and the thread that wants the
proxies unmarshals them from here. */
IStream *sAudioClient;
+ IStream *sAudioVolume;
IStream *sEndpointVolume;
/* WASAPI internal clock information, for estimating delay */