VirtualBox

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

Last change on this file since 89455 was 89439, checked in by vboxsync, 4 years ago

ValKit/AudioTest: Mated the mixer to the play command and made it possible to control the backend stream parameters to test resampling and channel selection. bugref:10008

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 6.5 KB
Line 
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 */
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 acquired config. */
71 PDMAUDIOSTREAMCFG Cfg;
72 /** The backend data (variable size). */
73 PDMAUDIOBACKENDSTREAM Backend;
74} AUDIOTESTDRVSTACKSTREAM;
75/** Pointer to a backend-only stream structure. */
76typedef AUDIOTESTDRVSTACKSTREAM *PAUDIOTESTDRVSTACKSTREAM;
77
78/**
79 * Mixer setup for a stream.
80 */
81typedef 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. */
99typedef AUDIOTESTDRVMIXSTREAM *PAUDIOTESTDRVMIXSTREAM;
100
101
102/** The test handle. */
103extern RTTEST g_hTest;
104extern unsigned g_uVerbosity;
105extern bool g_fDrvAudioDebug;
106extern const char *g_pszDrvAudioDebug;
107
108
109/** @name Driver stack
110 * @{ */
111void audioTestDriverStackDelete(PAUDIOTESTDRVSTACK pDrvStack);
112int audioTestDriverStackInit(PAUDIOTESTDRVSTACK pDrvStack, PCPDMDRVREG pDrvReg, bool fWithDrvAudio);
113int audioTestDriverStackSetDevice(PAUDIOTESTDRVSTACK pDrvStack, PDMAUDIODIR enmDir, const char *pszDevId);
114/** @} */
115
116/** @name Driver
117 * @{ */
118int audioTestDrvConstruct(PAUDIOTESTDRVSTACK pDrvStack, PCPDMDRVREG pDrvReg, PPDMDRVINS pParentDrvIns, PPPDMDRVINS ppDrvIns);
119/** @} */
120
121/** @name Driver stack stream
122 * @{ */
123int audioTestDriverStackStreamCreateInput(PAUDIOTESTDRVSTACK pDrvStack, PCPDMAUDIOPCMPROPS pProps,
124 uint32_t cMsBufferSize, uint32_t cMsPreBuffer, uint32_t cMsSchedulingHint,
125 PPDMAUDIOSTREAM *ppStream, PPDMAUDIOSTREAMCFG pCfgAcq);
126int audioTestDriverStackStreamCreateOutput(PAUDIOTESTDRVSTACK pDrvStack, PCPDMAUDIOPCMPROPS pProps,
127 uint32_t cMsBufferSize, uint32_t cMsPreBuffer, uint32_t cMsSchedulingHint,
128 PPDMAUDIOSTREAM *ppStream, PPDMAUDIOSTREAMCFG pCfgAcq);
129void audioTestDriverStackStreamDestroy(PAUDIOTESTDRVSTACK pDrvStack, PPDMAUDIOSTREAM pStream);
130int audioTestDriverStackStreamDrain(PAUDIOTESTDRVSTACK pDrvStack, PPDMAUDIOSTREAM pStream, bool fSync);
131int audioTestDriverStackStreamEnable(PAUDIOTESTDRVSTACK pDrvStack, PPDMAUDIOSTREAM pStream);
132int audioTestDriverStackStreamDisable(PAUDIOTESTDRVSTACK pDrvStack, PPDMAUDIOSTREAM pStream);
133uint32_t audioTestDriverStackStreamGetWritable(PAUDIOTESTDRVSTACK pDrvStack, PPDMAUDIOSTREAM pStream);
134bool audioTestDriverStackStreamIsOkay(PAUDIOTESTDRVSTACK pDrvStack, PPDMAUDIOSTREAM pStream);
135int audioTestDriverStackStreamPlay(PAUDIOTESTDRVSTACK pDrvStack, PPDMAUDIOSTREAM pStream, void const *pvBuf,
136 uint32_t cbBuf, uint32_t *pcbPlayed);
137int audioTestDriverStackStreamCapture(PAUDIOTESTDRVSTACK pDrvStack, PPDMAUDIOSTREAM pStream,
138 void *pvBuf, uint32_t cbBuf, uint32_t *pcbCaptured);
139/** @} */
140
141
142/** @name Mixing stream
143 * @{ */
144int AudioTestMixStreamInit(PAUDIOTESTDRVMIXSTREAM pMix, PAUDIOTESTDRVSTACK pDrvStack, PPDMAUDIOSTREAM pStream,
145 PCPDMAUDIOPCMPROPS pProps, uint32_t cMsBuffer);
146void AudioTestMixStreamTerm(PAUDIOTESTDRVMIXSTREAM pMix);
147int AudioTestMixStreamDrain(PAUDIOTESTDRVMIXSTREAM pMix, bool fSync);
148int AudioTestMixStreamEnable(PAUDIOTESTDRVMIXSTREAM pMix);
149uint32_t AudioTestMixStreamGetWritable(PAUDIOTESTDRVMIXSTREAM pMix);
150bool AudioTestMixStreamIsOkay(PAUDIOTESTDRVMIXSTREAM pMix);
151int AudioTestMixStreamPlay(PAUDIOTESTDRVMIXSTREAM pMix, void const *pvBuf, uint32_t cbBuf, uint32_t *pcbPlayed);
152int AudioTestMixStreamCapture(PAUDIOTESTDRVMIXSTREAM pMix, void *pvBuf, uint32_t cbBuf, uint32_t *pcbCaptured);
153/** @} */
154
155
156#endif /* !VBOX_INCLUDED_SRC_audio_vkatInternal_h */
157
Note: See TracBrowser for help on using the repository browser.

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