VirtualBox

Changeset 91453 in vbox for trunk/src/VBox


Ignore:
Timestamp:
Sep 29, 2021 9:43:40 AM (3 years ago)
Author:
vboxsync
Message:

Audio/Validation Kit: Implemented optional test tone options "--tone-freq" and "--tone-dur" to specify a defined frequency and duration. ​bugref:10008

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/ValidationKit/utils/audio/vkatCmdGeneric.cpp

    r91452 r91453  
    536536enum
    537537{
    538     VKAT_PLAY_OPT_VOL = 900
     538    VKAT_PLAY_OPT_TONE_DUR = 900,
     539    VKAT_PLAY_OPT_TONE_FREQ,
     540    VKAT_PLAY_OPT_VOL
    539541};
    540542
     
    551553    { "--sample-size",      'z',                          RTGETOPT_REQ_UINT8 },
    552554    { "--test-tone",        't',                          RTGETOPT_REQ_NOTHING },
     555    { "--tone-dur",         VKAT_PLAY_OPT_TONE_DUR,       RTGETOPT_REQ_UINT32 },
     556    { "--tone-freq",        VKAT_PLAY_OPT_TONE_FREQ,      RTGETOPT_REQ_UINT32 },
    553557    { "--output-device",    'o',                          RTGETOPT_REQ_STRING  },
    554558    { "--with-drv-audio",   'd',                          RTGETOPT_REQ_NOTHING },
    555559    { "--with-mixer",       'm',                          RTGETOPT_REQ_NOTHING },
    556     { "--vol",              VKAT_PLAY_OPT_VOL,            RTGETOPT_REQ_UINT8 },
     560    { "--vol",              VKAT_PLAY_OPT_VOL,            RTGETOPT_REQ_UINT8 }
    557561};
    558562
     
    563567    switch (pOpt->iShort)
    564568    {
    565         case 'b':               return "The audio backend to use";
    566         case 'c':               return "Number of backend output channels";
    567         case 'd':               return "Go via DrvAudio instead of directly interfacing with the backend";
    568         case 'f':               return "Output frequency (Hz)";
    569         case 'z':               return "Output sample size (bits)";
    570         case 't':               return "Plays a test tone. Can be specified multiple times";
    571         case 'm':               return "Go via the mixer";
    572         case 'o':               return "The ID of the output device to use";
    573         case VKAT_PLAY_OPT_VOL: return "Volume (in percent, 0-100) to use";
    574         default:                return NULL;
     569        case 'b':                       return "The audio backend to use";
     570        case 'c':                       return "Number of backend output channels";
     571        case 'd':                       return "Go via DrvAudio instead of directly interfacing with the backend";
     572        case 'f':                       return "Output frequency (Hz)";
     573        case 'z':                       return "Output sample size (bits)";
     574        case 't':                       return "Plays a test tone. Can be specified multiple times";
     575        case 'm':                       return "Go via the mixer";
     576        case 'o':                       return "The ID of the output device to use";
     577        case VKAT_PLAY_OPT_TONE_DUR:    return "Test tone duration (ms)";
     578        case VKAT_PLAY_OPT_TONE_FREQ:   return "Test tone frequency (Hz)";
     579        case VKAT_PLAY_OPT_VOL:         return "Volume (in percent, 0-100) to use";
     580        default:                        return NULL;
    575581    }
    576582}
     
    598604    PlayOpts.uVolumePercent = 100; /* Use maximum volume by default. */
    599605
     606    AUDIOTESTTONEPARMS ToneParms;
     607    RT_ZERO(ToneParms);
     608
     609    ToneParms.dbFreqHz   = AudioTestToneGetRandomFreq();
     610    ToneParms.msDuration = RTRandU32Ex(0, RT_MS_10SEC); /** @todo Probably a bit too long, but let's see. */
     611
    600612    /* Argument processing loop: */
    601613    int           ch;
     
    639651                break;
    640652
     653            case VKAT_PLAY_OPT_TONE_DUR:
     654                ToneParms.msDuration = ValueUnion.u32;
     655                break;
     656
     657            case VKAT_PLAY_OPT_TONE_FREQ:
     658                ToneParms.dbFreqHz = ValueUnion.u32;
     659                break;
     660
    641661            case VKAT_PLAY_OPT_VOL:
    642662                PlayOpts.uVolumePercent = ValueUnion.u8;
     
    670690    while (cTestTones--)
    671691    {
    672         AUDIOTESTTONEPARMS ToneParms;
    673         RT_ZERO(ToneParms);
    674 
    675692        /* Use some sane defaults if no PCM props are set by the user. */
    676693        PDMAudioPropsInit(&ToneParms.Props,
     
    678695                          cChannels ? cChannels : 2 /* Stereo */, uHz ? uHz : 44100);
    679696
    680         ToneParms.dbFreqHz       = AudioTestToneGetRandomFreq();
    681         ToneParms.msPrequel      = 0; /** @todo Implement analyzing this first! */
    682 #ifdef DEBUG_andy
    683         ToneParms.msDuration     = RTRandU32Ex(50, 2500);
    684 #else
    685         ToneParms.msDuration     = RTRandU32Ex(0, RT_MS_10SEC); /** @todo Probably a bit too long, but let's see. */
    686 #endif
    687         ToneParms.msSequel       = 0;   /** @todo Implement analyzing this first! */
    688697        ToneParms.uVolumePercent = PlayOpts.uVolumePercent;
    689698
Note: See TracChangeset for help on using the changeset viewer.

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