Index: /trunk/src/VBox/Devices/Audio/AudioMixer.cpp
===================================================================
--- /trunk/src/VBox/Devices/Audio/AudioMixer.cpp	(revision 87851)
+++ /trunk/src/VBox/Devices/Audio/AudioMixer.cpp	(revision 87852)
@@ -219,12 +219,11 @@
  * @returns IPRT status code.
  * @param   pcszName            Name of the audio mixer.
- * @param   fFlags              Creation flags. Not used at the moment and must be 0.
+ * @param   fFlags              Creation flags.
  * @param   ppMixer             Pointer which returns the created mixer object.
  */
 int AudioMixerCreate(const char *pcszName, uint32_t fFlags, PAUDIOMIXER *ppMixer)
 {
-    RT_NOREF(fFlags);
     AssertPtrReturn(pcszName, VERR_INVALID_POINTER);
-    /** @todo Add fFlags validation. */
+    AssertReturn   (fFlags & AUDMIXER_FLAGS_VALID_MASK, VERR_INVALID_PARAMETER);
     AssertPtrReturn(ppMixer, VERR_INVALID_POINTER);
 
@@ -245,4 +244,9 @@
             pMixer->cSinks = 0;
             RTListInit(&pMixer->lstSinks);
+
+            pMixer->fFlags = fFlags;
+
+            if (pMixer->fFlags & AUDMIXER_FLAGS_DEBUG)
+                LogRel(("Audio Mixer: Debug mode enabled\n"));
 
             /* Set master volume to the max. */
@@ -913,8 +917,9 @@
     }
 
-#ifdef VBOX_AUDIO_MIXER_DEBUG
-    DrvAudioHlpFileDestroy(pSink->Dbg.pFile);
-    pSink->Dbg.pFile = NULL;
-#endif
+    if (pSink->pParent->fFlags & AUDMIXER_FLAGS_DEBUG)
+    {
+        DrvAudioHlpFileDestroy(pSink->Dbg.pFile);
+        pSink->Dbg.pFile = NULL;
+    }
 
     if (pSink->pszName)
@@ -1266,8 +1271,9 @@
             pSink->tsLastReadWrittenNs = RTTimeNanoTS();
 
-#ifdef VBOX_AUDIO_MIXER_DEBUG
-            int rc2 = DrvAudioHlpFileWrite(pSink->Dbg.pFile, pvBuf, cbRead, 0 /* fFlags */);
-            AssertRC(rc2);
-#endif
+            if (pSink->pParent->fFlags & AUDMIXER_FLAGS_DEBUG)
+            {
+                int rc2 = DrvAudioHlpFileWrite(pSink->Dbg.pFile, pvBuf, cbRead, 0 /* fFlags */);
+                AssertRC(rc2);
+            }
         }
     }
@@ -1499,6 +1505,6 @@
     }
 
-#ifdef VBOX_AUDIO_MIXER_DEBUG
-    if (RT_SUCCESS(rc))
+    if (   RT_SUCCESS(rc)
+        && (pSink->pParent->fFlags & AUDMIXER_FLAGS_DEBUG))
     {
         DrvAudioHlpFileClose(pSink->Dbg.pFile);
@@ -1525,5 +1531,4 @@
         }
     }
-#endif
 
     int rc2 = RTCritSectLeave(&pSink->CritSect);
Index: /trunk/src/VBox/Devices/Audio/AudioMixer.h
===================================================================
--- /trunk/src/VBox/Devices/Audio/AudioMixer.h	(revision 87851)
+++ /trunk/src/VBox/Devices/Audio/AudioMixer.h	(revision 87852)
@@ -50,4 +50,6 @@
     /** Number of used audio sinks. */
     uint8_t                 cSinks;
+    /** Mixer flags. See AUDMIXER_FLAGS_XXX. */
+    uint32_t                fFlags;
 } AUDIOMIXER;
 /** Pointer to an audio mixer instance. */
@@ -224,10 +226,8 @@
     /** Last read (recording) / written (playback) timestamp (in ns). */
     uint64_t                tsLastReadWrittenNs;
-#ifdef VBOX_AUDIO_MIXER_DEBUG
     struct
     {
         PPDMAUDIOFILE       pFile;
     } Dbg;
-#endif
 } AUDMIXSINK;
 
@@ -250,5 +250,13 @@
 #define AUDMIXSTRMCTL_F_NONE            0
 
-int AudioMixerCreate(const char *pszName, uint32_t uFlags, PAUDIOMIXER *ppMixer);
+/** No mixer flags specified. */
+#define AUDMIXER_FLAGS_NONE             0
+/** Debug mode enabled.
+ *  This writes .WAV file to the host, usually to the temporary directory. */
+#define AUDMIXER_FLAGS_DEBUG            RT_BIT(0)
+/** Validation mask. */
+#define AUDMIXER_FLAGS_VALID_MASK       UINT32_C(0x00000001)
+
+int AudioMixerCreate(const char *pszName, uint32_t fFlags, PAUDIOMIXER *ppMixer);
 int AudioMixerCreateSink(PAUDIOMIXER pMixer, const char *pszName, AUDMIXSINKDIR enmDir, PAUDMIXSINK *ppSink);
 void AudioMixerDestroy(PAUDIOMIXER pMixer);
Index: /trunk/src/VBox/Devices/Audio/DevHDA.cpp
===================================================================
--- /trunk/src/VBox/Devices/Audio/DevHDA.cpp	(revision 87851)
+++ /trunk/src/VBox/Devices/Audio/DevHDA.cpp	(revision 87852)
@@ -4993,5 +4993,8 @@
      * Create the mixer.
      */
-    rc = AudioMixerCreate("HDA Mixer", 0 /* uFlags */, &pThisCC->pMixer);
+    uint32_t fMixer = AUDMIXER_FLAGS_NONE;
+    if (pThisCC->Dbg.fEnabled)
+        fMixer |= AUDMIXER_FLAGS_DEBUG;
+    rc = AudioMixerCreate("HDA Mixer", fMixer, &pThisCC->pMixer);
     AssertRCReturn(rc, rc);
 
Index: /trunk/src/VBox/Devices/Audio/DevIchAc97.cpp
===================================================================
--- /trunk/src/VBox/Devices/Audio/DevIchAc97.cpp	(revision 87851)
+++ /trunk/src/VBox/Devices/Audio/DevIchAc97.cpp	(revision 87852)
@@ -4303,6 +4303,11 @@
     }
 
+    uint32_t fMixer = AUDMIXER_FLAGS_NONE;
+    if (pThisCC->Dbg.fEnabled)
+        fMixer |= AUDMIXER_FLAGS_DEBUG;
+
     rc = AudioMixerCreate("AC'97 Mixer", 0 /* uFlags */, &pThisCC->pMixer);
     AssertRCReturn(rc, rc);
+
     rc = AudioMixerCreateSink(pThisCC->pMixer, "[Recording] Line In", AUDMIXSINKDIR_INPUT, &pThisCC->pSinkLineIn);
     AssertRCReturn(rc, rc);
