audio_int.h revision c7d7b8e996fc676c71441361102c88e997c1267e
/*
* QEMU Audio subsystem header
*
* Copyright (c) 2003-2005 Vassili Karpov (malc)
*
* 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
* 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.
*/
#ifndef QEMU_AUDIO_INT_H
#define QEMU_AUDIO_INT_H
#ifdef CONFIG_COREAUDIO
#ifndef VBOX
#define FLOAT_MIXENG
#else
#endif
/* #define RECIPROCAL */
#endif
#include <limits.h>
#include "mixeng.h"
#define qemu_malloc RTMemAlloc
#define qemu_mallocz RTMemAllocZ
#define qemu_strdup RTStrDup
#define qemu_strfree RTStrFree
#define asprintf RTStrAPrintf
struct audio_pcm_ops;
typedef enum {
struct audio_option {
const char *name;
void *valp;
const char *descr;
int *overridenp;
int overriden;
};
struct audio_callback {
void *opaque;
};
struct audio_pcm_info {
int bits;
int sign;
int freq;
int nchannels;
int align;
int shift;
int bytes_per_second;
int swap_endianness;
};
typedef struct SWVoiceCap SWVoiceCap;
typedef struct HWVoiceOut {
int enabled;
int pending_disable;
struct audio_pcm_info info;
int rpos;
int samples;
struct audio_pcm_ops *pcm_ops;
} HWVoiceOut;
typedef struct HWVoiceIn {
int enabled;
struct audio_pcm_info info;
int wpos;
int samples;
struct audio_pcm_ops *pcm_ops;
} HWVoiceIn;
struct SWVoiceOut {
struct audio_pcm_info info;
int buf_samples;
void *rate;
int active;
int empty;
HWVoiceOut *hw;
char *name;
struct audio_callback callback;
};
struct SWVoiceIn {
int active;
struct audio_pcm_info info;
void *rate;
int buf_samples; /* for debugging only */
char *name;
struct audio_callback callback;
};
struct audio_driver {
const char *name;
const char *descr;
struct audio_option *options;
void *(*init) (void);
void (*fini) (void *);
struct audio_pcm_ops *pcm_ops;
int can_be_default;
int max_voices_out;
int max_voices_in;
int voice_size_out;
int voice_size_in;
};
struct audio_pcm_ops {
};
struct capture_callback {
struct audio_capture_ops ops;
void *opaque;
};
struct CaptureVoiceOut {
void *buf;
};
struct SWVoiceCap {
};
struct AudioState {
struct audio_driver *drv;
void *drv_opaque;
int nb_hw_voices_out;
int nb_hw_voices_in;
};
extern struct audio_driver no_audio_driver;
extern struct audio_driver oss_audio_driver;
extern struct audio_driver sdl_audio_driver;
extern struct audio_driver wav_audio_driver;
extern struct audio_driver fmod_audio_driver;
extern struct audio_driver alsa_audio_driver;
extern struct audio_driver pulse_audio_driver;
extern struct audio_driver coreaudio_audio_driver;
extern struct audio_driver dsound_audio_driver;
extern struct audio_driver solaudio_audio_driver;
extern volume_t nominal_volume;
#ifdef VBOX
extern volume_t pcm_out_volume;
extern volume_t pcm_in_volume;
#endif
uint64_t audio_get_clock (void);
uint64_t audio_get_ticks_per_sec (void);
#define VOICE_ENABLE 1
#define VOICE_DISABLE 2
{
}
#if __STDC_VERSION__ > 199901L
#define INIT_FIELD(f) . f
#else
#define INIT_FIELD(f) /**/
#endif
#else
#define GCC_ATTR /**/
#define INIT_FIELD(f) /**/
#define GCC_FMT_ATTR(n, m)
#endif
#ifndef VBOX
#else
#endif
{
}
#ifdef DEBUG
{
}
#else
#define ldebug(...)
#else
#ifndef VBOX
#else
#endif
{
(void) fmt;
}
#endif
#endif
#define AUDIO_STRINGIFY_(n) #n
#define AUDIO_STRINGIFY(n) AUDIO_STRINGIFY_(n)
#define AUDIO_FUNC __FUNCTION__
#else
#endif
unsigned cSamples);
/*
* Filter interface.
*/
typedef DECLCALLBACK(int) FNAUDIOINPUTCALLBACK(void* pvCtx, uint32_t cbSamples, const void *pvSamples);
typedef FNAUDIOINPUTCALLBACK *PFNAUDIOINPUTCALLBACK;
int filter_output_intercepted(void);
void filter_output_end(void *pvOutputCtx);
int filter_input_intercepted(void);
int filter_input_begin(void **ppvInputCtx, PFNAUDIOINPUTCALLBACK pfnCallback, void *pvCallback, HWVoiceIn *phw, int samples);
void filter_input_end(void *pvInputCtx);
#endif /* audio_int.h */