audio_template.h revision 677833bc953b6cb418c701facbdcf4aa18d6c44e
/*
* QEMU Audio subsystem header
*
* Copyright (c) 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.
*/
#ifdef DAC
#define NAME "playback"
#define HW HWVoiceOut
#define SW SWVoiceOut
#else
#define NAME "capture"
#endif
AudioState *s,
struct audio_driver *drv
)
{
if (!max_voices) {
#ifdef DAC
#endif
}
else {
}
}
dolog ("drv=`%s' voice_size=0 max_voices=%d\n",
}
dolog ("drv=`%s' voice_size=%d max_voices=0\n",
}
}
{
if (HWBUF) {
}
}
{
if (!HWBUF) {
return -1;
}
return 0;
}
{
}
}
}
{
int samples;
#ifdef DAC
#else
#endif
dolog ("Could not allocate buffer for `%s' (%d samples)\n",
return -1;
}
#ifdef DAC
#else
#endif
return -1;
}
return 0;
}
const char *name,
)
{
int err;
#ifdef DAC
sw->total_hw_samples_mixed = 0;
#else
#endif
#ifdef DAC
#else
#endif
if (err) {
}
return err;
}
{
}
}
{
}
{
}
{
#ifdef DAC
#endif
}
}
{
}
{
return hw;
}
}
return NULL;
}
AudioState *s,
)
{
return hw;
}
}
return NULL;
}
{
return NULL;
}
dolog ("No host audio driver\n");
return NULL;
}
dolog ("Host audio driver without pcm_ops\n");
return NULL;
}
if (!hw) {
dolog ("Can not allocate voice `%s' size %d\n",
return NULL;
}
#ifdef DAC
#endif
goto err0;
}
goto err1;
}
#ifdef DAC
#else
#endif
goto err1;
}
#ifdef DAC
audio_attach_capture (s, hw);
#endif
return hw;
err1:
err0:
return NULL;
}
{
if (hw) {
return hw;
}
}
if (hw) {
return hw;
}
if (hw) {
return hw;
}
}
AudioState *s,
const char *sw_name,
)
{
}
else {
}
if (!sw) {
dolog ("Could not allocate soft voice `%s' (%zu bytes)\n",
#else
dolog ("Could not allocate soft voice `%s' (%u bytes)\n",
#endif
goto err1;
}
if (!hw) {
goto err2;
}
goto err3;
}
return sw;
err3:
err2:
err1:
return NULL;
}
{
}
{
if (sw) {
dolog ("card=%p card->audio=%p\n",
return;
}
}
}
const char *name,
void *callback_opaque ,
)
{
AudioState *s;
#ifdef DAC
int live = 0;
#endif
ldebug ("open %s, freq %d, nchannels %d, fmt %d\n",
if (audio_bug (AUDIO_FUNC,
dolog ("card=%p card->audio=%p name=%p callback_fn=%p as=%p\n",
name,
(void *) callback_fn,
(void *) as);
goto fail;
}
goto fail;
}
goto fail;
}
return sw;
}
#ifdef DAC
#ifdef DEBUG_PLIVE
dolog ("Old %s freq %d, bits %d, channels %d\n",
dolog ("New %s freq %d, bits %d, channels %d\n",
name,
freq,
#endif
if (live) {
}
}
#endif
}
if (sw) {
if (!hw) {
dolog ("Internal logic error voice `%s' has no hardware store\n",
goto fail;
}
goto fail;
}
}
else {
if (!sw) {
return NULL;
}
}
if (sw) {
#ifdef DAC
if (live) {
int mixed =
#ifdef DEBUG_PLIVE
#endif
}
#endif
#ifdef DEBUG_AUDIO
#endif
}
return sw;
fail:
return NULL;
}
{
}
{
if (!sw) {
return;
}
}
{
if (!sw) {
return 0;
}
/* dolog ("cur %lld old %lld\n", cur_ts, old_ts); */
}
else {
}
if (!delta) {
return 0;
}
}