Changeset 70928 in vbox for trunk/src/VBox/Devices/Audio
- Timestamp:
- Feb 9, 2018 10:44:14 AM (7 years ago)
- svn:sync-xref-src-repo-rev:
- 120756
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Audio/DrvHostDSound.cpp
r70927 r70928 258 258 } 259 259 260 261 260 static int dsoundWaveFmtFromCfg(PPDMAUDIOSTREAMCFG pCfg, PWAVEFORMATEX pFmt) 262 261 { … … 277 276 } 278 277 279 280 278 /** 281 279 * Retrieves the number of free bytes available for writing to a DirectSound output stream. … … 356 354 } 357 355 358 359 356 static char *dsoundGUIDToUtf8StrA(LPCGUID pGUID) 360 357 { … … 375 372 return RTStrDup("{Default device}"); 376 373 } 377 378 374 379 375 /** … … 397 393 Assert(RTListIsEmpty(&pThis->lstDevOutput)); 398 394 } 399 400 395 401 396 static HRESULT directSoundPlayRestore(PDRVHOSTDSOUND pThis, LPDIRECTSOUNDBUFFER8 pDSB) … … 411 406 } 412 407 413 414 408 static HRESULT directSoundPlayUnlock(PDRVHOSTDSOUND pThis, LPDIRECTSOUNDBUFFER8 pDSB, 415 409 PVOID pv1, PVOID pv2, … … 423 417 } 424 418 425 426 419 static HRESULT directSoundCaptureUnlock(LPDIRECTSOUNDCAPTUREBUFFER8 pDSCB, 427 420 PVOID pv1, PVOID pv2, … … 433 426 return hr; 434 427 } 435 436 428 437 429 static HRESULT directSoundPlayLock(PDRVHOSTDSOUND pThis, PDSOUNDSTREAM pStreamDS, … … 482 474 } 483 475 484 485 476 static HRESULT directSoundCaptureLock(PDSOUNDSTREAM pStreamDS, 486 477 DWORD dwOffset, DWORD dwBytes, … … 519 510 } 520 511 521 522 512 /* 523 513 * DirectSound playback … … 534 524 } 535 525 } 536 537 526 538 527 static HRESULT directSoundPlayInterfaceCreate(PDRVHOSTDSOUND pThis) … … 575 564 } 576 565 577 578 566 static HRESULT directSoundPlayClose(PDRVHOSTDSOUND pThis, PDSOUNDSTREAM pStreamDS) 579 567 { … … 621 609 return hr; 622 610 } 623 624 611 625 612 static HRESULT directSoundPlayOpen(PDRVHOSTDSOUND pThis, PDSOUNDSTREAM pStreamDS, … … 814 801 } 815 802 816 817 803 static void dsoundPlayClearBuffer(PDRVHOSTDSOUND pThis, PDSOUNDSTREAM pStreamDS) 818 804 { … … 845 831 } 846 832 847 848 833 static HRESULT directSoundPlayGetStatus(PDRVHOSTDSOUND pThis, LPDIRECTSOUNDBUFFER8 pDSB, DWORD *pdwStatus) 849 834 { … … 879 864 return hr; 880 865 } 881 882 866 883 867 static HRESULT directSoundPlayStop(PDRVHOSTDSOUND pThis, PDSOUNDSTREAM pStreamDS, bool fFlush) … … 927 911 928 912 pStreamDS->fEnabled = true; 913 /* Note: Playing back via DirectSound starts in the notification thread 914 * once enough audio output data is available. */ 929 915 930 916 pStreamDS->Out.fFirstPlayback = true; … … 1073 1059 } 1074 1060 1075 1076 1061 static HRESULT directSoundCaptureClose(PDRVHOSTDSOUND pThis, PDSOUNDSTREAM pStreamDS) 1077 1062 { … … 1097 1082 return hr; 1098 1083 } 1099 1100 1084 1101 1085 static HRESULT directSoundCaptureOpen(PDRVHOSTDSOUND pThis, PDSOUNDSTREAM pStreamDS, … … 1259 1243 } 1260 1244 1261 1262 1245 static HRESULT directSoundCaptureStop(PDRVHOSTDSOUND pThis, PDSOUNDSTREAM pStreamDS, bool fFlush) 1263 1246 { … … 1293 1276 } 1294 1277 1295 1296 1278 static HRESULT directSoundCaptureStart(PDRVHOSTDSOUND pThis, PDSOUNDSTREAM pStreamDS) 1297 1279 { 1298 AssertPtrReturn(pThis, VERR_INVALID_POINTER); 1299 AssertPtrReturn(pStreamDS, VERR_INVALID_POINTER); 1280 AssertPtrReturn(pThis, E_POINTER); 1281 AssertPtrReturn(pStreamDS, E_POINTER); 1282 1283 Assert(pStreamDS->fEnabled == false); 1300 1284 1301 1285 HRESULT hr; … … 1324 1308 pStreamDS->fEnabled = true; 1325 1309 1326 pStreamDS->In.cOverruns = 0; 1310 pStreamDS->In.offReadPos = 0; 1311 pStreamDS->In.cOverruns = 0; 1327 1312 } 1328 1313 else … … 1334 1319 hr = E_UNEXPECTED; 1335 1320 1336 if (SUCCEEDED(hr))1337 1338 1339 1321 LogFlowFunc(("Returning %Rhrc\n", hr)); 1340 1322 return hr; 1341 1323 } 1342 1343 1324 1344 1325 static int dsoundDevAdd(PRTLISTANCHOR pList, LPGUID pGUID, LPCWSTR pwszDescription, PDSOUNDDEV *ppDev) … … 1368 1349 } 1369 1350 1370 1371 1351 static void dsoundDeviceRemove(PDSOUNDDEV pDev) 1372 1352 { … … 1385 1365 } 1386 1366 } 1387 1388 1367 1389 1368 static void dsoundLogDevice(const char *pszType, LPGUID pGUID, LPCWSTR pwszDescription, LPCWSTR pwszModule) … … 1396 1375 } 1397 1376 1398 1399 1377 static BOOL CALLBACK dsoundDevicesEnumCbPlayback(LPGUID pGUID, LPCWSTR pwszDescription, LPCWSTR pwszModule, PVOID lpContext) 1400 1378 { … … 1422 1400 } 1423 1401 1424 1425 1402 static BOOL CALLBACK dsoundDevicesEnumCbCapture(LPGUID pGUID, LPCWSTR pwszDescription, LPCWSTR pwszModule, PVOID lpContext) 1426 1403 { … … 1444 1421 return TRUE; 1445 1422 } 1446 1447 1423 1448 1424 /** … … 1500 1476 } 1501 1477 1502 1503 1478 /** 1504 1479 * Updates this host driver's internal status, according to the global, overall input/output … … 1546 1521 } 1547 1522 1548 1549 1523 static void dsoundUpdateStatusInternal(PDRVHOSTDSOUND pThis) 1550 1524 { 1551 1525 dsoundUpdateStatusInternalEx(pThis, NULL /* pCfg */, 0 /* fEnum */); 1552 1526 } 1553 1554 1527 1555 1528 static int dsoundCreateStreamOut(PDRVHOSTDSOUND pThis, PDSOUNDSTREAM pStreamDS, … … 1557 1530 { 1558 1531 LogFlowFunc(("pStreamDS=%p, pCfgReq=%p\n", pStreamDS, pCfgReq)); 1532 1533 pStreamDS->cbBufSize = 0; 1559 1534 1560 1535 pStreamDS->Out.pDSB = NULL; … … 1565 1540 pStreamDS->Out.fFirstPlayback = true; 1566 1541 pStreamDS->Out.tsLastPlayMs = 0; 1567 pStreamDS->cbBufSize = 0;1568 1542 1569 1543 int rc = VINF_SUCCESS; … … 1697 1671 } 1698 1672 1699 1700 1673 static int dsoundDestroyStreamOut(PDRVHOSTDSOUND pThis, PPDMAUDIOBACKENDSTREAM pStream) 1701 1674 { … … 1722 1695 1723 1696 /* Init the stream structure and save relevant information to it. */ 1697 pStreamDS->cbBufSize = 0; 1698 1699 pStreamDS->In.pDSCB = NULL; 1724 1700 pStreamDS->In.offReadPos = 0; 1725 pStreamDS->cbBufSize = 0; 1726 pStreamDS->In.pDSCB = NULL; 1701 pStreamDS->In.cOverruns = 0; 1727 1702 1728 1703 int rc = VINF_SUCCESS; … … 1859 1834 return VINF_SUCCESS; 1860 1835 } 1861 1862 1836 1863 1837 /** … … 2206 2180 } 2207 2181 2208 2209 2182 /** 2210 2183 * @interface_method_impl{PDMIHOSTAUDIO,pfnInit} … … 2259 2232 } 2260 2233 2261 2262 2234 static LPCGUID dsoundConfigQueryGUID(PCFGMNODE pCfg, const char *pszName, RTUUID *pUuid) 2263 2235 { … … 2280 2252 } 2281 2253 2282 2283 2254 static int dsoundConfigInit(PDRVHOSTDSOUND pThis, PCFGMNODE pCfg) 2284 2255 { … … 2298 2269 } 2299 2270 2300 2301 2271 /** 2302 2272 * @interface_method_impl{PDMIHOSTAUDIO,pfnGetStatus} … … 2309 2279 return PDMAUDIOBACKENDSTS_RUNNING; 2310 2280 } 2311 2312 2281 2313 2282 /** … … 2341 2310 } 2342 2311 2343 2344 2312 /** 2345 2313 * @interface_method_impl{PDMIHOSTAUDIO,pfnStreamDestroy} … … 2371 2339 } 2372 2340 2373 2374 2341 /** 2375 2342 * @interface_method_impl{PDMIHOSTAUDIO,pfnStreamControl} … … 2396 2363 } 2397 2364 2398 2399 2365 /** 2400 2366 * @interface_method_impl{PDMIHOSTAUDIO,pfnStreamGetReadable} … … 2416 2382 } 2417 2383 2418 2419 2384 /** 2420 2385 * @interface_method_impl{PDMIHOSTAUDIO,pfnStreamGetWritable} … … 2432 2397 return 0; 2433 2398 } 2434 2435 2399 2436 2400 /** … … 2478 2442 } 2479 2443 2480 2481 2444 /** 2482 2445 * @interface_method_impl{PDMIHOSTAUDIO,pfnStreamGetStatus} … … 2506 2469 return strmSts; 2507 2470 } 2508 2509 2471 2510 2472 /** … … 2565 2527 #endif 2566 2528 2567 2568 2529 /********************************************************************************************************************************* 2569 2530 * PDMDRVINS::IBase Interface * … … 2583 2544 } 2584 2545 2585 2586 2546 /********************************************************************************************************************************* 2587 2547 * PDMDRVREG Interface * … … 2616 2576 LogFlowFuncLeave(); 2617 2577 } 2618 2619 2578 2620 2579 /**
Note:
See TracChangeset
for help on using the changeset viewer.