Changeset 89485 in vbox for trunk/src/VBox
- Timestamp:
- Jun 3, 2021 1:04:26 PM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Audio/DrvHostAudioDebug.cpp
r89344 r89485 38 38 * Debug host audio stream. 39 39 */ 40 typedef struct D EBUGAUDIOSTREAM40 typedef struct DRVHSTAUDDEBUGSTREAM 41 41 { 42 42 /** Common part. */ … … 50 50 AUDIOTESTTONE In; 51 51 }; 52 } D EBUGAUDIOSTREAM;52 } DRVHSTAUDDEBUGSTREAM; 53 53 /** Pointer to a debug host audio stream. */ 54 typedef D EBUGAUDIOSTREAM *PDEBUGAUDIOSTREAM;54 typedef DRVHSTAUDDEBUGSTREAM *PDRVHSTAUDDEBUGSTREAM; 55 55 56 56 /** … … 58 58 * @implements PDMIAUDIOCONNECTOR 59 59 */ 60 typedef struct DRVH OSTDEBUGAUDIO60 typedef struct DRVHSTAUDDEBUG 61 61 { 62 62 /** Pointer to the driver instance structure. */ … … 64 64 /** Pointer to host audio interface. */ 65 65 PDMIHOSTAUDIO IHostAudio; 66 } DRVH OSTDEBUGAUDIO;66 } DRVHSTAUDDEBUG; 67 67 /** Pointer to a debug host audio driver. */ 68 typedef DRVH OSTDEBUGAUDIO *PDRVHOSTDEBUGAUDIO;68 typedef DRVHSTAUDDEBUG *PDRVHSTAUDDEBUG; 69 69 70 70 … … 72 72 * @interface_method_impl{PDMIHOSTAUDIO,pfnGetConfig} 73 73 */ 74 static DECLCALLBACK(int) drvH ostDebugAudioHA_GetConfig(PPDMIHOSTAUDIO pInterface, PPDMAUDIOBACKENDCFG pBackendCfg)74 static DECLCALLBACK(int) drvHstAudDebugHA_GetConfig(PPDMIHOSTAUDIO pInterface, PPDMAUDIOBACKENDCFG pBackendCfg) 75 75 { 76 76 RT_NOREF(pInterface); … … 81 81 */ 82 82 RTStrCopy(pBackendCfg->szName, sizeof(pBackendCfg->szName), "DebugAudio"); 83 pBackendCfg->cbStream = sizeof(D EBUGAUDIOSTREAM);83 pBackendCfg->cbStream = sizeof(DRVHSTAUDDEBUGSTREAM); 84 84 pBackendCfg->fFlags = 0; 85 85 pBackendCfg->cMaxStreamsOut = 1; /* Output; writing to a file. */ … … 93 93 * @interface_method_impl{PDMIHOSTAUDIO,pfnGetStatus} 94 94 */ 95 static DECLCALLBACK(PDMAUDIOBACKENDSTS) drvH ostDebugAudioHA_GetStatus(PPDMIHOSTAUDIO pInterface, PDMAUDIODIR enmDir)95 static DECLCALLBACK(PDMAUDIOBACKENDSTS) drvHstAudDebugHA_GetStatus(PPDMIHOSTAUDIO pInterface, PDMAUDIODIR enmDir) 96 96 { 97 97 RT_NOREF(pInterface, enmDir); … … 103 103 * @interface_method_impl{PDMIHOSTAUDIO,pfnStreamCreate} 104 104 */ 105 static DECLCALLBACK(int) drvH ostDebugAudioHA_StreamCreate(PPDMIHOSTAUDIO pInterface, PPDMAUDIOBACKENDSTREAM pStream,105 static DECLCALLBACK(int) drvHstAudDebugHA_StreamCreate(PPDMIHOSTAUDIO pInterface, PPDMAUDIOBACKENDSTREAM pStream, 106 106 PPDMAUDIOSTREAMCFG pCfgReq, PPDMAUDIOSTREAMCFG pCfgAcq) 107 107 { 108 PDRVH OSTDEBUGAUDIO pDrv = RT_FROM_MEMBER(pInterface, DRVHOSTDEBUGAUDIO, IHostAudio);109 PD EBUGAUDIOSTREAM pStreamDbg = (PDEBUGAUDIOSTREAM)pStream;108 PDRVHSTAUDDEBUG pThis = RT_FROM_MEMBER(pInterface, DRVHSTAUDDEBUG, IHostAudio); 109 PDRVHSTAUDDEBUGSTREAM pStreamDbg = (PDRVHSTAUDDEBUGSTREAM)pStream; 110 110 AssertPtrReturn(pStreamDbg, VERR_INVALID_POINTER); 111 111 AssertPtrReturn(pCfgReq, VERR_INVALID_POINTER); … … 119 119 int rc = AudioHlpFileCreateAndOpenEx(&pStreamDbg->pFile, AUDIOHLPFILETYPE_WAV, NULL /*use temp dir*/, 120 120 pCfgReq->enmDir == PDMAUDIODIR_IN ? "DebugAudioIn" : "DebugAudioOut", 121 p Drv->pDrvIns->iInstance, AUDIOHLPFILENAME_FLAGS_NONE, AUDIOHLPFILE_FLAGS_NONE,121 pThis->pDrvIns->iInstance, AUDIOHLPFILENAME_FLAGS_NONE, AUDIOHLPFILE_FLAGS_NONE, 122 122 &pCfgReq->Props, RTFILE_O_WRITE | RTFILE_O_DENY_WRITE | RTFILE_O_CREATE_REPLACE); 123 123 if (RT_FAILURE(rc)) … … 132 132 * @interface_method_impl{PDMIHOSTAUDIO,pfnStreamDestroy} 133 133 */ 134 static DECLCALLBACK(int) drvH ostDebugAudioHA_StreamDestroy(PPDMIHOSTAUDIO pInterface, PPDMAUDIOBACKENDSTREAM pStream,135 134 static DECLCALLBACK(int) drvHstAudDebugHA_StreamDestroy(PPDMIHOSTAUDIO pInterface, PPDMAUDIOBACKENDSTREAM pStream, 135 bool fImmediate) 136 136 { 137 137 RT_NOREF(pInterface, fImmediate); 138 PD EBUGAUDIOSTREAM pStreamDbg = (PDEBUGAUDIOSTREAM)pStream;138 PDRVHSTAUDDEBUGSTREAM pStreamDbg = (PDRVHSTAUDDEBUGSTREAM)pStream; 139 139 AssertPtrReturn(pStreamDbg, VERR_INVALID_POINTER); 140 140 … … 152 152 * @ interface_method_impl{PDMIHOSTAUDIO,pfnStreamEnable} 153 153 */ 154 static DECLCALLBACK(int) drvH ostDebugAudioHA_StreamControlStub(PPDMIHOSTAUDIO pInterface, PPDMAUDIOBACKENDSTREAM pStream)154 static DECLCALLBACK(int) drvHstAudDebugHA_StreamControlStub(PPDMIHOSTAUDIO pInterface, PPDMAUDIOBACKENDSTREAM pStream) 155 155 { 156 156 RT_NOREF(pInterface, pStream); … … 162 162 * @interface_method_impl{PDMIHOSTAUDIO,pfnStreamControl} 163 163 */ 164 static DECLCALLBACK(int) drvH ostDebugAudioHA_StreamControl(PPDMIHOSTAUDIO pInterface,165 164 static DECLCALLBACK(int) drvHstAudDebugHA_StreamControl(PPDMIHOSTAUDIO pInterface, 165 PPDMAUDIOBACKENDSTREAM pStream, PDMAUDIOSTREAMCMD enmStreamCmd) 166 166 { 167 167 /** @todo r=bird: I'd like to get rid of this pfnStreamControl method, … … 172 172 { 173 173 case PDMAUDIOSTREAMCMD_ENABLE: 174 return drvH ostDebugAudioHA_StreamControlStub(pInterface, pStream);174 return drvHstAudDebugHA_StreamControlStub(pInterface, pStream); 175 175 case PDMAUDIOSTREAMCMD_DISABLE: 176 return drvH ostDebugAudioHA_StreamControlStub(pInterface, pStream);176 return drvHstAudDebugHA_StreamControlStub(pInterface, pStream); 177 177 case PDMAUDIOSTREAMCMD_PAUSE: 178 return drvH ostDebugAudioHA_StreamControlStub(pInterface, pStream);178 return drvHstAudDebugHA_StreamControlStub(pInterface, pStream); 179 179 case PDMAUDIOSTREAMCMD_RESUME: 180 return drvH ostDebugAudioHA_StreamControlStub(pInterface, pStream);180 return drvHstAudDebugHA_StreamControlStub(pInterface, pStream); 181 181 case PDMAUDIOSTREAMCMD_DRAIN: 182 return drvH ostDebugAudioHA_StreamControlStub(pInterface, pStream);182 return drvHstAudDebugHA_StreamControlStub(pInterface, pStream); 183 183 184 184 case PDMAUDIOSTREAMCMD_END: … … 195 195 * @interface_method_impl{PDMIHOSTAUDIO,pfnStreamGetReadable} 196 196 */ 197 static DECLCALLBACK(uint32_t) drvH ostDebugAudioHA_StreamGetReadable(PPDMIHOSTAUDIO pInterface, PPDMAUDIOBACKENDSTREAM pStream)198 { 199 RT_NOREF(pInterface); 200 PD EBUGAUDIOSTREAM pStreamDbg = (PDEBUGAUDIOSTREAM)pStream;197 static DECLCALLBACK(uint32_t) drvHstAudDebugHA_StreamGetReadable(PPDMIHOSTAUDIO pInterface, PPDMAUDIOBACKENDSTREAM pStream) 198 { 199 RT_NOREF(pInterface); 200 PDRVHSTAUDDEBUGSTREAM pStreamDbg = (PDRVHSTAUDDEBUGSTREAM)pStream; 201 201 202 202 return PDMAudioPropsMilliToBytes(&pStreamDbg->Cfg.Props, 10 /*ms*/); … … 207 207 * @interface_method_impl{PDMIHOSTAUDIO,pfnStreamGetWritable} 208 208 */ 209 static DECLCALLBACK(uint32_t) drvH ostDebugAudioHA_StreamGetWritable(PPDMIHOSTAUDIO pInterface, PPDMAUDIOBACKENDSTREAM pStream)209 static DECLCALLBACK(uint32_t) drvHstAudDebugHA_StreamGetWritable(PPDMIHOSTAUDIO pInterface, PPDMAUDIOBACKENDSTREAM pStream) 210 210 { 211 211 RT_NOREF(pInterface, pStream); … … 217 217 * @interface_method_impl{PDMIHOSTAUDIO,pfnStreamGetPending} 218 218 */ 219 static DECLCALLBACK(uint32_t) drvH ostDebugAudioHA_StreamGetPending(PPDMIHOSTAUDIO pInterface, PPDMAUDIOBACKENDSTREAM pStream)219 static DECLCALLBACK(uint32_t) drvHstAudDebugHA_StreamGetPending(PPDMIHOSTAUDIO pInterface, PPDMAUDIOBACKENDSTREAM pStream) 220 220 { 221 221 RT_NOREF(pInterface, pStream); … … 227 227 * @interface_method_impl{PDMIHOSTAUDIO,pfnStreamGetState} 228 228 */ 229 static DECLCALLBACK(PDMHOSTAUDIOSTREAMSTATE) drvH ostDebugAudioHA_StreamGetState(PPDMIHOSTAUDIO pInterface,230 229 static DECLCALLBACK(PDMHOSTAUDIOSTREAMSTATE) drvHstAudDebugHA_StreamGetState(PPDMIHOSTAUDIO pInterface, 230 PPDMAUDIOBACKENDSTREAM pStream) 231 231 { 232 232 RT_NOREF(pInterface); … … 239 239 * @interface_method_impl{PDMIHOSTAUDIO,pfnStreamPlay} 240 240 */ 241 static DECLCALLBACK(int) drvH ostDebugAudioHA_StreamPlay(PPDMIHOSTAUDIO pInterface, PPDMAUDIOBACKENDSTREAM pStream,241 static DECLCALLBACK(int) drvHstAudDebugHA_StreamPlay(PPDMIHOSTAUDIO pInterface, PPDMAUDIOBACKENDSTREAM pStream, 242 242 const void *pvBuf, uint32_t cbBuf, uint32_t *pcbWritten) 243 243 { 244 244 RT_NOREF(pInterface); 245 PD EBUGAUDIOSTREAM pStreamDbg = (PDEBUGAUDIOSTREAM)pStream;245 PDRVHSTAUDDEBUGSTREAM pStreamDbg = (PDRVHSTAUDDEBUGSTREAM)pStream; 246 246 247 247 int rc = AudioHlpFileWrite(pStreamDbg->pFile, pvBuf, cbBuf, 0 /* fFlags */); … … 257 257 * @interface_method_impl{PDMIHOSTAUDIO,pfnStreamCapture} 258 258 */ 259 static DECLCALLBACK(int) drvH ostDebugAudioHA_StreamCapture(PPDMIHOSTAUDIO pInterface, PPDMAUDIOBACKENDSTREAM pStream,260 261 { 262 RT_NOREF(pInterface); 263 PD EBUGAUDIOSTREAM pStreamDbg = (PDEBUGAUDIOSTREAM)pStream;259 static DECLCALLBACK(int) drvHstAudDebugHA_StreamCapture(PPDMIHOSTAUDIO pInterface, PPDMAUDIOBACKENDSTREAM pStream, 260 void *pvBuf, uint32_t cbBuf, uint32_t *pcbRead) 261 { 262 RT_NOREF(pInterface); 263 PDRVHSTAUDDEBUGSTREAM pStreamDbg = (PDRVHSTAUDDEBUGSTREAM)pStream; 264 264 /** @todo rate limit this? */ 265 265 … … 286 286 * @interface_method_impl{PDMIBASE,pfnQueryInterface} 287 287 */ 288 static DECLCALLBACK(void *) drvH ostDebugAudioQueryInterface(PPDMIBASE pInterface, const char *pszIID)289 { 290 PPDMDRVINS 291 PDRVH OSTDEBUGAUDIO pThis = PDMINS_2_DATA(pDrvIns, PDRVHOSTDEBUGAUDIO);288 static DECLCALLBACK(void *) drvHstAudDebugQueryInterface(PPDMIBASE pInterface, const char *pszIID) 289 { 290 PPDMDRVINS pDrvIns = PDMIBASE_2_PDMDRV(pInterface); 291 PDRVHSTAUDDEBUG pThis = PDMINS_2_DATA(pDrvIns, PDRVHSTAUDDEBUG); 292 292 293 293 PDMIBASE_RETURN_INTERFACE(pszIID, PDMIBASE, &pDrvIns->IBase); … … 302 302 * @copydoc FNPDMDRVCONSTRUCT 303 303 */ 304 static DECLCALLBACK(int) drvH ostDebugAudioConstruct(PPDMDRVINS pDrvIns, PCFGMNODE pCfg, uint32_t fFlags)304 static DECLCALLBACK(int) drvHstAudDebugConstruct(PPDMDRVINS pDrvIns, PCFGMNODE pCfg, uint32_t fFlags) 305 305 { 306 306 RT_NOREF(pCfg, fFlags); 307 307 PDMDRV_CHECK_VERSIONS_RETURN(pDrvIns); 308 PDRVH OSTDEBUGAUDIO pThis = PDMINS_2_DATA(pDrvIns, PDRVHOSTDEBUGAUDIO);308 PDRVHSTAUDDEBUG pThis = PDMINS_2_DATA(pDrvIns, PDRVHSTAUDDEBUG); 309 309 LogRel(("Audio: Initializing DEBUG driver\n")); 310 310 … … 314 314 pThis->pDrvIns = pDrvIns; 315 315 /* IBase */ 316 pDrvIns->IBase.pfnQueryInterface = drvH ostDebugAudioQueryInterface;316 pDrvIns->IBase.pfnQueryInterface = drvHstAudDebugQueryInterface; 317 317 /* IHostAudio */ 318 pThis->IHostAudio.pfnGetConfig = drvH ostDebugAudioHA_GetConfig;318 pThis->IHostAudio.pfnGetConfig = drvHstAudDebugHA_GetConfig; 319 319 pThis->IHostAudio.pfnGetDevices = NULL; 320 320 pThis->IHostAudio.pfnSetDevice = NULL; 321 pThis->IHostAudio.pfnGetStatus = drvH ostDebugAudioHA_GetStatus;321 pThis->IHostAudio.pfnGetStatus = drvHstAudDebugHA_GetStatus; 322 322 pThis->IHostAudio.pfnDoOnWorkerThread = NULL; 323 323 pThis->IHostAudio.pfnStreamConfigHint = NULL; 324 pThis->IHostAudio.pfnStreamCreate = drvH ostDebugAudioHA_StreamCreate;324 pThis->IHostAudio.pfnStreamCreate = drvHstAudDebugHA_StreamCreate; 325 325 pThis->IHostAudio.pfnStreamInitAsync = NULL; 326 pThis->IHostAudio.pfnStreamDestroy = drvH ostDebugAudioHA_StreamDestroy;326 pThis->IHostAudio.pfnStreamDestroy = drvHstAudDebugHA_StreamDestroy; 327 327 pThis->IHostAudio.pfnStreamNotifyDeviceChanged = NULL; 328 pThis->IHostAudio.pfnStreamControl = drvH ostDebugAudioHA_StreamControl;329 pThis->IHostAudio.pfnStreamGetReadable = drvH ostDebugAudioHA_StreamGetReadable;330 pThis->IHostAudio.pfnStreamGetWritable = drvH ostDebugAudioHA_StreamGetWritable;331 pThis->IHostAudio.pfnStreamGetPending = drvH ostDebugAudioHA_StreamGetPending;332 pThis->IHostAudio.pfnStreamGetState = drvH ostDebugAudioHA_StreamGetState;333 pThis->IHostAudio.pfnStreamPlay = drvH ostDebugAudioHA_StreamPlay;334 pThis->IHostAudio.pfnStreamCapture = drvH ostDebugAudioHA_StreamCapture;328 pThis->IHostAudio.pfnStreamControl = drvHstAudDebugHA_StreamControl; 329 pThis->IHostAudio.pfnStreamGetReadable = drvHstAudDebugHA_StreamGetReadable; 330 pThis->IHostAudio.pfnStreamGetWritable = drvHstAudDebugHA_StreamGetWritable; 331 pThis->IHostAudio.pfnStreamGetPending = drvHstAudDebugHA_StreamGetPending; 332 pThis->IHostAudio.pfnStreamGetState = drvHstAudDebugHA_StreamGetState; 333 pThis->IHostAudio.pfnStreamPlay = drvHstAudDebugHA_StreamPlay; 334 pThis->IHostAudio.pfnStreamCapture = drvHstAudDebugHA_StreamCapture; 335 335 336 336 #ifdef VBOX_AUDIO_DEBUG_DUMP_PCM_DATA_PATH … … 363 363 ~0U, 364 364 /* cbInstance */ 365 sizeof(DRVH OSTDEBUGAUDIO),365 sizeof(DRVHSTAUDDEBUG), 366 366 /* pfnConstruct */ 367 drvH ostDebugAudioConstruct,367 drvHstAudDebugConstruct, 368 368 /* pfnDestruct */ 369 369 NULL,
Note:
See TracChangeset
for help on using the changeset viewer.