this repo has no description
1/*
2This file is part of Darling.
3
4Copyright (C) 2020 Lubos Dolezel
5
6Darling is free software: you can redistribute it and/or modify
7it under the terms of the GNU General Public License as published by
8the Free Software Foundation, either version 3 of the License, or
9(at your option) any later version.
10
11Darling is distributed in the hope that it will be useful,
12but WITHOUT ANY WARRANTY; without even the implied warranty of
13MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14GNU General Public License for more details.
15
16You should have received a copy of the GNU General Public License
17along with Darling. If not, see <http://www.gnu.org/licenses/>.
18*/
19#include "SystemOutputAU.h"
20
21#pragma GCC visibility push(default)
22AUDIOCOMPONENT_ENTRY(AUOutputBaseFactory, SystemOutputAU);
23#pragma GCC visibility pop
24
25enum {
26 kOutputBus = 0,
27 kInputBus
28};
29
30SystemOutputAU::SystemOutputAU(AudioComponentInstance inInstance)
31: AUHAL(inInstance)
32{
33 UInt32 propSize = sizeof(AudioDeviceID);
34 AudioHardwareGetProperty(kAudioHardwarePropertyDefaultSystemOutputDevice, &propSize, &m_outputDevice);
35}
36
37OSStatus SystemOutputAU::GetPropertyInfo(AudioUnitPropertyID inID, AudioUnitScope inScope, AudioUnitElement inElement, UInt32& outDataSize, Boolean& outWritable)
38{
39 OSStatus status = AUHAL::GetPropertyInfo(inID, inScope, inElement, outDataSize, outWritable);
40
41 if (inID == kAudioOutputUnitProperty_CurrentDevice)
42 outWritable = false;
43
44 return status;
45}
46
47OSStatus SystemOutputAU::SetProperty(AudioUnitPropertyID inID, AudioUnitScope inScope,
48 AudioUnitElement inElement, const void* inData, UInt32 inDataSize)
49{
50 switch (inID)
51 {
52 case kAudioOutputUnitProperty_EnableIO:
53 {
54 if (inElement == kInputBus)
55 return kAudioUnitErr_InvalidElement;
56 break;
57 }
58 case kAudioOutputUnitProperty_CurrentDevice:
59 return kAudioUnitErr_InvalidProperty;
60 }
61 return AUHAL::SetProperty(inID, inScope, inElement, inData, inDataSize);
62}