| 299 |
299 |
UInt32 *actualInputFramesPerBuffer,
|
| 300 |
300 |
UInt32 *actualOutputFramesPerBuffer,
|
| 301 |
301 |
const PaMacAUHAL *auhalHostApi,
|
|
302 |
#ifndef AUDIO_COMPONENT_FIX
|
| 302 |
303 |
AudioUnit *audioUnit,
|
|
304 |
#else
|
|
305 |
AudioComponentInstance *audioUnit,
|
|
306 |
#endif
|
| 303 |
307 |
AudioConverterRef *srConverter,
|
| 304 |
308 |
AudioDeviceID *audioDevice,
|
| 305 |
309 |
const double sampleRate,
|
| ... | ... | |
| 314 |
318 |
*/
|
| 315 |
319 |
static void startStopCallback(
|
| 316 |
320 |
void * inRefCon,
|
|
321 |
#ifndef AUDIO_COMPONENT_FIX
|
| 317 |
322 |
AudioUnit ci,
|
|
323 |
#else
|
|
324 |
AudioComponentInstance ci,
|
|
325 |
#endif
|
| 318 |
326 |
AudioUnitPropertyID inID,
|
| 319 |
327 |
AudioUnitScope inScope,
|
| 320 |
328 |
AudioUnitElement inElement )
|
| ... | ... | |
| 1167 |
1175 |
UInt32 *actualInputFramesPerBuffer,
|
| 1168 |
1176 |
UInt32 *actualOutputFramesPerBuffer,
|
| 1169 |
1177 |
const PaMacAUHAL *auhalHostApi,
|
|
1178 |
#ifndef AUDIO_COMPONENT_FIX
|
| 1170 |
1179 |
AudioUnit *audioUnit,
|
|
1180 |
#else
|
|
1181 |
AudioComponentInstance *audioUnit,
|
|
1182 |
#endif
|
| 1171 |
1183 |
AudioConverterRef *srConverter,
|
| 1172 |
1184 |
AudioDeviceID *audioDevice,
|
| 1173 |
1185 |
const double sampleRate,
|
| 1174 |
1186 |
void *refCon )
|
| 1175 |
1187 |
{
|
|
1188 |
#ifndef AUDIO_COMPONENT_FIX
|
| 1176 |
1189 |
ComponentDescription desc;
|
| 1177 |
1190 |
Component comp;
|
|
1191 |
#else
|
|
1192 |
AudioComponentDescription desc;
|
|
1193 |
AudioComponent comp;
|
|
1194 |
#endif
|
| 1178 |
1195 |
/*An Apple TN suggests using CAStreamBasicDescription, but that is C++*/
|
| 1179 |
1196 |
AudioStreamBasicDescription desiredFormat;
|
| 1180 |
1197 |
OSStatus result = noErr;
|
| ... | ... | |
| 1244 |
1261 |
desc.componentManufacturer = kAudioUnitManufacturer_Apple;
|
| 1245 |
1262 |
desc.componentFlags = 0;
|
| 1246 |
1263 |
desc.componentFlagsMask = 0;
|
|
1264 |
|
| 1247 |
1265 |
/* -- find the component -- */
|
|
1266 |
#ifndef AUDIO_COMPONENT_FIX
|
| 1248 |
1267 |
comp = FindNextComponent( NULL, &desc );
|
|
1268 |
#else
|
|
1269 |
comp = AudioComponentFindNext( NULL, &desc );
|
|
1270 |
#endif
|
| 1249 |
1271 |
if( !comp )
|
| 1250 |
1272 |
{
|
| 1251 |
1273 |
DBUG( ( "AUHAL component not found." ) );
|
| ... | ... | |
| 1254 |
1276 |
return paUnanticipatedHostError;
|
| 1255 |
1277 |
}
|
| 1256 |
1278 |
/* -- open it -- */
|
| 1257 |
|
result = OpenAComponent( comp, audioUnit );
|
|
1279 |
#ifndef AUDIO_COMPONENT_FIX
|
|
1280 |
result = OpenAComponent(comp, audioUnit);
|
|
1281 |
#else
|
|
1282 |
result = AudioComponentInstanceNew(comp, audioUnit);
|
|
1283 |
#endif
|
| 1258 |
1284 |
if( result )
|
| 1259 |
1285 |
{
|
| 1260 |
1286 |
DBUG( ( "Failed to open AUHAL component." ) );
|
| ... | ... | |
| 1607 |
1633 |
#undef ERR_WRAP
|
| 1608 |
1634 |
|
| 1609 |
1635 |
error:
|
|
1636 |
#ifndef AUDIO_COMPONENT_FIX
|
| 1610 |
1637 |
CloseComponent( *audioUnit );
|
|
1638 |
#else
|
|
1639 |
AudioComponentInstanceDispose( *audioUnit );
|
|
1640 |
#endif
|
| 1611 |
1641 |
*audioUnit = NULL;
|
| 1612 |
1642 |
if( result )
|
| 1613 |
1643 |
return PaMacCore_SetError( result, line, 1 );
|
| ... | ... | |
| 2645 |
2675 |
}
|
| 2646 |
2676 |
if( stream->outputUnit && stream->outputUnit != stream->inputUnit ) {
|
| 2647 |
2677 |
AudioUnitUninitialize( stream->outputUnit );
|
|
2678 |
#ifndef AUDIO_COMPONENT_FIX
|
| 2648 |
2679 |
CloseComponent( stream->outputUnit );
|
|
2680 |
#else
|
|
2681 |
AudioComponentInstanceDispose( stream->outputUnit );
|
|
2682 |
#endif
|
| 2649 |
2683 |
}
|
| 2650 |
2684 |
stream->outputUnit = NULL;
|
| 2651 |
2685 |
if( stream->inputUnit )
|
| 2652 |
2686 |
{
|
| 2653 |
2687 |
AudioUnitUninitialize( stream->inputUnit );
|
|
2688 |
#ifndef AUDIO_COMPONENT_FIX
|
| 2654 |
2689 |
CloseComponent( stream->inputUnit );
|
|
2690 |
#else
|
|
2691 |
AudioComponentInstanceDispose( stream->inputUnit );
|
|
2692 |
#endif
|
| 2655 |
2693 |
stream->inputUnit = NULL;
|
| 2656 |
2694 |
}
|
| 2657 |
2695 |
if( stream->inputRingBuffer.buffer )
|