Changeset 88026 in vbox
- Timestamp:
- Mar 8, 2021 6:41:53 PM (4 years ago)
- Location:
- trunk
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/VBox/vmm/pdmaudioifs.h
r87990 r88026 299 299 PDMAUDIODIR_OUT, 300 300 /** Duplex handling. */ 301 PDMAUDIODIR_ ANY,301 PDMAUDIODIR_DUPLEX, 302 302 /** Hack to blow the type up to 32-bit. */ 303 303 PDMAUDIODIR_32BIT_HACK = 0x7fffffff … … 1437 1437 * @returns Status of the host audio backend. 1438 1438 * @param pInterface Pointer to the interface structure containing the called function pointer. 1439 * @param enmDir Audio direction to check host audio backend for. Specify PDMAUDIODIR_ ANYfor the overall1439 * @param enmDir Audio direction to check host audio backend for. Specify PDMAUDIODIR_DUPLEX for the overall 1440 1440 * backend status. 1441 1441 */ … … 1646 1646 * @returns PDMAUDIOBACKENDSTS enum. 1647 1647 * @param pInterface Pointer to the interface structure containing the called function pointer. 1648 * @param enmDir Audio direction to get status for. Pass PDMAUDIODIR_ ANYfor overall status.1648 * @param enmDir Audio direction to get status for. Pass PDMAUDIODIR_DUPLEX for overall status. 1649 1649 */ 1650 1650 DECLR3CALLBACKMEMBER(PDMAUDIOBACKENDSTS, pfnGetStatus, (PPDMIHOSTAUDIO pInterface, PDMAUDIODIR enmDir)); -
trunk/src/VBox/Devices/Audio/AudioMixer.cpp
r88025 r88026 580 580 /* ppStream is optional. */ 581 581 582 if (pConn->pfnGetStatus(pConn, PDMAUDIODIR_ ANY) == PDMAUDIOBACKENDSTS_NOT_ATTACHED)582 if (pConn->pfnGetStatus(pConn, PDMAUDIODIR_DUPLEX) == PDMAUDIOBACKENDSTS_NOT_ATTACHED) 583 583 return VERR_AUDIO_BACKEND_NOT_ATTACHED; 584 584 -
trunk/src/VBox/Devices/Audio/DrvAudio.cpp
r88025 r88026 469 469 470 470 LogRel2(("Audio: %s stream '%s' in backend (%s is %s)\n", PDMAudioStrmCmdGetName(enmStreamCmd), pStream->szName, 471 DrvAudioHlpAudDirToStr(pStream->enmDir),471 PDMAudioDirGetName(pStream->enmDir), 472 472 fEnabled ? "enabled" : "disabled")); 473 473 switch (enmStreamCmd) … … 938 938 AssertMsg(pStream->enmDir == PDMAUDIODIR_OUT, 939 939 ("Stream '%s' is not an output stream and therefore cannot be written to (direction is '%s')\n", 940 pStream->szName, DrvAudioHlpAudDirToStr(pStream->enmDir)));940 pStream->szName, PDMAudioDirGetName(pStream->enmDir))); 941 941 942 942 AssertMsg(PDMAudioPropsIsSizeAligned(&pStream->Guest.Cfg.Props, cbBuf), … … 2169 2169 2170 2170 LogRel(("Audio: Device '%s':\n", pDev->szName)); 2171 LogRel(("Audio: \tUsage = %s\n", DrvAudioHlpAudDirToStr(pDev->enmUsage)));2171 LogRel(("Audio: \tUsage = %s\n", PDMAudioDirGetName(pDev->enmUsage))); 2172 2172 LogRel(("Audio: \tFlags = %s\n", pszFlags ? pszFlags : "<NONE>")); 2173 2173 LogRel(("Audio: \tInput channels = %RU8\n", pDev->cMaxInputChannels)); -
trunk/src/VBox/Devices/Audio/DrvAudio.h
r88025 r88026 187 187 /** @name Audio format helper methods. 188 188 * @{ */ 189 const char * DrvAudioHlpAudDirToStr(PDMAUDIODIR enmDir);190 const char * DrvAudioHlpAudFmtToStr(PDMAUDIOFMT enmFmt);189 const char *PDMAudioDirGetName(PDMAUDIODIR enmDir); 190 const char *PDMAudioFormatGetName(PDMAUDIOFMT enmFmt); 191 191 bool PDMAudioFormatIsSigned(PDMAUDIOFMT enmFmt); 192 192 uint8_t PDMAudioFormatGetBits(PDMAUDIOFMT enmFmt); -
trunk/src/VBox/Devices/Audio/DrvAudioCommon.cpp
r88025 r88026 336 336 * @param pDstDevEnm Destination enumeration to store enumeration entries into. 337 337 * @param pSrcDevEnm Source enumeration to use. 338 * @param enmUsage Which entries to copy. Specify PDMAUDIODIR_ ANYto copy all entries.338 * @param enmUsage Which entries to copy. Specify PDMAUDIODIR_DUPLEX to copy all entries. 339 339 * @param fCopyUserData Whether to also copy the user data portion or not. 340 340 */ … … 350 350 RTListForEach(&pSrcDevEnm->lstDevices, pSrcDev, PDMAUDIODEVICE, Node) 351 351 { 352 if ( enmUsage != PDMAUDIODIR_ ANY352 if ( enmUsage != PDMAUDIODIR_DUPLEX 353 353 && enmUsage != pSrcDev->enmUsage) 354 354 { … … 383 383 int DrvAudioHlpDeviceEnumCopy(PPDMAUDIODEVICEENUM pDstDevEnm, const PPDMAUDIODEVICEENUM pSrcDevEnm) 384 384 { 385 return DrvAudioHlpDeviceEnumCopyEx(pDstDevEnm, pSrcDevEnm, PDMAUDIODIR_ ANY, false /* fCopyUserData */);385 return DrvAudioHlpDeviceEnumCopyEx(pDstDevEnm, pSrcDevEnm, PDMAUDIODIR_DUPLEX, false /* fCopyUserData */); 386 386 } 387 387 … … 401 401 RTListForEach(&pDevEnm->lstDevices, pDev, PDMAUDIODEVICE, Node) 402 402 { 403 if (enmUsage != PDMAUDIODIR_ ANY)403 if (enmUsage != PDMAUDIODIR_DUPLEX) 404 404 { 405 405 if (enmUsage != pDev->enmUsage) /* Wrong usage? Skip. */ … … 425 425 AssertPtrReturn(pDevEnm, 0); 426 426 427 if (enmUsage == PDMAUDIODIR_ ANY)427 if (enmUsage == PDMAUDIODIR_DUPLEX) 428 428 return pDevEnm->cDevices; 429 429 … … 459 459 460 460 LogFunc(("Device '%s':\n", pDev->szName)); 461 LogFunc(("\tUsage = %s\n", DrvAudioHlpAudDirToStr(pDev->enmUsage)));461 LogFunc(("\tUsage = %s\n", PDMAudioDirGetName(pDev->enmUsage))); 462 462 LogFunc(("\tFlags = %s\n", pszFlags ? pszFlags : "<NONE>")); 463 463 LogFunc(("\tInput channels = %RU8\n", pDev->cMaxInputChannels)); … … 471 471 472 472 /** 473 * Converts an audio direction to a string. 474 * 475 * @returns Stringified audio direction, or "Unknown", if not found. 476 * @param enmDir Audio direction to convert. 477 */ 478 const char *DrvAudioHlpAudDirToStr(PDMAUDIODIR enmDir) 473 * Gets the name of an audio direction enum value. 474 * 475 * @returns Pointer to read-only name string on success, "Unknown" if 476 * passed an invalid enum value. 477 * @param enmDir The audio direction value to name. 478 */ 479 const char *PDMAudioDirGetName(PDMAUDIODIR enmDir) 479 480 { 480 481 switch (enmDir) … … 483 484 case PDMAUDIODIR_IN: return "Input"; 484 485 case PDMAUDIODIR_OUT: return "Output"; 485 case PDMAUDIODIR_ANY: return "Duplex"; 486 default: break; 487 } 488 489 AssertMsgFailed(("Invalid audio direction %ld\n", enmDir)); 490 return "Unknown"; 486 case PDMAUDIODIR_DUPLEX: return "Duplex"; 487 488 /* no default */ 489 case PDMAUDIODIR_INVALID: 490 case PDMAUDIODIR_32BIT_HACK: 491 break; 492 } 493 AssertMsgFailedReturn(("Invalid audio direction %d\n", enmDir), "Unknown"); 491 494 } 492 495 … … 615 618 616 619 /** 617 * Returns wether the given audio format has signed bits or not. 618 * 619 * @return IPRT status code. 620 * @return bool @c true for signed bits, @c false for unsigned. 621 * @param enmFmt Audio format to retrieve value for. 620 * Checks whether the audio format is signed. 621 * 622 * @returns @c true for signed format, @c false for unsigned. 623 * @param enmFmt The audio format. 622 624 */ 623 625 bool PDMAudioFormatIsSigned(PDMAUDIOFMT enmFmt) … … 635 637 return false; 636 638 637 default: 639 /* no default */ 640 case PDMAUDIOFMT_INVALID: 641 case PDMAUDIOFMT_32BIT_HACK: 638 642 break; 639 643 } 640 641 AssertMsgFailed(("Bogus audio format %ld\n", enmFmt)); 642 return false; 643 } 644 645 /** 646 * Returns the bits of a given audio format. 647 * 648 * @return IPRT status code. 649 * @return uint8_t Bits of audio format. 650 * @param enmFmt Audio format to retrieve value for. 644 AssertMsgFailedReturn(("Bogus audio format %ld\n", enmFmt), false); 645 } 646 647 /** 648 * Gets the encoding width in bits of the give audio format. 649 * 650 * @returns Bit count. 0 if invalid input. 651 * @param enmFmt The audio format. 651 652 */ 652 653 uint8_t PDMAudioFormatGetBits(PDMAUDIOFMT enmFmt) … … 666 667 return 32; 667 668 668 default: 669 /* no default */ 670 case PDMAUDIOFMT_INVALID: 671 case PDMAUDIOFMT_32BIT_HACK: 669 672 break; 670 673 } 671 672 AssertMsgFailed(("Bogus audio format %ld\n", enmFmt)); 673 return 0; 674 } 675 676 /** 677 * Converts an audio format to a string. 678 * 679 * @returns Stringified audio format, or "Unknown", if not found. 680 * @param enmFmt Audio format to convert. 681 */ 682 const char *DrvAudioHlpAudFmtToStr(PDMAUDIOFMT enmFmt) 674 AssertMsgFailedReturn(("Bogus audio format %ld\n", enmFmt), 0); 675 } 676 677 /** 678 * Gets the name of an audio format enum value. 679 * 680 * @returns Pointer to read-only name on success, returns "Unknown" on if 681 * invalid enum value. 682 * @param enmFmt The audio format to name. 683 */ 684 const char *PDMAudioFormatGetName(PDMAUDIOFMT enmFmt) 683 685 { 684 686 switch (enmFmt) 685 687 { 686 case PDMAUDIOFMT_U8: 687 return "U8"; 688 689 case PDMAUDIOFMT_U16: 690 return "U16"; 691 692 case PDMAUDIOFMT_U32: 693 return "U32"; 694 695 case PDMAUDIOFMT_S8: 696 return "S8"; 697 698 case PDMAUDIOFMT_S16: 699 return "S16"; 700 701 case PDMAUDIOFMT_S32: 702 return "S32"; 703 704 default: 688 case PDMAUDIOFMT_U8: return "U8"; 689 case PDMAUDIOFMT_U16: return "U16"; 690 case PDMAUDIOFMT_U32: return "U32"; 691 case PDMAUDIOFMT_S8: return "S8"; 692 case PDMAUDIOFMT_S16: return "S16"; 693 case PDMAUDIOFMT_S32: return "S32"; 694 /* no default */ 695 case PDMAUDIOFMT_INVALID: 696 case PDMAUDIOFMT_32BIT_HACK: 705 697 break; 706 698 } 707 708 AssertMsgFailed(("Bogus audio format %ld\n", enmFmt)); 709 return "Unknown"; 699 AssertMsgFailedReturn(("Bogus audio format %d\n", enmFmt), "Unknown"); 710 700 } 711 701 -
trunk/src/VBox/Devices/Audio/DrvHostCoreAudio.cpp
r88023 r88026 785 785 if (pDevSrcInData->deviceID == pDevSrcOutData->deviceID) 786 786 { 787 pDevDst->enmUsage = PDMAUDIODIR_ ANY;787 pDevDst->enmUsage = PDMAUDIODIR_DUPLEX; 788 788 pDevDst->cMaxOutputChannels = pDevSrcOut->cMaxOutputChannels; 789 789
Note:
See TracChangeset
for help on using the changeset viewer.