Index: trunk/src/VBox/Devices/Audio/AudioHlp.cpp
===================================================================
--- trunk/src/VBox/Devices/Audio/AudioHlp.cpp	(revision 90010)
+++ trunk/src/VBox/Devices/Audio/AudioHlp.cpp	(revision 90011)
@@ -242,5 +242,6 @@
  * @param   pszPath     Base path to use.  If NULL or empty, the user's
  *                      temporary directory will be used.
- * @param   pszName     A name for better identifying the file.
+ * @param   pszNameFmt  A name for better identifying the file.
+ * @param   va          Arguments for @a pszNameFmt.
  * @param   uInstance   Device / driver instance which is using this file.
  * @param   enmType     Audio file type to construct file name for.
@@ -248,5 +249,5 @@
  * @param   chTweak     Retry tweak character.
  */
-static int audioHlpConstructPathWorker(char *pszDst, size_t cbDst, const char *pszPath, const char *pszName,
+static int audioHlpConstructPathWorker(char *pszDst, size_t cbDst, const char *pszPath, const char *pszNameFmt, va_list va,
                                        uint32_t uInstance, AUDIOHLPFILETYPE enmType, uint32_t fFlags, char chTweak)
 {
@@ -255,5 +256,5 @@
      */
     AssertPtrNullReturn(pszPath, VERR_INVALID_POINTER);
-    AssertPtrReturn(pszName, VERR_INVALID_POINTER);
+    AssertPtrReturn(pszNameFmt, VERR_INVALID_POINTER);
     AssertReturn(!(fFlags & ~AUDIOHLPFILENAME_FLAGS_VALID_MASK), VERR_INVALID_FLAGS);
 
@@ -319,9 +320,12 @@
 
     /* Append the filename, instance, retry-tweak and suffix. */
+    va_list vaCopy;
+    va_copy(vaCopy, va);
     ssize_t cchTail;
     if (chTweak == '\0')
-        cchTail = RTStrPrintf2(&pszDst[offDst], cbDst - offDst, "%s-%u%s", pszName, uInstance, pszSuffix);
+        cchTail = RTStrPrintf2(&pszDst[offDst], cbDst - offDst, "%N-%u%s", pszNameFmt, &vaCopy, uInstance, pszSuffix);
     else
-        cchTail = RTStrPrintf2(&pszDst[offDst], cbDst - offDst, "%s-%u%c%s", pszName, uInstance, chTweak, pszSuffix);
+        cchTail = RTStrPrintf2(&pszDst[offDst], cbDst - offDst, "%N-%u%c%s", pszNameFmt, &vaCopy, uInstance, chTweak, pszSuffix);
+    va_end(vaCopy);
     AssertReturn(cchTail > 0, VERR_BUFFER_OVERFLOW);
 
@@ -329,75 +333,68 @@
 }
 
-/**
- * Constructs an unique file name, based on the given path and the audio file type.
+
+/**
+ * Worker for AudioHlpFileCreateF and AudioHlpFileCreateAndOpenEx that allocates
+ * and initializes a AUDIOHLPFILE instance.
+ */
+static int audioHlpFileCreateWorker(PAUDIOHLPFILE *ppFile, uint32_t fFlags, AUDIOHLPFILETYPE enmType, const char *pszPath)
+{
+    AssertReturn(!(fFlags & ~AUDIOHLPFILE_FLAGS_VALID_MASK), VERR_INVALID_FLAGS);
+
+    size_t const cbPath = strlen(pszPath) + 1;
+    PAUDIOHLPFILE pFile = (PAUDIOHLPFILE)RTMemAllocVar(RT_UOFFSETOF_DYN(AUDIOHLPFILE, szName[cbPath]));
+    AssertPtrReturn(pFile, VERR_NO_MEMORY);
+
+    pFile->enmType = enmType;
+    pFile->fFlags  = fFlags;
+    pFile->hFile   = NIL_RTFILE;
+    pFile->pvData  = NULL;
+    pFile->cbData  = 0;
+    memcpy(pFile->szName, pszPath, cbPath);
+
+    *ppFile = pFile;
+    return VINF_SUCCESS;
+}
+
+
+/**
+ * Creates an instance of AUDIOHLPFILE with the given filename and type.
+ *
+ * @note This does <b>NOT</b> create the file, see AudioHlpFileOpen for that.
  *
  * @returns VBox status code.
- * @param   pszDst      Where to store the constructed file name.
- * @param   cbDst       Size of the destination buffer (bytes; incl terminator).
- * @param   pszPath     Base path to use.  If NULL or empty, the user's
- *                      temporary directory will be used.
- * @param   pszName     A name for better identifying the file.
- * @param   uInstance   Device / driver instance which is using this file.
- * @param   enmType     Audio file type to construct file name for.
- * @param   fFlags      File naming flags, AUDIOHLPFILENAME_FLAGS_XXX.
- */
-int AudioHlpFileNameGet(char *pszDst, size_t cbDst, const char *pszPath, const char *pszName,
-                        uint32_t uInstance, AUDIOHLPFILETYPE enmType, uint32_t fFlags)
-{
-    return audioHlpConstructPathWorker(pszDst, cbDst, pszPath, pszName, uInstance, enmType, fFlags, '\0');
-}
-
-/**
- * Creates an audio file.
- *
- * @returns VBox status code.
- * @param   enmType             Audio file type to open / create.
- * @param   pszFile             File path of file to open or create.
- * @param   fFlags              Audio file flags, AUDIOHLPFILE_FLAGS_XXX.
- * @param   ppFile              Where to store the created audio file handle.
- *                              Needs to be destroyed with AudioHlpFileDestroy().
- */
-int AudioHlpFileCreate(AUDIOHLPFILETYPE enmType, const char *pszFile, uint32_t fFlags, PAUDIOHLPFILE *ppFile)
-{
-    AssertPtrReturn(pszFile, VERR_INVALID_POINTER);
-    /** @todo Validate fFlags. */
-
-    PAUDIOHLPFILE pFile = (PAUDIOHLPFILE)RTMemAlloc(sizeof(AUDIOHLPFILE));
-    if (!pFile)
-        return VERR_NO_MEMORY;
-
-    int rc = VINF_SUCCESS;
-
-    switch (enmType)
-    {
-        case AUDIOHLPFILETYPE_RAW:
-        case AUDIOHLPFILETYPE_WAV:
-            pFile->enmType = enmType;
-            break;
-
-        default:
-            rc = VERR_INVALID_PARAMETER;
-            break;
-    }
-
-    if (RT_SUCCESS(rc))
-    {
-        RTStrPrintf(pFile->szName, RT_ELEMENTS(pFile->szName), "%s", pszFile);
-        pFile->hFile  = NIL_RTFILE;
-        pFile->fFlags = fFlags;
-        pFile->pvData = NULL;
-        pFile->cbData = 0;
-    }
-
-    if (RT_FAILURE(rc))
-    {
-        RTMemFree(pFile);
-        pFile = NULL;
-    }
-    else
-        *ppFile = pFile;
-
-    return rc;
-}
+ * @param   ppFile      Where to return the pointer to the audio debug file
+ *                      instance on success.
+ * @param   fFlags      AUDIOHLPFILE_FLAGS_XXX.
+ * @param   enmType     The audio file type to produce.
+ * @param   pszPath     The directory path.  The temporary directory will be
+ *                      used if NULL or empty.
+ * @param   fFilename   AUDIOHLPFILENAME_FLAGS_XXX.
+ * @param   uInstance   The instance number (will be appended to the filename
+ *                      with a dash inbetween).
+ * @param   pszNameFmt  The filename format string.
+ * @param   ...         Arguments to the filename format string.
+ */
+int AudioHlpFileCreateF(PAUDIOHLPFILE *ppFile, uint32_t fFlags, AUDIOHLPFILETYPE enmType,
+                        const char *pszPath, uint32_t fFilename, uint32_t uInstance, const char *pszNameFmt, ...)
+{
+    *ppFile = NULL;
+
+    /*
+     * Construct the filename first.
+     */
+    char szPath[RTPATH_MAX];
+    va_list va;
+    va_start(va, pszNameFmt);
+    int rc = audioHlpConstructPathWorker(szPath, sizeof(szPath), pszPath, pszNameFmt, va, uInstance, enmType, fFilename, '\0');
+    va_end(va);
+    AssertRCReturn(rc, rc);
+
+    /*
+     * Allocate and initializes a debug file instance with that filename path.
+     */
+    return audioHlpFileCreateWorker(ppFile, fFlags, enmType, szPath);
+}
+
 
 /**
@@ -416,4 +413,5 @@
     pFile = NULL;
 }
+
 
 /**
@@ -436,7 +434,5 @@
 
     if (pFile->enmType == AUDIOHLPFILETYPE_RAW)
-    {
         rc = RTFileOpen(&pFile->hFile, pFile->szName, fOpen);
-    }
     else if (pFile->enmType == AUDIOHLPFILETYPE_WAV)
     {
@@ -499,4 +495,5 @@
 }
 
+
 /**
  * Creates a debug file structure and opens a file for it, extended version.
@@ -506,5 +503,4 @@
  * @param   enmType     The file type.
  * @param   pszDir      The directory to open the file in.
- * @param   pszName     The base filename.
  * @param   iInstance   The device/driver instance.
  * @param   fFilename   AUDIOHLPFILENAME_FLAGS_XXX.
@@ -512,8 +508,10 @@
  * @param   pProps      PCM audio properties for the file.
  * @param   fOpen       RTFILE_O_XXX or AUDIOHLPFILE_DEFAULT_OPEN_FLAGS.
- */
-int AudioHlpFileCreateAndOpenEx(PAUDIOHLPFILE *ppFile, AUDIOHLPFILETYPE enmType, const char *pszDir, const char *pszName,
+ * @param   pszNameFmt  The base filename.
+ * @param   ...         Filename format arguments.
+ */
+int AudioHlpFileCreateAndOpenEx(PAUDIOHLPFILE *ppFile, AUDIOHLPFILETYPE enmType, const char *pszDir,
                                 uint32_t iInstance, uint32_t fFilename, uint32_t fCreate,
-                                PCPDMAUDIOPCMPROPS pProps, uint64_t fOpen)
+                                PCPDMAUDIOPCMPROPS pProps, uint64_t fOpen, const char *pszNameFmt, ...)
 {
     *ppFile = NULL;
@@ -521,13 +519,19 @@
     for (uint32_t iTry = 0; ; iTry++)
     {
+        /* Format the path to the filename. */
         char szFile[RTPATH_MAX];
-        int rc = audioHlpConstructPathWorker(szFile, sizeof(szFile), pszDir, pszName, iInstance, enmType, fFilename,
+        va_list va;
+        va_start(va, pszNameFmt);
+        int rc = audioHlpConstructPathWorker(szFile, sizeof(szFile), pszDir, pszNameFmt, va, iInstance, enmType, fFilename,
                                              iTry == 0 ? '\0' : iTry + 'a');
+        va_end(va);
         AssertRCReturn(rc, rc);
 
+        /* Create an debug audio file instance with the filename path. */
         PAUDIOHLPFILE pFile = NULL;
-        rc = AudioHlpFileCreate(enmType, szFile, fCreate, &pFile);
+        rc = audioHlpFileCreateWorker(&pFile, fCreate, enmType, szFile);
         AssertRCReturn(rc, rc);
 
+        /* Try open it. */
         rc = AudioHlpFileOpen(pFile, fOpen, pProps);
         if (RT_SUCCESS(rc))
@@ -542,4 +546,5 @@
 }
 
+
 /**
  * Creates a debug wav-file structure and opens a file for it, default flags.
@@ -555,7 +560,7 @@
                               uint32_t iInstance, PCPDMAUDIOPCMPROPS pProps)
 {
-    return AudioHlpFileCreateAndOpenEx(ppFile, AUDIOHLPFILETYPE_WAV, pszDir, pszName, iInstance,
+    return AudioHlpFileCreateAndOpenEx(ppFile, AUDIOHLPFILETYPE_WAV, pszDir, iInstance,
                                        AUDIOHLPFILENAME_FLAGS_NONE, AUDIOHLPFILE_FLAGS_NONE,
-                                       pProps, AUDIOHLPFILE_DEFAULT_OPEN_FLAGS);
+                                       pProps, AUDIOHLPFILE_DEFAULT_OPEN_FLAGS, "%s", pszName);
 }
 
@@ -607,7 +612,5 @@
         && !cbSize
         && !(pFile->fFlags & AUDIOHLPFILE_FLAGS_KEEP_IF_EMPTY))
-    {
         rc = AudioHlpFileDelete(pFile);
-    }
 
     pFile->cbData = 0;
@@ -624,9 +627,10 @@
 }
 
+
 /**
  * Deletes an audio file.
  *
  * @returns VBox status code.
- * @param   pFile               Audio file handle to delete.
+ * @param   pFile               Audio file to delete.
  */
 int AudioHlpFileDelete(PAUDIOHLPFILE pFile)
@@ -636,8 +640,6 @@
     int rc = RTFileDelete(pFile->szName);
     if (RT_SUCCESS(rc))
-    {
         LogRel2(("Audio: Deleted file '%s'\n", pFile->szName));
-    }
-    else if (rc == VERR_FILE_NOT_FOUND) /* Don't bitch if the file is not around (anymore). */
+    else if (rc == VERR_FILE_NOT_FOUND) /* Don't bitch if the file is not around anymore. */
         rc = VINF_SUCCESS;
 
@@ -648,9 +650,10 @@
 }
 
+
 /**
  * Returns the raw audio data size of an audio file.
  *
- * Note: This does *not* include file headers and other data which does
- *       not belong to the actual PCM audio data.
+ * @note This does *not* include file headers and other data which does not
+ *       belong to the actual PCM audio data.
  *
  * @returns Size (in bytes) of the raw PCM audio data.
@@ -664,7 +667,5 @@
 
     if (pFile->enmType == AUDIOHLPFILETYPE_RAW)
-    {
         cbSize = RTFileTell(pFile->hFile);
-    }
     else if (pFile->enmType == AUDIOHLPFILETYPE_WAV)
     {
@@ -677,9 +678,10 @@
 }
 
+
 /**
  * Returns whether the given audio file is open and in use or not.
  *
- * @return  bool                True if open, false if not.
- * @param   pFile               Audio file handle to check open status for.
+ * @returnd True if open, false if not.
+ * @param   pFile               Audio file to check open status for.
  */
 bool AudioHlpFileIsOpen(PAUDIOHLPFILE pFile)
@@ -691,9 +693,10 @@
 }
 
+
 /**
  * Write PCM data to a wave (.WAV) file.
  *
  * @returns VBox status code.
- * @param   pFile               Audio file handle to write PCM data to.
+ * @param   pFile               Audio file to write PCM data to.
  * @param   pvBuf               Audio data to write.
  * @param   cbBuf               Size (in bytes) of audio data to write.
@@ -715,7 +718,5 @@
 
     if (pFile->enmType == AUDIOHLPFILETYPE_RAW)
-    {
         rc = RTFileWrite(pFile->hFile, pvBuf, cbBuf, NULL);
-    }
     else if (pFile->enmType == AUDIOHLPFILETYPE_WAV)
     {
Index: trunk/src/VBox/Devices/Audio/AudioHlp.h
===================================================================
--- trunk/src/VBox/Devices/Audio/AudioHlp.h	(revision 90010)
+++ trunk/src/VBox/Devices/Audio/AudioHlp.h	(revision 90011)
@@ -75,10 +75,4 @@
 } AUDIOHLPFILETYPE;
 
-/** @name Audio file (name) helper methods.
- * @{ */
-int     AudioHlpFileNameGet(char *pszFile, size_t cchFile, const char *pszPath, const char *pszName,
-                            uint32_t uInstance, AUDIOHLPFILETYPE enmType, uint32_t fFlags);
-/** @}  */
-
 /** @name AUDIOHLPFILENAME_FLAGS_XXX
  * @{ */
@@ -108,5 +102,6 @@
     size_t              cbData;
     /** File name and path. */
-    char                szName[RTPATH_MAX];
+    RT_FLEXIBLE_ARRAY_EXTENSION
+    char                szName[RT_FLEXIBLE_ARRAY];
 } AUDIOHLPFILE;
 /** Pointer to an audio file handle. */
