VirtualBox

source: vbox/trunk/include/VBox/vmm/pdmaudioifs.h@ 56291

Last change on this file since 56291 was 56085, checked in by vboxsync, 10 years ago

PDM/Audio: Removed old audio architecture.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 24.7 KB
Line 
1/** @file
2 * PDM - Pluggable Device Manager, audio interfaces.
3 */
4
5/*
6 * Copyright (C) 2006-2015 Oracle Corporation
7 *
8 * This file is part of VirtualBox Open Source Edition (OSE), as
9 * available from http://www.virtualbox.org. This file is free software;
10 * you can redistribute it and/or modify it under the terms of the GNU
11 * General Public License (GPL) as published by the Free Software
12 * Foundation, in version 2 as it comes in the "COPYING" file of the
13 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
14 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
15 *
16 * The contents of this file may alternatively be used under the terms
17 * of the Common Development and Distribution License Version 1.0
18 * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
19 * VirtualBox OSE distribution, in which case the provisions of the
20 * CDDL are applicable instead of those of the GPL.
21 *
22 * You may elect to license modified versions of this file under the
23 * terms and conditions of either the GPL or the CDDL or both.
24 */
25
26#ifndef ___VBox_vmm_pdmaudioifs_h
27#define ___VBox_vmm_pdmaudioifs_h
28
29#include <VBox/types.h>
30#include <iprt/list.h>
31
32typedef uint32_t PDMAUDIODRVFLAGS;
33
34/** No flags set. */
35#define PDMAUDIODRVFLAG_NONE 0
36/** Marks a primary audio driver which is critical
37 * when running the VM. */
38#define PDMAUDIODRVFLAG_PRIMARY RT_BIT(0)
39
40/**
41 * Audio format in signed or unsigned variants.
42 */
43typedef enum PDMAUDIOFMT
44{
45 AUD_FMT_INVALID,
46 AUD_FMT_U8,
47 AUD_FMT_S8,
48 AUD_FMT_U16,
49 AUD_FMT_S16,
50 AUD_FMT_U32,
51 AUD_FMT_S32,
52 /** Hack to blow the type up to 32-bit. */
53 AUD_FMT_32BIT_HACK = 0x7fffffff
54} PDMAUDIOFMT;
55
56/**
57 * Audio configuration of a certain backend.
58 */
59typedef struct PDMAUDIOBACKENDCFG
60{
61 uint32_t cbStreamOut;
62 uint32_t cbStreamIn;
63 uint32_t cMaxHstStrmsOut;
64 uint32_t cMaxHstStrmsIn;
65} PDMAUDIOBACKENDCFG, *PPDMAUDIOBACKENDCFG;
66
67/**
68 * An audio sample. At the moment stereo (left + right channels) only.
69 * @todo Replace this with a more generic union
70 * which then also could handle 2.1 or 5.1 sound.
71 */
72typedef struct PDMAUDIOSAMPLE
73{
74 int64_t i64LSample;
75 int64_t i64RSample;
76} PDMAUDIOSAMPLE, *PPDMAUDIOSAMPLE;
77
78typedef enum PDMAUDIOENDIANNESS
79{
80 /** The usual invalid endian. */
81 PDMAUDIOENDIANNESS_INVALID,
82 /** Little endian. */
83 PDMAUDIOENDIANNESS_LITTLE,
84 /** Bit endian. */
85 PDMAUDIOENDIANNESS_BIG,
86 /** Endianness doesn't have a meaning in the context. */
87 PDMAUDIOENDIANNESS_NA,
88 /** The end of the valid endian values (exclusive). */
89 PDMAUDIOENDIANNESS_END,
90 /** Hack to blow the type up to 32-bit. */
91 PDMAUDIOENDIANNESS_32BIT_HACK = 0x7fffffff
92} PDMAUDIOENDIANNESS;
93
94typedef struct PDMAUDIOSTREAMCFG
95{
96 /** Frequency in Hertz (Hz). */
97 uint32_t uHz;
98 /** Number of channels (2 for stereo). */
99 uint8_t cChannels;
100 /** Audio format. */
101 PDMAUDIOFMT enmFormat;
102 /** @todo Use RT_LE2H_*? */
103 PDMAUDIOENDIANNESS enmEndianness;
104} PDMAUDIOSTREAMCFG, *PPDMAUDIOSTREAMCFG;
105
106#if defined(RT_LITTLE_ENDIAN)
107# define PDMAUDIOHOSTENDIANNESS PDMAUDIOENDIANNESS_LITTLE
108#elif defined(RT_BIG_ENDIAN)
109# define PDMAUDIOHOSTENDIANNESS PDMAUDIOENDIANNESS_BIG
110#else
111# error "Port me!"
112#endif
113
114typedef enum PDMAUDIODIR
115{
116 PDMAUDIODIR_UNKNOWN = 0,
117 PDMAUDIODIR_IN = 1,
118 PDMAUDIODIR_OUT = 2,
119 PDMAUDIODIR_BOTH = 3
120} PDMAUDIODIR;
121
122typedef enum PDMAUDIOMIXERCTL
123{
124 PDMAUDIOMIXERCTL_UNKNOWN = 0,
125 PDMAUDIOMIXERCTL_VOLUME,
126 PDMAUDIOMIXERCTL_PCM,
127 PDMAUDIOMIXERCTL_LINE_IN,
128 PDMAUDIOMIXERCTL_MIC_IN,
129 /** Hack to blow the type up to 32-bit. */
130 PDMAUDIOMIXERCTL_32BIT_HACK = 0x7fffffff
131} PDMAUDIOMIXERCTL;
132
133typedef enum PDMAUDIORECSOURCE
134{
135 PDMAUDIORECSOURCE_UNKNOWN = 0,
136 PDMAUDIORECSOURCE_MIC,
137 PDMAUDIORECSOURCE_CD,
138 PDMAUDIORECSOURCE_VIDEO,
139 PDMAUDIORECSOURCE_AUX,
140 PDMAUDIORECSOURCE_LINE_IN,
141 PDMAUDIORECSOURCE_PHONE,
142 /** Hack to blow the type up to 32-bit. */
143 PDMAUDIORECSOURCE_32BIT_HACK = 0x7fffffff
144} PDMAUDIORECSOURCE;
145
146/**
147 * Audio stream commands. Used in the audio connector
148 * as well as in the actual host backends.
149 */
150typedef enum PDMAUDIOSTREAMCMD
151{
152 /** Unknown command, do not use. */
153 PDMAUDIOSTREAMCMD_UNKNOWN = 0,
154 /** Enables the stream. */
155 PDMAUDIOSTREAMCMD_ENABLE,
156 /** Disables the stream. */
157 PDMAUDIOSTREAMCMD_DISABLE,
158 /** Hack to blow the type up to 32-bit. */
159 PDMAUDIOSTREAMCMD_32BIT_HACK = 0x7fffffff
160} PDMAUDIOSTREAMCMD;
161
162/**
163 * Properties of audio streams for host/guest
164 * for in or out directions.
165 */
166typedef struct PDMPCMPROPS
167{
168 /** Sample width. Bits per sample. */
169 uint8_t cBits;
170 /** Signed or unsigned sample. */
171 bool fSigned;
172 /** Shift count used for faster calculation of various
173 * values, such as the alignment, bytes to samples and so on.
174 * Depends on number of stream channels and the stream format
175 * being used.
176 *
177 ** @todo Use some RTAsmXXX functions instead?
178 */
179 uint8_t cShift;
180 /** Number of audio channels. */
181 uint8_t cChannels;
182 /** Alignment mask. */
183 uint32_t uAlign;
184 /** Sample frequency in Hertz (Hz). */
185 uint32_t uHz;
186 /** Bandwidth (bytes/s). */
187 uint32_t cbPerSec;
188 /** Whether the endianness is swapped or not. */
189 bool fSwapEndian;
190} PDMPCMPROPS, *PPDMPCMPROPS;
191
192/**
193 * Structure keeping an audio volume level.
194 */
195typedef struct PDMAUDIOVOLUME
196{
197 /** Set to @c true if this stream is muted, @c false if not. */
198 bool fMuted;
199 /** Left channel volume. */
200 uint32_t uLeft;
201 /** Right channel volume. */
202 uint32_t uRight;
203} PDMAUDIOVOLUME, *PPDMAUDIOVOLUME;
204
205/**
206 * Structure for holding rate processing information
207 * of a source + destination audio stream. This is needed
208 * because both streams can differ regarding their rates
209 * and therefore need to be treated accordingly.
210 */
211typedef struct PDMAUDIOSTRMRATE
212{
213 /** Current (absolute) offset in the output
214 * (destination) stream. */
215 uint64_t dstOffset;
216 /** Increment for moving dstOffset for the
217 * destination stream. This is needed because the
218 * source <-> destination rate might be different. */
219 uint64_t dstInc;
220 /** Current (absolute) offset in the input
221 * stream. */
222 uint32_t srcOffset;
223 /** Last processed sample of the input stream.
224 * Needed for interpolation. */
225 PDMAUDIOSAMPLE srcSampleLast;
226} PDMAUDIOSTRMRATE, *PPDMAUDIOSTRMRATE;
227
228/**
229 * Note: All internal handling is done in samples,
230 * not in bytes!
231 */
232typedef uint32_t PDMAUDIOMIXBUFFMT;
233typedef PDMAUDIOMIXBUFFMT *PPDMAUDIOMIXBUFFMT;
234
235typedef struct PDMAUDIOMIXBUF *PPDMAUDIOMIXBUF;
236typedef struct PDMAUDIOMIXBUF
237{
238 RTLISTNODE Node;
239 /** Name of the buffer. */
240 char *pszName;
241 /** Sample buffer. */
242 PPDMAUDIOSAMPLE pSamples;
243 /** Size of the sample buffer (in samples). */
244 uint32_t cSamples;
245 /** The current read/write position (in samples)
246 * in the samples buffer. */
247 uint32_t offReadWrite;
248 /**
249 * Total samples already mixed down to the parent buffer (if any). Always starting at
250 * the parent's offReadWrite position.
251 *
252 * Note: Count always is specified in parent samples, as the sample count can differ between parent
253 * and child.
254 */
255 uint32_t cMixed;
256 uint32_t cProcessed;
257 /** Pointer to parent buffer (if any). */
258 PPDMAUDIOMIXBUF pParent;
259 /** List of children mix buffers to keep in sync with (if being a parent buffer). */
260 RTLISTANCHOR lstBuffers;
261 /** Intermediate structure for buffer conversion tasks. */
262 PPDMAUDIOSTRMRATE pRate;
263 /** Current volume used for mixing. */
264 PDMAUDIOVOLUME Volume;
265 /** This buffer's audio format. */
266 PDMAUDIOMIXBUFFMT AudioFmt;
267 /**
268 * Ratio of the associated parent stream's frequency by this stream's
269 * frequency (1<<32), represented as a signed 64 bit integer.
270 *
271 * For example, if the parent stream has a frequency of 44 khZ, and this
272 * stream has a frequency of 11 kHz, the ration then would be
273 * (44/11 * (1 << 32)).
274 *
275 * Currently this does not get changed once assigned.
276 */
277 int64_t iFreqRatio;
278 /* For quickly converting samples <-> bytes and
279 * vice versa. */
280 uint8_t cShift;
281} PDMAUDIOMIXBUF;
282
283/**
284 * Represents an audio input on the host of a certain
285 * backend (e.g. DirectSound, PulseAudio etc).
286 *
287 * One host audio input is assigned to exactly one parent
288 * guest input stream.
289 */
290struct PDMAUDIOGSTSTRMIN;
291typedef PDMAUDIOGSTSTRMIN *PPDMAUDIOGSTSTRMIN;
292
293typedef struct PDMAUDIOHSTSTRMIN
294{
295 /** List node. */
296 RTLISTNODE Node;
297 /** PCM properties. */
298 PDMPCMPROPS Props;
299 /** Whether this input is enabled or not. */
300 bool fEnabled;
301 /** This stream's mixing buffer. */
302 PDMAUDIOMIXBUF MixBuf;
303 /** Pointer to (parent) guest stream. */
304 PPDMAUDIOGSTSTRMIN pGstStrmIn;
305} PDMAUDIOHSTSTRMIN, *PPDMAUDIOHSTSTRMIN;
306
307/*
308 * Represents an audio output on the host through a certain
309 * backend (e.g. DirectSound, PulseAudio etc).
310 *
311 * One host audio output can have multiple (1:N) guest outputs
312 * assigned.
313 */
314typedef struct PDMAUDIOHSTSTRMOUT
315{
316 /** List node. */
317 RTLISTNODE Node;
318 /** Stream properites. */
319 PDMPCMPROPS Props;
320 /** Enabled or disabled flag. */
321 bool fEnabled;
322 /** Whether this stream was marked as being disabled
323 * but there are still associated guest output streams
324 * which rely on its data. */
325 bool fPendingDisable;
326 /** This stream's mixing buffer. */
327 PDMAUDIOMIXBUF MixBuf;
328 /** Associated guest output streams. */
329 RTLISTANCHOR lstGstStrmOut;
330} PDMAUDIOHSTSTRMOUT, *PPDMAUDIOHSTSTRMOUT;
331
332/**
333 * Guest audio stream state.
334 */
335typedef struct PDMAUDIOGSTSTRMSTATE
336{
337 /** Guest audio out stream active or not. */
338 bool fActive;
339 /** Guest audio output stream has some samples or not. */
340 bool fEmpty;
341 /** Name of this stream. */
342 char *pszName;
343} PDMAUDIOGSTSTRMSTATE, *PPDMAUDIOGSTSTRMSTATE;
344
345/**
346 * Represents an audio input from the guest (that is, from the
347 * emulated device, e.g. Intel HDA).
348 *
349 * Each guest input can have multiple host input streams.
350 */
351typedef struct PDMAUDIOGSTSTRMIN
352{
353 /** Guest stream properites. */
354 PDMPCMPROPS Props;
355 /** Current stream state. */
356 PDMAUDIOGSTSTRMSTATE State;
357 /** This stream's mixing buffer. */
358 PDMAUDIOMIXBUF MixBuf;
359 /** Pointer to associated host input stream. */
360 PPDMAUDIOHSTSTRMIN pHstStrmIn;
361} PDMAUDIOGSTSTRMIN, *PPDMAUDIOGSTSTRMIN;
362
363/**
364 * Represents an audio output from the guest (that is, from the
365 * emulated device, e.g. Intel HDA).
366 *
367 * Each guest output is assigned to a single host output.
368 */
369typedef struct PDMAUDIOGSTSTRMOUT
370{
371 /** List node. */
372 RTLISTNODE Node;
373 /** Guest output stream properites. */
374 PDMPCMPROPS Props;
375 /** Current stream state. */
376 PDMAUDIOGSTSTRMSTATE State;
377 /** This stream's mixing buffer. */
378 PDMAUDIOMIXBUF MixBuf;
379 /** Pointer to the associated host output stream. */
380 PPDMAUDIOHSTSTRMOUT pHstStrmOut;
381} PDMAUDIOGSTSTRMOUT, *PPDMAUDIOGSTSTRMOUT;
382
383/** Pointer to a audio connector interface. */
384typedef struct PDMIAUDIOCONNECTOR *PPDMIAUDIOCONNECTOR;
385/**
386 * Audio connector interface (up).
387 */
388typedef struct PDMIAUDIOCONNECTOR
389{
390 DECLR3CALLBACKMEMBER(int, pfnQueryStatus, (PPDMIAUDIOCONNECTOR pInterface, uint32_t *pcbAvailIn, uint32_t *pcbFreeOut, uint32_t *pcSamplesLive));
391
392 /**
393 * Reads PCM audio data from the host (input).
394 *
395 * @returns VBox status code.
396 * @param pInterface Pointer to the interface structure containing the called function pointer.
397 * @param pGstStrmIn Pointer to guest input stream to write to.
398 * @param pvBuf Where to store the read data.
399 * @param cbSize Number of bytes to read.
400 * @param pcbRead Bytes of audio data read. Optional.
401 */
402 DECLR3CALLBACKMEMBER(int, pfnRead, (PPDMIAUDIOCONNECTOR pInterface, PPDMAUDIOGSTSTRMIN pGstStrmIn, void *pvBuf, uint32_t cbSize, uint32_t *pcbRead));
403
404 /**
405 * Writes PCM audio data to the host (output).
406 *
407 * @returns VBox status code.
408 * @param pInterface Pointer to the interface structure containing the called function pointer.
409 * @param pGstStrmOut Pointer to guest output stream to read from.
410 * @param pvBuf Audio data to be written.
411 * @param cbSize Number of bytes to be written.
412 * @param pcbWritten Bytes of audio data written. Optional.
413 */
414 DECLR3CALLBACKMEMBER(int, pfnWrite, (PPDMIAUDIOCONNECTOR pInterface, PPDMAUDIOGSTSTRMOUT pGstStrmOut, const void *pvBuf, uint32_t cbSize, uint32_t *pcbWritten));
415
416 /**
417 * Checks whether the specified guest input stream is in a working state.
418 *
419 * @returns True if a host voice in is available, false if not.
420 * @param pInterface Pointer to the interface structure containing the called function pointer.
421 * @param pGstStrmIn Pointer to guest input stream to check.
422 */
423 DECLR3CALLBACKMEMBER(bool, pfnIsInputOK, (PPDMIAUDIOCONNECTOR pInterface, PPDMAUDIOGSTSTRMIN pGstStrmIn));
424
425 /**
426 * Checks whether the specified guest output stream is in a working state.
427 *
428 * @returns True if a host voice out is available, false if not.
429 * @param pInterface Pointer to the interface structure containing the called function pointer.
430 * @param pGstStrmOut Pointer to guest output stream to check.
431 */
432 DECLR3CALLBACKMEMBER(bool, pfnIsOutputOK, (PPDMIAUDIOCONNECTOR pInterface, PPDMAUDIOGSTSTRMOUT pGstStrmOut));
433
434 /**
435 * Initializes the NULL audio driver as a fallback in case no host backend is available.
436 *
437 * @returns VBox status code.
438 * @param pInterface Pointer to the interface structure containing the called function pointer.
439 */
440 DECLR3CALLBACKMEMBER(int, pfnInitNull, (PPDMIAUDIOCONNECTOR pInterface));
441
442 /**
443 * Enables a specific guest output stream and starts the audio device.
444 *
445 * @returns VBox status code.
446 * @param pInterface Pointer to the interface structure containing the called function pointer.
447 * @param pGstStrmOut Pointer to guest output stream.
448 * @param fEnable Whether to enable or disable the specified output stream.
449 */
450 DECLR3CALLBACKMEMBER(int, pfnEnableOut, (PPDMIAUDIOCONNECTOR pInterface, PPDMAUDIOGSTSTRMOUT pGstStrmOut, bool fEnable));
451
452 /**
453 * Enables a specific guest input stream and starts the audio device.
454 *
455 * @returns VBox status code.
456 * @param pInterface Pointer to the interface structure containing the called function pointer.
457 * @param pGstStrmIn Pointer to guest input stream.
458 * @param fEnable Whether to enable or disable the specified input stream.
459 */
460 DECLR3CALLBACKMEMBER(int, pfnEnableIn, (PPDMIAUDIOCONNECTOR pInterface, PPDMAUDIOGSTSTRMIN pGstStrmIn, bool fEnable));
461
462 /**
463 * Closes a specific guest input stream.
464 *
465 * @param pInterface Pointer to the interface structure containing the called function pointer.
466 * @param pGstStrmIn Pointer to guest input stream.
467 */
468 DECLR3CALLBACKMEMBER(void, pfnCloseIn, (PPDMIAUDIOCONNECTOR pInterface, PPDMAUDIOGSTSTRMIN pGstStrmIn));
469
470 /**
471 * Closes a specific guest output stream.
472 *
473 * @param pInterface Pointer to the interface structure containing the called function pointer.
474 * @param pGstStrmOut Pointer to guest output stream.
475 */
476 DECLR3CALLBACKMEMBER(void, pfnCloseOut, (PPDMIAUDIOCONNECTOR pInterface, PPDMAUDIOGSTSTRMOUT pGstStrmOut));
477
478 /**
479 * Opens an input audio channel.
480 *
481 * @returns VBox status code.
482 * @param pInterface Pointer to the interface structure containing the called function pointer.
483 * @param pszName Name of the audio channel.
484 * @param enmRecSource Specifies the type of recording source to be opened.
485 * @param pCfg Pointer to PDMAUDIOSTREAMCFG to use.
486 * @param ppGstStrmIn Pointer where to return the guest guest input stream on success.
487 */
488 DECLR3CALLBACKMEMBER(int, pfnOpenIn, (PPDMIAUDIOCONNECTOR pInterface, const char *pszName,
489 PDMAUDIORECSOURCE enmRecSource, PPDMAUDIOSTREAMCFG pCfg,
490 PPDMAUDIOGSTSTRMIN *ppGstStrmIn));
491
492 /**
493 * Opens an output audio channel.
494 *
495 * @returns VBox status code.
496 * @param pInterface Pointer to the interface structure containing the called function pointer.
497 * @param pszName Name of the audio channel.
498 * @param pCfg Pointer to PDMAUDIOSTREAMCFG to use.
499 * @param ppGstStrmOut Pointer where to return the guest guest input stream on success.
500 */
501 DECLR3CALLBACKMEMBER(int, pfnOpenOut, (PPDMIAUDIOCONNECTOR pInterface, const char *pszName,
502 PPDMAUDIOSTREAMCFG pCfg, PPDMAUDIOGSTSTRMOUT *ppGstStrmOut));
503
504 DECLR3CALLBACKMEMBER(int, pfnPlayOut, (PPDMIAUDIOCONNECTOR pInterface, uint32_t *pcSamplesPlayed));
505
506 /**
507 * Checks whether a specific guest input stream is active or not.
508 *
509 * @returns Whether the specified stream is active or not.
510 * @param pInterface Pointer to the interface structure containing the called function pointer.
511 * @param pGstStrmIn Pointer to guest input stream.
512 */
513 DECLR3CALLBACKMEMBER(bool, pfnIsActiveIn, (PPDMIAUDIOCONNECTOR pInterface, PPDMAUDIOGSTSTRMIN pGstStrmIn));
514
515 /**
516 * Checks whether a specific guest output stream is active or not.
517 *
518 * @returns Whether the specified stream is active or not.
519 * @param pInterface Pointer to the interface structure containing the called function pointer.
520 * @param pGstStrmOut Pointer to guest output stream.
521 */
522 DECLR3CALLBACKMEMBER(bool, pfnIsActiveOut, (PPDMIAUDIOCONNECTOR pInterface, PPDMAUDIOGSTSTRMOUT pGstStrmOut));
523
524} PDMIAUDIOCONNECTOR;
525
526/** PDMIAUDIOCONNECTOR interface ID. */
527#define PDMIAUDIOCONNECTOR_IID "a41ca770-ed07-4f57-a0a6-41377d9d484f"
528
529/** Defines all needed interface callbacks for an audio backend. */
530#define PDMAUDIO_IHOSTAUDIO_CALLBACKS(_aDrvName) \
531 pThis->IHostAudio.pfnCaptureIn = _aDrvName##CaptureIn; \
532 pThis->IHostAudio.pfnControlIn = _aDrvName##ControlIn; \
533 pThis->IHostAudio.pfnControlOut = _aDrvName##ControlOut; \
534 pThis->IHostAudio.pfnFiniIn = _aDrvName##FiniIn; \
535 pThis->IHostAudio.pfnFiniOut = _aDrvName##FiniOut; \
536 pThis->IHostAudio.pfnGetConf = _aDrvName##GetConf; \
537 pThis->IHostAudio.pfnInit = _aDrvName##Init; \
538 pThis->IHostAudio.pfnInitIn = _aDrvName##InitIn; \
539 pThis->IHostAudio.pfnInitOut = _aDrvName##InitOut; \
540 pThis->IHostAudio.pfnIsEnabled = _aDrvName##IsEnabled; \
541 pThis->IHostAudio.pfnPlayOut = _aDrvName##PlayOut; \
542 pThis->IHostAudio.pfnShutdown = _aDrvName##Shutdown;
543
544/** Pointer to a host audio interface. */
545typedef struct PDMIHOSTAUDIO *PPDMIHOSTAUDIO;
546/**
547 * PDM host audio interface.
548 */
549typedef struct PDMIHOSTAUDIO
550{
551 /**
552 * Initialize the host-specific audio device.
553 *
554 * @returns VBox status code.
555 * @param pInterface Pointer to the interface structure containing the called function pointer.
556 */
557 DECLR3CALLBACKMEMBER(int, pfnInit, (PPDMIHOSTAUDIO pInterface));
558
559 /**
560 * Shuts down the host-specific audio device.
561 *
562 * @returns VBox status code.
563 * @param pInterface Pointer to the interface structure containing the called function pointer.
564 */
565 DECLR3CALLBACKMEMBER(void, pfnShutdown, (PPDMIHOSTAUDIO pInterface));
566
567 /**
568 * Initialize the host-specific audio device for input stream.
569 *
570 * @returns VBox status code.
571 * @param pInterface Pointer to the interface structure containing the called function pointer.
572 * @param pHstStrmIn Pointer to host input stream.
573 * @param pStreamCfg Pointer to stream configuration.
574 * @param enmRecSource Specifies the type of recording source to be initialized.
575 * @param pcSamples Returns how many samples the backend can handle. Optional.
576 */
577 DECLR3CALLBACKMEMBER(int, pfnInitIn, (PPDMIHOSTAUDIO pInterface, PPDMAUDIOHSTSTRMIN pHstStrmIn, PPDMAUDIOSTREAMCFG pStreamCfg, PDMAUDIORECSOURCE enmRecSource, uint32_t *pcSamples));
578
579 /**
580 * Initialize the host-specific output device for output stream.
581 *
582 * @returns VBox status code.
583 * @param pInterface Pointer to the interface structure containing the called function pointer.
584 * @param pHstStrmOut Pointer to host output stream.
585 * @param pStreamCfg Pointer to stream configuration.
586 * @param pcSamples Returns how many samples the backend can handle. Optional.
587 */
588 DECLR3CALLBACKMEMBER(int, pfnInitOut, (PPDMIHOSTAUDIO pInterface, PPDMAUDIOHSTSTRMOUT pHstStrmOut, PPDMAUDIOSTREAMCFG pStreamCfg, uint32_t *pcSamples));
589
590 /**
591 * Control the host audio device for an input stream.
592 *
593 * @returns VBox status code.
594 * @param pInterface Pointer to the interface structure containing the called function pointer.
595 * @param pHstStrmOut Pointer to host output stream.
596 * @param enmStreamCmd The stream command to issue.
597 */
598 DECLR3CALLBACKMEMBER(int, pfnControlOut, (PPDMIHOSTAUDIO pInterface, PPDMAUDIOHSTSTRMOUT pHstStrmOut, PDMAUDIOSTREAMCMD enmStreamCmd));
599
600 /**
601 * Control the host audio device for an output stream.
602 *
603 * @returns VBox status code.
604 * @param pInterface Pointer to the interface structure containing the called function pointer.
605 * @param pHstStrmOut Pointer to host output stream.
606 * @param enmStreamCmd The stream command to issue.
607 */
608 DECLR3CALLBACKMEMBER(int, pfnControlIn, (PPDMIHOSTAUDIO pInterface, PPDMAUDIOHSTSTRMIN pHstStrmIn, PDMAUDIOSTREAMCMD enmStreamCmd));
609
610 /**
611 * Ends the host audio input streamm.
612 *
613 * @returns VBox status code.
614 * @param pInterface Pointer to the interface structure containing the called function pointer.
615 * @param pHstStrmIn Pointer to host input stream.
616 */
617 DECLR3CALLBACKMEMBER(int, pfnFiniIn, (PPDMIHOSTAUDIO pInterface, PPDMAUDIOHSTSTRMIN pHstStrmIn));
618
619 /**
620 * Ends the host output stream.
621 *
622 * @returns VBox status code.
623 * @param pInterface Pointer to the interface structure containing the called function pointer.
624 * @param pHstStrmOut Pointer to host output stream.
625 */
626 DECLR3CALLBACKMEMBER(int, pfnFiniOut, (PPDMIHOSTAUDIO pInterface, PPDMAUDIOHSTSTRMOUT pHstStrmOut));
627
628 DECLR3CALLBACKMEMBER(bool, pfnIsEnabled, (PPDMIHOSTAUDIO pInterface, PDMAUDIODIR enmDir));
629
630 /**
631 * Plays a host audio stream.
632 *
633 * @returns VBox status code.
634 * @param pInterface Pointer to the interface structure containing the called function pointer.
635 * @param pHstStrmOut Pointer to host output stream.
636 * @param pcSamplesPlayed Pointer to number of samples captured.
637 */
638 DECLR3CALLBACKMEMBER(int, pfnPlayOut, (PPDMIHOSTAUDIO pInterface, PPDMAUDIOHSTSTRMOUT pHstStrmOut, uint32_t *pcSamplesPlayed));
639
640 /**
641 * Records audio to input stream.
642 *
643 * @returns VBox status code.
644 * @param pInterface Pointer to the interface structure containing the called function pointer.
645 * @param pHstStrmIn Pointer to host input stream.
646 * @param pcSamplesCaptured Pointer to number of samples captured.
647 */
648 DECLR3CALLBACKMEMBER(int, pfnCaptureIn, (PPDMIHOSTAUDIO pInterface, PPDMAUDIOHSTSTRMIN pHstStrmIn, uint32_t *pcSamplesCaptured));
649
650 /**
651 * Gets the configuration from the host audio (backend) driver.
652 *
653 * @returns VBox status code.
654 * @param pInterface Pointer to the interface structure containing the called function pointer.
655 * @param pBackendCfg Pointer where to store the backend audio configuration to.
656 */
657 DECLR3CALLBACKMEMBER(int, pfnGetConf, (PPDMIHOSTAUDIO pInterface, PPDMAUDIOBACKENDCFG pBackendCfg));
658
659} PDMIHOSTAUDIO;
660#define PDMIHOSTAUDIO_IID "39feea4f-c824-4197-bcff-7d4a6ede7420"
661
662#endif /* ___VBox_vmm_pdmaudioifs_h */
663
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