aboutsummaryrefslogtreecommitdiffstats
path: root/Game
diff options
context:
space:
mode:
Diffstat (limited to 'Game')
-rw-r--r--Game/Code/Classes/UAudio_FFMpeg.pas28
-rw-r--r--Game/Code/Screens/UScreenSong.pas3
2 files changed, 14 insertions, 17 deletions
diff --git a/Game/Code/Classes/UAudio_FFMpeg.pas b/Game/Code/Classes/UAudio_FFMpeg.pas
index 8cef934b..9a242cd9 100644
--- a/Game/Code/Classes/UAudio_FFMpeg.pas
+++ b/Game/Code/Classes/UAudio_FFMpeg.pas
@@ -375,37 +375,33 @@ function TAudio_FFMpeg.Length: real;
var
bytes: integer;
begin
- Result := MusicStream.pFormatCtx^.duration / AV_TIME_BASE;
+ Result := 0;
+ // Todo : why is Music stream always nil !?
+
+ if assigned( MusicStream ) then
+ begin
+ //writeln( 'MusicStream : ' + inttostr( integer( assigned( MusicStream ))) );
+ //writeln( 'MusicStream.pFormatCtx : ' + inttostr( integer( assigned( MusicStream.pFormatCtx ))) );
+ //writeln( 'MusicStream.pFormatCtx^.duration : ' + inttostr( integer( MusicStream.pFormatCtx^.duration )) );
+
+ Result := MusicStream.pFormatCtx^.duration / AV_TIME_BASE;
+ end;
end;
function TAudio_FFMpeg.getPosition: real;
-var
- bytes: integer;
begin
Result := 0;
-
-(*
- bytes := BASS_ChannelGetPosition(BASS);
- Result := BASS_ChannelBytes2Seconds(BASS, bytes);
-*)
end;
function TAudio_FFMpeg.Finished: boolean;
begin
Result := false;
-
-(*
- if BASS_ChannelIsActive(BASS) = BASS_ACTIVE_STOPPED then
- begin
- Result := true;
- end;
-*)
end;
procedure TAudio_FFMpeg.PlayStart;
begin
if StartSoundStream <> nil then
- StartSoundStream.Play();
+ StartSoundStream.Play();
end;
procedure TAudio_FFMpeg.PlayBack;
diff --git a/Game/Code/Screens/UScreenSong.pas b/Game/Code/Screens/UScreenSong.pas
index 0def87ab..03ef793b 100644
--- a/Game/Code/Screens/UScreenSong.pas
+++ b/Game/Code/Screens/UScreenSong.pas
@@ -1519,7 +1519,8 @@ begin
if Length(CatSongs.Song) > 0 then begin
//Load Music only when Song Preview is activated
- if (Ini.PreviewVolume <> 0) then
+ if ( Ini.PreviewVolume <> 0 ) AND
+ ( AudioPlayback.Length > 1 ) then
begin
AudioPlayback.SetLoop(false);
AudioPlayback.Open(CatSongs.Song[Interaction].Path + CatSongs.Song[Interaction].Mp3);