Changeset 87852 in vbox
- Timestamp:
- Feb 23, 2021 5:45:39 PM (4 years ago)
- Location:
- trunk/src/VBox/Devices/Audio
- Files:
-
- 4 edited
-
AudioMixer.cpp (modified) (6 diffs)
-
AudioMixer.h (modified) (3 diffs)
-
DevHDA.cpp (modified) (1 diff)
-
DevIchAc97.cpp (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Audio/AudioMixer.cpp
r87273 r87852 219 219 * @returns IPRT status code. 220 220 * @param pcszName Name of the audio mixer. 221 * @param fFlags Creation flags. Not used at the moment and must be 0.221 * @param fFlags Creation flags. 222 222 * @param ppMixer Pointer which returns the created mixer object. 223 223 */ 224 224 int AudioMixerCreate(const char *pcszName, uint32_t fFlags, PAUDIOMIXER *ppMixer) 225 225 { 226 RT_NOREF(fFlags);227 226 AssertPtrReturn(pcszName, VERR_INVALID_POINTER); 228 /** @todo Add fFlags validation. */227 AssertReturn (fFlags & AUDMIXER_FLAGS_VALID_MASK, VERR_INVALID_PARAMETER); 229 228 AssertPtrReturn(ppMixer, VERR_INVALID_POINTER); 230 229 … … 245 244 pMixer->cSinks = 0; 246 245 RTListInit(&pMixer->lstSinks); 246 247 pMixer->fFlags = fFlags; 248 249 if (pMixer->fFlags & AUDMIXER_FLAGS_DEBUG) 250 LogRel(("Audio Mixer: Debug mode enabled\n")); 247 251 248 252 /* Set master volume to the max. */ … … 913 917 } 914 918 915 #ifdef VBOX_AUDIO_MIXER_DEBUG 916 DrvAudioHlpFileDestroy(pSink->Dbg.pFile); 917 pSink->Dbg.pFile = NULL; 918 #endif 919 if (pSink->pParent->fFlags & AUDMIXER_FLAGS_DEBUG) 920 { 921 DrvAudioHlpFileDestroy(pSink->Dbg.pFile); 922 pSink->Dbg.pFile = NULL; 923 } 919 924 920 925 if (pSink->pszName) … … 1266 1271 pSink->tsLastReadWrittenNs = RTTimeNanoTS(); 1267 1272 1268 #ifdef VBOX_AUDIO_MIXER_DEBUG 1269 int rc2 = DrvAudioHlpFileWrite(pSink->Dbg.pFile, pvBuf, cbRead, 0 /* fFlags */); 1270 AssertRC(rc2); 1271 #endif 1273 if (pSink->pParent->fFlags & AUDMIXER_FLAGS_DEBUG) 1274 { 1275 int rc2 = DrvAudioHlpFileWrite(pSink->Dbg.pFile, pvBuf, cbRead, 0 /* fFlags */); 1276 AssertRC(rc2); 1277 } 1272 1278 } 1273 1279 } … … 1499 1505 } 1500 1506 1501 #ifdef VBOX_AUDIO_MIXER_DEBUG 1502 if (RT_SUCCESS(rc))1507 if ( RT_SUCCESS(rc) 1508 && (pSink->pParent->fFlags & AUDMIXER_FLAGS_DEBUG)) 1503 1509 { 1504 1510 DrvAudioHlpFileClose(pSink->Dbg.pFile); … … 1525 1531 } 1526 1532 } 1527 #endif1528 1533 1529 1534 int rc2 = RTCritSectLeave(&pSink->CritSect); -
trunk/src/VBox/Devices/Audio/AudioMixer.h
r87270 r87852 50 50 /** Number of used audio sinks. */ 51 51 uint8_t cSinks; 52 /** Mixer flags. See AUDMIXER_FLAGS_XXX. */ 53 uint32_t fFlags; 52 54 } AUDIOMIXER; 53 55 /** Pointer to an audio mixer instance. */ … … 224 226 /** Last read (recording) / written (playback) timestamp (in ns). */ 225 227 uint64_t tsLastReadWrittenNs; 226 #ifdef VBOX_AUDIO_MIXER_DEBUG227 228 struct 228 229 { 229 230 PPDMAUDIOFILE pFile; 230 231 } Dbg; 231 #endif232 232 } AUDMIXSINK; 233 233 … … 250 250 #define AUDMIXSTRMCTL_F_NONE 0 251 251 252 int AudioMixerCreate(const char *pszName, uint32_t uFlags, PAUDIOMIXER *ppMixer); 252 /** No mixer flags specified. */ 253 #define AUDMIXER_FLAGS_NONE 0 254 /** Debug mode enabled. 255 * This writes .WAV file to the host, usually to the temporary directory. */ 256 #define AUDMIXER_FLAGS_DEBUG RT_BIT(0) 257 /** Validation mask. */ 258 #define AUDMIXER_FLAGS_VALID_MASK UINT32_C(0x00000001) 259 260 int AudioMixerCreate(const char *pszName, uint32_t fFlags, PAUDIOMIXER *ppMixer); 253 261 int AudioMixerCreateSink(PAUDIOMIXER pMixer, const char *pszName, AUDMIXSINKDIR enmDir, PAUDMIXSINK *ppSink); 254 262 void AudioMixerDestroy(PAUDIOMIXER pMixer); -
trunk/src/VBox/Devices/Audio/DevHDA.cpp
r87835 r87852 4993 4993 * Create the mixer. 4994 4994 */ 4995 rc = AudioMixerCreate("HDA Mixer", 0 /* uFlags */, &pThisCC->pMixer); 4995 uint32_t fMixer = AUDMIXER_FLAGS_NONE; 4996 if (pThisCC->Dbg.fEnabled) 4997 fMixer |= AUDMIXER_FLAGS_DEBUG; 4998 rc = AudioMixerCreate("HDA Mixer", fMixer, &pThisCC->pMixer); 4996 4999 AssertRCReturn(rc, rc); 4997 5000 -
trunk/src/VBox/Devices/Audio/DevIchAc97.cpp
r87767 r87852 4303 4303 } 4304 4304 4305 uint32_t fMixer = AUDMIXER_FLAGS_NONE; 4306 if (pThisCC->Dbg.fEnabled) 4307 fMixer |= AUDMIXER_FLAGS_DEBUG; 4308 4305 4309 rc = AudioMixerCreate("AC'97 Mixer", 0 /* uFlags */, &pThisCC->pMixer); 4306 4310 AssertRCReturn(rc, rc); 4311 4307 4312 rc = AudioMixerCreateSink(pThisCC->pMixer, "[Recording] Line In", AUDMIXSINKDIR_INPUT, &pThisCC->pSinkLineIn); 4308 4313 AssertRCReturn(rc, rc);
Note:
See TracChangeset
for help on using the changeset viewer.

