aboutsummaryrefslogtreecommitdiffstats
path: root/Game
diff options
context:
space:
mode:
authorbrunzelchen <brunzelchen@b956fd51-792f-4845-bead-9b4dfca2ff2c>2010-02-23 17:54:33 +0000
committerbrunzelchen <brunzelchen@b956fd51-792f-4845-bead-9b4dfca2ff2c>2010-02-23 17:54:33 +0000
commit1c683178bcc27b47e63d9d663644d2ba6e7f40fc (patch)
tree83b68607dcf00cbc37679194c8e1217b79c88c2d /Game
parent2aa979ec2cb3c7b971d023dda8c1fd07ce0af8fa (diff)
downloadusdx-1c683178bcc27b47e63d9d663644d2ba6e7f40fc.tar.gz
usdx-1c683178bcc27b47e63d9d663644d2ba6e7f40fc.tar.xz
usdx-1c683178bcc27b47e63d9d663644d2ba6e7f40fc.zip
added own folder for recordings
git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/branches/1.0.1 Challenge MOD@2150 b956fd51-792f-4845-bead-9b4dfca2ff2c
Diffstat (limited to 'Game')
-rw-r--r--Game/Code/Classes/UFiles.pas5
-rw-r--r--Game/Code/Classes/ULog.pas23
-rw-r--r--Game/Code/Screens/UScreenSing.pas16
3 files changed, 30 insertions, 14 deletions
diff --git a/Game/Code/Classes/UFiles.pas b/Game/Code/Classes/UFiles.pas
index 56f3d83a..fdcffe3e 100644
--- a/Game/Code/Classes/UFiles.pas
+++ b/Game/Code/Classes/UFiles.pas
@@ -39,6 +39,7 @@ var
LanguagesPath: string;
PluginPath: string;
PlayListPath: string;
+ RecordingsPath: string;
SongFile: TextFile; // all procedures in this unit operates on this file
FileLineNo: integer; //Line which is readed at Last, for error reporting
@@ -71,6 +72,7 @@ begin
LanguagesPath := GamePath + 'Languages\';
PluginPath := GamePath + 'Plugins\';
PlaylistPath := GamePath + 'Playlists\';
+ RecordingsPath := GamePath + 'Recordings\';
Writeable := true;
@@ -99,6 +101,9 @@ begin
If Writeable And (not DirectoryExists(PlaylistPath)) then
Writeable := ForceDirectories(PlaylistPath);
+ If Writeable And (not DirectoryExists(RecordingsPath)) then
+ Writeable := ForceDirectories(RecordingsPath);
+
if not Writeable then
Log.LogError('Error: Dir is Readonly');
diff --git a/Game/Code/Classes/ULog.pas b/Game/Code/Classes/ULog.pas
index 16473318..afa156cb 100644
--- a/Game/Code/Classes/ULog.pas
+++ b/Game/Code/Classes/ULog.pas
@@ -34,7 +34,7 @@ type
procedure CriticalError(Text: string);
// voice
- procedure LogVoice(SoundNr: integer);
+ procedure LogVoice(SoundNr: Integer; Player, Artist, Title, Points: string);
// compability
procedure LogStatus(Log1, Log2: string);
@@ -172,7 +172,7 @@ begin
end;
end;
-procedure TLog.LogVoice(SoundNr: integer);
+procedure TLog.LogVoice(SoundNr: Integer; Player, Artist, Title, Points: string);
type
TRiffHeader = record
riff: Array[0..3] OF Char;
@@ -208,16 +208,16 @@ begin
begin
with riffHdr do
begin
- //Schreibe 'RIFF' in die ersten 4 bytes
+ //write 'RIFF'
riff[0] := 'R'; riff[1] := 'I'; riff[2] := 'F'; riff[3] := 'F';
// wird spaeter gesetzt;
filesize := 0;
- //Schreibe 'WAVE' in die naechsten 4 bytes
+ //write 'WAVE'
typeStr[0] := 'W'; typeStr[1] := 'A'; typeStr[2] := 'V'; typeStr[3] := 'E';
end;
with fmtChunk do
begin
- //Schreibe 'fmt' + char($20) in die naechsten 4 bytes
+ //write 'fmt' + char($20)
id[0] := 'f'; id[1] := 'm'; id[2] := 't'; id[3] := ' ';
size := 16;
end;
@@ -232,7 +232,7 @@ begin
end;
with dataChunk do
begin
- //Schreibe 'data' in die naechsten 4 bytes
+ //write 'data'
id[0] := 'd'; id[1] := 'a'; id[2] := 't'; id[3] := 'a';
size := 0;
end;
@@ -254,17 +254,19 @@ begin
for Num := 1 to 9999 do begin
FileName := IntToStr(Num);
while Length(FileName) < 4 do FileName := '0' + FileName;
- FileName := LogPath + 'Voice' + FileName + '.wav';
+ FileName := RecordingsPath + Artist + '_' +
+ Title + '_P' + Points + '_' + FileName + '_' + Player + '.wav';
if not FileExists(FileName) then break
end;
- FS := TFileStream.Create(FileName, fmCreate);
-
HeadInit(Header);
s := 0;
for BL := 0 to High(Sound[SoundNr].BufferLong) do
s := s + Sound[SoundNr].BufferLong[BL].Size;
-
+
+ if (s=0) then
+ exit;
+
Header.Datachunk.size := s;
//FileSize = DataSize + HeaderSize
Header.riffHdr.FileSize := Header.Datachunk.size + 24;
@@ -275,6 +277,7 @@ begin
ms.Write(Header, sizeof(header));
ms.Seek(0, soBeginning);
+ FS := TFileStream.Create(FileName, fmCreate);
FS.CopyFrom(ms, ms.Size);
FS.Seek(0, soEnd);
ms.Free;
diff --git a/Game/Code/Screens/UScreenSing.pas b/Game/Code/Screens/UScreenSing.pas
index 202b02c3..9bd89339 100644
--- a/Game/Code/Screens/UScreenSing.pas
+++ b/Game/Code/Screens/UScreenSing.pas
@@ -195,6 +195,7 @@ begin
PlaylistMedley.CurrentMedleySong:=PlaylistMedley.NumMedleySongs+1;
Finish;
+ FadeOut := true;
Music.PlayBack;
if ScreenSong.Mode<>smParty then
@@ -1398,8 +1399,9 @@ end;
procedure TScreenSing.Finish;
var
- I, J: integer;
+ I, J: integer;
len, num: integer;
+ points: string;
begin
Music.CaptureStop;
@@ -1407,9 +1409,15 @@ begin
if Ini.SavePlayback = 1 then begin
Log.BenchmarkStart(0);
- Log.LogVoice(0);
- //Log.LogVoice(1);
- //Log.LogVoice(2);
+ for I := 0 to PlayersPlay - 1 do
+ begin
+ points := IntToStr(Player[I].ScoreTotalI);
+ while Length(points) < 5 do
+ points := '0'+points;
+
+ Log.LogVoice(I, Ini.Name[I], AktSong.Artist, AktSong.Title, points);
+ end;
+
Log.BenchmarkEnd(0);
Log.LogBenchmark('Creating files', 0);
end;