native_midi/native_midi_macosx.c
changeset 718 fb0562cc1559
parent 625 1d489d8ec2e0
child 779 a2b494c054d5
equal deleted inserted replaced
717:27eb690edafc 718:fb0562cc1559
    29 #include <CoreServices/CoreServices.h>      /* ComponentDescription */
    29 #include <CoreServices/CoreServices.h>      /* ComponentDescription */
    30 #include <AudioUnit/AudioUnit.h>
    30 #include <AudioUnit/AudioUnit.h>
    31 #include <AudioToolbox/AudioToolbox.h>
    31 #include <AudioToolbox/AudioToolbox.h>
    32 #include <AvailabilityMacros.h>
    32 #include <AvailabilityMacros.h>
    33 
    33 
       
    34 #include "SDL_endian.h"
    34 #include "../SDL_mixer.h"
    35 #include "../SDL_mixer.h"
    35 #include "SDL_endian.h"
    36 #include "../mixer.h"
    36 #include "native_midi.h"
    37 #include "native_midi.h"
    37 
    38 
    38 /* Native Midi song */
    39 /* Native Midi song */
    39 struct _NativeMidiSong
    40 struct _NativeMidiSong
    40 {
    41 {
   262 
   263 
   263     if (song == NULL)
   264     if (song == NULL)
   264         return;
   265         return;
   265 
   266 
   266     SDL_PauseAudio(1);
   267     SDL_PauseAudio(1);
   267     SDL_UnlockAudio();
   268     Mix_UnlockAudio();
   268 
   269 
   269     if (currentsong)
   270     if (currentsong)
   270         MusicPlayerStop(currentsong->player);
   271         MusicPlayerStop(currentsong->player);
   271 
   272 
   272     currentsong = song;
   273     currentsong = song;
   280 
   281 
   281     vol = latched_volume;
   282     vol = latched_volume;
   282     latched_volume++;  /* just make this not match. */
   283     latched_volume++;  /* just make this not match. */
   283     native_midi_setvolume(vol);
   284     native_midi_setvolume(vol);
   284 
   285 
   285     SDL_LockAudio();
   286     Mix_LockAudio();
   286     SDL_PauseAudio(0);
   287     SDL_PauseAudio(0);
   287 }
   288 }
   288 
   289 
   289 void native_midi_stop()
   290 void native_midi_stop()
   290 {
   291 {
   291     if (currentsong) {
   292     if (currentsong) {
   292         SDL_PauseAudio(1);
   293         SDL_PauseAudio(1);
   293         SDL_UnlockAudio();
   294         Mix_UnlockAudio();
   294         MusicPlayerStop(currentsong->player);
   295         MusicPlayerStop(currentsong->player);
   295         currentsong = NULL;
   296         currentsong = NULL;
   296         SDL_LockAudio();
   297         Mix_LockAudio();
   297         SDL_PauseAudio(0);
   298         SDL_PauseAudio(0);
   298     }
   299     }
   299 }
   300 }
   300 
   301 
   301 int native_midi_active()
   302 int native_midi_active()