Unverified Commit 1d30df9b authored by Yue Wang's avatar Yue Wang Committed by GitHub

Update OSXOutputPlugin.cxx

some device seems to have issue with setting kAudioDevicePropertyVolumeScalar with kAudioObjectPropertyElementMaster. Use AudioToolbox 's kAudioHardwareServiceDeviceProperty_VirtualMasterVolume instead. Ideally, we should get the steoro channels first, and set the kAudioDevicePropertyVolumeScalar for each channel, which is doable as presented in https://github.com/cmus/cmus/blob/master/op/coreaudio.c. I will do a follow up PR after refactor PR.
parent ef84e5c8
......@@ -36,6 +36,7 @@
#include <CoreAudio/CoreAudio.h>
#include <AudioUnit/AudioUnit.h>
#include <AudioToolbox/AudioToolbox.h>
#include <CoreServices/CoreServices.h>
#include <boost/lockfree/spsc_queue.hpp>
......@@ -192,7 +193,7 @@ OSXOutput::GetVolume()
{
Float32 vol;
AudioObjectPropertyAddress aopa = {
.mSelector = kAudioDevicePropertyVolumeScalar,
.mSelector = kAudioHardwareServiceDeviceProperty_VirtualMasterVolume,
.mScope = kAudioObjectPropertyScopeOutput,
.mElement = kAudioObjectPropertyElementMaster,
};
......@@ -217,7 +218,7 @@ void
OSXOutput::SetVolume(unsigned new_volume) {
Float32 vol = new_volume / 100.0;
AudioObjectPropertyAddress aopa = {
.mSelector = kAudioDevicePropertyVolumeScalar,
.mSelector = kAudioHardwareServiceDeviceProperty_VirtualMasterVolume,
.mScope = kAudioObjectPropertyScopeOutput,
.mElement = kAudioObjectPropertyElementMaster
};
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment