Changeset 89234 in vbox for trunk/src/VBox/Devices/Audio/DrvHostAudioCoreAudio.cpp
- Timestamp:
- May 23, 2021 1:30:46 PM (4 years ago)
- svn:sync-xref-src-repo-rev:
- 144577
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Audio/DrvHostAudioCoreAudio.cpp
r89233 r89234 197 197 /** Critical section for serializing access between thread + callbacks. */ 198 198 RTCRITSECT CritSect; 199 /** Buffer that drvH ostAudioCaStreamStatusString uses. */199 /** Buffer that drvHstAudCaStreamStatusString uses. */ 200 200 char szStatus[64]; 201 201 } COREAUDIOSTREAM; … … 269 269 * @param pStreamCA The stream to get the status for. 270 270 */ 271 static const char *drvH ostAudioCaStreamStatusString(PCOREAUDIOSTREAM pStreamCA)271 static const char *drvHstAudCaStreamStatusString(PCOREAUDIOSTREAM pStreamCA) 272 272 { 273 273 static RTSTRTUPLE const s_aInitState[5] = … … 318 318 319 319 320 static void drvH ostAudioCaPrintASBD(const char *pszDesc, const AudioStreamBasicDescription *pASBD)320 static void drvHstAudCaPrintASBD(const char *pszDesc, const AudioStreamBasicDescription *pASBD) 321 321 { 322 322 LogRel2(("CoreAudio: %s description:\n", pszDesc)); … … 352 352 353 353 354 static void drvH ostAudioCaPCMPropsToASBD(PCPDMAUDIOPCMPROPS pProps, AudioStreamBasicDescription *pASBD)354 static void drvHstAudCaPCMPropsToASBD(PCPDMAUDIOPCMPROPS pProps, AudioStreamBasicDescription *pASBD) 355 355 { 356 356 AssertPtrReturnVoid(pProps); … … 375 375 376 376 #if 0 /* unused */ 377 static int drvH ostAudioCaCFStringToCString(const CFStringRef pCFString, char **ppszString)377 static int drvHstAudCaCFStringToCString(const CFStringRef pCFString, char **ppszString) 378 378 { 379 379 CFIndex cLen = CFStringGetLength(pCFString) + 1; … … 389 389 } 390 390 391 static AudioDeviceID drvH ostAudioCaDeviceUIDtoID(const char* pszUID)391 static AudioDeviceID drvHstAudCaDeviceUIDtoID(const char* pszUID) 392 392 { 393 393 /* Create a CFString out of our CString. */ … … 439 439 * (See AudioObjectPropertyListenerProc in the SDK headers.) 440 440 */ 441 static OSStatus drvH ostAudioCaDevicePropertyChangedCallback(AudioObjectID idObject, UInt32 cAddresses,442 441 static OSStatus drvHstAudCaDevicePropertyChangedCallback(AudioObjectID idObject, UInt32 cAddresses, 442 const AudioObjectPropertyAddress paAddresses[], void *pvUser) 443 443 { 444 444 PCOREAUDIODEVICEDATA pDev = (PCOREAUDIODEVICEDATA)pvUser; … … 475 475 * @param enmSts Status to propagate. 476 476 */ 477 static void drvH ostAudioCaDevicePropagateStatus(PCOREAUDIODEVICEDATA pDev, COREAUDIOINITSTATE enmSts)477 static void drvHstAudCaDevicePropagateStatus(PCOREAUDIODEVICEDATA pDev, COREAUDIOINITSTATE enmSts) 478 478 { 479 479 #if 1 … … 510 510 * (See AudioObjectPropertyListenerProc in the SDK headers.) 511 511 */ 512 static OSStatus drvH ostAudioCaDeviceIsAliveChangedCallback(AudioObjectID idObject, UInt32 cAddresses,513 512 static OSStatus drvHstAudCaDeviceIsAliveChangedCallback(AudioObjectID idObject, UInt32 cAddresses, 513 const AudioObjectPropertyAddress paAddresses[], void *pvUser) 514 514 { 515 515 PCOREAUDIODEVICEDATA pDev = (PCOREAUDIODEVICEDATA)pvUser; … … 552 552 /** @todo r=bird: This is certifiably insane given how StreamDestroy does absolutely _nothing_ unless the init state is INIT. 553 553 * The queue thread will be running and trashing random heap if it tries to modify anything in the stream structure. */ 554 drvH ostAudioCaDevicePropagateStatus(pDev, COREAUDIOINITSTATE_UNINIT);554 drvHstAudCaDevicePropagateStatus(pDev, COREAUDIOINITSTATE_UNINIT); 555 555 } 556 556 … … 567 567 * (See AudioObjectPropertyListenerProc in the SDK headers.) 568 568 */ 569 static OSStatus drvH ostAudioCaDefaultDeviceChangedCallback(AudioObjectID idObject, UInt32 cAddresses,570 569 static OSStatus drvHstAudCaDefaultDeviceChangedCallback(AudioObjectID idObject, UInt32 cAddresses, 570 const AudioObjectPropertyAddress *paAddresses, void *pvUser) 571 571 572 572 { … … 630 630 * Message handling callback for CFMachPort. 631 631 */ 632 static void drvH ostAudioCaThreadPortCallback(CFMachPortRef hPort, void *pvMsg, CFIndex cbMsg, void *pvUser)632 static void drvHstAudCaThreadPortCallback(CFMachPortRef hPort, void *pvMsg, CFIndex cbMsg, void *pvUser) 633 633 { 634 634 RT_NOREF(hPort, pvMsg, cbMsg, pvUser); … … 640 640 * @callback_method_impl{FNRTTHREAD, Worker thread for buffer callbacks.} 641 641 */ 642 static DECLCALLBACK(int) drvH ostAudioCaThread(RTTHREAD hThreadSelf, void *pvUser)642 static DECLCALLBACK(int) drvHstAudCaThread(RTTHREAD hThreadSelf, void *pvUser) 643 643 { 644 644 PDRVHOSTCOREAUDIO pThis = (PDRVHOSTCOREAUDIO)pvUser; … … 688 688 * @interface_method_impl{PDMIHOSTAUDIO,pfnGetConfig} 689 689 */ 690 static DECLCALLBACK(int) drvH ostAudioCaHA_GetConfig(PPDMIHOSTAUDIO pInterface, PPDMAUDIOBACKENDCFG pBackendCfg)690 static DECLCALLBACK(int) drvHstAudCaHA_GetConfig(PPDMIHOSTAUDIO pInterface, PPDMAUDIOBACKENDCFG pBackendCfg) 691 691 { 692 692 PDRVHOSTCOREAUDIO pThis = RT_FROM_MEMBER(pInterface, DRVHOSTCOREAUDIO, IHostAudio); … … 915 915 * functions as uncomplicated as possible. 916 916 */ 917 static int drvH ostAudioCaDevicesEnumerateAll(PDRVHOSTCOREAUDIO pThis, PPDMAUDIOHOSTENUM pDevEnm)917 static int drvHstAudCaDevicesEnumerateAll(PDRVHOSTCOREAUDIO pThis, PPDMAUDIOHOSTENUM pDevEnm) 918 918 { 919 919 AssertPtr(pThis); … … 1077 1077 * NULL is ignored. 1078 1078 */ 1079 static void drvH ostAudioCaDeviceRegisterCallbacks(PCOREAUDIODEVICEDATA pDev)1079 static void drvHstAudCaDeviceRegisterCallbacks(PCOREAUDIODEVICEDATA pDev) 1080 1080 { 1081 1081 if (pDev) … … 1096 1096 }; 1097 1097 OSStatus orc; 1098 orc = AudioObjectAddPropertyListener(idDevice, &PropAddr, drvH ostAudioCaDeviceIsAliveChangedCallback, pDev);1098 orc = AudioObjectAddPropertyListener(idDevice, &PropAddr, drvHstAudCaDeviceIsAliveChangedCallback, pDev); 1099 1099 if ( orc != noErr 1100 1100 && orc != kAudioHardwareIllegalOperationError) … … 1103 1103 PropAddr.mSelector = kAudioDeviceProcessorOverload; 1104 1104 PropAddr.mScope = kAudioUnitScope_Global; 1105 orc = AudioObjectAddPropertyListener(idDevice, &PropAddr, drvH ostAudioCaDevicePropertyChangedCallback, pDev);1105 orc = AudioObjectAddPropertyListener(idDevice, &PropAddr, drvHstAudCaDevicePropertyChangedCallback, pDev); 1106 1106 if (orc != noErr) 1107 1107 LogRel(("CoreAudio: Failed to register processor overload listener (%#x)\n", orc)); … … 1109 1109 PropAddr.mSelector = kAudioDevicePropertyNominalSampleRate; 1110 1110 PropAddr.mScope = kAudioUnitScope_Global; 1111 orc = AudioObjectAddPropertyListener(idDevice, &PropAddr, drvH ostAudioCaDevicePropertyChangedCallback, pDev);1111 orc = AudioObjectAddPropertyListener(idDevice, &PropAddr, drvHstAudCaDevicePropertyChangedCallback, pDev); 1112 1112 if (orc != noErr) 1113 1113 LogRel(("CoreAudio: Failed to register sample rate changed listener (%#x)\n", orc)); … … 1122 1122 * NULL is ignored. 1123 1123 */ 1124 static void drvH ostAudioCaDeviceUnregisterCallbacks(PCOREAUDIODEVICEDATA pDev)1124 static void drvHstAudCaDeviceUnregisterCallbacks(PCOREAUDIODEVICEDATA pDev) 1125 1125 { 1126 1126 if (pDev != NULL) … … 1141 1141 }; 1142 1142 OSStatus orc; 1143 orc = AudioObjectRemovePropertyListener(idDevice, &PropAddr, drvH ostAudioCaDevicePropertyChangedCallback, pDev);1143 orc = AudioObjectRemovePropertyListener(idDevice, &PropAddr, drvHstAudCaDevicePropertyChangedCallback, pDev); 1144 1144 if ( orc != noErr 1145 1145 && orc != kAudioHardwareBadObjectError) … … 1147 1147 1148 1148 PropAddr.mSelector = kAudioDevicePropertyNominalSampleRate; 1149 orc = AudioObjectRemovePropertyListener(idDevice, &PropAddr, drvH ostAudioCaDevicePropertyChangedCallback, pDev);1149 orc = AudioObjectRemovePropertyListener(idDevice, &PropAddr, drvHstAudCaDevicePropertyChangedCallback, pDev); 1150 1150 if ( orc != noErr 1151 1151 && orc != kAudioHardwareBadObjectError) … … 1153 1153 1154 1154 PropAddr.mSelector = kAudioDevicePropertyDeviceIsAlive; 1155 orc = AudioObjectRemovePropertyListener(idDevice, &PropAddr, drvH ostAudioCaDeviceIsAliveChangedCallback, pDev);1155 orc = AudioObjectRemovePropertyListener(idDevice, &PropAddr, drvHstAudCaDeviceIsAliveChangedCallback, pDev); 1156 1156 if ( orc != noErr 1157 1157 && orc != kAudioHardwareBadObjectError) … … 1167 1167 * @param pThis Host audio driver instance. 1168 1168 */ 1169 static int drvH ostAudioCaEnumerateDevices(PDRVHOSTCOREAUDIO pThis)1169 static int drvHstAudCaEnumerateDevices(PDRVHOSTCOREAUDIO pThis) 1170 1170 { 1171 1171 LogFlowFuncEnter(); … … 1176 1176 PDMAUDIOHOSTENUM LocalEnum; 1177 1177 PDMAudioHostEnumInit(&LocalEnum); 1178 int rc = drvH ostAudioCaDevicesEnumerateAll(pThis, &LocalEnum);1178 int rc = drvHstAudCaDevicesEnumerateAll(pThis, &LocalEnum); 1179 1179 if (RT_SUCCESS(rc)) 1180 1180 { … … 1200 1200 LogRel2(("CoreAudio: No default capturing device found (was none)\n")); 1201 1201 1202 drvH ostAudioCaDeviceUnregisterCallbacks(pThis->pDefaultDevIn);1202 drvHstAudCaDeviceUnregisterCallbacks(pThis->pDefaultDevIn); 1203 1203 pThis->pDefaultDevIn = pDefaultDevIn; 1204 drvH ostAudioCaDeviceRegisterCallbacks(pDefaultDevIn);1204 drvHstAudCaDeviceRegisterCallbacks(pDefaultDevIn); 1205 1205 1206 1206 /* Default output. */ … … 1214 1214 LogRel2(("CoreAudio: No default playback device found (was none)\n")); 1215 1215 1216 drvH ostAudioCaDeviceUnregisterCallbacks(pThis->pDefaultDevOut);1216 drvHstAudCaDeviceUnregisterCallbacks(pThis->pDefaultDevOut); 1217 1217 pThis->pDefaultDevOut = pDefaultDevOut; 1218 drvH ostAudioCaDeviceRegisterCallbacks(pDefaultDevOut);1218 drvHstAudCaDeviceRegisterCallbacks(pDefaultDevOut); 1219 1219 1220 1220 /* Replace the enum. */ … … 1235 1235 * @interface_method_impl{PDMIHOSTAUDIO,pfnGetDevices} 1236 1236 */ 1237 static DECLCALLBACK(int) drvH ostAudioCaHA_GetDevices(PPDMIHOSTAUDIO pInterface, PPDMAUDIOHOSTENUM pDeviceEnum)1237 static DECLCALLBACK(int) drvHstAudCaHA_GetDevices(PPDMIHOSTAUDIO pInterface, PPDMAUDIOHOSTENUM pDeviceEnum) 1238 1238 { 1239 1239 PDRVHOSTCOREAUDIO pThis = RT_FROM_MEMBER(pInterface, DRVHOSTCOREAUDIO, IHostAudio); … … 1245 1245 * We update the enumeration associated with pThis ... 1246 1246 */ 1247 int rc = drvH ostAudioCaEnumerateDevices(pThis);1247 int rc = drvHstAudCaEnumerateDevices(pThis); 1248 1248 if (RT_SUCCESS(rc)) 1249 1249 { … … 1267 1267 * @interface_method_impl{PDMIHOSTAUDIO,pfnGetStatus} 1268 1268 */ 1269 static DECLCALLBACK(PDMAUDIOBACKENDSTS) drvH ostAudioCaHA_GetStatus(PPDMIHOSTAUDIO pInterface, PDMAUDIODIR enmDir)1269 static DECLCALLBACK(PDMAUDIOBACKENDSTS) drvHstAudCaHA_GetStatus(PPDMIHOSTAUDIO pInterface, PDMAUDIODIR enmDir) 1270 1270 { 1271 1271 RT_NOREF(pInterface, enmDir); … … 1281 1281 * @param fQueued The new queued state. 1282 1282 */ 1283 DECLINLINE(bool) drvH ostAudioCaSetBufferQueued(AudioQueueBufferRef pAudioBuffer, bool fQueued)1283 DECLINLINE(bool) drvHstAudCaSetBufferQueued(AudioQueueBufferRef pAudioBuffer, bool fQueued) 1284 1284 { 1285 1285 if (fQueued) … … 1294 1294 * @param pAudioBuffer The buffer. 1295 1295 */ 1296 DECLINLINE(bool) drvH ostAudioCaIsBufferQueued(AudioQueueBufferRef pAudioBuffer)1296 DECLINLINE(bool) drvHstAudCaIsBufferQueued(AudioQueueBufferRef pAudioBuffer) 1297 1297 { 1298 1298 return ((uintptr_t)pAudioBuffer->mUserData & 1) == 1; … … 1305 1305 * Called whenever an audio queue is done processing a buffer. This routine 1306 1306 * will set the data fill size to zero and mark it as unqueued so that 1307 * drvH ostAudioCaHA_StreamPlay knowns it can use it.1307 * drvHstAudCaHA_StreamPlay knowns it can use it. 1308 1308 * 1309 1309 * @param pvUser User argument. … … 1313 1313 * @thread queue thread. 1314 1314 */ 1315 static void drvH ostAudioCaOutputQueueBufferCallback(void *pvUser, AudioQueueRef hAudioQueue, AudioQueueBufferRef pAudioBuffer)1315 static void drvHstAudCaOutputQueueBufferCallback(void *pvUser, AudioQueueRef hAudioQueue, AudioQueueBufferRef pAudioBuffer) 1316 1316 { 1317 1317 #if defined(VBOX_STRICT) || defined(LOG_ENABLED) … … 1327 1327 1328 1328 pAudioBuffer->mAudioDataByteSize = 0; 1329 bool fWasQueued = drvH ostAudioCaSetBufferQueued(pAudioBuffer, false /*fQueued*/);1330 Assert(!drvH ostAudioCaIsBufferQueued(pAudioBuffer));1329 bool fWasQueued = drvHstAudCaSetBufferQueued(pAudioBuffer, false /*fQueued*/); 1330 Assert(!drvHstAudCaIsBufferQueued(pAudioBuffer)); 1331 1331 Assert(fWasQueued); RT_NOREF(fWasQueued); 1332 1332 … … 1339 1339 * 1340 1340 * Called whenever input data from the audio queue becomes available. This 1341 * routine will mark the buffer unqueued so that drvH ostAudioCaHA_StreamCapture1342 * canread the data from it.1341 * routine will mark the buffer unqueued so that drvHstAudCaHA_StreamCapture can 1342 * read the data from it. 1343 1343 * 1344 1344 * @param pvUser User argument. … … 1349 1349 * @param paPacketDesc Array of packet descriptors. 1350 1350 */ 1351 static void drvH ostAudioCaInputQueueBufferCallback(void *pvUser, AudioQueueRef hAudioQueue,1352 1353 1351 static void drvHstAudCaInputQueueBufferCallback(void *pvUser, AudioQueueRef hAudioQueue, 1352 AudioQueueBufferRef pAudioBuffer, const AudioTimeStamp *pAudioTS, 1353 UInt32 cPacketDesc, const AudioStreamPacketDescription *paPacketDesc) 1354 1354 { 1355 1355 #if defined(VBOX_STRICT) || defined(LOG_ENABLED) … … 1364 1364 #endif 1365 1365 1366 bool fWasQueued = drvH ostAudioCaSetBufferQueued(pAudioBuffer, false /*fQueued*/);1367 Assert(!drvH ostAudioCaIsBufferQueued(pAudioBuffer));1366 bool fWasQueued = drvHstAudCaSetBufferQueued(pAudioBuffer, false /*fQueued*/); 1367 Assert(!drvHstAudCaIsBufferQueued(pAudioBuffer)); 1368 1368 Assert(fWasQueued); RT_NOREF(fWasQueued); 1369 1369 … … 1375 1375 * @interface_method_impl{PDMIHOSTAUDIO,pfnStreamCreate} 1376 1376 */ 1377 static DECLCALLBACK(int) drvH ostAudioCaHA_StreamCreate(PPDMIHOSTAUDIO pInterface, PPDMAUDIOBACKENDSTREAM pStream,1378 1377 static DECLCALLBACK(int) drvHstAudCaHA_StreamCreate(PPDMIHOSTAUDIO pInterface, PPDMAUDIOBACKENDSTREAM pStream, 1378 PPDMAUDIOSTREAMCFG pCfgReq, PPDMAUDIOSTREAMCFG pCfgAcq) 1379 1379 { 1380 1380 PDRVHOSTCOREAUDIO pThis = RT_FROM_MEMBER(pInterface, DRVHOSTCOREAUDIO, IHostAudio); … … 1442 1442 */ 1443 1443 PDMAudioStrmCfgCopy(&pStreamCA->Cfg, pCfgReq); 1444 drvH ostAudioCaPCMPropsToASBD(&pCfgReq->Props, &pStreamCA->BasicStreamDesc);1444 drvHstAudCaPCMPropsToASBD(&pCfgReq->Props, &pStreamCA->BasicStreamDesc); 1445 1445 /** @todo Do some validation? */ 1446 drvHostAudioCaPrintASBD( pCfgReq->enmDir == PDMAUDIODIR_IN 1447 ? "Capturing queue format" 1448 : "Playback queue format", &pStreamCA->BasicStreamDesc); 1446 drvHstAudCaPrintASBD(pCfgReq->enmDir == PDMAUDIODIR_IN ? "Capturing queue format" : "Playback queue format", 1447 &pStreamCA->BasicStreamDesc); 1449 1448 /* 1450 1449 * Create audio queue. … … 1462 1461 OSStatus orc; 1463 1462 if (pCfgReq->enmDir == PDMAUDIODIR_OUT) 1464 orc = AudioQueueNewOutput(&pStreamCA->BasicStreamDesc, drvH ostAudioCaOutputQueueBufferCallback, pStreamCA,1463 orc = AudioQueueNewOutput(&pStreamCA->BasicStreamDesc, drvHstAudCaOutputQueueBufferCallback, pStreamCA, 1465 1464 hRunLoop, hRunLoopMode, 0 /*fFlags - MBZ*/, &pStreamCA->hAudioQueue); 1466 1465 else 1467 orc = AudioQueueNewInput(&pStreamCA->BasicStreamDesc, drvH ostAudioCaInputQueueBufferCallback, pStreamCA,1466 orc = AudioQueueNewInput(&pStreamCA->BasicStreamDesc, drvHstAudCaInputQueueBufferCallback, pStreamCA, 1468 1467 hRunLoop, hRunLoopMode, 0 /*fFlags - MBZ*/, &pStreamCA->hAudioQueue); 1469 1468 LogFlowFunc(("AudioQueueNew%s -> %#x\n", pCfgReq->enmDir == PDMAUDIODIR_OUT ? "Output" : "Input", orc)); … … 1599 1598 * @interface_method_impl{PDMIHOSTAUDIO,pfnStreamDestroy} 1600 1599 */ 1601 static DECLCALLBACK(int) drvHostAudioCaHA_StreamDestroy(PPDMIHOSTAUDIO pInterface, PPDMAUDIOBACKENDSTREAM pStream, 1602 bool fImmediate) 1600 static DECLCALLBACK(int) drvHstAudCaHA_StreamDestroy(PPDMIHOSTAUDIO pInterface, PPDMAUDIOBACKENDSTREAM pStream, bool fImmediate) 1603 1601 { 1604 1602 RT_NOREF(pInterface); … … 1708 1706 #ifdef CORE_AUDIO_WITH_BREAKPOINT_TIMER 1709 1707 /** @callback_method_impl{FNRTTIMERLR, For debugging things that takes too long.} */ 1710 static DECLCALLBACK(void) drvH ostAudioCaBreakpointTimer(RTTIMERLR hTimer, void *pvUser, uint64_t iTick)1708 static DECLCALLBACK(void) drvHstAudCaBreakpointTimer(RTTIMERLR hTimer, void *pvUser, uint64_t iTick) 1711 1709 { 1712 1710 LogFlowFunc(("Queue-destruction timeout! iTick=%RU64\n", iTick)); … … 1721 1719 * @ interface_method_impl{PDMIHOSTAUDIO,pfnStreamEnable} 1722 1720 */ 1723 static DECLCALLBACK(int) drvH ostAudioCaHA_StreamEnable(PPDMIHOSTAUDIO pInterface, PPDMAUDIOBACKENDSTREAM pStream)1721 static DECLCALLBACK(int) drvHstAudCaHA_StreamEnable(PPDMIHOSTAUDIO pInterface, PPDMAUDIOBACKENDSTREAM pStream) 1724 1722 { 1725 1723 RT_NOREF(pInterface); 1726 1724 PCOREAUDIOSTREAM pStreamCA = (PCOREAUDIOSTREAM)pStream; 1727 LogFlowFunc(("Stream '%s' {%s}\n", pStreamCA->Cfg.szName, drvH ostAudioCaStreamStatusString(pStreamCA)));1725 LogFlowFunc(("Stream '%s' {%s}\n", pStreamCA->Cfg.szName, drvHstAudCaStreamStatusString(pStreamCA))); 1728 1726 AssertReturn(pStreamCA->enmInitState == COREAUDIOINITSTATE_INIT, VERR_AUDIO_STREAM_NOT_READY); 1729 1727 RTCritSectEnter(&pStreamCA->CritSect); … … 1740 1738 Assert(orc == noErr); 1741 1739 for (uint32_t iBuf = 0; iBuf < pStreamCA->cBuffers; iBuf++) 1742 Assert(!drvH ostAudioCaIsBufferQueued(pStreamCA->paBuffers[iBuf].pBuf));1740 Assert(!drvHstAudCaIsBufferQueued(pStreamCA->paBuffers[iBuf].pBuf)); 1743 1741 1744 1742 pStreamCA->offInternal = 0; … … 1750 1748 /* 1751 1749 * Input streams will start capturing, while output streams will only start 1752 * playing once we get some audio data to play (see drvH ostAudioCaHA_StreamPlay).1750 * playing once we get some audio data to play (see drvHstAudCaHA_StreamPlay). 1753 1751 */ 1754 1752 int rc = VINF_SUCCESS; … … 1762 1760 RT_BZERO(pBuf->mAudioData, pBuf->mAudioDataBytesCapacity); 1763 1761 pBuf->mAudioDataByteSize = 0; 1764 drvH ostAudioCaSetBufferQueued(pBuf, true /*fQueued*/);1762 drvHstAudCaSetBufferQueued(pBuf, true /*fQueued*/); 1765 1763 1766 1764 orc = AudioQueueEnqueueBuffer(pStreamCA->hAudioQueue, pBuf, 0 /*inNumPacketDescs*/, NULL /*inPacketDescs*/); 1767 1765 AssertLogRelMsgBreakStmt(orc == noErr, ("CoreAudio: AudioQueueEnqueueBuffer(#%u) -> %#x (%d) - stream '%s'\n", 1768 1766 iBuf, orc, orc, pStreamCA->Cfg.szName), 1769 drvH ostAudioCaSetBufferQueued(pBuf, false /*fQueued*/));1767 drvHstAudCaSetBufferQueued(pBuf, false /*fQueued*/)); 1770 1768 } 1771 1769 … … 1794 1792 * @ interface_method_impl{PDMIHOSTAUDIO,pfnStreamDisable} 1795 1793 */ 1796 static DECLCALLBACK(int) drvH ostAudioCaHA_StreamDisable(PPDMIHOSTAUDIO pInterface, PPDMAUDIOBACKENDSTREAM pStream)1794 static DECLCALLBACK(int) drvHstAudCaHA_StreamDisable(PPDMIHOSTAUDIO pInterface, PPDMAUDIOBACKENDSTREAM pStream) 1797 1795 { 1798 1796 RT_NOREF(pInterface); … … 1800 1798 LogFlowFunc(("cMsLastTransfer=%RI64 ms, stream '%s' {%s} \n", 1801 1799 pStreamCA->msLastTransfer ? RTTimeMilliTS() - pStreamCA->msLastTransfer : -1, 1802 pStreamCA->Cfg.szName, drvH ostAudioCaStreamStatusString(pStreamCA) ));1800 pStreamCA->Cfg.szName, drvHstAudCaStreamStatusString(pStreamCA) )); 1803 1801 AssertReturn(pStreamCA->enmInitState == COREAUDIOINITSTATE_INIT, VERR_AUDIO_STREAM_NOT_READY); 1804 1802 RTCritSectEnter(&pStreamCA->CritSect); … … 1833 1831 1834 1832 RTCritSectLeave(&pStreamCA->CritSect); 1835 LogFlowFunc(("returns %Rrc {%s}\n", rc, drvH ostAudioCaStreamStatusString(pStreamCA)));1833 LogFlowFunc(("returns %Rrc {%s}\n", rc, drvHstAudCaStreamStatusString(pStreamCA))); 1836 1834 return rc; 1837 1835 } … … 1841 1839 * @ interface_method_impl{PDMIHOSTAUDIO,pfnStreamPause} 1842 1840 */ 1843 static DECLCALLBACK(int) drvH ostAudioCaHA_StreamPause(PPDMIHOSTAUDIO pInterface, PPDMAUDIOBACKENDSTREAM pStream)1841 static DECLCALLBACK(int) drvHstAudCaHA_StreamPause(PPDMIHOSTAUDIO pInterface, PPDMAUDIOBACKENDSTREAM pStream) 1844 1842 { 1845 1843 RT_NOREF(pInterface); … … 1847 1845 LogFlowFunc(("cMsLastTransfer=%RI64 ms, stream '%s' {%s} \n", 1848 1846 pStreamCA->msLastTransfer ? RTTimeMilliTS() - pStreamCA->msLastTransfer : -1, 1849 pStreamCA->Cfg.szName, drvH ostAudioCaStreamStatusString(pStreamCA) ));1847 pStreamCA->Cfg.szName, drvHstAudCaStreamStatusString(pStreamCA) )); 1850 1848 AssertReturn(pStreamCA->enmInitState == COREAUDIOINITSTATE_INIT, VERR_AUDIO_STREAM_NOT_READY); 1851 1849 RTCritSectEnter(&pStreamCA->CritSect); … … 1879 1877 1880 1878 RTCritSectLeave(&pStreamCA->CritSect); 1881 LogFlowFunc(("returns %Rrc {%s}\n", rc, drvH ostAudioCaStreamStatusString(pStreamCA)));1879 LogFlowFunc(("returns %Rrc {%s}\n", rc, drvHstAudCaStreamStatusString(pStreamCA))); 1882 1880 return rc; 1883 1881 } … … 1887 1885 * @ interface_method_impl{PDMIHOSTAUDIO,pfnStreamResume} 1888 1886 */ 1889 static DECLCALLBACK(int) drvH ostAudioCaHA_StreamResume(PPDMIHOSTAUDIO pInterface, PPDMAUDIOBACKENDSTREAM pStream)1887 static DECLCALLBACK(int) drvHstAudCaHA_StreamResume(PPDMIHOSTAUDIO pInterface, PPDMAUDIOBACKENDSTREAM pStream) 1890 1888 { 1891 1889 RT_NOREF(pInterface); 1892 1890 PCOREAUDIOSTREAM pStreamCA = (PCOREAUDIOSTREAM)pStream; 1893 LogFlowFunc(("Stream '%s' {%s}\n", pStreamCA->Cfg.szName, drvH ostAudioCaStreamStatusString(pStreamCA)));1891 LogFlowFunc(("Stream '%s' {%s}\n", pStreamCA->Cfg.szName, drvHstAudCaStreamStatusString(pStreamCA))); 1894 1892 AssertReturn(pStreamCA->enmInitState == COREAUDIOINITSTATE_INIT, VERR_AUDIO_STREAM_NOT_READY); 1895 1893 RTCritSectEnter(&pStreamCA->CritSect); 1896 1894 1897 1895 /* 1898 * Resume according to state saved by drvH ostAudioCaHA_StreamPause.1896 * Resume according to state saved by drvHstAudCaHA_StreamPause. 1899 1897 */ 1900 1898 int rc = VINF_SUCCESS; … … 1912 1910 1913 1911 RTCritSectLeave(&pStreamCA->CritSect); 1914 LogFlowFunc(("returns %Rrc {%s}\n", rc, drvH ostAudioCaStreamStatusString(pStreamCA)));1912 LogFlowFunc(("returns %Rrc {%s}\n", rc, drvHstAudCaStreamStatusString(pStreamCA))); 1915 1913 return rc; 1916 1914 } … … 1920 1918 * @ interface_method_impl{PDMIHOSTAUDIO,pfnStreamDrain} 1921 1919 */ 1922 static DECLCALLBACK(int) drvH ostAudioCaHA_StreamDrain(PPDMIHOSTAUDIO pInterface, PPDMAUDIOBACKENDSTREAM pStream)1920 static DECLCALLBACK(int) drvHstAudCaHA_StreamDrain(PPDMIHOSTAUDIO pInterface, PPDMAUDIOBACKENDSTREAM pStream) 1923 1921 { 1924 1922 RT_NOREF(pInterface); … … 1927 1925 LogFlowFunc(("cMsLastTransfer=%RI64 ms, stream '%s' {%s} \n", 1928 1926 pStreamCA->msLastTransfer ? RTTimeMilliTS() - pStreamCA->msLastTransfer : -1, 1929 pStreamCA->Cfg.szName, drvH ostAudioCaStreamStatusString(pStreamCA) ));1927 pStreamCA->Cfg.szName, drvHstAudCaStreamStatusString(pStreamCA) )); 1930 1928 AssertReturn(pStreamCA->enmInitState == COREAUDIOINITSTATE_INIT, VERR_AUDIO_STREAM_NOT_READY); 1931 1929 RTCritSectEnter(&pStreamCA->CritSect); … … 1961 1959 1962 1960 RTCritSectLeave(&pStreamCA->CritSect); 1963 LogFlowFunc(("returns %Rrc {%s}\n", rc, drvH ostAudioCaStreamStatusString(pStreamCA)));1961 LogFlowFunc(("returns %Rrc {%s}\n", rc, drvHstAudCaStreamStatusString(pStreamCA))); 1964 1962 return rc; 1965 1963 } … … 1969 1967 * @interface_method_impl{PDMIHOSTAUDIO,pfnStreamControl} 1970 1968 */ 1971 static DECLCALLBACK(int) drvH ostAudioCaHA_StreamControl(PPDMIHOSTAUDIO pInterface,1972 1969 static DECLCALLBACK(int) drvHstAudCaHA_StreamControl(PPDMIHOSTAUDIO pInterface, 1970 PPDMAUDIOBACKENDSTREAM pStream, PDMAUDIOSTREAMCMD enmStreamCmd) 1973 1971 { 1974 1972 /** @todo r=bird: I'd like to get rid of this pfnStreamControl method, … … 1979 1977 { 1980 1978 case PDMAUDIOSTREAMCMD_ENABLE: 1981 return drvH ostAudioCaHA_StreamEnable(pInterface, pStream);1979 return drvHstAudCaHA_StreamEnable(pInterface, pStream); 1982 1980 case PDMAUDIOSTREAMCMD_DISABLE: 1983 return drvH ostAudioCaHA_StreamDisable(pInterface, pStream);1981 return drvHstAudCaHA_StreamDisable(pInterface, pStream); 1984 1982 case PDMAUDIOSTREAMCMD_PAUSE: 1985 return drvH ostAudioCaHA_StreamPause(pInterface, pStream);1983 return drvHstAudCaHA_StreamPause(pInterface, pStream); 1986 1984 case PDMAUDIOSTREAMCMD_RESUME: 1987 return drvH ostAudioCaHA_StreamResume(pInterface, pStream);1985 return drvHstAudCaHA_StreamResume(pInterface, pStream); 1988 1986 case PDMAUDIOSTREAMCMD_DRAIN: 1989 return drvH ostAudioCaHA_StreamDrain(pInterface, pStream);1987 return drvHstAudCaHA_StreamDrain(pInterface, pStream); 1990 1988 1991 1989 case PDMAUDIOSTREAMCMD_END: … … 2002 2000 * @interface_method_impl{PDMIHOSTAUDIO,pfnStreamGetReadable} 2003 2001 */ 2004 static DECLCALLBACK(uint32_t) drvH ostAudioCaHA_StreamGetReadable(PPDMIHOSTAUDIO pInterface, PPDMAUDIOBACKENDSTREAM pStream)2002 static DECLCALLBACK(uint32_t) drvHstAudCaHA_StreamGetReadable(PPDMIHOSTAUDIO pInterface, PPDMAUDIOBACKENDSTREAM pStream) 2005 2003 { 2006 2004 RT_NOREF(pInterface); … … 2020 2018 2021 2019 if ( cBuffers > 0 2022 && !drvH ostAudioCaIsBufferQueued(pBuf = paBuffers[idxBuffer].pBuf))2020 && !drvHstAudCaIsBufferQueued(pBuf = paBuffers[idxBuffer].pBuf)) 2023 2021 { 2024 2022 do … … 2038 2036 else 2039 2037 idxBuffer = 0; 2040 } while (idxBuffer != idxStart && !drvH ostAudioCaIsBufferQueued(pBuf = paBuffers[idxBuffer].pBuf));2038 } while (idxBuffer != idxStart && !drvHstAudCaIsBufferQueued(pBuf = paBuffers[idxBuffer].pBuf)); 2041 2039 } 2042 2040 … … 2051 2049 * @interface_method_impl{PDMIHOSTAUDIO,pfnStreamGetWritable} 2052 2050 */ 2053 static DECLCALLBACK(uint32_t) drvH ostAudioCaHA_StreamGetWritable(PPDMIHOSTAUDIO pInterface, PPDMAUDIOBACKENDSTREAM pStream)2051 static DECLCALLBACK(uint32_t) drvHstAudCaHA_StreamGetWritable(PPDMIHOSTAUDIO pInterface, PPDMAUDIOBACKENDSTREAM pStream) 2054 2052 { 2055 2053 RT_NOREF(pInterface); … … 2069 2067 2070 2068 if ( cBuffers > 0 2071 && !drvH ostAudioCaIsBufferQueued(pBuf = paBuffers[idxBuffer].pBuf))2069 && !drvHstAudCaIsBufferQueued(pBuf = paBuffers[idxBuffer].pBuf)) 2072 2070 { 2073 2071 do … … 2085 2083 else 2086 2084 idxBuffer = 0; 2087 } while (idxBuffer != idxStart && !drvH ostAudioCaIsBufferQueued(pBuf = paBuffers[idxBuffer].pBuf));2085 } while (idxBuffer != idxStart && !drvHstAudCaIsBufferQueued(pBuf = paBuffers[idxBuffer].pBuf)); 2088 2086 } 2089 2087 … … 2098 2096 * @interface_method_impl{PDMIHOSTAUDIO,pfnStreamGetState} 2099 2097 */ 2100 static DECLCALLBACK(PDMHOSTAUDIOSTREAMSTATE) drvH ostAudioCaHA_StreamGetState(PPDMIHOSTAUDIO pInterface,2101 2098 static DECLCALLBACK(PDMHOSTAUDIOSTREAMSTATE) drvHstAudCaHA_StreamGetState(PPDMIHOSTAUDIO pInterface, 2099 PPDMAUDIOBACKENDSTREAM pStream) 2102 2100 { 2103 2101 RT_NOREF(pInterface); … … 2118 2116 uintptr_t idxBuffer = pStreamCA->cBuffers; 2119 2117 while (idxBuffer-- > 0) 2120 if (!drvH ostAudioCaIsBufferQueued(paBuffers[idxBuffer].pBuf))2118 if (!drvHstAudCaIsBufferQueued(paBuffers[idxBuffer].pBuf)) 2121 2119 { /* likely */ } 2122 2120 else … … 2125 2123 uint32_t cQueued = 1; 2126 2124 while (idxBuffer-- > 0) 2127 cQueued += drvH ostAudioCaIsBufferQueued(paBuffers[idxBuffer].pBuf);2125 cQueued += drvHstAudCaIsBufferQueued(paBuffers[idxBuffer].pBuf); 2128 2126 LogFunc(("Still done draining '%s': %u queued buffers\n", pStreamCA->Cfg.szName, cQueued)); 2129 2127 #endif … … 2147 2145 * @interface_method_impl{PDMIHOSTAUDIO,pfnStreamPlay} 2148 2146 */ 2149 static DECLCALLBACK(int) drvH ostAudioCaHA_StreamPlay(PPDMIHOSTAUDIO pInterface, PPDMAUDIOBACKENDSTREAM pStream,2150 2147 static DECLCALLBACK(int) drvHstAudCaHA_StreamPlay(PPDMIHOSTAUDIO pInterface, PPDMAUDIOBACKENDSTREAM pStream, 2148 const void *pvBuf, uint32_t cbBuf, uint32_t *pcbWritten) 2151 2149 { 2152 2150 RT_NOREF(pInterface); … … 2166 2164 RTCritSectLeave(&pStreamCA->CritSect); 2167 2165 *pcbWritten = 0; 2168 LogFunc(("Skipping %#x byte write to disabled stream {%s}\n", cbBuf, drvH ostAudioCaStreamStatusString(pStreamCA) ));2166 LogFunc(("Skipping %#x byte write to disabled stream {%s}\n", cbBuf, drvHstAudCaStreamStatusString(pStreamCA) )); 2169 2167 return VINF_SUCCESS; 2170 2168 } 2171 Log4Func(("cbBuf=%#x stream '%s' {%s}\n", cbBuf, pStreamCA->Cfg.szName, drvH ostAudioCaStreamStatusString(pStreamCA) ));2169 Log4Func(("cbBuf=%#x stream '%s' {%s}\n", cbBuf, pStreamCA->Cfg.szName, drvHstAudCaStreamStatusString(pStreamCA) )); 2172 2170 2173 2171 /* … … 2192 2190 */ 2193 2191 AudioQueueBufferRef const pBuf = paBuffers[idxBuffer].pBuf; 2194 if (!drvH ostAudioCaIsBufferQueued(pBuf))2192 if (!drvHstAudCaIsBufferQueued(pBuf)) 2195 2193 { /* likely */ } 2196 2194 else … … 2213 2211 { 2214 2212 Log3Func(("@%#RX64: buffer #%u/%u: %#x bytes, have %#x only - leaving unqueued {%s}\n", 2215 pStreamCA->offInternal, idxBuffer, cBuffers, cbAvail, cbBuf, drvH ostAudioCaStreamStatusString(pStreamCA) ));2213 pStreamCA->offInternal, idxBuffer, cBuffers, cbAvail, cbBuf, drvHstAudCaStreamStatusString(pStreamCA) )); 2216 2214 memcpy((uint8_t *)pBuf->mAudioData + cbUsed, pvBuf, cbBuf); 2217 2215 pBuf->mAudioDataByteSize = cbUsed + cbBuf; … … 2224 2222 2225 2223 Log3Func(("@%#RX64: buffer #%u/%u: %#x bytes, have %#x - will queue {%s}\n", 2226 pStreamCA->offInternal, idxBuffer, cBuffers, cbAvail, cbBuf, drvH ostAudioCaStreamStatusString(pStreamCA) ));2224 pStreamCA->offInternal, idxBuffer, cBuffers, cbAvail, cbBuf, drvHstAudCaStreamStatusString(pStreamCA) )); 2227 2225 memcpy((uint8_t *)pBuf->mAudioData + cbUsed, pvBuf, cbAvail); 2228 2226 pBuf->mAudioDataByteSize = cbTotal; 2229 2227 cbWritten += cbAvail; 2230 2228 pStreamCA->offInternal += cbAvail; 2231 drvH ostAudioCaSetBufferQueued(pBuf, true /*fQueued*/);2229 drvHstAudCaSetBufferQueued(pBuf, true /*fQueued*/); 2232 2230 2233 2231 OSStatus orc = AudioQueueEnqueueBuffer(pStreamCA->hAudioQueue, pBuf, 0 /*inNumPacketDesc*/, NULL /*inPacketDescs*/); … … 2238 2236 LogRelMax(256, ("CoreAudio: AudioQueueEnqueueBuffer('%s', #%u) failed: %#x (%d)\n", 2239 2237 pStreamCA->Cfg.szName, idxBuffer, orc, orc)); 2240 drvH ostAudioCaSetBufferQueued(pBuf, false /*fQueued*/);2238 drvHstAudCaSetBufferQueued(pBuf, false /*fQueued*/); 2241 2239 pBuf->mAudioDataByteSize -= PDMAudioPropsFramesToBytes(&pStreamCA->Cfg.Props, 1); /* avoid assertions above */ 2242 2240 rc = VERR_AUDIO_STREAM_NOT_READY; … … 2309 2307 } 2310 2308 LogFlowFunc(("@%#RX64: rc=%Rrc cbWritten=%RU32 cMsDelta=%RU64 (%RU64 -> %RU64) {%s}\n", pStreamCA->offInternal, rc, cbWritten, 2311 msPrev ? msNow - msPrev : 0, msPrev, pStreamCA->msLastTransfer, drvH ostAudioCaStreamStatusString(pStreamCA) ));2309 msPrev ? msNow - msPrev : 0, msPrev, pStreamCA->msLastTransfer, drvHstAudCaStreamStatusString(pStreamCA) )); 2312 2310 return rc; 2313 2311 } … … 2317 2315 * @interface_method_impl{PDMIHOSTAUDIO,pfnStreamCapture} 2318 2316 */ 2319 static DECLCALLBACK(int) drvH ostAudioCaHA_StreamCapture(PPDMIHOSTAUDIO pInterface, PPDMAUDIOBACKENDSTREAM pStream,2320 2317 static DECLCALLBACK(int) drvHstAudCaHA_StreamCapture(PPDMIHOSTAUDIO pInterface, PPDMAUDIOBACKENDSTREAM pStream, 2318 void *pvBuf, uint32_t cbBuf, uint32_t *pcbRead) 2321 2319 { 2322 2320 RT_NOREF(pInterface); … … 2336 2334 RTCritSectLeave(&pStreamCA->CritSect); 2337 2335 *pcbRead = 0; 2338 LogFunc(("Skipping %#x byte read from disabled stream {%s}\n", cbBuf, drvH ostAudioCaStreamStatusString(pStreamCA)));2336 LogFunc(("Skipping %#x byte read from disabled stream {%s}\n", cbBuf, drvHstAudCaStreamStatusString(pStreamCA))); 2339 2337 return VINF_SUCCESS; 2340 2338 } 2341 Log4Func(("cbBuf=%#x stream '%s' {%s}\n", cbBuf, pStreamCA->Cfg.szName, drvH ostAudioCaStreamStatusString(pStreamCA) ));2339 Log4Func(("cbBuf=%#x stream '%s' {%s}\n", cbBuf, pStreamCA->Cfg.szName, drvHstAudCaStreamStatusString(pStreamCA) )); 2342 2340 2343 2341 … … 2364 2362 */ 2365 2363 AudioQueueBufferRef const pBuf = paBuffers[idxBuffer].pBuf; 2366 if (!drvH ostAudioCaIsBufferQueued(pBuf))2364 if (!drvHstAudCaIsBufferQueued(pBuf)) 2367 2365 { /* likely */ } 2368 2366 else … … 2386 2384 { 2387 2385 Log3Func(("@%#RX64: buffer #%u/%u: %#x bytes, want %#x - leaving unqueued {%s}\n", 2388 pStreamCA->offInternal, idxBuffer, cBuffers, cbLeft, cbBuf, drvH ostAudioCaStreamStatusString(pStreamCA) ));2386 pStreamCA->offInternal, idxBuffer, cBuffers, cbLeft, cbBuf, drvHstAudCaStreamStatusString(pStreamCA) )); 2389 2387 memcpy(pvBuf, (uint8_t const *)pBuf->mAudioData + offRead, cbBuf); 2390 2388 paBuffers[idxBuffer].offRead = offRead + cbBuf; … … 2395 2393 2396 2394 Log3Func(("@%#RX64: buffer #%u/%u: %#x bytes, want all (%#x) - will queue {%s}\n", 2397 pStreamCA->offInternal, idxBuffer, cBuffers, cbLeft, cbBuf, drvH ostAudioCaStreamStatusString(pStreamCA) ));2395 pStreamCA->offInternal, idxBuffer, cBuffers, cbLeft, cbBuf, drvHstAudCaStreamStatusString(pStreamCA) )); 2398 2396 memcpy(pvBuf, (uint8_t const *)pBuf->mAudioData + offRead, cbLeft); 2399 2397 cbRead += cbLeft; … … 2403 2401 paBuffers[idxBuffer].offRead = 0; 2404 2402 pBuf->mAudioDataByteSize = 0; 2405 drvH ostAudioCaSetBufferQueued(pBuf, true /*fQueued*/);2403 drvHstAudCaSetBufferQueued(pBuf, true /*fQueued*/); 2406 2404 2407 2405 OSStatus orc = AudioQueueEnqueueBuffer(pStreamCA->hAudioQueue, pBuf, 0 /*inNumPacketDesc*/, NULL /*inPacketDescs*/); … … 2412 2410 LogRelMax(256, ("CoreAudio: AudioQueueEnqueueBuffer('%s', #%u) failed: %#x (%d)\n", 2413 2411 pStreamCA->Cfg.szName, idxBuffer, orc, orc)); 2414 drvH ostAudioCaSetBufferQueued(pBuf, false /*fQueued*/);2412 drvHstAudCaSetBufferQueued(pBuf, false /*fQueued*/); 2415 2413 rc = VERR_AUDIO_STREAM_NOT_READY; 2416 2414 break; … … 2452 2450 } 2453 2451 LogFlowFunc(("@%#RX64: rc=%Rrc cbRead=%RU32 cMsDelta=%RU64 (%RU64 -> %RU64) {%s}\n", pStreamCA->offInternal, rc, cbRead, 2454 msPrev ? msNow - msPrev : 0, msPrev, pStreamCA->msLastTransfer, drvH ostAudioCaStreamStatusString(pStreamCA) ));2452 msPrev ? msNow - msPrev : 0, msPrev, pStreamCA->msLastTransfer, drvHstAudCaStreamStatusString(pStreamCA) )); 2455 2453 return rc; 2456 2454 } … … 2464 2462 * @interface_method_impl{PDMIBASE,pfnQueryInterface} 2465 2463 */ 2466 static DECLCALLBACK(void *) drvH ostAudioCaQueryInterface(PPDMIBASE pInterface, const char *pszIID)2464 static DECLCALLBACK(void *) drvHstAudCaQueryInterface(PPDMIBASE pInterface, const char *pszIID) 2467 2465 { 2468 2466 PPDMDRVINS pDrvIns = PDMIBASE_2_PDMDRV(pInterface); … … 2483 2481 * Worker for the power off and destructor callbacks. 2484 2482 */ 2485 static void drvH ostAudioCaRemoveDefaultDeviceListners(PDRVHOSTCOREAUDIO pThis)2483 static void drvHstAudCaRemoveDefaultDeviceListners(PDRVHOSTCOREAUDIO pThis) 2486 2484 { 2487 2485 /* … … 2499 2497 { 2500 2498 orc = AudioObjectRemovePropertyListener(kAudioObjectSystemObject, &PropAddr, 2501 drvH ostAudioCaDefaultDeviceChangedCallback, pThis);2499 drvHstAudCaDefaultDeviceChangedCallback, pThis); 2502 2500 if ( orc != noErr 2503 2501 && orc != kAudioHardwareBadObjectError) … … 2511 2509 PropAddr.mSelector = kAudioHardwarePropertyDefaultOutputDevice; 2512 2510 orc = AudioObjectRemovePropertyListener(kAudioObjectSystemObject, &PropAddr, 2513 drvH ostAudioCaDefaultDeviceChangedCallback, pThis);2511 drvHstAudCaDefaultDeviceChangedCallback, pThis); 2514 2512 if ( orc != noErr 2515 2513 && orc != kAudioHardwareBadObjectError) … … 2525 2523 * @interface_method_impl{PDMDRVREG,pfnPowerOff} 2526 2524 */ 2527 static DECLCALLBACK(void) drvH ostAudioCaPowerOff(PPDMDRVINS pDrvIns)2525 static DECLCALLBACK(void) drvHstAudCaPowerOff(PPDMDRVINS pDrvIns) 2528 2526 { 2529 2527 PDRVHOSTCOREAUDIO pThis = PDMINS_2_DATA(pDrvIns, PDRVHOSTCOREAUDIO); 2530 drvH ostAudioCaRemoveDefaultDeviceListners(pThis);2528 drvHstAudCaRemoveDefaultDeviceListners(pThis); 2531 2529 } 2532 2530 … … 2535 2533 * @callback_method_impl{FNPDMDRVDESTRUCT} 2536 2534 */ 2537 static DECLCALLBACK(void) drvH ostAudioCaDestruct(PPDMDRVINS pDrvIns)2535 static DECLCALLBACK(void) drvHstAudCaDestruct(PPDMDRVINS pDrvIns) 2538 2536 { 2539 2537 PDMDRV_CHECK_VERSIONS_RETURN_VOID(pDrvIns); 2540 2538 PDRVHOSTCOREAUDIO pThis = PDMINS_2_DATA(pDrvIns, PDRVHOSTCOREAUDIO); 2541 2539 2542 drvH ostAudioCaRemoveDefaultDeviceListners(pThis);2540 drvHstAudCaRemoveDefaultDeviceListners(pThis); 2543 2541 2544 2542 if (RTCritSectIsInitialized(&pThis->CritSect)) 2545 2543 { 2546 2544 RTCritSectEnter(&pThis->CritSect); 2547 drvH ostAudioCaDeviceUnregisterCallbacks(pThis->pDefaultDevIn);2548 drvH ostAudioCaDeviceUnregisterCallbacks(pThis->pDefaultDevOut);2545 drvHstAudCaDeviceUnregisterCallbacks(pThis->pDefaultDevIn); 2546 drvHstAudCaDeviceUnregisterCallbacks(pThis->pDefaultDevOut); 2549 2547 RTCritSectLeave(&pThis->CritSect); 2550 2548 } … … 2608 2606 * Construct a Core Audio driver instance.} 2609 2607 */ 2610 static DECLCALLBACK(int) drvH ostAudioCaConstruct(PPDMDRVINS pDrvIns, PCFGMNODE pCfg, uint32_t fFlags)2608 static DECLCALLBACK(int) drvHstAudCaConstruct(PPDMDRVINS pDrvIns, PCFGMNODE pCfg, uint32_t fFlags) 2611 2609 { 2612 2610 RT_NOREF(pCfg, fFlags); … … 2627 2625 PDMAudioHostEnumInit(&pThis->Devices); 2628 2626 /* IBase */ 2629 pDrvIns->IBase.pfnQueryInterface = drvH ostAudioCaQueryInterface;2627 pDrvIns->IBase.pfnQueryInterface = drvHstAudCaQueryInterface; 2630 2628 /* IHostAudio */ 2631 pThis->IHostAudio.pfnGetConfig = drvH ostAudioCaHA_GetConfig;2632 pThis->IHostAudio.pfnGetDevices = drvH ostAudioCaHA_GetDevices;2633 pThis->IHostAudio.pfnGetStatus = drvH ostAudioCaHA_GetStatus;2629 pThis->IHostAudio.pfnGetConfig = drvHstAudCaHA_GetConfig; 2630 pThis->IHostAudio.pfnGetDevices = drvHstAudCaHA_GetDevices; 2631 pThis->IHostAudio.pfnGetStatus = drvHstAudCaHA_GetStatus; 2634 2632 pThis->IHostAudio.pfnDoOnWorkerThread = NULL; 2635 2633 pThis->IHostAudio.pfnStreamConfigHint = NULL; 2636 pThis->IHostAudio.pfnStreamCreate = drvH ostAudioCaHA_StreamCreate;2634 pThis->IHostAudio.pfnStreamCreate = drvHstAudCaHA_StreamCreate; 2637 2635 pThis->IHostAudio.pfnStreamInitAsync = NULL; 2638 pThis->IHostAudio.pfnStreamDestroy = drvH ostAudioCaHA_StreamDestroy;2636 pThis->IHostAudio.pfnStreamDestroy = drvHstAudCaHA_StreamDestroy; 2639 2637 pThis->IHostAudio.pfnStreamNotifyDeviceChanged = NULL; 2640 pThis->IHostAudio.pfnStreamControl = drvH ostAudioCaHA_StreamControl;2641 pThis->IHostAudio.pfnStreamGetReadable = drvH ostAudioCaHA_StreamGetReadable;2642 pThis->IHostAudio.pfnStreamGetWritable = drvH ostAudioCaHA_StreamGetWritable;2638 pThis->IHostAudio.pfnStreamControl = drvHstAudCaHA_StreamControl; 2639 pThis->IHostAudio.pfnStreamGetReadable = drvHstAudCaHA_StreamGetReadable; 2640 pThis->IHostAudio.pfnStreamGetWritable = drvHstAudCaHA_StreamGetWritable; 2643 2641 pThis->IHostAudio.pfnStreamGetPending = NULL; 2644 pThis->IHostAudio.pfnStreamGetState = drvH ostAudioCaHA_StreamGetState;2645 pThis->IHostAudio.pfnStreamPlay = drvH ostAudioCaHA_StreamPlay;2646 pThis->IHostAudio.pfnStreamCapture = drvH ostAudioCaHA_StreamCapture;2642 pThis->IHostAudio.pfnStreamGetState = drvHstAudCaHA_StreamGetState; 2643 pThis->IHostAudio.pfnStreamPlay = drvHstAudCaHA_StreamPlay; 2644 pThis->IHostAudio.pfnStreamCapture = drvHstAudCaHA_StreamCapture; 2647 2645 2648 2646 int rc = RTCritSectInit(&pThis->CritSect); … … 2659 2657 PortCtx.release = NULL; 2660 2658 PortCtx.copyDescription = NULL; 2661 pThis->hThreadPort = CFMachPortCreate(NULL /*allocator*/, drvH ostAudioCaThreadPortCallback, &PortCtx, NULL);2659 pThis->hThreadPort = CFMachPortCreate(NULL /*allocator*/, drvHstAudCaThreadPortCallback, &PortCtx, NULL); 2662 2660 AssertLogRelReturn(pThis->hThreadPort != NULL, VERR_NO_MEMORY); 2663 2661 … … 2665 2663 AssertLogRelReturn(pThis->hThreadPortSrc != NULL, VERR_NO_MEMORY); 2666 2664 2667 rc = RTThreadCreateF(&pThis->hThread, drvH ostAudioCaThread, pThis, 0, RTTHREADTYPE_IO,2665 rc = RTThreadCreateF(&pThis->hThread, drvHstAudCaThread, pThis, 0, RTTHREADTYPE_IO, 2668 2666 RTTHREADFLAGS_WAITABLE, "CaAud-%u", pDrvIns->iInstance); 2669 2667 AssertLogRelMsgReturn(RT_SUCCESS(rc), ("RTThreadCreateF failed: %Rrc\n", rc), rc); … … 2677 2675 * Create a IPRT timer. The TM timers won't necessarily work as EMT is probably busy. 2678 2676 */ 2679 rc = RTTimerLRCreateEx(&pThis->hBreakpointTimer, 0 /*no interval*/, 0, drvH ostAudioCaBreakpointTimer, pThis);2677 rc = RTTimerLRCreateEx(&pThis->hBreakpointTimer, 0 /*no interval*/, 0, drvHstAudCaBreakpointTimer, pThis); 2680 2678 AssertRCReturn(rc, rc); 2681 2679 #endif … … 2684 2682 * Enumerate audio devices. 2685 2683 */ 2686 rc = drvH ostAudioCaEnumerateDevices(pThis);2684 rc = drvHstAudCaEnumerateDevices(pThis); 2687 2685 AssertRCReturn(rc, rc); 2688 2686 … … 2698 2696 }; 2699 2697 2700 OSStatus orc = AudioObjectAddPropertyListener(kAudioObjectSystemObject, &PropAddr, drvHostAudioCaDefaultDeviceChangedCallback, pThis); 2698 OSStatus orc = AudioObjectAddPropertyListener(kAudioObjectSystemObject, &PropAddr, 2699 drvHstAudCaDefaultDeviceChangedCallback, pThis); 2701 2700 pThis->fRegisteredDefaultInputListener = orc == noErr; 2702 2701 if ( orc != noErr … … 2705 2704 2706 2705 PropAddr.mSelector = kAudioHardwarePropertyDefaultOutputDevice; 2707 orc = AudioObjectAddPropertyListener(kAudioObjectSystemObject, &PropAddr, drvH ostAudioCaDefaultDeviceChangedCallback, pThis);2706 orc = AudioObjectAddPropertyListener(kAudioObjectSystemObject, &PropAddr, drvHstAudCaDefaultDeviceChangedCallback, pThis); 2708 2707 pThis->fRegisteredDefaultOutputListener = orc == noErr; 2709 2708 if ( orc != noErr … … 2751 2750 sizeof(DRVHOSTCOREAUDIO), 2752 2751 /* pfnConstruct */ 2753 drvH ostAudioCaConstruct,2752 drvHstAudCaConstruct, 2754 2753 /* pfnDestruct */ 2755 drvH ostAudioCaDestruct,2754 drvHstAudCaDestruct, 2756 2755 /* pfnRelocate */ 2757 2756 NULL, … … 2771 2770 NULL, 2772 2771 /* pfnPowerOff */ 2773 drvH ostAudioCaPowerOff,2772 drvHstAudCaPowerOff, 2774 2773 /* pfnSoftReset */ 2775 2774 NULL,
Note:
See TracChangeset
for help on using the changeset viewer.