Paudio driver moved to 1.3 API. SDL-ryan-multiple-audio-device
authorRyan C. Gordon <icculus@icculus.org>
Sat, 07 Oct 2006 20:20:59 +0000
branchSDL-ryan-multiple-audio-device
changeset 3832ca74a71063ac
parent 3831 7df0d3efe682
child 3833 de857f0708f5
Paudio driver moved to 1.3 API.
src/audio/paudio/SDL_paudio.c
src/audio/paudio/SDL_paudio.h
     1.1 --- a/src/audio/paudio/SDL_paudio.c	Sat Oct 07 19:59:57 2006 +0000
     1.2 +++ b/src/audio/paudio/SDL_paudio.c	Sat Oct 07 20:20:59 2006 +0000
     1.3 @@ -40,7 +40,7 @@
     1.4  #include "../SDL_audio_c.h"
     1.5  #include "SDL_paudio.h"
     1.6  
     1.7 -#define DEBUG_AUDIO 1
     1.8 +#define DEBUG_AUDIO 0
     1.9  
    1.10  /* A conflict within AIX 4.3.3 <sys/> headers and probably others as well.
    1.11   * I guess nobody ever uses audio... Shame over AIX header files.  */
    1.12 @@ -49,20 +49,12 @@
    1.13  #include <sys/audio.h>
    1.14  
    1.15  /* The tag name used by paud audio */
    1.16 -#define Paud_DRIVER_NAME         "paud"
    1.17 +#define PAUDIO_DRIVER_NAME         "paud"
    1.18  
    1.19  /* Open the audio device for playback, and don't block if busy */
    1.20  /* #define OPEN_FLAGS	(O_WRONLY|O_NONBLOCK) */
    1.21  #define OPEN_FLAGS	O_WRONLY
    1.22  
    1.23 -/* Audio driver functions */
    1.24 -static int Paud_OpenAudio(_THIS, SDL_AudioSpec * spec);
    1.25 -static void Paud_WaitAudio(_THIS);
    1.26 -static void Paud_PlayAudio(_THIS);
    1.27 -static Uint8 *Paud_GetAudioBuf(_THIS);
    1.28 -static void Paud_CloseAudio(_THIS);
    1.29 -
    1.30 -
    1.31  /* Get the name of the audio device we use for output */
    1.32  
    1.33  #ifndef _PATH_DEV_DSP
    1.34 @@ -85,7 +77,7 @@
    1.35  OpenUserDefinedDevice(char *path, int maxlen, int flags)
    1.36  {
    1.37      const char *audiodev;
    1.38 -    int audio_fd;
    1.39 +    int fd;
    1.40  
    1.41      /* Figure out what our audio device is */
    1.42      if ((audiodev = SDL_getenv("SDL_PATH_DSP")) == NULL) {
    1.43 @@ -94,42 +86,40 @@
    1.44      if (audiodev == NULL) {
    1.45          return -1;
    1.46      }
    1.47 -    audio_fd = open(audiodev, flags, 0);
    1.48 +    fd = open(audiodev, flags, 0);
    1.49      if (path != NULL) {
    1.50          SDL_strlcpy(path, audiodev, maxlen);
    1.51          path[maxlen - 1] = '\0';
    1.52      }
    1.53 -    return audio_fd;
    1.54 +    return fd;
    1.55  }
    1.56  
    1.57 -int
    1.58 +static int
    1.59  OpenAudioPath(char *path, int maxlen, int flags, int classic)
    1.60  {
    1.61      struct stat sb;
    1.62 -    int audio_fd;
    1.63 -    char audiopath[1024];
    1.64 -    int cycle;
    1.65 +    int cycle = 0;
    1.66 +    int fd = OpenUserDefinedDevice(path, maxlen, flags);
    1.67  
    1.68 -    audio_fd = OpenUserDefinedDevice(path, maxlen, flags);
    1.69 -    if (audio_fd != -1) {
    1.70 -        return audio_fd;
    1.71 +    if (fd != -1) {
    1.72 +        return fd;
    1.73      }
    1.74  
    1.75 -    cycle = 0;
    1.76      /* !!! FIXME: do we really need a table here? */
    1.77      while (devsettings[cycle][0] != '\0') {
    1.78 +        char audiopath[1024];
    1.79          SDL_snprintf(audiopath, SDL_arraysize(audiopath),
    1.80                       _PATH_DEV_DSP,
    1.81                       devsettings[cycle][0],
    1.82                       devsettings[cycle][1], devsettings[cycle][2]);
    1.83  
    1.84          if (stat(audiopath, &sb) == 0) {
    1.85 -            audio_fd = open(audiopath, flags, 0);
    1.86 -            if (audio_fd > 0) {
    1.87 +            fd = open(audiopath, flags, 0);
    1.88 +            if (fd > 0) {
    1.89                  if (path != NULL) {
    1.90                      SDL_strlcpy(path, audiopath, maxlen);
    1.91                  }
    1.92 -                return audio_fd;
    1.93 +                return fd;
    1.94              }
    1.95          }
    1.96      }
    1.97 @@ -137,10 +127,8 @@
    1.98  }
    1.99  
   1.100  
   1.101 -/* Audio driver bootstrap functions */
   1.102 -
   1.103  static int
   1.104 -Audio_Available(void)
   1.105 +PAUDIO_Available(void)
   1.106  {
   1.107      int fd;
   1.108      int available;
   1.109 @@ -154,64 +142,19 @@
   1.110      return (available);
   1.111  }
   1.112  
   1.113 -static void
   1.114 -Audio_DeleteDevice(SDL_AudioDevice * device)
   1.115 -{
   1.116 -    SDL_free(device->hidden);
   1.117 -    SDL_free(device);
   1.118 -}
   1.119 -
   1.120 -static SDL_AudioDevice *
   1.121 -Audio_CreateDevice(int devindex)
   1.122 -{
   1.123 -    SDL_AudioDevice *this;
   1.124 -
   1.125 -    /* Initialize all variables that we clean on shutdown */
   1.126 -    this = (SDL_AudioDevice *) SDL_malloc(sizeof(SDL_AudioDevice));
   1.127 -    if (this) {
   1.128 -        SDL_memset(this, 0, (sizeof *this));
   1.129 -        this->hidden = (struct SDL_PrivateAudioData *)
   1.130 -            SDL_malloc((sizeof *this->hidden));
   1.131 -    }
   1.132 -    if ((this == NULL) || (this->hidden == NULL)) {
   1.133 -        SDL_OutOfMemory();
   1.134 -        if (this) {
   1.135 -            SDL_free(this);
   1.136 -        }
   1.137 -        return (0);
   1.138 -    }
   1.139 -    SDL_memset(this->hidden, 0, (sizeof *this->hidden));
   1.140 -    audio_fd = -1;
   1.141 -
   1.142 -    /* Set the function pointers */
   1.143 -    this->OpenAudio = Paud_OpenAudio;
   1.144 -    this->WaitAudio = Paud_WaitAudio;
   1.145 -    this->PlayAudio = Paud_PlayAudio;
   1.146 -    this->GetAudioBuf = Paud_GetAudioBuf;
   1.147 -    this->CloseAudio = Paud_CloseAudio;
   1.148 -
   1.149 -    this->free = Audio_DeleteDevice;
   1.150 -
   1.151 -    return this;
   1.152 -}
   1.153 -
   1.154 -AudioBootStrap Paud_bootstrap = {
   1.155 -    Paud_DRIVER_NAME, "AIX Paudio",
   1.156 -    Audio_Available, Audio_CreateDevice, 0
   1.157 -};
   1.158  
   1.159  /* This function waits until it is possible to write a full sound buffer */
   1.160  static void
   1.161 -Paud_WaitAudio(_THIS)
   1.162 +PAUDIO_WaitDevice(_THIS)
   1.163  {
   1.164      fd_set fdset;
   1.165  
   1.166      /* See if we need to use timed audio synchronization */
   1.167 -    if (frame_ticks) {
   1.168 +    if (this->hidden->frame_ticks) {
   1.169          /* Use timer for general audio synchronization */
   1.170          Sint32 ticks;
   1.171  
   1.172 -        ticks = ((Sint32) (next_frame - SDL_GetTicks())) - FUDGE_TICKS;
   1.173 +        ticks = ((Sint32)(this->hidden->next_frame-SDL_GetTicks()))-FUDGE_TICKS;
   1.174          if (ticks > 0) {
   1.175              SDL_Delay(ticks);
   1.176          }
   1.177 @@ -221,9 +164,9 @@
   1.178          /* Use select() for audio synchronization */
   1.179          struct timeval timeout;
   1.180          FD_ZERO(&fdset);
   1.181 -        FD_SET(audio_fd, &fdset);
   1.182 +        FD_SET(this->hidden->audio_fd, &fdset);
   1.183  
   1.184 -        if (ioctl(audio_fd, AUDIO_BUFFER, &paud_bufinfo) < 0) {
   1.185 +        if (ioctl(this->hidden->audio_fd, AUDIO_BUFFER, &paud_bufinfo) < 0) {
   1.186  #ifdef DEBUG_AUDIO
   1.187              fprintf(stderr, "Couldn't get audio buffer information\n");
   1.188  #endif
   1.189 @@ -244,7 +187,7 @@
   1.190  #ifdef DEBUG_AUDIO
   1.191          fprintf(stderr, "Waiting for audio to get ready\n");
   1.192  #endif
   1.193 -        if (select(audio_fd + 1, NULL, &fdset, NULL, &timeout) <= 0) {
   1.194 +        if (select(this->hidden->audio_fd+1,NULL,&fdset,NULL,&timeout) <= 0) {
   1.195              const char *message =
   1.196                  "Audio timeout - buggy audio driver? (disabled)";
   1.197              /*
   1.198 @@ -255,7 +198,7 @@
   1.199              fprintf(stderr, "SDL: %s - %s\n", strerror(errno), message);
   1.200              this->enabled = 0;
   1.201              /* Don't try to close - may hang */
   1.202 -            audio_fd = -1;
   1.203 +            this->hidden->audio_fd = -1;
   1.204  #ifdef DEBUG_AUDIO
   1.205              fprintf(stderr, "Done disabling audio\n");
   1.206  #endif
   1.207 @@ -267,13 +210,15 @@
   1.208  }
   1.209  
   1.210  static void
   1.211 -Paud_PlayAudio(_THIS)
   1.212 +PAUDIO_PlayDevice(_THIS)
   1.213  {
   1.214 -    int written;
   1.215 +    int written = 0;
   1.216 +    const Uint8 *mixbuf = this->hidden->mixbuf;
   1.217 +    const size_t mixlen = this->hidden->mixlen;
   1.218  
   1.219      /* Write the audio data, checking for EAGAIN on broken audio drivers */
   1.220      do {
   1.221 -        written = write(audio_fd, mixbuf, mixlen);
   1.222 +        written = write(this->hidden->audio_fd, mixbuf, mixlen);
   1.223          if ((written < 0) && ((errno == 0) || (errno == EAGAIN))) {
   1.224              SDL_Delay(1);       /* Let a little CPU time go by */
   1.225          }
   1.226 @@ -282,8 +227,8 @@
   1.227             ((errno == 0) || (errno == EAGAIN) || (errno == EINTR)));
   1.228  
   1.229      /* If timer synchronization is enabled, set the next write frame */
   1.230 -    if (frame_ticks) {
   1.231 -        next_frame += frame_ticks;
   1.232 +    if (this->hidden->frame_ticks) {
   1.233 +        this->hidden->next_frame += this->hidden->frame_ticks;
   1.234      }
   1.235  
   1.236      /* If we couldn't write, assume fatal error for now */
   1.237 @@ -296,28 +241,34 @@
   1.238  }
   1.239  
   1.240  static Uint8 *
   1.241 -Paud_GetAudioBuf(_THIS)
   1.242 +PAUDIO_GetDeviceBuf(_THIS)
   1.243  {
   1.244 -    return mixbuf;
   1.245 +    return this->hidden->mixbuf;
   1.246  }
   1.247  
   1.248  static void
   1.249 -Paud_CloseAudio(_THIS)
   1.250 +PAUDIO_CloseDevice(_THIS)
   1.251  {
   1.252 -    if (mixbuf != NULL) {
   1.253 -        SDL_FreeAudioMem(mixbuf);
   1.254 -        mixbuf = NULL;
   1.255 -    }
   1.256 -    if (audio_fd >= 0) {
   1.257 -        close(audio_fd);
   1.258 -        audio_fd = -1;
   1.259 +    if (this->hidden != NULL) {
   1.260 +        if (this->hidden->mixbuf != NULL) {
   1.261 +            SDL_FreeAudioMem(this->hidden->mixbuf);
   1.262 +            this->hidden->mixbuf = NULL;
   1.263 +        }
   1.264 +        if (this->hidden->audio_fd >= 0) {
   1.265 +            close(this->hidden->audio_fd);
   1.266 +            this->hidden->audio_fd = -1;
   1.267 +        }
   1.268 +        SDL_free(this->hidden);
   1.269 +        this->hidden = NULL;
   1.270      }
   1.271  }
   1.272  
   1.273  static int
   1.274 -Paud_OpenAudio(_THIS, SDL_AudioSpec * spec)
   1.275 +PAUDIO_OpenDevice(_THIS, const char *devname, int iscapture)
   1.276  {
   1.277 +    const char *workaround = SDL_getenv("SDL_DSP_NOSELECT");
   1.278      char audiodev[1024];
   1.279 +    const char *err = NULL;
   1.280      int format;
   1.281      int bytes_per_sample;
   1.282      SDL_AudioFormat test_format;
   1.283 @@ -326,32 +277,40 @@
   1.284      audio_status paud_status;
   1.285      audio_control paud_control;
   1.286      audio_change paud_change;
   1.287 +    int fd = -1;
   1.288  
   1.289 -    /* Reset the timer synchronization flag */
   1.290 -    frame_ticks = 0.0;
   1.291 +    /* Initialize all variables that we clean on shutdown */
   1.292 +    this->hidden = (struct SDL_PrivateAudioData *)
   1.293 +                        SDL_malloc((sizeof *this->hidden));
   1.294 +    if (this->hidden == NULL) {
   1.295 +        SDL_OutOfMemory();
   1.296 +        return 0;
   1.297 +    }
   1.298 +    SDL_memset(this->hidden, 0, (sizeof *this->hidden));
   1.299  
   1.300      /* Open the audio device */
   1.301 -    audio_fd = OpenAudioPath(audiodev, sizeof(audiodev), OPEN_FLAGS, 0);
   1.302 -    if (audio_fd < 0) {
   1.303 +    fd = OpenAudioPath(audiodev, sizeof(audiodev), OPEN_FLAGS, 0);
   1.304 +    this->hidden->audio_fd = fd;
   1.305 +    if (fd < 0) {
   1.306 +        PAUDIO_CloseDevice(this);
   1.307          SDL_SetError("Couldn't open %s: %s", audiodev, strerror(errno));
   1.308 -        return -1;
   1.309 +        return 0;
   1.310      }
   1.311  
   1.312      /*
   1.313       * We can't set the buffer size - just ask the device for the maximum
   1.314       * that we can have.
   1.315       */
   1.316 -    if (ioctl(audio_fd, AUDIO_BUFFER, &paud_bufinfo) < 0) {
   1.317 +    if (ioctl(fd, AUDIO_BUFFER, &paud_bufinfo) < 0) {
   1.318 +        PAUDIO_CloseDevice(this);
   1.319          SDL_SetError("Couldn't get audio buffer information");
   1.320 -        return -1;
   1.321 +        return 0;
   1.322      }
   1.323  
   1.324 -    mixbuf = NULL;
   1.325 -
   1.326 -    if (spec->channels > 1)
   1.327 -        spec->channels = 2;
   1.328 +    if (this->spec.channels > 1)
   1.329 +        this->spec.channels = 2;
   1.330      else
   1.331 -        spec->channels = 1;
   1.332 +        this->spec.channels = 1;
   1.333  
   1.334      /*
   1.335       * Fields in the audio_init structure:
   1.336 @@ -398,14 +357,14 @@
   1.337       * paud.position_resolution; * smallest increment for position
   1.338       */
   1.339  
   1.340 -    paud_init.srate = spec->freq;
   1.341 +    paud_init.srate = this->spec.freq;
   1.342      paud_init.mode = PCM;
   1.343      paud_init.operation = PLAY;
   1.344 -    paud_init.channels = spec->channels;
   1.345 +    paud_init.channels = this->spec.channels;
   1.346  
   1.347      /* Try for a closest match on audio format */
   1.348      format = 0;
   1.349 -    for (test_format = SDL_FirstAudioFormat(spec->format);
   1.350 +    for (test_format = SDL_FirstAudioFormat(this->spec.format);
   1.351           !format && test_format;) {
   1.352  #ifdef DEBUG_AUDIO
   1.353          fprintf(stderr, "Trying format 0x%4.4x\n", test_format);
   1.354 @@ -458,31 +417,32 @@
   1.355  #ifdef DEBUG_AUDIO
   1.356          fprintf(stderr, "Couldn't find any hardware audio formats\n");
   1.357  #endif
   1.358 +        PAUDIO_CloseDevice(this);
   1.359          SDL_SetError("Couldn't find any hardware audio formats");
   1.360 -        return -1;
   1.361 +        return 0;
   1.362      }
   1.363 -    spec->format = test_format;
   1.364 +    this->spec.format = test_format;
   1.365  
   1.366      /*
   1.367       * We know the buffer size and the max number of subsequent writes
   1.368 -     * that can be pending. If more than one can pend, allow the application
   1.369 -     * to do something like double buffering between our write buffer and
   1.370 -     * the device's own buffer that we are filling with write() anyway.
   1.371 +     *  that can be pending. If more than one can pend, allow the application
   1.372 +     *  to do something like double buffering between our write buffer and
   1.373 +     *  the device's own buffer that we are filling with write() anyway.
   1.374       *
   1.375 -     * We calculate spec->samples like this because SDL_CalculateAudioSpec()
   1.376 -     * will give put paud_bufinfo.write_buf_cap (or paud_bufinfo.write_buf_cap/2)
   1.377 -     * into spec->size in return.
   1.378 +     * We calculate this->spec.samples like this because
   1.379 +     *  SDL_CalculateAudioSpec() will give put paud_bufinfo.write_buf_cap
   1.380 +     *  (or paud_bufinfo.write_buf_cap/2) into this->spec.size in return.
   1.381       */
   1.382      if (paud_bufinfo.request_buf_cap == 1) {
   1.383 -        spec->samples = paud_bufinfo.write_buf_cap
   1.384 -            / bytes_per_sample / spec->channels;
   1.385 +        this->spec.samples = paud_bufinfo.write_buf_cap
   1.386 +            / bytes_per_sample / this->spec.channels;
   1.387      } else {
   1.388 -        spec->samples = paud_bufinfo.write_buf_cap
   1.389 -            / bytes_per_sample / spec->channels / 2;
   1.390 +        this->spec.samples = paud_bufinfo.write_buf_cap
   1.391 +            / bytes_per_sample / this->spec.channels / 2;
   1.392      }
   1.393 -    paud_init.bsize = bytes_per_sample * spec->channels;
   1.394 +    paud_init.bsize = bytes_per_sample * this->spec.channels;
   1.395  
   1.396 -    SDL_CalculateAudioSpec(spec);
   1.397 +    SDL_CalculateAudioSpec(&this->spec);
   1.398  
   1.399      /*
   1.400       * The AIX paud device init can't modify the values of the audio_init
   1.401 @@ -492,47 +452,44 @@
   1.402       * /dev/paud supports all of the encoding formats, so we don't need
   1.403       * to do anything like reopening the device, either.
   1.404       */
   1.405 -    if (ioctl(audio_fd, AUDIO_INIT, &paud_init) < 0) {
   1.406 +    if (ioctl(fd, AUDIO_INIT, &paud_init) < 0) {
   1.407          switch (paud_init.rc) {
   1.408          case 1:
   1.409 -            SDL_SetError
   1.410 -                ("Couldn't set audio format: DSP can't do play requests");
   1.411 -            return -1;
   1.412 +            err = "Couldn't set audio format: DSP can't do play requests";
   1.413              break;
   1.414          case 2:
   1.415 -            SDL_SetError
   1.416 -                ("Couldn't set audio format: DSP can't do record requests");
   1.417 -            return -1;
   1.418 +            err = "Couldn't set audio format: DSP can't do record requests";
   1.419              break;
   1.420          case 4:
   1.421 -            SDL_SetError("Couldn't set audio format: request was invalid");
   1.422 -            return -1;
   1.423 +            err = "Couldn't set audio format: request was invalid";
   1.424              break;
   1.425          case 5:
   1.426 -            SDL_SetError
   1.427 -                ("Couldn't set audio format: conflict with open's flags");
   1.428 -            return -1;
   1.429 +            err = "Couldn't set audio format: conflict with open's flags";
   1.430              break;
   1.431          case 6:
   1.432 -            SDL_SetError
   1.433 -                ("Couldn't set audio format: out of DSP MIPS or memory");
   1.434 -            return -1;
   1.435 +            err = "Couldn't set audio format: out of DSP MIPS or memory";
   1.436              break;
   1.437          default:
   1.438 -            SDL_SetError
   1.439 -                ("Couldn't set audio format: not documented in sys/audio.h");
   1.440 -            return -1;
   1.441 +            err = "Couldn't set audio format: not documented in sys/audio.h";
   1.442              break;
   1.443          }
   1.444      }
   1.445  
   1.446 +    if (err != NULL) {
   1.447 +        PAUDIO_CloseDevice(this);
   1.448 +        SDL_SetError("Paudio: %s", err);
   1.449 +        return 0;
   1.450 +    }
   1.451 +
   1.452      /* Allocate mixing buffer */
   1.453 -    mixlen = spec->size;
   1.454 -    mixbuf = (Uint8 *) SDL_AllocAudioMem(mixlen);
   1.455 -    if (mixbuf == NULL) {
   1.456 -        return -1;
   1.457 +    this->hidden->mixlen = this->spec.size;
   1.458 +    this->hidden->mixbuf = (Uint8 *) SDL_AllocAudioMem(this->hidden->mixlen);
   1.459 +    if (this->hidden->mixbuf == NULL) {
   1.460 +        PAUDIO_CloseDevice(this);
   1.461 +        SDL_OutOfMemory();
   1.462 +        return 0;
   1.463      }
   1.464 -    SDL_memset(mixbuf, spec->silence, spec->size);
   1.465 +    SDL_memset(this->hidden->mixbuf, this->spec.silence, this->spec.size);
   1.466  
   1.467      /*
   1.468       * Set some paramters: full volume, first speaker that we can find.
   1.469 @@ -551,7 +508,7 @@
   1.470  
   1.471      paud_control.ioctl_request = AUDIO_CHANGE;
   1.472      paud_control.request_info = (char *) &paud_change;
   1.473 -    if (ioctl(audio_fd, AUDIO_CONTROL, &paud_control) < 0) {
   1.474 +    if (ioctl(fd, AUDIO_CONTROL, &paud_control) < 0) {
   1.475  #ifdef DEBUG_AUDIO
   1.476          fprintf(stderr, "Can't change audio display settings\n");
   1.477  #endif
   1.478 @@ -563,29 +520,43 @@
   1.479       */
   1.480      paud_control.ioctl_request = AUDIO_START;
   1.481      paud_control.position = 0;
   1.482 -    if (ioctl(audio_fd, AUDIO_CONTROL, &paud_control) < 0) {
   1.483 +    if (ioctl(fd, AUDIO_CONTROL, &paud_control) < 0) {
   1.484 +        PAUDIO_CloseDevice(this);
   1.485  #ifdef DEBUG_AUDIO
   1.486          fprintf(stderr, "Can't start audio play\n");
   1.487  #endif
   1.488          SDL_SetError("Can't start audio play");
   1.489 -        return -1;
   1.490 +        return 0;
   1.491      }
   1.492  
   1.493      /* Check to see if we need to use select() workaround */
   1.494 -    {
   1.495 -        char *workaround;
   1.496 -        workaround = SDL_getenv("SDL_DSP_NOSELECT");
   1.497 -        if (workaround) {
   1.498 -            frame_ticks = (float) (spec->samples * 1000) / spec->freq;
   1.499 -            next_frame = SDL_GetTicks() + frame_ticks;
   1.500 -        }
   1.501 +    if (workaround != NULL) {
   1.502 +        this->hidden->frame_ticks = (float) (this->spec.samples * 1000) /
   1.503 +                                                this->spec.freq;
   1.504 +        this->hidden->next_frame = SDL_GetTicks() + this->hidden->frame_ticks;
   1.505      }
   1.506  
   1.507 -    /* Get the parent process id (we're the parent of the audio thread) */
   1.508 -    parent = getpid();
   1.509 -
   1.510      /* We're ready to rock and roll. :-) */
   1.511 -    return 0;
   1.512 +    return 1;
   1.513  }
   1.514  
   1.515 +static int
   1.516 +PAUDIO_Init(SDL_AudioDriverImpl *impl)
   1.517 +{
   1.518 +    /* Set the function pointers */
   1.519 +    impl->OpenDevice = DSP_OpenDevice;
   1.520 +    impl->PlayDevice = DSP_PlayDevice;
   1.521 +    impl->PlayDevice = DSP_WaitDevice;
   1.522 +    impl->GetDeviceBuf = DSP_GetDeviceBuf;
   1.523 +    impl->CloseDevice = DSP_CloseDevice;
   1.524 +    impl->OnlyHasDefaultOutputDevice = 1;  /* !!! FIXME: add device enum! */
   1.525 +
   1.526 +    return 1;
   1.527 +}
   1.528 +
   1.529 +AudioBootStrap PAUDIO_bootstrap = {
   1.530 +    PAUDIO_DRIVER_NAME, "AIX Paudio",
   1.531 +    PAUDIO_Available, PAUDIO_Init, 0
   1.532 +};
   1.533 +
   1.534  /* vi: set ts=4 sw=4 expandtab: */
     2.1 --- a/src/audio/paudio/SDL_paudio.h	Sat Oct 07 19:59:57 2006 +0000
     2.2 +++ b/src/audio/paudio/SDL_paudio.h	Sat Oct 07 20:20:59 2006 +0000
     2.3 @@ -34,9 +34,6 @@
     2.4      /* The file descriptor for the audio device */
     2.5      int audio_fd;
     2.6  
     2.7 -    /* The parent process id, to detect when application quits */
     2.8 -    pid_t parent;
     2.9 -
    2.10      /* Raw mixing buffer */
    2.11      Uint8 *mixbuf;
    2.12      int mixlen;
    2.13 @@ -47,13 +44,5 @@
    2.14  };
    2.15  #define FUDGE_TICKS	10      /* The scheduler overhead ticks per frame */
    2.16  
    2.17 -/* Old variable names */
    2.18 -#define audio_fd		(this->hidden->audio_fd)
    2.19 -#define parent			(this->hidden->parent)
    2.20 -#define mixbuf			(this->hidden->mixbuf)
    2.21 -#define mixlen			(this->hidden->mixlen)
    2.22 -#define frame_ticks		(this->hidden->frame_ticks)
    2.23 -#define next_frame		(this->hidden->next_frame)
    2.24 -
    2.25  #endif /* _SDL_paudaudio_h */
    2.26  /* vi: set ts=4 sw=4 expandtab: */