VirtualBox

source: vbox/trunk/src/VBox/Devices/Audio/AudioMixer.h@ 59176

Last change on this file since 59176 was 56689, checked in by vboxsync, 9 years ago

Audio: Volume control debugging aids.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 4.0 KB
Line 
1/* $Id: AudioMixer.h 56689 2015-06-29 20:15:25Z vboxsync $ */
2/** @file
3 * VBox audio: Mixing routines, mainly used by the various audio device
4 * emulations to achieve proper multiplexing from/to attached
5 * devices LUNs.
6 */
7
8/*
9 * Copyright (C) 2014-2015 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 AUDIO_MIXER_H
21#define AUDIO_MIXER_H
22
23#include <iprt/cdefs.h>
24#include <VBox/vmm/pdmaudioifs.h>
25
26typedef struct AUDIOMIXER
27{
28 /** Mixer name. */
29 char *pszName;
30 /** Format the mixer should convert/output
31 * data to so that the underlying device emulation
32 * can work with it. */
33 PDMAUDIOSTREAMCFG devFmt;
34 /** The master volume of this mixer. */
35 PDMAUDIOVOLUME VolMaster;
36 /* List of audio mixer sinks. */
37 RTLISTANCHOR lstSinks;
38 /** Number of used audio sinks. */
39 uint8_t cSinks;
40} AUDIOMIXER, *PAUDIOMIXER;
41
42typedef struct AUDMIXSTREAM
43{
44 RTLISTNODE Node;
45 PPDMIAUDIOCONNECTOR pConn;
46 union
47 {
48 PPDMAUDIOGSTSTRMIN pIn;
49 PPDMAUDIOGSTSTRMOUT pOut;
50 };
51} AUDMIXSTREAM, *PAUDMIXSTREAM;
52
53typedef enum AUDMIXSINKDIR
54{
55 AUDMIXSINKDIR_UNKNOWN = 0,
56 AUDMIXSINKDIR_INPUT,
57 AUDMIXSINKDIR_OUTPUT,
58 /** The usual 32-bit hack. */
59 AUDMIXSINKDIR_32BIT_HACK = 0x7fffffff
60} AUDMIXSINKDIR;
61
62typedef struct AUDMIXSINK
63{
64 RTLISTNODE Node;
65 /** Name of this sink. */
66 char *pszName;
67 /** The sink direction, that is,
68 * if this sink handles input or output. */
69 AUDMIXSINKDIR enmDir;
70 /** Pointer to mixer object this sink is bound
71 * to. */
72 PAUDIOMIXER pParent;
73 /** Number of streams assigned. */
74 uint8_t cStreams;
75 /** List of assigned streams. */
76 RTLISTANCHOR lstStreams;
77 /** This sink's mixing buffer. */
78 PDMAUDIOMIXBUF MixBuf;
79 /** The volume of this sink. The volume always will
80 * be combined with the mixer's master volume. */
81 PDMAUDIOVOLUME Volume;
82} AUDMIXSINK, *PAUDMIXSINK;
83
84typedef enum AUDMIXOP
85{
86 AUDMIXOP_NONE = 0,
87 AUDMIXOP_COPY,
88 AUDMIXOP_BLEND,
89 /** The usual 32-bit hack. */
90 AUDMIXOP_32BIT_HACK = 0x7fffffff
91} AUDMIXOP;
92
93
94int AudioMixerAddSink(PAUDIOMIXER pMixer, const char *pszName, AUDMIXSINKDIR enmDir, PAUDMIXSINK *ppSink);
95int AudioMixerAddStreamIn(PAUDMIXSINK pSink, PPDMIAUDIOCONNECTOR pConnector, PPDMAUDIOGSTSTRMIN pStream, uint32_t uFlags, PAUDMIXSTREAM *ppStream);
96int AudioMixerAddStreamOut(PAUDMIXSINK pSink, PPDMIAUDIOCONNECTOR pConnector, PPDMAUDIOGSTSTRMOUT pStream, uint32_t uFlags, PAUDMIXSTREAM *ppStream);
97int AudioMixerControlStream(AUDMIXSTREAM pHandle); /** @todo Implement me. */
98int AudioMixerCreate(const char *pszName, uint32_t uFlags, PAUDIOMIXER *ppMixer);
99void AudioMixerDestroy(PAUDIOMIXER pMixer);
100uint32_t AudioMixerGetStreamCount(PAUDIOMIXER pMixer);
101void AudioMixerInvalidate(PAUDIOMIXER pMixer);
102int AudioMixerProcessSinkIn(PAUDMIXSINK pSink, AUDMIXOP enmOp, void *pvBuf, uint32_t cbBuf, uint32_t *pcbProcessed);
103int AudioMixerProcessSinkOut(PAUDMIXSINK pSink, AUDMIXOP enmOp, const void *pvBuf, uint32_t cbBuf, uint32_t *pcbProcessed);
104void AudioMixerRemoveSink(PAUDIOMIXER pMixer, PAUDMIXSINK pSink);
105void AudioMixerRemoveStream(PAUDMIXSINK pSink, PAUDMIXSTREAM pStream);
106int AudioMixerSetDeviceFormat(PAUDIOMIXER pMixer, PPDMAUDIOSTREAMCFG pCfg);
107int AudioMixerSetMasterVolume(PAUDIOMIXER pMixer, PPDMAUDIOVOLUME pVol);
108int AudioMixerSetSinkVolume(PAUDMIXSINK pSink, PPDMAUDIOVOLUME pVol);
109void AudioMixerDebug(PAUDIOMIXER pMixer, PCDBGFINFOHLP pHlp, const char *pszArgs);
110
111#endif /* AUDIO_MIXER_H */
112
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