Commit: 58956f3b91e581ef7040371dda3e3595902c18d9
Author: Jörg Müller
Date:   Mon Jun 15 12:18:14 2015 +0200
Branches: master
https://developer.blender.org/rB58956f3b91e581ef7040371dda3e3595902c18d9

Audaspace: fix the new wm_playanim.c (from gooseberry branch) to use the new 
API.

===================================================================

M       source/blender/windowmanager/intern/wm_playanim.c

===================================================================

diff --git a/source/blender/windowmanager/intern/wm_playanim.c 
b/source/blender/windowmanager/intern/wm_playanim.c
index cd97dea..3173e01 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

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to