Changeset 89293 in vbox for trunk/src/VBox/Devices
- Timestamp:
- May 26, 2021 2:04:25 PM (4 years ago)
- svn:sync-xref-src-repo-rev:
- 144639
- Location:
- trunk/src/VBox/Devices/Audio
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Audio/AudioTest.cpp
r89290 r89293 86 86 87 87 /** 88 * Returns a random test tone frequency. 89 */ 90 DECLINLINE(double) audioTestGetRandomFreq(void) 91 { 92 return s_aAudioTestToneFreqsHz[RTRandU32Ex(0, RT_ELEMENTS(s_aAudioTestToneFreqsHz) - 1)]; 93 } 94 95 /** 88 96 * Initializes a test tone with a specific frequency (in Hz). 89 97 * 90 * @returns Randomly pickedfrequency (in Hz).98 * @returns Used tone frequency (in Hz). 91 99 * @param pTone Pointer to test tone to initialize. 92 100 * @param pProps PCM properties to use for the test tone. 93 101 * @param dbFreq Frequency (in Hz) to initialize tone with. 94 */ 95 void AudioTestToneInit(PAUDIOTESTTONE pTone, PPDMAUDIOPCMPROPS pProps, double dbFreq) 96 { 102 * When set to 0.0, a random frequency will be chosen. 103 */ 104 double AudioTestToneInit(PAUDIOTESTTONE pTone, PPDMAUDIOPCMPROPS pProps, double dbFreq) 105 { 106 if (dbFreq == 0.0) 107 dbFreq = audioTestGetRandomFreq(); 108 97 109 /* Pick a frequency from our selection, so that every time a recording starts 98 110 * we'll hopfully generate a different note. */ … … 104 116 105 117 pTone->enmType = AUDIOTESTTONETYPE_SINE; /* Only type implemented so far. */ 118 119 return dbFreq; 106 120 } 107 121 … … 109 123 * Initializes a test tone by picking a random but well-known frequency (in Hz). 110 124 * 111 * @returns Randomly picked frequency (in Hz).125 * @returns Randomly picked tone frequency (in Hz). 112 126 * @param pTone Pointer to test tone to initialize. 113 127 * @param pProps PCM properties to use for the test tone. … … 115 129 double AudioTestToneInitRandom(PAUDIOTESTTONE pTone, PPDMAUDIOPCMPROPS pProps) 116 130 { 117 AudioTestToneInit(pTone, pProps, 118 /* Pick a frequency from our selection, so that every time a recording starts 119 * we'll hopfully generate a different note. */ 120 s_aAudioTestToneFreqsHz[RTRandU32Ex(0, RT_ELEMENTS(s_aAudioTestToneFreqsHz) - 1)]); 121 122 return pTone->rdFreqHz; 131 return AudioTestToneInit(pTone, pProps, 132 /* Pick a frequency from our selection, so that every time a recording starts 133 * we'll hopfully generate a different note. */ 134 0.0); 123 135 } 124 136 -
trunk/src/VBox/Devices/Audio/AudioTest.h
r89289 r89293 293 293 294 294 295 voidAudioTestToneInit(PAUDIOTESTTONE pTone, PPDMAUDIOPCMPROPS pProps, double dbFreq);295 double AudioTestToneInit(PAUDIOTESTTONE pTone, PPDMAUDIOPCMPROPS pProps, double dbFreq); 296 296 double AudioTestToneInitRandom(PAUDIOTESTTONE pTone, PPDMAUDIOPCMPROPS pProps); 297 297 int AudioTestToneGenerate(PAUDIOTESTTONE pTone, void *pvBuf, uint32_t cbBuf, uint32_t *pcbWritten);
Note:
See TracChangeset
for help on using the changeset viewer.