Changeset 89289 in vbox for trunk/src/VBox/Devices/Audio
- Timestamp:
- May 26, 2021 9:48:37 AM (4 years ago)
- svn:sync-xref-src-repo-rev:
- 144635
- Location:
- trunk/src/VBox/Devices/Audio
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Audio/AudioTest.cpp
r89262 r89289 86 86 87 87 /** 88 * Initializes a test tone by picking a random but well-knownfrequency (in Hz).88 * Initializes a test tone with a specific frequency (in Hz). 89 89 * 90 90 * @returns Randomly picked frequency (in Hz). 91 91 * @param pTone Pointer to test tone to initialize. 92 92 * @param pProps PCM properties to use for the test tone. 93 */ 94 double AudioTestToneInitRandom(PAUDIOTESTTONE pTone, PPDMAUDIOPCMPROPS pProps) 93 * @þaram dbFreq Frequency (in Hz) to initialize tone with. 94 */ 95 void AudioTestToneInit(PAUDIOTESTTONE pTone, PPDMAUDIOPCMPROPS pProps, double dbFreq) 95 96 { 96 97 /* Pick a frequency from our selection, so that every time a recording starts 97 98 * we'll hopfully generate a different note. */ 98 pTone->rdFreqHz = s_aAudioTestToneFreqsHz[RTRandU32Ex(0, RT_ELEMENTS(s_aAudioTestToneFreqsHz) - 1)];99 pTone->rdFreqHz = dbFreq; 99 100 pTone->rdFixed = 2.0 * M_PI * pTone->rdFreqHz / PDMAudioPropsHz(pProps); 100 101 pTone->uSample = 0; … … 103 104 104 105 pTone->enmType = AUDIOTESTTONETYPE_SINE; /* Only type implemented so far. */ 106 } 107 108 /** 109 * Initializes a test tone by picking a random but well-known frequency (in Hz). 110 * 111 * @returns Randomly picked frequency (in Hz). 112 * @param pTone Pointer to test tone to initialize. 113 * @param pProps PCM properties to use for the test tone. 114 */ 115 double AudioTestToneInitRandom(PAUDIOTESTTONE pTone, PPDMAUDIOPCMPROPS pProps) 116 { 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)]); 105 121 106 122 return pTone->rdFreqHz; -
trunk/src/VBox/Devices/Audio/AudioTest.h
r89265 r89289 293 293 294 294 295 void AudioTestToneInit(PAUDIOTESTTONE pTone, PPDMAUDIOPCMPROPS pProps, double dbFreq); 295 296 double AudioTestToneInitRandom(PAUDIOTESTTONE pTone, PPDMAUDIOPCMPROPS pProps); 296 297 int AudioTestToneGenerate(PAUDIOTESTTONE pTone, void *pvBuf, uint32_t cbBuf, uint32_t *pcbWritten);
Note:
See TracChangeset
for help on using the changeset viewer.