1 #ifndef HAVE_COREAUDIO
2 /*
3  * SoX bit-rot detection file; cobbled together
4  */
5 
6 enum {
7   kAudioHardwarePropertyProcessIsMaster,
8   kAudioHardwarePropertyIsInitingOrExiting,
9   kAudioHardwarePropertyDevices,
10   kAudioHardwarePropertyDefaultInputDevice,
11   kAudioHardwarePropertyDefaultOutputDevice,
12   kAudioHardwarePropertyDefaultSystemOutputDevice,
13   kAudioHardwarePropertyDeviceForUID,
14   kAudioHardwarePropertySleepingIsAllowed,
15   kAudioHardwarePropertyUnloadingIsAllowed,
16   kAudioHardwarePropertyHogModeIsAllowed,
17   kAudioHardwarePropertyRunLoop,
18   kAudioHardwarePropertyPlugInForBundleID
19 };
20 
21 enum {
22   kAudioObjectPropertyClass,
23   kAudioObjectPropertyOwner,
24   kAudioObjectPropertyCreator,
25   kAudioObjectPropertyName,
26   kAudioObjectPropertyManufacturer,
27   kAudioObjectPropertyElementName,
28   kAudioObjectPropertyElementCategoryName,
29   kAudioObjectPropertyElementNumberName,
30   kAudioObjectPropertyOwnedObjects,
31   kAudioObjectPropertyListenerAdded,
32   kAudioObjectPropertyListenerRemoved
33 };
34 
35 enum {
36   kAudioDevicePropertyDeviceName,
37   kAudioDevicePropertyDeviceNameCFString = kAudioObjectPropertyName,
38   kAudioDevicePropertyDeviceManufacturer,
39   kAudioDevicePropertyDeviceManufacturerCFString =
40       kAudioObjectPropertyManufacturer,
41   kAudioDevicePropertyRegisterBufferList,
42   kAudioDevicePropertyBufferSize,
43   kAudioDevicePropertyBufferSizeRange,
44   kAudioDevicePropertyChannelName,
45   kAudioDevicePropertyChannelNameCFString = kAudioObjectPropertyElementName,
46   kAudioDevicePropertyChannelCategoryName,
47   kAudioDevicePropertyChannelCategoryNameCFString =
48       kAudioObjectPropertyElementCategoryName,
49   kAudioDevicePropertyChannelNumberName,
50   kAudioDevicePropertyChannelNumberNameCFString =
51       kAudioObjectPropertyElementNumberName,
52   kAudioDevicePropertySupportsMixing,
53   kAudioDevicePropertyStreamFormat,
54   kAudioDevicePropertyStreamFormats,
55   kAudioDevicePropertyStreamFormatSupported,
56   kAudioDevicePropertyStreamFormatMatch,
57   kAudioDevicePropertyDataSourceNameForID,
58   kAudioDevicePropertyClockSourceNameForID,
59   kAudioDevicePropertyPlayThruDestinationNameForID,
60   kAudioDevicePropertyChannelNominalLineLevelNameForID
61 };
62 
63 enum {
64   kAudioDevicePropertyPlugIn,
65   kAudioDevicePropertyConfigurationApplication,
66   kAudioDevicePropertyDeviceUID,
67   kAudioDevicePropertyModelUID,
68   kAudioDevicePropertyTransportType,
69   kAudioDevicePropertyRelatedDevices,
70   kAudioDevicePropertyClockDomain,
71   kAudioDevicePropertyDeviceIsAlive,
72   kAudioDevicePropertyDeviceHasChanged,
73   kAudioDevicePropertyDeviceIsRunning,
74   kAudioDevicePropertyDeviceIsRunningSomewhere,
75   kAudioDevicePropertyDeviceCanBeDefaultDevice,
76   kAudioDevicePropertyDeviceCanBeDefaultSystemDevice,
77   kAudioDeviceProcessorOverload,
78   kAudioDevicePropertyHogMode,
79   kAudioDevicePropertyLatency,
80   kAudioDevicePropertyBufferFrameSize,
81   kAudioDevicePropertyBufferFrameSizeRange,
82   kAudioDevicePropertyUsesVariableBufferFrameSizes,
83   kAudioDevicePropertyStreams,
84   kAudioDevicePropertySafetyOffset,
85   kAudioDevicePropertyIOCycleUsage,
86   kAudioDevicePropertyStreamConfiguration,
87   kAudioDevicePropertyIOProcStreamUsage,
88   kAudioDevicePropertyPreferredChannelsForStereo,
89   kAudioDevicePropertyPreferredChannelLayout,
90   kAudioDevicePropertyNominalSampleRate,
91   kAudioDevicePropertyAvailableNominalSampleRates,
92   kAudioDevicePropertyActualSampleRate
93 };
94 
95 enum {
96   kAudioFormatLinearPCM,
97   kAudioFormatAC3,
98   kAudioFormat60958AC3,
99   kAudioFormatAppleIMA4,
100   kAudioFormatMPEG4AAC,
101   kAudioFormatMPEG4CELP,
102   kAudioFormatMPEG4HVXC,
103   kAudioFormatMPEG4TwinVQ,
104   kAudioFormatMACE3,
105   kAudioFormatMACE6,
106   kAudioFormatULaw,
107   kAudioFormatALaw,
108   kAudioFormatQDesign,
109   kAudioFormatQDesign2,
110   kAudioFormatQUALCOMM,
111   kAudioFormatMPEGLayer1,
112   kAudioFormatMPEGLayer2,
113   kAudioFormatMPEGLayer3,
114   kAudioFormatDVAudio,
115   kAudioFormatVariableDurationDVAudio,
116   kAudioFormatTimeCode,
117   kAudioFormatMIDIStream,
118   kAudioFormatParameterValueStream,
119   kAudioFormatAppleLossless
120 };
121 
122 enum {
123   kAudioFormatFlagIsFloat = (1L << 0),
124   kAudioFormatFlagIsBigEndian = (1L << 1),
125   kAudioFormatFlagIsSignedInteger = (1L << 2),
126   kAudioFormatFlagIsPacked = (1L << 3),
127   kAudioFormatFlagIsAlignedHigh = (1L << 4),
128   kAudioFormatFlagIsNonInterleaved = (1L << 5),
129   kAudioFormatFlagIsNonMixable = (1L << 6),
130 
131   kLinearPCMFormatFlagIsFloat = kAudioFormatFlagIsFloat,
132   kLinearPCMFormatFlagIsBigEndian = kAudioFormatFlagIsBigEndian,
133   kLinearPCMFormatFlagIsSignedInteger = kAudioFormatFlagIsSignedInteger,
134   kLinearPCMFormatFlagIsPacked = kAudioFormatFlagIsPacked,
135   kLinearPCMFormatFlagIsAlignedHigh = kAudioFormatFlagIsAlignedHigh,
136   kLinearPCMFormatFlagIsNonInterleaved = kAudioFormatFlagIsNonInterleaved,
137   kLinearPCMFormatFlagIsNonMixable = kAudioFormatFlagIsNonMixable,
138 
139   kAppleLosslessFormatFlag_16BitSourceData = 1,
140   kAppleLosslessFormatFlag_20BitSourceData = 2,
141   kAppleLosslessFormatFlag_24BitSourceData = 3,
142   kAppleLosslessFormatFlag_32BitSourceData = 4
143 };
144 
145 enum {
146   kAudioFormatFlagsNativeEndian = kAudioFormatFlagIsBigEndian,
147   kAudioFormatFlagsNativeFloatPacked =
148       kAudioFormatFlagIsFloat | kAudioFormatFlagsNativeEndian |
149       kAudioFormatFlagIsPacked
150 };
151 
152 enum {
153   kAudioDeviceUnknown
154 };
155 
156 enum {
157   kVariableLengthArray = 1
158 };
159 
160 enum {
161   kAudioHardwareNoError = 0,
162   noErr = kAudioHardwareNoError
163 };
164 
165 enum {
166   false
167 };
168 
169 typedef double Float64;
170 typedef float Float32;
171 typedef int SInt32;
172 typedef int Boolean;
173 typedef int OSErr;
174 typedef short SInt16;
175 typedef unsigned int UInt32;
176 typedef unsigned long int UInt64;
177 
178 typedef SInt32 OSStatus;
179 typedef UInt32 AudioObjectID;
180 typedef UInt32 AudioHardwarePropertyID;
181 typedef UInt32 AudioDevicePropertyID;
182 typedef AudioObjectID AudioDeviceID;
183 
184 struct AudioStreamBasicDescription {
185   Float64 mSampleRate;
186   UInt32 mFormatID;
187   UInt32 mFormatFlags;
188   UInt32 mBytesPerPacket;
189   UInt32 mFramesPerPacket;
190   UInt32 mBytesPerFrame;
191   UInt32 mChannelsPerFrame;
192   UInt32 mBitsPerChannel;
193   UInt32 mReserved;
194 };
195 typedef struct AudioStreamBasicDescription AudioStreamBasicDescription;
196 
197 
198 
199 struct SMPTETime {
200   SInt16 mSubframes;
201   SInt16 mSubframeDivisor;
202   UInt32 mCounter;
203   UInt32 mType;
204   UInt32 mFlags;
205   SInt16 mHours;
206   SInt16 mMinutes;
207   SInt16 mSeconds;
208   SInt16 mFrames;
209 };
210 typedef struct SMPTETime SMPTETime;
211 
212 struct AudioTimeStamp {
213   Float64 mSampleTime;
214   UInt64 mHostTime;
215   Float64 mRateScalar;
216   UInt64 mWordClockTime;
217   SMPTETime mSMPTETime;
218   UInt32 mFlags;
219   UInt32 mReserved;
220 };
221 typedef struct AudioTimeStamp AudioTimeStamp;
222 
223 struct AudioBuffer {
224   UInt32 mNumberChannels;
225   UInt32 mDataByteSize;
226   void *mData;
227 };
228 typedef struct AudioBuffer AudioBuffer;
229 
230 struct AudioBufferList {
231   UInt32 mNumberBuffers;
232   AudioBuffer mBuffers[kVariableLengthArray];
233 };
234 typedef struct AudioBufferList AudioBufferList;
235 
236 typedef OSStatus(*AudioDeviceIOProc) (AudioDeviceID inDevice,
237                                       const AudioTimeStamp * inNow,
238                                       const AudioBufferList * inInputData,
239                                       const AudioTimeStamp * inInputTime,
240                                       AudioBufferList * outOutputData,
241                                       const AudioTimeStamp * inOutputTime,
242                                       void *inClientData);
243 
244 
245 
246 OSStatus AudioHardwareGetProperty(AudioHardwarePropertyID inPropertyID,
247                                   UInt32 * ioPropertyDataSize,
248                                   void *outPropertyData);
249 
250 OSStatus AudioHardwareGetPropertyInfo(AudioHardwarePropertyID inPropertyID,
251                                   UInt32 * ioPropertyDataSize,
252                                   void *outPropertyData);
253 
254 OSStatus AudioDeviceSetProperty(AudioDeviceID inDevice,
255                                 const AudioTimeStamp * inWhen,
256                                 UInt32 inChannel, Boolean isInput,
257                                 AudioDevicePropertyID inPropertyID,
258                                 UInt32 inPropertyDataSize,
259                                 const void *inPropertyData);
260 OSStatus AudioDeviceGetProperty(AudioDeviceID inDevice, UInt32 inChannel,
261                                 Boolean isInput,
262                                 AudioDevicePropertyID inPropertyID,
263                                 UInt32 * ioPropertyDataSize,
264                                 void *outPropertyData);
265 
266 
267 OSStatus AudioDeviceAddIOProc(AudioDeviceID inDevice,
268                               AudioDeviceIOProc inProc, void *inClientData);
269 OSStatus AudioDeviceStart(AudioDeviceID inDevice, AudioDeviceIOProc inProc);
270 
271 
272 OSStatus AudioDeviceStop(AudioDeviceID inDevice, AudioDeviceIOProc inProc);
273 #endif
274