VirtualBox

source: vbox/trunk/src/VBox/ValidationKit/utils/audio/vkatInternal.h@ 89526

Last change on this file since 89526 was 89490, checked in by vboxsync, 4 years ago

ValKit/AudioTest: Simplified PDMIAUDIOCONNECTOR::pfnStreamCreate by moving the acquired configuration to the resulting stream (PDMAUDIOSTREAM::Cfg). bugref:10008

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 6.7 KB
Line 
1/* $Id: vkatInternal.h 89490 2021-06-03 23:00:04Z 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 */
46typedef 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. */
61typedef AUDIOTESTDRVSTACK *PAUDIOTESTDRVSTACK;
62
63/**
64 * Backend-only stream structure.
65 */
66typedef struct AUDIOTESTDRVSTACKSTREAM
67{
68 /** The public stream data. */
69 PDMAUDIOSTREAM Core;
70 /** The backend data (variable size). */
71 PDMAUDIOBACKENDSTREAM Backend;
72} AUDIOTESTDRVSTACKSTREAM;
73/** Pointer to a backend-only stream structure. */
74typedef AUDIOTESTDRVSTACKSTREAM *PAUDIOTESTDRVSTACKSTREAM;
75
76/**
77 * Mixer setup for a stream.
78 */
79typedef struct AUDIOTESTDRVMIXSTREAM
80{
81 /** Pointer to the driver stack. */
82 PAUDIOTESTDRVSTACK pDrvStack;
83 /** Pointer to the stream. */
84 PPDMAUDIOSTREAM pStream;
85 /** Properties to use. */
86 PCPDMAUDIOPCMPROPS pProps;
87 /** Set if we're mixing or just passing thru to the driver stack. */
88 bool fDoMixing;
89 /** Mixer buffer. */
90 AUDIOMIXBUF MixBuf;
91 /** Write state. */
92 AUDIOMIXBUFWRITESTATE WriteState;
93 /** Peek state. */
94 AUDIOMIXBUFPEEKSTATE PeekState;
95} AUDIOTESTDRVMIXSTREAM;
96/** Pointer to mixer setup for a stream. */
97typedef AUDIOTESTDRVMIXSTREAM *PAUDIOTESTDRVMIXSTREAM;
98
99
100/** The test handle. */
101extern RTTEST g_hTest;
102extern unsigned g_uVerbosity;
103extern bool g_fDrvAudioDebug;
104extern const char *g_pszDrvAudioDebug;
105
106
107/** @name Driver stack
108 * @{ */
109void audioTestDriverStackDelete(PAUDIOTESTDRVSTACK pDrvStack);
110int audioTestDriverStackInit(PAUDIOTESTDRVSTACK pDrvStack, PCPDMDRVREG pDrvReg, bool fWithDrvAudio);
111int audioTestDriverStackSetDevice(PAUDIOTESTDRVSTACK pDrvStack, PDMAUDIODIR enmDir, const char *pszDevId);
112/** @} */
113
114/** @name Driver
115 * @{ */
116int audioTestDrvConstruct(PAUDIOTESTDRVSTACK pDrvStack, PCPDMDRVREG pDrvReg, PPDMDRVINS pParentDrvIns, PPPDMDRVINS ppDrvIns);
117/** @} */
118
119/** @name Driver stack stream
120 * @{ */
121int audioTestDriverStackStreamCreateInput(PAUDIOTESTDRVSTACK pDrvStack, PCPDMAUDIOPCMPROPS pProps,
122 uint32_t cMsBufferSize, uint32_t cMsPreBuffer, uint32_t cMsSchedulingHint,
123 PPDMAUDIOSTREAM *ppStream, PPDMAUDIOSTREAMCFG pCfgAcq);
124int audioTestDriverStackStreamCreateOutput(PAUDIOTESTDRVSTACK pDrvStack, PCPDMAUDIOPCMPROPS pProps,
125 uint32_t cMsBufferSize, uint32_t cMsPreBuffer, uint32_t cMsSchedulingHint,
126 PPDMAUDIOSTREAM *ppStream, PPDMAUDIOSTREAMCFG pCfgAcq);
127void audioTestDriverStackStreamDestroy(PAUDIOTESTDRVSTACK pDrvStack, PPDMAUDIOSTREAM pStream);
128int audioTestDriverStackStreamDrain(PAUDIOTESTDRVSTACK pDrvStack, PPDMAUDIOSTREAM pStream, bool fSync);
129int audioTestDriverStackStreamEnable(PAUDIOTESTDRVSTACK pDrvStack, PPDMAUDIOSTREAM pStream);
130int AudioTestDriverStackStreamDisable(PAUDIOTESTDRVSTACK pDrvStack, PPDMAUDIOSTREAM pStream);
131bool audioTestDriverStackStreamIsOkay(PAUDIOTESTDRVSTACK pDrvStack, PPDMAUDIOSTREAM pStream);
132uint32_t audioTestDriverStackStreamGetWritable(PAUDIOTESTDRVSTACK pDrvStack, PPDMAUDIOSTREAM pStream);
133int audioTestDriverStackStreamPlay(PAUDIOTESTDRVSTACK pDrvStack, PPDMAUDIOSTREAM pStream, void const *pvBuf,
134 uint32_t cbBuf, uint32_t *pcbPlayed);
135uint32_t audioTestDriverStackStreamGetReadable(PAUDIOTESTDRVSTACK pDrvStack, PPDMAUDIOSTREAM pStream);
136int audioTestDriverStackStreamCapture(PAUDIOTESTDRVSTACK pDrvStack, PPDMAUDIOSTREAM pStream,
137 void *pvBuf, uint32_t cbBuf, uint32_t *pcbCaptured);
138/** @} */
139
140
141/** @name Mixing stream
142 * @{ */
143int AudioTestMixStreamInit(PAUDIOTESTDRVMIXSTREAM pMix, PAUDIOTESTDRVSTACK pDrvStack, PPDMAUDIOSTREAM pStream,
144 PCPDMAUDIOPCMPROPS pProps, uint32_t cMsBuffer);
145void AudioTestMixStreamTerm(PAUDIOTESTDRVMIXSTREAM pMix);
146int AudioTestMixStreamEnable(PAUDIOTESTDRVMIXSTREAM pMix);
147int AudioTestMixStreamDrain(PAUDIOTESTDRVMIXSTREAM pMix, bool fSync);
148int AudioTestMixStreamDisable(PAUDIOTESTDRVMIXSTREAM pMix);
149bool AudioTestMixStreamIsOkay(PAUDIOTESTDRVMIXSTREAM pMix);
150uint32_t AudioTestMixStreamGetWritable(PAUDIOTESTDRVMIXSTREAM pMix);
151int AudioTestMixStreamPlay(PAUDIOTESTDRVMIXSTREAM pMix, void const *pvBuf, uint32_t cbBuf, uint32_t *pcbPlayed);
152uint32_t AudioTestMixStreamGetReadable(PAUDIOTESTDRVMIXSTREAM pMix);
153int AudioTestMixStreamCapture(PAUDIOTESTDRVMIXSTREAM pMix, void *pvBuf, uint32_t cbBuf, uint32_t *pcbCaptured);
154/** @} */
155
156
157#endif /* !VBOX_INCLUDED_SRC_audio_vkatInternal_h */
158
Note: See TracBrowser for help on using the repository browser.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette