- Timestamp:
- May 21, 2015 6:42:53 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Audio/DrvHostCoreAudio.cpp
r55920 r56018 337 337 void *pvUser) 338 338 { 339 PCOREAUDIOSTREAMIN pStreamIn = (PCOREAUDIOSTREAMIN)pvUser;340 341 339 OSStatus err = noErr; 342 340 343 switch (propertyID) 344 { 345 case kAudioHardwarePropertyDefaultInputDevice: 346 { 347 /* This listener is called on every change of the hardware 348 * device. So check if the default device has really changed. */ 349 AudioObjectPropertyAddress propAdr = { kAudioHardwarePropertyDefaultInputDevice, 350 kAudioObjectPropertyScopeGlobal, kAudioObjectPropertyElementMaster }; 351 352 UInt32 uSize = sizeof(pStreamIn->deviceID); 353 UInt32 uResp; 354 err = AudioObjectGetPropertyData(kAudioObjectSystemObject, &propAdr, 0, NULL, &uSize, &uResp); 355 356 if (err == noErr) 357 { 358 if (pStreamIn->deviceID != uResp) 341 LogFlowFunc(("propertyID=%u nAddresses=%u pvUser=%p\n", propertyID, nAddresses, pvUser)); 342 343 for (UInt32 idxAddress = 0; idxAddress < nAddresses; idxAddress++) 344 { 345 const AudioObjectPropertyAddress *pProperty = &properties[idxAddress]; 346 347 switch (pProperty->mSelector) 348 { 349 case kAudioHardwarePropertyDefaultInputDevice: 350 { 351 PCOREAUDIOSTREAMIN pStreamIn = (PCOREAUDIOSTREAMIN)pvUser; 352 353 /* This listener is called on every change of the hardware 354 * device. So check if the default device has really changed. */ 355 UInt32 uSize = sizeof(pStreamIn->deviceID); 356 UInt32 uResp; 357 err = AudioObjectGetPropertyData(kAudioObjectSystemObject, pProperty, 0, NULL, &uSize, &uResp); 358 359 if (err == noErr) 359 360 { 360 LogRel(("CoreAudio: Default input device has changed\n")); 361 362 /* We move the reinitialization to the next input event. 363 * This make sure this thread isn't blocked and the 364 * reinitialization is done when necessary only. */ 365 ASMAtomicXchgU32(&pStreamIn->status, CA_STATUS_REINIT); 361 if (pStreamIn->deviceID != uResp) 362 { 363 LogRel(("CoreAudio: Default input device has changed\n")); 364 365 /* We move the reinitialization to the next input event. 366 * This make sure this thread isn't blocked and the 367 * reinitialization is done when necessary only. */ 368 ASMAtomicXchgU32(&pStreamIn->status, CA_STATUS_REINIT); 369 } 366 370 } 367 } 368 break; 369 } 370 371 default: 372 break; 371 break; 372 } 373 374 case kAudioHardwarePropertyDefaultOutputDevice: 375 { 376 PCOREAUDIOSTREAMOUT pStreamOut = (PCOREAUDIOSTREAMOUT)pvUser; 377 378 /* This listener is called on every change of the hardware 379 * device. So check if the default device has really changed. */ 380 AudioObjectPropertyAddress propAdr = { kAudioHardwarePropertyDefaultOutputDevice, 381 kAudioObjectPropertyScopeGlobal, kAudioObjectPropertyElementMaster }; 382 383 UInt32 uSize = sizeof(pStreamOut->deviceID); 384 UInt32 uResp; 385 err = AudioObjectGetPropertyData(kAudioObjectSystemObject, &propAdr, 0, NULL, &uSize, &uResp); 386 387 if (err == noErr) 388 { 389 if (pStreamOut->deviceID != uResp) 390 { 391 LogRel(("CoreAudio: Default output device has changed\n")); 392 393 /* We move the reinitialization to the next input event. 394 * This make sure this thread isn't blocked and the 395 * reinitialization is done when necessary only. */ 396 ASMAtomicXchgU32(&pStreamOut->status, CA_STATUS_REINIT); 397 } 398 } 399 break; 400 } 401 402 default: 403 break; 404 } 373 405 } 374 406 … … 1708 1740 * Unregister input device callbacks. 1709 1741 */ 1710 AudioObjectPropertyAddress propAdr = { kAudioDeviceProcessorOverload, kAudio UnitScope_Global,1742 AudioObjectPropertyAddress propAdr = { kAudioDeviceProcessorOverload, kAudioObjectPropertyScopeGlobal, 1711 1743 kAudioObjectPropertyElementMaster }; 1712 1744 #ifdef DEBUG … … 1806 1838 if (pStreamOut->fDefDevChgListReg) 1807 1839 { 1808 AudioObjectPropertyAddress propAdr = { kAudioHardwarePropertyDefaultOutputDevice, kAudio UnitScope_Global,1840 AudioObjectPropertyAddress propAdr = { kAudioHardwarePropertyDefaultOutputDevice, kAudioObjectPropertyScopeGlobal, 1809 1841 kAudioObjectPropertyElementMaster }; 1810 1842 err = AudioObjectRemovePropertyListener(pStreamOut->deviceID, &propAdr,
Note:
See TracChangeset
for help on using the changeset viewer.