1 | /* $Id: vkatInternal.h 92396 2021-11-12 11:46:06Z 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 holding additional I/O options.
|
---|
200 | */
|
---|
201 | typedef struct AUDIOTESTIOOPTS
|
---|
202 | {
|
---|
203 | /** Whether to use the audio connector or not. */
|
---|
204 | bool fWithDrvAudio;
|
---|
205 | /** Whether to use a mixing buffer or not. */
|
---|
206 | bool fWithMixer;
|
---|
207 | /** Buffer size (in ms). */
|
---|
208 | uint32_t cMsBufferSize;
|
---|
209 | /** Pre-buffering size (in ms). */
|
---|
210 | uint32_t cMsPreBuffer;
|
---|
211 | /** Scheduling (in ms). */
|
---|
212 | uint32_t cMsSchedulingHint;
|
---|
213 | /** Audio vlume to use (in percent). */
|
---|
214 | uint8_t uVolumePercent;
|
---|
215 | /** PCM audio properties to use. */
|
---|
216 | PDMAUDIOPCMPROPS Props;
|
---|
217 | } AUDIOTESTIOOPTS;
|
---|
218 | /** Pointer to additional playback options. */
|
---|
219 | typedef AUDIOTESTIOOPTS *PAUDIOTESTIOOPTS;
|
---|
220 |
|
---|
221 | /**
|
---|
222 | * Structure for keeping a user context for the test service callbacks.
|
---|
223 | */
|
---|
224 | typedef struct ATSCALLBACKCTX
|
---|
225 | {
|
---|
226 | /** The test environment bound to this context. */
|
---|
227 | PAUDIOTESTENV pTstEnv;
|
---|
228 | /** Absolute path to the packed up test set archive.
|
---|
229 | * Keep it simple for now and only support one (open) archive at a time. */
|
---|
230 | char szTestSetArchive[RTPATH_MAX];
|
---|
231 | /** File handle to the (opened) test set archive for reading. */
|
---|
232 | RTFILE hTestSetArchive;
|
---|
233 | /** Number of currently connected clients. */
|
---|
234 | uint8_t cClients;
|
---|
235 | } ATSCALLBACKCTX;
|
---|
236 | typedef ATSCALLBACKCTX *PATSCALLBACKCTX;
|
---|
237 |
|
---|
238 | /**
|
---|
239 | * Audio test environment parameters.
|
---|
240 | *
|
---|
241 | * This is global to all tests defined.
|
---|
242 | */
|
---|
243 | typedef struct AUDIOTESTENV
|
---|
244 | {
|
---|
245 | /** Audio testing mode. */
|
---|
246 | AUDIOTESTMODE enmMode;
|
---|
247 | /** Whether self test mode is active or not. */
|
---|
248 | bool fSelftest;
|
---|
249 | /** Whether skip the actual verification or not. */
|
---|
250 | bool fSkipVerify;
|
---|
251 | /** Name of the audio device to use.
|
---|
252 | * If empty the default audio device will be used. */
|
---|
253 | char szDev[128];
|
---|
254 | /** Zero-based index of current test (will be increased for every run test). */
|
---|
255 | uint32_t idxTest;
|
---|
256 | /** Number of iterations for *all* tests specified.
|
---|
257 | * When set to 0 (default), a random value (see specific test) will be chosen. */
|
---|
258 | uint32_t cIterations;
|
---|
259 | /** I/O options to use. */
|
---|
260 | AUDIOTESTIOOPTS IoOpts;
|
---|
261 | /** Test tone parameters to use. */
|
---|
262 | AUDIOTESTTONEPARMS ToneParms;
|
---|
263 | /** Output path for storing the test environment's final test files. */
|
---|
264 | char szTag[AUDIOTEST_TAG_MAX];
|
---|
265 | /** Output path for storing the test environment's final test files. */
|
---|
266 | char szPathOut[RTPATH_MAX];
|
---|
267 | /** Temporary path for this test environment. */
|
---|
268 | char szPathTemp[RTPATH_MAX];
|
---|
269 | /** Pointer to audio test driver stack to use. */
|
---|
270 | PAUDIOTESTDRVSTACK pDrvStack;
|
---|
271 | /** Audio stream. */
|
---|
272 | AUDIOTESTSTREAM aStreams[AUDIOTESTENV_MAX_STREAMS];
|
---|
273 | /** The audio test set to use. */
|
---|
274 | AUDIOTESTSET Set;
|
---|
275 | /** TCP options to use for ATS. */
|
---|
276 | AUDIOTESTENVTCPOPTS TcpOpts;
|
---|
277 | /** ATS server instance to use.
|
---|
278 | * NULL if not in use. */
|
---|
279 | PATSSERVER pSrv;
|
---|
280 | /** ATS callback context to use. */
|
---|
281 | ATSCALLBACKCTX CallbackCtx;
|
---|
282 | union
|
---|
283 | {
|
---|
284 | struct
|
---|
285 | {
|
---|
286 | /** Client connected to the ATS on the guest side. */
|
---|
287 | ATSCLIENT AtsClGuest;
|
---|
288 | /** Path to the guest's test set downloaded to the host. */
|
---|
289 | char szPathTestSetGuest[RTPATH_MAX];
|
---|
290 | /** Client connected to the Validation Kit audio driver ATS. */
|
---|
291 | ATSCLIENT AtsClValKit;
|
---|
292 | /** Path to the Validation Kit audio driver's test set downloaded to the host. */
|
---|
293 | char szPathTestSetValKit[RTPATH_MAX];
|
---|
294 | } Host;
|
---|
295 | } u;
|
---|
296 | } AUDIOTESTENV;
|
---|
297 |
|
---|
298 | /**
|
---|
299 | * Audio test descriptor.
|
---|
300 | */
|
---|
301 | typedef struct AUDIOTESTDESC
|
---|
302 | {
|
---|
303 | /** (Sort of) Descriptive test name. */
|
---|
304 | const char *pszName;
|
---|
305 | /** Flag whether the test is excluded. */
|
---|
306 | bool fExcluded;
|
---|
307 | /** The setup callback. */
|
---|
308 | PFNAUDIOTESTSETUP pfnSetup;
|
---|
309 | /** The exec callback. */
|
---|
310 | PFNAUDIOTESTEXEC pfnExec;
|
---|
311 | /** The destruction callback. */
|
---|
312 | PFNAUDIOTESTDESTROY pfnDestroy;
|
---|
313 | } AUDIOTESTDESC;
|
---|
314 |
|
---|
315 | /**
|
---|
316 | * Backend description.
|
---|
317 | */
|
---|
318 | typedef struct AUDIOTESTBACKENDDESC
|
---|
319 | {
|
---|
320 | /** The driver registration structure. */
|
---|
321 | PCPDMDRVREG pDrvReg;
|
---|
322 | /** The backend name.
|
---|
323 | * Aliases are implemented by having multiple entries for the same backend. */
|
---|
324 | const char *pszName;
|
---|
325 | } AUDIOTESTBACKENDDESC;
|
---|
326 |
|
---|
327 | /**
|
---|
328 | * VKAT command table entry.
|
---|
329 | */
|
---|
330 | typedef struct VKATCMD
|
---|
331 | {
|
---|
332 | /** The command name. */
|
---|
333 | const char *pszCommand;
|
---|
334 | /** The command handler. */
|
---|
335 | DECLCALLBACKMEMBER(RTEXITCODE, pfnHandler,(PRTGETOPTSTATE pGetState));
|
---|
336 |
|
---|
337 | /** Command description. */
|
---|
338 | const char *pszDesc;
|
---|
339 | /** Options array. */
|
---|
340 | PCRTGETOPTDEF paOptions;
|
---|
341 | /** Number of options in the option array. */
|
---|
342 | size_t cOptions;
|
---|
343 | /** Gets help for an option. */
|
---|
344 | DECLCALLBACKMEMBER(const char *, pfnOptionHelp,(PCRTGETOPTDEF pOpt));
|
---|
345 | /** Flag indicating if the command needs the ATS transport layer.
|
---|
346 | * Needed for command line parsing. */
|
---|
347 | bool fNeedsTransport;
|
---|
348 | } VKATCMD;
|
---|
349 | /** Pointer to a const VKAT command entry. */
|
---|
350 | typedef VKATCMD const *PCVKATCMD;
|
---|
351 |
|
---|
352 |
|
---|
353 | /*********************************************************************************************************************************
|
---|
354 | * Global Variables *
|
---|
355 | *********************************************************************************************************************************/
|
---|
356 | /** Terminate ASAP if set. Set on Ctrl-C. */
|
---|
357 | extern bool volatile g_fTerminate;
|
---|
358 | /** The release logger. */
|
---|
359 | extern PRTLOGGER g_pRelLogger;
|
---|
360 |
|
---|
361 | /** The test handle. */
|
---|
362 | extern RTTEST g_hTest;
|
---|
363 | /** The current verbosity level. */
|
---|
364 | extern unsigned g_uVerbosity;
|
---|
365 | /** DrvAudio: Enable debug (or not). */
|
---|
366 | extern bool g_fDrvAudioDebug;
|
---|
367 | /** DrvAudio: The debug output path. */
|
---|
368 | extern const char *g_pszDrvAudioDebug;
|
---|
369 |
|
---|
370 | extern const VKATCMD g_CmdEnum;
|
---|
371 | extern const VKATCMD g_CmdPlay;
|
---|
372 | extern const VKATCMD g_CmdRec;
|
---|
373 | extern const VKATCMD g_CmdSelfTest;
|
---|
374 |
|
---|
375 | extern AUDIOTESTDESC g_aTests[];
|
---|
376 | extern unsigned g_cTests;
|
---|
377 |
|
---|
378 | extern AUDIOTESTBACKENDDESC const g_aBackends[];
|
---|
379 | extern unsigned g_cBackends;
|
---|
380 |
|
---|
381 |
|
---|
382 | /*********************************************************************************************************************************
|
---|
383 | * Prototypes *
|
---|
384 | *********************************************************************************************************************************/
|
---|
385 |
|
---|
386 | /** @name Command line handlers
|
---|
387 | * @{ */
|
---|
388 | RTEXITCODE audioTestUsage(PRTSTREAM pStrm);
|
---|
389 | RTEXITCODE audioTestVersion(void);
|
---|
390 | void audioTestShowLogo(PRTSTREAM pStream);
|
---|
391 | /** @} */
|
---|
392 |
|
---|
393 | /** @name Driver stack
|
---|
394 | * @{ */
|
---|
395 | int AudioTestDriverStackPerformSelftest(void);
|
---|
396 |
|
---|
397 | void audioTestDriverStackDelete(PAUDIOTESTDRVSTACK pDrvStack);
|
---|
398 | int audioTestDriverStackInitEx(PAUDIOTESTDRVSTACK pDrvStack, PCPDMDRVREG pDrvReg, bool fEnabledIn, bool fEnabledOut, bool fWithDrvAudio);
|
---|
399 | int audioTestDriverStackInit(PAUDIOTESTDRVSTACK pDrvStack, PCPDMDRVREG pDrvReg, bool fWithDrvAudio);
|
---|
400 | int audioTestDriverStackProbe(PAUDIOTESTDRVSTACK pDrvStack, PCPDMDRVREG pDrvReg, bool fEnabledIn, bool fEnabledOut, bool fWithDrvAudio);
|
---|
401 | int audioTestDriverStackSetDevice(PAUDIOTESTDRVSTACK pDrvStack, PDMAUDIODIR enmDir, const char *pszDevId);
|
---|
402 | /** @} */
|
---|
403 |
|
---|
404 | /** @name Driver
|
---|
405 | * @{ */
|
---|
406 | int audioTestDrvConstruct(PAUDIOTESTDRVSTACK pDrvStack, PCPDMDRVREG pDrvReg, PPDMDRVINS pParentDrvIns, PPPDMDRVINS ppDrvIns);
|
---|
407 | /** @} */
|
---|
408 |
|
---|
409 | /** @name Driver stack stream
|
---|
410 | * @{ */
|
---|
411 | int audioTestDriverStackStreamCreateInput(PAUDIOTESTDRVSTACK pDrvStack, PCPDMAUDIOPCMPROPS pProps,
|
---|
412 | uint32_t cMsBufferSize, uint32_t cMsPreBuffer, uint32_t cMsSchedulingHint,
|
---|
413 | PPDMAUDIOSTREAM *ppStream, PPDMAUDIOSTREAMCFG pCfgAcq);
|
---|
414 | int audioTestDriverStackStreamCreateOutput(PAUDIOTESTDRVSTACK pDrvStack, PCPDMAUDIOPCMPROPS pProps,
|
---|
415 | uint32_t cMsBufferSize, uint32_t cMsPreBuffer, uint32_t cMsSchedulingHint,
|
---|
416 | PPDMAUDIOSTREAM *ppStream, PPDMAUDIOSTREAMCFG pCfgAcq);
|
---|
417 | void audioTestDriverStackStreamDestroy(PAUDIOTESTDRVSTACK pDrvStack, PPDMAUDIOSTREAM pStream);
|
---|
418 | int audioTestDriverStackStreamDrain(PAUDIOTESTDRVSTACK pDrvStack, PPDMAUDIOSTREAM pStream, bool fSync);
|
---|
419 | int audioTestDriverStackStreamEnable(PAUDIOTESTDRVSTACK pDrvStack, PPDMAUDIOSTREAM pStream);
|
---|
420 | int AudioTestDriverStackStreamDisable(PAUDIOTESTDRVSTACK pDrvStack, PPDMAUDIOSTREAM pStream);
|
---|
421 | bool audioTestDriverStackStreamIsOkay(PAUDIOTESTDRVSTACK pDrvStack, PPDMAUDIOSTREAM pStream);
|
---|
422 | uint32_t audioTestDriverStackStreamGetWritable(PAUDIOTESTDRVSTACK pDrvStack, PPDMAUDIOSTREAM pStream);
|
---|
423 | int audioTestDriverStackStreamPlay(PAUDIOTESTDRVSTACK pDrvStack, PPDMAUDIOSTREAM pStream, void const *pvBuf,
|
---|
424 | uint32_t cbBuf, uint32_t *pcbPlayed);
|
---|
425 | uint32_t audioTestDriverStackStreamGetReadable(PAUDIOTESTDRVSTACK pDrvStack, PPDMAUDIOSTREAM pStream);
|
---|
426 | int audioTestDriverStackStreamCapture(PAUDIOTESTDRVSTACK pDrvStack, PPDMAUDIOSTREAM pStream,
|
---|
427 | void *pvBuf, uint32_t cbBuf, uint32_t *pcbCaptured);
|
---|
428 | /** @} */
|
---|
429 |
|
---|
430 | /** @name Backend handling
|
---|
431 | * @{ */
|
---|
432 | PCPDMDRVREG AudioTestGetDefaultBackend(void);
|
---|
433 | PCPDMDRVREG AudioTestFindBackendOpt(const char *pszBackend);
|
---|
434 | /** @} */
|
---|
435 |
|
---|
436 | /** @name Mixing stream
|
---|
437 | * @{ */
|
---|
438 | int AudioTestMixStreamInit(PAUDIOTESTDRVMIXSTREAM pMix, PAUDIOTESTDRVSTACK pDrvStack, PPDMAUDIOSTREAM pStream,
|
---|
439 | PCPDMAUDIOPCMPROPS pProps, uint32_t cMsBuffer);
|
---|
440 | void AudioTestMixStreamTerm(PAUDIOTESTDRVMIXSTREAM pMix);
|
---|
441 | int AudioTestMixStreamEnable(PAUDIOTESTDRVMIXSTREAM pMix);
|
---|
442 | int AudioTestMixStreamDrain(PAUDIOTESTDRVMIXSTREAM pMix, bool fSync);
|
---|
443 | int AudioTestMixStreamDisable(PAUDIOTESTDRVMIXSTREAM pMix);
|
---|
444 | bool AudioTestMixStreamIsOkay(PAUDIOTESTDRVMIXSTREAM pMix);
|
---|
445 | uint32_t AudioTestMixStreamGetWritable(PAUDIOTESTDRVMIXSTREAM pMix);
|
---|
446 | int AudioTestMixStreamPlay(PAUDIOTESTDRVMIXSTREAM pMix, void const *pvBuf, uint32_t cbBuf, uint32_t *pcbPlayed);
|
---|
447 | uint32_t AudioTestMixStreamGetReadable(PAUDIOTESTDRVMIXSTREAM pMix);
|
---|
448 | int AudioTestMixStreamCapture(PAUDIOTESTDRVMIXSTREAM pMix, void *pvBuf, uint32_t cbBuf, uint32_t *pcbCaptured);
|
---|
449 | void AudioTestMixStreamSetVolume(PAUDIOTESTDRVMIXSTREAM pMix, uint8_t uVolumePercent);
|
---|
450 | /** @} */
|
---|
451 |
|
---|
452 | /** @name Device handling
|
---|
453 | * @{ */
|
---|
454 | int audioTestDeviceOpen(PPDMAUDIOHOSTDEV pDev);
|
---|
455 | int audioTestDeviceClose(PPDMAUDIOHOSTDEV pDev);
|
---|
456 |
|
---|
457 | int audioTestDevicesEnumerateAndCheck(PAUDIOTESTDRVSTACK pDrvStack, const char *pszDev, PPDMAUDIOHOSTDEV *ppDev);
|
---|
458 | /** @} */
|
---|
459 |
|
---|
460 | /** @name ATS routines
|
---|
461 | * @{ */
|
---|
462 | int audioTestEnvConnectToValKitAts(PAUDIOTESTENV pTstEnv,
|
---|
463 | const char *pszHostTcpAddr, uint32_t uHostTcpPort);
|
---|
464 | /** @} */
|
---|
465 |
|
---|
466 | /** @name Test environment handling
|
---|
467 | * @{ */
|
---|
468 | void audioTestEnvInit(PAUDIOTESTENV pTstEnv);
|
---|
469 | int audioTestEnvCreate(PAUDIOTESTENV pTstEnv, PAUDIOTESTDRVSTACK pDrvStack);
|
---|
470 | void audioTestEnvDestroy(PAUDIOTESTENV pTstEnv);
|
---|
471 | int audioTestEnvPrologue(PAUDIOTESTENV pTstEnv, bool fPack, char *pszPackFile, size_t cbPackFile);
|
---|
472 |
|
---|
473 | void audioTestParmsInit(PAUDIOTESTPARMS pTstParms);
|
---|
474 | void audioTestParmsDestroy(PAUDIOTESTPARMS pTstParms);
|
---|
475 | /** @} */
|
---|
476 |
|
---|
477 | int audioTestWorker(PAUDIOTESTENV pTstEnv);
|
---|
478 |
|
---|
479 | /** @todo Test tone handling */
|
---|
480 | int audioTestPlayTone(PAUDIOTESTIOOPTS pIoOpts, PAUDIOTESTENV pTstEnv, PAUDIOTESTSTREAM pStream, PAUDIOTESTTONEPARMS pParms);
|
---|
481 | void audioTestToneParmsInit(PAUDIOTESTTONEPARMS pToneParms);
|
---|
482 | /** @} */
|
---|
483 |
|
---|
484 | void audioTestIoOptsInitDefaults(PAUDIOTESTIOOPTS pIoOpts);
|
---|
485 |
|
---|
486 | /*********************************************************************************************************************************
|
---|
487 | * Common command line stuff *
|
---|
488 | *********************************************************************************************************************************/
|
---|
489 |
|
---|
490 | /**
|
---|
491 | * Common long options values.
|
---|
492 | */
|
---|
493 | enum
|
---|
494 | {
|
---|
495 | AUDIO_TEST_OPT_CMN_DAEMONIZE = 256,
|
---|
496 | AUDIO_TEST_OPT_CMN_DAEMONIZED,
|
---|
497 | AUDIO_TEST_OPT_CMN_DEBUG_AUDIO_ENABLE,
|
---|
498 | AUDIO_TEST_OPT_CMN_DEBUG_AUDIO_PATH
|
---|
499 | };
|
---|
500 |
|
---|
501 | /** For use in the option switch to handle common options. */
|
---|
502 | #define AUDIO_TEST_COMMON_OPTION_CASES(a_ValueUnion) \
|
---|
503 | case 'q': \
|
---|
504 | g_uVerbosity = 0; \
|
---|
505 | if (g_pRelLogger) \
|
---|
506 | RTLogGroupSettings(g_pRelLogger, "all=0 all.e"); \
|
---|
507 | break; \
|
---|
508 | \
|
---|
509 | case 'v': \
|
---|
510 | /* No-op here, has been handled by main() already. */ \
|
---|
511 | break; \
|
---|
512 | \
|
---|
513 | case 'V': \
|
---|
514 | return audioTestVersion(); \
|
---|
515 | \
|
---|
516 | case 'h': \
|
---|
517 | audioTestShowLogo(g_pStdOut); \
|
---|
518 | return audioTestUsage(g_pStdOut); \
|
---|
519 | \
|
---|
520 | case AUDIO_TEST_OPT_CMN_DEBUG_AUDIO_ENABLE: \
|
---|
521 | g_fDrvAudioDebug = true; \
|
---|
522 | break; \
|
---|
523 | \
|
---|
524 | case AUDIO_TEST_OPT_CMN_DEBUG_AUDIO_PATH: \
|
---|
525 | g_pszDrvAudioDebug = (a_ValueUnion).psz; \
|
---|
526 | break; \
|
---|
527 | case AUDIO_TEST_OPT_CMN_DAEMONIZE: \
|
---|
528 | break; \
|
---|
529 | case AUDIO_TEST_OPT_CMN_DAEMONIZED: \
|
---|
530 | break;
|
---|
531 |
|
---|
532 | #endif /* !VBOX_INCLUDED_SRC_audio_vkatInternal_h */
|
---|
533 |
|
---|