1 | /* $Id: vkatInternal.h 91489 2021-09-30 08:17:56Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * VKAT - Internal header file for common definitions + structs.
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2021 Oracle Corporation
|
---|
8 | *
|
---|
9 | * This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
10 | * available from http://www.virtualbox.org. This file is free software;
|
---|
11 | * you can redistribute it and/or modify it under the terms of the GNU
|
---|
12 | * General Public License (GPL) as published by the Free Software
|
---|
13 | * Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
14 | * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
|
---|
15 | * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
16 | *
|
---|
17 | * The contents of this file may alternatively be used under the terms
|
---|
18 | * of the Common Development and Distribution License Version 1.0
|
---|
19 | * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
|
---|
20 | * VirtualBox OSE distribution, in which case the provisions of the
|
---|
21 | * CDDL are applicable instead of those of the GPL.
|
---|
22 | *
|
---|
23 | * You may elect to license modified versions of this file under the
|
---|
24 | * terms and conditions of either the GPL or the CDDL or both.
|
---|
25 | */
|
---|
26 |
|
---|
27 | #ifndef VBOX_INCLUDED_SRC_audio_vkatInternal_h
|
---|
28 | #define VBOX_INCLUDED_SRC_audio_vkatInternal_h
|
---|
29 | #ifndef RT_WITHOUT_PRAGMA_ONCE
|
---|
30 | # pragma once
|
---|
31 | #endif
|
---|
32 |
|
---|
33 |
|
---|
34 | /*********************************************************************************************************************************
|
---|
35 | * Header Files *
|
---|
36 | *********************************************************************************************************************************/
|
---|
37 | #include <iprt/getopt.h>
|
---|
38 |
|
---|
39 | #include <VBox/vmm/pdmdrv.h>
|
---|
40 | #include <VBox/vmm/pdmaudioinline.h>
|
---|
41 | #include <VBox/vmm/pdmaudiohostenuminline.h>
|
---|
42 |
|
---|
43 | #include "Audio/AudioMixBuffer.h"
|
---|
44 | #include "Audio/AudioTest.h"
|
---|
45 | #include "Audio/AudioTestService.h"
|
---|
46 | #include "Audio/AudioTestServiceClient.h"
|
---|
47 |
|
---|
48 | #include "VBoxDD.h"
|
---|
49 |
|
---|
50 |
|
---|
51 | /*********************************************************************************************************************************
|
---|
52 | * Structures and Typedefs *
|
---|
53 | *********************************************************************************************************************************/
|
---|
54 | /**
|
---|
55 | * Audio driver stack.
|
---|
56 | *
|
---|
57 | * This can be just be backend driver alone or DrvAudio with a backend.
|
---|
58 | * @todo add automatic resampling via mixer so we can test more of the audio
|
---|
59 | * stack used by the device emulations.
|
---|
60 | */
|
---|
61 | typedef struct AUDIOTESTDRVSTACK
|
---|
62 | {
|
---|
63 | /** The device registration record for the backend. */
|
---|
64 | PCPDMDRVREG pDrvReg;
|
---|
65 | /** The backend driver instance. */
|
---|
66 | PPDMDRVINS pDrvBackendIns;
|
---|
67 | /** The backend's audio interface. */
|
---|
68 | PPDMIHOSTAUDIO pIHostAudio;
|
---|
69 |
|
---|
70 | /** The DrvAudio instance. */
|
---|
71 | PPDMDRVINS pDrvAudioIns;
|
---|
72 | /** This is NULL if we don't use DrvAudio. */
|
---|
73 | PPDMIAUDIOCONNECTOR pIAudioConnector;
|
---|
74 |
|
---|
75 | /** The current (last) audio device enumeration to use. */
|
---|
76 | PDMAUDIOHOSTENUM DevEnum;
|
---|
77 | } AUDIOTESTDRVSTACK;
|
---|
78 | /** Pointer to an audio driver stack. */
|
---|
79 | typedef AUDIOTESTDRVSTACK *PAUDIOTESTDRVSTACK;
|
---|
80 |
|
---|
81 | /**
|
---|
82 | * Backend-only stream structure.
|
---|
83 | */
|
---|
84 | typedef struct AUDIOTESTDRVSTACKSTREAM
|
---|
85 | {
|
---|
86 | /** The public stream data. */
|
---|
87 | PDMAUDIOSTREAM Core;
|
---|
88 | /** The backend data (variable size). */
|
---|
89 | PDMAUDIOBACKENDSTREAM Backend;
|
---|
90 | } AUDIOTESTDRVSTACKSTREAM;
|
---|
91 | /** Pointer to a backend-only stream structure. */
|
---|
92 | typedef AUDIOTESTDRVSTACKSTREAM *PAUDIOTESTDRVSTACKSTREAM;
|
---|
93 |
|
---|
94 | /**
|
---|
95 | * Mixer setup for a stream.
|
---|
96 | */
|
---|
97 | typedef struct AUDIOTESTDRVMIXSTREAM
|
---|
98 | {
|
---|
99 | /** Pointer to the driver stack. */
|
---|
100 | PAUDIOTESTDRVSTACK pDrvStack;
|
---|
101 | /** Pointer to the stream. */
|
---|
102 | PPDMAUDIOSTREAM pStream;
|
---|
103 | /** Properties to use. */
|
---|
104 | PCPDMAUDIOPCMPROPS pProps;
|
---|
105 | /** Set if we're mixing or just passing thru to the driver stack. */
|
---|
106 | bool fDoMixing;
|
---|
107 | /** Mixer buffer. */
|
---|
108 | AUDIOMIXBUF MixBuf;
|
---|
109 | /** Write state. */
|
---|
110 | AUDIOMIXBUFWRITESTATE WriteState;
|
---|
111 | /** Peek state. */
|
---|
112 | AUDIOMIXBUFPEEKSTATE PeekState;
|
---|
113 | } AUDIOTESTDRVMIXSTREAM;
|
---|
114 | /** Pointer to mixer setup for a stream. */
|
---|
115 | typedef AUDIOTESTDRVMIXSTREAM *PAUDIOTESTDRVMIXSTREAM;
|
---|
116 |
|
---|
117 | /**
|
---|
118 | * Enumeration specifying the current audio test mode.
|
---|
119 | */
|
---|
120 | typedef enum AUDIOTESTMODE
|
---|
121 | {
|
---|
122 | /** Unknown mode. */
|
---|
123 | AUDIOTESTMODE_UNKNOWN = 0,
|
---|
124 | /** VKAT is running on the guest side. */
|
---|
125 | AUDIOTESTMODE_GUEST,
|
---|
126 | /** VKAT is running on the host side. */
|
---|
127 | AUDIOTESTMODE_HOST
|
---|
128 | } AUDIOTESTMODE;
|
---|
129 |
|
---|
130 | struct AUDIOTESTENV;
|
---|
131 | /** Pointer a audio test environment. */
|
---|
132 | typedef AUDIOTESTENV *PAUDIOTESTENV;
|
---|
133 |
|
---|
134 | struct AUDIOTESTDESC;
|
---|
135 | /** Pointer a audio test descriptor. */
|
---|
136 | typedef AUDIOTESTDESC *PAUDIOTESTDESC;
|
---|
137 |
|
---|
138 | /**
|
---|
139 | * Callback to set up the test parameters for a specific test.
|
---|
140 | *
|
---|
141 | * @returns IPRT status code.
|
---|
142 | * @retval VINF_SUCCESS if setting the parameters up succeeded. Any other error code
|
---|
143 | * otherwise indicating the kind of error.
|
---|
144 | * @param pszTest Test name.
|
---|
145 | * @param pTstParmsAcq The audio test parameters to set up.
|
---|
146 | */
|
---|
147 | typedef DECLCALLBACKTYPE(int, FNAUDIOTESTSETUP,(PAUDIOTESTENV pTstEnv, PAUDIOTESTDESC pTstDesc, PAUDIOTESTPARMS pTstParmsAcq, void **ppvCtx));
|
---|
148 | /** Pointer to an audio test setup callback. */
|
---|
149 | typedef FNAUDIOTESTSETUP *PFNAUDIOTESTSETUP;
|
---|
150 |
|
---|
151 | typedef DECLCALLBACKTYPE(int, FNAUDIOTESTEXEC,(PAUDIOTESTENV pTstEnv, void *pvCtx, PAUDIOTESTPARMS pTstParms));
|
---|
152 | /** Pointer to an audio test exec callback. */
|
---|
153 | typedef FNAUDIOTESTEXEC *PFNAUDIOTESTEXEC;
|
---|
154 |
|
---|
155 | typedef DECLCALLBACKTYPE(int, FNAUDIOTESTDESTROY,(PAUDIOTESTENV pTstEnv, void *pvCtx));
|
---|
156 | /** Pointer to an audio test destroy callback. */
|
---|
157 | typedef FNAUDIOTESTDESTROY *PFNAUDIOTESTDESTROY;
|
---|
158 |
|
---|
159 | /**
|
---|
160 | * Structure for keeping an audio test audio stream.
|
---|
161 | */
|
---|
162 | typedef struct AUDIOTESTSTREAM
|
---|
163 | {
|
---|
164 | /** The PDM stream. */
|
---|
165 | PPDMAUDIOSTREAM pStream;
|
---|
166 | /** The backend stream. */
|
---|
167 | PPDMAUDIOBACKENDSTREAM pBackend;
|
---|
168 | /** The stream config. */
|
---|
169 | PDMAUDIOSTREAMCFG Cfg;
|
---|
170 | /** Associated mixing stream. Optional. */
|
---|
171 | AUDIOTESTDRVMIXSTREAM Mix;
|
---|
172 | } AUDIOTESTSTREAM;
|
---|
173 | /** Pointer to audio test stream. */
|
---|
174 | typedef AUDIOTESTSTREAM *PAUDIOTESTSTREAM;
|
---|
175 |
|
---|
176 | /** Maximum audio streams a test environment can handle. */
|
---|
177 | #define AUDIOTESTENV_MAX_STREAMS 8
|
---|
178 |
|
---|
179 | /**
|
---|
180 | * Structure for keeping TCP/IP-specific options.
|
---|
181 | */
|
---|
182 | typedef struct AUDIOTESTENVTCPOPTS
|
---|
183 | {
|
---|
184 | /** Connection mode(s) to use. */
|
---|
185 | ATSCONNMODE enmConnMode;
|
---|
186 | /** Bind address (server mode). When empty, "0.0.0.0" (any host) will be used. */
|
---|
187 | char szBindAddr[128];
|
---|
188 | /** Bind port (server mode). */
|
---|
189 | uint16_t uBindPort;
|
---|
190 | /** Connection address (client mode). */
|
---|
191 | char szConnectAddr[128];
|
---|
192 | /** Connection port (client mode). */
|
---|
193 | uint16_t uConnectPort;
|
---|
194 | } AUDIOTESTENVTCPOPTS;
|
---|
195 | /** Pointer to audio test TCP options. */
|
---|
196 | typedef AUDIOTESTENVTCPOPTS *PAUDIOTESTENVTCPOPTS;
|
---|
197 |
|
---|
198 | /**
|
---|
199 | * Structure for keeping a user context for the test service callbacks.
|
---|
200 | */
|
---|
201 | typedef struct ATSCALLBACKCTX
|
---|
202 | {
|
---|
203 | /** The test environment bound to this context. */
|
---|
204 | PAUDIOTESTENV pTstEnv;
|
---|
205 | /** Absolute path to the packed up test set archive.
|
---|
206 | * Keep it simple for now and only support one (open) archive at a time. */
|
---|
207 | char szTestSetArchive[RTPATH_MAX];
|
---|
208 | /** File handle to the (opened) test set archive for reading. */
|
---|
209 | RTFILE hTestSetArchive;
|
---|
210 | /** Number of currently connected clients. */
|
---|
211 | uint8_t cClients;
|
---|
212 | } ATSCALLBACKCTX;
|
---|
213 | typedef ATSCALLBACKCTX *PATSCALLBACKCTX;
|
---|
214 |
|
---|
215 | /**
|
---|
216 | * Audio test environment parameters.
|
---|
217 | * Not necessarily bound to a specific test (can be reused).
|
---|
218 | */
|
---|
219 | typedef struct AUDIOTESTENV
|
---|
220 | {
|
---|
221 | /** Audio testing mode. */
|
---|
222 | AUDIOTESTMODE enmMode;
|
---|
223 | /** Whether self test mode is active or not. */
|
---|
224 | bool fSelftest;
|
---|
225 | /** Whether skip the actual verification or not. */
|
---|
226 | bool fSkipVerify;
|
---|
227 | /** The PCM properties to use. */
|
---|
228 | PDMAUDIOPCMPROPS Props;
|
---|
229 | /** Name of the audio device to use.
|
---|
230 | * If empty the default audio device will be used. */
|
---|
231 | char szDev[128];
|
---|
232 | /** Audio volume to use (in percent).
|
---|
233 | * Might not be available on all systems. */
|
---|
234 | uint8_t uVolumePercent;
|
---|
235 | /** Number of iterations for *all* tests specified.
|
---|
236 | * When set to 0 (default), a random value (see specific test) will be chosen. */
|
---|
237 | uint32_t cIterations;
|
---|
238 | /** Duration (in ms) to play / record test tone.
|
---|
239 | * When set to 0 (default), a random value (see specific test) will be chosen. */
|
---|
240 | uint32_t cMsToneDuration;
|
---|
241 | /** Output path for storing the test environment's final test files. */
|
---|
242 | char szTag[AUDIOTEST_TAG_MAX];
|
---|
243 | /** Output path for storing the test environment's final test files. */
|
---|
244 | char szPathOut[RTPATH_MAX];
|
---|
245 | /** Temporary path for this test environment. */
|
---|
246 | char szPathTemp[RTPATH_MAX];
|
---|
247 | /** Buffer size (in ms). */
|
---|
248 | RTMSINTERVAL cMsBufferSize;
|
---|
249 | /** Pre-buffering time (in ms). */
|
---|
250 | RTMSINTERVAL cMsPreBuffer;
|
---|
251 | /** Scheduling hint (in ms). */
|
---|
252 | RTMSINTERVAL cMsSchedulingHint;
|
---|
253 | /** Pointer to audio test driver stack to use. */
|
---|
254 | PAUDIOTESTDRVSTACK pDrvStack;
|
---|
255 | /** Audio stream. */
|
---|
256 | AUDIOTESTSTREAM aStreams[AUDIOTESTENV_MAX_STREAMS];
|
---|
257 | /** The audio test set to use. */
|
---|
258 | AUDIOTESTSET Set;
|
---|
259 | /** TCP options to use for ATS. */
|
---|
260 | AUDIOTESTENVTCPOPTS TcpOpts;
|
---|
261 | /** ATS server instance to use.
|
---|
262 | * NULL if not in use. */
|
---|
263 | PATSSERVER pSrv;
|
---|
264 | /** ATS callback context to use. */
|
---|
265 | ATSCALLBACKCTX CallbackCtx;
|
---|
266 | union
|
---|
267 | {
|
---|
268 | struct
|
---|
269 | {
|
---|
270 | /** Client connected to the ATS on the guest side. */
|
---|
271 | ATSCLIENT AtsClGuest;
|
---|
272 | /** Path to the guest's test set downloaded to the host. */
|
---|
273 | char szPathTestSetGuest[RTPATH_MAX];
|
---|
274 | /** Client connected to the Validation Kit audio driver ATS. */
|
---|
275 | ATSCLIENT AtsClValKit;
|
---|
276 | /** Path to the Validation Kit audio driver's test set downloaded to the host. */
|
---|
277 | char szPathTestSetValKit[RTPATH_MAX];
|
---|
278 | } Host;
|
---|
279 | } u;
|
---|
280 | } AUDIOTESTENV;
|
---|
281 |
|
---|
282 | /**
|
---|
283 | * Audio test descriptor.
|
---|
284 | */
|
---|
285 | typedef struct AUDIOTESTDESC
|
---|
286 | {
|
---|
287 | /** (Sort of) Descriptive test name. */
|
---|
288 | const char *pszName;
|
---|
289 | /** Flag whether the test is excluded. */
|
---|
290 | bool fExcluded;
|
---|
291 | /** The setup callback. */
|
---|
292 | PFNAUDIOTESTSETUP pfnSetup;
|
---|
293 | /** The exec callback. */
|
---|
294 | PFNAUDIOTESTEXEC pfnExec;
|
---|
295 | /** The destruction callback. */
|
---|
296 | PFNAUDIOTESTDESTROY pfnDestroy;
|
---|
297 | } AUDIOTESTDESC;
|
---|
298 |
|
---|
299 | /**
|
---|
300 | * Backend description.
|
---|
301 | */
|
---|
302 | typedef struct AUDIOTESTBACKENDDESC
|
---|
303 | {
|
---|
304 | /** The driver registration structure. */
|
---|
305 | PCPDMDRVREG pDrvReg;
|
---|
306 | /** The backend name.
|
---|
307 | * Aliases are implemented by having multiple entries for the same backend. */
|
---|
308 | const char *pszName;
|
---|
309 | } AUDIOTESTBACKENDDESC;
|
---|
310 |
|
---|
311 | /**
|
---|
312 | * VKAT command table entry.
|
---|
313 | */
|
---|
314 | typedef struct VKATCMD
|
---|
315 | {
|
---|
316 | /** The command name. */
|
---|
317 | const char *pszCommand;
|
---|
318 | /** The command handler. */
|
---|
319 | DECLCALLBACKMEMBER(RTEXITCODE, pfnHandler,(PRTGETOPTSTATE pGetState));
|
---|
320 |
|
---|
321 | /** Command description. */
|
---|
322 | const char *pszDesc;
|
---|
323 | /** Options array. */
|
---|
324 | PCRTGETOPTDEF paOptions;
|
---|
325 | /** Number of options in the option array. */
|
---|
326 | size_t cOptions;
|
---|
327 | /** Gets help for an option. */
|
---|
328 | DECLCALLBACKMEMBER(const char *, pfnOptionHelp,(PCRTGETOPTDEF pOpt));
|
---|
329 | /** Flag indicating if the command needs the ATS transport layer.
|
---|
330 | * Needed for command line parsing. */
|
---|
331 | bool fNeedsTransport;
|
---|
332 | } VKATCMD;
|
---|
333 | /** Pointer to a const VKAT command entry. */
|
---|
334 | typedef VKATCMD const *PCVKATCMD;
|
---|
335 |
|
---|
336 |
|
---|
337 | /*********************************************************************************************************************************
|
---|
338 | * Global Variables *
|
---|
339 | *********************************************************************************************************************************/
|
---|
340 | /** Terminate ASAP if set. Set on Ctrl-C. */
|
---|
341 | extern bool volatile g_fTerminate;
|
---|
342 | /** The release logger. */
|
---|
343 | extern PRTLOGGER g_pRelLogger;
|
---|
344 |
|
---|
345 | /** The test handle. */
|
---|
346 | extern RTTEST g_hTest;
|
---|
347 | extern unsigned g_uVerbosity;
|
---|
348 | extern bool g_fDrvAudioDebug;
|
---|
349 | extern const char *g_pszDrvAudioDebug;
|
---|
350 |
|
---|
351 | /** The test handle. */
|
---|
352 | extern RTTEST g_hTest;
|
---|
353 | /** The current verbosity level. */
|
---|
354 | extern unsigned g_uVerbosity;
|
---|
355 | /** DrvAudio: Enable debug (or not). */
|
---|
356 | extern bool g_fDrvAudioDebug;
|
---|
357 | /** DrvAudio: The debug output path. */
|
---|
358 | extern const char *g_pszDrvAudioDebug;
|
---|
359 |
|
---|
360 | extern const VKATCMD g_CmdEnum;
|
---|
361 | extern const VKATCMD g_CmdPlay;
|
---|
362 | extern const VKATCMD g_CmdRec;
|
---|
363 | extern const VKATCMD g_CmdSelfTest;
|
---|
364 |
|
---|
365 | extern AUDIOTESTDESC g_aTests[];
|
---|
366 | extern unsigned g_cTests;
|
---|
367 |
|
---|
368 | extern AUDIOTESTBACKENDDESC const g_aBackends[];
|
---|
369 | extern unsigned g_cBackends;
|
---|
370 |
|
---|
371 |
|
---|
372 | /*********************************************************************************************************************************
|
---|
373 | * Prototypes *
|
---|
374 | *********************************************************************************************************************************/
|
---|
375 |
|
---|
376 | /** @name Command line handlers
|
---|
377 | * @{ */
|
---|
378 | RTEXITCODE audioTestUsage(PRTSTREAM pStrm);
|
---|
379 | RTEXITCODE audioTestVersion(void);
|
---|
380 | void audioTestShowLogo(PRTSTREAM pStream);
|
---|
381 | /** @} */
|
---|
382 |
|
---|
383 | /** @name Driver stack
|
---|
384 | * @{ */
|
---|
385 | void audioTestDriverStackDelete(PAUDIOTESTDRVSTACK pDrvStack);
|
---|
386 | int audioTestDriverStackInitEx(PAUDIOTESTDRVSTACK pDrvStack, PCPDMDRVREG pDrvReg, bool fEnabledIn, bool fEnabledOut, bool fWithDrvAudio);
|
---|
387 | int audioTestDriverStackInit(PAUDIOTESTDRVSTACK pDrvStack, PCPDMDRVREG pDrvReg, bool fWithDrvAudio);
|
---|
388 | int audioTestDriverStackProbe(PAUDIOTESTDRVSTACK pDrvStack, PCPDMDRVREG pDrvReg, bool fEnabledIn, bool fEnabledOut, bool fWithDrvAudio);
|
---|
389 | int audioTestDriverStackSetDevice(PAUDIOTESTDRVSTACK pDrvStack, PDMAUDIODIR enmDir, const char *pszDevId);
|
---|
390 | /** @} */
|
---|
391 |
|
---|
392 | /** @name Driver
|
---|
393 | * @{ */
|
---|
394 | int audioTestDrvConstruct(PAUDIOTESTDRVSTACK pDrvStack, PCPDMDRVREG pDrvReg, PPDMDRVINS pParentDrvIns, PPPDMDRVINS ppDrvIns);
|
---|
395 | /** @} */
|
---|
396 |
|
---|
397 | /** @name Driver stack stream
|
---|
398 | * @{ */
|
---|
399 | int audioTestDriverStackStreamCreateInput(PAUDIOTESTDRVSTACK pDrvStack, PCPDMAUDIOPCMPROPS pProps,
|
---|
400 | uint32_t cMsBufferSize, uint32_t cMsPreBuffer, uint32_t cMsSchedulingHint,
|
---|
401 | PPDMAUDIOSTREAM *ppStream, PPDMAUDIOSTREAMCFG pCfgAcq);
|
---|
402 | int audioTestDriverStackStreamCreateOutput(PAUDIOTESTDRVSTACK pDrvStack, PCPDMAUDIOPCMPROPS pProps,
|
---|
403 | uint32_t cMsBufferSize, uint32_t cMsPreBuffer, uint32_t cMsSchedulingHint,
|
---|
404 | PPDMAUDIOSTREAM *ppStream, PPDMAUDIOSTREAMCFG pCfgAcq);
|
---|
405 | void audioTestDriverStackStreamDestroy(PAUDIOTESTDRVSTACK pDrvStack, PPDMAUDIOSTREAM pStream);
|
---|
406 | int audioTestDriverStackStreamDrain(PAUDIOTESTDRVSTACK pDrvStack, PPDMAUDIOSTREAM pStream, bool fSync);
|
---|
407 | int audioTestDriverStackStreamEnable(PAUDIOTESTDRVSTACK pDrvStack, PPDMAUDIOSTREAM pStream);
|
---|
408 | int AudioTestDriverStackStreamDisable(PAUDIOTESTDRVSTACK pDrvStack, PPDMAUDIOSTREAM pStream);
|
---|
409 | bool audioTestDriverStackStreamIsOkay(PAUDIOTESTDRVSTACK pDrvStack, PPDMAUDIOSTREAM pStream);
|
---|
410 | uint32_t audioTestDriverStackStreamGetWritable(PAUDIOTESTDRVSTACK pDrvStack, PPDMAUDIOSTREAM pStream);
|
---|
411 | int audioTestDriverStackStreamPlay(PAUDIOTESTDRVSTACK pDrvStack, PPDMAUDIOSTREAM pStream, void const *pvBuf,
|
---|
412 | uint32_t cbBuf, uint32_t *pcbPlayed);
|
---|
413 | uint32_t audioTestDriverStackStreamGetReadable(PAUDIOTESTDRVSTACK pDrvStack, PPDMAUDIOSTREAM pStream);
|
---|
414 | int audioTestDriverStackStreamCapture(PAUDIOTESTDRVSTACK pDrvStack, PPDMAUDIOSTREAM pStream,
|
---|
415 | void *pvBuf, uint32_t cbBuf, uint32_t *pcbCaptured);
|
---|
416 | /** @} */
|
---|
417 |
|
---|
418 | /** @name Backend handling
|
---|
419 | * @{ */
|
---|
420 | PCPDMDRVREG AudioTestGetDefaultBackend(void);
|
---|
421 | PCPDMDRVREG AudioTestFindBackendOpt(const char *pszBackend);
|
---|
422 | /** @} */
|
---|
423 |
|
---|
424 | /** @name Mixing stream
|
---|
425 | * @{ */
|
---|
426 | int AudioTestMixStreamInit(PAUDIOTESTDRVMIXSTREAM pMix, PAUDIOTESTDRVSTACK pDrvStack, PPDMAUDIOSTREAM pStream,
|
---|
427 | PCPDMAUDIOPCMPROPS pProps, uint32_t cMsBuffer);
|
---|
428 | void AudioTestMixStreamTerm(PAUDIOTESTDRVMIXSTREAM pMix);
|
---|
429 | int AudioTestMixStreamEnable(PAUDIOTESTDRVMIXSTREAM pMix);
|
---|
430 | int AudioTestMixStreamDrain(PAUDIOTESTDRVMIXSTREAM pMix, bool fSync);
|
---|
431 | int AudioTestMixStreamDisable(PAUDIOTESTDRVMIXSTREAM pMix);
|
---|
432 | bool AudioTestMixStreamIsOkay(PAUDIOTESTDRVMIXSTREAM pMix);
|
---|
433 | uint32_t AudioTestMixStreamGetWritable(PAUDIOTESTDRVMIXSTREAM pMix);
|
---|
434 | int AudioTestMixStreamPlay(PAUDIOTESTDRVMIXSTREAM pMix, void const *pvBuf, uint32_t cbBuf, uint32_t *pcbPlayed);
|
---|
435 | uint32_t AudioTestMixStreamGetReadable(PAUDIOTESTDRVMIXSTREAM pMix);
|
---|
436 | int AudioTestMixStreamCapture(PAUDIOTESTDRVMIXSTREAM pMix, void *pvBuf, uint32_t cbBuf, uint32_t *pcbCaptured);
|
---|
437 | void AudioTestMixStreamSetVolume(PAUDIOTESTDRVMIXSTREAM pMix, uint8_t uVolumePercent);
|
---|
438 | /** @} */
|
---|
439 |
|
---|
440 | /** @name Device handling
|
---|
441 | * @{ */
|
---|
442 | int audioTestDeviceOpen(PPDMAUDIOHOSTDEV pDev);
|
---|
443 | int audioTestDeviceClose(PPDMAUDIOHOSTDEV pDev);
|
---|
444 |
|
---|
445 | int audioTestDevicesEnumerateAndCheck(PAUDIOTESTDRVSTACK pDrvStack, const char *pszDev, PPDMAUDIOHOSTDEV *ppDev);
|
---|
446 | /** @} */
|
---|
447 |
|
---|
448 | /** @name ATS routines
|
---|
449 | * @{ */
|
---|
450 | int audioTestEnvConnectToValKitAts(PAUDIOTESTENV pTstEnv,
|
---|
451 | const char *pszHostTcpAddr, uint32_t uHostTcpPort);
|
---|
452 | /** @} */
|
---|
453 |
|
---|
454 | /** @name Test environment handling
|
---|
455 | * @{ */
|
---|
456 | int audioTestEnvInit(PAUDIOTESTENV pTstEnv, PAUDIOTESTDRVSTACK pDrvStack);
|
---|
457 | void audioTestEnvDestroy(PAUDIOTESTENV pTstEnv);
|
---|
458 | int audioTestEnvPrologue(PAUDIOTESTENV pTstEnv, bool fPack, char *pszPackFile, size_t cbPackFile);
|
---|
459 |
|
---|
460 | void audioTestParmsInit(PAUDIOTESTPARMS pTstParms);
|
---|
461 | void audioTestParmsDestroy(PAUDIOTESTPARMS pTstParms);
|
---|
462 | /** @} */
|
---|
463 |
|
---|
464 | int audioTestWorker(PAUDIOTESTENV pTstEnv);
|
---|
465 |
|
---|
466 | /** @todo Test tone handling */
|
---|
467 | int audioTestPlayTone(PAUDIOTESTENV pTstEnv, PAUDIOTESTSTREAM pStream, PAUDIOTESTTONEPARMS pParms);
|
---|
468 | /** @} */
|
---|
469 |
|
---|
470 |
|
---|
471 | /*********************************************************************************************************************************
|
---|
472 | * Common command line stuff *
|
---|
473 | *********************************************************************************************************************************/
|
---|
474 |
|
---|
475 | /**
|
---|
476 | * Common long options values.
|
---|
477 | */
|
---|
478 | enum
|
---|
479 | {
|
---|
480 | AUDIO_TEST_OPT_CMN_DAEMONIZE = 256,
|
---|
481 | AUDIO_TEST_OPT_CMN_DAEMONIZED,
|
---|
482 | AUDIO_TEST_OPT_CMN_DEBUG_AUDIO_ENABLE,
|
---|
483 | AUDIO_TEST_OPT_CMN_DEBUG_AUDIO_PATH
|
---|
484 | };
|
---|
485 |
|
---|
486 | /** For use in the option switch to handle common options. */
|
---|
487 | #define AUDIO_TEST_COMMON_OPTION_CASES(a_ValueUnion) \
|
---|
488 | case 'q': \
|
---|
489 | g_uVerbosity = 0; \
|
---|
490 | if (g_pRelLogger) \
|
---|
491 | RTLogGroupSettings(g_pRelLogger, "all=0 all.e"); \
|
---|
492 | break; \
|
---|
493 | \
|
---|
494 | case 'v': \
|
---|
495 | g_uVerbosity++; \
|
---|
496 | if (g_pRelLogger) \
|
---|
497 | RTLogGroupSettings(g_pRelLogger, g_uVerbosity == 1 ? "all.e.l" : g_uVerbosity == 2 ? "all.e.l.f" : "all=~0"); \
|
---|
498 | break; \
|
---|
499 | \
|
---|
500 | case 'V': \
|
---|
501 | return audioTestVersion(); \
|
---|
502 | \
|
---|
503 | case 'h': \
|
---|
504 | audioTestShowLogo(g_pStdOut); \
|
---|
505 | return audioTestUsage(g_pStdOut); \
|
---|
506 | \
|
---|
507 | case AUDIO_TEST_OPT_CMN_DEBUG_AUDIO_ENABLE: \
|
---|
508 | g_fDrvAudioDebug = true; \
|
---|
509 | break; \
|
---|
510 | \
|
---|
511 | case AUDIO_TEST_OPT_CMN_DEBUG_AUDIO_PATH: \
|
---|
512 | g_pszDrvAudioDebug = (a_ValueUnion).psz; \
|
---|
513 | break; \
|
---|
514 | case AUDIO_TEST_OPT_CMN_DAEMONIZE: \
|
---|
515 | break; \
|
---|
516 | case AUDIO_TEST_OPT_CMN_DAEMONIZED: \
|
---|
517 | break;
|
---|
518 |
|
---|
519 | #endif /* !VBOX_INCLUDED_SRC_audio_vkatInternal_h */
|
---|
520 |
|
---|