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.
This commit is contained in:
parent
ef84e5c8fa
commit
1d30df9b15
@ -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
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user