src/audio/baudio/SDL_beaudio.cc
branchSDL-1.3
changeset 1668 4da1ee79c9af
parent 1662 782fd950bd46
     1.1 --- a/src/audio/baudio/SDL_beaudio.cc	Mon May 29 03:53:21 2006 +0000
     1.2 +++ b/src/audio/baudio/SDL_beaudio.cc	Mon May 29 04:04:35 2006 +0000
     1.3 @@ -38,44 +38,44 @@
     1.4  
     1.5  
     1.6  /* Audio driver functions */
     1.7 -    static int BE_OpenAudio (_THIS, SDL_AudioSpec * spec);
     1.8 -    static void BE_WaitAudio (_THIS);
     1.9 -    static void BE_PlayAudio (_THIS);
    1.10 -    static Uint8 *BE_GetAudioBuf (_THIS);
    1.11 -    static void BE_CloseAudio (_THIS);
    1.12 +    static int BE_OpenAudio(_THIS, SDL_AudioSpec * spec);
    1.13 +    static void BE_WaitAudio(_THIS);
    1.14 +    static void BE_PlayAudio(_THIS);
    1.15 +    static Uint8 *BE_GetAudioBuf(_THIS);
    1.16 +    static void BE_CloseAudio(_THIS);
    1.17  
    1.18  /* Audio driver bootstrap functions */
    1.19  
    1.20 -    static int Audio_Available (void)
    1.21 +    static int Audio_Available(void)
    1.22      {
    1.23          return (1);
    1.24      }
    1.25  
    1.26 -    static void Audio_DeleteDevice (SDL_AudioDevice * device)
    1.27 +    static void Audio_DeleteDevice(SDL_AudioDevice * device)
    1.28      {
    1.29 -        SDL_free (device->hidden);
    1.30 -        SDL_free (device);
    1.31 +        SDL_free(device->hidden);
    1.32 +        SDL_free(device);
    1.33      }
    1.34  
    1.35 -    static SDL_AudioDevice *Audio_CreateDevice (int devindex)
    1.36 +    static SDL_AudioDevice *Audio_CreateDevice(int devindex)
    1.37      {
    1.38          SDL_AudioDevice *device;
    1.39  
    1.40          /* Initialize all variables that we clean on shutdown */
    1.41 -        device = (SDL_AudioDevice *) SDL_malloc (sizeof (SDL_AudioDevice));
    1.42 +        device = (SDL_AudioDevice *) SDL_malloc(sizeof(SDL_AudioDevice));
    1.43          if (device) {
    1.44 -            SDL_memset (device, 0, (sizeof *device));
    1.45 +            SDL_memset(device, 0, (sizeof *device));
    1.46              device->hidden = (struct SDL_PrivateAudioData *)
    1.47 -                SDL_malloc ((sizeof *device->hidden));
    1.48 +                SDL_malloc((sizeof *device->hidden));
    1.49          }
    1.50          if ((device == NULL) || (device->hidden == NULL)) {
    1.51 -            SDL_OutOfMemory ();
    1.52 +            SDL_OutOfMemory();
    1.53              if (device) {
    1.54 -                SDL_free (device);
    1.55 +                SDL_free(device);
    1.56              }
    1.57              return (0);
    1.58          }
    1.59 -        SDL_memset (device->hidden, 0, (sizeof *device->hidden));
    1.60 +        SDL_memset(device->hidden, 0, (sizeof *device->hidden));
    1.61  
    1.62          /* Set the function pointers */
    1.63          device->OpenAudio = BE_OpenAudio;
    1.64 @@ -95,13 +95,13 @@
    1.65      };
    1.66  
    1.67  /* The BeOS callback for handling the audio buffer */
    1.68 -    static void FillSound (void *device, void *stream, size_t len,
    1.69 -                           const media_raw_audio_format & format)
    1.70 +    static void FillSound(void *device, void *stream, size_t len,
    1.71 +                          const media_raw_audio_format & format)
    1.72      {
    1.73          SDL_AudioDevice *audio = (SDL_AudioDevice *) device;
    1.74  
    1.75          /* Silence the buffer, since it's ours */
    1.76 -        SDL_memset (stream, audio->spec.silence, len);
    1.77 +        SDL_memset(stream, audio->spec.silence, len);
    1.78  
    1.79          /* Only do soemthing if audio is enabled */
    1.80          if (!audio->enabled)
    1.81 @@ -109,56 +109,56 @@
    1.82  
    1.83          if (!audio->paused) {
    1.84              if (audio->convert.needed) {
    1.85 -                SDL_mutexP (audio->mixer_lock);
    1.86 +                SDL_mutexP(audio->mixer_lock);
    1.87                  (*audio->spec.callback) (audio->spec.userdata,
    1.88                                           (Uint8 *) audio->convert.buf,
    1.89                                           audio->convert.len);
    1.90 -                SDL_mutexV (audio->mixer_lock);
    1.91 -                SDL_ConvertAudio (&audio->convert);
    1.92 -                SDL_memcpy (stream, audio->convert.buf,
    1.93 -                            audio->convert.len_cvt);
    1.94 +                SDL_mutexV(audio->mixer_lock);
    1.95 +                SDL_ConvertAudio(&audio->convert);
    1.96 +                SDL_memcpy(stream, audio->convert.buf,
    1.97 +                           audio->convert.len_cvt);
    1.98              } else {
    1.99 -                SDL_mutexP (audio->mixer_lock);
   1.100 +                SDL_mutexP(audio->mixer_lock);
   1.101                  (*audio->spec.callback) (audio->spec.userdata,
   1.102                                           (Uint8 *) stream, len);
   1.103 -                SDL_mutexV (audio->mixer_lock);
   1.104 +                SDL_mutexV(audio->mixer_lock);
   1.105              }
   1.106          }
   1.107          return;
   1.108      }
   1.109  
   1.110  /* Dummy functions -- we don't use thread-based audio */
   1.111 -    void BE_WaitAudio (_THIS)
   1.112 +    void BE_WaitAudio(_THIS)
   1.113      {
   1.114          return;
   1.115      }
   1.116 -    void BE_PlayAudio (_THIS)
   1.117 +    void BE_PlayAudio(_THIS)
   1.118      {
   1.119          return;
   1.120      }
   1.121 -    Uint8 *BE_GetAudioBuf (_THIS)
   1.122 +    Uint8 *BE_GetAudioBuf(_THIS)
   1.123      {
   1.124          return (NULL);
   1.125      }
   1.126  
   1.127 -    void BE_CloseAudio (_THIS)
   1.128 +    void BE_CloseAudio(_THIS)
   1.129      {
   1.130          if (audio_obj) {
   1.131 -            audio_obj->Stop ();
   1.132 +            audio_obj->Stop();
   1.133              delete audio_obj;
   1.134              audio_obj = NULL;
   1.135          }
   1.136  
   1.137          /* Quit the Be Application, if there's nothing left to do */
   1.138 -        SDL_QuitBeApp ();
   1.139 +        SDL_QuitBeApp();
   1.140      }
   1.141  
   1.142 -    int BE_OpenAudio (_THIS, SDL_AudioSpec * spec)
   1.143 +    int BE_OpenAudio(_THIS, SDL_AudioSpec * spec)
   1.144      {
   1.145          media_raw_audio_format format;
   1.146  
   1.147          /* Initialize the Be Application, if it's not already started */
   1.148 -        if (SDL_InitBeApp () < 0) {
   1.149 +        if (SDL_InitBeApp() < 0) {
   1.150              return (-1);
   1.151          }
   1.152  
   1.153 @@ -188,20 +188,20 @@
   1.154          format.buffer_size = spec->samples;
   1.155  
   1.156          /* Calculate the final parameters for this audio specification */
   1.157 -        SDL_CalculateAudioSpec (spec);
   1.158 +        SDL_CalculateAudioSpec(spec);
   1.159  
   1.160          /* Subscribe to the audio stream (creates a new thread) */
   1.161          {
   1.162              sigset_t omask;
   1.163 -            SDL_MaskSignals (&omask);
   1.164 -            audio_obj = new BSoundPlayer (&format, "SDL Audio", FillSound,
   1.165 -                                          NULL, _this);
   1.166 -            SDL_UnmaskSignals (&omask);
   1.167 +            SDL_MaskSignals(&omask);
   1.168 +            audio_obj = new BSoundPlayer(&format, "SDL Audio", FillSound,
   1.169 +                                         NULL, _this);
   1.170 +            SDL_UnmaskSignals(&omask);
   1.171          }
   1.172 -        if (audio_obj->Start () == B_NO_ERROR) {
   1.173 -            audio_obj->SetHasData (true);
   1.174 +        if (audio_obj->Start() == B_NO_ERROR) {
   1.175 +            audio_obj->SetHasData(true);
   1.176          } else {
   1.177 -            SDL_SetError ("Unable to start Be audio");
   1.178 +            SDL_SetError("Unable to start Be audio");
   1.179              return (-1);
   1.180          }
   1.181