svn merge -r 30954:31059 https://svn.blender.org/svnroot/bf-blender/trunk/blender
[blender.git] / source / blender / blenkernel / intern / sound.c
index 8fd97a801104c62abed80608760387d25c517a3b..26392132038f25e533dbb8807ca71718e0ff9faf 100644 (file)
@@ -382,10 +382,8 @@ void sound_move_scene_sound(struct Scene *scene, void* handle, int startframe, i
 
 void sound_start_play_scene(struct Scene *scene)
 {
-       AUD_Sound* sound;
-       sound = AUD_loopSound(scene->sound_scene);
-       scene->sound_scene_handle = AUD_play(sound, 1);
-       AUD_unload(sound);
+       scene->sound_scene_handle = AUD_play(scene->sound_scene, 1);
+       AUD_setLoop(scene->sound_scene_handle, -1);
 }
 
 void sound_play_scene(struct Scene *scene)
@@ -398,8 +396,6 @@ void sound_play_scene(struct Scene *scene)
        if(status == AUD_STATUS_INVALID)
                sound_start_play_scene(scene);
 
-       AUD_setLoop(scene->sound_scene_handle, -1, -1);
-
        if(status != AUD_STATUS_PLAYING)
        {
                AUD_seek(scene->sound_scene_handle, CFRA / FPS);
@@ -437,12 +433,16 @@ void sound_seek_scene(struct bContext *C)
 
        if(scene->audio.flag & AUDIO_SCRUB && !CTX_wm_screen(C)->animtimer)
        {
-               AUD_setLoop(scene->sound_scene_handle, -1, 1 / FPS);
+               // AUD_XXX TODO: fix scrubbing, it currently doesn't stop playing
                if(scene->audio.flag & AUDIO_SYNC)
                        AUD_seekSequencer(scene->sound_scene_handle, CFRA / FPS);
                else
                        AUD_seek(scene->sound_scene_handle, CFRA / FPS);
                AUD_resume(scene->sound_scene_handle);
+               if(AUD_getStatus(scene->sound_scrub_handle) != AUD_STATUS_INVALID)
+                       AUD_seek(scene->sound_scrub_handle, 0);
+               else
+                       scene->sound_scrub_handle = AUD_pauseAfter(scene->sound_scene_handle, 1 / FPS);
        }
        else
        {