···11+/*
22+This file is part of Darling.
33+44+Copyright (C) 2020 Lubos Dolezel
55+66+Darling is free software: you can redistribute it and/or modify
77+it under the terms of the GNU General Public License as published by
88+the Free Software Foundation, either version 3 of the License, or
99+(at your option) any later version.
1010+1111+Darling is distributed in the hope that it will be useful,
1212+but WITHOUT ANY WARRANTY; without even the implied warranty of
1313+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1414+GNU General Public License for more details.
1515+1616+You should have received a copy of the GNU General Public License
1717+along with Darling. If not, see <http://www.gnu.org/licenses/>.
1818+*/
1919+#include "SystemOutputAU.h"
2020+2121+#pragma GCC visibility push(default)
2222+AUDIOCOMPONENT_ENTRY(AUOutputBaseFactory, SystemOutputAU);
2323+#pragma GCC visibility pop
2424+2525+enum {
2626+ kOutputBus = 0,
2727+ kInputBus
2828+};
2929+3030+SystemOutputAU::SystemOutputAU(AudioComponentInstance inInstance)
3131+: AUHAL(inInstance)
3232+{
3333+ UInt32 propSize = sizeof(AudioDeviceID);
3434+ AudioHardwareGetProperty(kAudioHardwarePropertyDefaultSystemOutputDevice, &propSize, &m_outputDevice);
3535+}
3636+3737+OSStatus SystemOutputAU::SetProperty(AudioUnitPropertyID inID, AudioUnitScope inScope,
3838+ AudioUnitElement inElement, const void* inData, UInt32 inDataSize)
3939+{
4040+ switch (inID)
4141+ {
4242+ case kAudioOutputUnitProperty_EnableIO:
4343+ {
4444+ if (inElement == kInputBus)
4545+ return kAudioUnitErr_InvalidElement;
4646+ break;
4747+ }
4848+ case kAudioOutputUnitProperty_CurrentDevice:
4949+ return kAudioUnitErr_InvalidProperty;
5050+ }
5151+ return AUHAL::SetProperty(inID, inScope, inElement, inData, inDataSize);
5252+}
+31
src/CoreAudio/CoreAudioComponent/SystemOutputAU.h
···11+/*
22+This file is part of Darling.
33+44+Copyright (C) 2020 Lubos Dolezel
55+66+Darling is free software: you can redistribute it and/or modify
77+it under the terms of the GNU General Public License as published by
88+the Free Software Foundation, either version 3 of the License, or
99+(at your option) any later version.
1010+1111+Darling is distributed in the hope that it will be useful,
1212+but WITHOUT ANY WARRANTY; without even the implied warranty of
1313+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1414+GNU General Public License for more details.
1515+1616+You should have received a copy of the GNU General Public License
1717+along with Darling. If not, see <http://www.gnu.org/licenses/>.
1818+*/
1919+2020+#ifndef _CA_SYSTEM_OUTPUT_AU_H
2121+#define _CA_SYSTEM_OUTPUT_AU_H
2222+#include "AUHAL.h"
2323+2424+class SystemOutputAU : public AUHAL
2525+{
2626+public:
2727+ SystemOutputAU(AudioComponentInstance inInstance);
2828+ OSStatus SetProperty(AudioUnitPropertyID inID, AudioUnitScope inScope, AudioUnitElement inElement, const void* inData, UInt32 inDataSize) override;
2929+};
3030+3131+#endif