VirtualBox

Changeset 89218 in vbox for trunk/include


Ignore:
Timestamp:
May 21, 2021 11:57:55 AM (4 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
144560
Message:

Audio: Converted PDMAUDIODSTSRCUNION, PDMAUDIORECSRC and PDMAUDIOPLAYBACKDST into a single enum type PDMAUDIOPATH. bugref:9890

Location:
trunk/include/VBox/vmm
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/VBox/vmm/pdmaudioifs.h

    r89214 r89218  
    487487typedef PDMAUDIOFRAME const *PCPDMAUDIOFRAME;
    488488
    489 /**
    490  * Audio playback destinations.
    491  */
    492 typedef enum PDMAUDIOPLAYBACKDST
    493 {
    494     /** Invalid zero value as per usual (guards against using unintialized values). */
    495     PDMAUDIOPLAYBACKDST_INVALID = 0,
    496     /** Unknown destination. */
    497     PDMAUDIOPLAYBACKDST_UNKNOWN,
    498     /** Front channel. */
    499     PDMAUDIOPLAYBACKDST_FRONT,
    500     /** Center / LFE (Subwoofer) channel. */
    501     PDMAUDIOPLAYBACKDST_CENTER_LFE,
    502     /** Rear channel. */
    503     PDMAUDIOPLAYBACKDST_REAR,
     489
     490/**
     491 * Audio path: input sources and playback destinations.
     492 *
     493 * Think of this as the name of the socket you plug the virtual audio stream
     494 * jack into.
     495 *
     496 * @note Not quite sure what the purpose of this type is.  It used to be two
     497 * separate enums (PDMAUDIOPLAYBACKDST & PDMAUDIORECSRC) without overlapping
     498 * values and most commonly used in a union (PDMAUDIODSTSRCUNION).  The output
     499 * values were designated "channel" (e.g. "Front channel"), whereas this was not
     500 * done to the input ones.  So, I'm (bird) a little confused what the actual
     501 * meaning was.
     502 */
     503typedef enum PDMAUDIOPATH
     504{
     505    /** Customary invalid zero value. */
     506    PDMAUDIOPATH_INVALID = 0,
     507
     508    /** Unknown path / Doesn't care. */
     509    PDMAUDIOPATH_UNKNOWN,
     510
     511    /** First output value. */
     512    PDMAUDIOPATH_OUT_FIRST,
     513    /** Output: Front. */
     514    PDMAUDIOPATH_OUT_FRONT = PDMAUDIOPATH_OUT_FIRST,
     515    /** Output: Center / LFE (Subwoofer). */
     516    PDMAUDIOPATH_OUT_CENTER_LFE,
     517    /** Output: Rear. */
     518    PDMAUDIOPATH_OUT_REAR,
     519    /** Last output value (inclusive)   */
     520    PDMAUDIOPATH_OUT_END = PDMAUDIOPATH_OUT_REAR,
     521
     522    /** First input value. */
     523    PDMAUDIOPATH_IN_FIRST,
     524    /** Input: Microphone. */
     525    PDMAUDIOPATH_IN_MIC = PDMAUDIOPATH_IN_FIRST,
     526    /** Input: CD. */
     527    PDMAUDIOPATH_IN_CD,
     528    /** Input: Video-In. */
     529    PDMAUDIOPATH_IN_VIDEO,
     530    /** Input: AUX. */
     531    PDMAUDIOPATH_IN_AUX,
     532    /** Input: Line-In. */
     533    PDMAUDIOPATH_IN_LINE,
     534    /** Input: Phone-In. */
     535    PDMAUDIOPATH_IN_PHONE,
     536    /** Last intput value (inclusive). */
     537    PDMAUDIOPATH_IN_LAST = PDMAUDIOPATH_IN_PHONE,
     538
    504539    /** End of valid values. */
    505     PDMAUDIOPLAYBACKDST_END,
    506     /** Hack to blow the type up to 32-bit. */
    507     PDMAUDIOPLAYBACKDST_32BIT_HACK = 0x7fffffff
    508 } PDMAUDIOPLAYBACKDST;
    509 
    510 /**
    511  * Audio recording sources.
    512  *
    513  * @note Because this is almost exclusively used in PDMAUDIODSTSRCUNION where it
    514  *       overlaps with PDMAUDIOPLAYBACKDST, the values starts at 64 instead of 0.
    515  */
    516 typedef enum PDMAUDIORECSRC
    517 {
    518     /** Unknown recording source. */
    519     PDMAUDIORECSRC_UNKNOWN = 64,
    520     /** Microphone-In. */
    521     PDMAUDIORECSRC_MIC,
    522     /** CD. */
    523     PDMAUDIORECSRC_CD,
    524     /** Video-In. */
    525     PDMAUDIORECSRC_VIDEO,
    526     /** AUX. */
    527     PDMAUDIORECSRC_AUX,
    528     /** Line-In. */
    529     PDMAUDIORECSRC_LINE,
    530     /** Phone-In. */
    531     PDMAUDIORECSRC_PHONE,
    532     /** End of valid values. */
    533     PDMAUDIORECSRC_END,
    534     /** Hack to blow the type up to 32-bit. */
    535     PDMAUDIORECSRC_32BIT_HACK = 0x7fffffff
    536 } PDMAUDIORECSRC;
    537 
    538 /**
    539  * Union for keeping an audio stream destination or source.
    540  */
    541 typedef union PDMAUDIODSTSRCUNION
    542 {
    543     /** Desired playback destination (for an output stream). */
    544     PDMAUDIOPLAYBACKDST enmDst;
    545     /** Desired recording source (for an input stream). */
    546     PDMAUDIORECSRC      enmSrc;
    547 } PDMAUDIODSTSRCUNION;
    548 /** Pointer to an audio stream src/dst union. */
    549 typedef PDMAUDIODSTSRCUNION *PPDMAUDIODSTSRCUNION;
     540    PDMAUDIOPATH_END,
     541    /** Hack to blow the typ up to 32 bits. */
     542    PDMAUDIOPATH_32BIT_HACK = 0x7fffffff
     543} PDMAUDIOPATH;
    550544
    551545/**
     
    756750    /** Direction of the stream. */
    757751    PDMAUDIODIR             enmDir;
    758     /** Destination / source indicator, depending on enmDir. */
    759     PDMAUDIODSTSRCUNION     u;
     752    /** Destination / source path. */
     753    PDMAUDIOPATH            enmPath;
    760754    /** The stream's PCM properties. */
    761755    PDMAUDIOPCMPROPS        Props;
     
    12501244
    12511245/** PDMIAUDIOCONNECTOR interface ID. */
    1252 #define PDMIAUDIOCONNECTOR_IID                  "69d01cd1-df73-48db-86f4-2f97519ac585"
     1246#define PDMIAUDIOCONNECTOR_IID                  "ff9cabf0-4138-4c3a-aa99-28bf7a6feae7"
    12531247
    12541248
     
    15311525
    15321526/** PDMIHOSTAUDIO interface ID. */
    1533 #define PDMIHOSTAUDIO_IID                           "cd27862d-9aa2-4270-876e-7d660b87ecd3"
     1527#define PDMIHOSTAUDIO_IID                           "ad56b303-0c1f-4b79-9bd1-4ec04ae08c4f"
    15341528
    15351529
     
    16161610
    16171611/** PDMIHOSTAUDIOPORT interface ID. */
    1618 #define PDMIHOSTAUDIOPORT_IID                    "cd006383-7be1-4dbe-a69e-21236413cf30"
     1612#define PDMIHOSTAUDIOPORT_IID                    "9f91ec59-95ba-4925-92dc-e75be1c63352"
    16191613
    16201614/** @} */
  • trunk/include/VBox/vmm/pdmaudioinline.h

    r88991 r89218  
    107107
    108108/**
    109  * Gets the name of a playback destination enum value.
     109 * Gets the name of a path enum value.
    110110 *
    111111 * @returns Pointer to read-only name, "bad" if invalid input.
    112  * @param   enmPlaybackDst      The playback destination value.
    113  */
    114 DECLINLINE(const char *) PDMAudioPlaybackDstGetName(PDMAUDIOPLAYBACKDST enmPlaybackDst)
    115 {
    116     switch (enmPlaybackDst)
    117     {
    118         case PDMAUDIOPLAYBACKDST_UNKNOWN:    return "Unknown";
    119         case PDMAUDIOPLAYBACKDST_FRONT:      return "Front";
    120         case PDMAUDIOPLAYBACKDST_CENTER_LFE: return "Center / LFE";
    121         case PDMAUDIOPLAYBACKDST_REAR:       return "Rear";
     112 * @param   enmPath     The path value to name.
     113 */
     114DECLINLINE(const char *) PDMAudioPathGetName(PDMAUDIOPATH enmPath)
     115{
     116    switch (enmPath)
     117    {
     118        case PDMAUDIOPATH_UNKNOWN:          return "Unknown";
     119
     120        case PDMAUDIOPATH_OUT_FRONT:        return "Front";
     121        case PDMAUDIOPATH_OUT_CENTER_LFE:   return "Center / LFE";
     122        case PDMAUDIOPATH_OUT_REAR:         return "Rear";
     123
     124        case PDMAUDIOPATH_IN_MIC:           return "Microphone In";
     125        case PDMAUDIOPATH_IN_CD:            return "CD";
     126        case PDMAUDIOPATH_IN_VIDEO:         return "Video";
     127        case PDMAUDIOPATH_IN_AUX:           return "AUX";
     128        case PDMAUDIOPATH_IN_LINE:          return "Line In";
     129        case PDMAUDIOPATH_IN_PHONE:         return "Phone";
     130
    122131        /* no default */
    123         case PDMAUDIOPLAYBACKDST_INVALID:
    124         case PDMAUDIOPLAYBACKDST_END:
    125         case PDMAUDIOPLAYBACKDST_32BIT_HACK:
     132        case PDMAUDIOPATH_INVALID:
     133        case PDMAUDIOPATH_END:
     134        case PDMAUDIOPATH_32BIT_HACK:
    126135            break;
    127136    }
    128     AssertMsgFailedReturn(("Invalid playback destination %ld\n", enmPlaybackDst), "bad");
    129 }
    130 
    131 /**
    132  * Gets the name of a recording source enum value.
    133  *
    134  * @returns Pointer to read-only name, "bad" if invalid input.
    135  * @param   enmRecSrc       The recording source value.
    136  */
    137 DECLINLINE(const char *) PDMAudioRecSrcGetName(PDMAUDIORECSRC enmRecSrc)
    138 {
    139     switch (enmRecSrc)
    140     {
    141         case PDMAUDIORECSRC_UNKNOWN: return "Unknown";
    142         case PDMAUDIORECSRC_MIC:     return "Microphone In";
    143         case PDMAUDIORECSRC_CD:      return "CD";
    144         case PDMAUDIORECSRC_VIDEO:   return "Video";
    145         case PDMAUDIORECSRC_AUX:     return "AUX";
    146         case PDMAUDIORECSRC_LINE:    return "Line In";
    147         case PDMAUDIORECSRC_PHONE:   return "Phone";
    148         /* no default */
    149         case PDMAUDIORECSRC_END:
    150         case PDMAUDIORECSRC_32BIT_HACK:
    151             break;
    152     }
    153     AssertMsgFailedReturn(("Invalid recording source %ld\n", enmRecSrc), "bad");
     137    AssertMsgFailedReturn(("Unknown enmPath=%d\n", enmPath), "bad");
    154138}
    155139
     
    954938    if (PDMAudioPropsAreEqual(&pCfg1->Props, &pCfg2->Props))
    955939        return pCfg1->enmDir    == pCfg2->enmDir
    956             && pCfg1->u.enmDst  == pCfg2->u.enmDst
     940            && pCfg1->enmPath   == pCfg2->enmPath
    957941            && pCfg1->enmLayout == pCfg2->enmLayout
    958942            && pCfg1->Device.cMsSchedulingHint == pCfg2->Device.cMsSchedulingHint
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette