VirtualBox

source: vbox/trunk/src/VBox/Devices/Audio/AudioTest.h@ 88994

Last change on this file since 88994 was 88985, checked in by vboxsync, 4 years ago

Audio/ValKit: More hacking on the test set validation / error handling code. bugref:10008

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 4.7 KB
Line 
1/* $Id: AudioTest.h 88985 2021-05-11 16:31:00Z vboxsync $ */
2/** @file
3 * Audio testing routines.
4 * Common code which is being used by the ValidationKit audio test (VKAT)
5 * and the debug / ValdikationKit audio driver(s).
6 */
7
8/*
9 * Copyright (C) 2021 Oracle Corporation
10 *
11 * This file is part of VirtualBox Open Source Edition (OSE), as
12 * available from http://www.virtualbox.org. This file is free software;
13 * you can redistribute it and/or modify it under the terms of the GNU
14 * General Public License (GPL) as published by the Free Software
15 * Foundation, in version 2 as it comes in the "COPYING" file of the
16 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
17 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
18 */
19
20#ifndef VBOX_INCLUDED_SRC_Audio_AudioTest_h
21#define VBOX_INCLUDED_SRC_Audio_AudioTest_h
22#ifndef RT_WITHOUT_PRAGMA_ONCE
23# pragma once
24#endif
25
26#define AUDIOTEST_PATH_PREFIX_STR "audio-test-"
27
28/**
29 * Structure for handling an audio (sine wave) test tone.
30 */
31typedef struct AUDIOTESTTONE
32{
33 /** The PCM properties. */
34 PDMAUDIOPCMPROPS Props;
35 /** Current sample index for generate the sine wave. */
36 uint64_t uSample;
37 /** The fixed portion of the sin() input. */
38 double rdFixed;
39 /** Frequency (in Hz) of the sine wave to generate. */
40 double rdFreqHz;
41} AUDIOTESTTONE;
42/** Pointer to an audio test tone. */
43typedef AUDIOTESTTONE *PAUDIOTESTTONE;
44
45/**
46 * Structure for handling audio test tone parameters.
47 */
48typedef struct AUDIOTESTTONEPARMS
49{
50 /** The PCM properties. */
51 PDMAUDIOPCMPROPS Props;
52 /** Prequel (in ms) to play silence. Optional and can be set to 0. */
53 RTMSINTERVAL msPrequel;
54 /** Duration (in ms) to play the test tone. */
55 RTMSINTERVAL msDuration;
56 /** Sequel (in ms) to play silence. Optional and can be set to 0. */
57 RTMSINTERVAL msSequel;
58 /** Volume (in percent, 0-100) to use.
59 * If set to 0, the tone is muted (i.e. silent). */
60 uint8_t uVolumePercent;
61} AUDIOTESTTONEPARMS;
62/** Pointer to audio test tone parameters. */
63typedef AUDIOTESTTONEPARMS *PAUDIOTESTTONEPARMS;
64
65/**
66 * Enumeration for the test set mode.
67 */
68typedef enum AUDIOTESTSETMODE
69{
70 /** Invalid test set mode. */
71 AUDIOTESTSETMODE_INVALID = 0,
72 /** Test set is being created (testing in progress). */
73 AUDIOTESTSETMODE_TEST,
74 /** Existing test set is being verified. */
75 AUDIOTESTSETMODE_VERIFY,
76 /** The usual 32-bit hack. */
77 AUDIOTESTSETMODE_32BIT_HACK = 0x7fffffff
78} AUDIOTESTSETMODE;
79
80/**
81 * Structure specifying an audio test set.
82 */
83typedef struct AUDIOTESTSET
84{
85 /** Absolute path where to store the test audio data. */
86 char szPathAbs[RTPATH_MAX];
87 /** Current mode the test set is in. */
88 AUDIOTESTSETMODE enmMode;
89 union
90 {
91 RTFILE hFile;
92 RTINIFILE hIniFile;
93 } f;
94} AUDIOTESTSET;
95/** Pointer to an audio test set. */
96typedef AUDIOTESTSET *PAUDIOTESTSET;
97
98/**
99 * Structure for holding a single audio test error entry.
100 */
101typedef struct AUDIOTESTERRORENTRY
102{
103 /** The entrie's list node. */
104 RTLISTNODE Node;
105 /** Additional rc. */
106 int rc;
107 /** Actual error description. */
108 char szDesc[128];
109} AUDIOTESTERRORENTRY;
110/** Pointer to an audio test error description. */
111typedef AUDIOTESTERRORENTRY *PAUDIOTESTERRORENTRY;
112
113/**
114 * Structure for holding an audio test error description.
115 * This can contain multiple errors (FIFO list).
116 */
117typedef struct AUDIOTESTERRORDESC
118{
119 RTLISTANCHOR List;
120 uint32_t cErrors;
121} AUDIOTESTERRORDESC;
122/** Pointer to an audio test error description. */
123typedef AUDIOTESTERRORDESC *PAUDIOTESTERRORDESC;
124
125
126double AudioTestToneInitRandom(PAUDIOTESTTONE pTone, PPDMAUDIOPCMPROPS pProps);
127int AudioTestToneWrite(PAUDIOTESTTONE pTone, void *pvBuf, uint32_t cbBuf, uint32_t *pcbWritten);
128
129int AudioTestToneParamsInitRandom(PAUDIOTESTTONEPARMS pToneParams, PPDMAUDIOPCMPROPS pProps);
130
131int AudioTestPathCreateTemp(char *pszPath, size_t cbPath, const char *pszUUID);
132int AudioTestPathCreate(char *pszPath, size_t cbPath, const char *pszUUID);
133
134int AudioTestSetCreate(PAUDIOTESTSET pSet, const char *pszPath, const char *pszTag);
135void AudioTestSetDestroy(PAUDIOTESTSET pSet);
136int AudioTestSetOpen(PAUDIOTESTSET pSet, const char *pszPath);
137void AudioTestSetClose(PAUDIOTESTSET pSet);
138int AudioTestSetPack(PAUDIOTESTSET pSet, const char *pszOutDir);
139int AudioTestSetUnpack(const char *pszFile, const char *pszOutDir);
140int AudioTestSetVerify(PAUDIOTESTSET pSet, const char *pszTag, PAUDIOTESTERRORDESC pErrDesc);
141
142bool AudioTestErrorDescFailed(PAUDIOTESTERRORDESC pErr);
143void AudioTestErrorDescDestroy(PAUDIOTESTERRORDESC pErr);
144
145#endif /* !VBOX_INCLUDED_SRC_Audio_AudioTest_h */
146
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