Jamoma API  0.6.0.a19
CAHALAudioDevice.h
1 /* Copyright 2007 Apple Inc. All Rights Reserved.
2 
3  Disclaimer: IMPORTANT: This Apple software is supplied to you by
4  Apple Inc. ("Apple") in consideration of your agreement to the
5  following terms, and your use, installation, modification or
6  redistribution of this Apple software constitutes acceptance of these
7  terms. If you do not agree with these terms, please do not use,
8  install, modify or redistribute this Apple software.
9 
10  In consideration of your agreement to abide by the following terms, and
11  subject to these terms, Apple grants you a personal, non-exclusive
12  license, under Apple's copyrights in this original Apple software (the
13  "Apple Software"), to use, reproduce, modify and redistribute the Apple
14  Software, with or without modifications, in source and/or binary forms;
15  provided that if you redistribute the Apple Software in its entirety and
16  without modifications, you must retain this notice and the following
17  text and disclaimers in all such redistributions of the Apple Software.
18  Neither the name, trademarks, service marks or logos of Apple Inc.
19  may be used to endorse or promote products derived from the Apple
20  Software without specific prior written permission from Apple. Except
21  as expressly stated in this notice, no other rights or licenses, express
22  or implied, are granted by Apple herein, including but not limited to
23  any patent rights that may be infringed by your derivative works or by
24  other works in which the Apple Software may be incorporated.
25 
26  The Apple Software is provided by Apple on an "AS IS" basis. APPLE
27  MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION
28  THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS
29  FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND
30  OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
31 
32  IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL
33  OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
34  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
35  INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION,
36  MODIFICATION AND/OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED
37  AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE),
38  STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE
39  POSSIBILITY OF SUCH DAMAGE.
40 */
41 #if !defined(__CAHALAudioDevice_h__)
42 #define __CAHALAudioDevice_h__
43 
44 //==================================================================================================
45 // Includes
46 //==================================================================================================
47 
48 // Super Class Includes
49 #include "CAHALAudioObject.h"
50 
51 //==================================================================================================
52 // CAHALAudioDevice
53 //==================================================================================================
54 
55 class CAHALAudioDevice
56 :
57  public CAHALAudioObject
58 {
59 
60 // Construction/Destruction
61 public:
62  CAHALAudioDevice(AudioObjectID inAudioDevice);
63  CAHALAudioDevice(CFStringRef inUID);
64  virtual ~CAHALAudioDevice();
65 
66 // General Stuff
67 public:
68  CFStringRef CopyDeviceUID() const;
69  bool HasModelUID() const;
70  CFStringRef CopyModelUID() const;
71  CFStringRef CopyConfigurationApplicationBundleID() const;
72  CFURLRef CopyIconLocation() const;
73  UInt32 GetTransportType() const;
74  bool CanBeDefaultDevice(bool inIsInput, bool inIsSystem) const;
75  bool HasDevicePlugInStatus() const;
76  OSStatus GetDevicePlugInStatus() const;
77  bool IsAlive() const;
78  bool IsHidden() const;
79  pid_t GetHogModeOwner() const;
80  bool IsHogModeSettable() const;
81  bool TakeHogMode();
82  void ReleaseHogMode();
83  bool HasPreferredStereoChannels(bool inIsInput) const;
84  void GetPreferredStereoChannels(bool inIsInput, UInt32& outLeft, UInt32& outRight) const;
85  void SetPreferredStereoChannels(bool inIsInput, UInt32 inLeft, UInt32 inRight);
86  bool HasPreferredChannelLayout(bool inIsInput) const;
87  void GetPreferredChannelLayout(bool inIsInput, AudioChannelLayout& outChannelLayout) const;
88  void SetPreferredStereoChannels(bool inIsInput, AudioChannelLayout& inChannelLayout);
89  UInt32 GetNumberRelatedAudioDevices() const;
90  void GetRelatedAudioDevices(UInt32& ioNumberRelatedDevices, AudioObjectID* outRelatedDevices) const;
91  AudioObjectID GetRelatedAudioDeviceByIndex(UInt32 inIndex) const;
92 
93 // Stream Stuff
94 public:
95  UInt32 GetNumberStreams(bool inIsInput) const;
96  void GetStreams(bool inIsInput, UInt32& ioNumberStreams, AudioObjectID* outStreamList) const;
97  AudioObjectID GetStreamByIndex(bool inIsInput, UInt32 inIndex) const;
98  UInt32 GetTotalNumberChannels(bool inIsInput) const;
99  void GetCurrentVirtualFormats(bool inIsInput, UInt32& ioNumberStreams, AudioStreamBasicDescription* outFormats) const;
100  void GetCurrentPhysicalFormats(bool inIsInput, UInt32& ioNumberStreams, AudioStreamBasicDescription* outFormats) const;
101 
102 // IO Stuff
103 public:
104  bool IsRunning() const;
105  bool IsRunningSomewhere() const;
106  UInt32 GetLatency(bool inIsInput) const;
107  UInt32 GetSafetyOffset(bool inIsInput) const;
108  bool HasClockDomain() const;
109  UInt32 GetClockDomain() const;
110  Float64 GetActualSampleRate() const;
111  Float64 GetNominalSampleRate() const;
112  void SetNominalSampleRate(Float64 inSampleRate);
113  UInt32 GetNumberAvailableNominalSampleRateRanges() const;
114  void GetAvailableNominalSampleRateRanges(UInt32& ioNumberRanges, AudioValueRange* outRanges) const;
115  void GetAvailableNominalSampleRateRangeByIndex(UInt32 inIndex, Float64& outMinimum, Float64& outMaximum) const;
116  bool IsValidNominalSampleRate(Float64 inSampleRate) const;
117  bool IsIOBufferSizeSettable() const;
118  UInt32 GetIOBufferSize() const;
119  void SetIOBufferSize(UInt32 inBufferSize);
120  bool UsesVariableIOBufferSizes() const;
121  UInt32 GetMaximumVariableIOBufferSize() const;
122  bool HasIOBufferSizeRange() const;
123  void GetIOBufferSizeRange(UInt32& outMinimum, UInt32& outMaximum) const;
124  AudioDeviceIOProcID CreateIOProcID(AudioDeviceIOProc inIOProc, void* inClientData);
125  void DestroyIOProcID(AudioDeviceIOProcID inIOProcID);
126  void StartIOProc(AudioDeviceIOProcID inIOProcID);
127  void StartIOProcAtTime(AudioDeviceIOProcID inIOProcID, AudioTimeStamp& ioStartTime, bool inIsInput, bool inIgnoreHardware);
128  void StopIOProc(AudioDeviceIOProcID inIOProcID);
129  void GetIOProcStreamUsage(AudioDeviceIOProcID inIOProcID, bool inIsInput, bool* outStreamUsage) const;
130  void SetIOProcStreamUsage(AudioDeviceIOProcID inIOProcID, bool inIsInput, const bool* inStreamUsage);
131  Float32 GetIOCycleUsage() const;
132  void SetIOCycleUsage(Float32 inValue);
133 
134 // Time Operations
135 public:
136  void GetCurrentTime(AudioTimeStamp& outTime);
137  void TranslateTime(const AudioTimeStamp& inTime, AudioTimeStamp& outTime);
138  void GetNearestStartTime(AudioTimeStamp& ioTime, bool inIsInput, bool inIgnoreHardware);
139 
140 // Controls
141 public:
142  bool HasVolumeControl(AudioObjectPropertyScope inScope, UInt32 inChannel) const;
143  bool VolumeControlIsSettable(AudioObjectPropertyScope inScope, UInt32 inChannel) const;
144  Float32 GetVolumeControlScalarValue(AudioObjectPropertyScope inScope, UInt32 inChannel) const;
145  Float32 GetVolumeControlDecibelValue(AudioObjectPropertyScope inScope, UInt32 inChannel) const;
146  void SetVolumeControlScalarValue(AudioObjectPropertyScope inScope, UInt32 inChannel, Float32 inValue);
147  void SetVolumeControlDecibelValue(AudioObjectPropertyScope inScope, UInt32 inChannel, Float32 inValue);
148  Float32 GetVolumeControlScalarForDecibelValue(AudioObjectPropertyScope inScope, UInt32 inChannel, Float32 inValue) const;
149  Float32 GetVolumeControlDecibelForScalarValue(AudioObjectPropertyScope inScope, UInt32 inChannel, Float32 inValue) const;
150 
151  bool HasSubVolumeControl(AudioObjectPropertyScope inScope, UInt32 inChannel) const;
152  bool SubVolumeControlIsSettable(AudioObjectPropertyScope inScope, UInt32 inChannel) const;
153  Float32 GetSubVolumeControlScalarValue(AudioObjectPropertyScope inScope, UInt32 inChannel) const;
154  Float32 GetSubVolumeControlDecibelValue(AudioObjectPropertyScope inScope, UInt32 inChannel) const;
155  void SetSubVolumeControlScalarValue(AudioObjectPropertyScope inScope, UInt32 inChannel, Float32 inValue);
156  void SetSubVolumeControlDecibelValue(AudioObjectPropertyScope inScope, UInt32 inChannel, Float32 inValue);
157  Float32 GetSubVolumeControlScalarForDecibelValue(AudioObjectPropertyScope inScope, UInt32 inChannel, Float32 inValue) const;
158  Float32 GetSubVolumeControlDecibelForScalarValue(AudioObjectPropertyScope inScope, UInt32 inChannel, Float32 inValue) const;
159 
160  bool HasMuteControl(AudioObjectPropertyScope inScope, UInt32 inChannel) const;
161  bool MuteControlIsSettable(AudioObjectPropertyScope inScope, UInt32 inChannel) const;
162  bool GetMuteControlValue(AudioObjectPropertyScope inScope, UInt32 inChannel) const;
163  void SetMuteControlValue(AudioObjectPropertyScope inScope, UInt32 inChannel, bool inValue);
164 
165  bool HasSoloControl(AudioObjectPropertyScope inScope, UInt32 inChannel) const;
166  bool SoloControlIsSettable(AudioObjectPropertyScope inScope, UInt32 inChannel) const;
167  bool GetSoloControlValue(AudioObjectPropertyScope inScope, UInt32 inChannel) const;
168  void SetSoloControlValue(AudioObjectPropertyScope inScope, UInt32 inChannel, bool inValue);
169 
170  bool HasStereoPanControl(AudioObjectPropertyScope inScope, UInt32 inChannel) const;
171  bool StereoPanControlIsSettable(AudioObjectPropertyScope inScope, UInt32 inChannel) const;
172  Float32 GetStereoPanControlValue(AudioObjectPropertyScope inScope, UInt32 inChannel) const;
173  void SetStereoPanControlValue(AudioObjectPropertyScope inScope, UInt32 inChannel, Float32 inValue);
174  void GetStereoPanControlChannels(AudioObjectPropertyScope inScope, UInt32 inChannel, UInt32& outLeftChannel, UInt32& outRightChannel) const;
175 
176  bool HasJackControl(AudioObjectPropertyScope inScope, UInt32 inChannel) const;
177  bool GetJackControlValue(AudioObjectPropertyScope inScope, UInt32 inChannel) const;
178 
179  bool HasSubMuteControl(AudioObjectPropertyScope inScope, UInt32 inChannel) const;
180  bool SubMuteControlIsSettable(AudioObjectPropertyScope inScope, UInt32 inChannel) const;
181  bool GetSubMuteControlValue(AudioObjectPropertyScope inScope, UInt32 inChannel) const;
182  void SetSubMuteControlValue(AudioObjectPropertyScope inScope, UInt32 inChannel, bool inValue);
183 
184  bool HasiSubOwnerControl(AudioObjectPropertyScope inScope, UInt32 inChannel) const;
185  bool iSubOwnerControlIsSettable(AudioObjectPropertyScope inScope, UInt32 inChannel) const;
186  bool GetiSubOwnerControlValue(AudioObjectPropertyScope inScope, UInt32 inChannel) const;
187  void SetiSubOwnerControlValue(AudioObjectPropertyScope inScope, UInt32 inChannel, bool inValue);
188 
189  bool HasDataSourceControl(AudioObjectPropertyScope inScope, UInt32 inChannel) const;
190  bool DataSourceControlIsSettable(AudioObjectPropertyScope inScope, UInt32 inChannel) const;
191  UInt32 GetCurrentDataSourceID(AudioObjectPropertyScope inScope, UInt32 inChannel) const;
192  void SetCurrentDataSourceByID(AudioObjectPropertyScope inScope, UInt32 inChannel, UInt32 inID);
193  UInt32 GetNumberAvailableDataSources(AudioObjectPropertyScope inScope, UInt32 inChannel) const;
194  void GetAvailableDataSources(AudioObjectPropertyScope inScope, UInt32 inChannel, UInt32& ioNumberSources, UInt32* outSources) const;
195  UInt32 GetAvailableDataSourceByIndex(AudioObjectPropertyScope inScope, UInt32 inChannel, UInt32 inIndex) const;
196  CFStringRef CopyDataSourceNameForID(AudioObjectPropertyScope inScope, UInt32 inChannel, UInt32 inID) const;
197 
198  bool HasDataDestinationControl(AudioObjectPropertyScope inScope, UInt32 inChannel) const;
199  bool DataDestinationControlIsSettable(AudioObjectPropertyScope inScope, UInt32 inChannel) const;
200  UInt32 GetCurrentDataDestinationID(AudioObjectPropertyScope inScope, UInt32 inChannel) const;
201  void SetCurrentDataDestinationByID(AudioObjectPropertyScope inScope, UInt32 inChannel, UInt32 inID);
202  UInt32 GetNumberAvailableDataDestinations(AudioObjectPropertyScope inScope, UInt32 inChannel) const;
203  void GetAvailableDataDestinations(AudioObjectPropertyScope inScope, UInt32 inChannel, UInt32& ioNumberDestinations, UInt32* outDestinations) const;
204  UInt32 GetAvailableDataDestinationByIndex(AudioObjectPropertyScope inScope, UInt32 inChannel, UInt32 inIndex) const;
205  CFStringRef CopyDataDestinationNameForID(AudioObjectPropertyScope inScope, UInt32 inChannel, UInt32 inID) const;
206 
207  bool HasClockSourceControl() const;
208  bool ClockSourceControlIsSettable() const;
209  UInt32 GetCurrentClockSourceID() const;
210  void SetCurrentClockSourceByID(UInt32 inID);
211  UInt32 GetNumberAvailableClockSources() const;
212  void GetAvailableClockSources(UInt32& ioNumberSources, UInt32* outSources) const;
213  UInt32 GetAvailableClockSourceByIndex(UInt32 inIndex) const;
214  CFStringRef CopyClockSourceNameForID(UInt32 inID) const;
215  UInt32 GetClockSourceKindForID(UInt32 inID) const;
216 
217 };
218 
219 #endif