From 59b053bc8a9e0b52168b73ca86296e6fe890f522 Mon Sep 17 00:00:00 2001 From: mogguh Date: Mon, 25 Aug 2008 19:46:45 +0000 Subject: Added: Option for background music in sound options (affects UIni too) Added: New language string SING_OPTIONS_SOUND_BACKGROUNDMUSIC Added: CC licensed music loop Improved: Options positions via Deluxe theme (first pass, next will follow) Improved: Code beautified in UScreenMain git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@1290 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UMusic.pas | 31 +++++++++++++++++++++++-------- 1 file changed, 23 insertions(+), 8 deletions(-) (limited to 'Game/Code/Classes/UMusic.pas') diff --git a/Game/Code/Classes/UMusic.pas b/Game/Code/Classes/UMusic.pas index f3474e30..4090bd2f 100644 --- a/Game/Code/Classes/UMusic.pas +++ b/Game/Code/Classes/UMusic.pas @@ -503,6 +503,8 @@ type procedure LoadSounds(); procedure UnloadSounds(); + procedure StartBgMusic(); + procedure PauseBgMusic(); // TODO //function AddSound(Filename: string): integer; //procedure RemoveSound(ID: integer); @@ -536,6 +538,7 @@ implementation uses sysutils, math, + UIni, UMain, UCommandLine, URecord, @@ -709,7 +712,6 @@ begin // Load in-game sounds SoundLib := TSoundLibrary.Create; - AudioPlayback.PlaySound(SoundLib.BGMusic); end; procedure InitializeVideo(); @@ -860,9 +862,6 @@ end; procedure TSoundLibrary.LoadSounds(); begin - //Log.LogStatus('Loading Sounds', 'Music Initialize'); - //Log.BenchmarkStart(4); - UnloadSounds(); Start := AudioPlayback.OpenSound(SoundPath + 'Common start.mp3'); @@ -872,11 +871,10 @@ begin Option := AudioPlayback.OpenSound(SoundPath + 'option change col.mp3'); Click := AudioPlayback.OpenSound(SoundPath + 'rimshot022b.mp3'); - //BGMusic := AudioPlayback.OpenSound(SoundPath + '18982__bebeto__Loop010_ambient.mp3'); - //BGMusic.SetLoop(true); + BGMusic := AudioPlayback.OpenSound(SoundPath + 'Bebeto_-_Loop010.mp3'); - //Log.BenchmarkEnd(4); - //Log.LogBenchmark('--> Loading Sounds', 4); + if (BGMusic <> nil) then + BGMusic.Loop := True; end; procedure TSoundLibrary.UnloadSounds(); @@ -900,6 +898,23 @@ begin end; *) +procedure TSoundLibrary.StartBgMusic(); +begin + if (TBackgroundMusicOption(Ini.BackgroundMusicOption) = bmoOn) and + (Soundlib.BGMusic <> nil) and not (Soundlib.BGMusic.Status = ssPlaying) then + begin + AudioPlayback.PlaySound(Soundlib.BGMusic); + end; +end; + +procedure TSoundLibrary.PauseBgMusic(); +begin + If (Soundlib.BGMusic <> nil) then + begin + Soundlib.BGMusic.Pause; + end; +end; + { TVoiceRemoval } procedure TVoiceRemoval.Callback(Buffer: PChar; BufSize: integer); -- cgit v1.2.3