@@ -117,8 +112,10 @@
 int     AudioHlpFileCreateAndOpen(PAUDIOHLPFILE *ppFile, const char *pszDir, const char *pszName,
                                   uint32_t iInstance, PCPDMAUDIOPCMPROPS pProps);
-int     AudioHlpFileCreateAndOpenEx(PAUDIOHLPFILE *ppFile, AUDIOHLPFILETYPE enmType, const char *pszDir, const char *pszName,
+int     AudioHlpFileCreateAndOpenEx(PAUDIOHLPFILE *ppFile, AUDIOHLPFILETYPE enmType, const char *pszDir,
                                     uint32_t iInstance, uint32_t fFilename, uint32_t fCreate,
-                                    PCPDMAUDIOPCMPROPS pProps, uint64_t fOpen);
-int     AudioHlpFileCreate(AUDIOHLPFILETYPE enmType, const char *pszFile, uint32_t fFlags, PAUDIOHLPFILE *ppFile);
+                                    PCPDMAUDIOPCMPROPS pProps, uint64_t fOpen, const char *pszName, ...);
+int     AudioHlpFileCreateF(PAUDIOHLPFILE *ppFile, uint32_t fFlags, AUDIOHLPFILETYPE enmType,
+                            const char *pszPath, uint32_t fFilename, uint32_t uInstance, const char *pszFileFmt, ...);
+
 void    AudioHlpFileDestroy(PAUDIOHLPFILE pFile);
 int     AudioHlpFileOpen(PAUDIOHLPFILE pFile, uint32_t fOpen, PCPDMAUDIOPCMPROPS pProps);
