2004-11-10 00:09:44 +01:00
|
|
|
/*
|
|
|
|
* QEMU Audio subsystem header
|
2005-10-30 19:58:22 +01:00
|
|
|
*
|
|
|
|
* Copyright (c) 2003-2005 Vassili Karpov (malc)
|
|
|
|
*
|
2004-11-10 00:09:44 +01:00
|
|
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
|
|
* of this software and associated documentation files (the "Software"), to deal
|
|
|
|
* in the Software without restriction, including without limitation the rights
|
|
|
|
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
|
|
* copies of the Software, and to permit persons to whom the Software is
|
|
|
|
* furnished to do so, subject to the following conditions:
|
|
|
|
*
|
|
|
|
* The above copyright notice and this permission notice shall be included in
|
|
|
|
* all copies or substantial portions of the Software.
|
|
|
|
*
|
|
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
|
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
|
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
|
|
|
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
|
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
|
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
|
|
* THE SOFTWARE.
|
|
|
|
*/
|
2016-06-29 15:29:06 +02:00
|
|
|
|
2004-11-10 00:09:44 +01:00
|
|
|
#ifndef QEMU_AUDIO_INT_H
|
|
|
|
#define QEMU_AUDIO_INT_H
|
|
|
|
|
2018-03-01 11:05:46 +01:00
|
|
|
#ifdef CONFIG_AUDIO_COREAUDIO
|
2005-10-30 19:58:22 +01:00
|
|
|
#define FLOAT_MIXENG
|
|
|
|
/* #define RECIPROCAL */
|
|
|
|
#endif
|
|
|
|
#include "mixeng.h"
|
|
|
|
|
|
|
|
struct audio_pcm_ops;
|
|
|
|
|
|
|
|
struct audio_callback {
|
|
|
|
void *opaque;
|
2009-10-15 00:40:17 +02:00
|
|
|
audio_callback_fn fn;
|
2005-10-30 19:58:22 +01:00
|
|
|
};
|
2004-11-10 00:09:44 +01:00
|
|
|
|
2005-10-30 19:58:22 +01:00
|
|
|
struct audio_pcm_info {
|
|
|
|
int bits;
|
|
|
|
int sign;
|
|
|
|
int freq;
|
|
|
|
int nchannels;
|
|
|
|
int align;
|
|
|
|
int shift;
|
|
|
|
int bytes_per_second;
|
2006-07-04 23:47:22 +02:00
|
|
|
int swap_endianness;
|
2005-10-30 19:58:22 +01:00
|
|
|
};
|
2004-11-10 00:09:44 +01:00
|
|
|
|
2019-08-19 01:06:46 +02:00
|
|
|
typedef struct AudioState AudioState;
|
2006-07-16 20:57:03 +02:00
|
|
|
typedef struct SWVoiceCap SWVoiceCap;
|
|
|
|
|
2005-10-30 19:58:22 +01:00
|
|
|
typedef struct HWVoiceOut {
|
2019-08-19 01:06:46 +02:00
|
|
|
AudioState *s;
|
2004-11-10 00:09:44 +01:00
|
|
|
int enabled;
|
2009-09-12 00:28:45 +02:00
|
|
|
int poll_mode;
|
2004-11-10 00:09:44 +01:00
|
|
|
int pending_disable;
|
2005-10-30 19:58:22 +01:00
|
|
|
struct audio_pcm_info info;
|
2004-11-10 00:09:44 +01:00
|
|
|
|
|
|
|
f_sample *clip;
|
|
|
|
|
2019-08-19 01:06:58 +02:00
|
|
|
size_t rpos;
|
2005-10-30 19:58:22 +01:00
|
|
|
uint64_t ts_helper;
|
2004-11-10 00:09:44 +01:00
|
|
|
|
2008-12-03 23:48:44 +01:00
|
|
|
struct st_sample *mix_buf;
|
audio: api for mixeng code free backends
This will make it possible to skip mixeng with audio playback and
recording, allowing us to free ourselves from the limitations of the
current mixeng (stereo, int64 samples only). In this case, HW and SW
voices will be essentially the same, for every SW voice we will create
a HW voice, since we can no longer mix multiple voices together.
Some backends expect us to call a function when we have data ready
write()/read() style, while others provide a buffer and expects us to
directly write/read it, so for optimal performance audio_pcm_ops provide
methods for both cases. Previously backends asked mixeng for more data
in run_out/run_it, now instead mixeng or the frontends will call the
backends, so that's why two sets of functions required. audio.c
contains glue code between the two styles, so backends only ever have to
implement one style and frontends are free to call whichever is more
convenient for them.
Signed-off-by: Kővágó, Zoltán <DirtY.iCE.hu@gmail.com>
Message-id: 15a33c03a62228922d851f7324c52f73cb8d2414.1568927990.git.DirtY.iCE.hu@gmail.com
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2019-09-19 23:24:09 +02:00
|
|
|
void *buf_emul;
|
|
|
|
size_t pos_emul, pending_emul, size_emul;
|
2004-11-10 00:09:44 +01:00
|
|
|
|
2019-08-19 01:06:58 +02:00
|
|
|
size_t samples;
|
2009-09-12 09:36:22 +02:00
|
|
|
QLIST_HEAD (sw_out_listhead, SWVoiceOut) sw_head;
|
|
|
|
QLIST_HEAD (sw_cap_listhead, SWVoiceCap) cap_head;
|
2012-04-17 14:32:36 +02:00
|
|
|
int ctl_caps;
|
2008-10-06 20:08:30 +02:00
|
|
|
struct audio_pcm_ops *pcm_ops;
|
2009-09-12 09:36:22 +02:00
|
|
|
QLIST_ENTRY (HWVoiceOut) entries;
|
2005-10-30 19:58:22 +01:00
|
|
|
} HWVoiceOut;
|
2004-11-10 00:09:44 +01:00
|
|
|
|
2005-10-30 19:58:22 +01:00
|
|
|
typedef struct HWVoiceIn {
|
2019-08-19 01:06:46 +02:00
|
|
|
AudioState *s;
|
2005-10-30 19:58:22 +01:00
|
|
|
int enabled;
|
2009-09-12 00:28:45 +02:00
|
|
|
int poll_mode;
|
2005-10-30 19:58:22 +01:00
|
|
|
struct audio_pcm_info info;
|
|
|
|
|
|
|
|
t_sample *conv;
|
2004-11-11 17:55:09 +01:00
|
|
|
|
2019-08-19 01:06:58 +02:00
|
|
|
size_t wpos;
|
|
|
|
size_t total_samples_captured;
|
2005-10-30 19:58:22 +01:00
|
|
|
uint64_t ts_helper;
|
2004-11-10 00:09:44 +01:00
|
|
|
|
2008-12-03 23:48:44 +01:00
|
|
|
struct st_sample *conv_buf;
|
audio: api for mixeng code free backends
This will make it possible to skip mixeng with audio playback and
recording, allowing us to free ourselves from the limitations of the
current mixeng (stereo, int64 samples only). In this case, HW and SW
voices will be essentially the same, for every SW voice we will create
a HW voice, since we can no longer mix multiple voices together.
Some backends expect us to call a function when we have data ready
write()/read() style, while others provide a buffer and expects us to
directly write/read it, so for optimal performance audio_pcm_ops provide
methods for both cases. Previously backends asked mixeng for more data
in run_out/run_it, now instead mixeng or the frontends will call the
backends, so that's why two sets of functions required. audio.c
contains glue code between the two styles, so backends only ever have to
implement one style and frontends are free to call whichever is more
convenient for them.
Signed-off-by: Kővágó, Zoltán <DirtY.iCE.hu@gmail.com>
Message-id: 15a33c03a62228922d851f7324c52f73cb8d2414.1568927990.git.DirtY.iCE.hu@gmail.com
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2019-09-19 23:24:09 +02:00
|
|
|
void *buf_emul;
|
|
|
|
size_t pos_emul, pending_emul, size_emul;
|
2004-11-10 00:09:44 +01:00
|
|
|
|
2019-08-19 01:06:58 +02:00
|
|
|
size_t samples;
|
2009-09-12 09:36:22 +02:00
|
|
|
QLIST_HEAD (sw_in_listhead, SWVoiceIn) sw_head;
|
2012-04-17 14:32:36 +02:00
|
|
|
int ctl_caps;
|
2008-10-06 20:08:30 +02:00
|
|
|
struct audio_pcm_ops *pcm_ops;
|
2009-09-12 09:36:22 +02:00
|
|
|
QLIST_ENTRY (HWVoiceIn) entries;
|
2005-10-30 19:58:22 +01:00
|
|
|
} HWVoiceIn;
|
2004-11-10 00:09:44 +01:00
|
|
|
|
2005-10-30 19:58:22 +01:00
|
|
|
struct SWVoiceOut {
|
2009-05-14 01:11:35 +02:00
|
|
|
QEMUSoundCard *card;
|
2019-08-19 01:06:46 +02:00
|
|
|
AudioState *s;
|
2005-10-30 19:58:22 +01:00
|
|
|
struct audio_pcm_info info;
|
2004-11-10 00:09:44 +01:00
|
|
|
t_sample *conv;
|
|
|
|
int64_t ratio;
|
2008-12-03 23:48:44 +01:00
|
|
|
struct st_sample *buf;
|
2004-11-10 00:09:44 +01:00
|
|
|
void *rate;
|
2019-08-19 01:06:58 +02:00
|
|
|
size_t total_hw_samples_mixed;
|
2005-10-30 19:58:22 +01:00
|
|
|
int active;
|
|
|
|
int empty;
|
|
|
|
HWVoiceOut *hw;
|
|
|
|
char *name;
|
2008-12-03 23:48:44 +01:00
|
|
|
struct mixeng_volume vol;
|
2005-10-30 19:58:22 +01:00
|
|
|
struct audio_callback callback;
|
2009-09-12 09:36:22 +02:00
|
|
|
QLIST_ENTRY (SWVoiceOut) entries;
|
2005-10-30 19:58:22 +01:00
|
|
|
};
|
2004-11-10 00:09:44 +01:00
|
|
|
|
2005-10-30 19:58:22 +01:00
|
|
|
struct SWVoiceIn {
|
2009-05-14 01:11:35 +02:00
|
|
|
QEMUSoundCard *card;
|
2019-08-19 01:06:46 +02:00
|
|
|
AudioState *s;
|
2004-11-10 00:09:44 +01:00
|
|
|
int active;
|
2005-10-30 19:58:22 +01:00
|
|
|
struct audio_pcm_info info;
|
|
|
|
int64_t ratio;
|
|
|
|
void *rate;
|
2019-08-19 01:06:58 +02:00
|
|
|
size_t total_hw_samples_acquired;
|
2008-12-03 23:48:44 +01:00
|
|
|
struct st_sample *buf;
|
2005-10-30 19:58:22 +01:00
|
|
|
f_sample *clip;
|
|
|
|
HWVoiceIn *hw;
|
2004-11-10 00:09:44 +01:00
|
|
|
char *name;
|
2008-12-03 23:48:44 +01:00
|
|
|
struct mixeng_volume vol;
|
2005-10-30 19:58:22 +01:00
|
|
|
struct audio_callback callback;
|
2009-09-12 09:36:22 +02:00
|
|
|
QLIST_ENTRY (SWVoiceIn) entries;
|
2004-11-10 00:09:44 +01:00
|
|
|
};
|
|
|
|
|
2018-03-06 08:40:47 +01:00
|
|
|
typedef struct audio_driver audio_driver;
|
2005-11-05 19:55:28 +01:00
|
|
|
struct audio_driver {
|
|
|
|
const char *name;
|
|
|
|
const char *descr;
|
2019-03-08 23:34:15 +01:00
|
|
|
void *(*init) (Audiodev *);
|
2005-11-05 19:55:28 +01:00
|
|
|
void (*fini) (void *);
|
2008-10-06 20:08:30 +02:00
|
|
|
struct audio_pcm_ops *pcm_ops;
|
2005-11-05 19:55:28 +01:00
|
|
|
int can_be_default;
|
|
|
|
int max_voices_out;
|
|
|
|
int max_voices_in;
|
|
|
|
int voice_size_out;
|
|
|
|
int voice_size_in;
|
2012-04-17 14:32:36 +02:00
|
|
|
int ctl_caps;
|
2018-03-06 08:40:47 +01:00
|
|
|
QLIST_ENTRY(audio_driver) next;
|
2005-11-05 19:55:28 +01:00
|
|
|
};
|
|
|
|
|
2005-10-30 19:58:22 +01:00
|
|
|
struct audio_pcm_ops {
|
audio: api for mixeng code free backends
This will make it possible to skip mixeng with audio playback and
recording, allowing us to free ourselves from the limitations of the
current mixeng (stereo, int64 samples only). In this case, HW and SW
voices will be essentially the same, for every SW voice we will create
a HW voice, since we can no longer mix multiple voices together.
Some backends expect us to call a function when we have data ready
write()/read() style, while others provide a buffer and expects us to
directly write/read it, so for optimal performance audio_pcm_ops provide
methods for both cases. Previously backends asked mixeng for more data
in run_out/run_it, now instead mixeng or the frontends will call the
backends, so that's why two sets of functions required. audio.c
contains glue code between the two styles, so backends only ever have to
implement one style and frontends are free to call whichever is more
convenient for them.
Signed-off-by: Kővágó, Zoltán <DirtY.iCE.hu@gmail.com>
Message-id: 15a33c03a62228922d851f7324c52f73cb8d2414.1568927990.git.DirtY.iCE.hu@gmail.com
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2019-09-19 23:24:09 +02:00
|
|
|
int (*init_out)(HWVoiceOut *hw, audsettings *as, void *drv_opaque);
|
|
|
|
void (*fini_out)(HWVoiceOut *hw);
|
2019-08-19 01:06:58 +02:00
|
|
|
size_t (*run_out)(HWVoiceOut *hw, size_t live);
|
audio: api for mixeng code free backends
This will make it possible to skip mixeng with audio playback and
recording, allowing us to free ourselves from the limitations of the
current mixeng (stereo, int64 samples only). In this case, HW and SW
voices will be essentially the same, for every SW voice we will create
a HW voice, since we can no longer mix multiple voices together.
Some backends expect us to call a function when we have data ready
write()/read() style, while others provide a buffer and expects us to
directly write/read it, so for optimal performance audio_pcm_ops provide
methods for both cases. Previously backends asked mixeng for more data
in run_out/run_it, now instead mixeng or the frontends will call the
backends, so that's why two sets of functions required. audio.c
contains glue code between the two styles, so backends only ever have to
implement one style and frontends are free to call whichever is more
convenient for them.
Signed-off-by: Kővágó, Zoltán <DirtY.iCE.hu@gmail.com>
Message-id: 15a33c03a62228922d851f7324c52f73cb8d2414.1568927990.git.DirtY.iCE.hu@gmail.com
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2019-09-19 23:24:09 +02:00
|
|
|
size_t (*write) (HWVoiceOut *hw, void *buf, size_t size);
|
|
|
|
/*
|
|
|
|
* get a buffer that after later can be passed to put_buffer_out; optional
|
|
|
|
* returns the buffer, and writes it's size to size (in bytes)
|
|
|
|
* this is unrelated to the above buffer_size_out function
|
|
|
|
*/
|
|
|
|
void *(*get_buffer_out)(HWVoiceOut *hw, size_t *size);
|
|
|
|
/*
|
|
|
|
* put back the buffer returned by get_buffer_out; optional
|
|
|
|
* buf must be equal the pointer returned by get_buffer_out,
|
|
|
|
* size may be smaller
|
|
|
|
*/
|
|
|
|
size_t (*put_buffer_out)(HWVoiceOut *hw, void *buf, size_t size);
|
|
|
|
int (*ctl_out) (HWVoiceOut *hw, int cmd, ...);
|
|
|
|
|
|
|
|
int (*init_in) (HWVoiceIn *hw, audsettings *as, void *drv_opaque);
|
|
|
|
void (*fini_in) (HWVoiceIn *hw);
|
2019-08-19 01:06:58 +02:00
|
|
|
size_t (*run_in)(HWVoiceIn *hw);
|
audio: api for mixeng code free backends
This will make it possible to skip mixeng with audio playback and
recording, allowing us to free ourselves from the limitations of the
current mixeng (stereo, int64 samples only). In this case, HW and SW
voices will be essentially the same, for every SW voice we will create
a HW voice, since we can no longer mix multiple voices together.
Some backends expect us to call a function when we have data ready
write()/read() style, while others provide a buffer and expects us to
directly write/read it, so for optimal performance audio_pcm_ops provide
methods for both cases. Previously backends asked mixeng for more data
in run_out/run_it, now instead mixeng or the frontends will call the
backends, so that's why two sets of functions required. audio.c
contains glue code between the two styles, so backends only ever have to
implement one style and frontends are free to call whichever is more
convenient for them.
Signed-off-by: Kővágó, Zoltán <DirtY.iCE.hu@gmail.com>
Message-id: 15a33c03a62228922d851f7324c52f73cb8d2414.1568927990.git.DirtY.iCE.hu@gmail.com
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2019-09-19 23:24:09 +02:00
|
|
|
size_t (*read) (HWVoiceIn *hw, void *buf, size_t size);
|
|
|
|
void *(*get_buffer_in)(HWVoiceIn *hw, size_t *size);
|
|
|
|
void (*put_buffer_in)(HWVoiceIn *hw, void *buf, size_t size);
|
|
|
|
int (*ctl_in) (HWVoiceIn *hw, int cmd, ...);
|
2004-11-10 00:09:44 +01:00
|
|
|
};
|
|
|
|
|
audio: api for mixeng code free backends
This will make it possible to skip mixeng with audio playback and
recording, allowing us to free ourselves from the limitations of the
current mixeng (stereo, int64 samples only). In this case, HW and SW
voices will be essentially the same, for every SW voice we will create
a HW voice, since we can no longer mix multiple voices together.
Some backends expect us to call a function when we have data ready
write()/read() style, while others provide a buffer and expects us to
directly write/read it, so for optimal performance audio_pcm_ops provide
methods for both cases. Previously backends asked mixeng for more data
in run_out/run_it, now instead mixeng or the frontends will call the
backends, so that's why two sets of functions required. audio.c
contains glue code between the two styles, so backends only ever have to
implement one style and frontends are free to call whichever is more
convenient for them.
Signed-off-by: Kővágó, Zoltán <DirtY.iCE.hu@gmail.com>
Message-id: 15a33c03a62228922d851f7324c52f73cb8d2414.1568927990.git.DirtY.iCE.hu@gmail.com
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2019-09-19 23:24:09 +02:00
|
|
|
void *audio_generic_get_buffer_in(HWVoiceIn *hw, size_t *size);
|
|
|
|
void audio_generic_put_buffer_in(HWVoiceIn *hw, void *buf, size_t size);
|
|
|
|
void *audio_generic_get_buffer_out(HWVoiceOut *hw, size_t *size);
|
|
|
|
size_t audio_generic_put_buffer_out(HWVoiceOut *hw, void *buf, size_t size);
|
|
|
|
size_t audio_generic_put_buffer_out_nowrite(HWVoiceOut *hw, void *buf,
|
|
|
|
size_t size);
|
|
|
|
size_t audio_generic_write(HWVoiceOut *hw, void *buf, size_t size);
|
|
|
|
size_t audio_generic_read(HWVoiceIn *hw, void *buf, size_t size);
|
|
|
|
|
2006-07-04 18:51:32 +02:00
|
|
|
struct capture_callback {
|
|
|
|
struct audio_capture_ops ops;
|
|
|
|
void *opaque;
|
2009-09-12 09:36:22 +02:00
|
|
|
QLIST_ENTRY (capture_callback) entries;
|
2006-07-04 18:51:32 +02:00
|
|
|
};
|
|
|
|
|
2006-07-16 20:57:03 +02:00
|
|
|
struct CaptureVoiceOut {
|
2006-07-04 18:51:32 +02:00
|
|
|
HWVoiceOut hw;
|
|
|
|
void *buf;
|
2009-09-12 09:36:22 +02:00
|
|
|
QLIST_HEAD (cb_listhead, capture_callback) cb_head;
|
|
|
|
QLIST_ENTRY (CaptureVoiceOut) entries;
|
2006-07-16 20:57:03 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
struct SWVoiceCap {
|
|
|
|
SWVoiceOut sw;
|
|
|
|
CaptureVoiceOut *cap;
|
2009-09-12 09:36:22 +02:00
|
|
|
QLIST_ENTRY (SWVoiceCap) entries;
|
2006-07-16 20:57:03 +02:00
|
|
|
};
|
2006-07-04 18:51:32 +02:00
|
|
|
|
2019-01-11 15:08:53 +01:00
|
|
|
typedef struct AudioState {
|
2005-11-05 19:55:28 +01:00
|
|
|
struct audio_driver *drv;
|
2019-03-08 23:34:15 +01:00
|
|
|
Audiodev *dev;
|
2005-11-05 19:55:28 +01:00
|
|
|
void *drv_opaque;
|
|
|
|
|
|
|
|
QEMUTimer *ts;
|
2009-09-12 09:36:22 +02:00
|
|
|
QLIST_HEAD (card_listhead, QEMUSoundCard) card_head;
|
|
|
|
QLIST_HEAD (hw_in_listhead, HWVoiceIn) hw_head_in;
|
|
|
|
QLIST_HEAD (hw_out_listhead, HWVoiceOut) hw_head_out;
|
|
|
|
QLIST_HEAD (cap_listhead, CaptureVoiceOut) cap_head;
|
2005-11-05 19:55:28 +01:00
|
|
|
int nb_hw_voices_out;
|
|
|
|
int nb_hw_voices_in;
|
2009-02-18 21:44:04 +01:00
|
|
|
int vm_running;
|
2019-03-08 23:34:15 +01:00
|
|
|
int64_t period_ticks;
|
2019-08-19 01:06:46 +02:00
|
|
|
|
|
|
|
bool timer_running;
|
|
|
|
uint64_t timer_last;
|
2019-08-19 01:06:47 +02:00
|
|
|
|
|
|
|
QTAILQ_ENTRY(AudioState) list;
|
2019-01-11 15:08:53 +01:00
|
|
|
} AudioState;
|
2005-11-05 19:55:28 +01:00
|
|
|
|
2011-01-05 01:05:47 +01:00
|
|
|
extern const struct mixeng_volume nominal_volume;
|
2005-11-05 19:55:28 +01:00
|
|
|
|
2019-03-08 23:34:15 +01:00
|
|
|
extern const char *audio_prio_list[];
|
|
|
|
|
2018-03-06 08:40:47 +01:00
|
|
|
void audio_driver_register(audio_driver *drv);
|
|
|
|
audio_driver *audio_driver_lookup(const char *name);
|
|
|
|
|
2008-12-03 23:48:44 +01:00
|
|
|
void audio_pcm_init_info (struct audio_pcm_info *info, struct audsettings *as);
|
2005-10-30 19:58:22 +01:00
|
|
|
void audio_pcm_info_clear_buf (struct audio_pcm_info *info, void *buf, int len);
|
|
|
|
|
2019-08-19 01:06:58 +02:00
|
|
|
size_t audio_pcm_hw_get_live_in(HWVoiceIn *hw);
|
2005-10-30 19:58:22 +01:00
|
|
|
|
2019-08-19 01:06:58 +02:00
|
|
|
size_t audio_pcm_hw_clip_out(HWVoiceOut *hw, void *pcm_buf,
|
|
|
|
size_t live, size_t pending);
|
2009-09-18 08:59:38 +02:00
|
|
|
|
2005-11-05 19:55:28 +01:00
|
|
|
int audio_bug (const char *funcname, int cond);
|
|
|
|
void *audio_calloc (const char *funcname, int nmemb, size_t size);
|
|
|
|
|
2019-08-19 01:06:55 +02:00
|
|
|
void audio_run(AudioState *s, const char *msg);
|
2009-09-12 00:28:45 +02:00
|
|
|
|
2004-11-10 00:09:44 +01:00
|
|
|
#define VOICE_ENABLE 1
|
|
|
|
#define VOICE_DISABLE 2
|
2012-04-17 14:32:35 +02:00
|
|
|
#define VOICE_VOLUME 3
|
2004-11-10 00:09:44 +01:00
|
|
|
|
2012-04-17 14:32:36 +02:00
|
|
|
#define VOICE_VOLUME_CAP (1 << VOICE_VOLUME)
|
|
|
|
|
2019-08-19 01:06:58 +02:00
|
|
|
static inline size_t audio_ring_dist(size_t dst, size_t src, size_t len)
|
2005-10-30 19:58:22 +01:00
|
|
|
{
|
|
|
|
return (dst >= src) ? (dst - src) : (len - src + dst);
|
|
|
|
}
|
|
|
|
|
2013-06-16 11:19:31 +02:00
|
|
|
#define dolog(fmt, ...) AUD_log(AUDIO_CAP, fmt, ## __VA_ARGS__)
|
2005-10-30 19:58:22 +01:00
|
|
|
|
|
|
|
#ifdef DEBUG
|
2013-06-16 11:19:31 +02:00
|
|
|
#define ldebug(fmt, ...) AUD_log(AUDIO_CAP, fmt, ## __VA_ARGS__)
|
2005-10-30 19:58:22 +01:00
|
|
|
#else
|
2013-06-16 11:19:31 +02:00
|
|
|
#define ldebug(fmt, ...) (void)0
|
2005-10-30 19:58:22 +01:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#define AUDIO_STRINGIFY_(n) #n
|
|
|
|
#define AUDIO_STRINGIFY(n) AUDIO_STRINGIFY_(n)
|
|
|
|
|
2019-03-08 23:34:15 +01:00
|
|
|
typedef struct AudiodevListEntry {
|
|
|
|
Audiodev *dev;
|
|
|
|
QSIMPLEQ_ENTRY(AudiodevListEntry) next;
|
|
|
|
} AudiodevListEntry;
|
|
|
|
|
|
|
|
typedef QSIMPLEQ_HEAD(, AudiodevListEntry) AudiodevListHead;
|
|
|
|
AudiodevListHead audio_handle_legacy_opts(void);
|
|
|
|
|
|
|
|
void audio_free_audiodev_list(AudiodevListHead *head);
|
|
|
|
|
|
|
|
void audio_create_pdos(Audiodev *dev);
|
|
|
|
AudiodevPerDirectionOptions *audio_get_pdo_in(Audiodev *dev);
|
|
|
|
AudiodevPerDirectionOptions *audio_get_pdo_out(Audiodev *dev);
|
|
|
|
|
2016-06-29 15:29:06 +02:00
|
|
|
#endif /* QEMU_AUDIO_INT_H */
|