aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwhiteshark0 <whiteshark0@b956fd51-792f-4845-bead-9b4dfca2ff2c>2009-11-17 18:50:57 +0000
committerwhiteshark0 <whiteshark0@b956fd51-792f-4845-bead-9b4dfca2ff2c>2009-11-17 18:50:57 +0000
commit1c86cfca45351b172e42d508cb55788c644ed392 (patch)
treee0ede962fe581ace6041bb390d00fd0ecb7713b1
parent4a0804396809345423d596b079aed51261b8612f (diff)
downloadusdx-1c86cfca45351b172e42d508cb55788c644ed392.tar.gz
usdx-1c86cfca45351b172e42d508cb55788c644ed392.tar.xz
usdx-1c86cfca45351b172e42d508cb55788c644ed392.zip
fixed #89: wrong mp3 playback when selecting song while scrolling
the issue was caused by the delayed song loading to prevent noise when scrolling git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@1947 b956fd51-792f-4845-bead-9b4dfca2ff2c
-rw-r--r--src/screens/UScreenSong.pas20
1 files changed, 15 insertions, 5 deletions
diff --git a/src/screens/UScreenSong.pas b/src/screens/UScreenSong.pas
index 9a534c51..ff2ab201 100644
--- a/src/screens/UScreenSong.pas
+++ b/src/screens/UScreenSong.pas
@@ -57,6 +57,9 @@ type
private
Equalizer: Tms_Equalizer;
+ PreviewOpened: Integer; // interaction of the Song that is loaded for preview music
+ // -1 if nothing is opened
+
procedure StartMusicPreview();
procedure StopMusicPreview();
public
@@ -834,6 +837,8 @@ begin
Equalizer := Tms_Equalizer.Create(AudioPlayback, Theme.Song.Equalizer);
+ PreviewOpened := -1;
+
if (Length(CatSongs.Song) > 0) then
Interaction := 0;
end;
@@ -1440,7 +1445,9 @@ begin
begin
//Load Music only when Song Preview is activated
if ( Ini.PreviewVolume <> 0 ) then
- StartMusicPreview();
+ StartMusicPreview()
+ else
+ PreviewOpened := -1;
SetScroll;
end;
@@ -1473,13 +1480,13 @@ end;
procedure TScreenSong.OnHide;
begin
+ // if preview is not loaded: load musicfile now
+ if (PreviewOpened <> Interaction) then
+ AudioPlayback.Open(CatSongs.Song[Interaction].Path.Append(CatSongs.Song[Interaction].Mp3));
+
// turn music volume to 100%
AudioPlayback.SetVolume(1.0);
- // if preview is deactivated: load musicfile now
- if (IPreviewVolumeVals[Ini.PreviewVolume] = 0) then
- AudioPlayback.Open(CatSongs.Song[Interaction].Path.Append(CatSongs.Song[Interaction].Mp3));
-
// if hide then stop music (for party mode popup on exit)
if (Display.NextScreen <> @ScreenSing) and
(Display.NextScreen <> @ScreenSingModi) then
@@ -1659,6 +1666,8 @@ begin
if AudioPlayback.Open(Song.Path.Append(Song.Mp3)) then
begin
+ PreviewOpened := Interaction;
+
AudioPlayback.Position := AudioPlayback.Length / 4;
// set preview volume
if (Ini.PreviewFading = 0) then
@@ -1706,6 +1715,7 @@ end;
procedure TScreenSong.ChangeMusic;
begin
StopMusicPreview();
+ PreviewOpened := -1;
// Preview song if activated and current selection is not a category cover
if (CatSongs.VisibleSongs > 0) and