dsound_template.h revision 02e777a6f939d73f5285178584feffb3648fe8d5
/*
* QEMU DirectSound audio driver 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 DSBTYPE_IN
#define NAME "capture buffer"
#define IFACE IDirectSoundCaptureBuffer
#define BUFPTR LPDIRECTSOUNDCAPTUREBUFFER
#define FIELD dsound_capture_buffer
#else
#define NAME "playback buffer"
#define IFACE IDirectSoundBuffer
#define BUFPTR LPDIRECTSOUNDBUFFER
#define FIELD dsound_buffer
#endif
)
{
return -1;
}
return 0;
}
struct audio_pcm_info *info,
int entire
)
{
int i;
#ifdef DSBTYPE_IN
#else
#endif
for (i = 0; i < conf.lock_retries; ++i) {
buf,
pos,
len,
&p1,
&blen1,
&p2,
&blen2,
);
#ifndef DSBTYPE_IN
if (hr == DSERR_BUFFERLOST) {
goto fail;
}
continue;
}
#endif
goto fail;
}
break;
}
if (i == conf.lock_retries) {
goto fail;
}
dolog ("DirectSound returned misaligned buffer %ld %ld\n",
goto fail;
}
blen1 = 0;
}
blen2 = 0;
}
return 0;
fail:
*blen1p = -1;
*blen2p = -1;
return -1;
}
#ifdef DSBTYPE_IN
#else
#endif
{
#ifdef DSBTYPE_IN
#else
#endif
}
}
}
}
#ifdef DSBTYPE_IN
#else
#endif
{
int err;
dsound *s = &glob_dsound;
#ifdef DSBTYPE_IN
const char *typ = "ADC";
#else
const char *typ = "DAC";
#endif
if (err) {
return -1;
}
#ifdef DSBTYPE_IN
if (!s->dsound_capture)
return -1;
#endif
#ifdef DSBTYPE_IN
s->dsound_capture,
&bd,
);
#else
s->dsound,
&bd,
&ds->dsound_buffer,
);
#endif
return -1;
}
goto fail0;
}
#ifdef DEBUG_DSOUND
print_wave_format (&wfx);
#endif
goto fail0;
}
if (err) {
goto fail0;
}
obt_as.endianness = 0;
dolog (
"GetCaps returned misaligned buffer size %ld, alignment %d\n",
);
}
#ifdef DEBUG_DSOUND
dolog ("caps %ld, desc %ld\n",
dolog ("bufsize %d, freq %d, chan %d, bits %d, sign %d\n",
#endif
return 0;
return -1;
}