Changeset 70013 in vbox
- Timestamp:
- Dec 8, 2017 11:52:00 AM (7 years ago)
- svn:sync-xref-src-repo-rev:
- 119542
- Location:
- trunk
- Files:
-
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/VBox/vmm/pdmaudioifs.h
r69956 r70013 137 137 #include <iprt/circbuf.h> 138 138 #include <iprt/list.h> 139 #include <iprt/path.h> 139 140 140 141 #include <VBox/types.h> … … 741 742 uint32_t cChildren; 742 743 /** Intermediate structure for buffer conversion tasks. */ 743 PPDMAUDIOSTREAMRATE 744 PPDMAUDIOSTREAMRATE pRate; 744 745 /** Internal representation of current volume used for mixing. */ 745 746 PDMAUDMIXBUFVOL Volume; … … 767 768 typedef uint32_t PDMAUDIOFILEFLAGS; 768 769 769 /* No flags defined. */ 770 #define PDMAUDIOFILEFLAG_NONE 0 770 /** No flags defined. */ 771 #define PDMAUDIOFILE_FLAG_NONE 0 772 /** Keep the audio file even if it contains no audio data. */ 773 #define PDMAUDIOFILE_FLAG_KEEP_IF_EMPTY RT_BIT(0) 774 /** Audio file flag validation mask. */ 775 #define PDMAUDIOFILE_FLAG_VALID_MASK 0x1 771 776 772 777 /** … … 777 782 /** Unknown type, do not use. */ 778 783 PDMAUDIOFILETYPE_UNKNOWN = 0, 784 /** Raw (PCM) file. */ 785 PDMAUDIOFILETYPE_RAW, 779 786 /** Wave (.WAV) file. */ 780 787 PDMAUDIOFILETYPE_WAV, … … 783 790 } PDMAUDIOFILETYPE; 784 791 792 typedef uint32_t PDMAUDIOFILENAMEFLAGS; 793 794 /** No flags defined. */ 795 #define PDMAUDIOFILENAME_FLAG_NONE 0 796 /** Adds an ISO timestamp to the file name. */ 797 #define PDMAUDIOFILENAME_FLAG_TS RT_BIT(0) 798 785 799 /** 786 800 * Structure for an audio file handle. … … 789 803 { 790 804 /** Type of the audio file. */ 791 PDMAUDIOFILETYPE enmType; 792 /** File name. */ 793 char szName[255]; 805 PDMAUDIOFILETYPE enmType; 806 /** Audio file flags. */ 807 PDMAUDIOFILEFLAGS fFlags; 808 /** File name and path. */ 809 char szName[RTPATH_MAX + 1]; 794 810 /** Actual file handle. */ 795 RTFILE hFile;811 RTFILE hFile; 796 812 /** Data needed for the specific audio file type implemented. 797 813 * Optional, can be NULL. */ 798 void *pvData;814 void *pvData; 799 815 /** Data size (in bytes). */ 800 size_t cbData;816 size_t cbData; 801 817 } PDMAUDIOFILE, *PPDMAUDIOFILE; 802 818 … … 875 891 STAMCOUNTER StatFramesCaptured; 876 892 #endif 893 struct 894 { 895 /** File for writing stream reads. */ 896 PPDMAUDIOFILE pFileStreamRead; 897 /** File for writing non-interleaved captures. */ 898 PPDMAUDIOFILE pFileCaptureNonInterleaved; 899 } Dbg; 877 900 } PDMAUDIOSTREAMIN, *PPDMAUDIOSTREAMIN; 878 901 … … 890 913 STAMCOUNTER StatFramesPlayed; 891 914 #endif 915 struct 916 { 917 /** File for writing stream writes. */ 918 PPDMAUDIOFILE pFileStreamWrite; 919 /** File for writing stream playback. */ 920 PPDMAUDIOFILE pFilePlayNonInterleaved; 921 } Dbg; 892 922 } PDMAUDIOSTREAMOUT, *PPDMAUDIOSTREAMOUT; 893 923 -
trunk/src/VBox/Devices/Audio/DevHDA.cpp
r69948 r70013 2841 2841 # endif 2842 2842 2843 # ifdef VBOX_AUDIO_DEBUG_DUMP_PCM_DATA 2844 RTFILE fh; 2845 RTFileOpen(&fh, VBOX_AUDIO_DEBUG_DUMP_PCM_DATA_PATH "hdaDMAAccessWrite.pcm", 2846 RTFILE_O_OPEN_CREATE | RTFILE_O_APPEND | RTFILE_O_WRITE | RTFILE_O_DENY_NONE); 2847 RTFileWrite(fh, pvBuf, cbBuf, NULL); 2848 RTFileClose(fh); 2849 # endif 2843 if (pThis->fDebugEnabled) 2844 { 2845 RTFILE fh; 2846 RTFileOpen(&fh, VBOX_AUDIO_DEBUG_DUMP_PCM_DATA_PATH "hdaDMAAccessWrite.pcm", 2847 RTFILE_O_OPEN_CREATE | RTFILE_O_APPEND | RTFILE_O_WRITE | RTFILE_O_DENY_NONE); 2848 RTFileWrite(fh, pvBuf, cbBuf, NULL); 2849 RTFileClose(fh); 2850 } 2850 2851 2851 2852 # ifdef HDA_USE_DMA_ACCESS_HANDLER_WRITING … … 4757 4758 "TimerHz\0" 4758 4759 "PosAdjustEnabled\0" 4759 "PosAdjustFrames\0")) 4760 "PosAdjustFrames\0" 4761 "DebugEnabled\0" 4762 "DebugPathOut\0")) 4760 4763 { 4761 4764 return PDMDEV_SET_ERROR(pDevIns, VERR_PDM_DEVINS_UNKNOWN_CFG_VALUES, … … 4777 4780 N_("HDA configuration error: failed to read Hertz (Hz) rate as unsigned integer")); 4778 4781 4779 4780 4781 4782 4783 4784 4782 if (pThis->u16TimerHz != HDA_TIMER_HZ_DEFAULT) 4783 LogRel(("HDA: Using custom device timer rate (%RU16Hz)\n", pThis->u16TimerHz)); 4784 4785 rc = CFGMR3QueryBoolDef(pCfg, "PosAdjustEnabled", &pThis->fPosAdjustEnabled, true); 4786 if (RT_FAILURE(rc)) 4787 return PDMDEV_SET_ERROR(pDevIns, rc, 4785 4788 N_("HDA configuration error: failed to read position adjustment enabled as boolean")); 4786 4789 4787 if (!pThis->fPosAdjustEnabled) 4788 LogRel(("HDA: Position adjustment is disabled\n")); 4789 4790 rc = CFGMR3QueryU16Def(pCfg, "PosAdjustFrames", &pThis->cPosAdjustFrames, HDA_POS_ADJUST_DEFAULT); 4791 if (RT_FAILURE(rc)) 4792 return PDMDEV_SET_ERROR(pDevIns, rc, 4793 N_("HDA configuration error: failed to read position adjustment frames as unsigned integer")); 4794 4795 if (pThis->cPosAdjustFrames) 4796 LogRel(("HDA: Using custom position adjustment (%RU16 audio frames)\n", pThis->cPosAdjustFrames)); 4790 if (!pThis->fPosAdjustEnabled) 4791 LogRel(("HDA: Position adjustment is disabled\n")); 4792 4793 rc = CFGMR3QueryU16Def(pCfg, "PosAdjustFrames", &pThis->cPosAdjustFrames, HDA_POS_ADJUST_DEFAULT); 4794 if (RT_FAILURE(rc)) 4795 return PDMDEV_SET_ERROR(pDevIns, rc, 4796 N_("HDA configuration error: failed to read position adjustment frames as unsigned integer")); 4797 4798 if (pThis->cPosAdjustFrames) 4799 LogRel(("HDA: Using custom position adjustment (%RU16 audio frames)\n", pThis->cPosAdjustFrames)); 4800 4801 rc = CFGMR3QueryBoolDef(pCfg, "DebugEnabled", &pThis->Dbg.fEnabled, false); 4802 if (RT_FAILURE(rc)) 4803 return PDMDEV_SET_ERROR(pDevIns, rc, 4804 N_("HDA configuration error: failed to read debugging enabled flag as boolean")); 4805 4806 rc = CFGMR3QueryStringDef(pCfg, "DebugPathOut", pThis->Dbg.szOutPath, sizeof(pThis->Dbg.szOutPath), 4807 VBOX_AUDIO_DEBUG_DUMP_PCM_DATA_PATH); 4808 if (RT_FAILURE(rc)) 4809 return PDMDEV_SET_ERROR(pDevIns, rc, 4810 N_("HDA configuration error: failed to read debugging output path flag as string")); 4811 4812 if (!strlen(pThis->Dbg.szOutPath)) 4813 RTStrPrintf(pThis->Dbg.szOutPath, sizeof(pThis->Dbg.szOutPath), VBOX_AUDIO_DEBUG_DUMP_PCM_DATA_PATH); 4814 4815 if (pThis->Dbg.fEnabled) 4816 LogRel2(("HDA: Debug output will be saved to '%s'\n", pThis->Dbg.szOutPath)); 4797 4817 4798 4818 /* … … 5028 5048 for (uint8_t i = 0; i < HDA_MAX_STREAMS; ++i) 5029 5049 { 5030 rc = hdaStreamCreate(&pThis->aStreams[i], pThis );5050 rc = hdaStreamCreate(&pThis->aStreams[i], pThis, i /* u8SD */); 5031 5051 AssertRC(rc); 5032 5052 } … … 5250 5270 } 5251 5271 # endif 5252 5253 #ifdef VBOX_AUDIO_DEBUG_DUMP_PCM_DATA5254 RTFileDelete(VBOX_AUDIO_DEBUG_DUMP_PCM_DATA_PATH "hdaDMARead.pcm");5255 RTFileDelete(VBOX_AUDIO_DEBUG_DUMP_PCM_DATA_PATH "hdaDMAWrite.pcm");5256 RTFileDelete(VBOX_AUDIO_DEBUG_DUMP_PCM_DATA_PATH "hdaStreamRead.pcm");5257 RTFileDelete(VBOX_AUDIO_DEBUG_DUMP_PCM_DATA_PATH "hdaStreamWrite.pcm");5258 #endif5259 5272 5260 5273 LogFlowFuncLeaveRC(rc); -
trunk/src/VBox/Devices/Audio/DevHDA.h
r69919 r70013 22 22 * Header Files * 23 23 *********************************************************************************************************************************/ 24 #include <iprt/path.h> 25 24 26 #include <VBox/vmm/pdmdev.h> 25 27 … … 100 102 uint64_t tsDeassertedTotalNs; 101 103 } IRQ; 104 /** Whether debugging is enabled or not. */ 105 bool fEnabled; 106 /** Path where to dump the debug output to. 107 * Defaults to VBOX_AUDIO_DEBUG_DUMP_PCM_DATA_PATH. */ 108 char szOutPath[RTPATH_MAX + 1]; 102 109 } HDASTATEDBGINFO, *PHDASTATEDBGINFO; 103 110 #endif … … 214 221 /** Padding for alignment. */ 215 222 uint8_t au8Padding3[3]; 216 #ifdef DEBUG217 223 HDASTATEDBGINFO Dbg; 218 #endif219 224 } HDASTATE, *PHDASTATE; 220 225 #endif /* !DEV_HDA_H */ -
trunk/src/VBox/Devices/Audio/DevHDACommon.cpp
r69919 r70013 26 26 #include <VBox/log.h> 27 27 28 #include "DrvAudio.h" 28 29 29 30 #include "DevHDA.h" … … 293 294 } 294 295 #endif 295 296 #ifdef VBOX_AUDIO_DEBUG_DUMP_PCM_DATA 297 RTFILE fh; 298 int rc2 = RTFileOpen(&fh, VBOX_AUDIO_DEBUG_DUMP_PCM_DATA_PATH "hdaDMARead.pcm", 299 RTFILE_O_OPEN_CREATE | RTFILE_O_APPEND | RTFILE_O_WRITE | RTFILE_O_DENY_NONE); 300 if (RT_SUCCESS(rc2)) 301 { 302 RTFileWrite(fh, (uint8_t *)pvBuf + cbReadTotal, cbChunk, NULL); 303 RTFileClose(fh); 304 } 305 else 306 AssertRC(rc2); 307 #endif 296 if (pStream->Dbg.Runtime.fEnabled) 297 DrvAudioHlpFileWrite(pStream->Dbg.Runtime.pFileDMA, (uint8_t *)pvBuf + cbReadTotal, cbChunk, 0 /* fFlags */); 308 298 309 299 #ifdef VBOX_WITH_STATISTICS … … 375 365 Assert((cbChunk >> 1) >= 1); 376 366 377 #ifdef VBOX_AUDIO_DEBUG_DUMP_PCM_DATA 378 RTFILE fh; 379 RTFileOpen(&fh, VBOX_AUDIO_DEBUG_DUMP_PCM_DATA_PATH "hdaDMAWrite.pcm", 380 RTFILE_O_OPEN_CREATE | RTFILE_O_APPEND | RTFILE_O_WRITE | RTFILE_O_DENY_NONE); 381 RTFileWrite(fh, pvBuf, cbChunk, NULL); 382 RTFileClose(fh); 383 #endif 367 if (pStream->Dbg.Runtime.fEnabled) 368 DrvAudioHlpFileWrite(pStream->Dbg.Runtime.pFileDMA, (uint8_t *)pvBuf + cbWrittenTotal, cbChunk, 0 /* fFlags */); 369 384 370 rc = PDMDevHlpPCIPhysWrite(pThis->CTX_SUFF(pDevIns), 385 371 addrChunk, (uint8_t *)pvBuf + cbWrittenTotal, cbChunk); -
trunk/src/VBox/Devices/Audio/DrvAudio.cpp
r69956 r70013 137 137 138 138 # endif /* unused */ 139 140 static char *drvAudioDbgGetFileNameA(PDRVAUDIO pThis, const char *pszPath, const char *pszSuffix);141 static void drvAudioDbgPCMDelete(PDRVAUDIO pThis, const char *pszPath, const char *pszSuffix);142 static void drvAudioDbgPCMDump(PDRVAUDIO pThis, const char *pszPath, const char *pszSuffix, const void *pvData, size_t cbData);143 139 144 140 #ifdef LOG_ENABLED … … 965 961 } 966 962 967 if (pThis-> fDebugEnabled)968 drvAudioDbgPCMDump(pThis, pThis->szDebugPathOut, "StreamWrite.pcm", pvBuf, cbBuf);963 if (pThis->Dbg.fEnabled) 964 DrvAudioHlpFileWrite(pHstStream->Out.Dbg.pFileStreamWrite, pvBuf, cbBuf, 0 /* fFlags */); 969 965 970 966 #ifdef VBOX_WITH_STATISTICS … … 1333 1329 } 1334 1330 1335 if (pThis-> fDebugEnabled)1336 drvAudioDbgPCMDump(pThis, pThis->szDebugPathOut, "PlayNonInterleaved.pcm", auBuf, cbPlayed);1331 if (pThis->Dbg.fEnabled) 1332 DrvAudioHlpFileWrite(pHstStream->Out.Dbg.pFilePlayNonInterleaved, auBuf, cbPlayed, 0 /* fFlags */); 1337 1333 1338 1334 AssertMsg(cbPlayed <= cbRead, ("Played more than available (%RU32 available but got %RU32)\n", cbRead, cbPlayed)); … … 1635 1631 else if (cbCaptured) 1636 1632 { 1637 if (pThis-> fDebugEnabled)1638 drvAudioDbgPCMDump(pThis, pThis->szDebugPathOut, "CaptureNonInterleaved.pcm", auBuf, cbCaptured);1633 if (pThis->Dbg.fEnabled) 1634 DrvAudioHlpFileWrite(pHstStream->In.Dbg.pFileCaptureNonInterleaved, auBuf, cbCaptured, 0 /* fFlags */); 1639 1635 1640 1636 Assert(cbCaptured <= cbBuf); … … 2089 2085 } 2090 2086 #endif /* VBOX_WITH_AUDIO_ENUM */ 2091 2092 /**2093 * Returns an unique file name for this given audio connector instance.2094 *2095 * @return Allocated file name. Must be free'd using RTStrFree().2096 * @param pThis Driver instance.2097 * @param pszPath Path name of the file to delete. The path must exist.2098 * @param pszSuffix File name suffix to use.2099 */2100 static char *drvAudioDbgGetFileNameA(PDRVAUDIO pThis, const char *pszPath, const char *pszSuffix)2101 {2102 char szFileName[64];2103 RTStrPrintf(szFileName, sizeof(szFileName), "drvAudio%RU32-%s", pThis->pDrvIns->iInstance, pszSuffix);2104 2105 char szFilePath[RTPATH_MAX];2106 int rc2 = RTStrCopy(szFilePath, sizeof(szFilePath), pszPath);2107 AssertRC(rc2);2108 rc2 = RTPathAppend(szFilePath, sizeof(szFilePath), szFileName);2109 AssertRC(rc2);2110 2111 return RTStrDup(szFilePath);2112 }2113 2114 /**2115 * Deletes a PCM audio dump file.2116 *2117 * @param pThis Driver instance.2118 * @param pszPath Path name of the file to delete. The path must exist.2119 * @param pszSuffix File name suffix to use.2120 */2121 static void drvAudioDbgPCMDelete(PDRVAUDIO pThis, const char *pszPath, const char *pszSuffix)2122 {2123 char *pszFileName = drvAudioDbgGetFileNameA(pThis, pszPath, pszSuffix);2124 AssertPtr(pszFileName);2125 2126 RTFileDelete(pszFileName);2127 2128 RTStrFree(pszFileName);2129 }2130 2131 /**2132 * Dumps (raw) PCM audio data into a file by appending.2133 * Every driver instance will have an own prefix to not introduce writing races.2134 *2135 * @param pThis Driver instance.2136 * @param pszPath Path name to save file to. The path must exist.2137 * @param pszSuffix File name suffix to use.2138 * @param pvData Pointer to PCM data to dump.2139 * @param cbData Size (in bytes) of PCM data to dump.2140 */2141 static void drvAudioDbgPCMDump(PDRVAUDIO pThis,2142 const char *pszPath, const char *pszSuffix, const void *pvData, size_t cbData)2143 {2144 if (!pvData || !cbData)2145 return;2146 2147 AssertPtr(pThis->pDrvIns);2148 2149 char *pszFileName = drvAudioDbgGetFileNameA(pThis, pszPath, pszSuffix);2150 AssertPtr(pszFileName);2151 2152 RTFILE fh;2153 int rc2 = RTFileOpen(&fh, pszFileName, RTFILE_O_OPEN_CREATE | RTFILE_O_APPEND | RTFILE_O_WRITE | RTFILE_O_DENY_NONE);2154 AssertRC(rc2);2155 if (RT_SUCCESS(rc2))2156 {2157 RTFileWrite(fh, pvData, cbData, NULL);2158 RTFileClose(fh);2159 }2160 2161 RTStrFree(pszFileName);2162 }2163 2087 2164 2088 /** … … 2297 2221 CFGMR3QueryBoolDef(pCfgHandle, "OutputEnabled", &pThis->Out.fEnabled, false); 2298 2222 2299 CFGMR3QueryBoolDef(pCfgHandle, "DebugEnabled", &pThis->fDebugEnabled, false); 2300 rc2 = CFGMR3QueryString(pCfgHandle, "DebugPathOut", pThis->szDebugPathOut, sizeof(pThis->szDebugPathOut)); 2301 if (RT_FAILURE(rc2)) 2302 RTStrPrintf(pThis->szDebugPathOut, sizeof(pThis->szDebugPathOut), VBOX_AUDIO_DEBUG_DUMP_PCM_DATA_PATH); 2303 2304 if (pThis->fDebugEnabled) 2305 LogRel(("Audio: Debugging enabled (audio data written to '%s')\n", pThis->szDebugPathOut)); 2223 CFGMR3QueryBoolDef(pCfgHandle, "DebugEnabled", &pThis->Dbg.fEnabled, false); 2224 rc2 = CFGMR3QueryString(pCfgHandle, "DebugPathOut", pThis->Dbg.szPathOut, sizeof(pThis->Dbg.szPathOut)); 2225 if ( RT_FAILURE(rc2) 2226 || !strlen(pThis->Dbg.szPathOut)) 2227 { 2228 RTStrPrintf(pThis->Dbg.szPathOut, sizeof(pThis->Dbg.szPathOut), VBOX_AUDIO_DEBUG_DUMP_PCM_DATA_PATH); 2229 } 2230 2231 if (pThis->Dbg.fEnabled) 2232 LogRel(("Audio: Debugging enabled (audio data written to '%s')\n", pThis->Dbg.szPathOut)); 2306 2233 2307 2234 LogRel2(("Audio: Initial status for driver '%s': Input is %s, output is %s\n", … … 2399 2326 if (cReadTotal) 2400 2327 { 2401 if (pThis-> fDebugEnabled)2402 drvAudioDbgPCMDump(pThis, pThis->szDebugPathOut, "StreamRead.pcm",2403 pvBuf, AUDIOMIXBUF_F2B(&pGstStream->MixBuf, cReadTotal));2328 if (pThis->Dbg.fEnabled) 2329 DrvAudioHlpFileWrite(pHstStream->In.Dbg.pFileStreamRead, 2330 pvBuf, AUDIOMIXBUF_F2B(&pGstStream->MixBuf, cReadTotal), 0 /* fFlags */); 2404 2331 2405 2332 AudioMixBufFinish(&pGstStream->MixBuf, cReadTotal); … … 2630 2557 if (pCfgHost->enmDir == PDMAUDIODIR_IN) 2631 2558 { 2559 if (pThis->Dbg.fEnabled) 2560 { 2561 char szFile[RTPATH_MAX + 1]; 2562 2563 int rc2 = DrvAudioHlpGetFileName(szFile, RT_ELEMENTS(szFile), pThis->Dbg.szPathOut, "CaptureNonInterleaved", 2564 pThis->pDrvIns->iInstance, PDMAUDIOFILETYPE_WAV, PDMAUDIOFILENAME_FLAG_NONE); 2565 if (RT_SUCCESS(rc2)) 2566 { 2567 rc2 = DrvAudioHlpFileCreate(PDMAUDIOFILETYPE_WAV, szFile, PDMAUDIOFILE_FLAG_NONE, 2568 &pHstStrm->In.Dbg.pFileCaptureNonInterleaved); 2569 if (RT_SUCCESS(rc2)) 2570 rc2 = DrvAudioHlpFileOpen(pHstStrm->In.Dbg.pFileCaptureNonInterleaved, 2571 RTFILE_O_WRITE | RTFILE_O_DENY_WRITE | RTFILE_O_CREATE_REPLACE, &pHstStrm->Cfg.Props); 2572 } 2573 2574 if (RT_SUCCESS(rc2)) 2575 { 2576 rc2 = DrvAudioHlpGetFileName(szFile, RT_ELEMENTS(szFile), pThis->Dbg.szPathOut, "StreamRead", 2577 pThis->pDrvIns->iInstance, PDMAUDIOFILETYPE_WAV, PDMAUDIOFILENAME_FLAG_NONE); 2578 if (RT_SUCCESS(rc2)) 2579 { 2580 rc2 = DrvAudioHlpFileCreate(PDMAUDIOFILETYPE_WAV, szFile, PDMAUDIOFILE_FLAG_NONE, 2581 &pHstStrm->In.Dbg.pFileStreamRead); 2582 if (RT_SUCCESS(rc2)) 2583 rc2 = DrvAudioHlpFileOpen(pHstStrm->In.Dbg.pFileStreamRead, 2584 RTFILE_O_WRITE | RTFILE_O_DENY_WRITE | RTFILE_O_CREATE_REPLACE, &pHstStrm->Cfg.Props); 2585 } 2586 } 2587 } 2588 2632 2589 if (pThis->In.cStreamsFree) 2633 2590 pThis->In.cStreamsFree--; … … 2635 2592 else /* Out */ 2636 2593 { 2594 if (pThis->Dbg.fEnabled) 2595 { 2596 char szFile[RTPATH_MAX + 1]; 2597 2598 int rc2 = DrvAudioHlpGetFileName(szFile, RT_ELEMENTS(szFile), pThis->Dbg.szPathOut, "PlayNonInterleaved", 2599 pThis->pDrvIns->iInstance, PDMAUDIOFILETYPE_WAV, PDMAUDIOFILENAME_FLAG_NONE); 2600 if (RT_SUCCESS(rc2)) 2601 { 2602 rc2 = DrvAudioHlpFileCreate(PDMAUDIOFILETYPE_WAV, szFile, PDMAUDIOFILE_FLAG_NONE, 2603 &pHstStrm->Out.Dbg.pFilePlayNonInterleaved); 2604 if (RT_SUCCESS(rc2)) 2605 rc = DrvAudioHlpFileOpen(pHstStrm->Out.Dbg.pFilePlayNonInterleaved, 2606 RTFILE_O_WRITE | RTFILE_O_DENY_WRITE | RTFILE_O_CREATE_REPLACE, &pHstStrm->Cfg.Props); 2607 } 2608 2609 if (RT_SUCCESS(rc2)) 2610 { 2611 rc2 = DrvAudioHlpGetFileName(szFile, RT_ELEMENTS(szFile), pThis->Dbg.szPathOut, "StreamWrite", 2612 pThis->pDrvIns->iInstance, PDMAUDIOFILETYPE_WAV, PDMAUDIOFILENAME_FLAG_NONE); 2613 if (RT_SUCCESS(rc2)) 2614 { 2615 rc2 = DrvAudioHlpFileCreate(PDMAUDIOFILETYPE_WAV, szFile, PDMAUDIOFILE_FLAG_NONE, 2616 &pHstStrm->Out.Dbg.pFileStreamWrite); 2617 if (RT_SUCCESS(rc2)) 2618 rc2 = DrvAudioHlpFileOpen(pHstStrm->Out.Dbg.pFileStreamWrite, 2619 RTFILE_O_WRITE | RTFILE_O_DENY_WRITE | RTFILE_O_CREATE_REPLACE, &pHstStrm->Cfg.Props); 2620 } 2621 } 2622 } 2623 2637 2624 if (pThis->Out.cStreamsFree) 2638 2625 pThis->Out.cStreamsFree--; … … 2963 2950 if (RT_SUCCESS(rc)) 2964 2951 { 2965 #ifdef VBOX_WITH_STATISTICS2966 2952 if (pHstStream->enmDir == PDMAUDIODIR_IN) 2967 2953 { 2954 #ifdef VBOX_WITH_STATISTICS 2968 2955 PDMDrvHlpSTAMDeregister(pThis->pDrvIns, &pHstStream->In.StatFramesCaptured); 2956 #endif 2957 if (pThis->Dbg.fEnabled) 2958 { 2959 DrvAudioHlpFileDestroy(pHstStream->In.Dbg.pFileCaptureNonInterleaved); 2960 DrvAudioHlpFileDestroy(pHstStream->In.Dbg.pFileStreamRead); 2961 } 2969 2962 } 2970 2963 else if (pHstStream->enmDir == PDMAUDIODIR_OUT) 2971 2964 { 2965 #ifdef VBOX_WITH_STATISTICS 2972 2966 PDMDrvHlpSTAMDeregister(pThis->pDrvIns, &pHstStream->Out.StatFramesPlayed); 2967 #endif 2968 if (pThis->Dbg.fEnabled) 2969 { 2970 DrvAudioHlpFileDestroy(pHstStream->Out.Dbg.pFilePlayNonInterleaved); 2971 DrvAudioHlpFileDestroy(pHstStream->Out.Dbg.pFileStreamWrite); 2972 } 2973 2973 } 2974 2974 else 2975 2975 AssertFailed(); 2976 #endif 2976 2977 2977 RTListNodeRemove(&pHstStream->Node); 2978 2978 … … 3352 3352 STAMUNIT_NS_PER_CALL, "Profiling of output data processing."); 3353 3353 #endif 3354 3355 if (pThis->fDebugEnabled)3356 {3357 drvAudioDbgPCMDelete(pThis, pThis->szDebugPathOut, "StreamRead.pcm");3358 drvAudioDbgPCMDelete(pThis, pThis->szDebugPathOut, "StreamWrite.pcm");3359 drvAudioDbgPCMDelete(pThis, pThis->szDebugPathOut, "PlayNonInterleaved.pcm");3360 drvAudioDbgPCMDelete(pThis, pThis->szDebugPathOut, "CaptureNonInterleaved.pcm");3361 }3362 3354 } 3363 3355 -
trunk/src/VBox/Devices/Audio/DrvAudio.h
r69956 r70013 107 107 DRVAUDIOSTATS Stats; 108 108 #endif 109 /** Whether audio debugging is enabled or not. */110 bool fDebugEnabled;111 /** Where to store the debugging files.112 * Defaults to VBOX_AUDIO_DEBUG_DUMP_PCM_DATA_PATH if not set. */113 char szDebugPathOut[RTPATH_MAX + 1];114 109 struct 115 110 { … … 131 126 /** Max. number of free output streams. 132 127 * UINT32_MAX for unlimited streams. */ 133 uint32_tcStreamsFree;128 uint32_t cStreamsFree; 134 129 #ifdef VBOX_WITH_AUDIO_CALLBACKS 135 130 RTLISTANCHOR lstCB; 136 131 #endif 137 132 } Out; 133 struct 134 { 135 /** Whether audio debugging is enabled or not. */ 136 bool fEnabled; 137 /** Where to store the debugging files. 138 * Defaults to VBOX_AUDIO_DEBUG_DUMP_PCM_DATA_PATH if not set. */ 139 char szPathOut[RTPATH_MAX + 1]; 140 } Dbg; 138 141 } DRVAUDIO, *PDRVAUDIO; 139 142 … … 164 167 165 168 int DrvAudioHlpSanitizeFileName(char *pszPath, size_t cbPath); 166 int DrvAudioHlpGetFileName(char *pszFile, size_t cchFile, const char *pszPath, const char *pszName, PDMAUDIOFILETYPE enmType);169 int DrvAudioHlpGetFileName(char *pszFile, size_t cchFile, const char *pszPath, const char *pszName, uint32_t uInstance, PDMAUDIOFILETYPE enmType, PDMAUDIOFILENAMEFLAGS fFlags); 167 170 168 171 PPDMAUDIODEVICE DrvAudioHlpDeviceAlloc(size_t cbData); … … 185 188 char *DrvAudioHlpAudDevFlagsToStrA(PDMAUDIODEVFLAG fFlags); 186 189 187 int DrvAudioHlpWAVFileOpen(PPDMAUDIOFILE pFile, const char *pszFile, uint32_t fOpen, const PPDMAUDIOPCMPROPS pProps, PDMAUDIOFILEFLAGS fFlags); 188 int DrvAudioHlpWAVFileClose(PPDMAUDIOFILE pFile); 189 size_t DrvAudioHlpWAVFileGetDataSize(PPDMAUDIOFILE pFile); 190 int DrvAudioHlpWAVFileWrite(PPDMAUDIOFILE pFile, const void *pvBuf, size_t cbBuf, uint32_t fFlags); 190 int DrvAudioHlpFileCreate(PDMAUDIOFILETYPE enmType, const char *pszFile, PDMAUDIOFILEFLAGS fFlags, PPDMAUDIOFILE *ppFile); 191 void DrvAudioHlpFileDestroy(PPDMAUDIOFILE pFile); 192 int DrvAudioHlpFileOpen(PPDMAUDIOFILE pFile, uint32_t fOpen, const PPDMAUDIOPCMPROPS pProps); 193 int DrvAudioHlpFileClose(PPDMAUDIOFILE pFile); 194 int DrvAudioHlpFileDelete(PPDMAUDIOFILE pFile); 195 size_t DrvAudioHlpFileGetDataSize(PPDMAUDIOFILE pFile); 196 int DrvAudioHlpFileWrite(PPDMAUDIOFILE pFile, const void *pvBuf, size_t cbBuf, uint32_t fFlags); 191 197 192 198 #define AUDIO_MAKE_FOURCC(c0, c1, c2, c3) RT_H2LE_U32_C(RT_MAKE_U32_FROM_U8(c0, c1, c2, c3)) -
trunk/src/VBox/Devices/Audio/DrvAudioCommon.cpp
r69288 r70013 195 195 } 196 196 } 197 } 198 199 /** 200 * Returns an unique file name for this given audio connector instance. 201 * 202 * @return Allocated file name. Must be free'd using RTStrFree(). 203 * @param uInstance Driver / device instance. 204 * @param pszPath Path name of the file to delete. The path must exist. 205 * @param pszSuffix File name suffix to use. 206 */ 207 char *DrvAudioDbgGetFileNameA(uint8_t uInstance, const char *pszPath, const char *pszSuffix) 208 { 209 char szFileName[64]; 210 RTStrPrintf(szFileName, sizeof(szFileName), "drvAudio%RU8-%s", uInstance, pszSuffix); 211 212 char szFilePath[RTPATH_MAX]; 213 int rc2 = RTStrCopy(szFilePath, sizeof(szFilePath), pszPath); 214 AssertRC(rc2); 215 rc2 = RTPathAppend(szFilePath, sizeof(szFilePath), szFileName); 216 AssertRC(rc2); 217 218 return RTStrDup(szFilePath); 197 219 } 198 220 … … 1052 1074 * @param cchFile Size (in characters) of the file name buffer. 1053 1075 * @param pszPath Base path to use. 1054 * @param pszName A name for better identifying the file. Optional. 1076 * @param pszName A name for better identifying the file. 1077 * @param uInstance Device / driver instance which is using this file. 1055 1078 * @param enmType Audio file type to construct file name for. 1056 */ 1057 int DrvAudioHlpGetFileName(char *pszFile, size_t cchFile, const char *pszPath, const char *pszName, PDMAUDIOFILETYPE enmType) 1079 * @param fFlags File naming flags. 1080 */ 1081 int DrvAudioHlpGetFileName(char *pszFile, size_t cchFile, const char *pszPath, const char *pszName, 1082 uint32_t uInstance, PDMAUDIOFILETYPE enmType, PDMAUDIOFILENAMEFLAGS fFlags) 1058 1083 { 1059 1084 AssertPtrReturn(pszFile, VERR_INVALID_POINTER); 1060 1085 AssertReturn(cchFile, VERR_INVALID_PARAMETER); 1061 1086 AssertPtrReturn(pszPath, VERR_INVALID_POINTER); 1062 /* pszName is optional. */ 1087 AssertPtrReturn(pszName, VERR_INVALID_POINTER); 1088 /** @todo Validate fFlags. */ 1063 1089 1064 1090 int rc; … … 1066 1092 do 1067 1093 { 1068 char szFilePath[RTPATH_MAX ];1069 RTStrPrintf (szFilePath, sizeof(szFilePath), "%s", pszPath);1094 char szFilePath[RTPATH_MAX + 1]; 1095 RTStrPrintf2(szFilePath, sizeof(szFilePath), "%s", pszPath); 1070 1096 1071 1097 /* Create it when necessary. */ … … 1077 1103 } 1078 1104 1079 /* The actually drop directory consist of the current time stamp and a 1080 * unique number when necessary. */ 1081 char pszTime[64]; 1082 RTTIMESPEC time; 1083 if (!RTTimeSpecToString(RTTimeNow(&time), pszTime, sizeof(pszTime))) 1084 { 1085 rc = VERR_BUFFER_OVERFLOW; 1086 break; 1087 } 1088 1089 rc = DrvAudioHlpSanitizeFileName(pszTime, sizeof(pszTime)); 1090 if (RT_FAILURE(rc)) 1091 break; 1092 1093 rc = RTPathAppend(szFilePath, sizeof(szFilePath), pszTime); 1094 if (RT_FAILURE(rc)) 1095 break; 1096 1097 if (pszName) /* Optional name given? */ 1098 { 1105 if (fFlags & PDMAUDIOFILENAME_FLAG_TS) 1106 { 1107 char szTime[64]; 1108 RTTIMESPEC time; 1109 if (!RTTimeSpecToString(RTTimeNow(&time), szTime, sizeof(szTime))) 1110 { 1111 rc = VERR_BUFFER_OVERFLOW; 1112 break; 1113 } 1114 1115 rc = DrvAudioHlpSanitizeFileName(szTime, sizeof(szTime)); 1116 if (RT_FAILURE(rc)) 1117 break; 1118 1119 rc = RTStrCat(szFilePath, sizeof(szFilePath), szTime); 1120 if (RT_FAILURE(rc)) 1121 break; 1122 1099 1123 rc = RTStrCat(szFilePath, sizeof(szFilePath), "-"); 1100 1124 if (RT_FAILURE(rc)) 1101 1125 break; 1102 1103 rc = RTStrCat(szFilePath, sizeof(szFilePath), pszName); 1104 if (RT_FAILURE(rc)) 1126 } 1127 1128 rc = RTStrCat(szFilePath, sizeof(szFilePath), pszName); 1129 if (RT_FAILURE(rc)) 1130 break; 1131 1132 rc = RTStrCat(szFilePath, sizeof(szFilePath), "-"); 1133 if (RT_FAILURE(rc)) 1134 break; 1135 1136 char szInst[16]; 1137 RTStrPrintf2(szInst, sizeof(szInst), "%RU32", uInstance); 1138 rc = RTStrCat(szFilePath, sizeof(szFilePath), szInst); 1139 if (RT_FAILURE(rc)) 1140 break; 1141 1142 switch (enmType) 1143 { 1144 case PDMAUDIOFILETYPE_RAW: 1145 rc = RTStrCat(szFilePath, sizeof(szFilePath), ".pcm"); 1105 1146 break; 1106 } 1107 1108 switch (enmType) 1109 { 1147 1110 1148 case PDMAUDIOFILETYPE_WAV: 1111 1149 rc = RTStrCat(szFilePath, sizeof(szFilePath), ".wav"); … … 1114 1152 default: 1115 1153 AssertFailedStmt(rc = VERR_NOT_IMPLEMENTED); 1154 break; 1116 1155 } 1117 1156 … … 1119 1158 break; 1120 1159 1121 RTStrPrintf (pszFile, cchFile, "%s", szFilePath);1160 RTStrPrintf2(pszFile, cchFile, "%s", szFilePath); 1122 1161 1123 1162 } while (0); … … 1128 1167 1129 1168 /** 1130 * Opens or creates a wave (.WAV) file. 1169 * Creates an audio file. 1170 * 1171 * @returns IPRT status code. 1172 * @param enmType Audio file type to open / create. 1173 * @param pszFile File path of file to open or create. 1174 * @param fFlags Audio file flags. 1175 * @param ppFile Where to store the created audio file handle. 1176 * Needs to be destroyed with DrvAudioHlpFileDestroy(). 1177 */ 1178 int DrvAudioHlpFileCreate(PDMAUDIOFILETYPE enmType, const char *pszFile, PDMAUDIOFILEFLAGS fFlags, PPDMAUDIOFILE *ppFile) 1179 { 1180 AssertPtrReturn(pszFile, VERR_INVALID_POINTER); 1181 /** @todo Validate fFlags. */ 1182 1183 PPDMAUDIOFILE pFile = (PPDMAUDIOFILE)RTMemAlloc(sizeof(PDMAUDIOFILE)); 1184 if (!pFile) 1185 return VERR_NO_MEMORY; 1186 1187 int rc = VINF_SUCCESS; 1188 1189 switch (enmType) 1190 { 1191 case PDMAUDIOFILETYPE_RAW: 1192 case PDMAUDIOFILETYPE_WAV: 1193 pFile->enmType = enmType; 1194 break; 1195 1196 default: 1197 rc = VERR_INVALID_PARAMETER; 1198 break; 1199 } 1200 1201 if (RT_SUCCESS(rc)) 1202 { 1203 RTStrPrintf(pFile->szName, RT_ELEMENTS(pFile->szName), "%s", pszFile); 1204 pFile->fFlags = fFlags; 1205 } 1206 1207 if (RT_FAILURE(rc)) 1208 { 1209 RTMemFree(pFile); 1210 pFile = NULL; 1211 } 1212 else 1213 *ppFile = pFile; 1214 1215 return rc; 1216 } 1217 1218 /** 1219 * Destroys a formerly created audio file. 1220 * 1221 * @param pFile Audio file (object) to destroy. 1222 */ 1223 void DrvAudioHlpFileDestroy(PPDMAUDIOFILE pFile) 1224 { 1225 if (!pFile) 1226 return; 1227 1228 DrvAudioHlpFileClose(pFile); 1229 1230 RTMemFree(pFile); 1231 pFile = NULL; 1232 } 1233 1234 /** 1235 * Opens or creates an audio file. 1131 1236 * 1132 1237 * @returns IPRT status code. 1133 1238 * @param pFile Pointer to audio file handle to use. 1134 * @param pszFile File path of file to open or create.1135 1239 * @param fOpen Open flags. 1136 1240 * @param pProps PCM properties to use. 1137 * @param fFlags Audio file flags. 1138 */ 1139 int DrvAudioHlpWAVFileOpen(PPDMAUDIOFILE pFile, const char *pszFile, uint32_t fOpen, const PPDMAUDIOPCMPROPS pProps, 1140 PDMAUDIOFILEFLAGS fFlags) 1241 */ 1242 int DrvAudioHlpFileOpen(PPDMAUDIOFILE pFile, uint32_t fOpen, const PPDMAUDIOPCMPROPS pProps) 1141 1243 { 1142 1244 AssertPtrReturn(pFile, VERR_INVALID_POINTER); 1143 AssertPtrReturn(pszFile, VERR_INVALID_POINTER);1144 1245 /** @todo Validate fOpen flags. */ 1145 1246 AssertPtrReturn(pProps, VERR_INVALID_POINTER); 1146 RT_NOREF(fFlags); /** @todo Validate fFlags flags. */ 1147 1148 Assert(pProps->cChannels); 1149 Assert(pProps->uHz); 1150 Assert(pProps->cBits); 1151 1152 pFile->pvData = (PAUDIOWAVFILEDATA)RTMemAllocZ(sizeof(AUDIOWAVFILEDATA)); 1153 if (!pFile->pvData) 1154 return VERR_NO_MEMORY; 1155 pFile->cbData = sizeof(PAUDIOWAVFILEDATA); 1156 1157 PAUDIOWAVFILEDATA pData = (PAUDIOWAVFILEDATA)pFile->pvData; 1158 AssertPtr(pData); 1159 1160 /* Header. */ 1161 pData->Hdr.u32RIFF = AUDIO_MAKE_FOURCC('R','I','F','F'); 1162 pData->Hdr.u32Size = 36; 1163 pData->Hdr.u32WAVE = AUDIO_MAKE_FOURCC('W','A','V','E'); 1164 1165 pData->Hdr.u32Fmt = AUDIO_MAKE_FOURCC('f','m','t',' '); 1166 pData->Hdr.u32Size1 = 16; /* Means PCM. */ 1167 pData->Hdr.u16AudioFormat = 1; /* PCM, linear quantization. */ 1168 pData->Hdr.u16NumChannels = pProps->cChannels; 1169 pData->Hdr.u32SampleRate = pProps->uHz; 1170 pData->Hdr.u32ByteRate = DrvAudioHlpCalcBitrate(pProps->cBits, pProps->uHz, pProps->cChannels) / 8; 1171 pData->Hdr.u16BlockAlign = pProps->cChannels * pProps->cBits / 8; 1172 pData->Hdr.u16BitsPerSample = pProps->cBits; 1173 1174 /* Data chunk. */ 1175 pData->Hdr.u32ID2 = AUDIO_MAKE_FOURCC('d','a','t','a'); 1176 pData->Hdr.u32Size2 = 0; 1177 1178 int rc = RTFileOpen(&pFile->hFile, pszFile, fOpen); 1247 1248 int rc; 1249 1250 if (pFile->enmType == PDMAUDIOFILETYPE_RAW) 1251 { 1252 rc = RTFileOpen(&pFile->hFile, pFile->szName, fOpen); 1253 } 1254 else if (pFile->enmType == PDMAUDIOFILETYPE_WAV) 1255 { 1256 Assert(pProps->cChannels); 1257 Assert(pProps->uHz); 1258 Assert(pProps->cBits); 1259 1260 pFile->pvData = (PAUDIOWAVFILEDATA)RTMemAllocZ(sizeof(AUDIOWAVFILEDATA)); 1261 if (pFile->pvData) 1262 { 1263 pFile->cbData = sizeof(PAUDIOWAVFILEDATA); 1264 1265 PAUDIOWAVFILEDATA pData = (PAUDIOWAVFILEDATA)pFile->pvData; 1266 AssertPtr(pData); 1267 1268 /* Header. */ 1269 pData->Hdr.u32RIFF = AUDIO_MAKE_FOURCC('R','I','F','F'); 1270 pData->Hdr.u32Size = 36; 1271 pData->Hdr.u32WAVE = AUDIO_MAKE_FOURCC('W','A','V','E'); 1272 1273 pData->Hdr.u32Fmt = AUDIO_MAKE_FOURCC('f','m','t',' '); 1274 pData->Hdr.u32Size1 = 16; /* Means PCM. */ 1275 pData->Hdr.u16AudioFormat = 1; /* PCM, linear quantization. */ 1276 pData->Hdr.u16NumChannels = pProps->cChannels; 1277 pData->Hdr.u32SampleRate = pProps->uHz; 1278 pData->Hdr.u32ByteRate = DrvAudioHlpCalcBitrate(pProps->cBits, pProps->uHz, pProps->cChannels) / 8; 1279 pData->Hdr.u16BlockAlign = pProps->cChannels * pProps->cBits / 8; 1280 pData->Hdr.u16BitsPerSample = pProps->cBits; 1281 1282 /* Data chunk. */ 1283 pData->Hdr.u32ID2 = AUDIO_MAKE_FOURCC('d','a','t','a'); 1284 pData->Hdr.u32Size2 = 0; 1285 1286 rc = RTFileOpen(&pFile->hFile, pFile->szName, fOpen); 1287 if (RT_SUCCESS(rc)) 1288 { 1289 rc = RTFileWrite(pFile->hFile, &pData->Hdr, sizeof(pData->Hdr), NULL); 1290 if (RT_FAILURE(rc)) 1291 { 1292 RTFileClose(pFile->hFile); 1293 pFile->hFile = NIL_RTFILE; 1294 } 1295 } 1296 1297 if (RT_FAILURE(rc)) 1298 { 1299 RTMemFree(pFile->pvData); 1300 pFile->pvData = NULL; 1301 pFile->cbData = 0; 1302 } 1303 } 1304 else 1305 rc = VERR_NO_MEMORY; 1306 } 1307 else 1308 rc = VERR_INVALID_PARAMETER; 1309 1179 1310 if (RT_SUCCESS(rc)) 1180 1311 { 1181 rc = RTFileWrite(pFile->hFile, &pData->Hdr, sizeof(pData->Hdr), NULL); 1182 if (RT_FAILURE(rc)) 1183 { 1184 RTFileClose(pFile->hFile); 1185 pFile->hFile = NIL_RTFILE; 1186 } 1187 } 1188 1189 if (RT_SUCCESS(rc)) 1190 { 1191 pFile->enmType = PDMAUDIOFILETYPE_WAV; 1192 1193 RTStrPrintf(pFile->szName, RT_ELEMENTS(pFile->szName), "%s", pszFile); 1312 LogRel2(("Audio: Opened file '%s'\n", pFile->szName)); 1194 1313 } 1195 1314 else 1196 { 1197 RTMemFree(pFile->pvData); 1198 pFile->pvData = NULL; 1199 pFile->cbData = 0; 1200 } 1315 LogRel(("Audio: Failed opening file '%s', rc=%Rrc\n", pFile->szName, rc)); 1201 1316 1202 1317 return rc; … … 1204 1319 1205 1320 /** 1206 * Closes a wave (.WAV)audio file.1321 * Closes an audio file. 1207 1322 * 1208 1323 * @returns IPRT status code. 1209 1324 * @param pFile Audio file handle to close. 1210 1325 */ 1211 int DrvAudioHlp WAVFileClose(PPDMAUDIOFILE pFile)1326 int DrvAudioHlpFileClose(PPDMAUDIOFILE pFile) 1212 1327 { 1213 1328 AssertPtrReturn(pFile, VERR_INVALID_POINTER); 1214 1329 1215 Assert(pFile->enmType == PDMAUDIOFILETYPE_WAV); 1216 1217 if (pFile->hFile != NIL_RTFILE) 1330 size_t cbSize = DrvAudioHlpFileGetDataSize(pFile); 1331 1332 int rc; 1333 1334 if (pFile->enmType == PDMAUDIOFILETYPE_RAW) 1335 { 1336 if (pFile->hFile != NIL_RTFILE) 1337 { 1338 rc = RTFileClose(pFile->hFile); 1339 pFile->hFile = NIL_RTFILE; 1340 } 1341 } 1342 else if (pFile->enmType == PDMAUDIOFILETYPE_WAV) 1343 { 1344 if (pFile->hFile != NIL_RTFILE) 1345 { 1346 PAUDIOWAVFILEDATA pData = (PAUDIOWAVFILEDATA)pFile->pvData; 1347 AssertPtr(pData); 1348 1349 /* Update the header with the current data size. */ 1350 RTFileWriteAt(pFile->hFile, 0, &pData->Hdr, sizeof(pData->Hdr), NULL); 1351 1352 rc = RTFileClose(pFile->hFile); 1353 pFile->hFile = NIL_RTFILE; 1354 } 1355 1356 if (pFile->pvData) 1357 { 1358 RTMemFree(pFile->pvData); 1359 pFile->pvData = NULL; 1360 } 1361 } 1362 else 1363 AssertFailedStmt(rc = VERR_NOT_IMPLEMENTED); 1364 1365 if ( RT_SUCCESS(rc) 1366 && !cbSize 1367 && !(pFile->fFlags & PDMAUDIOFILE_FLAG_KEEP_IF_EMPTY)) 1368 { 1369 rc = DrvAudioHlpFileDelete(pFile); 1370 } 1371 1372 pFile->cbData = 0; 1373 1374 if (RT_SUCCESS(rc)) 1375 { 1376 LogRel2(("Audio: Closed file '%s' (%zu bytes)\n", pFile->szName, cbSize)); 1377 } 1378 else 1379 LogRel(("Audio: Failed closing file '%s', rc=%Rrc\n", pFile->szName, rc)); 1380 1381 return rc; 1382 } 1383 1384 /** 1385 * Deletes an audio file. 1386 * 1387 * @returns IPRT status code. 1388 * @param pFile Audio file handle to delete. 1389 */ 1390 int DrvAudioHlpFileDelete(PPDMAUDIOFILE pFile) 1391 { 1392 AssertPtrReturn(pFile, VERR_INVALID_POINTER); 1393 1394 int rc = RTFileDelete(pFile->szName); 1395 if (RT_FAILURE(rc)) 1396 LogRel(("Audio: Failed deleting file '%s', rc=%Rrc\n", pFile->szName, rc)); 1397 1398 return rc; 1399 } 1400 1401 /** 1402 * Returns the raw audio data size of an audio file. 1403 * 1404 * Note: This does *not* include file headers and other data which does 1405 * not belong to the actual PCM audio data. 1406 * 1407 * @returns Size (in bytes) of the raw PCM audio data. 1408 * @param pFile Audio file handle to retrieve the audio data size for. 1409 */ 1410 size_t DrvAudioHlpFileGetDataSize(PPDMAUDIOFILE pFile) 1411 { 1412 AssertPtrReturn(pFile, 0); 1413 1414 size_t cbSize = 0; 1415 1416 if (pFile->enmType == PDMAUDIOFILETYPE_RAW) 1417 { 1418 cbSize = RTFileTell(pFile->hFile); 1419 } 1420 else if (pFile->enmType == PDMAUDIOFILETYPE_WAV) 1218 1421 { 1219 1422 PAUDIOWAVFILEDATA pData = (PAUDIOWAVFILEDATA)pFile->pvData; 1220 1423 AssertPtr(pData); 1221 1424 1222 /* Update the header with the current data size. */ 1223 RTFileWriteAt(pFile->hFile, 0, &pData->Hdr, sizeof(pData->Hdr), NULL); 1224 1225 RTFileClose(pFile->hFile); 1226 pFile->hFile = NIL_RTFILE; 1227 } 1228 1229 if (pFile->pvData) 1230 { 1231 RTMemFree(pFile->pvData); 1232 pFile->pvData = NULL; 1233 } 1234 1235 pFile->cbData = 0; 1236 pFile->enmType = PDMAUDIOFILETYPE_UNKNOWN; 1237 1238 return VINF_SUCCESS; 1239 } 1240 1241 /** 1242 * Returns the raw PCM audio data size of a wave file. 1243 * This does *not* include file headers and other data which does 1244 * not belong to the actual PCM audio data. 1245 * 1246 * @returns Size (in bytes) of the raw PCM audio data. 1247 * @param pFile Audio file handle to retrieve the audio data size for. 1248 */ 1249 size_t DrvAudioHlpWAVFileGetDataSize(PPDMAUDIOFILE pFile) 1250 { 1251 AssertPtrReturn(pFile, 0); 1252 1253 Assert(pFile->enmType == PDMAUDIOFILETYPE_WAV); 1254 1255 PAUDIOWAVFILEDATA pData = (PAUDIOWAVFILEDATA)pFile->pvData; 1256 AssertPtr(pData); 1257 1258 return pData->Hdr.u32Size2; 1425 cbSize = pData->Hdr.u32Size2; 1426 } 1427 1428 return cbSize; 1259 1429 } 1260 1430 … … 1268 1438 * @param fFlags Additional write flags. Not being used at the moment and must be 0. 1269 1439 */ 1270 int DrvAudioHlp WAVFileWrite(PPDMAUDIOFILE pFile, const void *pvBuf, size_t cbBuf, uint32_t fFlags)1440 int DrvAudioHlpFileWrite(PPDMAUDIOFILE pFile, const void *pvBuf, size_t cbBuf, uint32_t fFlags) 1271 1441 { 1272 1442 AssertPtrReturn(pFile, VERR_INVALID_POINTER); … … 1275 1445 AssertReturn(fFlags == 0, VERR_INVALID_PARAMETER); /** @todo fFlags are currently not implemented. */ 1276 1446 1277 Assert(pFile->enmType == PDMAUDIOFILETYPE_WAV);1278 1279 1447 if (!cbBuf) 1280 1448 return VINF_SUCCESS; 1281 1449 1282 PAUDIOWAVFILEDATA pData = (PAUDIOWAVFILEDATA)pFile->pvData; 1283 AssertPtr(pData); 1284 1285 int rc = RTFileWrite(pFile->hFile, pvBuf, cbBuf, NULL); 1286 if (RT_SUCCESS(rc)) 1287 { 1288 pData->Hdr.u32Size += (uint32_t)cbBuf; 1289 pData->Hdr.u32Size2 += (uint32_t)cbBuf; 1290 } 1450 int rc; 1451 1452 if (pFile->enmType == PDMAUDIOFILETYPE_RAW) 1453 { 1454 rc = RTFileWrite(pFile->hFile, pvBuf, cbBuf, NULL); 1455 } 1456 else if (pFile->enmType == PDMAUDIOFILETYPE_WAV) 1457 { 1458 PAUDIOWAVFILEDATA pData = (PAUDIOWAVFILEDATA)pFile->pvData; 1459 AssertPtr(pData); 1460 1461 rc = RTFileWrite(pFile->hFile, pvBuf, cbBuf, NULL); 1462 if (RT_SUCCESS(rc)) 1463 { 1464 pData->Hdr.u32Size += (uint32_t)cbBuf; 1465 pData->Hdr.u32Size2 += (uint32_t)cbBuf; 1466 } 1467 } 1468 else 1469 rc = VERR_NOT_SUPPORTED; 1291 1470 1292 1471 return rc; -
trunk/src/VBox/Devices/Audio/DrvHostDebugAudio.cpp
r69119 r70013 37 37 PPDMAUDIOSTREAMCFG pCfg; 38 38 /** Audio file to dump output to or read input from. */ 39 P DMAUDIOFILEFile;39 PPDMAUDIOFILE pFile; 40 40 union 41 41 { … … 150 150 { 151 151 char szFile[RTPATH_MAX]; 152 rc = DrvAudioHlpGetFileName(szFile, RT_ELEMENTS(szFile), szTemp, NULL, PDMAUDIOFILETYPE_WAV); 152 rc = DrvAudioHlpGetFileName(szFile, RT_ELEMENTS(szFile), szTemp, "DebugAudioOut", 153 pDrv->pDrvIns->iInstance, PDMAUDIOFILETYPE_WAV, PDMAUDIOFILENAME_FLAG_NONE); 153 154 if (RT_SUCCESS(rc)) 154 155 { 155 LogFlowFunc(("%s\n", szFile)); 156 rc = DrvAudioHlpWAVFileOpen(&pStreamDbg->File, szFile, 157 RTFILE_O_WRITE | RTFILE_O_DENY_WRITE | RTFILE_O_CREATE_REPLACE, 158 &pCfgReq->Props, PDMAUDIOFILEFLAG_NONE); 156 rc = DrvAudioHlpFileCreate(PDMAUDIOFILETYPE_WAV, szFile, PDMAUDIOFILE_FLAG_NONE, &pStreamDbg->pFile); 157 if (RT_SUCCESS(rc)) 158 { 159 rc = DrvAudioHlpFileOpen(pStreamDbg->pFile, RTFILE_O_WRITE | RTFILE_O_DENY_WRITE | RTFILE_O_CREATE_REPLACE, 160 &pCfgReq->Props); 161 } 162 159 163 if (RT_FAILURE(rc)) 160 164 LogRel(("DebugAudio: Creating output file '%s' failed with %Rrc\n", szFile, rc)); … … 228 232 memcpy(pStreamDbg->Out.auPlayBuffer, (uint8_t *)pvBuf + cbWrittenTotal, cbChunk); 229 233 230 #ifdef VBOX_AUDIO_DEBUG_DUMP_PCM_DATA 231 RTFILE fh; 232 RTFileOpen(&fh, VBOX_AUDIO_DEBUG_DUMP_PCM_DATA_PATH "AudioDebugOutput.pcm", 233 RTFILE_O_OPEN_CREATE | RTFILE_O_APPEND | RTFILE_O_WRITE | RTFILE_O_DENY_NONE); 234 RTFileWrite(fh, pStreamDbg->Out.auPlayBuffer, cbChunk, NULL); 235 RTFileClose(fh); 236 #endif 237 int rc2 = DrvAudioHlpWAVFileWrite(&pStreamDbg->File, 238 pStreamDbg->Out.auPlayBuffer, cbChunk, 0 /* fFlags */); 234 int rc2 = DrvAudioHlpFileWrite(pStreamDbg->pFile, pStreamDbg->Out.auPlayBuffer, cbChunk, 0 /* fFlags */); 239 235 if (RT_FAILURE(rc2)) 240 236 { … … 289 285 } 290 286 291 size_t cbDataSize = DrvAudioHlpWAVFileGetDataSize(&pStreamDbg->File); 292 293 int rc = DrvAudioHlpWAVFileClose(&pStreamDbg->File); 294 if (RT_SUCCESS(rc)) 295 { 296 /* Delete the file again if nothing but the header was written to it. */ 297 bool fDeleteEmptyFiles = true; /** @todo Make deletion configurable? */ 298 299 if ( !cbDataSize 300 && fDeleteEmptyFiles) 301 { 302 rc = RTFileDelete(pStreamDbg->File.szName); 303 } 304 else 305 LogRel(("DebugAudio: Created output file '%s' (%zu bytes)\n", pStreamDbg->File.szName, cbDataSize)); 306 } 307 308 return rc; 287 DrvAudioHlpFileDestroy(pStreamDbg->pFile); 288 289 return VINF_SUCCESS; 309 290 } 310 291 -
trunk/src/VBox/Devices/Audio/DrvHostValidationKit.cpp
r69119 r70013 167 167 { 168 168 LogFlowFunc(("%s\n", szFile)); 169 rc = DrvAudioHlp WAVFileOpen(&pStreamDbg->File, szFile,170 171 &pCfgReq->Props, PDMAUDIOFILEFLAG_NONE);169 rc = DrvAudioHlpFileOpen(&pStreamDbg->File, PDMAUDIOFILETYPE_WAV, szFile, 170 RTFILE_O_WRITE | RTFILE_O_DENY_WRITE | RTFILE_O_CREATE_REPLACE, 171 &pCfgReq->Props, PDMAUDIOFILE_FLAG_NONE); 172 172 if (RT_FAILURE(rc)) 173 173 LogRel(("VaKitAudio: Creating output file '%s' failed with %Rrc\n", szFile, rc)); … … 277 277 // pStreamDbg->Out.tsLastPlayed = PDMDrvHlpTMGetVirtualTime(pDrv->pDrvIns);; 278 278 279 int rc2 = DrvAudioHlp WAVFileWrite(&pStreamDbg->File, pvBuf, cxBuf, 0 /* fFlags */);279 int rc2 = DrvAudioHlpFileWrite(&pStreamDbg->File, pvBuf, cxBuf, 0 /* fFlags */); 280 280 if (RT_FAILURE(rc2)) 281 281 LogRel(("DebugAudio: Writing output failed with %Rrc\n", rc2)); … … 321 321 } 322 322 323 size_t cbDataSize = DrvAudioHlp WAVFileGetDataSize(&pStreamDbg->File);324 325 int rc = DrvAudioHlp WAVFileClose(&pStreamDbg->File);323 size_t cbDataSize = DrvAudioHlpFileGetDataSize(&pStreamDbg->File); 324 325 int rc = DrvAudioHlpFileClose(&pStreamDbg->File); 326 326 RTFileClose(pStreamDbg->hFileTiming); 327 327 -
trunk/src/VBox/Devices/Audio/HDAStream.cpp
r69946 r70013 43 43 * @param pStream HDA stream to create. 44 44 * @param pThis HDA state to assign the HDA stream to. 45 */ 46 int hdaStreamCreate(PHDASTREAM pStream, PHDASTATE pThis) 45 * @param u8SD Stream descriptor number to assign. 46 */ 47 int hdaStreamCreate(PHDASTREAM pStream, PHDASTATE pThis, uint8_t u8SD) 47 48 { 48 49 RT_NOREF(pThis); 49 50 AssertPtrReturn(pStream, VERR_INVALID_POINTER); 50 51 51 pStream->u8SD = UINT8_MAX;52 pStream->u8SD = u8SD; 52 53 pStream->pMixSink = NULL; 53 54 pStream->pHDAState = pThis; … … 71 72 #endif 72 73 74 pStream->Dbg.Runtime.fEnabled = pThis->Dbg.fEnabled; 75 76 if (pStream->Dbg.Runtime.fEnabled) 77 { 78 char szFile[64]; 79 80 if (pStream->State.Cfg.enmDir == PDMAUDIODIR_IN) 81 RTStrPrintf(szFile, sizeof(szFile), "hdaStreamWriteSD%RU8", pStream->u8SD); 82 else 83 RTStrPrintf(szFile, sizeof(szFile), "hdaStreamReadSD%RU8", pStream->u8SD); 84 85 char szPath[RTPATH_MAX + 1]; 86 rc2 = DrvAudioHlpGetFileName(szPath, sizeof(szPath), pThis->Dbg.szOutPath, szFile, 87 0 /* uInst */, PDMAUDIOFILETYPE_WAV, PDMAUDIOFILENAME_FLAG_NONE); 88 AssertRC(rc2); 89 rc2 = DrvAudioHlpFileCreate(PDMAUDIOFILETYPE_WAV, szPath, PDMAUDIOFILE_FLAG_NONE, &pStream->Dbg.Runtime.pFileStream); 90 AssertRC(rc2); 91 92 if (pStream->State.Cfg.enmDir == PDMAUDIODIR_IN) 93 RTStrPrintf(szFile, sizeof(szFile), "hdaDMAWriteSD%RU8", pStream->u8SD); 94 else 95 RTStrPrintf(szFile, sizeof(szFile), "hdaDMAReadSD%RU8", pStream->u8SD); 96 97 rc2 = DrvAudioHlpGetFileName(szPath, sizeof(szPath), pThis->Dbg.szOutPath, szFile, 98 0 /* uInst */, PDMAUDIOFILETYPE_WAV, PDMAUDIOFILENAME_FLAG_NONE); 99 AssertRC(rc2); 100 101 rc2 = DrvAudioHlpFileCreate(PDMAUDIOFILETYPE_WAV, szPath, PDMAUDIOFILE_FLAG_NONE, &pStream->Dbg.Runtime.pFileDMA); 102 AssertRC(rc2); 103 104 /* Delete stale debugging files from a former run. */ 105 DrvAudioHlpFileDelete(pStream->Dbg.Runtime.pFileStream); 106 DrvAudioHlpFileDelete(pStream->Dbg.Runtime.pFileDMA); 107 } 108 73 109 return rc; 74 110 } … … 109 145 AssertRC(rc2); 110 146 #endif 147 148 if (pStream->Dbg.Runtime.fEnabled) 149 { 150 DrvAudioHlpFileDestroy(pStream->Dbg.Runtime.pFileStream); 151 DrvAudioHlpFileDestroy(pStream->Dbg.Runtime.pFileDMA); 152 } 111 153 112 154 LogFlowFuncLeave(); … … 394 436 if (pStream->pMixSink->pMixSink) 395 437 rc = AudioMixerSinkCtl(pStream->pMixSink->pMixSink, enmCmd); 438 439 if ( RT_SUCCESS(rc) 440 && pStream->Dbg.Runtime.fEnabled) 441 { 442 if (fEnable) 443 { 444 int rc2 = DrvAudioHlpFileOpen(pStream->Dbg.Runtime.pFileStream, 445 RTFILE_O_WRITE | RTFILE_O_DENY_WRITE | RTFILE_O_CREATE_REPLACE, 446 &pStream->State.Cfg.Props); 447 AssertRC(rc2); 448 449 rc2 = DrvAudioHlpFileOpen(pStream->Dbg.Runtime.pFileDMA, 450 RTFILE_O_WRITE | RTFILE_O_DENY_WRITE | RTFILE_O_CREATE_REPLACE, 451 &pStream->State.Cfg.Props); 452 AssertRC(rc2); 453 } 454 else 455 { 456 int rc2 = DrvAudioHlpFileClose(pStream->Dbg.Runtime.pFileStream); 457 AssertRC(rc2); 458 459 rc2 = DrvAudioHlpFileClose(pStream->Dbg.Runtime.pFileDMA); 460 AssertRC(rc2); 461 } 462 } 396 463 } 397 464 … … 541 608 } 542 609 543 #ifdef VBOX_AUDIO_DEBUG_DUMP_PCM_DATA 544 RTFILE fh; 545 RTFileOpen(&fh, VBOX_AUDIO_DEBUG_DUMP_PCM_DATA_PATH "hdaStreamWrite.pcm", 546 RTFILE_O_OPEN_CREATE | RTFILE_O_APPEND | RTFILE_O_WRITE | RTFILE_O_DENY_NONE); 547 RTFileWrite(fh, pvDst, cbDst, NULL); 548 RTFileClose(fh); 549 #endif 610 if (pStream->Dbg.Runtime.fEnabled) 611 DrvAudioHlpFileWrite(pStream->Dbg.Runtime.pFileStream, pvDst, cbDst, 0 /* fFlags */); 550 612 } 551 613 … … 611 673 if (cbSrc) 612 674 { 613 #ifdef VBOX_AUDIO_DEBUG_DUMP_PCM_DATA 614 RTFILE fh; 615 RTFileOpen(&fh, VBOX_AUDIO_DEBUG_DUMP_PCM_DATA_PATH "hdaStreamRead.pcm", 616 RTFILE_O_OPEN_CREATE | RTFILE_O_APPEND | RTFILE_O_WRITE | RTFILE_O_DENY_NONE); 617 RTFileWrite(fh, pvSrc, cbSrc, NULL); 618 RTFileClose(fh); 619 #endif 675 if (pStream->Dbg.Runtime.fEnabled) 676 DrvAudioHlpFileWrite(pStream->Dbg.Runtime.pFileStream, pvSrc, cbSrc, 0 /* fFlags */); 677 620 678 rc = AudioMixerSinkWrite(pSink->pMixSink, AUDMIXOP_COPY, pvSrc, (uint32_t)cbSrc, &cbWritten); 621 679 AssertRC(rc); -
trunk/src/VBox/Devices/Audio/HDAStream.h
r69919 r70013 52 52 #endif 53 53 54 #if defined (DEBUG) || defined(HDA_USE_DMA_ACCESS_HANDLER) 54 /** 55 * Structure containing HDA stream debug stuff, configurable at runtime. 56 */ 57 typedef struct HDASTREAMDBGINFORT 58 { 59 /** Whether debugging is enabled or not. */ 60 bool fEnabled; 61 uint8_t Padding[7]; 62 /** File for dumping stream reads / writes. 63 * For input streams, this dumps data being written to the device FIFO, 64 * whereas for output streams this dumps data being read from the device FIFO. */ 65 R3PTRTYPE(PPDMAUDIOFILE) pFileStream; 66 /** File for dumping DMA reads / writes. 67 * For input streams, this dumps data being written to the device DMA, 68 * whereas for output streams this dumps data being read from the device DMA. */ 69 R3PTRTYPE(PPDMAUDIOFILE) pFileDMA; 70 } HDASTREAMDBGINFORT, *PHDASTREAMDBGINFORT; 71 72 /** 73 * Structure containing HDA stream debug information. 74 */ 55 75 typedef struct HDASTREAMDBGINFO 56 76 { 77 #ifdef DEBUG 57 78 /** Critical section to serialize access if needed. */ 58 79 RTCRITSECT CritSect; 59 uint32_t Padding 1[2];80 uint32_t Padding0[2]; 60 81 /** Number of total read accesses. */ 61 82 uint64_t cReadsTotal; … … 81 102 * (useful for intros and silence at the beginning of a song). */ 82 103 uint64_t cbSilenceReadMin; 104 #endif 105 /** Runtime debug info. */ 106 HDASTREAMDBGINFORT Runtime; 83 107 } HDASTREAMDBGINFO ,*PHDASTREAMDBGINFO; 84 #endif /* defined (DEBUG) || defined(HDA_USE_DMA_ACCESS_HANDLER) */85 108 86 109 /** … … 190 213 /** Internal state of this stream. */ 191 214 HDASTREAMSTATE State; 192 #ifdef DEBUG193 215 /** Debug information. */ 194 216 HDASTREAMDBGINFO Dbg; 195 #endif196 217 } HDASTREAM, *PHDASTREAM; 197 218 … … 212 233 * @{ 213 234 */ 214 int hdaStreamCreate(PHDASTREAM pStream, PHDASTATE pThis );235 int hdaStreamCreate(PHDASTREAM pStream, PHDASTATE pThis, uint8_t u8SD); 215 236 void hdaStreamDestroy(PHDASTREAM pStream); 216 237 int hdaStreamInit(PHDASTREAM pStream, uint8_t uSD); -
trunk/src/VBox/Devices/testcase/tstDeviceStructSizeRC.cpp
r69919 r70013 1847 1847 GEN_CHECK_OFF(HDASTREAMSTATE, pCircBuf); 1848 1848 1849 GEN_CHECK_SIZE(HDASTREAMDBGINFORT); 1850 1851 GEN_CHECK_SIZE(HDASTREAMDBGINFO); 1852 GEN_CHECK_OFF(HDASTREAMDBGINFO, Runtime); 1853 1849 1854 GEN_CHECK_SIZE(HDASTREAM); 1850 1855 GEN_CHECK_OFF(HDASTREAM, u8SD); … … 1854 1859 GEN_CHECK_OFF(HDASTREAM, u16LVI); 1855 1860 GEN_CHECK_OFF(HDASTREAM, State); 1861 GEN_CHECK_OFF(HDASTREAM, Dbg); 1856 1862 1857 1863 GEN_CHECK_SIZE(HDASTATE); -
trunk/src/VBox/Main/src-client/ConsoleImpl2.cpp
r69956 r70013 72 72 #include <VBox/param.h> 73 73 #include <VBox/vmm/pdmapi.h> /* For PDMR3DriverAttach/PDMR3DriverDetach. */ 74 #include <VBox/vmm/pdmaudioifs.h>75 74 #include <VBox/vmm/pdmusb.h> /* For PDMR3UsbCreateEmulatedDevice. */ 76 75 #include <VBox/vmm/pdmdev.h> /* For PDMAPICMODE enum. */ … … 2839 2838 hrc = audioAdapter->COMGETTER(AudioCodec)(&audioCodec); H(); 2840 2839 2840 GetExtraDataBoth(virtualBox, pMachine, "VBoxInternal2/Audio/Debug/Enabled", &strTmp); 2841 const bool fDebugEnabled = strTmp.equalsIgnoreCase("true") || strTmp.equalsIgnoreCase("1"); 2842 2843 Utf8Str strDebugPathOut; 2844 GetExtraDataBoth(virtualBox, pMachine, "VBoxInternal2/Audio/Debug/PathOut", &strDebugPathOut); 2845 2841 2846 switch (audioController) 2842 2847 { … … 2889 2894 hrc = pBusMgr->assignPCIDevice(strAudioDevice.c_str(), pInst); H(); 2890 2895 InsertConfigNode (pInst, "Config", &pCfg); 2896 2897 InsertConfigInteger(pCfg, "DebugEnabled", fDebugEnabled); 2898 InsertConfigString (pCfg, "DebugPathOut", strDebugPathOut); 2891 2899 } 2892 2900 } … … 2907 2915 } 2908 2916 2909 GetExtraDataBoth(virtualBox, pMachine, "VBoxInternal2/Audio/Debug/Enabled", &strTmp);2910 bool fDebugEnabled = strTmp.equalsIgnoreCase("true") || strTmp.equalsIgnoreCase("1");2911 2912 Utf8Str strDebugPathOut;2913 GetExtraDataBoth(virtualBox, pMachine, "VBoxInternal2/Audio/Debug/PathOut", &strDebugPathOut);2914 if (strDebugPathOut.isEmpty())2915 strDebugPathOut = VBOX_AUDIO_DEBUG_DUMP_PCM_DATA_PATH;2916 2917 2917 /* 2918 2918 * The audio driver. … … 2996 2996 CFGMR3InsertNodeF(pInst, &pLunL0, "LUN#%RU8", u8AudioLUN++); 2997 2997 InsertConfigString(pLunL0, "Driver", "AUDIO"); 2998 2998 2999 InsertConfigNode(pLunL0, "Config", &pCfg); 2999 3000 3000 InsertConfigString (pCfg, "DriverName", strAudioDriver.c_str()); 3001 3001 InsertConfigInteger(pCfg, "InputEnabled", fAudioEnabledIn); … … 3042 3042 /* Note: Don't do any driver attaching (fAttachDetach) here, as this will 3043 3043 * be done automatically as part of the VM startup process. */ 3044 pDisplay->i_videoRecConfigure(pDisplay, pDisplay->i_videoRecGetConfig(), false /* fAttachDetach */); 3044 rc = pDisplay->i_videoRecConfigure(pDisplay, pDisplay->i_videoRecGetConfig(), false /* fAttachDetach */); 3045 3046 /** @todo Fix this: Figure out what the next LUN might be. */ 3047 u8AudioLUN = 3; 3045 3048 } 3046 3049 #endif /* VBOX_WITH_AUDIO_VIDEOREC */ 3047 3048 GetExtraDataBoth(virtualBox, pMachine, "VBoxInternal2/Audio/Debug/Enabled", &strTmp);3049 3050 3050 3051 if (fDebugEnabled) … … 3056 3057 CFGMR3InsertNodeF(pInst, &pLunL0, "LUN#%RU8", u8AudioLUN++); 3057 3058 InsertConfigString(pLunL0, "Driver", "AUDIO"); 3059 3058 3060 InsertConfigNode(pLunL0, "Config", &pCfg); 3059 InsertConfigString (pCfg, "DriverName", "DebugAudio");3061 InsertConfigString (pCfg, "DriverName", "DebugAudio"); 3060 3062 InsertConfigInteger(pCfg, "InputEnabled", fAudioEnabledIn); 3061 3063 InsertConfigInteger(pCfg, "OutputEnabled", fAudioEnabledOut);
Note:
See TracChangeset
for help on using the changeset viewer.