From: Ada yretenai@gmail.com
--- dlls/winecoreaudio.drv/coreaudio.c | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-)
diff --git a/dlls/winecoreaudio.drv/coreaudio.c b/dlls/winecoreaudio.drv/coreaudio.c index fdae645a80a..067f4d263d3 100644 --- a/dlls/winecoreaudio.drv/coreaudio.c +++ b/dlls/winecoreaudio.drv/coreaudio.c @@ -42,6 +42,7 @@ #include <fcntl.h> #include <fenv.h> #include <unistd.h> +#include <math.h>
#include <CoreAudio/CoreAudio.h> #include <AudioToolbox/AudioFormat.h> @@ -1760,26 +1761,21 @@ static NTSTATUS unix_get_prop_value(void *args)
static NTSTATUS unix_set_volumes(void *args) { + static unsigned int once; + if (!once++) + WARN("CoreAudio doesn't support per-channel volume control\n"); + struct set_volumes_params *params = args; struct coreaudio_stream *stream = handle_get_stream(params->stream); - Float32 level = 1.0, tmp; + Float32 level = params->master_volume; OSStatus sc; UINT32 i;
- if(params->channel >= stream->fmt->nChannels || params->channel < -1){ - ERR("Incorrect channel %d\n", params->channel); - return STATUS_SUCCESS; + for(i = 0; i < stream->fmt->nChannels; ++i){ + const float vol = params->master_volume * params->volumes[i] * params->session_volumes[i]; + level = fminf(level, vol); }
- if(params->channel == -1){ - for(i = 0; i < stream->fmt->nChannels; ++i){ - tmp = params->master_volume * params->volumes[i] * params->session_volumes[i]; - level = tmp < level ? tmp : level; - } - }else - level = params->master_volume * params->volumes[params->channel] * - params->session_volumes[params->channel]; - sc = AudioUnitSetParameter(stream->unit, kHALOutputParam_Volume, kAudioUnitScope_Global, 0, level, 0); if(sc != noErr)