1 | /* $Id: vkatInternal.h 89439 2021-06-01 19:41:40Z 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 | #include <VBox/vmm/pdmdrv.h>
|
---|
34 | #include <VBox/vmm/pdmaudioinline.h>
|
---|
35 | #include <VBox/vmm/pdmaudiohostenuminline.h>
|
---|
36 | #include "Audio/AudioMixBuffer.h"
|
---|
37 |
|
---|
38 |
|
---|
39 | /**
|
---|
40 | * Audio driver stack.
|
---|
41 | *
|
---|
42 | * This can be just be backend driver alone or DrvAudio with a backend.
|
---|
43 | * @todo add automatic resampling via mixer so we can test more of the audio
|
---|
44 | * stack used by the device emulations.
|
---|
45 | */
|
---|
46 | typedef struct AUDIOTESTDRVSTACK
|
---|
47 | {
|
---|
48 | /** The device registration record for the backend. */
|
---|
49 | PCPDMDRVREG pDrvReg;
|
---|
50 | /** The backend driver instance. */
|
---|
51 | PPDMDRVINS pDrvBackendIns;
|
---|
52 | /** The backend's audio interface. */
|
---|
53 | PPDMIHOSTAUDIO pIHostAudio;
|
---|
54 |
|
---|
55 | /** The DrvAudio instance. */
|
---|
56 | PPDMDRVINS pDrvAudioIns;
|
---|
57 | /** This is NULL if we don't use DrvAudio. */
|
---|
58 | PPDMIAUDIOCONNECTOR pIAudioConnector;
|
---|
59 | } AUDIOTESTDRVSTACK;
|
---|
60 | /** Pointer to an audio driver stack. */
|
---|
61 | typedef AUDIOTESTDRVSTACK *PAUDIOTESTDRVSTACK;
|
---|
62 |
|
---|
63 | /**
|
---|
64 | * Backend-only stream structure.
|
---|
65 | */
|
---|
66 | typedef struct AUDIOTESTDRVSTACKSTREAM
|
---|
67 | {
|
---|
68 | /** The public stream data. */
|
---|
69 | PDMAUDIOSTREAM Core;
|
---|
70 | /** The acquired config. */
|
---|
71 | PDMAUDIOSTREAMCFG Cfg;
|
---|
72 | /** The backend data (variable size). */
|
---|
73 | PDMAUDIOBACKENDSTREAM Backend;
|
---|
74 | } AUDIOTESTDRVSTACKSTREAM;
|
---|
75 | /** Pointer to a backend-only stream structure. */
|
---|
76 | typedef AUDIOTESTDRVSTACKSTREAM *PAUDIOTESTDRVSTACKSTREAM;
|
---|
77 |
|
---|
78 | /**
|
---|
79 | * Mixer setup for a stream.
|
---|
80 | */
|
---|
81 | typedef struct AUDIOTESTDRVMIXSTREAM
|
---|
82 | {
|
---|
83 | /** Pointer to the driver stack. */
|
---|
84 | PAUDIOTESTDRVSTACK pDrvStack;
|
---|
85 | /** Pointer to the stream. */
|
---|
86 | PPDMAUDIOSTREAM pStream;
|
---|
87 | /** Properties to use. */
|
---|
88 | PCPDMAUDIOPCMPROPS pProps;
|
---|
89 | /** Set if we're mixing or just passing thru to the driver stack. */
|
---|
90 | bool fDoMixing;
|
---|
91 | /** Mixer buffer. */
|
---|
92 | AUDIOMIXBUF MixBuf;
|
---|
93 | /** Write state. */
|
---|
94 | AUDIOMIXBUFWRITESTATE WriteState;
|
---|
95 | /** Peek state. */
|
---|
96 | AUDIOMIXBUFPEEKSTATE PeekState;
|
---|
97 | } AUDIOTESTDRVMIXSTREAM;
|
---|
98 | /** Pointer to mixer setup for a stream. */
|
---|
99 | typedef AUDIOTESTDRVMIXSTREAM *PAUDIOTESTDRVMIXSTREAM;
|
---|
100 |
|
---|
101 |
|
---|
102 | /** The test handle. */
|
---|
103 | extern RTTEST g_hTest;
|
---|
104 | extern unsigned g_uVerbosity;
|
---|
105 | extern bool g_fDrvAudioDebug;
|
---|
106 | extern const char *g_pszDrvAudioDebug;
|
---|
107 |
|
---|
108 |
|
---|
109 | /** @name Driver stack
|
---|
110 | * @{ */
|
---|
111 | void audioTestDriverStackDelete(PAUDIOTESTDRVSTACK pDrvStack);
|
---|
112 | int audioTestDriverStackInit(PAUDIOTESTDRVSTACK pDrvStack, PCPDMDRVREG pDrvReg, bool fWithDrvAudio);
|
---|
113 | int audioTestDriverStackSetDevice(PAUDIOTESTDRVSTACK pDrvStack, PDMAUDIODIR enmDir, const char *pszDevId);
|
---|
114 | /** @} */
|
---|
115 |
|
---|
116 | /** @name Driver
|
---|
117 | * @{ */
|
---|
118 | int audioTestDrvConstruct(PAUDIOTESTDRVSTACK pDrvStack, PCPDMDRVREG pDrvReg, PPDMDRVINS pParentDrvIns, PPPDMDRVINS ppDrvIns);
|
---|
119 | /** @} */
|
---|
120 |
|
---|
121 | /** @name Driver stack stream
|
---|
122 | * @{ */
|
---|
123 | int audioTestDriverStackStreamCreateInput(PAUDIOTESTDRVSTACK pDrvStack, PCPDMAUDIOPCMPROPS pProps,
|
---|
124 | uint32_t cMsBufferSize, uint32_t cMsPreBuffer, uint32_t cMsSchedulingHint,
|
---|
125 | PPDMAUDIOSTREAM *ppStream, PPDMAUDIOSTREAMCFG pCfgAcq);
|
---|
126 | int audioTestDriverStackStreamCreateOutput(PAUDIOTESTDRVSTACK pDrvStack, PCPDMAUDIOPCMPROPS pProps,
|
---|
127 | uint32_t cMsBufferSize, uint32_t cMsPreBuffer, uint32_t cMsSchedulingHint,
|
---|
128 | PPDMAUDIOSTREAM *ppStream, PPDMAUDIOSTREAMCFG pCfgAcq);
|
---|
129 | void audioTestDriverStackStreamDestroy(PAUDIOTESTDRVSTACK pDrvStack, PPDMAUDIOSTREAM pStream);
|
---|
130 | int audioTestDriverStackStreamDrain(PAUDIOTESTDRVSTACK pDrvStack, PPDMAUDIOSTREAM pStream, bool fSync);
|
---|
131 | int audioTestDriverStackStreamEnable(PAUDIOTESTDRVSTACK pDrvStack, PPDMAUDIOSTREAM pStream);
|
---|
132 | int audioTestDriverStackStreamDisable(PAUDIOTESTDRVSTACK pDrvStack, PPDMAUDIOSTREAM pStream);
|
---|
133 | uint32_t audioTestDriverStackStreamGetWritable(PAUDIOTESTDRVSTACK pDrvStack, PPDMAUDIOSTREAM pStream);
|
---|
134 | bool audioTestDriverStackStreamIsOkay(PAUDIOTESTDRVSTACK pDrvStack, PPDMAUDIOSTREAM pStream);
|
---|
135 | int audioTestDriverStackStreamPlay(PAUDIOTESTDRVSTACK pDrvStack, PPDMAUDIOSTREAM pStream, void const *pvBuf,
|
---|
136 | uint32_t cbBuf, uint32_t *pcbPlayed);
|
---|
137 | int audioTestDriverStackStreamCapture(PAUDIOTESTDRVSTACK pDrvStack, PPDMAUDIOSTREAM pStream,
|
---|
138 | void *pvBuf, uint32_t cbBuf, uint32_t *pcbCaptured);
|
---|
139 | /** @} */
|
---|
140 |
|
---|
141 |
|
---|
142 | /** @name Mixing stream
|
---|
143 | * @{ */
|
---|
144 | int AudioTestMixStreamInit(PAUDIOTESTDRVMIXSTREAM pMix, PAUDIOTESTDRVSTACK pDrvStack, PPDMAUDIOSTREAM pStream,
|
---|
145 | PCPDMAUDIOPCMPROPS pProps, uint32_t cMsBuffer);
|
---|
146 | void AudioTestMixStreamTerm(PAUDIOTESTDRVMIXSTREAM pMix);
|
---|
147 | int AudioTestMixStreamDrain(PAUDIOTESTDRVMIXSTREAM pMix, bool fSync);
|
---|
148 | int AudioTestMixStreamEnable(PAUDIOTESTDRVMIXSTREAM pMix);
|
---|
149 | uint32_t AudioTestMixStreamGetWritable(PAUDIOTESTDRVMIXSTREAM pMix);
|
---|
150 | bool AudioTestMixStreamIsOkay(PAUDIOTESTDRVMIXSTREAM pMix);
|
---|
151 | int AudioTestMixStreamPlay(PAUDIOTESTDRVMIXSTREAM pMix, void const *pvBuf, uint32_t cbBuf, uint32_t *pcbPlayed);
|
---|
152 | int AudioTestMixStreamCapture(PAUDIOTESTDRVMIXSTREAM pMix, void *pvBuf, uint32_t cbBuf, uint32_t *pcbCaptured);
|
---|
153 | /** @} */
|
---|
154 |
|
---|
155 |
|
---|
156 | #endif /* !VBOX_INCLUDED_SRC_audio_vkatInternal_h */
|
---|
157 |
|
---|