diff --git a/aegisub/audio_player_alsa.cpp b/aegisub/audio_player_alsa.cpp index 84fdede52..5dc5bdccd 100644 --- a/aegisub/audio_player_alsa.cpp +++ b/aegisub/audio_player_alsa.cpp @@ -397,6 +397,8 @@ __int64 AlsaPlayer::GetEndPosition() // Get current position __int64 AlsaPlayer::GetCurrentPosition() { + // FIXME: this should be based on not duration played but actual sample being heard + // (during vidoeo playback, cur_frame might get changed to resync) snd_pcm_sframes_t delay = 0; snd_pcm_delay(pcm_handle, &delay); // don't bother catching errors here return cur_frame - delay; diff --git a/aegisub/audio_player_dsound.cpp b/aegisub/audio_player_dsound.cpp index df74806d8..7c87a060c 100644 --- a/aegisub/audio_player_dsound.cpp +++ b/aegisub/audio_player_dsound.cpp @@ -395,6 +395,8 @@ __int64 DirectSoundPlayer::GetCurrentPosition() { // Check if buffer is loaded if (!buffer || !playing) return 0; + // FIXME: this should be based on not duration played but actual sample being heard + // (during vidoeo playback, cur_frame might get changed to resync) DWORD curtime = GetTickCount(); __int64 tdiff = curtime - startTime; return startPos + tdiff * provider->GetSampleRate() / 1000; diff --git a/aegisub/audio_player_openal.cpp b/aegisub/audio_player_openal.cpp index c553198c3..574d02cce 100644 --- a/aegisub/audio_player_openal.cpp +++ b/aegisub/audio_player_openal.cpp @@ -384,6 +384,8 @@ __int64 OpenALPlayer::GetEndPosition() // Get current position __int64 OpenALPlayer::GetCurrentPosition() { + // FIXME: this should be based on not duration played but actual sample being heard + // (during vidoeo playback, cur_frame might get changed to resync) long extra = playback_segment_timer.Time(); return buffers_played * buffer_length + start_frame + extra * samplerate / 1000; } diff --git a/aegisub/audio_player_pulse.cpp b/aegisub/audio_player_pulse.cpp index 4c237b769..15e511e83 100644 --- a/aegisub/audio_player_pulse.cpp +++ b/aegisub/audio_player_pulse.cpp @@ -395,6 +395,9 @@ __int64 PulseAudioPlayer::GetCurrentPosition() { if (!is_playing) return 0; + // FIXME: this should be based on not duration played but actual sample being heard + // (during vidoeo playback, cur_frame might get changed to resync) + // Calculation duration we have played, in microseconds pa_usec_t play_cur_time; pa_stream_get_time(stream, &play_cur_time);