Fix: Make sure Blender doesn't seek an extra time after starting to playback
This commit is contained in:
committed by
Sebastian Parborg
parent
6d1bc2feb1
commit
d7140a599d
@@ -930,7 +930,11 @@ void BKE_sound_play_scene(Scene *scene)
|
||||
}
|
||||
|
||||
if (status != AUD_STATUS_PLAYING) {
|
||||
AUD_Handle_setPosition(scene->playback_handle, cur_time);
|
||||
/* Seeking the synchronizer will also seek the playback handle.
|
||||
* Even if we don't have A/V sync on, keep the synchronizer and handle
|
||||
* seek time in sync.
|
||||
*/
|
||||
AUD_seekSynchronizer(scene->playback_handle, cur_time);
|
||||
AUD_Handle_resume(scene->playback_handle);
|
||||
}
|
||||
|
||||
@@ -991,10 +995,9 @@ void BKE_sound_seek_scene(Main *bmain, Scene *scene)
|
||||
}
|
||||
|
||||
if (scene->audio.flag & AUDIO_SCRUB && !animation_playing) {
|
||||
/* Playback one frame of audio without advancing the timeline. */
|
||||
// TODO bug when starting playback before "pauseAfter has finished.
|
||||
AUD_Handle_setPosition(scene->playback_handle, cur_time);
|
||||
if (scene->audio.flag & AUDIO_SYNC) {
|
||||
AUD_seekSynchronizer(scene->playback_handle, cur_time);
|
||||
}
|
||||
AUD_Handle_resume(scene->playback_handle);
|
||||
if (scene->sound_scrub_handle &&
|
||||
AUD_Handle_getStatus(scene->sound_scrub_handle) != AUD_STATUS_INVALID)
|
||||
@@ -1008,15 +1011,12 @@ void BKE_sound_seek_scene(Main *bmain, Scene *scene)
|
||||
scene->sound_scrub_handle = AUD_pauseAfter(scene->playback_handle, one_frame);
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (scene->audio.flag & AUDIO_SYNC) {
|
||||
AUD_seekSynchronizer(scene->playback_handle, cur_time);
|
||||
}
|
||||
else {
|
||||
if (status == AUD_STATUS_PLAYING) {
|
||||
AUD_Handle_setPosition(scene->playback_handle, cur_time);
|
||||
}
|
||||
}
|
||||
else if (status == AUD_STATUS_PLAYING) {
|
||||
/* Seeking the synchronizer will also seek the playback handle.
|
||||
* Even if we don't have A/V sync on, keep the synchronizer and handle
|
||||
* seek time in sync.
|
||||
*/
|
||||
AUD_seekSynchronizer(scene->playback_handle, cur_time);
|
||||
}
|
||||
|
||||
AUD_Device_unlock(sound_device);
|
||||
|
||||
@@ -1815,9 +1815,6 @@ void ED_screen_animation_timer(bContext *C, int redraws, int sync, int enable)
|
||||
sad->from_anim_edit = ELEM(spacetype, SPACE_GRAPH, SPACE_ACTION, SPACE_NLA);
|
||||
|
||||
screen->animtimer->customdata = sad;
|
||||
|
||||
/* Seek audio to ensure playback in preview range with AV sync. */
|
||||
DEG_id_tag_update(&scene->id, ID_RECALC_FRAME_CHANGE);
|
||||
}
|
||||
|
||||
/* Notifier caught by top header, for button. */
|
||||
|
||||
Reference in New Issue
Block a user