diff options
author | tobigun <tobigun@b956fd51-792f-4845-bead-9b4dfca2ff2c> | 2010-04-22 01:04:24 +0000 |
---|---|---|
committer | tobigun <tobigun@b956fd51-792f-4845-bead-9b4dfca2ff2c> | 2010-04-22 01:04:24 +0000 |
commit | edfc692c991e08af0163aa6812e5972478d7191b (patch) | |
tree | 2580b6460cd805a3782c39404e6208c05dc0a435 /src/screens | |
parent | 776e4ffb42b0cc5f32c2dcc54745a3537e3bcc15 (diff) | |
download | usdx-edfc692c991e08af0163aa6812e5972478d7191b.tar.gz usdx-edfc692c991e08af0163aa6812e5972478d7191b.tar.xz usdx-edfc692c991e08af0163aa6812e5972478d7191b.zip |
- now it is possible to sync lyrics to audio
- ini option SyncTo added
- lyric to audio is default now (instead of sync audio to lyrics)
- modified RelativeTimer (hopefully easier to use and more self-explanatory)
git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@2273 b956fd51-792f-4845-bead-9b4dfca2ff2c
Diffstat (limited to '')
-rw-r--r-- | src/screens/UScreenSing.pas | 32 |
1 files changed, 28 insertions, 4 deletions
diff --git a/src/screens/UScreenSing.pas b/src/screens/UScreenSing.pas index 269ef201..e4764760 100644 --- a/src/screens/UScreenSing.pas +++ b/src/screens/UScreenSing.pas @@ -58,6 +58,10 @@ type function GetClock(): real; override; end; + TMusicSyncSource = class(TSyncSource) + function GetClock(): real; override; + end; + type TScreenSing = class(TMenu) private @@ -65,6 +69,7 @@ type fCurrentVideo: IVideo; fVideoClip: IVideo; fLyricsSync: TLyricsSyncSource; + fMusicSync: TMusicSyncSource; protected eSongLoaded: THookableEvent; //< event is called after lyrics of a song are loaded on OnShow Paused: boolean; //pause Mod @@ -256,7 +261,7 @@ begin end else // disable pause begin - LyricsState.Resume(); + LyricsState.Start(); // play music AudioPlayback.Play; @@ -325,6 +330,7 @@ begin Theme.LyricBar.LowerX, Theme.LyricBar.LowerY, Theme.LyricBar.LowerW, Theme.LyricBar.LowerH); fLyricsSync := TLyricsSyncSource.Create(); + fMusicSync := TMusicSyncSource.Create(); eSongLoaded := THookableEvent.Create('ScreenSing.SongLoaded'); @@ -659,11 +665,21 @@ begin AudioPlayback.Open(CurrentSong.Path.Append(CurrentSong.Mp3)); AudioPlayback.SetVolume(1.0); AudioPlayback.Position := CurrentSong.Start; - // synchronize music to the lyrics - AudioPlayback.SetSyncSource(fLyricsSync); + + // synchronize music + if (Ini.SyncTo = Ord(stLyrics)) then + AudioPlayback.SetSyncSource(fLyricsSync) + else + AudioPlayback.SetSyncSource(nil); + + // synchronize lyrics (do not set this before AudioPlayback is initialized) + if (Ini.SyncTo = Ord(stMusic)) then + LyricsState.SetSyncSource(fMusicSync) + else + LyricsState.SetSyncSource(nil); // start lyrics - LyricsState.Resume(); + LyricsState.Start(true); // start music AudioPlayback.Play(); @@ -907,6 +923,9 @@ begin AudioPlayback.Stop; AudioPlayback.SetSyncSource(nil); + LyricsState.Stop(); + LyricsState.SetSyncSource(nil); + // close video files fVideoClip := nil; fCurrentVideo := nil; @@ -1045,5 +1064,10 @@ begin Result := LyricsState.GetCurrentTime(); end; +function TMusicSyncSource.GetClock(): real; +begin + Result := AudioPlayback.Position; +end; + end. |