Changeset 55065 in vbox
- Timestamp:
- Apr 1, 2015 9:29:05 AM (10 years ago)
- svn:sync-xref-src-repo-rev:
- 99354
- Location:
- trunk/src/VBox/Devices/Audio
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Audio/AudioMixBuffer.cpp
r55005 r55065 48 48 #include "AudioMixBuffer.h" 49 49 50 #if 150 #if 0 51 51 # define AUDMIXBUF_LOG(x) LogFlowFunc(x) 52 52 #else … … 301 301 _aType *pSrc = (_aType *)pvSrc; \ 302 302 uint32_t cSamples = (uint32_t)RT_MIN(pOpts->cSamples, cbSrc / sizeof(_aType)); \ 303 AUDMIXBUF_MACRO_LOG(("cSamples=%RU32, sizeof(%zu)\n", pOpts->cSamples, sizeof(_aType))); \ 303 AUDMIXBUF_MACRO_LOG(("cSamples=%RU32, sizeof(%zu), lVol=%RU32, rVol=%RU32\n", \ 304 pOpts->cSamples, sizeof(_aType), pOpts->Volume.uLeft, pOpts->Volume.uRight)); \ 304 305 for (uint32_t i = 0; i < cSamples; i++) \ 305 306 { \ … … 363 364 } 364 365 365 /* audioMixBufConv ToS8: 8 bit, signed. */366 /* audioMixBufConvXXXS8: 8 bit, signed. */ 366 367 AUDMIXBUF_CONVERT(S8 /* Name */, int8_t, INT8_MIN /* Min */, INT8_MAX /* Max */, true /* fSigned */, 8 /* cShift */) 367 /* audioMixBufConv ToU8: 8 bit, unsigned. */368 /* audioMixBufConvXXXU8: 8 bit, unsigned. */ 368 369 AUDMIXBUF_CONVERT(U8 /* Name */, uint8_t, 0 /* Min */, UINT8_MAX /* Max */, false /* fSigned */, 8 /* cShift */) 369 /* audioMixBufConv ToS16: 16 bit, signed. */370 /* audioMixBufConvXXXS16: 16 bit, signed. */ 370 371 AUDMIXBUF_CONVERT(S16 /* Name */, int16_t, INT16_MIN /* Min */, INT16_MAX /* Max */, true /* fSigned */, 16 /* cShift */) 371 /* audioMixBufConv ToU16: 16 bit, unsigned. */372 /* audioMixBufConvXXXU16: 16 bit, unsigned. */ 372 373 AUDMIXBUF_CONVERT(U16 /* Name */, uint16_t, 0 /* Min */, UINT16_MAX /* Max */, false /* fSigned */, 16 /* cShift */) 373 /* audioMixBufConv ToS32: 32 bit, signed. */374 /* audioMixBufConvXXXS32: 32 bit, signed. */ 374 375 AUDMIXBUF_CONVERT(S32 /* Name */, int32_t, INT32_MIN /* Min */, INT32_MAX /* Max */, true /* fSigned */, 32 /* cShift */) 375 /* audioMixBufConv ToU32: 32 bit, unsigned. */376 /* audioMixBufConvXXXU32: 32 bit, unsigned. */ 376 377 AUDMIXBUF_CONVERT(U32 /* Name */, uint32_t, 0 /* Min */, UINT32_MAX /* Max */, false /* fSigned */, 32 /* cShift */) 377 378 … … 636 637 /* Set initial volume to max. */ 637 638 pMixBuf->Volume.fMuted = false; 638 pMixBuf->Volume.uLeft = UINT32_MAX;639 pMixBuf->Volume.uRight = UINT32_MAX;639 pMixBuf->Volume.uLeft = 0x7F; 640 pMixBuf->Volume.uRight = 0x7F; 640 641 641 642 /* Prevent division by zero. … … 1120 1121 AssertPtrReturnVoid(pVol); 1121 1122 1122 AUDMIXBUF_LOG(("%s: lVol=%RU32, rVol=%RU32\n", pMixBuf->pszName, pVol->uLeft, pVol->uRight)); 1123 1124 pMixBuf->Volume = *pVol; 1123 LogFlowFunc(("%s: lVol=%RU32, rVol=%RU32\n", pMixBuf->pszName, pVol->uLeft, pVol->uRight)); 1124 1125 pMixBuf->Volume.fMuted = pVol->fMuted; 1126 pMixBuf->Volume.uLeft = uint64_t(0x100000000 * pVol->uLeft ) / 255; 1127 pMixBuf->Volume.uRight = uint64_t(0x100000000 * pVol->uRight) / 255; 1128 1129 LogFlowFunc(("\t-> lVol=%RU32, rVol=%RU32\n", pMixBuf->Volume.uLeft, pMixBuf->Volume.uRight)); 1125 1130 } 1126 1131 … … 1346 1351 uint32_t cWrittenTotal = 0; 1347 1352 1353 AUDMIXBUF_CONVOPTS convOpts; 1354 convOpts.Volume = pMixBuf->Volume; 1355 1348 1356 /* Anything to do at all? */ 1349 1357 if (cLenDst1) 1350 1358 { 1351 AUDMIXBUF_CONVOPTS convOpts = { cLenDst1, pMixBuf->Volume };1359 convOpts.cSamples = cLenDst1; 1352 1360 cWrittenTotal = pConv(pSamplesDst1, pvBuf, cbBuf, &convOpts); 1353 1361 } … … 1359 1367 AssertPtr(pSamplesDst2); 1360 1368 1361 AUDMIXBUF_CONVOPTS convOpts = { cLenDst2, pMixBuf->Volume };1369 convOpts.cSamples = cLenDst2; 1362 1370 cWrittenTotal += pConv(pSamplesDst2, (uint8_t *)pvBuf + AUDIOMIXBUF_S2B(pMixBuf, cLenDst1), cbBuf, &convOpts); 1363 1371 } -
trunk/src/VBox/Devices/Audio/AudioMixer.cpp
r55005 r55065 37 37 #include <VBox/log.h> 38 38 39 40 int audioMixerUpdateSinkVolume(PAUDMIXSINK pSink, const PPDMAUDIOVOLUME pVolMaster, const PPDMAUDIOVOLUME pVolSink); 41 42 39 43 int audioMixerAddSink(PAUDIOMIXER pMixer, const char *pszName, AUDMIXSINKDIR enmDir, PAUDMIXSINK *ppSink) 40 44 { … … 61 65 /* Set initial volume to max. */ 62 66 pSink->Volume.fMuted = false; 63 pSink->Volume.uLeft = UINT32_MAX;64 pSink->Volume.uRight = UINT32_MAX;67 pSink->Volume.uLeft = 0x7F; 68 pSink->Volume.uRight = 0x7F; 65 69 66 70 RTListAppend(&pMixer->lstSinks, &pSink->Node); … … 106 110 pSink->cStreams++; 107 111 108 LogFlowFunc((" pSink=%p,pStream=%p, cStreams=%RU8\n",109 pSink , pMixStream, pSink->cStreams));112 LogFlowFunc(("%s: pStream=%p, cStreams=%RU8\n", 113 pSink->pszName, pMixStream, pSink->cStreams)); 110 114 111 115 if (ppStream) … … 144 148 pSink->cStreams++; 145 149 146 LogFlowFunc((" pSink=%p,pStream=%p, cStreams=%RU8\n",147 pSink , pMixStream, pSink->cStreams));150 LogFlowFunc(("%s: pStream=%p, cStreams=%RU8\n", 151 pSink->pszName, pMixStream, pSink->cStreams)); 148 152 149 153 if (ppStream) … … 205 209 if (pMixer) 206 210 { 207 LogFlowFunc(("Destroying % p ...\n", pMixer));211 LogFlowFunc(("Destroying %s ...\n", pMixer->pszName)); 208 212 209 213 PAUDMIXSINK pSink = RTListGetFirst(&pMixer->lstSinks, AUDMIXSINK, Node); … … 260 264 261 265 return cStreams; 266 } 267 268 void audioMixerInvalidate(PAUDIOMIXER pMixer) 269 { 270 AssertPtrReturnVoid(pMixer); 271 272 LogFlowFunc(("%s: Invalidating ...\n", pMixer->pszName)); 273 274 /* Propagate new master volume to all connected sinks. */ 275 PAUDMIXSINK pSink; 276 RTListForEach(&pMixer->lstSinks, pSink, AUDMIXSINK, Node) 277 { 278 int rc2 = audioMixerUpdateSinkVolume(pSink, &pMixer->VolMaster, &pSink->Volume); 279 AssertRC(rc2); 280 } 262 281 } 263 282 … … 356 375 pMixer->cSinks--; 357 376 358 LogFlowFunc((" pMixer=%p, pSink=%p, cSinks=%RU8\n",359 pMixer , pSink, pMixer->cSinks));377 LogFlowFunc(("%s: pSink=%s, cSinks=%RU8\n", 378 pMixer->pszName, pSink->pszName, pMixer->cSinks)); 360 379 361 380 audioMixerDestroySink(pSink); … … 372 391 pSink->cStreams--; 373 392 374 LogFlowFunc(("pSink=%p, pStream=%p, cStreams=%RU8\n", 375 pSink, pStream, pSink->cStreams)); 393 const char *pszStream = pSink->enmDir == AUDMIXSINKDIR_INPUT 394 ? pStream->pIn->MixBuf.pszName : pStream->pOut->MixBuf.pszName; 395 396 LogFlowFunc(("%s: pStream=%s, cStreams=%RU8\n", 397 pSink->pszName, pszStream, pSink->cStreams)); 376 398 377 399 audioMixerDestroyStream(pStream); … … 389 411 } 390 412 391 static PDMAUDIOVOLUME audioMixerTranslateVolume(const PPDMAUDIOVOLUME pVolMaster, PPDMAUDIOVOLUME pVol) 392 { 393 PDMAUDIOVOLUME volMaster = *pVolMaster; 394 395 uint32_t u32VolumeLeft = (uint32_t)pVol->uLeft; 396 uint32_t u32VolumeRight = (uint32_t)pVol->uRight; 413 static inline PDMAUDIOVOLUME audioMixerVolCalc(PPDMAUDIOVOLUME pVol) 414 { 415 uint32_t u32VolumeLeft = pVol->uLeft; 416 uint32_t u32VolumeRight = pVol->uRight; 397 417 /* 0x00..0xff => 0x01..0x100 */ 398 418 if (u32VolumeLeft) … … 401 421 u32VolumeRight++; 402 422 403 volMaster.uLeft = u32VolumeLeft * 0x800000; /* Maximum is 0x80000000 */404 volMaster.uRight = u32VolumeRight * 0x800000; /* Maximum is 0x80000000 */405 406 423 PDMAUDIOVOLUME volOut; 407 volOut.fMuted = volMaster.fMuted || pVol->fMuted; 408 volOut.uLeft = ASMMultU64ByU32DivByU32(volMaster.uLeft, pVol->uLeft, 0x80000000U); /* Maximum is 0x80000000U */ 409 volOut.uRight = ASMMultU64ByU32DivByU32(volMaster.uRight, pVol->uRight, 0x80000000U); /* Maximum is 0x80000000U */ 410 411 LogFlowFunc(("pMaster=%p, lVol=%RU32, rVol=%RU32\n", 412 pVolMaster, pVolMaster->uLeft, pVolMaster->uRight)); 413 LogFlowFunc(("pVol=%p, lVol=%RU32, rVol=%RU32 => lVol=%RU32, rVol=%RU32\n", 414 pVol, pVol->uLeft, pVol->uRight, volOut.uLeft, volOut.uRight)); 424 volOut.fMuted = pVol->fMuted; 425 volOut.uLeft = u32VolumeLeft * 0x80000000; /* Maximum is 0x80000000 */ 426 volOut.uRight = u32VolumeRight * 0x80000000; /* Maximum is 0x80000000 */ 415 427 416 428 return volOut; 417 429 } 418 430 419 int audioMixerSetMasterVolume(PAUDIOMIXER pMixer, PPDMAUDIOVOLUME pVol) 420 { 421 AssertPtrReturn(pMixer, VERR_INVALID_POINTER); 422 AssertPtrReturn(pVol, VERR_INVALID_POINTER); 423 424 pMixer->VolMaster = audioMixerTranslateVolume(&pMixer->VolMaster, pVol); 425 #if 0 426 .uLeft = pVol->uLeft * 0x800000; /* maximum is 0x80000000 */ 427 pMixer->VolMaster.uRight = pVol->uRight * 0x800000; /* maximum is 0x80000000 */ 428 #endif 429 LogFlowFunc(("%s: lVol=%RU32, rVol=%RU32 => lVol=%RU32, rVol=%RU32\n", 430 pVol->uLeft, pVol->uRight, pMixer->VolMaster.uLeft, pMixer->VolMaster.uRight)); 431 432 return VINF_SUCCESS; 433 } 434 435 int audioMixerSetSinkVolume(PAUDMIXSINK pSink, PPDMAUDIOVOLUME pVol) 436 { 437 AssertPtrReturn(pSink, VERR_INVALID_POINTER); 438 AssertPtrReturn(pVol, VERR_INVALID_POINTER); 439 440 LogFlowFunc(("%s: lVol=%RU32, rVol=%RU32\n", pSink->pszName, pVol->uLeft, pVol->uRight)); 441 442 pSink->Volume.uLeft = pVol->uLeft * 0x808080; /* Maximum is INT_MAX = 0x7fffffff */ 443 pSink->Volume.uRight = pVol->uRight * 0x808080; /* Maximum is INT_MAX = 0x7fffffff */ 444 445 /** @todo Apply the mixer's master volume to it. */ 431 static inline PDMAUDIOVOLUME audioMixerVolMix(const PPDMAUDIOVOLUME pVolMaster, PPDMAUDIOVOLUME pVol) 432 { 433 PDMAUDIOVOLUME volOut; 434 volOut.fMuted = pVolMaster->fMuted || pVol->fMuted; 435 volOut.uLeft = ASMMultU64ByU32DivByU32(pVolMaster->uLeft, pVol->uLeft, 0x80000000U); /* Maximum is 0x80000000U */ 436 volOut.uRight = ASMMultU64ByU32DivByU32(pVolMaster->uRight, pVol->uRight, 0x80000000U); /* Maximum is 0x80000000U */ 437 438 LogFlowFunc(("pMaster=%p, fMuted=%RTbool, lVol=%RU32, rVol=%RU32\n", 439 pVolMaster, pVolMaster->fMuted, pVolMaster->uLeft, pVolMaster->uRight)); 440 LogFlowFunc(("pVol=%p, fMuted=%RTbool, lVol=%RU32, rVol=%RU32 => fMuted=%RTbool, lVol=%RU32, rVol=%RU32\n", 441 pVol, pVol->fMuted, pVol->uLeft, pVol->uRight, volOut.fMuted, volOut.uLeft, volOut.uRight)); 442 443 return volOut; 444 } 445 446 int audioMixerUpdateSinkVolume(PAUDMIXSINK pSink, const PPDMAUDIOVOLUME pVolMaster, const PPDMAUDIOVOLUME pVolSink) 447 { 448 AssertPtrReturn(pSink, VERR_INVALID_POINTER); 449 AssertPtrReturn(pVolMaster, VERR_INVALID_POINTER); 450 AssertPtrReturn(pVolSink, VERR_INVALID_POINTER); 451 452 LogFlowFunc(("Master fMuted=%RTbool, lVol=%RU32, rVol=%RU32\n", 453 pVolMaster->fMuted, pVolMaster->uLeft, pVolMaster->uRight)); 454 LogFlowFunc(("%s: fMuted=%RTbool, lVol=%RU32, rVol=%RU32\n", 455 pSink->pszName, pSink->Volume.fMuted, pSink->Volume.uLeft, pSink->Volume.uRight)); 446 456 447 457 /** @todo Very crude implementation for now -- needs more work! */ 458 459 PDMAUDIOVOLUME volSink; 460 volSink.fMuted = pVolMaster->fMuted || pVolSink->fMuted; 461 volSink.uLeft = (pVolSink->uLeft * pVolMaster->uLeft) / UINT8_MAX; 462 volSink.uRight = (pVolSink->uRight * pVolMaster->uRight) / UINT8_MAX; 463 464 LogFlowFunc(("\t-> fMuted=%RTbool, lVol=%RU32, rVol=%RU32\n", 465 volSink.fMuted, volSink.uLeft, volSink.uRight)); 448 466 449 467 bool fOut = pSink->enmDir == AUDMIXSINKDIR_OUTPUT; … … 454 472 { 455 473 if (fOut) 456 audioMixBufSetVolume(&pStream->pOut->MixBuf, & pSink->Volume);474 audioMixBufSetVolume(&pStream->pOut->MixBuf, &volSink); 457 475 else 458 audioMixBufSetVolume(&pStream->pIn->MixBuf, & pSink->Volume);476 audioMixBufSetVolume(&pStream->pIn->MixBuf, &volSink); 459 477 } 460 478 … … 462 480 } 463 481 482 int audioMixerSetMasterVolume(PAUDIOMIXER pMixer, PPDMAUDIOVOLUME pVol) 483 { 484 AssertPtrReturn(pMixer, VERR_INVALID_POINTER); 485 AssertPtrReturn(pVol, VERR_INVALID_POINTER); 486 487 pMixer->VolMaster = *pVol; //= audioMixerVolCalc(pVol); 488 489 LogFlowFunc(("%s: lVol=%RU32, rVol=%RU32 => fMuted=%RTbool, lVol=%RU32, rVol=%RU32\n", 490 pMixer->pszName, pVol->uLeft, pVol->uRight, 491 pMixer->VolMaster.fMuted, pMixer->VolMaster.uLeft, pMixer->VolMaster.uRight)); 492 493 audioMixerInvalidate(pMixer); 494 return VINF_SUCCESS; 495 } 496 497 int audioMixerSetSinkVolume(PAUDMIXSINK pSink, PPDMAUDIOVOLUME pVol) 498 { 499 AssertPtrReturn(pSink, VERR_INVALID_POINTER); 500 AssertPtrReturn(pVol, VERR_INVALID_POINTER); 501 502 LogFlowFunc(("%s: fMuted=%RTbool, lVol=%RU32, rVol=%RU32\n", pSink->pszName, pVol->fMuted, pVol->uLeft, pVol->uRight)); 503 504 AssertPtr(pSink->pParent); 505 return audioMixerUpdateSinkVolume(pSink, &pSink->pParent->VolMaster, pVol); 506 } 507 -
trunk/src/VBox/Devices/Audio/AudioMixer.h
r55005 r55065 99 99 void audioMixerDestroy(PAUDIOMIXER pMixer); 100 100 uint32_t audioMixerGetStreamCount(PAUDIOMIXER pMixer); 101 void audioMixerInvalidate(PAUDIOMIXER pMixer); 101 102 int audioMixerProcessSinkIn(PAUDMIXSINK pSink, AUDMIXOP enmOp, void *pvBuf, size_t cbBuf, uint32_t *pcbProcessed); 102 103 int audioMixerProcessSinkOut(PAUDMIXSINK pSink, AUDMIXOP enmOp, const void *pvBuf, size_t cbBuf, uint32_t *pcbProcessed); -
trunk/src/VBox/Devices/Audio/DevIchAc97.cpp
r55005 r55065 717 717 rc = VINF_SUCCESS; 718 718 } 719 720 audioMixerInvalidate(pThis->pMixer); 719 721 #else 720 722 if (freq) … … 847 849 lvol = 255 * lvol / VOL_MASK; 848 850 849 LogFunc(("mt=%ld, val=%RU32 \n", mt, val));851 LogFunc(("mt=%ld, val=%RU32, mute=%RTbool\n", mt, val, RT_BOOL(mute))); 850 852 851 853 #ifdef SOFT_VOLUME … … 981 983 audioMixerDestroy(pThis->pMixer); 982 984 pThis->pMixer = NULL; 985 } 986 987 int rc2 = audioMixerCreate("AC'97 Mixer", 0 /* uFlags */, &pThis->pMixer); 988 if (RT_SUCCESS(rc2)) 989 { 990 /* Set a default audio format for our mixer. */ 991 PDMAUDIOSTREAMCFG streamCfg; 992 streamCfg.uHz = 41000; 993 streamCfg.cChannels = 2; 994 streamCfg.enmFormat = AUD_FMT_S16; 995 streamCfg.enmEndianness = PDMAUDIOHOSTENDIANESS; 996 997 rc2 = audioMixerSetDeviceFormat(pThis->pMixer, &streamCfg); 998 AssertRC(rc2); 999 1000 /* Add all required audio sinks. */ 1001 rc2 = audioMixerAddSink(pThis->pMixer, "[Playback] PCM Output", 1002 AUDMIXSINKDIR_OUTPUT, &pThis->pSinkOutput); 1003 AssertRC(rc2); 1004 1005 rc2 = audioMixerAddSink(pThis->pMixer, "[Recording] Line In", 1006 AUDMIXSINKDIR_INPUT, &pThis->pSinkLineIn); 1007 AssertRC(rc2); 1008 1009 rc2 = audioMixerAddSink(pThis->pMixer, "[Recording] Microphone In", 1010 AUDMIXSINKDIR_INPUT, &pThis->pSinkMicIn); 1011 AssertRC(rc2); 983 1012 } 984 1013 #endif /* VBOX_WITH_PDM_AUDIO_DRIVER */ … … 1029 1058 #endif 1030 1059 1031 #ifdef VBOX_WITH_PDM_AUDIO_DRIVER1032 int rc2 = audioMixerCreate("AC'97 Mixer", 0 /* uFlags */, &pThis->pMixer);1033 if (RT_SUCCESS(rc2))1034 {1035 /* Set a default audio format for our mixer. */1036 PDMAUDIOSTREAMCFG streamCfg;1037 streamCfg.uHz = 41000;1038 streamCfg.cChannels = 2;1039 streamCfg.enmFormat = AUD_FMT_S16;1040 streamCfg.enmEndianness = PDMAUDIOHOSTENDIANESS;1041 1042 rc2 = audioMixerSetDeviceFormat(pThis->pMixer, &streamCfg);1043 AssertRC(rc2);1044 1045 /* Add all required audio sinks. */1046 rc2 = audioMixerAddSink(pThis->pMixer, "[Playback] PCM Output",1047 AUDMIXSINKDIR_OUTPUT, &pThis->pSinkOutput);1048 AssertRC(rc2);1049 1050 rc2 = audioMixerAddSink(pThis->pMixer, "[Recording] Line In",1051 AUDMIXSINKDIR_INPUT, &pThis->pSinkLineIn);1052 AssertRC(rc2);1053 1054 rc2 = audioMixerAddSink(pThis->pMixer, "[Recording] Microphone In",1055 AUDMIXSINKDIR_INPUT, &pThis->pSinkMicIn);1056 AssertRC(rc2);1057 }1058 #endif1059 1060 1060 /* Reset all streams. */ 1061 1061 uint8_t active[LAST_INDEX] = { 0 }; … … 1328 1328 if (RT_SUCCESS(rc)) 1329 1329 { 1330 #ifdef DEBUG_TIMER 1330 1331 LogFlowFunc(("\tLUN#%RU8: [1] cbIn=%RU32, cbOut=%RU32\n", pDrv->uLUN, cbIn, cbOut)); 1331 1332 #endif 1332 1333 if (cSamplesLive) 1333 1334 { 1334 1335 uint32_t cSamplesPlayed; 1335 1336 int rc2 = pDrv->pConnector->pfnPlayOut(pDrv->pConnector, &cSamplesPlayed); 1337 #ifdef DEBUG_TIMER 1336 1338 if (RT_SUCCESS(rc2)) 1337 1339 LogFlowFunc(("LUN#%RU8: cSamplesLive=%RU32, cSamplesPlayed=%RU32\n", 1338 1340 pDrv->uLUN, cSamplesLive, cSamplesPlayed)); 1339 1341 #endif 1340 1342 if (cSamplesPlayed) 1341 1343 { 1342 1344 rc = pDrv->pConnector->pfnQueryStatus(pDrv->pConnector, 1343 1345 &cbIn, &cbOut, &cSamplesLive); 1346 #ifdef DEBUG_TIMER 1344 1347 if (RT_SUCCESS(rc)) 1345 1348 LogFlowFunc(("\tLUN#%RU8: [2] cbIn=%RU32, cbOut=%RU32\n", pDrv->uLUN, cbIn, cbOut)); 1349 #endif 1346 1350 } 1347 1351 } … … 1352 1356 } 1353 1357 1358 #ifdef DEBUG_TIMER 1354 1359 LogFlowFunc(("cbInMax=%RU32, cbOutMin=%RU32\n", cbInMax, cbOutMin)); 1360 #endif 1355 1361 1356 1362 if (cbOutMin == UINT32_MAX) -
trunk/src/VBox/Devices/Audio/DevIchHda.cpp
r55005 r55065 564 564 /** PCM output stream. */ 565 565 R3PTRTYPE(PPDMAUDIOGSTSTRMOUT) pStrmOut; 566 /** Mixer handle for line output stream. */ 567 R3PTRTYPE(PAUDMIXSTREAM) phStrmOut; 566 568 } HDAOUTPUTSTREAM, *PHDAOUTPUTSTREAM; 567 569 … … 2457 2459 } 2458 2460 2459 int rc ;2461 int rc = VINF_SUCCESS; 2460 2462 char *pszDesc; 2461 2463 … … 2490 2492 { 2491 2493 int rc = VINF_SUCCESS; 2494 char *pszDesc; 2492 2495 2493 2496 PHDADRIVER pDrv; 2494 2497 RTListForEach(&pThis->lstDrv, pDrv, HDADRIVER, Node) 2495 2498 { 2496 int rc2 = pDrv->pConnector->pfnOpenOut(pDrv->pConnector, pszName, pCfg, &pDrv->Out.pStrmOut); 2497 if (RT_FAILURE(rc2)) 2498 { 2499 LogFunc(("LUN#%RU8: Opening stream \"%s\" failed, rc=%Rrc\n", pDrv->uLUN, pszName, rc2)); 2500 if (RT_SUCCESS(rc)) 2501 rc = rc2; 2502 /* Keep going. */ 2499 if (RTStrAPrintf(&pszDesc, "[LUN#%RU8] %s", pDrv->uLUN, pszName) <= 0) 2500 { 2501 rc = VERR_NO_MEMORY; 2502 break; 2503 2503 } 2504 2505 rc = pDrv->pConnector->pfnOpenOut(pDrv->pConnector, pszDesc, pCfg, &pDrv->Out.pStrmOut); 2506 LogFlowFunc(("LUN#%RU8: Opened output \"%s\", with rc=%Rrc\n", pDrv->uLUN, pszDesc, rc)); 2507 if (rc == VINF_SUCCESS) /* Note: Could return VWRN_ALREADY_EXISTS. */ 2508 { 2509 audioMixerRemoveStream(pThis->pSinkOutput, pDrv->Out.phStrmOut); 2510 rc = audioMixerAddStreamOut(pThis->pSinkOutput, 2511 pDrv->pConnector, pDrv->Out.pStrmOut, 2512 0 /* uFlags */, &pDrv->Out.phStrmOut); 2513 } 2514 2515 RTStrFree(pszDesc); 2504 2516 } 2505 2517 … … 2535 2547 2536 2548 PHDADRIVER pDrv; 2537 2538 LogFlowFuncEnter();2539 2549 2540 2550 uint32_t cbIn, cbOut, cSamplesLive; … … 2545 2555 if (RT_SUCCESS(rc)) 2546 2556 { 2557 #ifdef DEBUG_TIMER 2547 2558 LogFlowFunc(("\tLUN#%RU8: [1] cbIn=%RU32, cbOut=%RU32\n", pDrv->uLUN, cbIn, cbOut)); 2548 2559 #endif 2549 2560 if (cSamplesLive) 2550 2561 { … … 2557 2568 rc = pDrv->pConnector->pfnQueryStatus(pDrv->pConnector, 2558 2569 &cbIn, &cbOut, &cSamplesLive); 2570 #ifdef DEBUG_TIMER 2559 2571 if (RT_SUCCESS(rc)) 2560 2572 LogFlowFunc(("\tLUN#%RU8: [2] cbIn=%RU32, cbOut=%RU32\n", pDrv->uLUN, cbIn, cbOut)); 2573 #endif 2561 2574 } 2562 2575 … … 2566 2579 } 2567 2580 2581 #ifdef DEBUG_TIMER 2568 2582 LogFlowFunc(("cbInMax=%RU32, cbOutMin=%RU32\n", cbInMax, cbOutMin)); 2583 #endif 2569 2584 2570 2585 if (cbOutMin == UINT32_MAX) … … 2587 2602 2588 2603 TMTimerSet(pThis->pTimer, TMTimerGet(pThis->pTimer) + pThis->uTicks); 2589 2590 LogFlowFuncLeave();2591 2604 2592 2605 STAM_PROFILE_STOP(&pThis->StatTimer, a); -
trunk/src/VBox/Devices/Audio/DevIchHdaCodec.cpp
r53567 r55065 1348 1348 if (fIsRight) 1349 1349 hdaCodecSetRegisterU8(&LIFIER_REGISTER(*pAmplifier, AMPLIFIER_IN, AMPLIFIER_RIGHT, u8Index), cmd, 0); 1350 1351 /** @todo Fix ID of u8AdcVolsLineIn! */ 1352 #ifdef VBOX_WITH_PDM_AUDIO_DRIVER 1353 hdaCodecToAudVolume(pThis, pAmplifier, PDMAUDIOMIXERCTL_LINE_IN); 1354 #else 1355 hdaCodecToAudVolume(pAmplifier, AUD_MIXER_LINE_IN); 1356 #endif 1350 1357 } 1351 1358 if (fIsOut) … … 1355 1362 if (fIsRight) 1356 1363 hdaCodecSetRegisterU8(&LIFIER_REGISTER(*pAmplifier, AMPLIFIER_OUT, AMPLIFIER_RIGHT, u8Index), cmd, 0); 1357 } 1358 if (CODEC_NID(cmd) == pThis->u8DacLineOut)1364 1365 /** @todo Fix ID of u8DacLineOut! */ 1359 1366 #ifdef VBOX_WITH_PDM_AUDIO_DRIVER 1360 1367 hdaCodecToAudVolume(pThis, pAmplifier, PDMAUDIOMIXERCTL_VOLUME); … … 1362 1369 hdaCodecToAudVolume(pAmplifier, AUD_MIXER_VOLUME); 1363 1370 #endif 1364 1365 if (CODEC_NID(cmd) == pThis->u8AdcVolsLineIn) /* Microphone */ 1366 #ifdef VBOX_WITH_PDM_AUDIO_DRIVER 1367 hdaCodecToAudVolume(pThis, pAmplifier, PDMAUDIOMIXERCTL_LINE_IN); 1368 #else 1369 hdaCodecToAudVolume(pAmplifier, AUD_MIXER_LINE_IN); 1370 #endif 1371 } 1371 1372 1372 1373 return VINF_SUCCESS;
Note:
See TracChangeset
for help on using the changeset viewer.