Fix T74111: Animation Playback Delayed With Time Remapping And AV-Sync
When setting the current playback time in BKE_sound_play_scene we didn't account for the frame length. So the current frame/time would be wrong when we asked the audio playback what time it was. This would lead to playback being offset when using time remapping and AV sync. Reviewed By: Richard Antalik and Sybren A. Stüvel Differential Revision: http://developer.blender.org/D7248
This commit is contained in:
parent
ded7af53b4
commit
9ddbb03861
Notes:
blender-bot
2023-02-14 00:44:02 +01:00
Referenced by issue #74111, Animation Playback Delayed With Time Remapping And AV-Sync
|
@ -751,12 +751,20 @@ static void sound_start_play_scene(Scene *scene)
|
|||
}
|
||||
}
|
||||
|
||||
static float get_cur_time(Scene *scene)
|
||||
{
|
||||
/* We divide by the current framelen to take into account time remapping.
|
||||
* Otherwise we will get the wrong starting time which will break A/V sync.
|
||||
* See T74111 for further details. */
|
||||
return FRA2TIME((CFRA + SUBFRA) / scene->r.framelen);
|
||||
}
|
||||
|
||||
void BKE_sound_play_scene(Scene *scene)
|
||||
{
|
||||
sound_verify_evaluated_id(&scene->id);
|
||||
|
||||
AUD_Status status;
|
||||
const float cur_time = (float)((double)CFRA / FPS);
|
||||
const float cur_time = get_cur_time(scene);
|
||||
|
||||
AUD_Device_lock(sound_device);
|
||||
|
||||
|
@ -804,7 +812,7 @@ void BKE_sound_seek_scene(Main *bmain, Scene *scene)
|
|||
int animation_playing;
|
||||
|
||||
const float one_frame = (float)(1.0 / FPS);
|
||||
const float cur_time = (float)((double)CFRA / FPS);
|
||||
const float cur_time = get_cur_time(scene);
|
||||
|
||||
AUD_Device_lock(sound_device);
|
||||
|
||||
|
|
Loading…
Reference in New Issue