aboutsummaryrefslogtreecommitdiffstats
path: root/Game/Code
diff options
context:
space:
mode:
Diffstat (limited to 'Game/Code')
-rw-r--r--Game/Code/Classes/UDraw.pas2
-rw-r--r--Game/Code/Classes/ULyrics.pas5
-rw-r--r--Game/Code/Classes/UMain.pas4
-rw-r--r--Game/Code/Classes/UMusic.pas802
-rw-r--r--Game/Code/Classes/UMusic_BASS.pas703
-rw-r--r--Game/Code/Classes/UTime.pas81
-rw-r--r--Game/Code/Classes/UVideo.pas3
-rw-r--r--Game/Code/Screens/UScreenCredits.pas22
-rw-r--r--Game/Code/Screens/UScreenEdit.pas12
-rw-r--r--Game/Code/Screens/UScreenEditConvert.pas10
-rw-r--r--Game/Code/Screens/UScreenEditSub.pas38
-rw-r--r--Game/Code/Screens/UScreenLevel.pas4
-rw-r--r--Game/Code/Screens/UScreenMain.pas30
-rw-r--r--Game/Code/Screens/UScreenName.pas4
-rw-r--r--Game/Code/Screens/UScreenOpen.pas6
-rw-r--r--Game/Code/Screens/UScreenOptions.pas42
-rw-r--r--Game/Code/Screens/UScreenOptionsAdvanced.pas8
-rw-r--r--Game/Code/Screens/UScreenOptionsGame.pas14
-rw-r--r--Game/Code/Screens/UScreenOptionsGraphics.pas8
-rw-r--r--Game/Code/Screens/UScreenOptionsLyrics.pas8
-rw-r--r--Game/Code/Screens/UScreenOptionsRecord.pas8
-rw-r--r--Game/Code/Screens/UScreenOptionsSound.pas8
-rw-r--r--Game/Code/Screens/UScreenOptionsThemes.pas8
-rw-r--r--Game/Code/Screens/UScreenPartyNewRound.pas4
-rw-r--r--Game/Code/Screens/UScreenPartyOptions.pas8
-rw-r--r--Game/Code/Screens/UScreenPartyPlayer.pas4
-rw-r--r--Game/Code/Screens/UScreenPartyScore.pas4
-rw-r--r--Game/Code/Screens/UScreenPartyWin.pas4
-rw-r--r--Game/Code/Screens/UScreenSing.pas22
-rw-r--r--Game/Code/Screens/UScreenSingModi.pas10
-rw-r--r--Game/Code/Screens/UScreenSong.pas82
-rw-r--r--Game/Code/Screens/UScreenSongJumpto.pas2
-rw-r--r--Game/Code/Screens/UScreenSongMenu.pas2
-rw-r--r--Game/Code/Screens/UScreenStatDetail.pas4
-rw-r--r--Game/Code/Screens/UScreenStatMain.pas9
-rw-r--r--Game/Code/USDXResCompiler.exebin401920 -> 1698394 bytes
-rw-r--r--Game/Code/UltraStar.dpr110
-rw-r--r--Game/Code/switches.inc5
38 files changed, 1035 insertions, 1065 deletions
diff --git a/Game/Code/Classes/UDraw.pas b/Game/Code/Classes/UDraw.pas
index a8404355..473e9017 100644
--- a/Game/Code/Classes/UDraw.pas
+++ b/Game/Code/Classes/UDraw.pas
@@ -470,7 +470,7 @@ var
lTmpB : real;
begin
if (Player[NrGracza].ScoreTotalI >= 0) then begin
- glColor4f(1, 1, 1, sqrt((1+sin(Music.Position * 3))/4)/ 2 + 0.5 );
+ glColor4f(1, 1, 1, sqrt((1+sin( AudioPlayback.Position * 3))/4)/ 2 + 0.5 );
glEnable(GL_TEXTURE_2D);
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
diff --git a/Game/Code/Classes/ULyrics.pas b/Game/Code/Classes/ULyrics.pas
index 4fd360b7..e4ac2024 100644
--- a/Game/Code/Classes/ULyrics.pas
+++ b/Game/Code/Classes/ULyrics.pas
@@ -8,7 +8,10 @@ interface
{$I switches.inc}
-uses OpenGL12, UTexture, UThemes, UMusic;
+uses OpenGL12,
+ UTexture,
+ UThemes,
+ UMusic;
type
TLyricWord = record
diff --git a/Game/Code/Classes/UMain.pas b/Game/Code/Classes/UMain.pas
index 41676bf3..40b91be7 100644
--- a/Game/Code/Classes/UMain.pas
+++ b/Game/Code/Classes/UMain.pas
@@ -520,7 +520,7 @@ begin
// beat click
if (Ini.BeatClick = 1) and ((Czas.AktBeatC + Czesci[0].Resolution + Czesci[0].NotesGAP) mod Czesci[0].Resolution = 0) then
- Music.PlayClick;
+ AudioPlayback.PlayClick;
// debug system on LPT
if ((Czas.AktBeatC + Czesci[0].Resolution + Czesci[0].NotesGAP) mod Czesci[0].Resolution = 0) then begin
@@ -542,7 +542,7 @@ begin
if (Czesci[0].Czesc[Czesci[0].Akt].Nuta[Pet].Start = Czas.AktBeatC) then begin
// click assist
if Ini.ClickAssist = 1 then
- Music.PlayClick;
+ AudioPlayback.PlayClick;
//LPT_2 := 0;
if ParamStr(1) <> '-doublelights' then
diff --git a/Game/Code/Classes/UMusic.pas b/Game/Code/Classes/UMusic.pas
index 3c43615b..934e14e3 100644
--- a/Game/Code/Classes/UMusic.pas
+++ b/Game/Code/Classes/UMusic.pas
@@ -8,145 +8,8 @@ interface
{$MODE Delphi}
{$ENDIF}
-
-uses Classes,
- {$IFDEF win32}
- windows,
- {$ENDIF}
- UCommon,
- Messages,
- SysUtils,
- {$IFNDEF FPC}
- Forms,
- {$ENDIF}
- {$IFDEF useBASS}
- bass,
- {$ENDIF}
- ULog,
- USongs;
-
-
-procedure InitializeSound;
-
-type
- TSoundCard = record
- Name: string;
- Source: array of string;
- end;
-
- TFFTData = array [0..256] of Single;
-
- TCustomSoundEntry = record
- Filename : String;
- Handle : hStream;
- end;
-
- IAudioPlayback = Interface
- procedure InitializePlayback;
-
- procedure SetVolume(Volume: integer);
- procedure SetMusicVolume(Volume: integer);
- procedure SetLoop(Enabled: boolean);
-
- function Open(Name: string): boolean; // true if succeed
-
- procedure Play;
- procedure Pause; //Pause Mod
- procedure Stop;
-
- procedure Rewind;
- procedure MoveTo(Time: real);
- procedure Close;
-
- function Finished: boolean;
- function Length: real;
- function Position: real;
-
- procedure PlayStart;
- procedure PlayBack;
- procedure PlaySwoosh;
- procedure PlayChange;
- procedure PlayOption;
- procedure PlayClick;
- procedure PlayDrum;
- procedure PlayHihat;
- procedure PlayClap;
- procedure PlayShuffle;
- procedure StopShuffle;
-
- function LoadSoundFromFile(var hStream: hStream; Name: string): boolean;
-
- //Custom Sounds
- function LoadCustomSound(const Filename: String): Cardinal;
- procedure PlayCustomSound(const Index: Cardinal);
- end;
-
-
- TMusic = class( TInterfacedObject, IAudioPlayback )
- private
- BassStart: hStream; // Wait, I've replaced this with BASS
- BassBack: hStream; // It has almost all features we need
- BassSwoosh: hStream;
- BassChange: hStream; // Almost? It aleady has them all :)
- BassOption: hStream;
- BassClick: hStream;
- BassDrum: hStream;
- BassHihat: hStream;
- BassClap: hStream;
- BassShuffle: hStream;
-
- //Custom Sounds
- CustomSounds: array of TCustomSoundEntry;
- Loaded: boolean;
- Loop: boolean;
-
-
- function FFMPeg_StreamCreateFile(abool : boolean; aFileName : pchar ): THandle;
-
- public
- Bass: hStream;
- procedure InitializePlayback;
- procedure InitializeRecord;
- procedure SetVolume(Volume: integer);
- procedure SetMusicVolume(Volume: integer);
- procedure SetLoop(Enabled: boolean);
- function Open(Name: string): boolean; // true if succeed
- procedure Rewind;
- procedure MoveTo(Time: real);
- procedure Play;
- procedure Pause; //Pause Mod
- procedure Stop;
- procedure Close;
- function Finished: boolean;
- function Length: real;
- function Position: real;
- procedure PlayStart;
- procedure PlayBack;
- procedure PlaySwoosh;
- procedure PlayChange;
- procedure PlayOption;
- procedure PlayClick;
- procedure PlayDrum;
- procedure PlayHihat;
- procedure PlayClap;
- procedure PlayShuffle;
- procedure StopShuffle;
- procedure CaptureStart;
- procedure CaptureStop;
- procedure CaptureCard(RecordI, PlayerLeft, PlayerRight: byte);
- procedure StopCard(Card: byte);
- function LoadSoundFromFile(var hStream: hStream; Name: string): boolean;
-
- //Equalizer
- function GetFFTData: TFFTData;
-
- //Custom Sounds
- function LoadCustomSound(const Filename: String): Cardinal;
- procedure PlayCustomSound(const Index: Cardinal);
-end;
-
-const
- RecordSystem = 1;
+uses Classes // UCommon
+ ;
type
TMuzyka = record
@@ -216,621 +79,104 @@ type
Razem: real; // caly czas utworu
end;
-var
- Music: TMusic;
-
- // muzyka
- Muzyka: TMuzyka;
-
- // czesci z nutami;
- Czesci: array of TCzesci;
-
- // czas
- Czas: TCzas;
-
- fHWND: Thandle;
-
-type
- TMPModes = (mpNotReady, mpStopped, mpPlaying, mpRecording, mpSeeking,
- mpPaused, mpOpen);
-
-const
- ModeStr: array[TMPModes] of string = ('Not ready', 'Stopped', 'Playing', 'Recording', 'Seeking', 'Paused', 'Open');
-
-implementation
-
-uses
- {$IFDEF FPC}
- lclintf,
- {$ENDIF}
-
- avcodec,
- avformat,
- avutil,
-
- UGraphic,
- URecord,
- UFiles,
- UIni,
- UMain,
- UThemes;
-
-procedure InitializeSound;
-begin
- Log.LogStatus('Initializing Playback', 'InitializeSound'); Music.InitializePlayback;
- Log.LogStatus('Initializing Record', 'InitializeSound'); Music.InitializeRecord;
-end;
-
-procedure TMusic.InitializePlayback;
-var
- Pet: integer;
- S: integer;
-begin
- Log.BenchmarkStart(4);
- Log.LogStatus('Initializing Playback Subsystem', 'Music Initialize');
-
- Loaded := false;
- Loop := false;
-
- {$ifdef win32}
- // TODO : JB_Linux ... is this needed ? :)
- fHWND := AllocateHWND( nil); // TODO : JB_lazarus - can we do something different here ?? lazarus didnt like this function
- {$ENDIF}
-
- {$IFDEF useBASS}
- // TODO : jb_linux replace with something other than bass
- if not BASS_Init(1, 44100, 0, fHWND, nil) then
- begin
- {$IFNDEF FPC}
- // TODO : JB_linux find a way to do this nice..
- Application.MessageBox ('Could not initialize BASS', 'Error');
- {$ENDIF}
- Exit;
- end;
- {$ENDIF}
-
- Log.BenchmarkEnd(4); Log.LogBenchmark('--> Bass Init', 4);
-
- // config playing buffer
-// BASS_SetConfig(BASS_CONFIG_UPDATEPERIOD, 10);
-// BASS_SetConfig(BASS_CONFIG_BUFFER, 100);
-
- Log.LogStatus('Loading Sounds', 'Music Initialize');
-
- Log.BenchmarkStart(4);
- LoadSoundFromFile(BassStart, SoundPath + 'Common Start.mp3');
- LoadSoundFromFile(BassBack, SoundPath + 'Common Back.mp3');
- LoadSoundFromFile(BassSwoosh, SoundPath + 'menu swoosh.mp3');
- LoadSoundFromFile(BassChange, SoundPath + 'select music change music 50.mp3');
- LoadSoundFromFile(BassOption, SoundPath + 'option change col.mp3');
- LoadSoundFromFile(BassClick, SoundPath + 'rimshot022b.mp3');
-
-// LoadSoundFromFile(BassDrum, SoundPath + 'bassdrumhard076b.mp3');
-// LoadSoundFromFile(BassHihat, SoundPath + 'hihatclosed068b.mp3');
-// LoadSoundFromFile(BassClap, SoundPath + 'claps050b.mp3');
-
-// LoadSoundFromFile(BassShuffle, SoundPath + 'Shuffle.mp3');
-
- Log.BenchmarkEnd(4);
- Log.LogBenchmark('--> Loading Sounds', 4);
-end;
-
-procedure TMusic.InitializeRecord;
-var
- S: integer;
- device: integer;
- descr: string;
- input: integer;
- input2: integer;
- flags: integer;
- mic: array[0..15] of integer;
- SC: integer; // soundcard
- SCI: integer; // soundcard input
-begin
- if RecordSystem = 1 then begin
- SetLength(Sound, 6 {max players});//Ini.Players+1);
- for S := 0 to High(Sound) do begin //Ini.Players do begin
- Sound[S] := TSound.Create;
- Sound[S].Num := S;
- Sound[S].BufferNew := TMemoryStream.Create;
- SetLength(Sound[S].BufferLong, 1);
- Sound[S].BufferLong[0] := TMemoryStream.Create;
- Sound[S].n := 4*1024;
- end;
-
-
- // check for recording devices;
- {device := 0;
- descr := BASS_RecordGetDeviceDescription(device);
-
- SetLength(SoundCard, 0);
- while (descr <> '') do begin
- SC := High(SoundCard) + 1;
- SetLength(SoundCard, SC+1);
-
- Log.LogAnalyze('Device #'+IntToStr(device)+': '+ descr);
- SoundCard[SC].Description := Descr;
-
- // check for recording inputs
- mic[device] := -1; // default to no change
- input := 0;
- BASS_RecordInit(device);
- Log.LogAnalyze('Input #' + IntToStr(Input) + ': ' + BASS_RecordGetInputName(input));
- flags := BASS_RecordGetInput(input);
-
- SetLength(SoundCard[SC].Input, 0);
- while (flags <> -1) do begin
- SCI := High(SoundCard[SC].Input) + 1;
- SetLength(SoundCard[SC].Input, SCI+1);
-
- Log.LogAnalyze('Input #' + IntToStr(Input) + ': ' + BASS_RecordGetInputName(input));
- SoundCard[SC].Input[SCI].Name := BASS_RecordGetInputName(Input);
-
- if (flags and BASS_INPUT_TYPE_MASK) = BASS_INPUT_TYPE_MIC then begin
- mic[device] := input; // auto set microphone
- end;
- Inc(Input);
- flags := BASS_RecordGetInput(input);
- end;
-
- if mic[device] <> -1 then begin
- Log.LogAnalyze('Found the mic at input ' + IntToStr(Mic[device]))
- end else begin
- Log.LogAnalyze('Mic not found');
- mic[device] := 0; // setting to the first one (for kxproject)
- end;
- SoundCard[SC].InputSeleceted := Mic[Device];
-
-
- BASS_RecordFree;
-
- inc(Device);
- descr := BASS_RecordGetDeviceDescription(Device);
- end; // while}
- end; // if
-end;
-
-procedure TMusic.SetVolume(Volume: integer);
-begin
- //Old Sets Wave Volume
- //BASS_SetVolume(Volume);
- //New: Sets Volume only for this Application
-
- {$IFDEF useBASS}
- // TODO : jb_linux replace with something other than bass
- BASS_SetConfig(BASS_CONFIG_GVOL_SAMPLE, Volume);
- BASS_SetConfig(BASS_CONFIG_GVOL_STREAM, Volume);
- BASS_SetConfig(BASS_CONFIG_GVOL_MUSIC, Volume);
- {$ENDIF}
-end;
-
-procedure TMusic.SetMusicVolume(Volume: Integer);
-begin
- //Max Volume Prevention
- if Volume > 100 then
- Volume := 100;
-
- //Set Volume
- {$IFDEF useBASS}
- // TODO : jb_linux replace with something other than bass
- BASS_ChannelSetAttributes (Bass, -1, Volume, -101);
- {$ENDIF}
-end;
-
-procedure TMusic.SetLoop(Enabled: boolean);
-begin
- Loop := Enabled;
-end;
-
-function TMusic.Open(Name: string): boolean;
-begin
- Loaded := false;
- if FileExists(Name) then
- begin
- {$IFDEF useBASS}
- // TODO : jb_linux replace with something other than bass
- Bass := Bass_StreamCreateFile(false, pchar(Name), 0, 0, 0);
- {$ENDIF}
-
- Loaded := true;
- //Set Max Volume
- SetMusicVolume (100);
- end;
-
- Result := Loaded;
-end;
-
-procedure TMusic.Rewind;
-begin
- if Loaded then begin
- end;
-end;
-
-procedure TMusic.MoveTo(Time: real);
-var
- bytes: integer;
-begin
- {$IFDEF useBASS}
- // TODO : jb_linux replace with something other than bass
- bytes := BASS_ChannelSeconds2Bytes(Bass, Time);
- BASS_ChannelSetPosition(Bass, bytes);
- {$ENDIF}
-end;
-
-procedure TMusic.Play;
-begin
- {$IFDEF useBASS}
- // TODO : jb_linux replace with something other than bass
- if Loaded then
- begin
- if Loop then
- BASS_ChannelPlay(Bass, True); // start from beginning... actually bass itself does not loop, nor does this TMusic Class
-
- BASS_ChannelPlay(Bass, False); // for setting position before playing
+ TSoundCard = record
+ Name: string;
+ Source: array of string;
end;
- {$ENDIF}
-end;
-procedure TMusic.Pause; //Pause Mod
-begin
- {$IFDEF useBASS}
- // TODO : jb_linux replace with something other than bass
- if Loaded then begin
- BASS_ChannelPause(Bass); // Pauses Song
- end;
- {$ENDIF}
-end;
-
-procedure TMusic.Stop;
-begin
- {$IFDEF useBASS}
- // TODO : jb_linux replace with something other than bass
- Bass_ChannelStop(Bass);
- {$ENDIF}
-end;
-
-procedure TMusic.Close;
-begin
- {$IFDEF useBASS}
- // TODO : jb_linux replace with something other than bass
- Bass_StreamFree(Bass);
- {$ENDIF}
-end;
-
-function TMusic.Length: real;
-var
- bytes: integer;
-begin
- Result := 60;
-
- {$IFDEF useBASS}
- // TODO : jb_linux replace with something other than bass
- bytes := BASS_ChannelGetLength(Bass);
- Result := BASS_ChannelBytes2Seconds(Bass, bytes);
- {$ENDIF}
-end;
-
-function TMusic.Position: real;
-var
- bytes: integer;
-begin
- Result := 0;
-
- {$IFDEF useBASS}
- // TODO : jb_linux replace with something other than bass
- bytes := BASS_ChannelGetPosition(BASS);
- Result := BASS_ChannelBytes2Seconds(BASS, bytes);
- {$ENDIF}
-end;
+ TFFTData = array [0..256] of Single;
-function TMusic.Finished: boolean;
-begin
- Result := false;
+ hStream = Cardinal;
- {$IFDEF useBASS}
- // TODO : jb_linux replace with something other than bass
- if BASS_ChannelIsActive(BASS) = BASS_ACTIVE_STOPPED then
- begin
- Result := true;
+ TCustomSoundEntry = record
+ Filename : String;
+ Handle : hStream;
end;
- {$ENDIF}
-end;
-
-procedure TMusic.PlayStart;
-begin
- {$IFDEF useBASS}
- // TODO : jb_linux replace with something other than bass
- BASS_ChannelPlay(BassStart, True);
- {$ENDIF}
-end;
-
-procedure TMusic.PlayBack;
-begin
- {$IFDEF useBASS}
- // TODO : jb_linux replace with something other than bass
- BASS_ChannelPlay(BassBack, True);// then
- {$ENDIF}
-end;
-
-procedure TMusic.PlaySwoosh;
-begin
- {$IFDEF useBASS}
- // TODO : jb_linux replace with something other than bass
- BASS_ChannelPlay(BassSwoosh, True);
- {$ENDIF}
-end;
-
-procedure TMusic.PlayChange;
-begin
- {$IFDEF useBASS}
- // TODO : jb_linux replace with something other than bass
- BASS_ChannelPlay(BassChange, True);
- {$ENDIF}
-end;
-
-procedure TMusic.PlayOption;
-begin
- {$IFDEF useBASS}
- // TODO : jb_linux replace with something other than bass
- BASS_ChannelPlay(BassOption, True);
- {$ENDIF}
-end;
-
-procedure TMusic.PlayClick;
-begin
- {$IFDEF useBASS}
- // TODO : jb_linux replace with something other than bass
- BASS_ChannelPlay(BassClick, True);
- {$ENDIF}
-end;
-procedure TMusic.PlayDrum;
-begin
- {$IFDEF useBASS}
- // TODO : jb_linux replace with something other than bass
- BASS_ChannelPlay(BassDrum, True);
- {$ENDIF}
-end;
-
-procedure TMusic.PlayHihat;
-begin
- {$IFDEF useBASS}
- // TODO : jb_linux replace with something other than bass
- BASS_ChannelPlay(BassHihat, True);
- {$ENDIF}
-end;
-
-procedure TMusic.PlayClap;
-begin
- {$IFDEF useBASS}
- // TODO : jb_linux replace with something other than bass
- BASS_ChannelPlay(BassClap, True);
- {$ENDIF}
-end;
-
-procedure TMusic.PlayShuffle;
-begin
- {$IFDEF useBASS}
- // TODO : jb_linux replace with something other than bass
- BASS_ChannelPlay(BassShuffle, True);
- {$ENDIF}
-end;
+type
+ IAudioPlayback = Interface
+ procedure InitializePlayback;
+ procedure InitializeRecord;
+ procedure SetVolume(Volume: integer);
+ procedure SetMusicVolume(Volume: integer);
+ procedure SetLoop(Enabled: boolean);
+ function Open(Name: string): boolean; // true if succeed
+ procedure Rewind;
+ procedure MoveTo(Time: real);
+ procedure Play;
+ procedure Pause; //Pause Mod
+ procedure Stop;
+ procedure Close;
+ function Finished: boolean;
+ function Length: real;
+ function Position: real;
+ procedure PlayStart;
+ procedure PlayBack;
+ procedure PlaySwoosh;
+ procedure PlayChange;
+ procedure PlayOption;
+ procedure PlayClick;
+ procedure PlayDrum;
+ procedure PlayHihat;
+ procedure PlayClap;
+ procedure PlayShuffle;
+ procedure StopShuffle;
+ procedure CaptureStart;
+ procedure CaptureStop;
+ procedure CaptureCard(RecordI, PlayerLeft, PlayerRight: byte);
+ procedure StopCard(Card: byte);
+ function LoadSoundFromFile(var hStream: hStream; Name: string): boolean;
-procedure TMusic.StopShuffle;
-begin
- {$IFDEF useBASS}
- // TODO : jb_linux replace with something other than bass
- BASS_ChannelStop(BassShuffle);
- {$ENDIF}
-end;
+ //Equalizer
+ function GetFFTData: TFFTData;
-procedure TMusic.CaptureStart;
-var
- S: integer;
- SC: integer;
- P1: integer;
- P2: integer;
-begin
- for S := 0 to High(Sound) do
- Sound[S].BufferLong[0].Clear;
-
- for SC := 0 to High(Ini.CardList) do begin
- P1 := Ini.CardList[SC].ChannelL;
- P2 := Ini.CardList[SC].ChannelR;
- if P1 > PlayersPlay then P1 := 0;
- if P2 > PlayersPlay then P2 := 0;
- if (P1 > 0) or (P2 > 0) then
- CaptureCard(SC, P1, P2);
+ //Custom Sounds
+ function LoadCustomSound(const Filename: String): Cardinal;
+ procedure PlayCustomSound(const Index: Cardinal );
end;
-end;
-procedure TMusic.CaptureStop;
-var
- SC: integer;
- P1: integer;
- P2: integer;
-begin
- for SC := 0 to High(Ini.CardList) do begin
- P1 := Ini.CardList[SC].ChannelL;
- P2 := Ini.CardList[SC].ChannelR;
- if P1 > PlayersPlay then P1 := 0;
- if P2 > PlayersPlay then P2 := 0;
- if (P1 > 0) or (P2 > 0) then StopCard(SC);
- end;
+var // TODO : JB --- THESE SHOULD NOT BE GLOBAL
+ // muzyka
+ Muzyka: TMuzyka;
-end;
+ // czesci z nutami;
+ Czesci: array of TCzesci;
-//procedure TMusic.CaptureCard(RecordI, SoundNum, PlayerLeft, PlayerRight: byte);
-procedure TMusic.CaptureCard(RecordI, PlayerLeft, PlayerRight: byte);
-var
- Error: integer;
- ErrorMsg: string;
-begin
- {$IFDEF useBASS}
- // TODO : jb_linux replace with something other than bass
-
- if not BASS_RecordInit(RecordI) then
- begin
- Error := BASS_ErrorGetCode;
-
- ErrorMsg := IntToStr(Error);
- if Error = BASS_ERROR_DX then ErrorMsg := 'No DX5';
- if Error = BASS_ERROR_ALREADY then ErrorMsg := 'The device has already been initialized';
- if Error = BASS_ERROR_DEVICE then ErrorMsg := 'The device number specified is invalid';
- if Error = BASS_ERROR_DRIVER then ErrorMsg := 'There is no available device driver';
-
- {Log.LogAnalyze('Error initializing record [' + IntToStr(RecordI) + ', '
- + IntToStr(PlayerLeft) + ', '+ IntToStr(PlayerRight) + ']: '
- + ErrorMsg);}
- Log.LogError('Error initializing record [' + IntToStr(RecordI) + ', '
- + IntToStr(PlayerLeft) + ', '+ IntToStr(PlayerRight) + ']: '
- + ErrorMsg);
- Log.LogError('Music -> CaptureCard: Error initializing record: ' + ErrorMsg);
-
-
- end
- else
- begin
- Recording.SoundCard[RecordI].BassRecordStream := BASS_RecordStart(44100, 2, MakeLong(0, 20) , @GetMicrophone, PlayerLeft + PlayerRight*256);
- end;
+ // czas
+ Czas: TCzas;
- {$ENDIF}
-end;
-
-procedure TMusic.StopCard(Card: byte);
-begin
- {$IFDEF useBASS}
- // TODO : jb_linux replace with something other than bass
- BASS_RecordSetDevice(Card);
- BASS_RecordFree;
- {$ENDIF}
-end;
-function TMusic.LoadSoundFromFile(var hStream: hStream; Name: string): boolean;
-var
- L: Integer;
-begin
- if FileExists(Name) then
- begin
- Log.LogStatus('Loading Sound: "' + Name + '"', 'LoadSoundFromFile');
- try
- {$IFDEF useBASS}
- // TODO : jb_linux replace with something other than bass
- hStream := BASS_StreamCreateFile(False, pchar(Name), 0, 0, 0);
- {$ELSE}
- hStream := FFMPeg_StreamCreateFile(False, pchar(Name) );
- {$ENDIF}
-
-
-
- //Add CustomSound
- L := High(CustomSounds) + 1;
- SetLength (CustomSounds, L + 1);
- CustomSounds[L].Filename := Name;
- CustomSounds[L].Handle := hStream;
- except
- Log.LogError('Failed to open using BASS', 'LoadSoundFromFile');
- end;
- end
- else
- begin
- Log.LogError('Sound not found: "' + Name + '"', 'LoadSoundFromFile');
- exit;
- end;
-end;
+procedure InitializeSound;
+function AudioPlayback(): IAudioPlayback;
-//Equalizer
-function TMusic.GetFFTData: TFFTData;
-var
-Data: TFFTData;
-begin
- {$IFDEF useBASS}
- // TODO : jb_linux replace with something other than bass
+implementation
- //Get Channel Data Mono and 256 Values
- BASS_ChannelGetData(Bass, @Result, BASS_DATA_FFT512);
- //Result := Data;
-
- {$ENDIF}
-end;
+uses
+ uLog,
+ UMusic_BASS;
-function TMusic.LoadCustomSound(const Filename: String): Cardinal;
var
- S: hStream;
- I: Integer;
- F: String;
-begin
- //Search for Sound in already loaded Sounds
- F := UpperCase(SoundPath + FileName);
- For I := 0 to High(CustomSounds) do
- begin
- if (UpperCase(CustomSounds[I].Filename) = F) then
- begin
- Result := I;
- Exit;
- end;
- end;
-
- if LoadSoundFromFile(S, SoundPath + Filename) then
- Result := High(CustomSounds)
- else
- Result := 0;
-end;
+ singleton_AudioPlayback : IAudioPlayback;
-procedure TMusic.PlayCustomSound(const Index: Cardinal);
+function AudioPlayback(): IAudioPlayback;
begin
- {$IFDEF useBASS}
- // TODO : jb_linux replace with something other than bass
+ if singleton_AudioPlayback = nil then
+ begin
+ writeln( 'Created AudioPlayback' );
+ singleton_AudioPlayback := TMusic_bass.create();
+ end;
- if Index <= High(CustomSounds) then
- BASS_ChannelPlay(CustomSounds[Index].Handle, True);
-
- {$ENDIF}
+ result := singleton_AudioPlayback;
end;
-
-{*
-
-Sorry guys... this is my mess :(
-Im going to try and get ffmpeg to handle audio playback ( at least for linux )
-and Im going to implement it nicly along side BASS, in TMusic ( where I can )
-
-http://www.dranger.com/ffmpeg/ffmpeg.html
-http://www.dranger.com/ffmpeg/ffmpegtutorial_all.html
-
-http://www.inb.uni-luebeck.de/~boehme/using_libavcodec.html
-
-*}
-function TMusic.FFMPeg_StreamCreateFile(abool : boolean; aFileName : pchar ): THandle;
-var
- lFormatCtx : PAVFormatContext;
+procedure InitializeSound;
begin
+ Log.LogStatus('Initializing Playback', 'InitializeSound');
+ AudioPlayback.InitializePlayback;
-(*
- if(SDL_OpenAudio(&wanted_spec, &spec) < 0)
- begin
- fprintf(stderr, "SDL_OpenAudio: %s\n", SDL_GetError());
- writeln( 'SDL_OpenAudio' );
- exit;
- end;
-*)
-
-(*
- if ( av_open_input_file( lFormatCtx, aFileName, NULL, 0, NULL ) <> 0 )
- begin
- writeln( 'Unable to open file '+ aFileName );
- exit;
- end;
-
- // Retrieve stream information
- if ( av_find_stream_info(pFormatCtx) < 0 )
- begin
- writeln( 'Unable to Retrieve stream information' );
- exit;
- end;
-*)
-
+ Log.LogStatus('Initializing Record', 'InitializeSound');
+ AudioPlayback.InitializeRecord;
end;
end.
diff --git a/Game/Code/Classes/UMusic_BASS.pas b/Game/Code/Classes/UMusic_BASS.pas
new file mode 100644
index 00000000..dfb6f79c
--- /dev/null
+++ b/Game/Code/Classes/UMusic_BASS.pas
@@ -0,0 +1,703 @@
+unit UMusic_BASS;
+
+interface
+
+{$I switches.inc}
+
+{$IFDEF FPC}
+ {$MODE Delphi}
+{$ENDIF}
+
+
+uses Classes,
+
+ {$IFDEF win32}
+ windows,
+ {$ENDIF}
+
+// UCommon,
+ Messages,
+ SysUtils,
+ {$IFNDEF FPC}
+ Forms,
+ {$ENDIF}
+
+ bass,
+ ULog,
+ UMusic;
+// USongs;
+// Classes;
+
+
+
+type
+
+ TMusic_bass = class( TInterfacedObject, IAudioPlayback )
+ private
+ BassStart: hStream; // Wait, I've replaced this with BASS
+ BassBack: hStream; // It has almost all features we need
+ BassSwoosh: hStream;
+ BassChange: hStream; // Almost? It aleady has them all :)
+ BassOption: hStream;
+ BassClick: hStream;
+ BassDrum: hStream;
+ BassHihat: hStream;
+ BassClap: hStream;
+ BassShuffle: hStream;
+
+ //Custom Sounds
+ CustomSounds: array of TCustomSoundEntry;
+ Loaded: boolean;
+ Loop: boolean;
+ fHWND: THandle;
+
+ public
+ Bass: hStream;
+ procedure InitializePlayback;
+ procedure InitializeRecord;
+ procedure SetVolume(Volume: integer);
+ procedure SetMusicVolume(Volume: integer);
+ procedure SetLoop(Enabled: boolean);
+ function Open(Name: string): boolean; // true if succeed
+ procedure Rewind;
+ procedure MoveTo(Time: real);
+ procedure Play;
+ procedure Pause; //Pause Mod
+ procedure Stop;
+ procedure Close;
+ function Finished: boolean;
+ function Length: real;
+ function Position: real;
+ procedure PlayStart;
+ procedure PlayBack;
+ procedure PlaySwoosh;
+ procedure PlayChange;
+ procedure PlayOption;
+ procedure PlayClick;
+ procedure PlayDrum;
+ procedure PlayHihat;
+ procedure PlayClap;
+ procedure PlayShuffle;
+ procedure StopShuffle;
+ procedure CaptureStart;
+ procedure CaptureStop;
+ procedure CaptureCard(RecordI, PlayerLeft, PlayerRight: byte);
+ procedure StopCard(Card: byte);
+ function LoadSoundFromFile(var hStream: hStream; Name: string): boolean;
+
+ //Equalizer
+ function GetFFTData: TFFTData;
+
+ //Custom Sounds
+ function LoadCustomSound(const Filename: String): Cardinal;
+ procedure PlayCustomSound(const Index: Cardinal );
+end;
+
+const
+ RecordSystem = 1;
+
+type
+ TMPModes = (mpNotReady, mpStopped, mpPlaying, mpRecording, mpSeeking,
+ mpPaused, mpOpen);
+
+const
+ ModeStr: array[TMPModes] of string = ('Not ready', 'Stopped', 'Playing', 'Recording', 'Seeking', 'Paused', 'Open');
+
+implementation
+
+uses
+ {$IFDEF FPC}
+ lclintf,
+ {$ENDIF}
+
+// avcodec,
+// avformat,
+// avutil,
+
+// UGraphic,
+ URecord,
+// UFiles,
+ UIni,
+ UMain,
+ UThemes;
+
+
+
+procedure TMusic_bass.InitializePlayback;
+var
+ Pet: integer;
+ S: integer;
+begin
+ Log.BenchmarkStart(4);
+ Log.LogStatus('Initializing Playback Subsystem', 'Music Initialize');
+
+ Loaded := false;
+ Loop := false;
+
+ {$ifdef win32}
+ // TODO : JB_Linux ... is this needed ? :)
+ fHWND := AllocateHWND( nil); // TODO : JB_lazarus - can we do something different here ?? lazarus didnt like this function
+ {$ENDIF}
+
+ {$IFDEF useBASS}
+ // TODO : jb_linux replace with something other than bass
+ if not BASS_Init(1, 44100, 0, fHWND, nil) then
+ begin
+ {$IFNDEF FPC}
+ // TODO : JB_linux find a way to do this nice..
+ Application.MessageBox ('Could not initialize BASS', 'Error');
+ {$ENDIF}
+ Exit;
+ end;
+ {$ENDIF}
+
+ Log.BenchmarkEnd(4); Log.LogBenchmark('--> Bass Init', 4);
+
+ // config playing buffer
+// BASS_SetConfig(BASS_CONFIG_UPDATEPERIOD, 10);
+// BASS_SetConfig(BASS_CONFIG_BUFFER, 100);
+
+ Log.LogStatus('Loading Sounds', 'Music Initialize');
+
+ Log.BenchmarkStart(4);
+ LoadSoundFromFile(BassStart, SoundPath + 'Common Start.mp3');
+ LoadSoundFromFile(BassBack, SoundPath + 'Common Back.mp3');
+ LoadSoundFromFile(BassSwoosh, SoundPath + 'menu swoosh.mp3');
+ LoadSoundFromFile(BassChange, SoundPath + 'select music change music 50.mp3');
+ LoadSoundFromFile(BassOption, SoundPath + 'option change col.mp3');
+ LoadSoundFromFile(BassClick, SoundPath + 'rimshot022b.mp3');
+
+// LoadSoundFromFile(BassDrum, SoundPath + 'bassdrumhard076b.mp3');
+// LoadSoundFromFile(BassHihat, SoundPath + 'hihatclosed068b.mp3');
+// LoadSoundFromFile(BassClap, SoundPath + 'claps050b.mp3');
+
+// LoadSoundFromFile(BassShuffle, SoundPath + 'Shuffle.mp3');
+
+ Log.BenchmarkEnd(4);
+ Log.LogBenchmark('--> Loading Sounds', 4);
+end;
+
+procedure TMusic_bass.InitializeRecord;
+var
+ S: integer;
+ device: integer;
+ descr: string;
+ input: integer;
+ input2: integer;
+ flags: integer;
+ mic: array[0..15] of integer;
+ SC: integer; // soundcard
+ SCI: integer; // soundcard input
+begin
+ if RecordSystem = 1 then begin
+ SetLength(Sound, 6 {max players});//Ini.Players+1);
+ for S := 0 to High(Sound) do begin //Ini.Players do begin
+ Sound[S] := TSound.Create;
+ Sound[S].Num := S;
+ Sound[S].BufferNew := TMemoryStream.Create;
+ SetLength(Sound[S].BufferLong, 1);
+ Sound[S].BufferLong[0] := TMemoryStream.Create;
+ Sound[S].n := 4*1024;
+ end;
+
+
+ // check for recording devices;
+ {device := 0;
+ descr := BASS_RecordGetDeviceDescription(device);
+
+ SetLength(SoundCard, 0);
+ while (descr <> '') do begin
+ SC := High(SoundCard) + 1;
+ SetLength(SoundCard, SC+1);
+
+ Log.LogAnalyze('Device #'+IntToStr(device)+': '+ descr);
+ SoundCard[SC].Description := Descr;
+
+ // check for recording inputs
+ mic[device] := -1; // default to no change
+ input := 0;
+ BASS_RecordInit(device);
+ Log.LogAnalyze('Input #' + IntToStr(Input) + ': ' + BASS_RecordGetInputName(input));
+ flags := BASS_RecordGetInput(input);
+
+ SetLength(SoundCard[SC].Input, 0);
+ while (flags <> -1) do begin
+ SCI := High(SoundCard[SC].Input) + 1;
+ SetLength(SoundCard[SC].Input, SCI+1);
+
+ Log.LogAnalyze('Input #' + IntToStr(Input) + ': ' + BASS_RecordGetInputName(input));
+ SoundCard[SC].Input[SCI].Name := BASS_RecordGetInputName(Input);
+
+ if (flags and BASS_INPUT_TYPE_MASK) = BASS_INPUT_TYPE_MIC then begin
+ mic[device] := input; // auto set microphone
+ end;
+ Inc(Input);
+ flags := BASS_RecordGetInput(input);
+ end;
+
+ if mic[device] <> -1 then begin
+ Log.LogAnalyze('Found the mic at input ' + IntToStr(Mic[device]))
+ end else begin
+ Log.LogAnalyze('Mic not found');
+ mic[device] := 0; // setting to the first one (for kxproject)
+ end;
+ SoundCard[SC].InputSeleceted := Mic[Device];
+
+
+ BASS_RecordFree;
+
+ inc(Device);
+ descr := BASS_RecordGetDeviceDescription(Device);
+ end; // while}
+ end; // if
+end;
+
+procedure TMusic_bass.SetVolume(Volume: integer);
+begin
+ //Old Sets Wave Volume
+ //BASS_SetVolume(Volume);
+ //New: Sets Volume only for this Application
+
+ {$IFDEF useBASS}
+ // TODO : jb_linux replace with something other than bass
+ BASS_SetConfig(BASS_CONFIG_GVOL_SAMPLE, Volume);
+ BASS_SetConfig(BASS_CONFIG_GVOL_STREAM, Volume);
+ BASS_SetConfig(BASS_CONFIG_GVOL_MUSIC, Volume);
+ {$ENDIF}
+end;
+
+procedure TMusic_bass.SetMusicVolume(Volume: Integer);
+begin
+ //Max Volume Prevention
+ if Volume > 100 then
+ Volume := 100;
+
+ if Volume < 0 then
+ Volume := 0;
+
+
+ //Set Volume
+ {$IFDEF useBASS}
+ // TODO : jb_linux replace with something other than bass
+ BASS_ChannelSetAttributes (Bass, -1, Volume, -101);
+ {$ENDIF}
+end;
+
+procedure TMusic_bass.SetLoop(Enabled: boolean);
+begin
+ Loop := Enabled;
+end;
+
+function TMusic_bass.Open(Name: string): boolean;
+begin
+ Loaded := false;
+ if FileExists(Name) then
+ begin
+ {$IFDEF useBASS}
+ // TODO : jb_linux replace with something other than bass
+ Bass := Bass_StreamCreateFile(false, pchar(Name), 0, 0, 0);
+ {$ENDIF}
+
+ Loaded := true;
+ //Set Max Volume
+ SetMusicVolume (100);
+ end;
+
+ Result := Loaded;
+end;
+
+procedure TMusic_bass.Rewind;
+begin
+ if Loaded then begin
+ end;
+end;
+
+procedure TMusic_bass.MoveTo(Time: real);
+var
+ bytes: integer;
+begin
+ {$IFDEF useBASS}
+ // TODO : jb_linux replace with something other than bass
+ bytes := BASS_ChannelSeconds2Bytes(Bass, Time);
+ BASS_ChannelSetPosition(Bass, bytes);
+ {$ENDIF}
+end;
+
+procedure TMusic_bass.Play;
+begin
+ {$IFDEF useBASS}
+ // TODO : jb_linux replace with something other than bass
+ if Loaded then
+ begin
+ if Loop then
+ BASS_ChannelPlay(Bass, True); // start from beginning... actually bass itself does not loop, nor does this TMusic_bass Class
+
+ BASS_ChannelPlay(Bass, False); // for setting position before playing
+ end;
+ {$ENDIF}
+end;
+
+procedure TMusic_bass.Pause; //Pause Mod
+begin
+ {$IFDEF useBASS}
+ // TODO : jb_linux replace with something other than bass
+ if Loaded then begin
+ BASS_ChannelPause(Bass); // Pauses Song
+ end;
+ {$ENDIF}
+end;
+
+procedure TMusic_bass.Stop;
+begin
+ {$IFDEF useBASS}
+ // TODO : jb_linux replace with something other than bass
+ Bass_ChannelStop(Bass);
+ {$ENDIF}
+end;
+
+procedure TMusic_bass.Close;
+begin
+ {$IFDEF useBASS}
+ // TODO : jb_linux replace with something other than bass
+ Bass_StreamFree(Bass);
+ {$ENDIF}
+end;
+
+function TMusic_bass.Length: real;
+var
+ bytes: integer;
+begin
+ Result := 60;
+
+ {$IFDEF useBASS}
+ // TODO : jb_linux replace with something other than bass
+ bytes := BASS_ChannelGetLength(Bass);
+ Result := BASS_ChannelBytes2Seconds(Bass, bytes);
+ {$ENDIF}
+end;
+
+function TMusic_bass.Position: real;
+var
+ bytes: integer;
+begin
+ Result := 0;
+
+ {$IFDEF useBASS}
+ // TODO : jb_linux replace with something other than bass
+ bytes := BASS_ChannelGetPosition(BASS);
+ Result := BASS_ChannelBytes2Seconds(BASS, bytes);
+ {$ENDIF}
+end;
+
+function TMusic_bass.Finished: boolean;
+begin
+ Result := false;
+
+ {$IFDEF useBASS}
+ // TODO : jb_linux replace with something other than bass
+ if BASS_ChannelIsActive(BASS) = BASS_ACTIVE_STOPPED then
+ begin
+ Result := true;
+ end;
+ {$ENDIF}
+end;
+
+procedure TMusic_bass.PlayStart;
+begin
+ {$IFDEF useBASS}
+ // TODO : jb_linux replace with something other than bass
+ BASS_ChannelPlay(BassStart, True);
+ {$ENDIF}
+end;
+
+procedure TMusic_bass.PlayBack;
+begin
+ {$IFDEF useBASS}
+ // TODO : jb_linux replace with something other than bass
+ BASS_ChannelPlay(BassBack, True);// then
+ {$ENDIF}
+end;
+
+procedure TMusic_bass.PlaySwoosh;
+begin
+ {$IFDEF useBASS}
+ // TODO : jb_linux replace with something other than bass
+ BASS_ChannelPlay(BassSwoosh, True);
+ {$ENDIF}
+end;
+
+procedure TMusic_bass.PlayChange;
+begin
+ {$IFDEF useBASS}
+ // TODO : jb_linux replace with something other than bass
+ BASS_ChannelPlay(BassChange, True);
+ {$ENDIF}
+end;
+
+procedure TMusic_bass.PlayOption;
+begin
+ {$IFDEF useBASS}
+ // TODO : jb_linux replace with something other than bass
+ BASS_ChannelPlay(BassOption, True);
+ {$ENDIF}
+end;
+
+procedure TMusic_bass.PlayClick;
+begin
+ {$IFDEF useBASS}
+ // TODO : jb_linux replace with something other than bass
+ BASS_ChannelPlay(BassClick, True);
+ {$ENDIF}
+end;
+
+procedure TMusic_bass.PlayDrum;
+begin
+ {$IFDEF useBASS}
+ // TODO : jb_linux replace with something other than bass
+ BASS_ChannelPlay(BassDrum, True);
+ {$ENDIF}
+end;
+
+procedure TMusic_bass.PlayHihat;
+begin
+ {$IFDEF useBASS}
+ // TODO : jb_linux replace with something other than bass
+ BASS_ChannelPlay(BassHihat, True);
+ {$ENDIF}
+end;
+
+procedure TMusic_bass.PlayClap;
+begin
+ {$IFDEF useBASS}
+ // TODO : jb_linux replace with something other than bass
+ BASS_ChannelPlay(BassClap, True);
+ {$ENDIF}
+end;
+
+procedure TMusic_bass.PlayShuffle;
+begin
+ {$IFDEF useBASS}
+ // TODO : jb_linux replace with something other than bass
+ BASS_ChannelPlay(BassShuffle, True);
+ {$ENDIF}
+end;
+
+procedure TMusic_bass.StopShuffle;
+begin
+ {$IFDEF useBASS}
+ // TODO : jb_linux replace with something other than bass
+ BASS_ChannelStop(BassShuffle);
+ {$ENDIF}
+end;
+
+procedure TMusic_bass.CaptureStart;
+var
+ S: integer;
+ SC: integer;
+ P1: integer;
+ P2: integer;
+begin
+ for S := 0 to High(Sound) do
+ Sound[S].BufferLong[0].Clear;
+
+ for SC := 0 to High(Ini.CardList) do begin
+ P1 := Ini.CardList[SC].ChannelL;
+ P2 := Ini.CardList[SC].ChannelR;
+ if P1 > PlayersPlay then P1 := 0;
+ if P2 > PlayersPlay then P2 := 0;
+ if (P1 > 0) or (P2 > 0) then
+ CaptureCard(SC, P1, P2);
+ end;
+end;
+
+procedure TMusic_bass.CaptureStop;
+var
+ SC: integer;
+ P1: integer;
+ P2: integer;
+begin
+
+ for SC := 0 to High(Ini.CardList) do begin
+ P1 := Ini.CardList[SC].ChannelL;
+ P2 := Ini.CardList[SC].ChannelR;
+ if P1 > PlayersPlay then P1 := 0;
+ if P2 > PlayersPlay then P2 := 0;
+ if (P1 > 0) or (P2 > 0) then StopCard(SC);
+ end;
+
+end;
+
+//procedure TMusic_bass.CaptureCard(RecordI, SoundNum, PlayerLeft, PlayerRight: byte);
+procedure TMusic_bass.CaptureCard(RecordI, PlayerLeft, PlayerRight: byte);
+var
+ Error: integer;
+ ErrorMsg: string;
+begin
+ {$IFDEF useBASS}
+ // TODO : jb_linux replace with something other than bass
+
+ if not BASS_RecordInit(RecordI) then
+ begin
+ Error := BASS_ErrorGetCode;
+
+ ErrorMsg := IntToStr(Error);
+ if Error = BASS_ERROR_DX then ErrorMsg := 'No DX5';
+ if Error = BASS_ERROR_ALREADY then ErrorMsg := 'The device has already been initialized';
+ if Error = BASS_ERROR_DEVICE then ErrorMsg := 'The device number specified is invalid';
+ if Error = BASS_ERROR_DRIVER then ErrorMsg := 'There is no available device driver';
+
+ {Log.LogAnalyze('Error initializing record [' + IntToStr(RecordI) + ', '
+ + IntToStr(PlayerLeft) + ', '+ IntToStr(PlayerRight) + ']: '
+ + ErrorMsg);}
+ Log.LogError('Error initializing record [' + IntToStr(RecordI) + ', '
+ + IntToStr(PlayerLeft) + ', '+ IntToStr(PlayerRight) + ']: '
+ + ErrorMsg);
+ Log.LogError('Music -> CaptureCard: Error initializing record: ' + ErrorMsg);
+
+
+ end
+ else
+ begin
+ Recording.SoundCard[RecordI].BassRecordStream := BASS_RecordStart(44100, 2, MakeLong(0, 20) , @GetMicrophone, PlayerLeft + PlayerRight*256);
+ end;
+
+ {$ENDIF}
+end;
+
+procedure TMusic_bass.StopCard(Card: byte);
+begin
+ {$IFDEF useBASS}
+ // TODO : jb_linux replace with something other than bass
+ BASS_RecordSetDevice(Card);
+ BASS_RecordFree;
+ {$ENDIF}
+end;
+
+function TMusic_bass.LoadSoundFromFile(var hStream: hStream; Name: string): boolean;
+var
+ L: Integer;
+begin
+ if FileExists(Name) then
+ begin
+ Log.LogStatus('Loading Sound: "' + Name + '"', 'LoadSoundFromFile');
+ try
+ {$IFDEF useBASS}
+ // TODO : jb_linux replace with something other than bass
+ hStream := BASS_StreamCreateFile(False, pchar(Name), 0, 0, 0);
+ {$ELSE}
+ hStream := FFMPeg_StreamCreateFile(False, pchar(Name) );
+ {$ENDIF}
+
+
+
+ //Add CustomSound
+ L := High(CustomSounds) + 1;
+ SetLength (CustomSounds, L + 1);
+ CustomSounds[L].Filename := Name;
+ CustomSounds[L].Handle := hStream;
+ except
+ Log.LogError('Failed to open using BASS', 'LoadSoundFromFile');
+ end;
+ end
+ else
+ begin
+ Log.LogError('Sound not found: "' + Name + '"', 'LoadSoundFromFile');
+ exit;
+ end;
+end;
+
+//Equalizer
+function TMusic_bass.GetFFTData: TFFTData;
+var
+Data: TFFTData;
+begin
+ {$IFDEF useBASS}
+ // TODO : jb_linux replace with something other than bass
+
+ //Get Channel Data Mono and 256 Values
+ BASS_ChannelGetData(Bass, @Result, BASS_DATA_FFT512);
+ //Result := Data;
+
+ {$ENDIF}
+end;
+
+function TMusic_bass.LoadCustomSound(const Filename: String): Cardinal;
+var
+ S: hStream;
+ I: Integer;
+ F: String;
+begin
+ //Search for Sound in already loaded Sounds
+ F := UpperCase(SoundPath + FileName);
+ For I := 0 to High(CustomSounds) do
+ begin
+ if (UpperCase(CustomSounds[I].Filename) = F) then
+ begin
+ Result := I;
+ Exit;
+ end;
+ end;
+
+ if LoadSoundFromFile(S, SoundPath + Filename) then
+ Result := High(CustomSounds)
+ else
+ Result := 0;
+end;
+
+procedure TMusic_bass.PlayCustomSound(const Index: Cardinal );
+begin
+ {$IFDEF useBASS}
+ // TODO : jb_linux replace with something other than bass
+
+ if Index <= High(CustomSounds) then
+ BASS_ChannelPlay(CustomSounds[Index].Handle, True);
+
+ {$ENDIF}
+end;
+
+
+{*
+
+Sorry guys... this is my mess :(
+Im going to try and get ffmpeg to handle audio playback ( at least for linux )
+and Im going to implement it nicly along side BASS, in TMusic_bass ( where I can )
+
+http://www.dranger.com/ffmpeg/ffmpeg.html
+http://www.dranger.com/ffmpeg/ffmpegtutorial_all.html
+
+http://www.inb.uni-luebeck.de/~boehme/using_libavcodec.html
+
+*}
+{*
+function TMusic_bass.FFMPeg_StreamCreateFile(abool : boolean; aFileName : pchar ): THandle;
+var
+ lFormatCtx : PAVFormatContext;
+begin
+
+(*
+ if(SDL_OpenAudio(&wanted_spec, &spec) < 0)
+ begin
+ fprintf(stderr, "SDL_OpenAudio: %s\n", SDL_GetError());
+ writeln( 'SDL_OpenAudio' );
+ exit;
+ end;
+*)
+
+(*
+ if ( av_open_input_file( lFormatCtx, aFileName, NULL, 0, NULL ) <> 0 )
+ begin
+ writeln( 'Unable to open file '+ aFileName );
+ exit;
+ end;
+
+ // Retrieve stream information
+ if ( av_find_stream_info(pFormatCtx) < 0 )
+ begin
+ writeln( 'Unable to Retrieve stream information' );
+ exit;
+ end;
+*)
+
+end; *}
+
+end.
diff --git a/Game/Code/Classes/UTime.pas b/Game/Code/Classes/UTime.pas
index edd65b7e..87d17ee5 100644
--- a/Game/Code/Classes/UTime.pas
+++ b/Game/Code/Classes/UTime.pas
@@ -6,7 +6,6 @@ interface
{$MODE Delphi}
{$ENDIF}
-{$DEFINE SDLTimer}
{$UNDEF DebugDisplay}
type
@@ -22,7 +21,6 @@ procedure CountMidTime;
var
USTime: TTime;
- TimeFreq: int64;
TimeNew: int64;
TimeOld: int64;
TimeSkip: real;
@@ -32,16 +30,8 @@ var
implementation
uses
- {$IFDEF win32}
- windows,
- {$ELSE}
- libc,
- time,
- {$ENDIF}
- sysutils,
- {$IFDEF SDLTimer}
+// sysutils,
sdl,
- {$ENDIF}
ucommon;
const
@@ -65,18 +55,7 @@ end;
procedure CountSkipTimeSet;
begin
- {$IFDEF SDLTimer}
- TimeNew := SDL_GetTicks(); // / cSDLCorrectionRatio
- TimeFreq := 0;
- {$ELSE}
- {$IFDEF win32}
- QueryPerformanceFrequency(TimeFreq);
- QueryPerformanceCounter(TimeNew);
- {$ELSE}
- TimeNew := CurrentSec100OfDay(); // TODO - JB_Linux will prob need looking at
- TimeFreq := 0;
- {$ENDIF}
- {$ENDIF}
+ TimeNew := SDL_GetTicks();
{$IFDEF DebugDisplay}
Writeln( 'CountSkipTimeSet : ' + inttostr(trunc(TimeNew)) );
@@ -86,26 +65,9 @@ end;
procedure CountSkipTime;
begin
- TimeOld := TimeNew;
-
- {$IFDEF SDLTimer}
- TimeNew := SDL_GetTicks();
- TimeSkip := (TimeNew-TimeOld) / cSDLCorrectionRatio;
- {$ELSE}
- {$IFDEF win32}
- QueryPerformanceCounter(TimeNew);
-
- if ( TimeNew-TimeOld > 0 ) AND
- ( TimeFreq > 0 ) THEN
- begin
- TimeSkip := (TimeNew-TimeOld)/TimeFreq;
- end;
-
- {$ELSE}
- TimeNew := CurrentSec100OfDay(); // TODO - JB_Linux will prob need looking at
- TimeSkip := (TimeNew-TimeOld);
- {$ENDIF}
- {$ENDIF}
+ TimeOld := TimeNew;
+ TimeNew := SDL_GetTicks();
+ TimeSkip := (TimeNew-TimeOld) / cSDLCorrectionRatio;
{$IFDEF DebugDisplay}
Writeln( 'TimeNew : ' + inttostr(trunc(TimeNew)) );
@@ -116,43 +78,20 @@ end;
procedure CountMidTime;
begin
- {$IFDEF SDLTimer}
- TimeMidTemp := SDL_GetTicks();
- TimeMid := (TimeMidTemp - TimeNew) / cSDLCorrectionRatio;
- {$ELSE}
- {$IFDEF win32}
- QueryPerformanceCounter(TimeMidTemp);
- TimeMid := (TimeMidTemp-TimeNew)/TimeFreq;
- {$ELSE}
- TimeMidTemp := CurrentSec100OfDay();
- TimeMid := (TimeMidTemp-TimeNew); // TODO - JB_Linux will prob need looking at
- {$ENDIF}
- {$ENDIF}
+ TimeMidTemp := SDL_GetTicks();
+ TimeMid := (TimeMidTemp - TimeNew) / cSDLCorrectionRatio;
{$IFDEF DebugDisplay}
- Writeln( 'TimeNew : ' + inttostr(trunc(TimeNew)) );
+ Writeln( 'TimeNew : ' + inttostr(trunc(TimeNew)) );
Writeln( 'CountMidTime : ' + inttostr(trunc(TimeMid)) );
{$ENDIF}
end;
function TTime.GetTime: real;
-var
- TimeTemp: int64;
begin
- {$IFDEF SDLTimer}
- TimeTemp := SDL_GetTicks();
- Result := TimeTemp / cSDLCorrectionRatio; // TODO - JB_Linux will prob need looking at
- {$ELSE}
- {$IFDEF win32}
- QueryPerformanceCounter(TimeTemp);
- Result := TimeTemp / TimeFreq;
- {$ELSE}
- TimeTemp := CurrentSec100OfDay();
- Result := TimeTemp; // TODO - JB_Linux will prob need looking at
- {$ENDIF}
- {$ENDIF}
-
+ Result := SDL_GetTicks() / cSDLCorrectionRatio;
+
{$IFDEF DebugDisplay}
Writeln( 'GetTime : ' + inttostr(trunc(Result)) );
{$ENDIF}
diff --git a/Game/Code/Classes/UVideo.pas b/Game/Code/Classes/UVideo.pas
index 2dd745fd..ed1e5fe3 100644
--- a/Game/Code/Classes/UVideo.pas
+++ b/Game/Code/Classes/UVideo.pas
@@ -210,7 +210,6 @@ begin
writeln( 'VideoStreamIndex : ' + inttostr(VideoStreamIndex) );
writeln( 'AudioStreamIndex : ' + inttostr(AudioStreamIndex) );
end;
-(*
aCodecCtx := VideoFormatContext.streams[ AudioStreamIndex ].codec;
WantedAudioCodecContext.freq := aCodecCtx^.sample_rate;
@@ -222,7 +221,7 @@ begin
WantedAudioCodecContext.userdata := aCodecCtx;
-
+(*
if(SDL_OpenAudio(WantedAudioCodecContext, AudioCodecContext) < 0) then
begin
writeln( 'Could not do SDL_OpenAudio' );
diff --git a/Game/Code/Screens/UScreenCredits.pas b/Game/Code/Screens/UScreenCredits.pas
index 2bd0156a..b7d6d3e7 100644
--- a/Game/Code/Screens/UScreenCredits.pas
+++ b/Game/Code/Screens/UScreenCredits.pas
@@ -172,7 +172,7 @@ begin
SDLK_BACKSPACE :
begin
FadeTo(@ScreenMain);
- Music.PlayBack;
+ AudioPlayback.PlayBack;
end;
{ SDLK_SPACE:
begin
@@ -288,7 +288,7 @@ begin
deluxe_slidein := 0;
Credits_Alpha := 0;
//Music.SetLoop(true); Loop looped ned, so ne scheisse
- Music.Open(soundpath + 'wome-credits-tune.mp3'); //danke kleinster liebster weeeetüüüüü!!
+ AudioPlayback.Open(soundpath + 'wome-credits-tune.mp3'); //danke kleinster liebster weeeetüüüüü!!
// Music.Play;
CTime:=0;
// setlength(CTime_hold,0);
@@ -344,7 +344,7 @@ end;
procedure TScreenCredits.onHide;
begin
- Music.Stop;
+ AudioPlayback.Stop;
end;
Procedure TScreenCredits.Draw_FunkyText;
@@ -445,7 +445,7 @@ const myLogoCoords: Array[0..27,0..1] of Cardinal = ((39,32),(84,32),(100,16),(
begin
//dis does teh muiwk y0r
- Data := Music.GetFFTData;
+ Data := AudioPlayback.GetFFTData;
Log.LogStatus('',' JB-1');
@@ -465,7 +465,7 @@ begin
CRDTS_Stage:=Intro;
CTime:=0;
- Music.Play;
+ AudioPlayback.Play;
end;
if (CRDTS_Stage=Intro) and (CTime=Timings[7]) then
@@ -1311,14 +1311,14 @@ Log.LogStatus('',' JB-4');
begin
if CTime=Timings[20] then begin
CTime_hold:=0;
- Music.Stop;
- Music.Open(soundpath + 'credits-outro-tune.mp3');
- Music.Play;
- Music.SetVolume(20);
- Music.SetLoop(True);
+ AudioPlayback.Stop;
+ AudioPlayback.Open(soundpath + 'credits-outro-tune.mp3');
+ AudioPlayback.Play;
+ AudioPlayback.SetVolume(20);
+ AudioPlayback.SetLoop(True);
end;
if CTime_hold > 231 then begin
- Music.Play;
+ AudioPlayback.Play;
Ctime_hold:=0;
end;
glClearColor(0,0,0,0);
diff --git a/Game/Code/Screens/UScreenEdit.pas b/Game/Code/Screens/UScreenEdit.pas
index 93c2a5b4..a58756e6 100644
--- a/Game/Code/Screens/UScreenEdit.pas
+++ b/Game/Code/Screens/UScreenEdit.pas
@@ -36,14 +36,15 @@ begin
SDLK_ESCAPE,
SDLK_BACKSPACE :
begin
- Music.PlayBack;
+ AudioPlayback.PlayBack;
FadeTo(@ScreenMain);
// Result := false;
end;
SDLK_RETURN:
begin
- if Interaction = 0 then begin
- Music.PlayStart;
+ if Interaction = 0 then
+ begin
+ AudioPlayback.PlayStart;
FadeTo(@ScreenEditConvert);
end;
// if Interaction = 1 then begin
@@ -51,8 +52,9 @@ begin
// FadeTo(@ScreenEditHeader);
// end;
- if Interaction = 1 then begin
- Music.PlayBack;
+ if Interaction = 1 then
+ begin
+ AudioPlayback.PlayBack;
FadeTo(@ScreenMain);
end;
end;
diff --git a/Game/Code/Screens/UScreenEditConvert.pas b/Game/Code/Screens/UScreenEditConvert.pas
index 762f84c2..1878337b 100644
--- a/Game/Code/Screens/UScreenEditConvert.pas
+++ b/Game/Code/Screens/UScreenEditConvert.pas
@@ -120,19 +120,21 @@ begin
{$IFDEF UseMIDIPort}
MidiFile.StopPlaying;
{$ENDIF}
- Music.PlayBack;
+ AudioPlayback.PlayBack;
FadeTo(@ScreenEdit);
end;
SDLK_RETURN:
begin
- if Interaction = 0 then begin
- Music.PlayStart;
+ if Interaction = 0 then
+ begin
+ AudioPlayback.PlayStart;
ScreenOpen.BackScreen := @ScreenEditConvert;
FadeTo(@ScreenOpen);
end;
- if Interaction = 1 then begin
+ if Interaction = 1 then
+ begin
Selected := false;
{$IFDEF UseMIDIPort}
MidiFile.OnMidiEvent := MidiFile1MidiEvent;
diff --git a/Game/Code/Screens/UScreenEditSub.pas b/Game/Code/Screens/UScreenEditSub.pas
index 22420b26..1dd3fb24 100644
--- a/Game/Code/Screens/UScreenEditSub.pas
+++ b/Game/Code/Screens/UScreenEditSub.pas
@@ -320,13 +320,13 @@ begin
if SDL_ModState = 0 then begin
// Play Sentence
Click := true;
- Music.Stop;
+ AudioPlayback.Stop;
R := GetTimeFromBeat(Czesci[0].Czesc[Czesci[0].Akt].StartNote);
- if R <= Music.Length then begin
- Music.MoveTo(R);
+ if R <= AudioPlayback.Length then begin
+ AudioPlayback.MoveTo(R);
PlayStopTime := GetTimeFromBeat(Czesci[0].Czesc[Czesci[0].Akt].Koniec);
PlaySentence := true;
- Music.Play;
+ AudioPlayback.Play;
LastClick := -100;
end;
end;
@@ -349,10 +349,10 @@ begin
PlaySentence := true;
Click := true;
- Music.Stop;
- Music.MoveTo(GetTimeFromBeat(Czesci[0].Czesc[Czesci[0].Akt].StartNote)+0{-0.10});
+ AudioPlayback.Stop;
+ AudioPlayback.MoveTo(GetTimeFromBeat(Czesci[0].Czesc[Czesci[0].Akt].StartNote)+0{-0.10});
PlayStopTime := GetTimeFromBeat(Czesci[0].Czesc[Czesci[0].Akt].Koniec)+0;
- Music.Play;
+ AudioPlayback.Play;
LastClick := -100;
end;
end;
@@ -363,12 +363,12 @@ begin
PlaySentenceMidi := false; // stop midi
PlaySentence := true;
Click := false;
- Music.Stop;
- Music.MoveTo(GetTimeFromBeat(Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Start));
+ AudioPlayback.Stop;
+ AudioPlayback.MoveTo(GetTimeFromBeat(Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Start));
PlayStopTime := (GetTimeFromBeat(
Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Start +
Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Dlugosc));
- Music.Play;
+ AudioPlayback.Play;
LastClick := -100;
end;
@@ -510,7 +510,7 @@ begin
Lyric.AddCzesc(Czesci[0].Akt);
Lyric.Selected := 0;
- Music.Stop;
+ AudioPlayback.Stop;
PlaySentence := false;
end;
@@ -538,7 +538,7 @@ begin
Lyric.AddCzesc(Czesci[0].Akt);
Lyric.Selected := 0;
- Music.Stop;
+ AudioPlayback.Stop;
PlaySentence := false;
end;
@@ -1188,7 +1188,7 @@ begin
AktNuta := 0;
Czesci[0].Czesc[0].Nuta[0].Color := 1;
- Music.Open(Path + AktSong.Mp3);
+ AudioPlayback.Open(Path + AktSong.Mp3);
//Set Down Music Volume for Better hearability of Midi Sounds
//Music.SetVolume(40);
@@ -1262,20 +1262,22 @@ begin
// mp3 music
if PlaySentence then begin
// stop the music
- if (Music.Position > PlayStopTime) then begin
- Music.Stop;
+ if (AudioPlayback.Position > PlayStopTime) then
+ begin
+ AudioPlayback.Stop;
PlaySentence := false;
end;
// click
if (Click) and (PlaySentence) then begin
// AktBeat := Floor(AktSong.BPM[0].BPM * (Music.Position - AktSong.GAP / 1000) / 60);
- AktBeat := Floor(GetMidBeat(Music.Position - AktSong.GAP / 1000));
+ AktBeat := Floor(GetMidBeat(AudioPlayback.Position - AktSong.GAP / 1000));
Text[TextDebug].Text := IntToStr(AktBeat);
if AktBeat <> LastClick then begin
for Pet := 0 to Czesci[0].Czesc[Czesci[0].Akt].HighNut do
- if (Czesci[0].Czesc[Czesci[0].Akt].Nuta[Pet].Start = AktBeat) then begin
- Music.PlayClick;
+ if (Czesci[0].Czesc[Czesci[0].Akt].Nuta[Pet].Start = AktBeat) then
+ begin
+ AudioPlayback.PlayClick;
LastClick := AktBeat;
end;
end;
diff --git a/Game/Code/Screens/UScreenLevel.pas b/Game/Code/Screens/UScreenLevel.pas
index 34fc87af..df23d340 100644
--- a/Game/Code/Screens/UScreenLevel.pas
+++ b/Game/Code/Screens/UScreenLevel.pas
@@ -32,7 +32,7 @@ begin
SDLK_ESCAPE,
SDLK_BACKSPACE :
begin
- Music.PlayBack;
+ AudioPlayback.PlayBack;
FadeTo(@ScreenName);
end;
@@ -40,7 +40,7 @@ begin
begin
Ini.Difficulty := Interaction;
Ini.SaveLevel;
- Music.PlayStart;
+ AudioPlayback.PlayStart;
//Set Standard Mode
ScreenSong.Mode := 0;
FadeTo(@ScreenSong);
diff --git a/Game/Code/Screens/UScreenMain.pas b/Game/Code/Screens/UScreenMain.pas
index aecc40bb..cb7390cc 100644
--- a/Game/Code/Screens/UScreenMain.pas
+++ b/Game/Code/Screens/UScreenMain.pas
@@ -92,7 +92,7 @@ begin
//Credits_Y := 600;
//Credits_Alpha := 0;
//Credits_Visible := True;
- Music.PlayStart;
+ AudioPlayback.PlayStart;
FadeTo(@ScreenCredits);
end;
end;
@@ -100,20 +100,20 @@ begin
begin
if (Ini.Players >= 1) AND (Length(DLLMan.Plugins)>=1) then
begin
- Music.PlayStart;
+ AudioPlayback.PlayStart;
FadeTo(@ScreenPartyOptions);
end;
end;
SDLK_S:
begin
- Music.PlayStart;
+ AudioPlayback.PlayStart;
FadeTo(@ScreenStatMain);
end;
SDLK_E:
begin
- Music.PlayStart;
+ AudioPlayback.PlayStart;
FadeTo(@ScreenEdit);
end;
@@ -124,7 +124,7 @@ begin
begin
if (Length(Songs.Song) >= 1) then
begin
- Music.PlayStart;
+ AudioPlayback.PlayStart;
if (Ini.Players >= 0) and (Ini.Players <= 3) then PlayersPlay := Ini.Players + 1;
if (Ini.Players = 4) then PlayersPlay := 6;
@@ -141,7 +141,7 @@ begin
begin
if (Length(DLLMan.Plugins)>=1) then
begin
- Music.PlayStart;
+ AudioPlayback.PlayStart;
FadeTo(@ScreenPartyOptions);
end
else //show error message, No Plugins Loaded
@@ -152,25 +152,29 @@ begin
end;
//Stats
- if Interaction = 2 then begin
- Music.PlayStart;
+ if Interaction = 2 then
+ begin
+ AudioPlayback.PlayStart;
FadeTo(@ScreenStatMain);
end;
//Editor
- if Interaction = 3 then begin
- Music.PlayStart;
+ if Interaction = 3 then
+ begin
+ AudioPlayback.PlayStart;
FadeTo(@ScreenEdit);
end;
//Options
- if Interaction = 4 then begin
- Music.PlayStart;
+ if Interaction = 4 then
+ begin
+ AudioPlayback.PlayStart;
FadeTo(@ScreenOptions);
end;
//Exit
- if Interaction = 5 then begin
+ if Interaction = 5 then
+ begin
Result := false;
end;
end;
diff --git a/Game/Code/Screens/UScreenName.pas b/Game/Code/Screens/UScreenName.pas
index 0d98e944..5363d2a2 100644
--- a/Game/Code/Screens/UScreenName.pas
+++ b/Game/Code/Screens/UScreenName.pas
@@ -156,7 +156,7 @@ begin
SDLK_ESCAPE :
begin
Ini.SaveNames;
- Music.PlayBack;
+ AudioPlayback.PlayBack;
if GoTo_SingScreen then
FadeTo(@ScreenSong)
else
@@ -168,7 +168,7 @@ begin
for I := 1 to 6 do
Ini.Name[I-1] := Button[I-1].Text[0].Text;
Ini.SaveNames;
- Music.PlayStart;
+ AudioPlayback.PlayStart;
if GoTo_SingScreen then
FadeTo(@ScreenSing)
diff --git a/Game/Code/Screens/UScreenOpen.pas b/Game/Code/Screens/UScreenOpen.pas
index c27ee762..edf684db 100644
--- a/Game/Code/Screens/UScreenOpen.pas
+++ b/Game/Code/Screens/UScreenOpen.pas
@@ -57,7 +57,7 @@ begin
begin
//Empty Filename and go to last Screen
FileName := '';
- Music.PlayBack;
+ AudioPlayback.PlayBack;
FadeTo(BackScreen);
end;
@@ -66,14 +66,14 @@ begin
if (Interaction = 2) then begin
//Update Filename and go to last Screen
FileName := Text[TextN].Text;
- Music.PlayBack;
+ AudioPlayback.PlayBack;
FadeTo(BackScreen);
end
else if (Interaction = 1) then
begin
//Empty Filename and go to last Screen
FileName := '';
- Music.PlayBack;
+ AudioPlayback.PlayBack;
FadeTo(BackScreen);
end;
end;
diff --git a/Game/Code/Screens/UScreenOptions.pas b/Game/Code/Screens/UScreenOptions.pas
index a1f64659..1867d03b 100644
--- a/Game/Code/Screens/UScreenOptions.pas
+++ b/Game/Code/Screens/UScreenOptions.pas
@@ -36,49 +36,57 @@ begin
SDLK_BACKSPACE :
begin
Ini.Save;
- Music.PlayBack;
+ AudioPlayback.PlayBack;
FadeTo(@ScreenMain);
end;
SDLK_RETURN:
begin
- if SelInteraction = 0 then begin
- Music.PlayStart;
+ if SelInteraction = 0 then
+ begin
+ AudioPlayback.PlayStart;
FadeTo(@ScreenOptionsGame);
end;
- if SelInteraction = 1 then begin
- Music.PlayStart;
+ if SelInteraction = 1 then
+ begin
+ AudioPlayback.PlayStart;
FadeTo(@ScreenOptionsGraphics);
end;
- if SelInteraction = 2 then begin
- Music.PlayStart;
+ if SelInteraction = 2 then
+ begin
+ AudioPlayback.PlayStart;
FadeTo(@ScreenOptionsSound);
end;
- if SelInteraction = 3 then begin
- Music.PlayStart;
+ if SelInteraction = 3 then
+ begin
+ AudioPlayback.PlayStart;
FadeTo(@ScreenOptionsLyrics);
end;
- if SelInteraction = 4 then begin
- Music.PlayStart;
+ if SelInteraction = 4 then
+ begin
+ AudioPlayback.PlayStart;
FadeTo(@ScreenOptionsThemes);
end;
- if SelInteraction = 5 then begin
- Music.PlayStart;
+ if SelInteraction = 5 then
+ begin
+ AudioPlayback.PlayStart;
FadeTo(@ScreenOptionsRecord);
end;
- if SelInteraction = 6 then begin
- Music.PlayStart;
+ if SelInteraction = 6 then
+ begin
+ AudioPlayback.PlayStart;
FadeTo(@ScreenOptionsAdvanced);
end;
- if SelInteraction = 7 then begin
+ if SelInteraction = 7 then
+ begin
Ini.Save;
- Music.PlayBack;
+ AudioPlayback.PlayBack;
FadeTo(@ScreenMain);
end;
end;
diff --git a/Game/Code/Screens/UScreenOptionsAdvanced.pas b/Game/Code/Screens/UScreenOptionsAdvanced.pas
index 63c3aa7a..271ff972 100644
--- a/Game/Code/Screens/UScreenOptionsAdvanced.pas
+++ b/Game/Code/Screens/UScreenOptionsAdvanced.pas
@@ -32,7 +32,7 @@ begin
SDLK_BACKSPACE :
begin
Ini.Save;
- Music.PlayBack;
+ AudioPlayback.PlayBack;
FadeTo(@ScreenOptions);
end;
SDLK_RETURN:
@@ -41,7 +41,7 @@ begin
//if SelInteraction = 7 then begin
if SelInteraction = 6 then begin
Ini.Save;
- Music.PlayBack;
+ AudioPlayback.PlayBack;
FadeTo(@ScreenOptions);
end;
end;
@@ -54,7 +54,7 @@ begin
//SelectLoadAnimation Hidden because it is useless atm
//if (SelInteraction >= 0) and (SelInteraction <= 6) then begin
if (SelInteraction >= 0) and (SelInteraction <= 5) then begin
- Music.PlayOption;
+ AudioPlayback.PlayOption;
InteractInc;
end;
end;
@@ -63,7 +63,7 @@ begin
//SelectLoadAnimation Hidden because it is useless atm
//if (SelInteraction >= 0) and (SelInteraction <= 6) then begin
if (SelInteraction >= 0) and (SelInteraction <= 5) then begin
- Music.PlayOption;
+ AudioPlayback.PlayOption;
InteractDec;
end;
end;
diff --git a/Game/Code/Screens/UScreenOptionsGame.pas b/Game/Code/Screens/UScreenOptionsGame.pas
index 0f69f326..1d94ffa6 100644
--- a/Game/Code/Screens/UScreenOptionsGame.pas
+++ b/Game/Code/Screens/UScreenOptionsGame.pas
@@ -33,14 +33,14 @@ begin
SDLK_ESCAPE,
SDLK_BACKSPACE :
begin
- Music.PlayBack;
+ AudioPlayback.PlayBack;
RefreshSongs;
FadeTo(@ScreenOptions);
end;
SDLK_RETURN:
begin
if SelInteraction = 6 then begin
- Music.PlayBack;
+ AudioPlayback.PlayBack;
RefreshSongs;
FadeTo(@ScreenOptions);
end;
@@ -51,15 +51,17 @@ begin
InteractPrev;
SDLK_RIGHT:
begin
- if (SelInteraction >= 0) and (SelInteraction <= 5) then begin
- Music.PlayOption;
+ if (SelInteraction >= 0) and (SelInteraction <= 5) then
+ begin
+ AudioPlayback.PlayOption;
InteractInc;
end;
end;
SDLK_LEFT:
begin
- if (SelInteraction >= 0) and (SelInteraction <= 5) then begin
- Music.PlayOption;
+ if (SelInteraction >= 0) and (SelInteraction <= 5) then
+ begin
+ AudioPlayback.PlayOption;
InteractDec;
end;
end;
diff --git a/Game/Code/Screens/UScreenOptionsGraphics.pas b/Game/Code/Screens/UScreenOptionsGraphics.pas
index d4be6974..c0ea90ff 100644
--- a/Game/Code/Screens/UScreenOptionsGraphics.pas
+++ b/Game/Code/Screens/UScreenOptionsGraphics.pas
@@ -32,7 +32,7 @@ begin
SDLK_BACKSPACE :
begin
Ini.Save;
- Music.PlayBack;
+ AudioPlayback.PlayBack;
FadeTo(@ScreenOptions);
end;
SDLK_RETURN:
@@ -42,7 +42,7 @@ begin
end;}
if SelInteraction = 5 then begin
Ini.Save;
- Music.PlayBack;
+ AudioPlayback.PlayBack;
FadeTo(@ScreenOptions);
end;
end;
@@ -53,14 +53,14 @@ begin
SDLK_RIGHT:
begin
if (SelInteraction >= 0) and (SelInteraction <= 4) then begin
- Music.PlayOption;
+ AudioPlayback.PlayOption;
InteractInc;
end;
end;
SDLK_LEFT:
begin
if (SelInteraction >= 0) and (SelInteraction <= 4) then begin
- Music.PlayOption;
+ AudioPlayback.PlayOption;
InteractDec;
end;
end;
diff --git a/Game/Code/Screens/UScreenOptionsLyrics.pas b/Game/Code/Screens/UScreenOptionsLyrics.pas
index 5cadc5b9..7ef7c207 100644
--- a/Game/Code/Screens/UScreenOptionsLyrics.pas
+++ b/Game/Code/Screens/UScreenOptionsLyrics.pas
@@ -32,14 +32,14 @@ begin
SDLK_BACKSPACE :
begin
Ini.Save;
- Music.PlayBack;
+ AudioPlayback.PlayBack;
FadeTo(@ScreenOptions);
end;
SDLK_RETURN:
begin
if SelInteraction = 3 then begin
Ini.Save;
- Music.PlayBack;
+ AudioPlayback.PlayBack;
FadeTo(@ScreenOptions);
end;
end;
@@ -50,14 +50,14 @@ begin
SDLK_RIGHT:
begin
if (SelInteraction >= 0) and (SelInteraction <= 2) then begin
- Music.PlayOption;
+ AudioPlayback.PlayOption;
InteractInc;
end;
end;
SDLK_LEFT:
begin
if (SelInteraction >= 0) and (SelInteraction <= 2) then begin
- Music.PlayOption;
+ AudioPlayback.PlayOption;
InteractDec;
end;
end;
diff --git a/Game/Code/Screens/UScreenOptionsRecord.pas b/Game/Code/Screens/UScreenOptionsRecord.pas
index ef8b31d1..d497c637 100644
--- a/Game/Code/Screens/UScreenOptionsRecord.pas
+++ b/Game/Code/Screens/UScreenOptionsRecord.pas
@@ -36,14 +36,14 @@ begin
SDLK_BACKSPACE:
begin
Ini.Save;
- Music.PlayBack;
+ AudioPlayback.PlayBack;
FadeTo(@ScreenOptions);
end;
SDLK_RETURN:
begin
if SelInteraction = 4 then begin
Ini.Save;
- Music.PlayBack;
+ AudioPlayback.PlayBack;
FadeTo(@ScreenOptions);
end;
end;
@@ -54,7 +54,7 @@ begin
SDLK_RIGHT:
begin
if (SelInteraction >= 0) and (SelInteraction <= 3) then begin
- Music.PlayOption;
+ AudioPlayback.PlayOption;
InteractInc;
end;
if SelInteraction = 0 then UpdateCard;
@@ -62,7 +62,7 @@ begin
SDLK_LEFT:
begin
if (SelInteraction >= 0) and (SelInteraction <= 3) then begin
- Music.PlayOption;
+ AudioPlayback.PlayOption;
InteractDec;
end;
if SelInteraction = 0 then UpdateCard;
diff --git a/Game/Code/Screens/UScreenOptionsSound.pas b/Game/Code/Screens/UScreenOptionsSound.pas
index 3c3e28e4..1777228b 100644
--- a/Game/Code/Screens/UScreenOptionsSound.pas
+++ b/Game/Code/Screens/UScreenOptionsSound.pas
@@ -32,14 +32,14 @@ begin
SDLK_BACKSPACE :
begin
Ini.Save;
- Music.PlayBack;
+ AudioPlayback.PlayBack;
FadeTo(@ScreenOptions);
end;
SDLK_RETURN:
begin
if SelInteraction = 6 then begin
Ini.Save;
- Music.PlayBack;
+ AudioPlayback.PlayBack;
FadeTo(@ScreenOptions);
end;
end;
@@ -50,14 +50,14 @@ begin
SDLK_RIGHT:
begin
if (SelInteraction >= 0) and (SelInteraction <= 5) then begin
- Music.PlayOption;
+ AudioPlayback.PlayOption;
InteractInc;
end;
end;
SDLK_LEFT:
begin
if (SelInteraction >= 0) and (SelInteraction <= 5) then begin
- Music.PlayOption;
+ AudioPlayback.PlayOption;
InteractDec;
end;
end;
diff --git a/Game/Code/Screens/UScreenOptionsThemes.pas b/Game/Code/Screens/UScreenOptionsThemes.pas
index 5b5f8877..cf89ac3f 100644
--- a/Game/Code/Screens/UScreenOptionsThemes.pas
+++ b/Game/Code/Screens/UScreenOptionsThemes.pas
@@ -35,14 +35,14 @@ begin
SDLK_BACKSPACE :
begin
Ini.Save;
- Music.PlayBack;
+ AudioPlayback.PlayBack;
FadeTo(@ScreenOptions);
end;
SDLK_RETURN:
begin
if SelInteraction = 3 then begin
Ini.Save;
- Music.PlayBack;
+ AudioPlayback.PlayBack;
FadeTo(@ScreenOptions);
end;
end;
@@ -53,14 +53,14 @@ begin
SDLK_RIGHT:
begin
if (SelInteraction >= 0) and (SelInteraction <= 2) then begin
- Music.PlayOption;
+ AudioPlayback.PlayOption;
InteractInc;
end;
end;
SDLK_LEFT:
begin
if (SelInteraction >= 0) and (SelInteraction <= 2) then begin
- Music.PlayOption;
+ AudioPlayback.PlayOption;
InteractDec;
end;
end;
diff --git a/Game/Code/Screens/UScreenPartyNewRound.pas b/Game/Code/Screens/UScreenPartyNewRound.pas
index 30a1f8f0..ee534781 100644
--- a/Game/Code/Screens/UScreenPartyNewRound.pas
+++ b/Game/Code/Screens/UScreenPartyNewRound.pas
@@ -92,13 +92,13 @@ begin
SDLK_ESCAPE,
SDLK_BACKSPACE :
begin
- Music.PlayBack;
+ AudioPlayback.PlayBack;
CheckFadeTo(@ScreenMain,'MSG_END_PARTY');
end;
SDLK_RETURN:
begin
- Music.PlayStart;
+ AudioPlayback.PlayStart;
if DLLMan.Selected.LoadSong then
begin
//Select PartyMode ScreenSong
diff --git a/Game/Code/Screens/UScreenPartyOptions.pas b/Game/Code/Screens/UScreenPartyOptions.pas
index ab6bd733..714e0d99 100644
--- a/Game/Code/Screens/UScreenPartyOptions.pas
+++ b/Game/Code/Screens/UScreenPartyOptions.pas
@@ -63,7 +63,7 @@ begin
SDLK_ESCAPE,
SDLK_BACKSPACE :
begin
- Music.PlayBack;
+ AudioPlayback.PlayBack;
FadeTo(@ScreenMain);
end;
@@ -113,7 +113,7 @@ begin
//Start Party
PartySession.StartNewParty(Rounds + 2);
- Music.PlayStart;
+ AudioPlayback.PlayStart;
//Go to Player Screen
FadeTo(@ScreenPartyPlayer);
end;
@@ -125,7 +125,7 @@ begin
SDLK_UP: InteractPrev;
SDLK_RIGHT:
begin
- Music.PlayOption;
+ AudioPlayback.PlayOption;
InteractInc;
//Change Playlist2 if Playlist is Changed
@@ -140,7 +140,7 @@ begin
end;
SDLK_LEFT:
begin
- Music.PlayOption;
+ AudioPlayback.PlayOption;
InteractDec;
//Change Playlist2 if Playlist is Changed
diff --git a/Game/Code/Screens/UScreenPartyPlayer.pas b/Game/Code/Screens/UScreenPartyPlayer.pas
index e6830ee6..24534599 100644
--- a/Game/Code/Screens/UScreenPartyPlayer.pas
+++ b/Game/Code/Screens/UScreenPartyPlayer.pas
@@ -184,7 +184,7 @@ begin
SDLK_ESCAPE:
begin
Ini.SaveNames;
- Music.PlayBack;
+ AudioPlayback.PlayBack;
FadeTo(@ScreenPartyOptions);
end;
@@ -202,7 +202,7 @@ begin
end;
end;
- Music.PlayStart;
+ AudioPlayback.PlayStart;
FadeTo(@ScreenPartyNewRound);
end;
diff --git a/Game/Code/Screens/UScreenPartyScore.pas b/Game/Code/Screens/UScreenPartyScore.pas
index 6333896c..6af835f2 100644
--- a/Game/Code/Screens/UScreenPartyScore.pas
+++ b/Game/Code/Screens/UScreenPartyScore.pas
@@ -57,7 +57,7 @@ begin
SDLK_ESCAPE,
SDLK_BACKSPACE :
begin
- Music.PlayStart;
+ AudioPlayback.PlayStart;
if (PartySession.CurRound < High(PartySession.Rounds)) then
FadeTo(@ScreenPartyNewRound)
else
@@ -69,7 +69,7 @@ begin
SDLK_RETURN:
begin
- Music.PlayStart;
+ AudioPlayback.PlayStart;
if (PartySession.CurRound < High(PartySession.Rounds)) then
FadeTo(@ScreenPartyNewRound)
else
diff --git a/Game/Code/Screens/UScreenPartyWin.pas b/Game/Code/Screens/UScreenPartyWin.pas
index fecca3d1..3c7ad921 100644
--- a/Game/Code/Screens/UScreenPartyWin.pas
+++ b/Game/Code/Screens/UScreenPartyWin.pas
@@ -50,13 +50,13 @@ begin
SDLK_ESCAPE,
SDLK_BACKSPACE :
begin
- Music.PlayStart;
+ AudioPlayback.PlayStart;
FadeTo(@ScreenMain);
end;
SDLK_RETURN:
begin
- Music.PlayStart;
+ AudioPlayback.PlayStart;
FadeTo(@ScreenMain);
end;
end;
diff --git a/Game/Code/Screens/UScreenSing.pas b/Game/Code/Screens/UScreenSing.pas
index 9e43f31f..e0c80297 100644
--- a/Game/Code/Screens/UScreenSing.pas
+++ b/Game/Code/Screens/UScreenSing.pas
@@ -146,7 +146,7 @@ begin
//Sound[0].BufferLong
Finish;
- Music.PlayBack;
+ AudioPlayback.PlayBack;
FadeTo(@ScreenScore);
end;
@@ -182,7 +182,7 @@ begin
Paused := true;
// pause Music
- Music.Pause;
+ AudioPlayback.Pause;
// pause Video
if (AktSong.Video <> '') and FileExists(AktSong.Path + AktSong.Video) then
@@ -193,9 +193,9 @@ begin
Czas.Teraz := PauseTime; //Position of Notes
// Position of Music
- Music.MoveTo (PauseTime);
+ AudioPlayback.MoveTo (PauseTime);
// Play Music
- Music.Play;
+ AudioPlayback.Play;
// Video
if (AktSong.Video <> '') and FileExists(AktSong.Path + AktSong.Video) then
@@ -451,14 +451,14 @@ begin
// play music (I)
- Music.CaptureStart;
- Music.MoveTo(AktSong.Start);
+ AudioPlayback.CaptureStart;
+ AudioPlayback.MoveTo(AktSong.Start);
// Music.Play;
// prepare timer (I)
// CountSkipTimeSet;
Czas.Teraz := AktSong.Start;
- Czas.Razem := Music.Length;
+ Czas.Razem := AudioPlayback.Length;
if (AktSong.Finish > 0) then Czas.Razem := AktSong.Finish / 1000;
Czas.OldBeat := -1;
for P := 0 to High(Player) do
@@ -871,7 +871,7 @@ begin
end;
// play music (II)
- Music.Play;
+ AudioPlayback.Play;
// prepare timer (II)
CountSkipTimeSet;
@@ -1147,7 +1147,7 @@ begin
// check for music finish
// Log.LogError('Check for music finish: ' + BoolToStr(Music.Finished) + ' ' + FloatToStr(Czas.Teraz*1000) + ' ' + IntToStr(AktSong.Finish));
if ShowFinish then begin
- if (not Music.Finished) and ((AktSong.Finish = 0) or (Czas.Teraz*1000 <= AktSong.Finish)) then begin
+ if (not AudioPlayback.Finished) and ((AktSong.Finish = 0) or (Czas.Teraz*1000 <= AktSong.Finish)) then begin
//Pause Mod:
if not Paused then
Sing(Self); // analyze song
@@ -1201,8 +1201,8 @@ end;
procedure TScreenSing.Finish;
begin
- Music.CaptureStop;
- Music.Stop;
+ AudioPlayback.CaptureStop;
+ AudioPlayback.Stop;
if Ini.SavePlayback = 1 then begin
Log.BenchmarkStart(0);
diff --git a/Game/Code/Screens/UScreenSingModi.pas b/Game/Code/Screens/UScreenSingModi.pas
index d18dd5bc..a05c6d4b 100644
--- a/Game/Code/Screens/UScreenSingModi.pas
+++ b/Game/Code/Screens/UScreenSingModi.pas
@@ -102,7 +102,7 @@ begin
SDLK_BACKSPACE :
begin
Finish;
- Music.PlayBack;
+ AudioPlayback.PlayBack;
FadeTo(@ScreenPartyScore);
end;
@@ -170,7 +170,7 @@ begin
end
else //Start Without Song
begin
- Music.CaptureStart;
+ AudioPlayback.CaptureStart;
end;
//Set Playerinfo
@@ -531,7 +531,7 @@ end;
if ShowFinish then begin
if DllMan.Selected.LoadSong then
begin
- if (not Music.Finished) and ((AktSong.Finish = 0) or (Czas.Teraz*1000 <= AktSong.Finish)) then begin
+ if (not AudioPlayback.Finished) and ((AktSong.Finish = 0) or (Czas.Teraz*1000 <= AktSong.Finish)) then begin
//Pause Mod:
if not Paused then
Sing(Self); // analyze song
@@ -658,12 +658,12 @@ end;
function LoadSound (const Name: PChar): Cardinal; stdcall; //Procedure that loads a Custom Sound
begin
- Result := Music.LoadCustomSound(String(Name));
+ Result := AudioPlayback.LoadCustomSound(String(Name));
end;
procedure PlaySound (const Index: Cardinal); stdcall; //Plays a Custom Sound
begin
- Music.PlayCustomSound(Index);
+ AudioPlayback.PlayCustomSound(Index);
end;
end.
diff --git a/Game/Code/Screens/UScreenSong.pas b/Game/Code/Screens/UScreenSong.pas
index 0bf411c1..df4ec87a 100644
--- a/Game/Code/Screens/UScreenSong.pas
+++ b/Game/Code/Screens/UScreenSong.pas
@@ -265,7 +265,7 @@ begin
begin
SkipTo(CatSongs.VisibleIndex((I + Interaction) mod I2));
- Music.PlayChange;
+ AudioPlayback.PlayChange;
ChangeMusic;
SetScroll4;
@@ -284,7 +284,7 @@ begin
begin
SkipTo(CatSongs.VisibleIndex((I + Interaction) mod I2));
- Music.PlayChange;
+ AudioPlayback.PlayChange;
ChangeMusic;
SetScroll4;
@@ -326,7 +326,7 @@ begin
Interaction := I - 1;
//Stop Music
- Music.Stop;
+ AudioPlayback.Stop;
CatSongs.ShowCategoryList;
@@ -361,8 +361,8 @@ begin
end
else
begin
- Music.Stop;
- Music.PlayBack;
+ AudioPlayback.Stop;
+ AudioPlayback.PlayBack;
FadeTo(@ScreenMain);
end;
@@ -372,7 +372,7 @@ begin
//When in party Mode then Ask before Close
else if (Mode = 1) then
begin
- Music.PlayBack;
+ AudioPlayback.PlayBack;
CheckFadeTo(@ScreenMain,'MSG_END_PARTY');
end;
end;
@@ -495,7 +495,7 @@ begin
FixSelected;
//Play Music:
- Music.PlayChange;
+ AudioPlayback.PlayChange;
ChangeMusic;
end;
@@ -538,7 +538,7 @@ begin
FixSelected;
//Play Music:
- Music.PlayChange;
+ AudioPlayback.PlayChange;
ChangeMusic;
end;
end;
@@ -548,8 +548,9 @@ begin
SDLK_RIGHT:
begin
- if (Length(Songs.Song) > 0) AND (Mode = 0) then begin
- Music.PlayChange;
+ if (Length(Songs.Song) > 0) AND (Mode = 0) then
+ begin
+ AudioPlayback.PlayChange;
SelectNext;
// InteractNext;
// SongTarget := Interaction;
@@ -563,7 +564,7 @@ begin
SDLK_LEFT:
begin
if (Length(Songs.Song) > 0)AND (Mode = 0) then begin
- Music.PlayChange;
+ AudioPlayback.PlayChange;
SelectPrev;
ChangeMusic;
SetScroll4;
@@ -643,9 +644,9 @@ begin
end
else //Random in one Category
begin
- SkipTo(Random(CatSongs.VisibleSongs));
+ SkipTo(Random(CatSongs.VisibleSongs));
end;
- Music.PlayChange;
+ AudioPlayback.PlayChange;
ChangeMusic;
SetScroll4;
@@ -1410,7 +1411,7 @@ end;
procedure TScreenSong.onShow;
begin
- Music.Stop;
+ AudioPlayback.Stop;
if Ini.Players <= 3 then PlayersPlay := Ini.Players + 1;
if Ini.Players = 4 then PlayersPlay := 6;
@@ -1429,13 +1430,13 @@ begin
//Load Music only when Song Preview is activated
if (Ini.PreviewVolume <> 0) then
begin
- Music.SetLoop(false);
- Music.Open(CatSongs.Song[Interaction].Path + CatSongs.Song[Interaction].Mp3);
- Music.MoveTo(Music.Length / 4);
- Music.Play;
+ AudioPlayback.SetLoop(false);
+ AudioPlayback.Open(CatSongs.Song[Interaction].Path + CatSongs.Song[Interaction].Mp3);
+ AudioPlayback.MoveTo(AudioPlayback.Length / 4);
+ AudioPlayback.Play;
//Set Preview Volume
- Music.SetMusicVolume (Ini.PreviewVolume * 10);
+ AudioPlayback.SetMusicVolume (Ini.PreviewVolume * 10);
{//if Music Fade is activated, Set Volume to 0 %
if (Ini.PreviewFading <> 0) then
Music.SetMusicVolume(0);}
@@ -1478,15 +1479,15 @@ procedure TScreenSong.onHide;
begin
//When Music Fading is activated, Turn Music to 100 %
If (Ini.PreviewVolume <> 100) or (Ini.PreviewFading <> 0) then
- Music.SetMusicVolume(100);
+ AudioPlayback.SetMusicVolume(100);
//If Preview is deactivated: Load MUsicfile now
If (Ini.PreviewVolume = 0) then
- Music.Open(CatSongs.Song[Interaction].Path + CatSongs.Song[Interaction].Mp3);
+ AudioPlayback.Open(CatSongs.Song[Interaction].Path + CatSongs.Song[Interaction].Mp3);
//When hide then Stop Music (For Party Mode Popup on Exit)
- if (Display.NextScreen <> @ScreenSing) and (Display.NextScreen <> @ScreenSingModi) and (Music <> nil) then
- Music.Stop;
+ if (Display.NextScreen <> @ScreenSing) and (Display.NextScreen <> @ScreenSingModi) and (AudioPlayback <> nil) then
+ AudioPlayback.Stop;
end;
procedure TScreenSong.DrawExtensions;
@@ -1546,13 +1547,13 @@ begin
begin
//Start Song Fade after a little Time, to prevent Song to be Played on Scrolling
if (CoverTime < 0.2) and (CoverTime + TimeSkip >= 0.2) then
- Music.Play;
+ AudioPlayback.Play;
//Update Song Volume
if (CoverTime < Ini.PreviewFading) then
- Music.SetMusicVolume(Round (CoverTime * Ini.PreviewVolume / Ini.PreviewFading * 10))
+ AudioPlayback.SetMusicVolume(Round (CoverTime * Ini.PreviewVolume / Ini.PreviewFading * 10))
else
- Music.SetMusicVolume(Ini.PreviewVolume * 10);
+ AudioPlayback.SetMusicVolume(Ini.PreviewVolume * 10);
end;
@@ -1673,18 +1674,18 @@ begin
begin
if (NOT CatSongs.Song[Interaction].Main) AND(CatSongs.VisibleSongs > 0) then
begin
- Music.Close;
- if Music.Open(CatSongs.Song[Interaction].Path + CatSongs.Song[Interaction].Mp3) then begin
- Music.MoveTo(Music.Length / 4);
+ AudioPlayback.Close;
+ if AudioPlayback.Open(CatSongs.Song[Interaction].Path + CatSongs.Song[Interaction].Mp3) then begin
+ AudioPlayback.MoveTo(AudioPlayback.Length / 4);
//If Song Fading is activated then don't Play directly, and Set Volume to Null, else Play normal
if (Ini.PreviewFading = 0) then
- Music.Play
+ AudioPlayback.Play
else
- Music.SetMusicVolume(0);
+ AudioPlayback.SetMusicVolume(0);
end;
end
else
- Music.Stop;
+ AudioPlayback.Stop;
end;
end;
@@ -1715,7 +1716,7 @@ var
lTmp : double;
begin
-if (not Music.Finished) AND (Theme.Song.Equalizer.Length > 0) then
+if (not AudioPlayback.Finished) AND (Theme.Song.Equalizer.Length > 0) then
begin
@@ -1724,7 +1725,7 @@ begin
if (A <> EqualizerTime) then
begin
EqualizerTime := A;
- Data := Music.GetFFTData;
+ Data := AudioPlayback.GetFFTData;
B:=0;
Pos := 0;
@@ -1890,7 +1891,7 @@ begin
end;
end;
- Music.PlayChange;
+ AudioPlayback.PlayChange;
ChangeMusic;
SetScroll;
UpdateLCD;
@@ -2003,7 +2004,7 @@ end;
procedure TScreenSong.StartSong;
begin
CatSongs.Selected := Interaction;
- Music.Stop;
+ AudioPlayback.Stop;
//Party Mode
if (Mode = 1) then
begin
@@ -2018,7 +2019,7 @@ end;
procedure TScreenSong.SelectPlayers;
begin
CatSongs.Selected := Interaction;
- Music.Stop;
+ AudioPlayback.Stop;
ScreenName.Goto_SingScreen := True;
FadeTo(@ScreenName);
@@ -2026,9 +2027,10 @@ end;
procedure TScreenSong.OpenEditor;
begin
- if (Length(Songs.Song) > 0) and (not CatSongs.Song[Interaction].Main) AND (Mode = 0) then begin
- Music.Stop;
- Music.PlayStart;
+ if (Length(Songs.Song) > 0) and (not CatSongs.Song[Interaction].Main) AND (Mode = 0) then
+ begin
+ AudioPlayback.Stop;
+ AudioPlayback.PlayStart;
ScreenEditSub.Path := CatSongs.Song[Interaction].Path;
ScreenEditSub.FileName := CatSongs.Song[Interaction].FileName;
FadeTo(@ScreenEditSub);
diff --git a/Game/Code/Screens/UScreenSongJumpto.pas b/Game/Code/Screens/UScreenSongJumpto.pas
index 48d23468..de78665e 100644
--- a/Game/Code/Screens/UScreenSongJumpto.pas
+++ b/Game/Code/Screens/UScreenSongJumpto.pas
@@ -65,7 +65,7 @@ begin
SDLK_ESCAPE:
begin
Visible := False;
- Music.PlayBack;
+ AudioPlayback.PlayBack;
if (VisSongs = 0) AND (Length(Button[0].Text[0].Text) > 0) then
begin
ScreenSong.UnLoadDetailedCover;
diff --git a/Game/Code/Screens/UScreenSongMenu.pas b/Game/Code/Screens/UScreenSongMenu.pas
index ce331e2f..c6e16f60 100644
--- a/Game/Code/Screens/UScreenSongMenu.pas
+++ b/Game/Code/Screens/UScreenSongMenu.pas
@@ -94,7 +94,7 @@ begin
SDLK_ESCAPE,
SDLK_BACKSPACE :
begin
- Music.PlayBack;
+ AudioPlayback.PlayBack;
Visible := False;
end;
diff --git a/Game/Code/Screens/UScreenStatDetail.pas b/Game/Code/Screens/UScreenStatDetail.pas
index 9dc6c525..1310b127 100644
--- a/Game/Code/Screens/UScreenStatDetail.pas
+++ b/Game/Code/Screens/UScreenStatDetail.pas
@@ -51,7 +51,7 @@ begin
SDLK_ESCAPE,
SDLK_BACKSPACE :
begin
- Music.PlayBack;
+ AudioPlayback.PlayBack;
FadeTo(@ScreenStatMain);
end;
SDLK_RETURN:
@@ -74,7 +74,7 @@ begin
end;
if Interaction = 3 then begin
- Music.PlayBack;
+ AudioPlayback.PlayBack;
FadeTo(@ScreenStatMain);
end;
end;
diff --git a/Game/Code/Screens/UScreenStatMain.pas b/Game/Code/Screens/UScreenStatMain.pas
index 223ad2b2..4f46bec2 100644
--- a/Game/Code/Screens/UScreenStatMain.pas
+++ b/Game/Code/Screens/UScreenStatMain.pas
@@ -60,19 +60,20 @@ begin
SDLK_BACKSPACE :
begin
Ini.Save;
- Music.PlayBack;
+ AudioPlayback.PlayBack;
FadeTo(@ScreenMain);
end;
SDLK_RETURN:
begin
//Exit Button Pressed
- if Interaction = 4 then begin
- Music.PlayBack;
+ if Interaction = 4 then
+ begin
+ AudioPlayback.PlayBack;
FadeTo(@ScreenMain);
end
else //One of the Stats Buttons Pressed
begin
- Music.PlayBack;
+ AudioPlayback.PlayBack;
ScreenStatDetail.Typ := Interaction;
FadeTo(@ScreenStatDetail);
end;
diff --git a/Game/Code/USDXResCompiler.exe b/Game/Code/USDXResCompiler.exe
index 6b0137be..b18e11a9 100644
--- a/Game/Code/USDXResCompiler.exe
+++ b/Game/Code/USDXResCompiler.exe
Binary files differ
diff --git a/Game/Code/UltraStar.dpr b/Game/Code/UltraStar.dpr
index ed58e97f..239984b5 100644
--- a/Game/Code/UltraStar.dpr
+++ b/Game/Code/UltraStar.dpr
@@ -4,50 +4,32 @@ program UltraStar;
{$I switches.inc}
uses
- //------------------------------
- //Includes - 3rd Party Libraries
- //------------------------------
- SDL in 'lib\JEDI-SDLv1.0\SDL\Pas\SDL.pas',
+ SDL in 'lib\JEDI-SDLv1.0\SDL\Pas\SDL.pas',
moduleloader in 'lib\JEDI-SDLv1.0\SDL\Pas\moduleloader.pas',
- sdlutils in 'lib\JEDI-SDLv1.0\SDL\Pas\sdlutils.pas',
- sdl_image in 'lib\JEDI-SDLv1.0\SDL_Image\Pas\sdl_image.pas',
- OpenGL12 in 'lib\JEDI-SDLv1.0\OpenGL\Pas\OpenGL12.pas',
- sdl_ttf in 'lib\JEDI-SDLv1.0\SDL_ttf\Pas\sdl_ttf.pas',
-
- bass in 'lib\bass\delphi\bass.pas',
-
- PNGImage in 'lib\PNGImage\PNGImage.pas',
- PNGzLib in 'lib\PNGImage\PNGzLib.pas',
- pnglang in 'lib\PNGImage\pnglang.pas',
-
- midiout in 'lib\midi\midiout.pas',
- midiin in 'lib\midi\midiin.pas',
- Circbuf in 'lib\midi\CIRCBUF.PAS',
- MidiType in 'lib\midi\MidiType.PAS',
- MidiDefs in 'lib\midi\MidiDefs.PAS',
- MidiCons in 'lib\midi\MidiCons.PAS',
- MidiFile in 'lib\midi\MidiFile.PAS',
- Delphmcb in 'lib\midi\Delphmcb.PAS',
-
- {$IFDEF UseSerialPort}
- zlportio in 'lib\zlportio\zlportio.pas',
- ddkint in 'lib\zlportio\ddkint.pas',
- {$ENDIF}
-
- avcodec in 'lib\ffmpeg\avcodec.pas',
- avformat in 'lib\ffmpeg\avformat.pas',
- avutil in 'lib\ffmpeg\avutil.pas',
- rational in 'lib\ffmpeg\rational.pas',
- opt in 'lib\ffmpeg\opt.pas',
- avio in 'lib\ffmpeg\avio.pas',
-
+ sdlutils in 'lib\JEDI-SDLv1.0\SDL\Pas\sdlutils.pas',
+ sdl_image in 'lib\JEDI-SDLv1.0\SDL_Image\Pas\sdl_image.pas',
+ OpenGL12 in 'lib\JEDI-SDLv1.0\OpenGL\Pas\OpenGL12.pas',
+ sdl_ttf in 'lib\JEDI-SDLv1.0\SDL_ttf\Pas\sdl_ttf.pas',
+ bass in 'lib\bass\delphi\bass.pas',
+ PNGImage in 'lib\PNGImage\PNGImage.pas',
+ PNGzLib in 'lib\PNGImage\PNGzLib.pas',
+ pnglang in 'lib\PNGImage\pnglang.pas',
+ midiout in 'lib\midi\midiout.pas',
+ midiin in 'lib\midi\midiin.pas',
+ CIRCBUF in 'lib\midi\CIRCBUF.PAS',
+ MidiType in 'lib\midi\MidiType.PAS',
+ MidiDefs in 'lib\midi\MidiDefs.PAS',
+ MidiCons in 'lib\midi\MidiCons.PAS',
+ MidiFile in 'lib\midi\MidiFile.PAS',
+ Delphmcb in 'lib\midi\Delphmcb.PAS',
+ avcodec in 'lib\ffmpeg\avcodec.pas',
+ avformat in 'lib\ffmpeg\avformat.pas',
+ avutil in 'lib\ffmpeg\avutil.pas',
+ rational in 'lib\ffmpeg\rational.pas',
+ opt in 'lib\ffmpeg\opt.pas',
+ avio in 'lib\ffmpeg\avio.pas',
SQLiteTable3 in 'lib\SQLite\SQLiteTable3.pas',
- SQLite3 in 'lib\SQLite\SQLite3.pas',
-
-
- //------------------------------
- //Includes - Menu System
- //------------------------------
+ SQLite3 in 'lib\SQLite\SQLite3.pas',
UDisplay in 'Menu\UDisplay.pas',
UMenu in 'Menu\UMenu.pas',
UMenuStatic in 'Menu\UMenuStatic.pas',
@@ -58,14 +40,11 @@ uses
UMenuSelectSlide in 'Menu\UMenuSelectSlide.pas',
UDrawTexture in 'Menu\UDrawTexture.pas',
UMenuButtonCollection in 'Menu\UMenuButtonCollection.pas',
-
- //------------------------------
- //Includes - Classes
- //------------------------------
UCommon in 'Classes\UCommon.pas',
UGraphic in 'Classes\UGraphic.pas',
UTexture in 'Classes\UTexture.pas',
UMusic in 'Classes\UMusic.pas',
+ UMusic_BASS in 'Classes\UMusic_BASS.pas',
ULanguage in 'Classes\ULanguage.pas',
UMain in 'Classes\UMain.pas',
UDraw in 'Classes\UDraw.pas',
@@ -90,27 +69,17 @@ uses
UDLLManager in 'Classes\UDLLManager.pas',
UParty in 'Classes\UParty.pas',
UPlaylist in 'Classes\UPlaylist.pas',
- UCommandLine in 'Classes\UCommandLine.pas',
+ UCommandLine in 'Classes\UCommandLine.pas',
UTextClasses in 'Classes\UTextClasses.pas',
USingScores in 'Classes\USingScores.pas',
USingNotes in 'Classes\USingNotes.pas',
-
- //New Plugin and Core Management
- UModules in 'Classes\UModules.pas', //This Unit contains a const with the Modules to Load
- UHooks in 'Classes\UHooks.pas', //Class for Hook Management //Write Freeing Methods for Both
- UServices in 'Classes\UServices.pas', //95% - One Hack to remove ;)
- UCore in 'Classes\UCore.pas', //30 % - Many Classes needs Rewriting or Manipulation
+ UModules in 'Classes\UModules.pas',
+ UHooks in 'Classes\UHooks.pas',
+ UServices in 'Classes\UServices.pas',
+ UCore in 'Classes\UCore.pas',
UCoreModule in 'Classes\UCoreModule.pas',
- UPluginInterface in 'Classes\UPluginInterface.pas', //Some changes to work with unwriten classes, need to be done
-
- //------------------------------
- //Includes - Video Support
- //------------------------------
+ UPluginInterface in 'Classes\UPluginInterface.pas',
UVideo in 'Classes\UVideo.pas',
-
- //------------------------------
- //Includes - Screens
- //------------------------------
UScreenLoading in 'Screens\UScreenLoading.pas',
UScreenWelcome in 'Screens\UScreenWelcome.pas',
UScreenMain in 'Screens\UScreenMain.pas',
@@ -139,26 +108,14 @@ uses
UScreenStatDetail in 'Screens\UScreenStatDetail.pas',
UScreenCredits in 'Screens\UScreenCredits.pas',
UScreenPopup in 'Screens\UScreenPopup.pas',
-
- //------------------------------
- //Includes - Screens PartyMode
- //------------------------------
UScreenSingModi in 'Screens\UScreenSingModi.pas',
UScreenPartyNewRound in 'Screens\UScreenPartyNewRound.pas',
UScreenPartyScore in 'Screens\UScreenPartyScore.pas',
UScreenPartyPlayer in 'Screens\UScreenPartyPlayer.pas',
UScreenPartyOptions in 'Screens\UScreenPartyOptions.pas',
UScreenPartyWin in 'Screens\UScreenPartyWin.pas',
-
- //------------------------------
- //Includes - Modi SDK
- //------------------------------
ModiSDK in '..\..\Modis\SDK\ModiSDK.pas',
- UPluginDefs in '..\..\Modis\SDK\UPluginDefs.pas', //New Plugin SDK
-
- //------------------------------
- //Includes - Delphi
- //------------------------------
+ UPluginDefs in '..\..\Modis\SDK\UPluginDefs.pas',
Windows,
SysUtils;
@@ -335,8 +292,7 @@ begin
// Sound
Log.BenchmarkStart(1);
Log.LogStatus('Initialize Sound', 'Initialization');
- Log.LogStatus('Creating Music', 'InitializeSound'); Music := TMusic.Create;
- InitializeSound;
+ Log.LogStatus('Creating Music', 'InitializeSound'); InitializeSound();
Log.BenchmarkEnd(1);
Log.LogBenchmark('Initializing Sound', 1);
diff --git a/Game/Code/switches.inc b/Game/Code/switches.inc
index 4e5deb2d..578271c0 100644
--- a/Game/Code/switches.inc
+++ b/Game/Code/switches.inc
@@ -4,7 +4,7 @@
{$UNDEF UseSerialPort}
{$UNDEF UseMIDIPort}
{$ELSE}
- {$DEFINE UseSerialPort}
+ {$UNDEF UseSerialPort}
{$DEFINE UseMIDIPort}
{$ENDIF}
@@ -15,4 +15,5 @@
{$ENDIF}
{$ELSE}
{$UNDEF UseBASS}
-{$ENDIF} \ No newline at end of file
+{$ENDIF}
+