Added a simple audio resync method for video playback

Originally committed to SVN as r84.
This commit is contained in:
Rodrigo Braz Monteiro 2006-02-20 22:24:25 +00:00
parent 62f94c5a6c
commit 37ec3a7058
3 changed files with 15 additions and 7 deletions

View file

@ -107,12 +107,6 @@ private:
void GetKaraokePos(__int64 &start,__int64 &end,bool cap);
void UpdatePosition(int pos,bool IsSample=false);
int GetMSAtX(__int64 x);
int GetXAtMS(__int64 ms);
int GetMSAtSample(__int64 x);
__int64 GetSampleAtMS(__int64 ms);
int GetSyllableAtX(int x);
public:
bool NeedCommit;
bool loaded;
@ -135,9 +129,15 @@ public:
void SetFile(wxString file);
void SetFromVideo();
void UpdateScrollbar();
void SetDialogue(SubtitlesGrid *_grid=NULL,AssDialogue *diag=NULL,int n=-1);
__int64 GetSampleAtX(int x);
int GetXAtSample(__int64 n);
void SetDialogue(SubtitlesGrid *_grid=NULL,AssDialogue *diag=NULL,int n=-1);
int GetMSAtX(__int64 x);
int GetXAtMS(__int64 ms);
int GetMSAtSample(__int64 x);
__int64 GetSampleAtMS(__int64 ms);
int GetSyllableAtX(int x);
void MakeDialogueVisible(bool force=false);
void CommitChanges();

View file

@ -32,6 +32,7 @@ Please visit http://aegisub.net to download latest version
- Implemented Redo (AMZ)
- Fonts collector will now default collection to same folder as script (Set to "?script" on config.dat) (AMZ)
- Alt+Left/Right on the video seek bar will now seek by increments of 10 frames (increment is customizeable in config.dat) (AMZ)
- Added a simple audio resync method for video playback (AMZ)
= 1.09 beta - 2006.01.16 ===========================

View file

@ -836,4 +836,11 @@ void VideoDisplay::OnPlayTimer(wxTimerEvent &event) {
// Jump to next frame
PlayNextFrame = nextFrame;
JumpToFrame(nextFrame);
// Sync audio
if (nextFrame % 25 == 0) {
__int64 audPos = audio->GetSampleAtMS(VFR_Output.GetTimeAtFrame(nextFrame));
audio->provider->playPos = audPos;
audio->provider->realPlayPos = audPos;
}
}