Skip to content
This repository has been archived by the owner on Feb 11, 2021. It is now read-only.

Commit

Permalink
NetBSD patch to use AUDIO_GETBUFINFO when available (contributed by j…
Browse files Browse the repository at this point in the history
…mcneill)
  • Loading branch information
slouken committed Sep 26, 2012
1 parent 11426c2 commit a015c1d
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/audio/sun/SDL_sunaudio.c
Expand Up @@ -53,6 +53,10 @@
/* Open the audio device for playback, and don't block if busy */
#define OPEN_FLAGS (O_WRONLY|O_NONBLOCK)

#if defined(AUDIO_GETINFO) && !defined(AUDIO_GETBUFINFO)
#define AUDIO_GETBUFINFO AUDIO_GETINFO
#endif

/* Audio driver functions */
static int DSP_OpenAudio(_THIS, SDL_AudioSpec * spec);
static void DSP_WaitAudio(_THIS);
Expand Down Expand Up @@ -129,11 +133,11 @@ AudioBootStrap SUNAUDIO_bootstrap = {
void
CheckUnderflow(_THIS)
{
#ifdef AUDIO_GETINFO
#ifdef AUDIO_GETBUFINFO
audio_info_t info;
int left;

ioctl(audio_fd, AUDIO_GETINFO, &info);
ioctl(audio_fd, AUDIO_GETBUFINFO, &info);
left = (written - info.play.samples);
if (written && (left == 0)) {
fprintf(stderr, "audio underflow!\n");
Expand All @@ -145,12 +149,12 @@ CheckUnderflow(_THIS)
void
DSP_WaitAudio(_THIS)
{
#ifdef AUDIO_GETINFO
#ifdef AUDIO_GETBUFINFO
#define SLEEP_FUDGE 10 /* 10 ms scheduling fudge factor */
audio_info_t info;
Sint32 left;

ioctl(audio_fd, AUDIO_GETINFO, &info);
ioctl(audio_fd, AUDIO_GETBUFINFO, &info);
left = (written - info.play.samples);
if (left > fragsize) {
Sint32 sleepy;
Expand Down

0 comments on commit a015c1d

Please sign in to comment.