Index: trunk/src/VBox/Devices/Audio/DevHdaStream.cpp
===================================================================
--- trunk/src/VBox/Devices/Audio/DevHdaStream.cpp	(revision 90010)
+++ trunk/src/VBox/Devices/Audio/DevHdaStream.cpp	(revision 90011)
@@ -108,44 +108,19 @@
     if (pStreamR3->Dbg.Runtime.fEnabled)
     {
-        char szFile[64];
-        char szPath[RTPATH_MAX];
-
-        /* pFileStream */
-        if (fIsInput)
-            RTStrPrintf(szFile, sizeof(szFile), "hdaStreamWriteSD%RU8", uSD);
-        else
-            RTStrPrintf(szFile, sizeof(szFile), "hdaStreamReadSD%RU8", uSD);
-
-        int rc2 = AudioHlpFileNameGet(szPath, sizeof(szPath), pThisCC->Dbg.pszOutPath, szFile,
-                                      0 /* uInst */, AUDIOHLPFILETYPE_WAV, AUDIOHLPFILENAME_FLAGS_NONE);
+        int rc2 = AudioHlpFileCreateF(&pStreamR3->Dbg.Runtime.pFileStream, AUDIOHLPFILE_FLAGS_NONE, AUDIOHLPFILETYPE_WAV,
+                                      pThisCC->Dbg.pszOutPath, AUDIOHLPFILENAME_FLAGS_NONE, 0 /*uInstance*/,
+                                      fIsInput ? "hdaStreamWriteSD%RU8" : "hdaStreamReadSD%RU8", uSD);
         AssertRC(rc2);
 
-        rc2 = AudioHlpFileCreate(AUDIOHLPFILETYPE_WAV, szPath, AUDIOHLPFILE_FLAGS_NONE, &pStreamR3->Dbg.Runtime.pFileStream);
+        /* pFileDMARaw */
+        rc2 = AudioHlpFileCreateF(&pStreamR3->Dbg.Runtime.pFileDMARaw, AUDIOHLPFILE_FLAGS_NONE, AUDIOHLPFILETYPE_WAV,
+                                  pThisCC->Dbg.pszOutPath, AUDIOHLPFILENAME_FLAGS_NONE, 0 /*uInstance*/,
+                                  fIsInput ? "hdaDMARawWriteSD%RU8" : "hdaDMARawReadSD%RU8", uSD);
         AssertRC(rc2);
 
-        /* pFileDMARaw */
-        if (fIsInput)
-            RTStrPrintf(szFile, sizeof(szFile), "hdaDMARawWriteSD%RU8", uSD);
-        else
-            RTStrPrintf(szFile, sizeof(szFile), "hdaDMARawReadSD%RU8", uSD);
-
-        rc2 = AudioHlpFileNameGet(szPath, sizeof(szPath), pThisCC->Dbg.pszOutPath, szFile,
-                                  0 /* uInst */, AUDIOHLPFILETYPE_WAV, AUDIOHLPFILENAME_FLAGS_NONE);
-        AssertRC(rc2);
-
-        rc2 = AudioHlpFileCreate(AUDIOHLPFILETYPE_WAV, szPath, AUDIOHLPFILE_FLAGS_NONE, &pStreamR3->Dbg.Runtime.pFileDMARaw);
-        AssertRC(rc2);
-
         /* pFileDMAMapped */
-        if (fIsInput)
-            RTStrPrintf(szFile, sizeof(szFile), "hdaDMAWriteMappedSD%RU8", uSD);
-        else
-            RTStrPrintf(szFile, sizeof(szFile), "hdaDMAReadMappedSD%RU8", uSD);
-
-        rc2 = AudioHlpFileNameGet(szPath, sizeof(szPath), pThisCC->Dbg.pszOutPath, szFile,
-                                  0 /* uInst */, AUDIOHLPFILETYPE_WAV, AUDIOHLPFILENAME_FLAGS_NONE);
-        AssertRC(rc2);
-
-        rc2 = AudioHlpFileCreate(AUDIOHLPFILETYPE_WAV, szPath, AUDIOHLPFILE_FLAGS_NONE, &pStreamR3->Dbg.Runtime.pFileDMAMapped);
+        rc2 = AudioHlpFileCreateF(&pStreamR3->Dbg.Runtime.pFileDMAMapped, AUDIOHLPFILE_FLAGS_NONE, AUDIOHLPFILETYPE_WAV,
+                                  pThisCC->Dbg.pszOutPath, AUDIOHLPFILENAME_FLAGS_NONE, 0 /*uInstance*/,
+                                  fIsInput ? "hdaDMAWriteMappedSD%RU8" : "hdaDMAReadMappedSD%RU8", uSD);
         AssertRC(rc2);
 
Index: trunk/src/VBox/Devices/Audio/DevIchAc97.cpp
===================================================================
--- trunk/src/VBox/Devices/Audio/DevIchAc97.cpp	(revision 90010)
+++ trunk/src/VBox/Devices/Audio/DevIchAc97.cpp	(revision 90011)
@@ -2411,27 +2411,14 @@
     else
     {
-        char szFile[64];
-        if (ichac97R3GetDirFromSD(pStream->u8SD) == PDMAUDIODIR_IN)
-            RTStrPrintf(szFile, sizeof(szFile), "ac97StreamWriteSD%RU8", pStream->u8SD);
-        else
-            RTStrPrintf(szFile, sizeof(szFile), "ac97StreamReadSD%RU8", pStream->u8SD);
-
-        char szPath[RTPATH_MAX];
-        int rc2 = AudioHlpFileNameGet(szPath, sizeof(szPath), pThisCC->Dbg.pszOutPath, szFile,
-                                      0 /* uInst */, AUDIOHLPFILETYPE_WAV, AUDIOHLPFILENAME_FLAGS_NONE);
+        int rc2 = AudioHlpFileCreateF(&pStreamCC->Dbg.Runtime.pFileStream, AUDIOHLPFILE_FLAGS_NONE, AUDIOHLPFILETYPE_WAV,
+                                      pThisCC->Dbg.pszOutPath, AUDIOHLPFILENAME_FLAGS_NONE, 0 /*uInstance*/,
+                                      ichac97R3GetDirFromSD(pStream->u8SD) == PDMAUDIODIR_IN
+                                      ? "ac97StreamWriteSD%RU8" : "ac97StreamReadSD%RU8", pStream->u8SD);
         AssertRC(rc2);
-        rc2 = AudioHlpFileCreate(AUDIOHLPFILETYPE_WAV, szPath, AUDIOHLPFILE_FLAGS_NONE, &pStreamCC->Dbg.Runtime.pFileStream);
-        AssertRC(rc2);
-
-        if (ichac97R3GetDirFromSD(pStream->u8SD) == PDMAUDIODIR_IN)
-            RTStrPrintf(szFile, sizeof(szFile), "ac97DMAWriteSD%RU8", pStream->u8SD);
-        else
-            RTStrPrintf(szFile, sizeof(szFile), "ac97DMAReadSD%RU8", pStream->u8SD);
-
-        rc2 = AudioHlpFileNameGet(szPath, sizeof(szPath), pThisCC->Dbg.pszOutPath, szFile,
-                                  0 /* uInst */, AUDIOHLPFILETYPE_WAV, AUDIOHLPFILENAME_FLAGS_NONE);
-        AssertRC(rc2);
-
-        rc2 = AudioHlpFileCreate(AUDIOHLPFILETYPE_WAV, szPath, AUDIOHLPFILE_FLAGS_NONE, &pStreamCC->Dbg.Runtime.pFileDMA);
+
+        rc2 = AudioHlpFileCreateF(&pStreamCC->Dbg.Runtime.pFileDMA, AUDIOHLPFILE_FLAGS_NONE, AUDIOHLPFILETYPE_WAV,
+                                  pThisCC->Dbg.pszOutPath, AUDIOHLPFILENAME_FLAGS_NONE, 0 /*uInstance*/,
+                                  ichac97R3GetDirFromSD(pStream->u8SD) == PDMAUDIODIR_IN
+                                  ? "ac97DMAWriteSD%RU8" : "ac97DMAReadSD%RU8", pStream->u8SD);
         AssertRC(rc2);
 
Index: trunk/src/VBox/Devices/Audio/DevSB16.cpp
===================================================================
--- trunk/src/VBox/Devices/Audio/DevSB16.cpp	(revision 90010)
+++ trunk/src/VBox/Devices/Audio/DevSB16.cpp	(revision 90011)
@@ -2065,16 +2065,8 @@
     else
     {
-        char szFile[64];
-
-        if (sb16GetDirFromIndex(pStream->uIdx) == PDMAUDIODIR_IN)
-            RTStrPrintf(szFile, sizeof(szFile), "sb16StreamWriteSD%RU8", pStream->uIdx);
-        else
-            RTStrPrintf(szFile, sizeof(szFile), "sb16StreamReadSD%RU8", pStream->uIdx);
-
-        char szPath[RTPATH_MAX];
-        int rc2 = AudioHlpFileNameGet(szPath, sizeof(szPath), pThis->Dbg.pszOutPath, szFile,
-                                      0 /* uInst */, AUDIOHLPFILETYPE_WAV, AUDIOHLPFILENAME_FLAGS_NONE);
-        AssertRC(rc2);
-        rc2 = AudioHlpFileCreate(AUDIOHLPFILETYPE_WAV, szPath, AUDIOHLPFILE_FLAGS_NONE, &pStream->Dbg.Runtime.pFileDMA);
+        int rc2 = AudioHlpFileCreateF(&pStream->Dbg.Runtime.pFileDMA, AUDIOHLPFILE_FLAGS_NONE, AUDIOHLPFILETYPE_WAV,
+                                      pThis->Dbg.pszOutPath, AUDIOHLPFILENAME_FLAGS_NONE, 0 /*uInstance*/,
+                                      sb16GetDirFromIndex(pStream->uIdx) == PDMAUDIODIR_IN
+                                      ? "sb16StreamWriteSD%RU8" : "sb16StreamReadSD%RU8", pStream->uIdx);
         AssertRC(rc2);
 
Index: trunk/src/VBox/Devices/Audio/DrvHostAudioDebug.cpp
===================================================================
--- trunk/src/VBox/Devices/Audio/DrvHostAudioDebug.cpp	(revision 90010)
+++ trunk/src/VBox/Devices/Audio/DrvHostAudioDebug.cpp	(revision 90011)
@@ -118,7 +118,7 @@
 
     int rc = AudioHlpFileCreateAndOpenEx(&pStreamDbg->pFile, AUDIOHLPFILETYPE_WAV, NULL /*use temp dir*/,
-                                         pCfgReq->enmDir == PDMAUDIODIR_IN ? "DebugAudioIn" : "DebugAudioOut",
                                          pThis->pDrvIns->iInstance, AUDIOHLPFILENAME_FLAGS_NONE, AUDIOHLPFILE_FLAGS_NONE,
-                                         &pCfgReq->Props, RTFILE_O_WRITE | RTFILE_O_DENY_WRITE | RTFILE_O_CREATE_REPLACE);
+                                         &pCfgReq->Props, RTFILE_O_WRITE | RTFILE_O_DENY_WRITE | RTFILE_O_CREATE_REPLACE,
+                                         pCfgReq->enmDir == PDMAUDIODIR_IN ? "DebugAudioIn" : "DebugAudioOut");
     if (RT_FAILURE(rc))
         LogRel(("DebugAudio: Failed to creating debug file for %s stream '%s' in the temp directory: %Rrc\n",
