From 58956f3b91e581ef7040371dda3e3595902c18d9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20M=C3=BCller?= Date: Mon, 15 Jun 2015 12:18:14 +0200 Subject: Audaspace: fix the new wm_playanim.c (from gooseberry branch) to use the new API. --- source/blender/windowmanager/intern/wm_playanim.c | 55 ++++++++++++----------- 1 file changed, 29 insertions(+), 26 deletions(-) (limited to 'source/blender/windowmanager/intern') diff --git a/source/blender/windowmanager/intern/wm_playanim.c b/source/blender/windowmanager/intern/wm_playanim.c index cd97deaa88a..3173e0180fa 100644 --- a/source/blender/windowmanager/intern/wm_playanim.c +++ b/source/blender/windowmanager/intern/wm_playanim.c @@ -77,6 +77,7 @@ AUD_Sound *source = NULL; AUD_Handle *playback_handle = NULL; AUD_Handle *scrub_handle = NULL; +AUD_Device *audio_device = NULL; #endif /* simple limiter to avoid flooding memory */ @@ -532,7 +533,7 @@ static void update_sound_fps(void) /* swaptime stores the 1.0/fps ratio */ double speed = 1.0 / (swaptime * fps_movie); - AUD_setSoundPitch(playback_handle, speed); + AUD_Handle_setPitch(playback_handle, speed); } #endif } @@ -554,30 +555,30 @@ static void change_frame(PlayState *ps, int cx) #ifdef WITH_AUDASPACE if (scrub_handle) { - AUD_stop(scrub_handle); + AUD_Handle_stop(scrub_handle); scrub_handle = NULL; } if (playback_handle) { - AUD_Status status = AUD_getStatus(playback_handle); + AUD_Status status = AUD_Handle_getStatus(playback_handle); if (status != AUD_STATUS_PLAYING) { - AUD_stop(playback_handle); - playback_handle = AUD_play(source, 1); + AUD_Handle_stop(playback_handle); + playback_handle = AUD_Device_play(audio_device, source, 1); if (playback_handle) { - AUD_seek(playback_handle, i / fps_movie); + AUD_Handle_setPosition(playback_handle, i / fps_movie); scrub_handle = AUD_pauseAfter(playback_handle, 1 / fps_movie); } update_sound_fps(); } else { - AUD_seek(playback_handle, i / fps_movie); + AUD_Handle_setPosition(playback_handle, i / fps_movie); scrub_handle = AUD_pauseAfter(playback_handle, 1 / fps_movie); } } else if (source) { - playback_handle = AUD_play(source, 1); + playback_handle = AUD_Device_play(audio_device, source, 1); if (playback_handle) { - AUD_seek(playback_handle, i / fps_movie); + AUD_Handle_setPosition(playback_handle, i / fps_movie); scrub_handle = AUD_pauseAfter(playback_handle, 1 / fps_movie); } update_sound_fps(); @@ -828,10 +829,10 @@ static int ghost_event_proc(GHOST_EventHandle evt, GHOST_TUserDataPtr ps_void) picture = picture->next; } if (playback_handle) - AUD_stop(playback_handle); - playback_handle = AUD_play(source, 1); + AUD_Handle_stop(playback_handle); + playback_handle = AUD_Device_play(audio_device, source, 1); if (playback_handle) - AUD_seek(playback_handle, i / fps_movie); + AUD_Handle_setPosition(playback_handle, i / fps_movie); update_sound_fps(); } #endif @@ -841,7 +842,7 @@ static int ghost_event_proc(GHOST_EventHandle evt, GHOST_TUserDataPtr ps_void) ps->wait2 = true; #ifdef WITH_AUDASPACE if (playback_handle) { - AUD_stop(playback_handle); + AUD_Handle_stop(playback_handle); playback_handle = NULL; } #endif @@ -862,10 +863,10 @@ static int ghost_event_proc(GHOST_EventHandle evt, GHOST_TUserDataPtr ps_void) picture = picture->next; } if (playback_handle) - AUD_stop(playback_handle); - playback_handle = AUD_play(source, 1); + AUD_Handle_stop(playback_handle); + playback_handle = AUD_Device_play(audio_device, source, 1); if (playback_handle) - AUD_seek(playback_handle, i / fps_movie); + AUD_Handle_setPosition(playback_handle, i / fps_movie); update_sound_fps(); } #endif @@ -882,7 +883,7 @@ static int ghost_event_proc(GHOST_EventHandle evt, GHOST_TUserDataPtr ps_void) ps->wait2 = !ps->wait2; #ifdef WITH_AUDASPACE if (playback_handle) { - AUD_stop(playback_handle); + AUD_Handle_stop(playback_handle); playback_handle = NULL; } #endif @@ -1104,8 +1105,10 @@ static char *wm_main_playanim_intern(int argc, const char **argv) specs.format = AUD_FORMAT_S16; specs.channels = AUD_CHANNELS_STEREO; - if (!AUD_init(AUD_OPENAL_DEVICE, specs, AUD_DEFAULT_BUFFER_SIZE)) - AUD_init(AUD_NULL_DEVICE, specs, AUD_DEFAULT_BUFFER_SIZE); + AUD_initOnce(); + + if (!(audio_device = AUD_init("OpenAL", specs, AUD_DEFAULT_BUFFER_SIZE, "Blender"))) + audio_device = AUD_init("Null", specs, AUD_DEFAULT_BUFFER_SIZE, "Blender"); #endif @@ -1281,7 +1284,7 @@ static char *wm_main_playanim_intern(int argc, const char **argv) build_pict_list(&ps, filepath, (efra - sfra) + 1, ps.fstep, ps.fontid); #ifdef WITH_AUDASPACE - source = AUD_load(filepath); + source = AUD_Sound_file(filepath); { struct anim *anim_movie = ((struct PlayAnimPict *)picsbase.first)->anim; if (anim_movie) { @@ -1338,8 +1341,8 @@ static char *wm_main_playanim_intern(int argc, const char **argv) #ifdef WITH_AUDASPACE if (playback_handle) - AUD_stop(playback_handle); - playback_handle = AUD_play(source, 1); + AUD_Handle_stop(playback_handle); + playback_handle = AUD_Device_play(audio_device, source, 1); update_sound_fps(); #endif @@ -1509,11 +1512,11 @@ static char *wm_main_playanim_intern(int argc, const char **argv) #ifdef WITH_AUDASPACE if (playback_handle) - AUD_stop(playback_handle); + AUD_Handle_stop(playback_handle); if (scrub_handle) - AUD_stop(scrub_handle); - AUD_unload(source); - AUD_exit(); + AUD_Handle_stop(scrub_handle); + AUD_Sound_free(source); + AUD_exit(audio_device); #endif #if 0 // XXX25 -- cgit v1.2.3