Commit decdda7

Nick Faro committed on
Merge branch 'tables-for-real' into hUGETracker
commit decdda7f8cecc938ee13fd74f7649d436f9388cc parent 2cb2c1fparent bce2082
18 changed files Diffed against the first of 2 parents. +1097−1183
DeletedPostBuild.pas +0−67
@@ -1,67 +0,0 @@
1 {
2 This script runs after build.
3
4 In a production build, it populates the directory with
5 - Halt.gb
6 - hUGEDriver
7 - The manual
8 - PixeliteTTF
9 - Sample Songs
10
11 In a development build, it hardlinks
12 - Halt.gb
13 - hUGEDriver
14 - PixeliteTTF
15
16 into the build output folder so that the driver and tracker can be developed
17 simultaneously.
18 }
19
20 {$mode objfpc}{$H+}
21
22 uses SysUtils, StrUtils;
23
24 procedure HTCopyFile(Source: String);
25 begin
26 {$ifdef WINDOWS}
27 ExecuteProcess('cmd.exe', '/c "copy ' + ExpandFileName(Source) + ' ' + ParamStr(2) + ExtractFileName(Source) + '"');
28 {$endif}
29
30 {$ifdef UNIX}
31 ExecuteProcess('/bin/bash', '-c "cp -rf ' + Source + ' ' + ParamStr(2) + ExtractFileName(Source) + '" > /dev/null');
32 {$endif}
33 end;
34
35 procedure HTCopyDir(Source: String);
36 begin
37 {$ifdef WINDOWS}
38 ExecuteProcess('cmd.exe', '/c "robocopy /E ' + ExpandFileName(Source) + ' ' + ParamStr(2) + ExtractFileName(Source) + '"');
39 {$endif}
40
41 {$ifdef UNIX}
42 ExecuteProcess('/bin/bash', '-c "cp -rf ' + Source + ' ' + ParamStr(2) + ExtractFileName(Source) + '" > /dev/null');
43 {$endif}
44 end;
45
46 var
47 I: Integer;
48 Dev: Boolean;
49 DestDir: String;
50 begin
51 DestDir := ParamStr(2);
52 Dev := ContainsText(DestDir, 'Development');
53
54 if not DirectoryExists(DestDir+'render') then
55 MkDir(DestDir+'render');
56
57 HTCopyFile('Resources/ROMs/halt.gb');
58 HTCopyFile('Resources/Fonts/PixeliteTTF.ttf');
59
60 if not Dev then begin
61 HTCopyDir('hUGEDriver');
62 HTCopyDir('Resources/SampleSongs');
63 end else begin
64 if not DirectoryExists(DestDir+'hUGEDriver') then
65 Writeln('hUGEDriver not copied in development mode. Manually link it there yourself!');
66 end;
67 end.
Deletedbeepboximport.pas +0−55
@@ -1,55 +0,0 @@
1 unit BeepBoxImport;
2
3 {$mode objfpc}{$H+}
4
5 interface
6
7 uses
8 Classes, SysUtils, fpjson, Song, hugedatatypes, constants;
9
10 function LoadSongFromBeepBoxJsonStream(Stream: TStream): TSong;
11
12 implementation
13
14 procedure TranscribePattern(BBPat: TJSONObject; Pat: PPattern);
15 var
16 Notes: TJSONArray;
17 I: Integer;
18 NoteVal, TickStart, TickEnd: Integer;
19 begin
20 Notes := TJSONArray(BBPat.FindPath('notes'));
21 for I := 0 to Notes.Count-1 do begin
22 NoteVal := Notes[I].FindPath('pitches[0]').AsInteger - C_5;
23 TickStart := Notes[I].FindPath('points[0].tick').AsInteger;
24 TickEnd := Notes[I].FindPath('points[1].tick').AsInteger;
25
26 with Pat^[TickStart] do begin
27 Note := NoteVal;
28 Instrument := 1;
29 EffectCode := $0;
30 EffectParams.Value := $00;
31 end;
32
33 with Pat^[TickEnd] do begin
34 EffectCode := $E;
35 EffectParams.Value := $00;
36 end;
37 end;
38 end;
39
40 function LoadSongFromBeepBoxJsonStream(Stream: TStream): TSong;
41 var
42 jData: TJSONData;
43 jObject: TJSONObject;
44 begin
45 jData := GetJSON(Stream);
46 jObject := TJSONObject(jData);
47
48 InitializeSong(Result);
49 Result.TicksPerRow := 6;
50 TranscribePattern(TJSONObject(jObject.FindPath('channels[0].patterns[0]')), Result.Patterns.GetOrCreateNew(0));
51 TranscribePattern(TJSONObject(jObject.FindPath('channels[1].patterns[0]')), Result.Patterns.GetOrCreateNew(1));
52 end;
53
54 end.
55
Deletedbuild-release-unix.sh +0−65
@@ -1,65 +0,0 @@
1 #!/bin/bash
2 set -x #echo on
3
4 asm=$(which rgbasm)
5 link=$(which rgblink)
6 fix=$(which rgbfix)
7 ffm=$(which ffmpeg)
8
9 if [ -z "$asm" ]; then { echo "rgbasm not found!"; exit 1; } fi
10 if [ -z "$link" ]; then { echo "rgblink not found!"; exit 1; } fi
11 if [ -z "$fix" ]; then { echo "rgbfix not found!"; exit 1; } fi
12 if [ -z "$ffm" ]; then { echo "ffmpeg not found!"; exit 1; } fi
13
14 outdir="$1"
15 if [ -z "$outdir" ]
16 then
17 echo "Output directory not specified!"
18 exit 1
19 fi
20
21 # Build halt.gb
22
23 function check_fail() {
24 if [ $? -ne 0 ]
25 then
26 echo "Failed, aborting."
27 exit 1
28 fi
29 }
30
31 rgbasm -o halt.obj halt.asm
32 check_fail
33
34 rgblink -n $outdir/halt.sym -o $outdir/halt.gb halt.obj
35 check_fail
36
37 rm halt.obj
38 check_fail
39
40 rgbfix -p0 -v $outdir/halt.gb
41 check_fail
42
43 # Copy needed stuff
44
45 cp $asm $outdir/
46 cp $link $outdir/
47 cp $fix $outdir/
48 cp $ffm $outdir/
49
50 cp Resources/Fonts/PixeliteTTF.ttf $outdir/
51 check_fail
52
53 mkdir $outdir/hUGEDriver
54 pushd $outdir/hUGEDriver
55 curl -L https://api.github.com/repos/SuperDisk/hUGEDriver/tarball | tar xzf - --strip 1
56 check_fail
57 popd
58
59 cp -r "Resources/Sample Songs" "$outdir/Sample Songs"
60 check_fail
61
62 tar czf hUGETracker-$outdir.tar.gz $outdir
63 check_fail
64
65 echo Done
Deletedbuild-release-win.bat +0−93
@@ -1,93 +0,0 @@
1 @echo on
2
3 for /f %%i in ('where rgbasm') do set rgbasm=%%i
4 for /f %%i in ('where rgblink') do set rgblink=%%i
5 for /f %%i in ('where rgbfix') do set rgbfix=%%i
6 for /f %%i in ('where ffmpeg') do set ffmpeg=%%i
7
8 if x%rgbasm%==x (
9 echo rgbasm not found!
10 exit/b 1
11 )
12 if x%rgblink%==x (
13 echo rgblink not found!
14 exit/b 1
15 )
16 if x%rgbfix%==x (
17 echo rgbfix not found!
18 exit/b 1
19 )
20 if x%ffmpeg%==x (
21 echo ffmpeg not found!
22 exit/b 1
23 )
24
25 set outdir=%1
26 if x%outdir%==x goto no_outdir
27
28 :: Build halt.gb
29 rgbasm -o halt.obj halt.asm
30 if not errorlevel 0 goto buildfail
31 rgblink -n %outdir%\halt.sym -o %outdir%\halt.gb halt.obj
32 if not errorlevel 0 goto buildfail
33
34 erase halt.obj
35
36 rgbfix -p0 -v %outdir%\halt.gb
37 if not errorlevel 0 goto fixfail
38
39 :: Copy needed stuff
40
41 copy %rgbasm% %outdir%\
42 copy %rgblink% %outdir%\
43 copy %rgbfix% %outdir%\
44 copy %ffmpeg% %outdir%\
45
46 copy Resources\Fonts\PixeliteTTF.ttf %outdir%\
47 if not errorlevel 0 goto copyfail
48
49 copy Resources\Libs\SDL2.dll %outdir%\
50 if not errorlevel 0 goto copyfail
51
52 mkdir %outdir%\hUGEDriver
53 pushd %outdir%\hUGEDriver
54 curl -L https://api.github.com/repos/SuperDisk/hUGEDriver/tarball | tar xzf - --strip 1
55 popd
56
57 Xcopy /E /I /Y "Resources\Sample Songs" "%outdir%\Sample Songs"
58 if not errorlevel 0 goto copyfail
59
60 :: Zip it up
61
62 powershell Compress-Archive %outdir%\* hUGETracker-%outdir%.zip -Force
63
64 echo Done
65 exit/b 0
66
67 :norgbasm
68 echo rgbasm.exe not found!
69 exit/b 1
70
71 :norgblink
72 echo rgblink not found!
73 exit/b 1
74
75 :norgbfix
76 echo rgbfix not found!
77 exit/b 1
78
79 :buildfail
80 echo Building halt.gb and halt.sym failed!
81 exit/b 1
82
83 :fixfail
84 echo rgbfix failed while fixing halt.gb!
85 exit/b 1
86
87 :copyfail
88 echo Error while copying required things from resources!
89 exit/b 1
90
91 :no_outdir
92 echo Output directory not specified!
93 exit/b 1
Modifiedcodegen.pas +72−16
@@ -105,7 +105,7 @@ procedure RenderSongToGBDKC(Song: TSong; DescriptorName: String; Filename: strin
105 SL.Add(IntToStr(HighMask)); 105 SL.Add(IntToStr(HighMask));
106 106
107 for J := Low(TNoiseMacro) to High(TNoiseMacro) do 107 for J := Low(TNoiseMacro) to High(TNoiseMacro) do
108 SL.Add(IntToStr(Byte(Instrument.NoiseMacro[J]))); 108 SL.Add(IntToStr(Byte(0)));
109 end 109 end
110 else 110 else
111 for J := Low(AsmInstrument) to High(AsmInstrument) do 111 for J := Low(AsmInstrument) to High(AsmInstrument) do
@@ -244,7 +244,7 @@ end;
244 244
245 function RenderInstruments(Instruments: TInstrumentBank): string; 245 function RenderInstruments(Instruments: TInstrumentBank): string;
246 var 246 var
247 SL, ResultSL: TStringList; 247 ResultSL: TStringList;
248 AsmInstrument: TAsmInstrument; 248 AsmInstrument: TAsmInstrument;
249 I, J: integer; 249 I, J: integer;
250 TypePrefix: string; 250 TypePrefix: string;
@@ -254,33 +254,33 @@ begin
254 254
255 for I := Low(Instruments) to High(Instruments) do 255 for I := Low(Instruments) to High(Instruments) do
256 begin 256 begin
257 WriteStr(TypePrefix, Instruments[I].Type_);
258 ResultSL.Add(Format('%s%s:', [TypePrefix, 'inst' + IntToStr(I)]));
259
257 AsmInstrument := InstrumentToBytes(Instruments[I]); 260 AsmInstrument := InstrumentToBytes(Instruments[I]);
258 SL := TStringList.Create;
259 SL.StrictDelimiter := True;
260 SL.Delimiter := ',';
261 261
262 if Instruments[I].Type_ = itNoise then 262 if Instruments[I].Type_ = itNoise then
263 begin 263 begin
264 SL.Add(IntToStr(AsmInstrument[1])); // envelope 264 ResultSL.Add('db '+IntToStr(AsmInstrument[1])); // envelope
265 265
266 HighMask := AsmInstrument[0]; 266 HighMask := AsmInstrument[0];
267 if Instruments[I].LengthEnabled then 267 if Instruments[I].LengthEnabled then
268 HighMask := HighMask or %01000000; 268 HighMask := HighMask or %01000000;
269 if Instruments[I].CounterStep = swSeven then 269 if Instruments[I].CounterStep = swSeven then
270 HighMask := HighMask or %10000000; 270 HighMask := HighMask or %10000000;
271 SL.Add(IntToStr(HighMask)); 271 ResultSL.Add('db '+IntToStr(HighMask));
272
273 for J := Low(TNoiseMacro) to High(TNoiseMacro) do
274 SL.Add(IntToStr(Instruments[I].NoiseMacro[J]));
275 end 272 end
276 else 273 else begin
277 for J := Low(AsmInstrument) to High(AsmInstrument) do 274 for J := Low(AsmInstrument) to High(AsmInstrument) do
278 SL.Add(IntToStr(AsmInstrument[J])); 275 ResultSL.Add('db '+IntToStr(AsmInstrument[J]));
276 end;
279 277
280 WriteStr(TypePrefix, Instruments[I].Type_); 278 if Instruments[I].SubpatternEnabled then
281 ResultSL.Add(Format('%s%s: db %s', [TypePrefix, 'inst' + IntToStr(I), 279 ResultSL.Insert(ResultSL.Count-1, Format('dw %sSP%d', [TypePrefix, I]))
282 SL.DelimitedText])); 280 else
283 SL.Free; 281 ResultSL.Insert(ResultSL.Count-1, 'dw 0');
282 ResultSL.Add('ds '+IfThen(Instruments[I].Type_ = itNoise, '4', '2'));
283 ResultSL.Add('');
284 end; 284 end;
285 285
286 Result := ResultSL.Text; 286 Result := ResultSL.Text;
@@ -327,6 +327,46 @@ begin
327 SL.Free; 327 SL.Free;
328 end; 328 end;
329 329
330 function RenderTableCell(Cell: TCell; Last: Boolean): string;
331 var
332 SL: TStringList;
333 begin
334 SL := TStringList.Create;
335 SL.Delimiter := ',';
336 SL.StrictDelimiter := True;
337
338 if (Cell.Note = NO_NOTE) then
339 SL.Add('___')
340 else
341 SL.Add(IntToStr(Cell.Note));
342
343 if Last and (Cell.Volume = 0) then
344 SL.Add(IntToStr(1)) // Automatically insert jump back to row 1 if last cell
345 else
346 SL.Add(IntToStr(EnsureRange(Cell.Volume, 0, 32)));
347
348 SL.Add('$' + EffectCodeToStr(Cell.EffectCode, Cell.EffectParams));
349
350 // RGBDS thinks you're defining a new macro if you don't have a space first.
351 Result := ' dn ' + SL.DelimitedText;
352 SL.Free;
353 end;
354
355 function RenderTablePattern(Name: string; Pattern: TPattern): string;
356 var
357 SL: TStringList;
358 I: integer;
359 begin
360 SL := TStringList.Create;
361 SL.Add(Name + ':');
362
363 for I := 0 to 31 do
364 SL.Add(RenderTableCell(Pattern[I], I = 31)); // TODO: hardcoded value
365
366 Result := SL.Text;
367 SL.Free;
368 end;
369
330 function RenderWaveforms(Waves: TWaveBank): string; 370 function RenderWaveforms(Waves: TWaveBank): string;
331 var 371 var
332 SL, ResultSL: TStringList; 372 SL, ResultSL: TStringList;
@@ -447,6 +487,7 @@ procedure AssembleSong(Song: TSong; Filename: string; Mode: TExportMode);
447 var 487 var
448 OutFile: Text; 488 OutFile: Text;
449 I: integer; 489 I: integer;
490 TypePrefix: String;
450 Proc: TProcess; 491 Proc: TProcess;
451 FilePath: string; 492 FilePath: string;
452 RenameSucceeded: Boolean; 493 RenameSucceeded: Boolean;
@@ -550,6 +591,21 @@ begin
550 591
551 CloseFile(OutFile); 592 CloseFile(OutFile);
552 593
594 AssignFile(OutFile, 'render/subpattern.htt');
595 Rewrite(OutFile);
596
597 // TODO: Are keys and data defined to be aligned? Seems like they are but
598 // should probably find out if that's just an implementation detail...
599 for I := Low(Song.Instruments.All) to High(Song.Instruments.All) do
600 with Song.Instruments.All[I] do begin
601 if SubpatternEnabled then begin
602 WriteStr(TypePrefix, Type_);
603 Write(OutFile, RenderTablePattern(TypePrefix+'SP' + IntToStr(ModInst(I)), Subpattern));
604 end;
605 end;
606
607 CloseFile(OutFile);
608
553 // Build the file 609 // Build the file
554 Proc := TProcess.Create(nil); 610 Proc := TProcess.Create(nil);
555 Proc.Options := Proc.Options + [poWaitOnExit, poUsePipes, poStdErrToOutput, poNoConsole]; 611 Proc.Options := Proc.Options + [poWaitOnExit, poUsePipes, poStdErrToOutput, poNoConsole];
Modifiedconstants.pas +2−1
@@ -18,7 +18,7 @@ type
18 TRoutineIndex = 0..15; 18 TRoutineIndex = 0..15;
19 19
20 const 20 const
21 UGE_FORMAT_VERSION = 5; 21 UGE_FORMAT_VERSION = 6;
22 22
23 SYM_ROW = 'row'; 23 SYM_ROW = 'row';
24 SYM_TICK = 'tick'; 24 SYM_TICK = 'tick';
@@ -127,6 +127,7 @@ const
127 As8 = 70; 127 As8 = 70;
128 B_8 = 71; 128 B_8 = 71;
129 HIGHEST_NOTE = 71; 129 HIGHEST_NOTE = 71;
130 MIDDLE_NOTE = ((HIGHEST_NOTE - LOWEST_NOTE) div 2)+1;
130 LAST_NOTE = 72; 131 LAST_NOTE = 72;
131 NO_NOTE = 90; 132 NO_NOTE = 90;
132 133
ModifiedhUGEDriver +1−1
@@ -1 +1 @@
1 Subproject commit 8967274b7be23d911bbb4c242b61d0bc8a51c803 1 Subproject commit 4f8dea1ba852e17846978fd7adc260bb6c24b0df
ModifiedhUGETracker.lpi +38−37
@@ -166,9 +166,16 @@
166 <OpenInFileMan Value="True"/> 166 <OpenInFileMan Value="True"/>
167 </PublishOptions> 167 </PublishOptions>
168 <RunParams> 168 <RunParams>
169 <local>
170 <CommandLineParams Value="&quot;C:\Projects\GB-Stuff\uge\Resources\Sample Songs\raphaelgoulart - The Murderous Funk Machine (intro).uge&quot;"/>
171 </local>
169 <FormatVersion Value="2"/> 172 <FormatVersion Value="2"/>
170 <Modes Count="1"> 173 <Modes Count="1">
171 <Mode0 Name="default"/> 174 <Mode0 Name="default">
175 <local>
176 <CommandLineParams Value="&quot;C:\Projects\GB-Stuff\uge\Resources\Sample Songs\raphaelgoulart - The Murderous Funk Machine (intro).uge&quot;"/>
177 </local>
178 </Mode0>
172 </Modes> 179 </Modes>
173 </RunParams> 180 </RunParams>
174 <RequiredPackages Count="5"> 181 <RequiredPackages Count="5">
@@ -188,7 +195,7 @@
188 <PackageName Value="LCL"/> 195 <PackageName Value="LCL"/>
189 </Item5> 196 </Item5>
190 </RequiredPackages> 197 </RequiredPackages>
191 <Units Count="26"> 198 <Units Count="24">
192 <Unit0> 199 <Unit0>
193 <Filename Value="hUGETracker.lpr"/> 200 <Filename Value="hUGETracker.lpr"/>
194 <IsPartOfProject Value="True"/> 201 <IsPartOfProject Value="True"/>
@@ -242,89 +249,79 @@
242 <UnitName Value="Constants"/> 249 <UnitName Value="Constants"/>
243 </Unit10> 250 </Unit10>
244 <Unit11> 251 <Unit11>
245 <Filename Value="waves.pas"/>
246 <IsPartOfProject Value="True"/>
247 <UnitName Value="Waves"/>
248 </Unit11>
249 <Unit12>
250 <Filename Value="about_hugetracker.pas"/> 252 <Filename Value="about_hugetracker.pas"/>
251 <IsPartOfProject Value="True"/> 253 <IsPartOfProject Value="True"/>
252 <ComponentName Value="frmAboutHugetracker"/> 254 <ComponentName Value="frmAboutHugetracker"/>
253 <HasResources Value="True"/> 255 <HasResources Value="True"/>
254 <ResourceBaseClass Value="Form"/> 256 <ResourceBaseClass Value="Form"/>
255 </Unit12> 257 </Unit11>
256 <Unit13> 258 <Unit12>
257 <Filename Value="trackergrid.pas"/> 259 <Filename Value="trackergrid.pas"/>
258 <IsPartOfProject Value="True"/> 260 <IsPartOfProject Value="True"/>
259 <UnitName Value="TrackerGrid"/> 261 <UnitName Value="TrackerGrid"/>
260 </Unit13> 262 </Unit12>
261 <Unit14> 263 <Unit13>
262 <Filename Value="clipboardutils.pas"/> 264 <Filename Value="clipboardutils.pas"/>
263 <IsPartOfProject Value="True"/> 265 <IsPartOfProject Value="True"/>
264 <UnitName Value="ClipboardUtils"/> 266 <UnitName Value="ClipboardUtils"/>
265 </Unit14> 267 </Unit13>
266 <Unit15> 268 <Unit14>
267 <Filename Value="hugedatatypes.pas"/> 269 <Filename Value="hugedatatypes.pas"/>
268 <IsPartOfProject Value="True"/> 270 <IsPartOfProject Value="True"/>
269 <UnitName Value="HugeDatatypes"/> 271 <UnitName Value="HugeDatatypes"/>
270 </Unit15> 272 </Unit14>
271 <Unit16> 273 <Unit15>
272 <Filename Value="codegen.pas"/> 274 <Filename Value="codegen.pas"/>
273 <IsPartOfProject Value="True"/> 275 <IsPartOfProject Value="True"/>
274 <UnitName Value="Codegen"/> 276 <UnitName Value="Codegen"/>
275 </Unit16> 277 </Unit15>
276 <Unit17> 278 <Unit16>
277 <Filename Value="symparser.pas"/> 279 <Filename Value="symparser.pas"/>
278 <IsPartOfProject Value="True"/> 280 <IsPartOfProject Value="True"/>
279 <UnitName Value="SymParser"/> 281 <UnitName Value="SymParser"/>
280 </Unit17> 282 </Unit16>
281 <Unit18> 283 <Unit17>
282 <Filename Value="effecteditor.pas"/> 284 <Filename Value="effecteditor.pas"/>
283 <IsPartOfProject Value="True"/> 285 <IsPartOfProject Value="True"/>
284 <ComponentName Value="frmEffectEditor"/> 286 <ComponentName Value="frmEffectEditor"/>
285 <HasResources Value="True"/> 287 <HasResources Value="True"/>
286 <ResourceBaseClass Value="Form"/> 288 <ResourceBaseClass Value="Form"/>
287 </Unit18> 289 </Unit17>
288 <Unit19> 290 <Unit18>
289 <Filename Value="options.pas"/> 291 <Filename Value="options.pas"/>
290 <IsPartOfProject Value="True"/> 292 <IsPartOfProject Value="True"/>
291 <ComponentName Value="frmOptions"/> 293 <ComponentName Value="frmOptions"/>
292 <HasResources Value="True"/> 294 <HasResources Value="True"/>
293 <ResourceBaseClass Value="Form"/> 295 <ResourceBaseClass Value="Form"/>
294 </Unit19> 296 </Unit18>
295 <Unit20> 297 <Unit19>
296 <Filename Value="rendertowave.pas"/> 298 <Filename Value="rendertowave.pas"/>
297 <IsPartOfProject Value="True"/> 299 <IsPartOfProject Value="True"/>
298 <ComponentName Value="frmRenderToWave"/> 300 <ComponentName Value="frmRenderToWave"/>
299 <HasResources Value="True"/> 301 <HasResources Value="True"/>
300 <ResourceBaseClass Value="Form"/> 302 <ResourceBaseClass Value="Form"/>
301 <UnitName Value="RenderToWave"/> 303 <UnitName Value="RenderToWave"/>
302 </Unit20> 304 </Unit19>
303 <Unit21> 305 <Unit20>
304 <Filename Value="modimport.pas"/> 306 <Filename Value="modimport.pas"/>
305 <IsPartOfProject Value="True"/> 307 <IsPartOfProject Value="True"/>
306 <UnitName Value="MODImport"/> 308 <UnitName Value="MODImport"/>
307 </Unit21> 309 </Unit20>
308 <Unit22> 310 <Unit21>
309 <Filename Value="keymap.pas"/> 311 <Filename Value="keymap.pas"/>
310 <IsPartOfProject Value="True"/> 312 <IsPartOfProject Value="True"/>
311 <UnitName Value="Keymap"/> 313 <UnitName Value="Keymap"/>
312 </Unit22> 314 </Unit21>
313 <Unit23> 315 <Unit22>
314 <Filename Value="hugesettings.pas"/> 316 <Filename Value="hugesettings.pas"/>
315 <IsPartOfProject Value="True"/> 317 <IsPartOfProject Value="True"/>
316 <UnitName Value="hUGESettings"/> 318 <UnitName Value="hUGESettings"/>
317 </Unit23> 319 </Unit22>
318 <Unit24> 320 <Unit23>
319 <Filename Value="beepboximport.pas"/>
320 <IsPartOfProject Value="True"/>
321 <UnitName Value="BeepBoxImport"/>
322 </Unit24>
323 <Unit25>
324 <Filename Value="dmfimport.pas"/> 321 <Filename Value="dmfimport.pas"/>
325 <IsPartOfProject Value="True"/> 322 <IsPartOfProject Value="True"/>
326 <UnitName Value="DMFImport"/> 323 <UnitName Value="DMFImport"/>
327 </Unit25> 324 </Unit23>
328 </Units> 325 </Units>
329 </ProjectOptions> 326 </ProjectOptions>
330 <CompilerOptions> 327 <CompilerOptions>
@@ -361,6 +358,10 @@
361 </Debugging> 358 </Debugging>
362 </Linking> 359 </Linking>
363 <Other> 360 <Other>
361 <Verbosity>
362 <ShoLineNum Value="True"/>
363 </Verbosity>
364 <WriteFPCLogo Value="False"/>
364 <CustomOptions Value="-dBorland -dVer150 -dDelphi7 -dCompiler6_Up -dPUREPASCAL -dDEVELOPMENT"/> 365 <CustomOptions Value="-dBorland -dVer150 -dDelphi7 -dCompiler6_Up -dPUREPASCAL -dDEVELOPMENT"/>
365 </Other> 366 </Other>
366 </CompilerOptions> 367 </CompilerOptions>
Modifiedhugedatatypes.pas +287−27
@@ -5,53 +5,45 @@ unit HugeDatatypes;
5 interface 5 interface
6 6
7 uses 7 uses
8 Classes, SysUtils, fgl, instruments, waves; 8 Classes, SysUtils, fgl;
9 9
10 type 10 type
11 Nibble = $0..$F; 11 Nibble = $0..$F;
12 12
13 TRoutine = string; 13 TRoutine = string;
14 14
15 TInstrumentBankV1 = packed array[1..15] of TInstrumentV1;
16 TInstrumentCollectionV1 = packed record
17 case Boolean of
18 False: (Duty, Wave, Noise: TInstrumentBankV1);
19 True: (All: packed array[1..45] of TInstrumentV1);
20 end;
21
22 TInstrumentBankV2 = packed array[1..15] of TInstrumentV2;
23 TInstrumentCollectionV2 = packed record
24 case Boolean of
25 False: (Duty, Wave, Noise: TInstrumentBankV2);
26 True: (All: packed array[1..45] of TInstrumentV2);
27 end;
28
29 TInstrumentBank = TInstrumentBankV2;
30 TInstrumentCollection = TInstrumentCollectionV2;
31
32 TWaveBankV1 = packed array[0..15] of TWaveV1;
33 TWaveBankV2 = packed array[0..15] of TWaveV2;
34 TWaveBank = TWaveBankV2;
35 TRoutineBank = packed array[0..15] of TRoutine;
36
37 TEffectParams = bitpacked record 15 TEffectParams = bitpacked record
38 case Boolean of 16 case Boolean of
39 True: (Param2, Param1: Nibble); 17 True: (Param2, Param1: Nibble);
40 False: (Value: Byte); 18 False: (Value: Byte);
41 end; 19 end;
42 20
43 TCell = packed record 21 TCellV1 = packed record
22 Note: Integer;
23 Instrument: Integer;
24 EffectCode: Integer;
25 EffectParams: TEffectParams;
26 end;
27
28 TCellV2 = packed record
44 Note: Integer; 29 Note: Integer;
45 Instrument: Integer; 30 Instrument: Integer;
31 Volume: Integer;
46 EffectCode: Integer; 32 EffectCode: Integer;
47 EffectParams: TEffectParams; 33 EffectParams: TEffectParams;
48 end; 34 end;
35
36 TCell = TCellV2;
49 PCell = ^TCell; 37 PCell = ^TCell;
50 38
51 TPattern = packed array[0..63] of TCell; 39 TPatternV1 = packed array[0..63] of TCellV1;
52 PPattern = ^TPattern; 40 PPatternV1 = ^TPatternV1;
41
42 TPatternV2 = packed array[0..63] of TCellV2;
43 TPattern = TPatternV2;
44 PPattern = ^TPatternV2;
53 45
54 //TPatternMap = specialize TFPGMap<Integer, PPattern>; 46 TPatternMapV1 = specialize TFPGMap<Integer, PPatternV1>;
55 TPatternMap = class(specialize TFPGMap<Integer, PPattern>) 47 TPatternMap = class(specialize TFPGMap<Integer, PPattern>)
56 function GetOrCreateNew(Key: Integer): PPattern; 48 function GetOrCreateNew(Key: Integer): PPattern;
57 function MaxKey: Integer; 49 function MaxKey: Integer;
@@ -61,6 +53,260 @@ type
61 destructor Destroy; override; 53 destructor Destroy; override;
62 end; 54 end;
63 55
56 TWaveV1 = packed array[0..32] of Byte;
57 TWaveV2 = packed array[0..31] of Byte;
58 TWave = TWaveV2;
59 T4bitWave = packed array[0..15] of Byte;
60
61 TInstrumentType = (itSquare = 0, itWave = 1, itNoise = 2);
62 TDutyType = 0..3;
63 TSweepType = (stUp, stDown);
64 TStepWidth = (swFifteen, swSeven);
65 TEnvelopeVolume = 0..15;
66 TEnvelopeSweepAmount = 0..7;
67 TNoiseMacro = array[0..5] of -31..32;
68
69 TInstrumentV1 = packed record
70 Type_: TInstrumentType;
71
72 Name: ShortString;
73 Length: Integer;
74 // Highmask
75 LengthEnabled: Boolean;
76
77 InitialVolume: TEnvelopeVolume;
78 VolSweepDirection: TSweepType;
79 VolSweepAmount: TEnvelopeSweepAmount;
80
81 // itSquare
82 // NR10
83 SweepTime: Integer;
84 SweepIncDec: TSweepType;
85 SweepShift: Integer;
86
87 // NR11
88 Duty: TDutyType;
89
90 // itWave
91
92 // NR32
93 OutputLevel: Integer;
94 // itWave
95 Waveform: Integer;
96
97 // itNoise
98 // NR42
99 ShiftClockFreq: Integer; // Unused
100 CounterStep: TStepWidth;
101 DividingRatio: Integer;
102 end;
103
104 TInstrumentV2 = packed record
105 Type_: TInstrumentType;
106
107 Name: ShortString;
108 Length: Integer;
109 // Highmask
110 LengthEnabled: Boolean;
111
112 InitialVolume: TEnvelopeVolume;
113 VolSweepDirection: TSweepType;
114 VolSweepAmount: TEnvelopeSweepAmount;
115
116 // itSquare
117 // NR10
118 SweepTime: Integer;
119 SweepIncDec: TSweepType;
120 SweepShift: Integer;
121
122 // NR11
123 Duty: TDutyType;
124
125 // itWave
126
127 // NR32
128 OutputLevel: Integer;
129 // itWave
130 Waveform: Integer;
131
132 // itNoise
133 // NR42
134 ShiftClockFreq: Integer; // Unused
135 CounterStep: TStepWidth;
136 DividingRatio: Integer;
137 NoiseMacro: TNoiseMacro;
138 end;
139
140 TInstrumentV3 = packed record
141 Type_: TInstrumentType;
142
143 Name: ShortString;
144 Length: Integer;
145 // Highmask
146 LengthEnabled: Boolean;
147
148 InitialVolume: TEnvelopeVolume;
149 VolSweepDirection: TSweepType;
150 VolSweepAmount: TEnvelopeSweepAmount;
151
152 // itSquare
153 // NR10
154 SweepTime: Integer;
155 SweepIncDec: TSweepType;
156 SweepShift: Integer;
157
158 // NR11
159 Duty: TDutyType;
160
161 // itWave
162
163 // NR32
164 OutputLevel: Integer;
165 // itWave
166 Waveform: Integer;
167
168 // itNoise
169 // NR42
170 CounterStep: TStepWidth;
171 SubpatternEnabled: Boolean;
172 Subpattern: TPattern;
173 end;
174
175 TInstrument = TInstrumentV3;
176
177 TAsmInstrument = array[0..3] of Byte;
178
179 TRegisters = record
180 case Type_: TInstrumentType of
181 itSquare: (NR10, NR11, NR12, NR13, NR14: Byte);
182 itWave: (NR30, NR31, NR32, NR33, NR34: Byte);
183 itNoise: (NR41, NR42, NR43, NR44: Byte);
184 end;
185
186 Bit = Boolean;
187 TwoBits = 0..%11;
188 ThreeBits = 0..%111;
189 FourBits = 0..%1111;
190 FiveBits = 0..%11111;
191 SixBits = 0..%111111;
192 SevenBits = 0..%1111111;
193 EightBits = Byte;
194
195 TSweepRegister = bitpacked record
196 case Boolean of
197 True: (
198 Shift: ThreeBits;
199 IncDec: Bit;
200 SweepTime: ThreeBits;
201 _: Bit;
202 );
203 False: (ByteValue: Byte);
204 end;
205
206 TSquareLengthRegister = bitpacked record
207 case Boolean of
208 True: (
209 Length: SixBits;
210 Duty: TwoBits;
211 );
212 False: (ByteValue: Byte);
213 end;
214
215 TEnvelopeRegister = bitpacked record
216 case Boolean of
217 True: (
218 SweepNumber: ThreeBits;
219 Direction: Bit;
220 InitialVolume: FourBits;
221 );
222 False: (ByteValue: Byte);
223 end;
224
225 TLowByteRegister = Byte;
226
227 THighByteRegister = bitpacked record
228 case Boolean of
229 True: (
230 FrequencyBits: ThreeBits;
231 _Padding: ThreeBits;
232 UseLength: Bit;
233 Initial: Bit;
234 );
235 False: (ByteValue: Byte);
236 end;
237
238 TCh3SoundOnOffRegister = bitpacked record
239 case Boolean of
240 True: (
241 _Padding: SevenBits;
242 Playback: Bit;
243 );
244 False: (ByteValue: Byte);
245 end;
246
247 TCh3SoundLengthRegister = Byte;
248
249 TCh3OutputLevelRegister = bitpacked record
250 case Boolean of
251 True: (
252 _Padding: FiveBits;
253 OutputLevel: TwoBits;
254 _Padding2: Bit;
255 );
256 False: (ByteValue: Byte);
257 end;
258
259 TCh4SoundLengthRegister = 0..63;
260
261 TPolynomialCounterRegister = bitpacked record
262 case Boolean of
263 True: (
264 DividingRatio: ThreeBits;
265 SevenBitCounter: Bit;
266 ShiftClockFrequency: FourBits;
267 );
268 False: (ByteValue: Byte);
269 end;
270
271 TCh4HighByteRegister = bitpacked record
272 case Boolean of
273 True: (
274 _Padding: SixBits;
275 UseLength: Bit;
276 Initial: Bit;
277 );
278 False: (ByteValue: Byte);
279 end;
280
281 TInstrumentBankV1 = packed array[1..15] of TInstrumentV1;
282 TInstrumentCollectionV1 = packed record
283 case Boolean of
284 False: (Duty, Wave, Noise: TInstrumentBankV1);
285 True: (All: packed array[1..45] of TInstrumentV1);
286 end;
287
288 TInstrumentBankV2 = packed array[1..15] of TInstrumentV2;
289 TInstrumentCollectionV2 = packed record
290 case Boolean of
291 False: (Duty, Wave, Noise: TInstrumentBankV2);
292 True: (All: packed array[1..45] of TInstrumentV2);
293 end;
294
295 TInstrumentBankV3 = packed array[1..15] of TInstrumentV3;
296 TInstrumentCollectionV3 = packed record
297 case Boolean of
298 False: (Duty, Wave, Noise: TInstrumentBankV3);
299 True: (All: packed array[1..45] of TInstrumentV3);
300 end;
301
302 TInstrumentBank = TInstrumentBankV3;
303 TInstrumentCollection = TInstrumentCollectionV3;
304
305 TWaveBankV1 = packed array[0..15] of TWaveV1;
306 TWaveBankV2 = packed array[0..15] of TWaveV2;
307 TWaveBank = TWaveBankV2;
308 TRoutineBank = packed array[0..15] of TRoutine;
309
64 TOrderMatrix = packed array[0..3] of array of Integer; 310 TOrderMatrix = packed array[0..3] of array of Integer;
65 311
66 TCellPart = ( 312 TCellPart = (
@@ -93,6 +339,20 @@ operator = (L, R: TSelectionPos): Boolean;
93 procedure IncSelectionPos(var SP: TSelectionPos); 339 procedure IncSelectionPos(var SP: TSelectionPos);
94 procedure DecSelectionPos(var SP: TSelectionPos); 340 procedure DecSelectionPos(var SP: TSelectionPos);
95 341
342 const
343 DefaultWaves: array[0..10] of TWave =
344 (($0,$0,$0,$0,$f,$f,$f,$f,$f,$f,$f,$f,$f,$f,$f,$f,$f,$f,$f,$f,$f,$f,$f,$f,$f,$f,$f,$f,$f,$f,$f,$f),
345 ($0,$0,$0,$0,$0,$0,$0,$0,$f,$f,$f,$f,$f,$f,$f,$f,$f,$f,$f,$f,$f,$f,$f,$f,$f,$f,$f,$f,$f,$f,$f,$f),
346 ($0,$0,$0,$0,$0,$0,$0,$0,$0,$0,$0,$0,$0,$0,$0,$0,$f,$f,$f,$f,$f,$f,$f,$f,$f,$f,$f,$f,$f,$f,$f,$f),
347 ($0,$0,$0,$0,$0,$0,$0,$0,$0,$0,$0,$0,$0,$0,$0,$0,$0,$0,$0,$0,$0,$0,$0,$0,$f,$f,$f,$f,$f,$f,$f,$f),
348 ($0,$0,$0,$1,$1,$2,$2,$3,$3,$4,$4,$5,$5,$6,$6,$7,$7,$8,$8,$9,$9,$a,$a,$b,$b,$c,$c,$d,$d,$e,$e,$f),
349 ($f,$e,$d,$c,$b,$a,$9,$8,$7,$6,$5,$4,$3,$2,$1,$0,$1,$2,$3,$4,$5,$6,$7,$8,$9,$a,$b,$c,$d,$e,$f,$f),
350 ($7,$a,$c,$d,$d,$b,$7,$5,$2,$1,$1,$3,$6,$8,$b,$d,$d,$c,$9,$7,$4,$1,$0,$1,$4,$7,$9,$c,$d,$d,$b,$8),
351 ($0,$f,$0,$f,$0,$f,$0,$f,$0,$f,$0,$f,$0,$f,$0,$f,$0,$f,$0,$f,$0,$f,$0,$f,$0,$f,$0,$f,$0,$f,$0,$f),
352 ($f,$e,$f,$c,$f,$a,$f,$8,$f,$6,$f,$4,$f,$2,$f,$0,$f,$2,$f,$4,$f,$6,$f,$8,$f,$a,$f,$c,$f,$e,$f,$f),
353 ($f,$e,$d,$d,$c,$c,$b,$b,$a,$a,$9,$9,$8,$8,$7,$7,$8,$a,$b,$d,$f,$1,$2,$4,$5,$7,$8,$a,$b,$d,$e,$e),
354 ($8,$4,$1,$1,$6,$1,$e,$d,$5,$7,$4,$7,$5,$a,$a,$d,$c,$e,$a,$3,$1,$7,$7,$9,$d,$d,$2,$0,$0,$3,$4,$7));
355
96 implementation 356 implementation
97 357
98 uses Utils; 358 uses Utils;
Modifiedinstruments.pas +4−190
@@ -5,193 +5,7 @@ unit instruments;
5 interface 5 interface
6 6
7 uses 7 uses
8 Classes, SysUtils; 8 Classes, SysUtils, HugeDatatypes;
9
10 type
11 TInstrumentType = (itSquare = 0, itWave = 1, itNoise = 2);
12 TDutyType = 0..3;
13 TSweepType = (stUp, stDown);
14 TStepWidth = (swFifteen, swSeven);
15 TEnvelopeVolume = 0..15;
16 TEnvelopeSweepAmount = 0..7;
17 TNoiseMacro = array[0..5] of -31..32;
18
19 TInstrumentV1 = packed record
20 Type_: TInstrumentType;
21
22 Name: ShortString;
23 Length: Integer;
24 // Highmask
25 LengthEnabled: Boolean;
26
27 InitialVolume: TEnvelopeVolume;
28 VolSweepDirection: TSweepType;
29 VolSweepAmount: TEnvelopeSweepAmount;
30
31 // itSquare
32 // NR10
33 SweepTime: Integer;
34 SweepIncDec: TSweepType;
35 SweepShift: Integer;
36
37 // NR11
38 Duty: TDutyType;
39
40 // itWave
41
42 // NR32
43 OutputLevel: Integer;
44 // itWave
45 Waveform: Integer;
46
47 // itNoise
48 // NR42
49 ShiftClockFreq: Integer; // Unused
50 CounterStep: TStepWidth;
51 DividingRatio: Integer;
52 end;
53
54 TInstrumentV2 = packed record
55 Type_: TInstrumentType;
56
57 Name: ShortString;
58 Length: Integer;
59 // Highmask
60 LengthEnabled: Boolean;
61
62 InitialVolume: TEnvelopeVolume;
63 VolSweepDirection: TSweepType;
64 VolSweepAmount: TEnvelopeSweepAmount;
65
66 // itSquare
67 // NR10
68 SweepTime: Integer;
69 SweepIncDec: TSweepType;
70 SweepShift: Integer;
71
72 // NR11
73 Duty: TDutyType;
74
75 // itWave
76
77 // NR32
78 OutputLevel: Integer;
79 // itWave
80 Waveform: Integer;
81
82 // itNoise
83 // NR42
84 ShiftClockFreq: Integer; // Unused
85 CounterStep: TStepWidth;
86 DividingRatio: Integer;
87 NoiseMacro: TNoiseMacro;
88 end;
89
90 TInstrument = TInstrumentV2;
91
92 TAsmInstrument = array[0..3] of Byte;
93
94 TRegisters = record
95 case Type_: TInstrumentType of
96 itSquare: (NR10, NR11, NR12, NR13, NR14: Byte);
97 itWave: (NR30, NR31, NR32, NR33, NR34: Byte);
98 itNoise: (NR41, NR42, NR43, NR44: Byte);
99 end;
100
101 Bit = Boolean;
102 TwoBits = 0..%11;
103 ThreeBits = 0..%111;
104 FourBits = 0..%1111;
105 FiveBits = 0..%11111;
106 SixBits = 0..%111111;
107 SevenBits = 0..%1111111;
108 EightBits = Byte;
109
110 TSweepRegister = bitpacked record
111 case Boolean of
112 True: (
113 Shift: ThreeBits;
114 IncDec: Bit;
115 SweepTime: ThreeBits;
116 _: Bit;
117 );
118 False: (ByteValue: Byte);
119 end;
120
121 TSquareLengthRegister = bitpacked record
122 case Boolean of
123 True: (
124 Length: SixBits;
125 Duty: TwoBits;
126 );
127 False: (ByteValue: Byte);
128 end;
129
130 TEnvelopeRegister = bitpacked record
131 case Boolean of
132 True: (
133 SweepNumber: ThreeBits;
134 Direction: Bit;
135 InitialVolume: FourBits;
136 );
137 False: (ByteValue: Byte);
138 end;
139
140 TLowByteRegister = Byte;
141
142 THighByteRegister = bitpacked record
143 case Boolean of
144 True: (
145 FrequencyBits: ThreeBits;
146 _Padding: ThreeBits;
147 UseLength: Bit;
148 Initial: Bit;
149 );
150 False: (ByteValue: Byte);
151 end;
152
153 TCh3SoundOnOffRegister = bitpacked record
154 case Boolean of
155 True: (
156 _Padding: SevenBits;
157 Playback: Bit;
158 );
159 False: (ByteValue: Byte);
160 end;
161
162 TCh3SoundLengthRegister = Byte;
163
164 TCh3OutputLevelRegister = bitpacked record
165 case Boolean of
166 True: (
167 _Padding: FiveBits;
168 OutputLevel: TwoBits;
169 _Padding2: Bit;
170 );
171 False: (ByteValue: Byte);
172 end;
173
174 TCh4SoundLengthRegister = 0..63;
175
176 TPolynomialCounterRegister = bitpacked record
177 case Boolean of
178 True: (
179 DividingRatio: ThreeBits;
180 SevenBitCounter: Bit;
181 ShiftClockFrequency: FourBits;
182 );
183 False: (ByteValue: Byte);
184 end;
185
186 TCh4HighByteRegister = bitpacked record
187 case Boolean of
188 True: (
189 _Padding: SixBits;
190 UseLength: Bit;
191 Initial: Bit;
192 );
193 False: (ByteValue: Byte);
194 end;
195 9
196 function NoiseInstrumentToRegisters( 10 function NoiseInstrumentToRegisters(
197 Frequency: Word; 11 Frequency: Word;
@@ -246,8 +60,8 @@ begin
246 60
247 // Because *InstrumentToRegisters is meant for previewing, it puts in 61 // Because *InstrumentToRegisters is meant for previewing, it puts in
248 // a value for shift clock freq, so we have to remove it and put in the mask 62 // a value for shift clock freq, so we have to remove it and put in the mask
249 // instead. 63 // instead. The mask is a leftover from old versions, so it's always zero.
250 Poly.ShiftClockFrequency := Instrument.ShiftClockFreq; 64 Poly.ShiftClockFrequency := 0;
251 Result[3] := Regs.NR44; 65 Result[3] := Regs.NR44;
252 end; 66 end;
253 67
@@ -320,7 +134,7 @@ begin
320 134
321 NR43.ShiftClockFrequency := $F - (Frequency shr 7); // Quantize CH4 note 135 NR43.ShiftClockFrequency := $F - (Frequency shr 7); // Quantize CH4 note
322 136
323 NR43.DividingRatio:= Instr.DividingRatio; 137 NR43.DividingRatio:= 0; //Instr.DividingRatio;
324 NR43.SevenBitCounter:=Instr.CounterStep = swSeven; 138 NR43.SevenBitCounter:=Instr.CounterStep = swSeven;
325 139
326 NR44.Initial:= Initial; 140 NR44.Initial:= Initial;
Modifiedoptions.pas +1−1
@@ -252,7 +252,7 @@ begin
252 if Assigned(SampleTrackerGrid) then 252 if Assigned(SampleTrackerGrid) then
253 SampleTrackerGrid.Free; 253 SampleTrackerGrid.Free;
254 254
255 SampleTrackerGrid := TTrackerGrid.Create(Self, SampleTrackerGridPanel, SamplePatternMap); 255 SampleTrackerGrid := TTrackerGrid.Create(Self, SampleTrackerGridPanel, SamplePatternMap, 4);
256 SampleTrackerGrid.FontSize := FontSizeSpinner.Value; 256 SampleTrackerGrid.FontSize := FontSizeSpinner.Value;
257 for I := 0 to 3 do 257 for I := 0 to 3 do
258 SampleTrackerGrid.LoadPattern(I, 0); 258 SampleTrackerGrid.LoadPattern(I, 0);
Deletedsetup-windows-dev.bat +0−21
@@ -1,21 +0,0 @@
1 set outdir=lib\Development\x86_64-win64
2 mkdir %outdir%
3
4 copy Resources\Fonts\PixeliteTTF.ttf %outdir%\
5 if not errorlevel 0 goto copyfail
6
7 copy Resources\Libs\SDL2.dll %outdir%\
8 if not errorlevel 0 goto copyfail
9
10 Xcopy /E /I /Y hUGEDriver %outdir%\hUGEDriver
11 if not errorlevel 0 goto copyfail
12
13 Xcopy /E /I /Y "Resources\Sample Songs" "%outdir%\Sample Songs"
14 if not errorlevel 0 goto copyfail
15
16 exit/b 0
17
18 :copyfail
19
20 echo Error while copying required files!
21 exit/b 1
Modifiedsong.pas +184−40
@@ -7,9 +7,11 @@ unit Song;
7 7
8 interface 8 interface
9 9
10 uses Classes, HugeDatatypes, instruments, Constants, waves, math; 10 uses Classes, HugeDatatypes, instruments, Constants, math, sysutils;
11 11
12 type 12 type
13 ESongVersionException = class(Exception);
14
13 TSongV1 = packed record 15 TSongV1 = packed record
14 Version: Integer; 16 Version: Integer;
15 17
@@ -22,7 +24,7 @@ type
22 24
23 TicksPerRow: Integer; 25 TicksPerRow: Integer;
24 26
25 Patterns: TPatternMap; 27 Patterns: TPatternMapV1;
26 OrderMatrix: TOrderMatrix; 28 OrderMatrix: TOrderMatrix;
27 end; 29 end;
28 30
@@ -38,7 +40,7 @@ type
38 40
39 TicksPerRow: Integer; 41 TicksPerRow: Integer;
40 42
41 Patterns: TPatternMap; 43 Patterns: TPatternMapV1;
42 OrderMatrix: TOrderMatrix; 44 OrderMatrix: TOrderMatrix;
43 45
44 Routines: TRoutineBank; 46 Routines: TRoutineBank;
@@ -52,11 +54,11 @@ type
52 Comment: ShortString; 54 Comment: ShortString;
53 55
54 Instruments: TInstrumentCollectionV1; 56 Instruments: TInstrumentCollectionV1;
55 Waves: TWaveBankV2; 57 Waves: TWaveBank;
56 58
57 TicksPerRow: Integer; 59 TicksPerRow: Integer;
58 60
59 Patterns: TPatternMap; 61 Patterns: TPatternMapV1;
60 OrderMatrix: TOrderMatrix; 62 OrderMatrix: TOrderMatrix;
61 63
62 Routines: TRoutineBank; 64 Routines: TRoutineBank;
@@ -70,11 +72,11 @@ type
70 Comment: ShortString; 72 Comment: ShortString;
71 73
72 Instruments: TInstrumentCollectionV2; 74 Instruments: TInstrumentCollectionV2;
73 Waves: TWaveBankV2; 75 Waves: TWaveBank;
74 76
75 TicksPerRow: Integer; 77 TicksPerRow: Integer;
76 78
77 Patterns: TPatternMap; 79 Patterns: TPatternMapV1;
78 OrderMatrix: TOrderMatrix; 80 OrderMatrix: TOrderMatrix;
79 81
80 Routines: TRoutineBank; 82 Routines: TRoutineBank;
@@ -82,9 +84,27 @@ type
82 84
83 TSongV5 = TSongV4; // no structural differences 85 TSongV5 = TSongV4; // no structural differences
84 86
87 TSongV6 = packed record
88 Version: Integer;
89
90 Name: ShortString;
91 Artist: ShortString;
92 Comment: ShortString;
93
94 Instruments: TInstrumentCollection;
95 Waves: TWaveBank;
96
97 TicksPerRow: Integer;
98
99 Patterns: TPatternMap;
100 OrderMatrix: TOrderMatrix;
101
102 Routines: TRoutineBank;
103 end;
104
85 { TSong } 105 { TSong }
86 106
87 TSong = TSongV5; 107 TSong = TSongV6;
88 108
89 procedure WriteSongToStream(S: TStream; const ASong: TSong); 109 procedure WriteSongToStream(S: TStream; const ASong: TSong);
90 procedure ReadSongFromStream(S: TStream; out ASong: TSong); 110 procedure ReadSongFromStream(S: TStream; out ASong: TSong);
@@ -96,33 +116,36 @@ function UpgradeSong(S: TSongV1): TSong; overload;
96 function UpgradeSong(S: TSongV2): TSong; overload; 116 function UpgradeSong(S: TSongV2): TSong; overload;
97 function UpgradeSong(S: TSongV3): TSong; overload; 117 function UpgradeSong(S: TSongV3): TSong; overload;
98 function UpgradeSong(S: TSongV4): TSong; overload; 118 function UpgradeSong(S: TSongV4): TSong; overload;
119 //function UpgradeSong(S: TSongV5): TSong; overload;
99 120
100 function OptimizeSong(const S: TSong): TSong; 121 function OptimizeSong(const S: TSong): TSong;
101 function PatternIsUsed(Idx: Integer; const Song: TSong): Boolean; 122 function PatternIsUsed(Idx: Integer; const Song: TSong): Boolean;
102 123
103 implementation 124 implementation
104 125
126 uses Utils;
127
105 // Thanks to WP on the FreePascal forums for this code! 128 // Thanks to WP on the FreePascal forums for this code!
106 // https://forum.lazarus.freepascal.org/index.php/topic,47892.msg344152.html#msg344152 129 // https://forum.lazarus.freepascal.org/index.php/topic,47892.msg344152.html#msg344152
107 130
108 procedure ReadSongFromStreamV1(S: TStream; out ASong: TSongV1); 131 procedure ReadSongFromStreamV1(S: TStream; out ASong: TSongV1);
109 var 132 var
110 i, n: Integer; 133 i, n: Integer;
111 pat: PPattern; 134 pat: PPatternV1;
112 begin 135 begin
113 // Read the fixed elements first 136 // Read the fixed elements first
114 n := SizeOf(TSongV1) - SizeOf(TPatternMap) - SizeOf(TOrderMatrix); 137 n := SizeOf(TSongV1) - SizeOf(TPatternMapV1) - SizeOf(TOrderMatrix);
115 S.Read(ASong, n); 138 S.Read(ASong, n);
116 139
117 // Create the patterns 140 // Create the patterns
118 ASong.Patterns := TPatternMap.Create; 141 ASong.Patterns := TPatternMapV1.Create;
119 // Read the pattern count 142 // Read the pattern count
120 S.Read(n, SizeOf(Integer)); 143 S.Read(n, SizeOf(Integer));
121 for i:=0 to n - 1 do begin 144 for i:=0 to n - 1 do begin
122 // Allocate memory for each pattern ... 145 // Allocate memory for each pattern ...
123 New(pat); 146 New(pat);
124 // and read the pattern content 147 // and read the pattern content
125 S.Read(pat^, SizeOf(TPattern)); 148 S.Read(pat^, SizeOf(TPatternV1));
126 // Add the pattern to the list 149 // Add the pattern to the list
127 ASong.Patterns.Add(i, pat); 150 ASong.Patterns.Add(i, pat);
128 end; 151 end;
@@ -142,25 +165,25 @@ end;
142 procedure ReadSongFromStreamV2(S: TStream; out ASong: TSongV2); 165 procedure ReadSongFromStreamV2(S: TStream; out ASong: TSongV2);
143 var 166 var
144 i, n: Integer; 167 i, n: Integer;
145 pat: PPattern; 168 pat: PPatternV1;
146 begin 169 begin
147 // Read the fixed elements first 170 // Read the fixed elements first
148 n := SizeOf(TSongV2) 171 n := SizeOf(TSongV2)
149 - SizeOf(TPatternMap) 172 - SizeOf(TPatternMapV1)
150 - SizeOf(TOrderMatrix) 173 - SizeOf(TOrderMatrix)
151 - SizeOf(TRoutineBank); 174 - SizeOf(TRoutineBank);
152 175
153 S.Read(ASong, n); 176 S.Read(ASong, n);
154 177
155 // Create the patterns 178 // Create the patterns
156 ASong.Patterns := TPatternMap.Create; 179 ASong.Patterns := TPatternMapV1.Create;
157 // Read the pattern count 180 // Read the pattern count
158 S.Read(n, SizeOf(Integer)); 181 S.Read(n, SizeOf(Integer));
159 for i:=0 to n - 1 do begin 182 for i:=0 to n - 1 do begin
160 // Allocate memory for each pattern ... 183 // Allocate memory for each pattern ...
161 New(pat); 184 New(pat);
162 // and read the pattern content 185 // and read the pattern content
163 S.Read(pat^, SizeOf(TPattern)); 186 S.Read(pat^, SizeOf(TPatternV1));
164 // Add the pattern to the list 187 // Add the pattern to the list
165 ASong.Patterns.Add(i, pat); 188 ASong.Patterns.Add(i, pat);
166 end; 189 end;
@@ -183,25 +206,25 @@ end;
183 procedure ReadSongFromStreamV3(S: TStream; out ASong: TSongV3); 206 procedure ReadSongFromStreamV3(S: TStream; out ASong: TSongV3);
184 var 207 var
185 i, n: Integer; 208 i, n: Integer;
186 pat: PPattern; 209 pat: PPatternV1;
187 begin 210 begin
188 // Read the fixed elements first 211 // Read the fixed elements first
189 n := SizeOf(TSongV3) 212 n := SizeOf(TSongV3)
190 - SizeOf(TPatternMap) 213 - SizeOf(TPatternMapV1)
191 - SizeOf(TOrderMatrix) 214 - SizeOf(TOrderMatrix)
192 - SizeOf(TRoutineBank); 215 - SizeOf(TRoutineBank);
193 216
194 S.Read(ASong, n); 217 S.Read(ASong, n);
195 218
196 // Create the patterns 219 // Create the patterns
197 ASong.Patterns := TPatternMap.Create; 220 ASong.Patterns := TPatternMapV1.Create;
198 // Read the pattern count 221 // Read the pattern count
199 S.Read(n, SizeOf(Integer)); 222 S.Read(n, SizeOf(Integer));
200 for i:=0 to n - 1 do begin 223 for i:=0 to n - 1 do begin
201 // Allocate memory for each pattern ... 224 // Allocate memory for each pattern ...
202 New(pat); 225 New(pat);
203 // and read the pattern content 226 // and read the pattern content
204 S.Read(pat^, SizeOf(TPattern)); 227 S.Read(pat^, SizeOf(TPatternV1));
205 // Add the pattern to the list 228 // Add the pattern to the list
206 ASong.Patterns.Add(i, pat); 229 ASong.Patterns.Add(i, pat);
207 end; 230 end;
@@ -224,25 +247,25 @@ end;
224 procedure ReadSongFromStreamV4(S: TStream; out ASong: TSongV4); 247 procedure ReadSongFromStreamV4(S: TStream; out ASong: TSongV4);
225 var 248 var
226 i, n: Integer; 249 i, n: Integer;
227 pat: PPattern; 250 pat: PPatternV1;
228 begin 251 begin
229 // Read the fixed elements first 252 // Read the fixed elements first
230 n := SizeOf(TSongV4) 253 n := SizeOf(TSongV4)
231 - SizeOf(TPatternMap) 254 - SizeOf(TPatternMapV1)
232 - SizeOf(TOrderMatrix) 255 - SizeOf(TOrderMatrix)
233 - SizeOf(TRoutineBank); 256 - SizeOf(TRoutineBank);
234 257
235 S.Read(ASong, n); 258 S.Read(ASong, n);
236 259
237 // Create the patterns 260 // Create the patterns
238 ASong.Patterns := TPatternMap.Create; 261 ASong.Patterns := TPatternMapV1.Create;
239 // Read the pattern count 262 // Read the pattern count
240 S.Read(n, SizeOf(Integer)); 263 S.Read(n, SizeOf(Integer));
241 for i:=0 to n - 1 do begin 264 for i:=0 to n - 1 do begin
242 // Allocate memory for each pattern ... 265 // Allocate memory for each pattern ...
243 New(pat); 266 New(pat);
244 // and read the pattern content 267 // and read the pattern content
245 S.Read(pat^, SizeOf(TPattern)); 268 S.Read(pat^, SizeOf(TPatternV1));
246 // Add the pattern to the list 269 // Add the pattern to the list
247 ASong.Patterns.Add(i, pat); 270 ASong.Patterns.Add(i, pat);
248 end; 271 end;
@@ -265,10 +288,53 @@ end;
265 procedure ReadSongFromStreamV5(S: TStream; out ASong: TSongV5); 288 procedure ReadSongFromStreamV5(S: TStream; out ASong: TSongV5);
266 var 289 var
267 i, n, PatKey: Integer; 290 i, n, PatKey: Integer;
268 pat: PPattern; 291 pat: PPatternV1;
269 begin 292 begin
270 // Read the fixed elements first 293 // Read the fixed elements first
271 n := SizeOf(TSongV5) 294 n := SizeOf(TSongV5)
295 - SizeOf(TPatternMapV1)
296 - SizeOf(TOrderMatrix)
297 - SizeOf(TRoutineBank);
298
299 S.Read(ASong, n);
300
301 // Create the patterns
302 ASong.Patterns := TPatternMapV1.Create;
303 // Read the pattern count
304 S.Read(n, SizeOf(Integer));
305 for i:=0 to n - 1 do begin
306 // Read pattern key
307 S.Read(PatKey, SizeOf(Integer));
308 // Allocate memory for each pattern ...
309 New(pat);
310 // and read the pattern content
311 S.Read(pat^, SizeOf(TPatternV1));
312 // Add the pattern to the list
313 ASong.Patterns.Add(PatKey, pat);
314 end;
315
316 // Read the OrderMatrix
317 for i := 0 to 3 do
318 begin
319 // Read length of each OrderMatrix array
320 S.Read(n, SizeOf(Integer));
321 // Allocate memory for it
322 SetLength(ASong.OrderMatrix[i], n);
323 // Read content of OrderMatrix array
324 S.Read(ASong.OrderMatrix[i, 0], n*SizeOf(Integer));
325 end;
326
327 for I := Low(TRoutineBank) to High(TRoutineBank) do
328 ASong.Routines[I] := S.ReadAnsiString;
329 end;
330
331 procedure ReadSongFromStreamV6(S: TStream; out ASong: TSongV6);
332 var
333 i, n, PatKey: Integer;
334 pat: PPattern;
335 begin
336 // Read the fixed elements first
337 n := SizeOf(TSongV6)
272 - SizeOf(TPatternMap) 338 - SizeOf(TPatternMap)
273 - SizeOf(TOrderMatrix) 339 - SizeOf(TOrderMatrix)
274 - SizeOf(TRoutineBank); 340 - SizeOf(TRoutineBank);
@@ -310,7 +376,7 @@ var
310 i, n: Integer; 376 i, n: Integer;
311 begin 377 begin
312 // Write the fixed record elements first 378 // Write the fixed record elements first
313 n := SizeOf(TSongV5) 379 n := SizeOf(TSong)
314 - SizeOf(TPatternMap) 380 - SizeOf(TPatternMap)
315 - SizeOf(TOrderMatrix) 381 - SizeOf(TOrderMatrix)
316 - SizeOf(TRoutineBank); 382 - SizeOf(TRoutineBank);
@@ -345,6 +411,7 @@ var
345 SV2: TSongV2; 411 SV2: TSongV2;
346 SV3: TSongV3; 412 SV3: TSongV3;
347 SV4: TSongV4; 413 SV4: TSongV4;
414 SV5: TSongV5;
348 begin 415 begin
349 S.Read(Version, SizeOf(Integer)); 416 S.Read(Version, SizeOf(Integer));
350 S.Seek(0, soBeginning); 417 S.Seek(0, soBeginning);
@@ -366,7 +433,14 @@ begin
366 ASong := UpgradeSong(SV4); 433 ASong := UpgradeSong(SV4);
367 end; 434 end;
368 5: begin 435 5: begin
369 ReadSongFromStreamV5(S, ASong); 436 ReadSongFromStreamV5(S, SV5);
437 ASong := UpgradeSong(SV5);
438 end;
439 6: begin
440 ReadSongFromStreamV6(S, ASong);
441 end;
442 else begin
443 raise ESongVersionException.Create(IntToStr(Version));
370 end; 444 end;
371 end; 445 end;
372 end; 446 end;
@@ -382,8 +456,10 @@ begin
382 Comment := ''; 456 Comment := '';
383 end; 457 end;
384 458
385 for I := Low(S.Instruments.All) to High(S.Instruments.All) do 459 for I := Low(S.Instruments.All) to High(S.Instruments.All) do begin
386 S.Instruments.All[I] := Default(TInstrument); 460 S.Instruments.All[I] := Default(TInstrument);
461 BlankPattern(@S.Instruments.All[I].Subpattern);
462 end;
387 463
388 for I := Low(S.Instruments.Duty) to High(S.Instruments.Duty) do begin 464 for I := Low(S.Instruments.Duty) to High(S.Instruments.Duty) do begin
389 with S.Instruments.Duty[I] do begin 465 with S.Instruments.Duty[I] do begin
@@ -421,9 +497,6 @@ begin
421 InitialVolume := High(TEnvelopeVolume); 497 InitialVolume := High(TEnvelopeVolume);
422 VolSweepDirection := stDown; 498 VolSweepDirection := stDown;
423 VolSweepAmount := 0; 499 VolSweepAmount := 0;
424 NoiseMacro := Default(TNoiseMacro);
425 ShiftClockFreq := 0;
426 DividingRatio := 0;
427 CounterStep := swFifteen; 500 CounterStep := swFifteen;
428 end; 501 end;
429 502
@@ -606,7 +679,7 @@ var
606 Result := False; 679 Result := False;
607 end; 680 end;
608 681
609 procedure ConvertPattern(var Pat: TPattern); 682 procedure ConvertPattern(var Pat: TPatternV2);
610 var 683 var
611 I: Integer; 684 I: Integer;
612 Regs: TRegisters; 685 Regs: TRegisters;
@@ -617,7 +690,7 @@ var
617 for I := Low(Pat) to High(Pat) do begin 690 for I := Low(Pat) to High(Pat) do begin
618 if (Pat[I].Instrument = 0) or (Pat[I].Note = NO_NOTE) then Continue; 691 if (Pat[I].Instrument = 0) or (Pat[I].Note = NO_NOTE) then Continue;
619 692
620 Regs := NoiseInstrumentToRegisters(NotesToFreqs.KeyData[Pat[I].Note], False, SV4.Instruments.Noise[Pat[I].Instrument]); 693 Regs := NoiseInstrumentToRegisters(NotesToFreqs.KeyData[Pat[I].Note], False, Result.Instruments.Noise[Pat[I].Instrument]);
621 if PolyCounter.DividingRatio = 0 then 694 if PolyCounter.DividingRatio = 0 then
622 RealR := 0.5 695 RealR := 0.5
623 else 696 else
@@ -645,19 +718,90 @@ begin
645 SV4.Instruments.All[I].NoiseMacro := Default(TNoiseMacro); 718 SV4.Instruments.All[I].NoiseMacro := Default(TNoiseMacro);
646 end; 719 end;
647 720
721 Result := UpgradeSong(SV4);
722
648 // Rewrite noise patterns to accomodate the new noise instruments... 723 // Rewrite noise patterns to accomodate the new noise instruments...
649 for I := 0 to SV4.Patterns.Count-1 do 724 for I := 0 to Result.Patterns.Count-1 do
650 if UsedInCH4(SV4.Patterns.Keys[I]) then begin 725 if UsedInCH4(Result.Patterns.Keys[I]) then begin
651 ConvertPattern(SV4.Patterns.Data[I]^); 726 ConvertPattern(Result.Patterns.Data[I]^);
652 end; 727 end;
653
654 Result := UpgradeSong(SV4);
655 end; 728 end;
656 729
657 function UpgradeSong(S: TSongV4): TSong; 730 function UpgradeSong(S: TSongV4): TSong;
731 var
732 SV6: TSongV6;
733 I: Integer;
734
735 function ConvertPattern(Pat: PPatternV1): PPattern;
736 var
737 J: Integer;
738 begin
739 New(Result);
740 for J := Low(TPatternV1) to High(TPatternV1) do begin
741 Result^[J].Instrument := Pat^[J].Instrument;
742 Result^[J].EffectCode := Pat^[J].EffectCode;
743 Result^[J].EffectParams.Value := Pat^[J].EffectParams.Value;
744 Result^[J].Note := Pat^[J].Note;
745 Result^[J].Volume := 0;
746 end;
747 end;
748
749 function ConvertNoiseMacro(NoiseMacro: TNoiseMacro): TPattern;
750 var
751 J: Integer;
752 WrapPoint: Integer;
753 begin
754 BlankPattern(@Result);
755 for J := Low(NoiseMacro) to High(NoiseMacro) do
756 Result[J+1].Note := NoiseMacro[J] + 36;
757
758 WrapPoint := Min(S.TicksPerRow, 7);
759 Result[WrapPoint-1].Volume := WrapPoint; // hold on last row
760 end;
658 begin 761 begin
659 S.Version := 5; 762 SV6.Version:=6;
660 Result := S; 763
764 SV6.Name:=S.Name;
765 SV6.Artist:=S.Artist;
766 SV6.Comment:=S.Comment;
767
768 for I := Low(S.Instruments.All) to High(S.Instruments.All) do begin
769 SV6.Instruments.All[I].Type_ := S.Instruments.All[I].Type_;
770 SV6.Instruments.All[I].Name := S.Instruments.All[I].Name;
771 SV6.Instruments.All[I].Length := S.Instruments.All[I].Length;
772 SV6.Instruments.All[I].LengthEnabled := S.Instruments.All[I].LengthEnabled;
773 SV6.Instruments.All[I].InitialVolume := S.Instruments.All[I].InitialVolume;
774 SV6.Instruments.All[I].VolSweepDirection := S.Instruments.All[I].VolSweepDirection;
775 SV6.Instruments.All[I].VolSweepAmount := S.Instruments.All[I].VolSweepAmount;
776 SV6.Instruments.All[I].SweepTime := S.Instruments.All[I].SweepTime;
777 SV6.Instruments.All[I].SweepIncDec := S.Instruments.All[I].SweepIncDec;
778 SV6.Instruments.All[I].SweepShift := S.Instruments.All[I].SweepShift;
779 SV6.Instruments.All[I].Duty := S.Instruments.All[I].Duty;
780 SV6.Instruments.All[I].OutputLevel := S.Instruments.All[I].OutputLevel;
781 SV6.Instruments.All[I].Waveform := S.Instruments.All[I].Waveform;
782 SV6.Instruments.All[I].CounterStep := S.Instruments.All[I].CounterStep;
783 SV6.Instruments.All[I].SubpatternEnabled := False;
784 BlankPattern(@SV6.Instruments.All[I].Subpattern);
785 end;
786 // TODO: Port over noise macro
787 for I := Low(S.Instruments.Noise) to High(S.Instruments.Noise) do begin
788 SV6.Instruments.Noise[I].Subpattern := ConvertNoiseMacro(S.Instruments.Noise[I].NoiseMacro);
789 SV6.Instruments.Noise[I].SubpatternEnabled := True;
790 end;
791
792 SV6.Waves := S.Waves;
793
794 SV6.TicksPerRow:=S.TicksPerRow;
795 SV6.OrderMatrix:=S.OrderMatrix;
796
797 SV6.Routines:=S.Routines;
798
799 SV6.Patterns := TPatternMap.Create;
800 // Update patterns to new format
801 for I := 0 to S.Patterns.Count-1 do
802 SV6.Patterns.Add(S.Patterns.Keys[I], ConvertPattern(S.Patterns.Data[I]));
803
804 Result := SV6;
661 end; 805 end;
662 806
663 function OptimizeSong(const S: TSong): TSong; 807 function OptimizeSong(const S: TSong): TSong;
Modifiedtracker.lfm +264−247
@@ -1,12 +1,12 @@
1 object frmTracker: TfrmTracker 1 object frmTracker: TfrmTracker
2 Left = 1101 2 Left = 1192
3 Height = 654 3 Height = 857
4 Top = 419 4 Top = 177
5 Width = 1232 5 Width = 1318
6 AllowDropFiles = True 6 AllowDropFiles = True
7 Caption = 'hUGETracker' 7 Caption = 'hUGETracker'
8 ClientHeight = 634 8 ClientHeight = 837
9 ClientWidth = 1232 9 ClientWidth = 1318
10 KeyPreview = True 10 KeyPreview = True
11 Menu = MainMenu1 11 Menu = MainMenu1
12 OnCloseQuery = FormCloseQuery 12 OnCloseQuery = FormCloseQuery
@@ -20,7 +20,7 @@ object frmTracker: TfrmTracker
20 LCLVersion = '2.2.0.3' 20 LCLVersion = '2.2.0.3'
21 object TreeView1: TTreeView 21 object TreeView1: TTreeView
22 Left = 0 22 Left = 0
23 Height = 522 23 Height = 725
24 Top = 89 24 Top = 89
25 Width = 193 25 Width = 193
26 Align = alLeft 26 Align = alLeft
@@ -42,26 +42,26 @@ object frmTracker: TfrmTracker
42 end 42 end
43 object Splitter1: TSplitter 43 object Splitter1: TSplitter
44 Left = 193 44 Left = 193
45 Height = 522 45 Height = 725
46 Top = 89 46 Top = 89
47 Width = 5 47 Width = 5
48 end 48 end
49 object Panel1: TPanel 49 object Panel1: TPanel
50 Left = 198 50 Left = 198
51 Height = 522 51 Height = 725
52 Top = 89 52 Top = 89
53 Width = 1034 53 Width = 1120
54 Align = alClient 54 Align = alClient
55 BevelOuter = bvNone 55 BevelOuter = bvNone
56 ClientHeight = 522 56 ClientHeight = 725
57 ClientWidth = 1034 57 ClientWidth = 1120
58 ParentFont = False 58 ParentFont = False
59 TabOrder = 2 59 TabOrder = 2
60 object PageControl1: TPageControl 60 object PageControl1: TPageControl
61 Left = 0 61 Left = 0
62 Height = 522 62 Height = 725
63 Top = 0 63 Top = 0
64 Width = 1034 64 Width = 1120
65 ActivePage = InstrumentTabSheet 65 ActivePage = InstrumentTabSheet
66 Align = alClient 66 Align = alClient
67 ParentFont = False 67 ParentFont = False
@@ -69,8 +69,8 @@ object frmTracker: TfrmTracker
69 TabOrder = 0 69 TabOrder = 0
70 object GeneralTabSheet: TTabSheet 70 object GeneralTabSheet: TTabSheet
71 Caption = 'General' 71 Caption = 'General'
72 ClientHeight = 494 72 ClientHeight = 697
73 ClientWidth = 1026 73 ClientWidth = 1112
74 ParentFont = False 74 ParentFont = False
75 object SongInformationGroupbox: TGroupBox 75 object SongInformationGroupbox: TGroupBox
76 Left = 8 76 Left = 8
@@ -145,17 +145,17 @@ object frmTracker: TfrmTracker
145 end 145 end
146 object PatternTabSheet: TTabSheet 146 object PatternTabSheet: TTabSheet
147 Caption = 'Patterns' 147 Caption = 'Patterns'
148 ClientHeight = 494 148 ClientHeight = 697
149 ClientWidth = 1026 149 ClientWidth = 1112
150 ParentFont = False 150 ParentFont = False
151 object Panel3: TPanel 151 object Panel3: TPanel
152 Left = 224 152 Left = 224
153 Height = 494 153 Height = 697
154 Top = 0 154 Top = 0
155 Width = 802 155 Width = 888
156 Align = alClient 156 Align = alClient
157 ClientHeight = 494 157 ClientHeight = 697
158 ClientWidth = 802 158 ClientWidth = 888
159 ParentFont = False 159 ParentFont = False
160 TabOrder = 0 160 TabOrder = 0
161 object HeaderControl1: THeaderControl 161 object HeaderControl1: THeaderControl
@@ -163,36 +163,36 @@ object frmTracker: TfrmTracker
163 Height = 30 163 Height = 30
164 Hint = 'Left click to mute, right click to solo' 164 Hint = 'Left click to mute, right click to solo'
165 Top = 1 165 Top = 1
166 Width = 800 166 Width = 886
167 DragReorder = False 167 DragReorder = False
168 Images = ImageList2 168 Images = ImageList2
169 Sections = < 169 Sections = <
170 item 170 item
171 Alignment = taLeftJustify 171 Alignment = taLeftJustify
172 Width = 32 172 Width = 32
173 Visible = True 173 Visible = True
174 end 174 end
175 item 175 item
176 Alignment = taCenter 176 Alignment = taCenter
177 ImageIndex = 1 177 ImageIndex = 1
178 Text = 'Duty 1' 178 Text = 'Duty 1'
179 Width = 133 179 Width = 133
180 Visible = True 180 Visible = True
181 end 181 end
182 item 182 item
183 Alignment = taCenter 183 Alignment = taCenter
184 ImageIndex = 1 184 ImageIndex = 1
185 Text = 'Duty 2' 185 Text = 'Duty 2'
186 Width = 133 186 Width = 133
187 Visible = True 187 Visible = True
188 end 188 end
189 item 189 item
190 Alignment = taCenter 190 Alignment = taCenter
191 ImageIndex = 1 191 ImageIndex = 1
192 Text = 'Wave' 192 Text = 'Wave'
193 Width = 133 193 Width = 133
194 Visible = True 194 Visible = True
195 end 195 end
196 item 196 item
197 Alignment = taCenter 197 Alignment = taCenter
198 ImageIndex = 1 198 ImageIndex = 1
@@ -208,9 +208,9 @@ object frmTracker: TfrmTracker
208 end 208 end
209 object ScrollBox1: TScrollBox 209 object ScrollBox1: TScrollBox
210 Left = 1 210 Left = 1
211 Height = 462 211 Height = 665
212 Top = 31 212 Top = 31
213 Width = 800 213 Width = 886
214 HorzScrollBar.Increment = 3 214 HorzScrollBar.Increment = 3
215 HorzScrollBar.Page = 32 215 HorzScrollBar.Page = 32
216 HorzScrollBar.Smooth = True 216 HorzScrollBar.Smooth = True
@@ -221,15 +221,15 @@ object frmTracker: TfrmTracker
221 VertScrollBar.Tracking = True 221 VertScrollBar.Tracking = True
222 Align = alClient 222 Align = alClient
223 BorderStyle = bsNone 223 BorderStyle = bsNone
224 ClientHeight = 462 224 ClientHeight = 665
225 ClientWidth = 800 225 ClientWidth = 886
226 ParentFont = False 226 ParentFont = False
227 TabOrder = 1 227 TabOrder = 1
228 OnMouseWheelDown = ScrollBox1MouseWheelDown 228 OnMouseWheelDown = ScrollBox1MouseWheelDown
229 OnMouseWheelUp = ScrollBox1MouseWheelUp 229 OnMouseWheelUp = ScrollBox1MouseWheelUp
230 object RowNumberStringGrid: TStringGrid 230 object RowNumberStringGrid: TStringGrid
231 Left = 0 231 Left = 0
232 Height = 462 232 Height = 665
233 Top = 0 233 Top = 0
234 Width = 32 234 Width = 32
235 Align = alLeft 235 Align = alLeft
@@ -246,34 +246,34 @@ object frmTracker: TfrmTracker
246 end 246 end
247 object OrderEditStringGrid: TStringGrid 247 object OrderEditStringGrid: TStringGrid
248 Left = 0 248 Left = 0
249 Height = 494 249 Height = 697
250 Top = 0 250 Top = 0
251 Width = 224 251 Width = 224
252 Align = alLeft 252 Align = alLeft
253 AutoEdit = False 253 AutoEdit = False
254 AutoFillColumns = True 254 AutoFillColumns = True
255 Columns = < 255 Columns = <
256 item 256 item
257 Alignment = taCenter 257 Alignment = taCenter
258 MinSize = 33 258 MinSize = 33
259 MaxSize = 33 259 MaxSize = 33
260 Title.Caption = 'Dty1' 260 Title.Caption = 'Dty1'
261 Width = 34 261 Width = 34
262 end 262 end
263 item 263 item
264 Alignment = taCenter 264 Alignment = taCenter
265 MinSize = 33 265 MinSize = 33
266 MaxSize = 33 266 MaxSize = 33
267 Title.Caption = 'Dty2' 267 Title.Caption = 'Dty2'
268 Width = 34 268 Width = 34
269 end 269 end
270 item 270 item
271 Alignment = taCenter 271 Alignment = taCenter
272 MinSize = 33 272 MinSize = 33
273 MaxSize = 33 273 MaxSize = 33
274 Title.Caption = 'Wav' 274 Title.Caption = 'Wav'
275 Width = 34 275 Width = 34
276 end 276 end
277 item 277 item
278 Alignment = taCenter 278 Alignment = taCenter
279 MinSize = 33 279 MinSize = 33
@@ -311,54 +311,38 @@ object frmTracker: TfrmTracker
311 end 311 end
312 object InstrumentTabSheet: TTabSheet 312 object InstrumentTabSheet: TTabSheet
313 Caption = 'Instruments' 313 Caption = 'Instruments'
314 ClientHeight = 494 314 ClientHeight = 697
315 ClientWidth = 1026 315 ClientWidth = 1112
316 ParentFont = False 316 ParentFont = False
317 object PaintBox1: TPaintBox
318 AnchorSideTop.Control = FlowPanel1
319 AnchorSideTop.Side = asrBottom
320 AnchorSideBottom.Side = asrBottom
321 Left = 0
322 Height = 0
323 Hint = 'Preview of how the resulting waveform will look with envelope applied'
324 Top = 494
325 Width = 1026
326 Align = alClient
327 Color = clBlack
328 ParentColor = False
329 ParentFont = False
330 Visible = False
331 OnPaint = PaintBox1Paint
332 end
333 object FlowPanel1: TFlowPanel 317 object FlowPanel1: TFlowPanel
334 Left = 0 318 Left = 0
335 Height = 675 319 Height = 697
336 Top = 0 320 Top = 0
337 Width = 1026 321 Width = 952
338 Align = alTop 322 Align = alClient
339 AutoSize = True 323 AutoSize = True
340 BevelOuter = bvNone 324 BevelOuter = bvNone
341 ControlList = < 325 ControlList = <
342 item 326 item
343 Control = InstrumentGroupBox 327 Control = InstrumentGroupBox
344 WrapAfter = waAuto 328 WrapAfter = waAuto
345 Index = 0 329 Index = 0
346 end 330 end
347 item 331 item
348 Control = EnvelopeGroupBox 332 Control = EnvelopeGroupBox
349 WrapAfter = waAuto 333 WrapAfter = waAuto
350 Index = 1 334 Index = 1
351 end 335 end
352 item 336 item
353 Control = SquareGroupBox 337 Control = SquareGroupBox
354 WrapAfter = waAuto 338 WrapAfter = waAuto
355 Index = 2 339 Index = 2
356 end 340 end
357 item 341 item
358 Control = WaveGroupBox 342 Control = WaveGroupBox
359 WrapAfter = waAuto 343 WrapAfter = waAuto
360 Index = 3 344 Index = 3
361 end 345 end
362 item 346 item
363 Control = NoiseGroupBox 347 Control = NoiseGroupBox
364 WrapAfter = waAuto 348 WrapAfter = waAuto
@@ -370,7 +354,7 @@ object frmTracker: TfrmTracker
370 TabOrder = 0 354 TabOrder = 0
371 object InstrumentGroupBox: TGroupBox 355 object InstrumentGroupBox: TGroupBox
372 Left = 7 356 Left = 7
373 Height = 241 357 Height = 273
374 Top = 7 358 Top = 7
375 Width = 280 359 Width = 280
376 Anchors = [] 360 Anchors = []
@@ -379,7 +363,7 @@ object frmTracker: TfrmTracker
379 BorderSpacing.Right = 7 363 BorderSpacing.Right = 7
380 BorderSpacing.Bottom = 7 364 BorderSpacing.Bottom = 7
381 Caption = 'Instrument' 365 Caption = 'Instrument'
382 ClientHeight = 221 366 ClientHeight = 253
383 ClientWidth = 276 367 ClientWidth = 276
384 ParentFont = False 368 ParentFont = False
385 TabOrder = 0 369 TabOrder = 0
@@ -433,11 +417,11 @@ object frmTracker: TfrmTracker
433 ParentFont = False 417 ParentFont = False
434 end 418 end
435 object InstrumentTypeCombobox: TComboBox 419 object InstrumentTypeCombobox: TComboBox
436 Left = 76 420 Left = 80
437 Height = 23 421 Height = 23
438 Hint = 'What type of channel this instrument will be played on' 422 Hint = 'What type of channel this instrument will be played on'
439 Top = 8 423 Top = 8
440 Width = 189 424 Width = 185
441 ItemHeight = 15 425 ItemHeight = 15
442 ItemIndex = 0 426 ItemIndex = 0
443 Items.Strings = ( 427 Items.Strings = (
@@ -465,7 +449,8 @@ object frmTracker: TfrmTracker
465 object InstrumentImportButton: TButton 449 object InstrumentImportButton: TButton
466 Left = 12 450 Left = 12
467 Height = 25 451 Height = 25
468 Top = 184 452 Hint = 'Import an instrument'
453 Top = 216
469 Width = 116 454 Width = 116
470 Caption = 'Import' 455 Caption = 'Import'
471 OnClick = InstrumentImportButtonClick 456 OnClick = InstrumentImportButtonClick
@@ -475,7 +460,8 @@ object frmTracker: TfrmTracker
475 object InstrumentExportButton: TButton 460 object InstrumentExportButton: TButton
476 Left = 149 461 Left = 149
477 Height = 25 462 Height = 25
478 Top = 184 463 Hint = 'Export an instrument'
464 Top = 216
479 Width = 116 465 Width = 116
480 Caption = 'Export' 466 Caption = 'Export'
481 OnClick = InstrumentExportButtonClick 467 OnClick = InstrumentExportButtonClick
@@ -518,7 +504,7 @@ object frmTracker: TfrmTracker
518 Tag = 4 504 Tag = 4
519 Left = 110 505 Left = 110
520 Height = 25 506 Height = 25
521 Hint = 'Test out the instrument with a C-5 note' 507 Hint = 'Test out the instrument with a C-4 note'
522 Top = 146 508 Top = 146
523 Width = 27 509 Width = 27
524 Caption = '4' 510 Caption = '4'
@@ -530,7 +516,7 @@ object frmTracker: TfrmTracker
530 Tag = 3 516 Tag = 3
531 Left = 78 517 Left = 78
532 Height = 25 518 Height = 25
533 Hint = 'Test out the instrument with a C-5 note' 519 Hint = 'Test out the instrument with a C-3 note'
534 Top = 146 520 Top = 146
535 Width = 27 521 Width = 27
536 Caption = '3' 522 Caption = '3'
@@ -542,7 +528,7 @@ object frmTracker: TfrmTracker
542 Tag = 6 528 Tag = 6
543 Left = 174 529 Left = 174
544 Height = 25 530 Height = 25
545 Hint = 'Test out the instrument with a C-5 note' 531 Hint = 'Test out the instrument with a C-6 note'
546 Top = 146 532 Top = 146
547 Width = 27 533 Width = 27
548 Caption = '6' 534 Caption = '6'
@@ -554,7 +540,7 @@ object frmTracker: TfrmTracker
554 Tag = 7 540 Tag = 7
555 Left = 206 541 Left = 206
556 Height = 25 542 Height = 25
557 Hint = 'Test out the instrument with a C-5 note' 543 Hint = 'Test out the instrument with a C-7 note'
558 Top = 146 544 Top = 146
559 Width = 27 545 Width = 27
560 Caption = '7' 546 Caption = '7'
@@ -566,7 +552,7 @@ object frmTracker: TfrmTracker
566 Tag = 8 552 Tag = 8
567 Left = 238 553 Left = 238
568 Height = 25 554 Height = 25
569 Hint = 'Test out the instrument with a C-5 note' 555 Hint = 'Test out the instrument with a C-8 note'
570 Top = 146 556 Top = 146
571 Width = 27 557 Width = 27
572 Caption = '8' 558 Caption = '8'
@@ -574,6 +560,15 @@ object frmTracker: TfrmTracker
574 ParentFont = False 560 ParentFont = False
575 TabOrder = 12 561 TabOrder = 12
576 end 562 end
563 object EnableSubpatternCheckbox: TCheckBox
564 Left = 12
565 Height = 19
566 Top = 184
567 Width = 115
568 Caption = 'Enable subpattern'
569 OnChange = EnableSubpatternCheckboxChange
570 TabOrder = 13
571 end
577 end 572 end
578 object EnvelopeGroupBox: TGroupBox 573 object EnvelopeGroupBox: TGroupBox
579 Left = 301 574 Left = 301
@@ -593,7 +588,7 @@ object frmTracker: TfrmTracker
593 object Label4: TLabel 588 object Label4: TLabel
594 Left = 8 589 Left = 8
595 Height = 15 590 Height = 15
596 Top = 9 591 Top = 16
597 Width = 46 592 Width = 46
598 Caption = 'Start vol.' 593 Caption = 'Start vol.'
599 ParentFont = False 594 ParentFont = False
@@ -601,7 +596,7 @@ object frmTracker: TfrmTracker
601 object Label5: TLabel 596 object Label5: TLabel
602 Left = 8 597 Left = 8
603 Height = 15 598 Height = 15
604 Top = 48 599 Top = 54
605 Width = 48 600 Width = 48
606 Caption = 'Direction' 601 Caption = 'Direction'
607 ParentFont = False 602 ParentFont = False
@@ -627,7 +622,7 @@ object frmTracker: TfrmTracker
627 object Label6: TLabel 622 object Label6: TLabel
628 Left = 8 623 Left = 8
629 Height = 15 624 Height = 15
630 Top = 86 625 Top = 90
631 Width = 41 626 Width = 41
632 Caption = 'Change' 627 Caption = 'Change'
633 ParentFont = False 628 ParentFont = False
@@ -679,7 +674,7 @@ object frmTracker: TfrmTracker
679 object SquareGroupBox: TGroupBox 674 object SquareGroupBox: TGroupBox
680 Left = 7 675 Left = 7
681 Height = 169 676 Height = 169
682 Top = 262 677 Top = 294
683 Width = 319 678 Width = 319
684 Anchors = [] 679 Anchors = []
685 BorderSpacing.Left = 7 680 BorderSpacing.Left = 7
@@ -756,7 +751,7 @@ object frmTracker: TfrmTracker
756 object Label9: TLabel 751 object Label9: TLabel
757 Left = 8 752 Left = 8
758 Height = 15 753 Height = 15
759 Top = 84 754 Top = 88
760 Width = 56 755 Width = 56
761 Caption = 'Sweep size' 756 Caption = 'Sweep size'
762 ParentFont = False 757 ParentFont = False
@@ -806,7 +801,7 @@ object frmTracker: TfrmTracker
806 object WaveGroupBox: TGroupBox 801 object WaveGroupBox: TGroupBox
807 Left = 340 802 Left = 340
808 Height = 169 803 Height = 169
809 Top = 262 804 Top = 294
810 Width = 297 805 Width = 297
811 Anchors = [] 806 Anchors = []
812 BorderSpacing.Left = 7 807 BorderSpacing.Left = 7
@@ -911,18 +906,18 @@ object frmTracker: TfrmTracker
911 end 906 end
912 end 907 end
913 object NoiseGroupBox: TGroupBox 908 object NoiseGroupBox: TGroupBox
914 Left = 7 909 Left = 651
915 Height = 223 910 Height = 59
916 Top = 445 911 Top = 294
917 Width = 397 912 Width = 237
918 Anchors = [] 913 Anchors = []
919 BorderSpacing.Left = 7 914 BorderSpacing.Left = 7
920 BorderSpacing.Top = 7 915 BorderSpacing.Top = 7
921 BorderSpacing.Right = 7 916 BorderSpacing.Right = 7
922 BorderSpacing.Bottom = 7 917 BorderSpacing.Bottom = 7
923 Caption = 'Noise' 918 Caption = 'Noise'
924 ClientHeight = 203 919 ClientHeight = 39
925 ClientWidth = 393 920 ClientWidth = 233
926 ParentFont = False 921 ParentFont = False
927 TabOrder = 4 922 TabOrder = 4
928 object SevenBitCounterCheckbox: TCheckBox 923 object SevenBitCounterCheckbox: TCheckBox
@@ -937,44 +932,70 @@ object frmTracker: TfrmTracker
937 ParentFont = False 932 ParentFont = False
938 TabOrder = 0 933 TabOrder = 0
939 end 934 end
940 object Panel6: TPanel 935 end
941 Left = 8 936 end
942 Height = 152 937 object SubpatternGroupBox: TGroupBox
943 Top = 40 938 Left = 952
944 Width = 376 939 Height = 690
945 BevelOuter = bvLowered 940 Top = 7
946 ClientHeight = 152 941 Width = 160
947 ClientWidth = 376 942 Align = alRight
943 Anchors = []
944 BorderSpacing.Top = 7
945 Caption = 'Subpattern'
946 ClientHeight = 670
947 ClientWidth = 156
948 TabOrder = 1
949 object ScrollBox2: TScrollBox
950 Left = 0
951 Height = 670
952 Top = 0
953 Width = 156
954 HorzScrollBar.Increment = 3
955 HorzScrollBar.Page = 32
956 HorzScrollBar.Smooth = True
957 HorzScrollBar.Tracking = True
958 VertScrollBar.Increment = 5
959 VertScrollBar.Page = 50
960 VertScrollBar.Smooth = True
961 VertScrollBar.Tracking = True
962 Align = alClient
963 BorderStyle = bsNone
964 ClientHeight = 670
965 ClientWidth = 156
966 TabOrder = 0
967 OnMouseWheelDown = ScrollBox1MouseWheelDown
968 OnMouseWheelUp = ScrollBox1MouseWheelUp
969 object RowNumberStringGrid1: TStringGrid
970 Left = 124
971 Height = 670
972 Top = 0
973 Width = 32
974 Align = alRight
975 BorderStyle = bsNone
976 ColCount = 1
977 DefaultColWidth = 32
978 Enabled = False
948 ParentFont = False 979 ParentFont = False
949 TabOrder = 1 980 RowCount = 32
950 object NoiseMacroPaintbox: TPaintBox 981 ScrollBars = ssNone
951 Left = 1 982 TabOrder = 0
952 Height = 150
953 Top = 1
954 Width = 374
955 Align = alClient
956 ParentFont = False
957 OnMouseDown = NoiseMacroPaintboxMouseDown
958 OnMouseMove = NoiseMacroPaintboxMouseMove
959 OnMouseUp = NoiseMacroPaintboxMouseUp
960 OnPaint = NoiseMacroPaintboxPaint
961 end
962 end 983 end
963 end 984 end
964 end 985 end
965 end 986 end
966 object WavesTabSheet: TTabSheet 987 object WavesTabSheet: TTabSheet
967 Caption = 'Waves' 988 Caption = 'Waves'
968 ClientHeight = 494 989 ClientHeight = 697
969 ClientWidth = 1026 990 ClientWidth = 1112
970 ParentFont = False 991 ParentFont = False
971 object WaveEditPaintBox: TPaintBox 992 object WaveEditPaintBox: TPaintBox
972 AnchorSideTop.Control = WaveEditGroupBox 993 AnchorSideTop.Control = WaveEditGroupBox
973 AnchorSideTop.Side = asrBottom 994 AnchorSideTop.Side = asrBottom
974 Left = 0 995 Left = 0
975 Height = 334 996 Height = 537
976 Top = 160 997 Top = 160
977 Width = 1026 998 Width = 1112
978 Align = alBottom 999 Align = alBottom
979 Anchors = [akTop, akLeft, akRight, akBottom] 1000 Anchors = [akTop, akLeft, akRight, akBottom]
980 BorderSpacing.Top = 13 1001 BorderSpacing.Top = 13
@@ -1067,17 +1088,17 @@ object frmTracker: TfrmTracker
1067 end 1088 end
1068 object CommentsTabSheet: TTabSheet 1089 object CommentsTabSheet: TTabSheet
1069 Caption = 'Comments' 1090 Caption = 'Comments'
1070 ClientHeight = 494 1091 ClientHeight = 697
1071 ClientWidth = 1026 1092 ClientWidth = 1112
1072 ParentFont = False 1093 ParentFont = False
1073 object CommentMemo: TMemo 1094 object CommentMemo: TMemo
1074 AnchorSideTop.Control = Label17 1095 AnchorSideTop.Control = Label17
1075 AnchorSideTop.Side = asrBottom 1096 AnchorSideTop.Side = asrBottom
1076 Left = 0 1097 Left = 0
1077 Height = 458 1098 Height = 661
1078 Hint = 'The comments section for your song. Greetings/links/etc' 1099 Hint = 'The comments section for your song. Greetings/links/etc'
1079 Top = 36 1100 Top = 36
1080 Width = 1026 1101 Width = 1112
1081 Align = alBottom 1102 Align = alBottom
1082 Anchors = [akTop, akLeft, akRight, akBottom] 1103 Anchors = [akTop, akLeft, akRight, akBottom]
1083 BorderSpacing.Top = 13 1104 BorderSpacing.Top = 13
@@ -1097,16 +1118,16 @@ object frmTracker: TfrmTracker
1097 end 1118 end
1098 object RoutinesTabSheet: TTabSheet 1119 object RoutinesTabSheet: TTabSheet
1099 Caption = 'Routines' 1120 Caption = 'Routines'
1100 ClientHeight = 494 1121 ClientHeight = 697
1101 ClientWidth = 1026 1122 ClientWidth = 1112
1102 ParentFont = False 1123 ParentFont = False
1103 inline RoutineSynedit: TSynEdit 1124 inline RoutineSynedit: TSynEdit
1104 AnchorSideTop.Control = Label19 1125 AnchorSideTop.Control = Label19
1105 AnchorSideTop.Side = asrBottom 1126 AnchorSideTop.Side = asrBottom
1106 Left = 0 1127 Left = 0
1107 Height = 366 1128 Height = 569
1108 Top = 128 1129 Top = 128
1109 Width = 1026 1130 Width = 1112
1110 Align = alBottom 1131 Align = alBottom
1111 BorderSpacing.Top = 13 1132 BorderSpacing.Top = 13
1112 Anchors = [akTop, akLeft, akRight, akBottom] 1133 Anchors = [akTop, akLeft, akRight, akBottom]
@@ -1123,423 +1144,423 @@ object frmTracker: TfrmTracker
1123 RightGutter.MouseActions = <> 1144 RightGutter.MouseActions = <>
1124 Highlighter = SynAnySyn1 1145 Highlighter = SynAnySyn1
1125 InsertCaret = ctBlock 1146 InsertCaret = ctBlock
1126 Keystrokes = < 1147 Keystrokes = <
1127 item 1148 item
1128 Command = ecUp 1149 Command = ecUp
1129 ShortCut = 38 1150 ShortCut = 38
1130 end 1151 end
1131 item 1152 item
1132 Command = ecSelUp 1153 Command = ecSelUp
1133 ShortCut = 8230 1154 ShortCut = 8230
1134 end 1155 end
1135 item 1156 item
1136 Command = ecScrollUp 1157 Command = ecScrollUp
1137 ShortCut = 16422 1158 ShortCut = 16422
1138 end 1159 end
1139 item 1160 item
1140 Command = ecDown 1161 Command = ecDown
1141 ShortCut = 40 1162 ShortCut = 40
1142 end 1163 end
1143 item 1164 item
1144 Command = ecSelDown 1165 Command = ecSelDown
1145 ShortCut = 8232 1166 ShortCut = 8232
1146 end 1167 end
1147 item 1168 item
1148 Command = ecScrollDown 1169 Command = ecScrollDown
1149 ShortCut = 16424 1170 ShortCut = 16424
1150 end 1171 end
1151 item 1172 item
1152 Command = ecLeft 1173 Command = ecLeft
1153 ShortCut = 37 1174 ShortCut = 37
1154 end 1175 end
1155 item 1176 item
1156 Command = ecSelLeft 1177 Command = ecSelLeft
1157 ShortCut = 8229 1178 ShortCut = 8229
1158 end 1179 end
1159 item 1180 item
1160 Command = ecWordLeft 1181 Command = ecWordLeft
1161 ShortCut = 16421 1182 ShortCut = 16421
1162 end 1183 end
1163 item 1184 item
1164 Command = ecSelWordLeft 1185 Command = ecSelWordLeft
1165 ShortCut = 24613 1186 ShortCut = 24613
1166 end 1187 end
1167 item 1188 item
1168 Command = ecRight 1189 Command = ecRight
1169 ShortCut = 39 1190 ShortCut = 39
1170 end 1191 end
1171 item 1192 item
1172 Command = ecSelRight 1193 Command = ecSelRight
1173 ShortCut = 8231 1194 ShortCut = 8231
1174 end 1195 end
1175 item 1196 item
1176 Command = ecWordRight 1197 Command = ecWordRight
1177 ShortCut = 16423 1198 ShortCut = 16423
1178 end 1199 end
1179 item 1200 item
1180 Command = ecSelWordRight 1201 Command = ecSelWordRight
1181 ShortCut = 24615 1202 ShortCut = 24615
1182 end 1203 end
1183 item 1204 item
1184 Command = ecPageDown 1205 Command = ecPageDown
1185 ShortCut = 34 1206 ShortCut = 34
1186 end 1207 end
1187 item 1208 item
1188 Command = ecSelPageDown 1209 Command = ecSelPageDown
1189 ShortCut = 8226 1210 ShortCut = 8226
1190 end 1211 end
1191 item 1212 item
1192 Command = ecPageBottom 1213 Command = ecPageBottom
1193 ShortCut = 16418 1214 ShortCut = 16418
1194 end 1215 end
1195 item 1216 item
1196 Command = ecSelPageBottom 1217 Command = ecSelPageBottom
1197 ShortCut = 24610 1218 ShortCut = 24610
1198 end 1219 end
1199 item 1220 item
1200 Command = ecPageUp 1221 Command = ecPageUp
1201 ShortCut = 33 1222 ShortCut = 33
1202 end 1223 end
1203 item 1224 item
1204 Command = ecSelPageUp 1225 Command = ecSelPageUp
1205 ShortCut = 8225 1226 ShortCut = 8225
1206 end 1227 end
1207 item 1228 item
1208 Command = ecPageTop 1229 Command = ecPageTop
1209 ShortCut = 16417 1230 ShortCut = 16417
1210 end 1231 end
1211 item 1232 item
1212 Command = ecSelPageTop 1233 Command = ecSelPageTop
1213 ShortCut = 24609 1234 ShortCut = 24609
1214 end 1235 end
1215 item 1236 item
1216 Command = ecLineStart 1237 Command = ecLineStart
1217 ShortCut = 36 1238 ShortCut = 36
1218 end 1239 end
1219 item 1240 item
1220 Command = ecSelLineStart 1241 Command = ecSelLineStart
1221 ShortCut = 8228 1242 ShortCut = 8228
1222 end 1243 end
1223 item 1244 item
1224 Command = ecEditorTop 1245 Command = ecEditorTop
1225 ShortCut = 16420 1246 ShortCut = 16420
1226 end 1247 end
1227 item 1248 item
1228 Command = ecSelEditorTop 1249 Command = ecSelEditorTop
1229 ShortCut = 24612 1250 ShortCut = 24612
1230 end 1251 end
1231 item 1252 item
1232 Command = ecLineEnd 1253 Command = ecLineEnd
1233 ShortCut = 35 1254 ShortCut = 35
1234 end 1255 end
1235 item 1256 item
1236 Command = ecSelLineEnd 1257 Command = ecSelLineEnd
1237 ShortCut = 8227 1258 ShortCut = 8227
1238 end 1259 end
1239 item 1260 item
1240 Command = ecEditorBottom 1261 Command = ecEditorBottom
1241 ShortCut = 16419 1262 ShortCut = 16419
1242 end 1263 end
1243 item 1264 item
1244 Command = ecSelEditorBottom 1265 Command = ecSelEditorBottom
1245 ShortCut = 24611 1266 ShortCut = 24611
1246 end 1267 end
1247 item 1268 item
1248 Command = ecToggleMode 1269 Command = ecToggleMode
1249 ShortCut = 45 1270 ShortCut = 45
1250 end 1271 end
1251 item 1272 item
1252 Command = ecCopy 1273 Command = ecCopy
1253 ShortCut = 16429 1274 ShortCut = 16429
1254 end 1275 end
1255 item 1276 item
1256 Command = ecPaste 1277 Command = ecPaste
1257 ShortCut = 8237 1278 ShortCut = 8237
1258 end 1279 end
1259 item 1280 item
1260 Command = ecDeleteChar 1281 Command = ecDeleteChar
1261 ShortCut = 46 1282 ShortCut = 46
1262 end 1283 end
1263 item 1284 item
1264 Command = ecCut 1285 Command = ecCut
1265 ShortCut = 8238 1286 ShortCut = 8238
1266 end 1287 end
1267 item 1288 item
1268 Command = ecDeleteLastChar 1289 Command = ecDeleteLastChar
1269 ShortCut = 8 1290 ShortCut = 8
1270 end 1291 end
1271 item 1292 item
1272 Command = ecDeleteLastChar 1293 Command = ecDeleteLastChar
1273 ShortCut = 8200 1294 ShortCut = 8200
1274 end 1295 end
1275 item 1296 item
1276 Command = ecDeleteLastWord 1297 Command = ecDeleteLastWord
1277 ShortCut = 16392 1298 ShortCut = 16392
1278 end 1299 end
1279 item 1300 item
1280 Command = ecUndo 1301 Command = ecUndo
1281 ShortCut = 32776 1302 ShortCut = 32776
1282 end 1303 end
1283 item 1304 item
1284 Command = ecRedo 1305 Command = ecRedo
1285 ShortCut = 40968 1306 ShortCut = 40968
1286 end 1307 end
1287 item 1308 item
1288 Command = ecLineBreak 1309 Command = ecLineBreak
1289 ShortCut = 13 1310 ShortCut = 13
1290 end 1311 end
1291 item 1312 item
1292 Command = ecSelectAll 1313 Command = ecSelectAll
1293 ShortCut = 16449 1314 ShortCut = 16449
1294 end 1315 end
1295 item 1316 item
1296 Command = ecCopy 1317 Command = ecCopy
1297 ShortCut = 16451 1318 ShortCut = 16451
1298 end 1319 end
1299 item 1320 item
1300 Command = ecBlockIndent 1321 Command = ecBlockIndent
1301 ShortCut = 24649 1322 ShortCut = 24649
1302 end 1323 end
1303 item 1324 item
1304 Command = ecLineBreak 1325 Command = ecLineBreak
1305 ShortCut = 16461 1326 ShortCut = 16461
1306 end 1327 end
1307 item 1328 item
1308 Command = ecInsertLine 1329 Command = ecInsertLine
1309 ShortCut = 16462 1330 ShortCut = 16462
1310 end 1331 end
1311 item 1332 item
1312 Command = ecDeleteWord 1333 Command = ecDeleteWord
1313 ShortCut = 16468 1334 ShortCut = 16468
1314 end 1335 end
1315 item 1336 item
1316 Command = ecBlockUnindent 1337 Command = ecBlockUnindent
1317 ShortCut = 24661 1338 ShortCut = 24661
1318 end 1339 end
1319 item 1340 item
1320 Command = ecPaste 1341 Command = ecPaste
1321 ShortCut = 16470 1342 ShortCut = 16470
1322 end 1343 end
1323 item 1344 item
1324 Command = ecCut 1345 Command = ecCut
1325 ShortCut = 16472 1346 ShortCut = 16472
1326 end 1347 end
1327 item 1348 item
1328 Command = ecDeleteLine 1349 Command = ecDeleteLine
1329 ShortCut = 16473 1350 ShortCut = 16473
1330 end 1351 end
1331 item 1352 item
1332 Command = ecDeleteEOL 1353 Command = ecDeleteEOL
1333 ShortCut = 24665 1354 ShortCut = 24665
1334 end 1355 end
1335 item 1356 item
1336 Command = ecUndo 1357 Command = ecUndo
1337 ShortCut = 16474 1358 ShortCut = 16474
1338 end 1359 end
1339 item 1360 item
1340 Command = ecRedo 1361 Command = ecRedo
1341 ShortCut = 24666 1362 ShortCut = 24666
1342 end 1363 end
1343 item 1364 item
1344 Command = ecGotoMarker0 1365 Command = ecGotoMarker0
1345 ShortCut = 16432 1366 ShortCut = 16432
1346 end 1367 end
1347 item 1368 item
1348 Command = ecGotoMarker1 1369 Command = ecGotoMarker1
1349 ShortCut = 16433 1370 ShortCut = 16433
1350 end 1371 end
1351 item 1372 item
1352 Command = ecGotoMarker2 1373 Command = ecGotoMarker2
1353 ShortCut = 16434 1374 ShortCut = 16434
1354 end 1375 end
1355 item 1376 item
1356 Command = ecGotoMarker3 1377 Command = ecGotoMarker3
1357 ShortCut = 16435 1378 ShortCut = 16435
1358 end 1379 end
1359 item 1380 item
1360 Command = ecGotoMarker4 1381 Command = ecGotoMarker4
1361 ShortCut = 16436 1382 ShortCut = 16436
1362 end 1383 end
1363 item 1384 item
1364 Command = ecGotoMarker5 1385 Command = ecGotoMarker5
1365 ShortCut = 16437 1386 ShortCut = 16437
1366 end 1387 end
1367 item 1388 item
1368 Command = ecGotoMarker6 1389 Command = ecGotoMarker6
1369 ShortCut = 16438 1390 ShortCut = 16438
1370 end 1391 end
1371 item 1392 item
1372 Command = ecGotoMarker7 1393 Command = ecGotoMarker7
1373 ShortCut = 16439 1394 ShortCut = 16439
1374 end 1395 end
1375 item 1396 item
1376 Command = ecGotoMarker8 1397 Command = ecGotoMarker8
1377 ShortCut = 16440 1398 ShortCut = 16440
1378 end 1399 end
1379 item 1400 item
1380 Command = ecGotoMarker9 1401 Command = ecGotoMarker9
1381 ShortCut = 16441 1402 ShortCut = 16441
1382 end 1403 end
1383 item 1404 item
1384 Command = ecSetMarker0 1405 Command = ecSetMarker0
1385 ShortCut = 24624 1406 ShortCut = 24624
1386 end 1407 end
1387 item 1408 item
1388 Command = ecSetMarker1 1409 Command = ecSetMarker1
1389 ShortCut = 24625 1410 ShortCut = 24625
1390 end 1411 end
1391 item 1412 item
1392 Command = ecSetMarker2 1413 Command = ecSetMarker2
1393 ShortCut = 24626 1414 ShortCut = 24626
1394 end 1415 end
1395 item 1416 item
1396 Command = ecSetMarker3 1417 Command = ecSetMarker3
1397 ShortCut = 24627 1418 ShortCut = 24627
1398 end 1419 end
1399 item 1420 item
1400 Command = ecSetMarker4 1421 Command = ecSetMarker4
1401 ShortCut = 24628 1422 ShortCut = 24628
1402 end 1423 end
1403 item 1424 item
1404 Command = ecSetMarker5 1425 Command = ecSetMarker5
1405 ShortCut = 24629 1426 ShortCut = 24629
1406 end 1427 end
1407 item 1428 item
1408 Command = ecSetMarker6 1429 Command = ecSetMarker6
1409 ShortCut = 24630 1430 ShortCut = 24630
1410 end 1431 end
1411 item 1432 item
1412 Command = ecSetMarker7 1433 Command = ecSetMarker7
1413 ShortCut = 24631 1434 ShortCut = 24631
1414 end 1435 end
1415 item 1436 item
1416 Command = ecSetMarker8 1437 Command = ecSetMarker8
1417 ShortCut = 24632 1438 ShortCut = 24632
1418 end 1439 end
1419 item 1440 item
1420 Command = ecSetMarker9 1441 Command = ecSetMarker9
1421 ShortCut = 24633 1442 ShortCut = 24633
1422 end 1443 end
1423 item 1444 item
1424 Command = EcFoldLevel1 1445 Command = EcFoldLevel1
1425 ShortCut = 41009 1446 ShortCut = 41009
1426 end 1447 end
1427 item 1448 item
1428 Command = EcFoldLevel2 1449 Command = EcFoldLevel2
1429 ShortCut = 41010 1450 ShortCut = 41010
1430 end 1451 end
1431 item 1452 item
1432 Command = EcFoldLevel3 1453 Command = EcFoldLevel3
1433 ShortCut = 41011 1454 ShortCut = 41011
1434 end 1455 end
1435 item 1456 item
1436 Command = EcFoldLevel4 1457 Command = EcFoldLevel4
1437 ShortCut = 41012 1458 ShortCut = 41012
1438 end 1459 end
1439 item 1460 item
1440 Command = EcFoldLevel5 1461 Command = EcFoldLevel5
1441 ShortCut = 41013 1462 ShortCut = 41013
1442 end 1463 end
1443 item 1464 item
1444 Command = EcFoldLevel6 1465 Command = EcFoldLevel6
1445 ShortCut = 41014 1466 ShortCut = 41014
1446 end 1467 end
1447 item 1468 item
1448 Command = EcFoldLevel7 1469 Command = EcFoldLevel7
1449 ShortCut = 41015 1470 ShortCut = 41015
1450 end 1471 end
1451 item 1472 item
1452 Command = EcFoldLevel8 1473 Command = EcFoldLevel8
1453 ShortCut = 41016 1474 ShortCut = 41016
1454 end 1475 end
1455 item 1476 item
1456 Command = EcFoldLevel9 1477 Command = EcFoldLevel9
1457 ShortCut = 41017 1478 ShortCut = 41017
1458 end 1479 end
1459 item 1480 item
1460 Command = EcFoldLevel0 1481 Command = EcFoldLevel0
1461 ShortCut = 41008 1482 ShortCut = 41008
1462 end 1483 end
1463 item 1484 item
1464 Command = EcFoldCurrent 1485 Command = EcFoldCurrent
1465 ShortCut = 41005 1486 ShortCut = 41005
1466 end 1487 end
1467 item 1488 item
1468 Command = EcUnFoldCurrent 1489 Command = EcUnFoldCurrent
1469 ShortCut = 41003 1490 ShortCut = 41003
1470 end 1491 end
1471 item 1492 item
1472 Command = EcToggleMarkupWord 1493 Command = EcToggleMarkupWord
1473 ShortCut = 32845 1494 ShortCut = 32845
1474 end 1495 end
1475 item 1496 item
1476 Command = ecNormalSelect 1497 Command = ecNormalSelect
1477 ShortCut = 24654 1498 ShortCut = 24654
1478 end 1499 end
1479 item 1500 item
1480 Command = ecColumnSelect 1501 Command = ecColumnSelect
1481 ShortCut = 24643 1502 ShortCut = 24643
1482 end 1503 end
1483 item 1504 item
1484 Command = ecLineSelect 1505 Command = ecLineSelect
1485 ShortCut = 24652 1506 ShortCut = 24652
1486 end 1507 end
1487 item 1508 item
1488 Command = ecTab 1509 Command = ecTab
1489 ShortCut = 9 1510 ShortCut = 9
1490 end 1511 end
1491 item 1512 item
1492 Command = ecShiftTab 1513 Command = ecShiftTab
1493 ShortCut = 8201 1514 ShortCut = 8201
1494 end 1515 end
1495 item 1516 item
1496 Command = ecMatchBracket 1517 Command = ecMatchBracket
1497 ShortCut = 24642 1518 ShortCut = 24642
1498 end 1519 end
1499 item 1520 item
1500 Command = ecColSelUp 1521 Command = ecColSelUp
1501 ShortCut = 40998 1522 ShortCut = 40998
1502 end 1523 end
1503 item 1524 item
1504 Command = ecColSelDown 1525 Command = ecColSelDown
1505 ShortCut = 41000 1526 ShortCut = 41000
1506 end 1527 end
1507 item 1528 item
1508 Command = ecColSelLeft 1529 Command = ecColSelLeft
1509 ShortCut = 40997 1530 ShortCut = 40997
1510 end 1531 end
1511 item 1532 item
1512 Command = ecColSelRight 1533 Command = ecColSelRight
1513 ShortCut = 40999 1534 ShortCut = 40999
1514 end 1535 end
1515 item 1536 item
1516 Command = ecColSelPageDown 1537 Command = ecColSelPageDown
1517 ShortCut = 40994 1538 ShortCut = 40994
1518 end 1539 end
1519 item 1540 item
1520 Command = ecColSelPageBottom 1541 Command = ecColSelPageBottom
1521 ShortCut = 57378 1542 ShortCut = 57378
1522 end 1543 end
1523 item 1544 item
1524 Command = ecColSelPageUp 1545 Command = ecColSelPageUp
1525 ShortCut = 40993 1546 ShortCut = 40993
1526 end 1547 end
1527 item 1548 item
1528 Command = ecColSelPageTop 1549 Command = ecColSelPageTop
1529 ShortCut = 57377 1550 ShortCut = 57377
1530 end 1551 end
1531 item 1552 item
1532 Command = ecColSelLineStart 1553 Command = ecColSelLineStart
1533 ShortCut = 40996 1554 ShortCut = 40996
1534 end 1555 end
1535 item 1556 item
1536 Command = ecColSelLineEnd 1557 Command = ecColSelLineEnd
1537 ShortCut = 40995 1558 ShortCut = 40995
1538 end 1559 end
1539 item 1560 item
1540 Command = ecColSelEditorTop 1561 Command = ecColSelEditorTop
1541 ShortCut = 57380 1562 ShortCut = 57380
1542 end 1563 end
1543 item 1564 item
1544 Command = ecColSelEditorBottom 1565 Command = ecColSelEditorBottom
1545 ShortCut = 57379 1566 ShortCut = 57379
@@ -1639,11 +1660,11 @@ object frmTracker: TfrmTracker
1639 Left = 0 1660 Left = 0
1640 Height = 64 1661 Height = 64
1641 Top = 25 1662 Top = 25
1642 Width = 1232 1663 Width = 1318
1643 Align = alTop 1664 Align = alTop
1644 BevelOuter = bvNone 1665 BevelOuter = bvNone
1645 ClientHeight = 64 1666 ClientHeight = 64
1646 ClientWidth = 1232 1667 ClientWidth = 1318
1647 ParentFont = False 1668 ParentFont = False
1648 TabOrder = 3 1669 TabOrder = 3
1649 object LEDMeter1: TLEDMeter 1670 object LEDMeter1: TLEDMeter
@@ -1651,7 +1672,7 @@ object frmTracker: TfrmTracker
1651 Left = 0 1672 Left = 0
1652 Height = 32 1673 Height = 32
1653 Top = 32 1674 Top = 32
1654 Width = 444 1675 Width = 530
1655 Anchors = [akTop, akLeft, akRight] 1676 Anchors = [akTop, akLeft, akRight]
1656 BevelStyle = bvLowered 1677 BevelStyle = bvLowered
1657 Colors.Border = 2168839 1678 Colors.Border = 2168839
@@ -1674,7 +1695,7 @@ object frmTracker: TfrmTracker
1674 Left = 0 1695 Left = 0
1675 Height = 32 1696 Height = 32
1676 Top = 0 1697 Top = 0
1677 Width = 444 1698 Width = 530
1678 Anchors = [akTop, akLeft, akRight] 1699 Anchors = [akTop, akLeft, akRight]
1679 BevelStyle = bvLowered 1700 BevelStyle = bvLowered
1680 Colors.Border = 2168839 1701 Colors.Border = 2168839
@@ -1693,7 +1714,7 @@ object frmTracker: TfrmTracker
1693 Section3Value = 48 1714 Section3Value = 48
1694 end 1715 end
1695 object Duty1Visualizer: TPaintBox 1716 object Duty1Visualizer: TPaintBox
1696 Left = 444 1717 Left = 530
1697 Height = 64 1718 Height = 64
1698 Top = 0 1719 Top = 0
1699 Width = 197 1720 Width = 197
@@ -1703,7 +1724,7 @@ object frmTracker: TfrmTracker
1703 OnPaint = Duty1VisualizerPaint 1724 OnPaint = Duty1VisualizerPaint
1704 end 1725 end
1705 object Duty2Visualizer: TPaintBox 1726 object Duty2Visualizer: TPaintBox
1706 Left = 641 1727 Left = 727
1707 Height = 64 1728 Height = 64
1708 Top = 0 1729 Top = 0
1709 Width = 197 1730 Width = 197
@@ -1713,7 +1734,7 @@ object frmTracker: TfrmTracker
1713 OnPaint = Duty2VisualizerPaint 1734 OnPaint = Duty2VisualizerPaint
1714 end 1735 end
1715 object WaveVisualizer: TPaintBox 1736 object WaveVisualizer: TPaintBox
1716 Left = 838 1737 Left = 924
1717 Height = 64 1738 Height = 64
1718 Top = 0 1739 Top = 0
1719 Width = 197 1740 Width = 197
@@ -1723,7 +1744,7 @@ object frmTracker: TfrmTracker
1723 OnPaint = WaveVisualizerPaint 1744 OnPaint = WaveVisualizerPaint
1724 end 1745 end
1725 object NoiseVisualizer: TPaintBox 1746 object NoiseVisualizer: TPaintBox
1726 Left = 1035 1747 Left = 1121
1727 Height = 64 1748 Height = 64
1728 Top = 0 1749 Top = 0
1729 Width = 197 1750 Width = 197
@@ -1736,16 +1757,16 @@ object frmTracker: TfrmTracker
1736 object StatusBar1: TStatusBar 1757 object StatusBar1: TStatusBar
1737 Left = 0 1758 Left = 0
1738 Height = 23 1759 Height = 23
1739 Top = 611 1760 Top = 814
1740 Width = 1232 1761 Width = 1318
1741 AutoHint = True 1762 AutoHint = True
1742 Panels = < 1763 Panels = <
1743 item 1764 item
1744 Width = 467 1765 Width = 467
1745 end 1766 end
1746 item 1767 item
1747 Width = 200 1768 Width = 200
1748 end 1769 end
1749 item 1770 item
1750 Width = 200 1771 Width = 200
1751 end> 1772 end>
@@ -1758,7 +1779,7 @@ object frmTracker: TfrmTracker
1758 Left = 0 1779 Left = 0
1759 Height = 25 1780 Height = 25
1760 Top = 0 1781 Top = 0
1761 Width = 1232 1782 Width = 1318
1762 AutoSize = True 1783 AutoSize = True
1763 Caption = 'ToolBar1' 1784 Caption = 'ToolBar1'
1764 EdgeBorders = [ebBottom] 1785 EdgeBorders = [ebBottom]
@@ -1956,12 +1977,12 @@ object frmTracker: TfrmTracker
1956 Caption = '-' 1977 Caption = '-'
1957 end 1978 end
1958 object MenuItem34: TMenuItem 1979 object MenuItem34: TMenuItem
1959 Caption = 'Import GBT Player ...' 1980 Caption = 'Import GBT Player MOD ...'
1960 ImageIndex = 78 1981 ImageIndex = 78
1961 OnClick = MenuItem34Click 1982 OnClick = MenuItem34Click
1962 end 1983 end
1963 object MenuItem41: TMenuItem 1984 object MenuItem41: TMenuItem
1964 Caption = 'Import DefleMask ...' 1985 Caption = 'Import DefleMask DMF ...'
1965 ImageIndex = 79 1986 ImageIndex = 79
1966 OnClick = MenuItem41Click 1987 OnClick = MenuItem41Click
1967 end 1988 end
@@ -2067,10 +2088,6 @@ object frmTracker: TfrmTracker
2067 Caption = 'Find problems in song' 2088 Caption = 'Find problems in song'
2068 end 2089 end
2069 end 2090 end
2070 object DebugPlayNoteButton: TMenuItem
2071 Caption = 'Debug play note'
2072 OnClick = DebugPlayNoteButtonClick
2073 end
2074 object DebugButton: TMenuItem 2091 object DebugButton: TMenuItem
2075 Caption = 'Debug button' 2092 Caption = 'Debug button'
2076 OnClick = DebugButtonClick 2093 OnClick = DebugButtonClick
@@ -2987,7 +3004,7 @@ object frmTracker: TfrmTracker
2987 end 3004 end
2988 object RGBDSAsmSaveDialog: TSaveDialog 3005 object RGBDSAsmSaveDialog: TSaveDialog
2989 Filter = 'RGBDS Assembly|*.asm' 3006 Filter = 'RGBDS Assembly|*.asm'
2990 Left = 248 3007 Left = 272
2991 Top = 64 3008 Top = 48
2992 end 3009 end
2993 end 3010 end
Modifiedtracker.pas +109−166
@@ -6,12 +6,11 @@ interface
6 uses 6 uses
7 Classes, SysUtils, Forms, Controls, Graphics, Dialogs, ExtCtrls, ComCtrls, 7 Classes, SysUtils, Forms, Controls, Graphics, Dialogs, ExtCtrls, ComCtrls,
8 Menus, Spin, StdCtrls, ActnList, StdActns, SynEdit, SynHighlighterAny, 8 Menus, Spin, StdCtrls, ActnList, StdActns, SynEdit, SynHighlighterAny,
9 FileUtil, math, Instruments, Waves, Song, Utils, Constants, 9 FileUtil, math, Instruments, Song, Utils, Constants,
10 sound, vars, machine, about_hugetracker, TrackerGrid, lclintf, lmessages, 10 sound, vars, machine, about_hugetracker, TrackerGrid, lclintf, lmessages,
11 Buttons, Grids, DBCtrls, HugeDatatypes, LCLType, Clipbrd, RackCtls, Codegen, 11 Buttons, Grids, DBCtrls, HugeDatatypes, LCLType, Clipbrd, RackCtls, Codegen,
12 SymParser, options, bgrabitmap, effecteditor, RenderToWave, 12 SymParser, options, bgrabitmap, effecteditor, RenderToWave,
13 modimport, beepboximport, mainloop, strutils, Types, Keymap, hUGESettings, 13 modimport, mainloop, strutils, Types, Keymap, hUGESettings;
14 dmfimport;
15 14
16 // TODO: Move to config file? 15 // TODO: Move to config file?
17 const 16 const
@@ -43,7 +42,11 @@ type
43 { TfrmTracker } 42 { TfrmTracker }
44 43
45 TfrmTracker = class(TForm) 44 TfrmTracker = class(TForm)
45 EnableSubpatternCheckbox: TCheckBox;
46 DecreaseOctaveAction: TAction; 46 DecreaseOctaveAction: TAction;
47 SubpatternGroupBox: TGroupBox;
48 RowNumberStringGrid1: TStringGrid;
49 ScrollBox2: TScrollBox;
47 IncreaseOctaveAction: TAction; 50 IncreaseOctaveAction: TAction;
48 IncrementCurrentInstrumentAction: TAction; 51 IncrementCurrentInstrumentAction: TAction;
49 DecrementCurrentInstrumentAction: TAction; 52 DecrementCurrentInstrumentAction: TAction;
@@ -67,8 +70,6 @@ type
67 MenuItem43: TMenuItem; 70 MenuItem43: TMenuItem;
68 MenuItem44: TMenuItem; 71 MenuItem44: TMenuItem;
69 MenuItem54: TMenuItem; 72 MenuItem54: TMenuItem;
70 NoiseMacroPaintbox: TPaintBox;
71 Panel6: TPanel;
72 GBDKCSaveDialog: TSaveDialog; 73 GBDKCSaveDialog: TSaveDialog;
73 RGBDSAsmSaveDialog: TSaveDialog; 74 RGBDSAsmSaveDialog: TSaveDialog;
74 StopAction: TAction; 75 StopAction: TAction;
@@ -219,7 +220,6 @@ type
219 WaveEditNumberSpinner: TSpinEdit; 220 WaveEditNumberSpinner: TSpinEdit;
220 WaveEditGroupBox: TGroupBox; 221 WaveEditGroupBox: TGroupBox;
221 Label19: TLabel; 222 Label19: TLabel;
222 DebugPlayNoteButton: TMenuItem;
223 WaveEditPaintBox: TPaintBox; 223 WaveEditPaintBox: TPaintBox;
224 RoutineNumberSpinner: TSpinEdit; 224 RoutineNumberSpinner: TSpinEdit;
225 Label17: TLabel; 225 Label17: TLabel;
@@ -268,7 +268,6 @@ type
268 SampleSongsMenuItem: TMenuItem; 268 SampleSongsMenuItem: TMenuItem;
269 MenuItem5: TMenuItem; 269 MenuItem5: TMenuItem;
270 PageControl1: TPageControl; 270 PageControl1: TPageControl;
271 PaintBox1: TPaintBox;
272 WavePaintbox: TPaintBox; 271 WavePaintbox: TPaintBox;
273 Panel1: TPanel; 272 Panel1: TPanel;
274 Panel2: TPanel; 273 Panel2: TPanel;
@@ -283,7 +282,10 @@ type
283 StatusBar1: TStatusBar; 282 StatusBar1: TStatusBar;
284 TreeView1: TTreeView; 283 TreeView1: TTreeView;
285 TrackerGrid: TTrackerGrid; 284 TrackerGrid: TTrackerGrid;
285 TableGrid: TTableGrid;
286 procedure TrackerPopupMixPasteClick(Sender: TObject); 286 procedure TrackerPopupMixPasteClick(Sender: TObject);
287 procedure EnableSubpatternCheckboxChange(Sender: TObject);
288 procedure FormShow(Sender: TObject);
287 procedure TestOctaveButtonClick(Sender: TObject); 289 procedure TestOctaveButtonClick(Sender: TObject);
288 procedure DebugButtonClick(Sender: TObject); 290 procedure DebugButtonClick(Sender: TObject);
289 procedure DecreaseOctaveActionExecute(Sender: TObject); 291 procedure DecreaseOctaveActionExecute(Sender: TObject);
@@ -316,11 +318,8 @@ type
316 procedure MenuItem41Click(Sender: TObject); 318 procedure MenuItem41Click(Sender: TObject);
317 procedure NoiseMacroPaintboxMouseDown(Sender: TObject; 319 procedure NoiseMacroPaintboxMouseDown(Sender: TObject;
318 Button: TMouseButton; Shift: TShiftState; X, Y: Integer); 320 Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
319 procedure NoiseMacroPaintboxMouseMove(Sender: TObject; Shift: TShiftState;
320 X, Y: Integer);
321 procedure NoiseMacroPaintboxMouseUp(Sender: TObject; Button: TMouseButton; 321 procedure NoiseMacroPaintboxMouseUp(Sender: TObject; Button: TMouseButton;
322 Shift: TShiftState; X, Y: Integer); 322 Shift: TShiftState; X, Y: Integer);
323 procedure NoiseMacroPaintboxPaint(Sender: TObject);
324 procedure OrderEditStringGridCellProcess(Sender: TObject; aCol, 323 procedure OrderEditStringGridCellProcess(Sender: TObject; aCol,
325 aRow: Integer; processType: TCellProcessType; var aValue: string); 324 aRow: Integer; processType: TCellProcessType; var aValue: string);
326 procedure OrderEditStringGridValidateEntry(sender: TObject; aCol, 325 procedure OrderEditStringGridValidateEntry(sender: TObject; aCol,
@@ -331,7 +330,6 @@ type
331 MousePos: TPoint; var Handled: Boolean); 330 MousePos: TPoint; var Handled: Boolean);
332 procedure ScrollBox1MouseWheelUp(Sender: TObject; Shift: TShiftState; 331 procedure ScrollBox1MouseWheelUp(Sender: TObject; Shift: TShiftState;
333 MousePos: TPoint; var Handled: Boolean); 332 MousePos: TPoint; var Handled: Boolean);
334 procedure FormShow(Sender: TObject);
335 procedure InstrumentComboBoxChange(Sender: TObject); 333 procedure InstrumentComboBoxChange(Sender: TObject);
336 procedure CopyActionExecute(Sender: TObject); 334 procedure CopyActionExecute(Sender: TObject);
337 procedure CutActionExecute(Sender: TObject); 335 procedure CutActionExecute(Sender: TObject);
@@ -362,7 +360,6 @@ type
362 procedure InstrumentNameEditChange(Sender: TObject); 360 procedure InstrumentNameEditChange(Sender: TObject);
363 procedure InstrumentNumberSpinnerChange(Sender: TObject); 361 procedure InstrumentNumberSpinnerChange(Sender: TObject);
364 procedure LengthSpinnerChange(Sender: TObject); 362 procedure LengthSpinnerChange(Sender: TObject);
365 procedure DebugPlayNoteButtonClick(Sender: TObject);
366 procedure MenuItem11Click(Sender: TObject); 363 procedure MenuItem11Click(Sender: TObject);
367 procedure MenuItem12Click(Sender: TObject); 364 procedure MenuItem12Click(Sender: TObject);
368 procedure MenuItem14Click(Sender: TObject); 365 procedure MenuItem14Click(Sender: TObject);
@@ -433,7 +430,6 @@ type
433 procedure WaveEditPaintBoxPaint(Sender: TObject); 430 procedure WaveEditPaintBoxPaint(Sender: TObject);
434 procedure InstrumentTypeComboboxChange(Sender: TObject); 431 procedure InstrumentTypeComboboxChange(Sender: TObject);
435 procedure LengthEnabledCheckboxChange(Sender: TObject); 432 procedure LengthEnabledCheckboxChange(Sender: TObject);
436 procedure PaintBox1Paint(Sender: TObject);
437 procedure SevenBitCounterCheckboxChange(Sender: TObject); 433 procedure SevenBitCounterCheckboxChange(Sender: TObject);
438 procedure SongEditChange(Sender: TObject); 434 procedure SongEditChange(Sender: TObject);
439 procedure StartVolSpinnerChange(Sender: TObject); 435 procedure StartVolSpinnerChange(Sender: TObject);
@@ -450,6 +446,7 @@ type
450 CurrentWave: ^TWave; 446 CurrentWave: ^TWave;
451 CurrentInstrumentBank: TInstrumentType; 447 CurrentInstrumentBank: TInstrumentType;
452 LoadedFileName: String; 448 LoadedFileName: String;
449 SubpatternMap: TPatternMap;
453 450
454 PreviewingInstrument: Integer; 451 PreviewingInstrument: Integer;
455 PreviewingWithKey: Word; 452 PreviewingWithKey: Word;
@@ -459,7 +456,6 @@ type
459 SaveSucceeded: Boolean; 456 SaveSucceeded: Boolean;
460 ScopesOn: Boolean; 457 ScopesOn: Boolean;
461 458
462 {PatternsNode, }
463 WaveInstrumentsNode, 459 WaveInstrumentsNode,
464 NoiseInstrumentsNode, 460 NoiseInstrumentsNode,
465 DutyInstrumentsNode, 461 DutyInstrumentsNode,
@@ -549,9 +545,11 @@ var
549 begin 545 begin
550 HaltPlayback; 546 HaltPlayback;
551 547
548 SubpatternMap.Clear;
549 for I := Low(Song.Instruments.All) to High(Song.Instruments.All) do
550 SubpatternMap.Add(I, @Song.Instruments.All[I].Subpattern);
551
552 LoadingFile := True; // HACK!!!!! 552 LoadingFile := True; // HACK!!!!!
553 LoadInstrument(itSquare, 1);
554 LoadWave(0);
555 553
556 RoutineSynedit.Text := Song.Routines[0]; 554 RoutineSynedit.Text := Song.Routines[0];
557 RoutineNumberSpinner.Value := 0; 555 RoutineNumberSpinner.Value := 0;
@@ -579,7 +577,6 @@ begin
579 InstrumentComboBox.Items.Add('Noise '+IntToStr(I)+': '+Song.Instruments.Noise[ModInst(I)].Name); 577 InstrumentComboBox.Items.Add('Noise '+IntToStr(I)+': '+Song.Instruments.Noise[ModInst(I)].Name);
580 578
581 InstrumentComboBox.ItemIndex := 0; 579 InstrumentComboBox.ItemIndex := 0;
582 //TrackerGrid.SelectedInstrument := 1; //ModInst(InstrumentComboBox.ItemIndex);
583 580
584 for I := Low(TInstrumentBank) to High(TInstrumentBank) do begin 581 for I := Low(TInstrumentBank) to High(TInstrumentBank) do begin
585 DutyInstrumentsNode.Items[I-1].Text := IntToStr(I)+': '+Song.Instruments.Duty[I].Name; 582 DutyInstrumentsNode.Items[I-1].Text := IntToStr(I)+': '+Song.Instruments.Duty[I].Name;
@@ -587,6 +584,9 @@ begin
587 NoiseInstrumentsNode.Items[I-1].Text := IntToStr(I)+': '+Song.Instruments.Noise[I].Name; 584 NoiseInstrumentsNode.Items[I-1].Text := IntToStr(I)+': '+Song.Instruments.Noise[I].Name;
588 end; 585 end;
589 586
587 LoadInstrument(itSquare, 1);
588 LoadWave(0);
589
590 LoadingFile := False; // HACK!!!! 590 LoadingFile := False; // HACK!!!!
591 591
592 OrderEditStringGrid.Row := 1; 592 OrderEditStringGrid.Row := 1;
@@ -850,7 +850,7 @@ begin
850 Spokeb(Addr+1, Regs.NR41); 850 Spokeb(Addr+1, Regs.NR41);
851 851
852 for I := 0 to 5 do begin 852 for I := 0 to 5 do begin
853 Spokeb(Addr+2+I, Byte(Instr.NoiseMacro[I])); 853 Spokeb(Addr+2+I, Byte(0));
854 end; 854 end;
855 855
856 PokeSymbol(SYM_HALT_MACRO_INDEX, 1); 856 PokeSymbol(SYM_HALT_MACRO_INDEX, 1);
@@ -924,18 +924,20 @@ end;
924 procedure TfrmTracker.LoadSong(Filename: String); 924 procedure TfrmTracker.LoadSong(Filename: String);
925 var 925 var
926 Stream: TStream; 926 Stream: TStream;
927 TempSong: TSong;
927 begin 928 begin
928 DestroySong(Song); 929 Stream := TFileStream.Create(FileName, fmOpenRead);
929
930 stream := TFileStream.Create(FileName, fmOpenRead);
931 try 930 try
932 ReadSongFromStream(stream, Song); 931 ReadSongFromStream(stream, TempSong);
933 finally 932 DestroySong(Song);
934 stream.Free; 933 Song := TempSong;
934 FileSaveAs1.Dialog.FileName := FileName;
935 UpdateUIAfterLoad(Filename);
936 except
937 on E: ESongVersionException do
938 ShowMessage('This song was created with a newer version of hUGETracker, and cannot be loaded.');
935 end; 939 end;
936 FileSaveAs1.Dialog.FileName := FileName; 940 Stream.Free;
937
938 UpdateUIAfterLoad(Filename);
939 end; 941 end;
940 942
941 procedure TfrmTracker.ReloadPatterns; 943 procedure TfrmTracker.ReloadPatterns;
@@ -1150,20 +1152,32 @@ procedure TfrmTracker.RecreateTrackerGrid;
1150 var 1152 var
1151 I: Integer; 1153 I: Integer;
1152 begin 1154 begin
1155 // Recreate TrackerGrid
1153 if Assigned(TrackerGrid) then TrackerGrid.Free; 1156 if Assigned(TrackerGrid) then TrackerGrid.Free;
1154 TrackerGrid := TTrackerGrid.Create(Self, ScrollBox1, Song.Patterns); 1157 TrackerGrid := TTrackerGrid.Create(Self, ScrollBox1, Song.Patterns, 4);
1155 TrackerGrid.OnResize:=@OnTrackerGridResize; 1158 TrackerGrid.OnResize:=@OnTrackerGridResize;
1156 TrackerGrid.OnCursorOutOfBounds:=@OnTrackerGridCursorOutOfBounds; 1159 TrackerGrid.OnCursorOutOfBounds:=@OnTrackerGridCursorOutOfBounds;
1157 TrackerGrid.Left := RowNumberStringGrid.Left + RowNumberStringGrid.Width;
1158 TrackerGrid.FontSize := TrackerSettings.PatternEditorFontSize; 1160 TrackerGrid.FontSize := TrackerSettings.PatternEditorFontSize;
1161 TrackerGrid.Left := RowNumberStringGrid.Left + RowNumberStringGrid.Width;
1162 TrackerGrid.PopupMenu := TrackerGridPopup;
1159 RowNumberStringGrid.DefaultRowHeight := TrackerGrid.RowHeight; 1163 RowNumberStringGrid.DefaultRowHeight := TrackerGrid.RowHeight;
1160 ScopesOn := TrackerSettings.UseScopes; 1164 RowNumberStringGrid.DisabledFontColor := RowNumberStringGrid.Font.Color;
1165
1166 // Recreate TableGrid
1167 if Assigned(TableGrid) then TableGrid.Free;
1168 TableGrid := TTableGrid.Create(Self, ScrollBox2, SubpatternMap, 1, 32);
1169
1170 TableGrid.FontSize := TrackerSettings.PatternEditorFontSize;
1171 TableGrid.Left := RowNumberStringGrid1.Left - TableGrid.Width;
1172 TableGrid.PopupMenu := TrackerGridPopup;
1173 RowNumberStringGrid1.DefaultRowHeight := TrackerGrid.RowHeight;
1174 RowNumberStringGrid1.DisabledFontColor := RowNumberStringGrid1.Font.Color;
1175
1176 SubpatternGroupBox.Width := RowNumberStringGrid1.Width + TableGrid.Width + 10;
1161 1177
1162 // Fix the size of the channel headers 1178 // Fix the size of the channel headers
1163 for I := 1 to HeaderControl1.Sections.Count-1 do 1179 for I := 1 to HeaderControl1.Sections.Count-1 do
1164 HeaderControl1.Sections.Items[I].Width := TrackerGrid.ColumnWidth; 1180 HeaderControl1.Sections.Items[I].Width := TrackerGrid.ColumnWidth;
1165
1166 TrackerGrid.PopupMenu := TrackerGridPopup;
1167 end; 1181 end;
1168 1182
1169 procedure TfrmTracker.RecreateRowNumbers; 1183 procedure TfrmTracker.RecreateRowNumbers;
@@ -1171,13 +1185,19 @@ var
1171 I: Integer; 1185 I: Integer;
1172 begin 1186 begin
1173 RowNumberStringGrid.Clean; 1187 RowNumberStringGrid.Clean;
1188 RowNumberStringGrid1.Clean;
1174 // Add the row numbers to the string grid 1189 // Add the row numbers to the string grid
1175 for I := 0 to RowNumberStringGrid.RowCount-1 do begin 1190 for I := 0 to RowNumberStringGrid.RowCount-1 do
1176 if TrackerSettings.DisplayRowNumbersAsHex then 1191 if TrackerSettings.DisplayRowNumbersAsHex then
1177 RowNumberStringGrid.Cells[0, I] := IntToHex(I, 2) 1192 RowNumberStringGrid.Cells[0, I] := IntToHex(I, 2)
1178 else 1193 else
1179 RowNumberStringGrid.Cells[0, I] := IntToStr(I) 1194 RowNumberStringGrid.Cells[0, I] := IntToStr(I);
1180 end; 1195
1196 for I := 0 to RowNumberStringGrid1.RowCount-1 do
1197 if TrackerSettings.DisplayRowNumbersAsHex then
1198 RowNumberStringGrid1.Cells[0, I] := IntToHex(I, 2)
1199 else
1200 RowNumberStringGrid1.Cells[0, I] := IntToStr(I);
1181 end; 1201 end;
1182 1202
1183 procedure TfrmTracker.LoadInstrument(Bank: TInstrumentType; Instr: Integer); 1203 procedure TfrmTracker.LoadInstrument(Bank: TInstrumentType; Instr: Integer);
@@ -1192,11 +1212,14 @@ begin
1192 end; 1212 end;
1193 CI := CurrentInstrument; 1213 CI := CurrentInstrument;
1194 1214
1215 TableGrid.LoadPattern(0, UnmodInst(Bank, Instr));
1216
1195 InstrumentTypeComboBox.ItemIndex := Integer(CurrentInstrumentBank); 1217 InstrumentTypeComboBox.ItemIndex := Integer(CurrentInstrumentBank);
1196 InstrumentNumberSpinner.Value := Instr; 1218 InstrumentNumberSpinner.Value := Instr;
1197 InstrumentNameEdit.Text := CI^.Name; 1219 InstrumentNameEdit.Text := CI^.Name;
1198 LengthEnabledCheckbox.Checked := CI^.LengthEnabled; 1220 LengthEnabledCheckbox.Checked := CI^.LengthEnabled;
1199 LengthTrackbar.Position := CI^.Length; 1221 LengthTrackbar.Position := CI^.Length;
1222 EnableSubpatternCheckbox.Checked := CI^.SubpatternEnabled;
1200 1223
1201 case CI^.Type_ of 1224 case CI^.Type_ of
1202 itSquare: begin 1225 itSquare: begin
@@ -1237,15 +1260,12 @@ begin
1237 end; 1260 end;
1238 1261
1239 itNoise: begin 1262 itNoise: begin
1240 //ShiftClockTrackbar.Position := CI^.ShiftClockFreq;
1241 //DivRatioTrackbar.Position := CI^.DividingRatio;
1242 SevenBitCounterCheckbox.Checked := CI^.CounterStep = swSeven; 1263 SevenBitCounterCheckbox.Checked := CI^.CounterStep = swSeven;
1243 end; 1264 end;
1244 end; 1265 end;
1245 1266
1246 WavePaintbox.Invalidate; 1267 WavePaintbox.Invalidate;
1247 EnvelopePaintBox.Invalidate; 1268 EnvelopePaintBox.Invalidate;
1248 NoiseMacroPaintbox.Invalidate;
1249 end; 1269 end;
1250 1270
1251 procedure TfrmTracker.ChangeToSquare; 1271 procedure TfrmTracker.ChangeToSquare;
@@ -1329,15 +1349,6 @@ begin
1329 Application.Terminate; 1349 Application.Terminate;
1330 end; 1350 end;
1331 1351
1332 procedure TfrmTracker.PaintBox1Paint(Sender: TObject);
1333 begin
1334 PaintBox1.Canvas.Brush.Color := clBlack;
1335 PaintBox1.Canvas.Pen.Color := clBlack;
1336 PaintBox1.Canvas.Clear;
1337 if WaveformCombobox.ItemIndex > -1 then
1338 DrawWaveform(PaintBox1, Song.Waves[WaveformCombobox.ItemIndex]);
1339 end;
1340
1341 procedure TfrmTracker.SevenBitCounterCheckboxChange(Sender: TObject); 1352 procedure TfrmTracker.SevenBitCounterCheckboxChange(Sender: TObject);
1342 begin 1353 begin
1343 if SevenBitCounterCheckbox.Checked then 1354 if SevenBitCounterCheckbox.Checked then
@@ -1418,6 +1429,7 @@ begin
1418 {$endif} 1429 {$endif}
1419 1430
1420 VisualizerBuffer := TBGRABitmap.Create(Duty1Visualizer.Width, Duty1Visualizer.Height); 1431 VisualizerBuffer := TBGRABitmap.Create(Duty1Visualizer.Width, Duty1Visualizer.Height);
1432 SubpatternMap := TPatternMap.Create;
1421 1433
1422 PreviewingInstrument := -1; 1434 PreviewingInstrument := -1;
1423 1435
@@ -1457,9 +1469,6 @@ begin
1457 // Initialize ticks per row 1469 // Initialize ticks per row
1458 Song.TicksPerRow := TicksPerRowSpinEdit.Value; 1470 Song.TicksPerRow := TicksPerRowSpinEdit.Value;
1459 1471
1460 LoadInstrument(itSquare, 1);
1461 LoadWave(0);
1462
1463 // Initialize order table (InitializeSong creates the default order table) 1472 // Initialize order table (InitializeSong creates the default order table)
1464 CopyOrderMatrixToOrderGrid; 1473 CopyOrderMatrixToOrderGrid;
1465 1474
@@ -1481,7 +1490,6 @@ begin
1481 1490
1482 {$ifdef PRODUCTION} 1491 {$ifdef PRODUCTION}
1483 DebugButton.Visible := False; 1492 DebugButton.Visible := False;
1484 DebugPlayNoteButton.Visible := False;
1485 MenuItem41.Visible := False; 1493 MenuItem41.Visible := False;
1486 {$endif} 1494 {$endif}
1487 1495
@@ -1498,10 +1506,8 @@ begin
1498 SampleSongsMenuItem.Enabled := False; 1506 SampleSongsMenuItem.Enabled := False;
1499 1507
1500 // If a command line param was passed, try to open it 1508 // If a command line param was passed, try to open it
1501 if FileExists(ParamStr(1)) and (ExtractFileExt(ParamStr(1)) = '.uge') then begin 1509 if FileExists(ParamStr(1)) and (ExtractFileExt(ParamStr(1)) = '.uge') then
1502 LoadSong(ParamStr(1)); 1510 LoadSong(ParamStr(1))
1503 UpdateUIAfterLoad(ParamStr(1));
1504 end
1505 else 1511 else
1506 UpdateUIAfterLoad; 1512 UpdateUIAfterLoad;
1507 end; 1513 end;
@@ -1660,7 +1666,6 @@ end;
1660 procedure TfrmTracker.FileOpen1Accept(Sender: TObject); 1666 procedure TfrmTracker.FileOpen1Accept(Sender: TObject);
1661 begin 1667 begin
1662 LoadSong(FileOpen1.Dialog.FileName); 1668 LoadSong(FileOpen1.Dialog.FileName);
1663 UpdateUIAfterLoad(FileOpen1.Dialog.FileName);
1664 end; 1669 end;
1665 1670
1666 procedure TfrmTracker.HeaderControl1MouseDown(Sender: TObject; 1671 procedure TfrmTracker.HeaderControl1MouseDown(Sender: TObject;
@@ -1806,6 +1811,7 @@ procedure TfrmTracker.IncreaseOctaveActionExecute(Sender: TObject);
1806 begin 1811 begin
1807 OctaveSpinEdit.Value := OctaveSpinEdit.Value + 1; 1812 OctaveSpinEdit.Value := OctaveSpinEdit.Value + 1;
1808 TrackerGrid.SelectedOctave := OctaveSpinEdit.Value; 1813 TrackerGrid.SelectedOctave := OctaveSpinEdit.Value;
1814 TableGrid.SelectedOctave := OctaveSpinEdit.Value;
1809 end; 1815 end;
1810 1816
1811 procedure TfrmTracker.IncrementCurrentInstrumentActionExecute(Sender: TObject); 1817 procedure TfrmTracker.IncrementCurrentInstrumentActionExecute(Sender: TObject);
@@ -1859,21 +1865,8 @@ begin
1859 end; 1865 end;
1860 1866
1861 procedure TfrmTracker.MenuItem41Click(Sender: TObject); 1867 procedure TfrmTracker.MenuItem41Click(Sender: TObject);
1862 var
1863 Stream: TStream;
1864 begin 1868 begin
1865 if not CheckUnsavedChanges then Exit;
1866
1867 if True then begin
1868 DestroySong(Song);
1869 1869
1870 Stream := TFileStream.Create('C:/test/pokemon3.dmf', fmOpenRead);
1871 Song := LoadSongFromDmfStream(Stream);
1872
1873 Stream.Free;
1874
1875 UpdateUIAfterLoad('Bargus');
1876 end;
1877 end; 1870 end;
1878 1871
1879 procedure TfrmTracker.NoiseMacroPaintboxMouseDown(Sender: TObject; 1872 procedure TfrmTracker.NoiseMacroPaintboxMouseDown(Sender: TObject;
@@ -1882,61 +1875,12 @@ begin
1882 DrawingMacro := True; 1875 DrawingMacro := True;
1883 end; 1876 end;
1884 1877
1885 procedure TfrmTracker.NoiseMacroPaintboxMouseMove(Sender: TObject;
1886 Shift: TShiftState; X, Y: Integer);
1887 var
1888 MacroIdx, Val: Integer;
1889 begin
1890 if DrawingMacro then begin
1891 MacroIdx := EnsureRange(Trunc((X/NoiseMacroPaintbox.Width) * 6), 0, 5);
1892 Val := 32-EnsureRange(Trunc((Y/NoiseMacroPaintbox.Height) * 63), 0, 63);
1893
1894 CurrentInstrument^.NoiseMacro[MacroIdx] := Val;
1895 NoiseMacroPaintbox.Invalidate;
1896 end;
1897 end;
1898
1899 procedure TfrmTracker.NoiseMacroPaintboxMouseUp(Sender: TObject; 1878 procedure TfrmTracker.NoiseMacroPaintboxMouseUp(Sender: TObject;
1900 Button: TMouseButton; Shift: TShiftState; X, Y: Integer); 1879 Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
1901 begin 1880 begin
1902 DrawingMacro := False; 1881 DrawingMacro := False;
1903 end; 1882 end;
1904 1883
1905 procedure TfrmTracker.NoiseMacroPaintboxPaint(Sender: TObject);
1906 var
1907 BarWidth, BarStep: Double;
1908 I: Integer;
1909 Rect: TRect;
1910
1911 function FormatMacroNumber(Val: Integer): string;
1912 begin
1913 if Val = 0 then Exit('')
1914 else if Val > 0 then Exit('+'+IntToStr(Val))
1915 else Exit(IntToStr(Val));
1916 end;
1917
1918 begin
1919 BarWidth := (NoiseMacroPaintbox.Width / 6); // TODO: change this constant?
1920 BarStep := (NoiseMacroPaintbox.Height / 63);
1921 with NoiseMacroPaintbox.Canvas do begin
1922 Brush.Color := clGameboyBlack;
1923 Clear;
1924
1925 Brush.Color := clGameboyMidGreen;
1926 Pen.Color := clGameboyBlack;
1927 for I := Low(TNoiseMacro) to High(TNoiseMacro) do begin
1928 Rect := TRect.Create(
1929 Trunc(I*BarWidth),
1930 NoiseMacroPaintbox.Height div 2,
1931 Trunc((I+1)*BarWidth),
1932 Ceil((NoiseMacroPaintbox.Height / 2) - (CurrentInstrument^.NoiseMacro[I] * BarStep))
1933 );
1934 FillRect(Rect);
1935 TextOut(Rect.Left + Trunc(Rect.Width/2.5), Rect.Top + (Rect.Height div 2), FormatMacroNumber(CurrentInstrument^.NoiseMacro[I]));
1936 end;
1937 end;
1938 end;
1939
1940 procedure TfrmTracker.OrderEditStringGridCellProcess(Sender: TObject; aCol, 1884 procedure TfrmTracker.OrderEditStringGridCellProcess(Sender: TObject; aCol,
1941 aRow: Integer; processType: TCellProcessType; var aValue: string); 1885 aRow: Integer; processType: TCellProcessType; var aValue: string);
1942 begin 1886 begin
@@ -1987,9 +1931,9 @@ begin
1987 if ssCtrl in Shift then begin 1931 if ssCtrl in Shift then begin
1988 Handled := True; 1932 Handled := True;
1989 if ssShift in Shift then 1933 if ssShift in Shift then
1990 TrackerGrid.IncrementSelection(-12, -10, -0, -0, -$10) 1934 (ActiveControl as TTrackerGrid).IncrementSelection(-12, -10, -0, -0, -$10)
1991 else 1935 else
1992 TrackerGrid.IncrementSelection(-1, -1, -0, -0, -1); 1936 (ActiveControl as TTrackerGrid).IncrementSelection(-1, -1, -0, -0, -1);
1993 end 1937 end
1994 else 1938 else
1995 Handled := False; 1939 Handled := False;
@@ -2001,21 +1945,14 @@ begin
2001 if ssCtrl in Shift then begin 1945 if ssCtrl in Shift then begin
2002 Handled := True; 1946 Handled := True;
2003 if ssShift in Shift then 1947 if ssShift in Shift then
2004 TrackerGrid.IncrementSelection(12, 10, 0, 0, $10) 1948 (ActiveControl as TTrackerGrid).IncrementSelection(12, 10, 0, 0, $10)
2005 else 1949 else
2006 TrackerGrid.IncrementSelection(1, 1, 0, 0, 1); 1950 (ActiveControl as TTrackerGrid).IncrementSelection(1, 1, 0, 0, 1);
2007 end 1951 end
2008 else 1952 else
2009 Handled := False; 1953 Handled := False;
2010 end; 1954 end;
2011 1955
2012 procedure TfrmTracker.FormShow(Sender: TObject);
2013 begin
2014 // HACK: This needs to be done due to a scaling bug in the LCL.
2015 RecreateTrackerGrid;
2016 ReloadPatterns
2017 end;
2018
2019 procedure TfrmTracker.TestOctaveButtonClick(Sender: TObject); 1956 procedure TfrmTracker.TestOctaveButtonClick(Sender: TObject);
2020 begin 1957 begin
2021 case (Sender as TButton).Tag of 1958 case (Sender as TButton).Tag of
@@ -2033,25 +1970,32 @@ begin
2033 TrackerGrid.DoMixPaste 1970 TrackerGrid.DoMixPaste
2034 end; 1971 end;
2035 1972
2036 procedure TfrmTracker.DebugButtonClick(Sender: TObject); 1973 procedure TfrmTracker.FormShow(Sender: TObject);
2037 var
2038 S: TStream;
2039 begin 1974 begin
2040 S := TFileStream.Create('C:/test/bbs.json', fmOpenRead); 1975 { HACK: This needs to be done due to a scaling bug in the LCL.
2041 try 1976 For some reason, omitting these two lines causes the window to
2042 DestroySong(Song); 1977 appear at a weird size, not the one defined by the form editor. }
2043 Song := LoadSongFromBeepBoxJsonStream(S);
2044 finally
2045 S.Free;
2046 end;
2047 1978
2048 UpdateUIAfterLoad('Yeah!'); 1979 // TODO: Look into this! This makes literally zero sense.
1980 RecreateTrackerGrid;
1981 ReloadPatterns;
1982 LoadInstrument(itSquare, 1) // Load default pattern for tablegrid
1983 end;
1984
1985 procedure TfrmTracker.EnableSubpatternCheckboxChange(Sender: TObject);
1986 begin
1987 CurrentInstrument^.SubpatternEnabled := EnableSubpatternCheckbox.Checked;
1988 end;
1989
1990 procedure TfrmTracker.DebugButtonClick(Sender: TObject);
1991 begin
2049 end; 1992 end;
2050 1993
2051 procedure TfrmTracker.DecreaseOctaveActionExecute(Sender: TObject); 1994 procedure TfrmTracker.DecreaseOctaveActionExecute(Sender: TObject);
2052 begin 1995 begin
2053 OctaveSpinEdit.Value := OctaveSpinEdit.Value - 1; 1996 OctaveSpinEdit.Value := OctaveSpinEdit.Value - 1;
2054 TrackerGrid.SelectedOctave := OctaveSpinEdit.Value; 1997 TrackerGrid.SelectedOctave := OctaveSpinEdit.Value;
1998 TableGrid.SelectedOctave := OctaveSpinEdit.Value;
2055 end; 1999 end;
2056 2000
2057 procedure TfrmTracker.DecrementCurrentInstrumentActionExecute(Sender: TObject); 2001 procedure TfrmTracker.DecrementCurrentInstrumentActionExecute(Sender: TObject);
@@ -2114,6 +2058,7 @@ end;
2114 procedure TfrmTracker.OctaveSpinEditChange(Sender: TObject); 2058 procedure TfrmTracker.OctaveSpinEditChange(Sender: TObject);
2115 begin 2059 begin
2116 TrackerGrid.SelectedOctave := OctaveSpinEdit.Value; 2060 TrackerGrid.SelectedOctave := OctaveSpinEdit.Value;
2061 TableGrid.SelectedOctave := OctaveSpinEdit.Value;
2117 end; 2062 end;
2118 2063
2119 procedure TfrmTracker.RoutineNumberSpinnerChange(Sender: TObject); 2064 procedure TfrmTracker.RoutineNumberSpinnerChange(Sender: TObject);
@@ -2137,6 +2082,7 @@ end;
2137 procedure TfrmTracker.StepSpinEditChange(Sender: TObject); 2082 procedure TfrmTracker.StepSpinEditChange(Sender: TObject);
2138 begin 2083 begin
2139 TrackerGrid.Step := StepSpinEdit.Value; 2084 TrackerGrid.Step := StepSpinEdit.Value;
2085 TableGrid.Step := StepSpinEdit.Value;
2140 end; 2086 end;
2141 2087
2142 procedure TfrmTracker.StopActionExecute(Sender: TObject); 2088 procedure TfrmTracker.StopActionExecute(Sender: TObject);
@@ -2201,12 +2147,6 @@ begin
2201 EnvelopePaintBox.Invalidate; 2147 EnvelopePaintBox.Invalidate;
2202 end; 2148 end;
2203 2149
2204 procedure TfrmTracker.DebugPlayNoteButtonClick(Sender: TObject);
2205 begin
2206 PreviewInstrument(C_5, InstrumentNumberSpinner.Value);
2207 //PreviewInstrument(NotesToFreqs.KeyData[C_5], InstrumentComboBox.ItemIndex);
2208 end;
2209
2210 procedure TfrmTracker.MenuItem11Click(Sender: TObject); 2150 procedure TfrmTracker.MenuItem11Click(Sender: TObject);
2211 begin 2151 begin
2212 TrackerGrid.DoUndo; 2152 TrackerGrid.DoUndo;
@@ -2301,8 +2241,12 @@ begin
2301 frmOptions.ShowModal; 2241 frmOptions.ShowModal;
2302 2242
2303 TrackerGrid.FontSize := TrackerSettings.PatternEditorFontSize; 2243 TrackerGrid.FontSize := TrackerSettings.PatternEditorFontSize;
2244 TableGrid.FontSize := TrackerSettings.PatternEditorFontSize;
2304 RowNumberStringGrid.DefaultRowHeight := TrackerGrid.RowHeight; 2245 RowNumberStringGrid.DefaultRowHeight := TrackerGrid.RowHeight;
2305 OrderEditStringGrid.DrawHexAutonumbering := TrackerSettings.DisplayOrderRowNumbersAsHex; 2246 OrderEditStringGrid.DrawHexAutonumbering := TrackerSettings.DisplayOrderRowNumbersAsHex;
2247 RowNumberStringGrid1.DefaultRowHeight := TrackerGrid.RowHeight;
2248
2249 SubpatternGroupBox.Width := RowNumberStringGrid1.Width + TableGrid.Width + 10;
2306 2250
2307 ScopesOn := TrackerSettings.UseScopes; 2251 ScopesOn := TrackerSettings.UseScopes;
2308 2252
@@ -2317,7 +2261,7 @@ end;
2317 2261
2318 procedure TfrmTracker.MenuItem31Click(Sender: TObject); 2262 procedure TfrmTracker.MenuItem31Click(Sender: TObject);
2319 begin 2263 begin
2320 TrackerGrid.InterpolateSelection; 2264 (ActiveControl as TTrackerGrid).InterpolateSelection;
2321 end; 2265 end;
2322 2266
2323 procedure TfrmTracker.MenuItem33Click(Sender: TObject); 2267 procedure TfrmTracker.MenuItem33Click(Sender: TObject);
@@ -2355,22 +2299,22 @@ end;
2355 2299
2356 procedure TfrmTracker.OnIncrementValueBy1Click(Sender: TObject); 2300 procedure TfrmTracker.OnIncrementValueBy1Click(Sender: TObject);
2357 begin 2301 begin
2358 TrackerGrid.IncrementSelection(1, 1, 0, 0, 1); 2302 (ActiveControl as TTrackerGrid).IncrementSelection(1, 1, 0, 0, 1);
2359 end; 2303 end;
2360 2304
2361 procedure TfrmTracker.OnDecrementValueBy1Click(Sender: TObject); 2305 procedure TfrmTracker.OnDecrementValueBy1Click(Sender: TObject);
2362 begin 2306 begin
2363 TrackerGrid.IncrementSelection(-1, -1, 0, 0, -1); 2307 (ActiveControl as TTrackerGrid).IncrementSelection(-1, -1, 0, 0, -1);
2364 end; 2308 end;
2365 2309
2366 procedure TfrmTracker.OnIncrementValueBy10Click(Sender: TObject); 2310 procedure TfrmTracker.OnIncrementValueBy10Click(Sender: TObject);
2367 begin 2311 begin
2368 TrackerGrid.IncrementSelection(12, 10, 0, 0, $10); 2312 (ActiveControl as TTrackerGrid).IncrementSelection(12, 10, 0, 0, $10);
2369 end; 2313 end;
2370 2314
2371 procedure TfrmTracker.OnDecrementValueBy10Click(Sender: TObject); 2315 procedure TfrmTracker.OnDecrementValueBy10Click(Sender: TObject);
2372 begin 2316 begin
2373 TrackerGrid.IncrementSelection(-12, -10, 0, 0, -$10); 2317 (ActiveControl as TTrackerGrid).IncrementSelection(-12, -10, 0, 0, -$10);
2374 end; 2318 end;
2375 2319
2376 procedure TfrmTracker.MenuItem5Click(Sender: TObject); 2320 procedure TfrmTracker.MenuItem5Click(Sender: TObject);
@@ -2529,80 +2473,80 @@ end;
2529 2473
2530 procedure TfrmTracker.TrackerPopupCopyClick(Sender: TObject); 2474 procedure TfrmTracker.TrackerPopupCopyClick(Sender: TObject);
2531 begin 2475 begin
2532 SendMessage(TrackerGrid.Handle, LM_COPY, 0, 0) 2476 SendMessage((ActiveControl as TTrackerGrid).Handle, LM_COPY, 0, 0)
2533 end; 2477 end;
2534 2478
2535 procedure TfrmTracker.TrackerPopupCutClick(Sender: TObject); 2479 procedure TfrmTracker.TrackerPopupCutClick(Sender: TObject);
2536 begin 2480 begin
2537 SendMessage(TrackerGrid.Handle, LM_CUT, 0, 0) 2481 SendMessage((ActiveControl as TTrackerGrid).Handle, LM_CUT, 0, 0)
2538 end; 2482 end;
2539 2483
2540 procedure TfrmTracker.TrackerPopupEditEffectClick(Sender: TObject); 2484 procedure TfrmTracker.TrackerPopupEditEffectClick(Sender: TObject);
2541 begin 2485 begin
2542 TrackerGrid.OpenEffectEditor; 2486 (ActiveControl as TTrackerGrid).OpenEffectEditor;
2543 end; 2487 end;
2544 2488
2545 procedure TfrmTracker.TrackerPopupEraseClick(Sender: TObject); 2489 procedure TfrmTracker.TrackerPopupEraseClick(Sender: TObject);
2546 begin 2490 begin
2547 TrackerGrid.EraseSelection 2491 (ActiveControl as TTrackerGrid).EraseSelection
2548 end; 2492 end;
2549 2493
2550 procedure TfrmTracker.TrackerPopupFloodPasteClick(Sender: TObject); 2494 procedure TfrmTracker.TrackerPopupFloodPasteClick(Sender: TObject);
2551 begin 2495 begin
2552 TrackerGrid.DoRepeatPaste 2496 (ActiveControl as TTrackerGrid).DoRepeatPaste;
2553 end; 2497 end;
2554 2498
2555 procedure TfrmTracker.TrackerPopupPasteClick(Sender: TObject); 2499 procedure TfrmTracker.TrackerPopupPasteClick(Sender: TObject);
2556 begin 2500 begin
2557 SendMessage(TrackerGrid.Handle, LM_PASTE, 0, 0) 2501 SendMessage((ActiveControl as TTrackerGrid).Handle, LM_PASTE, 0, 0)
2558 end; 2502 end;
2559 2503
2560 procedure TfrmTracker.TrackerPopupRedoClick(Sender: TObject); 2504 procedure TfrmTracker.TrackerPopupRedoClick(Sender: TObject);
2561 begin 2505 begin
2562 TrackerGrid.DoRedo 2506 (ActiveControl as TTrackerGrid).DoRedo
2563 end; 2507 end;
2564 2508
2565 procedure TfrmTracker.TrackerPopupSelectAllClick(Sender: TObject); 2509 procedure TfrmTracker.TrackerPopupSelectAllClick(Sender: TObject);
2566 begin 2510 begin
2567 TrackerGrid.SelectAll 2511 (ActiveControl as TTrackerGrid).SelectAll
2568 end; 2512 end;
2569 2513
2570 procedure TfrmTracker.TrackerPopupSelectChannelClick(Sender: TObject); 2514 procedure TfrmTracker.TrackerPopupSelectChannelClick(Sender: TObject);
2571 begin 2515 begin
2572 TrackerGrid.SelectColumn 2516 (ActiveControl as TTrackerGrid).SelectColumn
2573 end; 2517 end;
2574 2518
2575 procedure TfrmTracker.TrackerPopupTransposeOctaveDownClick(Sender: TObject); 2519 procedure TfrmTracker.TrackerPopupTransposeOctaveDownClick(Sender: TObject);
2576 begin 2520 begin
2577 TrackerGrid.TransposeSelection(-12); 2521 (ActiveControl as TTrackerGrid).TransposeSelection(-12);
2578 if TrackerSettings.PreviewWhenBumping then 2522 if TrackerSettings.PreviewWhenBumping then
2579 PreviewNoteUnderCursor; 2523 PreviewNoteUnderCursor;
2580 end; 2524 end;
2581 2525
2582 procedure TfrmTracker.TrackerPopupTransposeOctaveUpClick(Sender: TObject); 2526 procedure TfrmTracker.TrackerPopupTransposeOctaveUpClick(Sender: TObject);
2583 begin 2527 begin
2584 TrackerGrid.TransposeSelection(12); 2528 (ActiveControl as TTrackerGrid).TransposeSelection(12);
2585 if TrackerSettings.PreviewWhenBumping then 2529 if TrackerSettings.PreviewWhenBumping then
2586 PreviewNoteUnderCursor; 2530 PreviewNoteUnderCursor;
2587 end; 2531 end;
2588 2532
2589 procedure TfrmTracker.TrackerPopupTransposeSemiDownClick(Sender: TObject); 2533 procedure TfrmTracker.TrackerPopupTransposeSemiDownClick(Sender: TObject);
2590 begin 2534 begin
2591 TrackerGrid.TransposeSelection(-1); 2535 (ActiveControl as TTrackerGrid).TransposeSelection(-1);
2592 if TrackerSettings.PreviewWhenBumping then 2536 if TrackerSettings.PreviewWhenBumping then
2593 PreviewNoteUnderCursor; 2537 PreviewNoteUnderCursor;
2594 end; 2538 end;
2595 2539
2596 procedure TfrmTracker.TrackerPopupTransposeSemiUpClick(Sender: TObject); 2540 procedure TfrmTracker.TrackerPopupTransposeSemiUpClick(Sender: TObject);
2597 begin 2541 begin
2598 TrackerGrid.TransposeSelection(1); 2542 (ActiveControl as TTrackerGrid).TransposeSelection(1);
2599 if TrackerSettings.PreviewWhenBumping then 2543 if TrackerSettings.PreviewWhenBumping then
2600 PreviewNoteUnderCursor; 2544 PreviewNoteUnderCursor;
2601 end; 2545 end;
2602 2546
2603 procedure TfrmTracker.TrackerPopupUndoClick(Sender: TObject); 2547 procedure TfrmTracker.TrackerPopupUndoClick(Sender: TObject);
2604 begin 2548 begin
2605 TrackerGrid.DoUndo 2549 (ActiveControl as TTrackerGrid).DoUndo
2606 end; 2550 end;
2607 2551
2608 procedure TfrmTracker.TreeView1DblClick(Sender: TObject); 2552 procedure TfrmTracker.TreeView1DblClick(Sender: TObject);
@@ -2716,4 +2660,3 @@ begin
2716 end; 2660 end;
2717 2661
2718 end. 2662 end.
2719
Modifiedtrackergrid.pas +134−51
@@ -9,14 +9,11 @@ uses
9 LMessages, HugeDatatypes, ClipboardUtils, gdeque, gstack, utils, effecteditor, 9 LMessages, HugeDatatypes, ClipboardUtils, gdeque, gstack, utils, effecteditor,
10 Keymap; 10 Keymap;
11 11
12 // TODO: Maybe read these from a config file
13 const 12 const
14 NUM_COLUMNS = 4;
15 NUM_ROWS = 64;
16 UNDO_STACK_SIZE = 100; 13 UNDO_STACK_SIZE = 100;
17 14
18 type 15 type
19 TPatternGrid = array[0..3] of PPattern; 16 TPatternGrid = array of PPattern;
20 17
21 { TSavedPattern } 18 { TSavedPattern }
22 19
@@ -25,7 +22,7 @@ type
25 Pattern: TPattern; 22 Pattern: TPattern;
26 end; 23 end;
27 24
28 TSavedPatternSet = array[0..3] of TSavedPattern; 25 TSavedPatternSet = array of TSavedPattern;
29 TUndoRedoAction = record 26 TUndoRedoAction = record
30 Before, After: TSavedPatternSet; 27 Before, After: TSavedPatternSet;
31 end; 28 end;
@@ -76,12 +73,12 @@ type
76 73
77 procedure InputNote(Key: Word); 74 procedure InputNote(Key: Word);
78 procedure InputInstrument(Key: Word); 75 procedure InputInstrument(Key: Word);
79 procedure InputVolume(Key: Word); 76 procedure InputVolume(Key: Word); virtual;
80 procedure InputEffectCode(Key: Word); 77 procedure InputEffectCode(Key: Word);
81 procedure InputEffectParams(Key: Word); 78 procedure InputEffectParams(Key: Word);
82 79
83 procedure RenderRow(Row: Integer); 80 procedure RenderRow(Row: Integer);
84 procedure RenderCell(const Cell: TCell); 81 procedure RenderCell(const Cell: TCell); virtual;
85 82
86 procedure SetHighlightedRow(Row: Integer); 83 procedure SetHighlightedRow(Row: Integer);
87 procedure SetSelectionGridRect(R: TRect); 84 procedure SetSelectionGridRect(R: TRect);
@@ -97,7 +94,7 @@ type
97 private 94 private
98 PatternMap: TPatternMap; 95 PatternMap: TPatternMap;
99 Patterns: TPatternGrid; 96 Patterns: TPatternGrid;
100 PatternNumbers: array[0..3] of Integer; 97 PatternNumbers: array of Integer;
101 98
102 CharHeight: Integer; 99 CharHeight: Integer;
103 CharWidth: Integer; 100 CharWidth: Integer;
@@ -121,6 +118,7 @@ type
121 public 118 public
122 Cursor, Other: TSelectionPos; 119 Cursor, Other: TSelectionPos;
123 ColumnWidth, RowHeight: Integer; 120 ColumnWidth, RowHeight: Integer;
121 NumColumns, NumRows: Integer;
124 122
125 SelectedInstrument, SelectedOctave, Step: Integer; 123 SelectedInstrument, SelectedOctave, Step: Integer;
126 124
@@ -156,10 +154,19 @@ type
156 constructor Create( 154 constructor Create(
157 AOwner: TComponent; 155 AOwner: TComponent;
158 Parent: TWinControl; 156 Parent: TWinControl;
159 PatternMap: TPatternMap); reintroduce; 157 PatternMap: TPatternMap;
158 NumColumns: Integer;
159 NumRows: Integer = 64); reintroduce;
160 destructor Destroy; override; 160 destructor Destroy; override;
161 end; 161 end;
162 162
163 { TTableGrid }
164
165 TTableGrid = class(TTrackerGrid)
166 procedure RenderCell(const Cell: TCell); override;
167 procedure InputVolume(Key: Word); override;
168 end;
169
163 var 170 var
164 clNote: TColor = TColor($7F4A00); 171 clNote: TColor = TColor($7F4A00);
165 clInstrument: TColor = TColor($7F7F00); 172 clInstrument: TColor = TColor($7F7F00);
@@ -170,6 +177,8 @@ var
170 clFxPan: TColor = TColor($7F7F00); 177 clFxPan: TColor = TColor($7F7F00);
171 clFxSong: TColor = TColor($00007F); 178 clFxSong: TColor = TColor($00007F);
172 179
180 clTblJump: TColor = TColor($72004E);
181
173 clBackground: TColor = TColor($D0DBE1); 182 clBackground: TColor = TColor($D0DBE1);
174 clHighlighted: TColor = TColor($7A99A9); 183 clHighlighted: TColor = TColor($7A99A9);
175 clSelected: TColor = TColor($9EB4C0); 184 clSelected: TColor = TColor($9EB4C0);
@@ -182,6 +191,71 @@ var
182 191
183 implementation 192 implementation
184 193
194 { TTableGrid }
195
196 procedure TTableGrid.RenderCell(const Cell: TCell);
197 begin
198 with Canvas do begin
199 Font.Color := clNote;
200
201 if (Cell.Note = NO_NOTE) then begin
202 Font.Color := clDots;
203 TextOut(PenPos.X, PenPos.Y, '...')
204 end
205 else if Cell.Note >= MIDDLE_NOTE then
206 TextOut(PenPos.X, PenPos.Y, '+'+FormatFloat('00', Cell.Note - MIDDLE_NOTE))
207 else if Cell.Note < MIDDLE_NOTE then
208 TextOut(PenPos.X, PenPos.Y, '-'+FormatFloat('00', MIDDLE_NOTE - Cell.Note));
209
210 TextOut(PenPos.X, PenPos.Y, ' ');
211
212 // Instrument column empty
213 Font.Color := clDots;
214 TextOut(PenPos.X, PenPos.Y, '..');
215
216 if Cell.Volume <> 0 then begin
217 Font.Color := clTblJump;
218 TextOut(PenPos.X, PenPos.Y, 'J'+FormatFloat('00', Cell.Volume));
219 end
220 else begin
221 Font.Color := clDots;
222 TextOut(PenPos.X, PenPos.Y, '...');
223 end;
224
225 if (Cell.EffectCode <> 0) or (Cell.EffectParams.Value <> 0) then begin
226 Font.Color := GetEffectColor(Cell.EffectCode);
227 TextOut(
228 PenPos.X,
229 PenPos.Y,
230 IntToHex(Cell.EffectCode, 1)
231 + IntToHex(Cell.EffectParams.Param1, 1)
232 + IntToHex(Cell.EffectParams.Param2, 1)
233 );
234 end
235 else begin
236 Font.Color := clDots;
237 TextOut(PenPos.X, PenPos.Y, '...');
238 end;
239
240 TextOut(PenPos.X, PenPos.Y, ' ');
241 end;
242 end;
243
244 procedure TTableGrid.InputVolume(Key: Word);
245 var
246 Temp: Nibble;
247 begin
248 BeginUndoAction;
249 with Patterns[Cursor.X]^[Cursor.Y] do begin
250 if Key = VK_DELETE then Volume := 0
251 else if KeycodeToHexNumber(Key, Temp) and InRange(Temp, 0, 9) then
252 Volume := ((Volume mod 10) * 10) + Temp;
253 end;
254
255 Invalidate;
256 EndUndoAction;
257 end;
258
185 { TSelectionEnumerator } 259 { TSelectionEnumerator }
186 260
187 constructor TSelectionEnumerator.Create(Grid: TPatternGrid; Cursor, 261 constructor TSelectionEnumerator.Create(Grid: TPatternGrid; Cursor,
@@ -236,13 +310,20 @@ end;
236 constructor TTrackerGrid.Create( 310 constructor TTrackerGrid.Create(
237 AOwner: TComponent; 311 AOwner: TComponent;
238 Parent: TWinControl; 312 Parent: TWinControl;
239 PatternMap: TPatternMap); 313 PatternMap: TPatternMap;
314 NumColumns: Integer;
315 NumRows: Integer);
240 begin 316 begin
241 inherited Create(AOwner); 317 inherited Create(AOwner);
242 318
243 FFontSize := 12; 319 FFontSize := 12;
244 320
245 Self.PatternMap := PatternMap; 321 Self.PatternMap := PatternMap;
322 Self.NumColumns := NumColumns;
323 Self.NumRows := NumRows;
324
325 SetLength(Patterns, NumColumns);
326 SetLength(PatternNumbers, NumColumns);
246 327
247 NestedUndoCount := 0; 328 NestedUndoCount := 0;
248 Performed := TUndoDeque.Create; 329 Performed := TUndoDeque.Create;
@@ -278,7 +359,7 @@ begin
278 Brush.Color := clBackground; 359 Brush.Color := clBackground;
279 Clear; 360 Clear;
280 361
281 for I := 0 to High(TPattern) do begin 362 for I := 0 to NumRows-1 do begin
282 if (I mod 4) = 0 then 363 if (I mod 4) = 0 then
283 Brush.Color := clLineFour; 364 Brush.Color := clLineFour;
284 if (I mod 16) = 0 then 365 if (I mod 16) = 0 then
@@ -297,16 +378,12 @@ begin
297 // Draw borders between columns 378 // Draw borders between columns
298 Canvas.Pen.Color := clDividers; 379 Canvas.Pen.Color := clDividers;
299 Canvas.Pen.Width := 2; 380 Canvas.Pen.Width := 2;
300 R := TRect.Create(0, 0, ColumnWidth+1, Height); 381
301 Canvas.Rectangle(R); 382 for I := 0 to NumColumns do begin
302 R := TRect.Create(ColumnWidth, 0, ColumnWidth, Height); 383 //TODO: WTF? Why do we need this IfThen?
303 Canvas.Rectangle(R); 384 R := TRect.Create(ColumnWidth*I, 0, ColumnWidth + IfThen(I=0, 1, 0), Height);
304 R := TRect.Create(ColumnWidth*2, 0, ColumnWidth, Height); 385 Canvas.Rectangle(R);
305 Canvas.Rectangle(R); 386 end;
306 R := TRect.Create(ColumnWidth*3, 0, ColumnWidth, Height);
307 Canvas.Rectangle(R);
308 R := TRect.Create(ColumnWidth*4, 0, ColumnWidth, Height);
309 Canvas.Rectangle(R);
310 387
311 RenderSelectedArea; 388 RenderSelectedArea;
312 if DraggingSelection then 389 if DraggingSelection then
@@ -451,8 +528,8 @@ begin
451 VK_NEXT: Inc(Cursor.Y, 16); 528 VK_NEXT: Inc(Cursor.Y, 16);
452 VK_LEFT: DecSelectionPos(Cursor); 529 VK_LEFT: DecSelectionPos(Cursor);
453 VK_RIGHT: IncSelectionPos(Cursor); 530 VK_RIGHT: IncSelectionPos(Cursor);
454 VK_HOME: Cursor.Y := Low(TPattern); 531 VK_HOME: Cursor.Y := 0;
455 VK_END: Cursor.Y := High(TPattern); 532 VK_END: Cursor.Y := NumRows-1;
456 VK_TAB: begin 533 VK_TAB: begin
457 if ssShift in Shift then begin 534 if ssShift in Shift then begin
458 Dec(Cursor.X); 535 Dec(Cursor.X);
@@ -461,10 +538,10 @@ begin
461 else 538 else
462 Inc(Cursor.X); 539 Inc(Cursor.X);
463 540
464 if Cursor.X > High(TPatternGrid) then 541 if Cursor.X > (NumColumns-1) then
465 Cursor.X := Low(TPatternGrid); 542 Cursor.X := 0;
466 if Cursor.X < Low(TPatternGrid) then 543 if Cursor.X < 0 then
467 Cursor.X := High(TPatternGrid); 544 Cursor.X := (NumColumns-1);
468 545
469 Key := 0; 546 Key := 0;
470 end 547 end
@@ -479,14 +556,14 @@ begin
479 end; 556 end;
480 end; 557 end;
481 558
482 if (Cursor.Y > High(TPattern)) or (Cursor.Y < Low(TPattern)) then 559 if (Cursor.Y > NumRows-1) or (Cursor.Y < 0) then
483 if Assigned(OnCursorOutOfBounds) then OnCursorOutOfBounds; 560 if Assigned(OnCursorOutOfBounds) then OnCursorOutOfBounds;
484 561
485 if Shift = [] then 562 if Shift = [] then
486 Other := Cursor; 563 Other := Cursor;
487 564
488 ClampCursors; 565 ClampCursors;
489 Invalidate 566 Invalidate;
490 end; 567 end;
491 568
492 procedure TTrackerGrid.KeyUp(var Key: Word; Shift: TShiftState); 569 procedure TTrackerGrid.KeyUp(var Key: Word; Shift: TShiftState);
@@ -525,6 +602,10 @@ procedure TTrackerGrid.PerformPaste(Paste: TSelection; Where: TSelectionPos; Mix
525 if (not Mix) or (Cell2.Cell.Instrument <> 0) then 602 if (not Mix) or (Cell2.Cell.Instrument <> 0) then
526 Cell1.Instrument := Cell2.Cell.Instrument; 603 Cell1.Instrument := Cell2.Cell.Instrument;
527 604
605 if cpVolume in Cell2.Parts then
606 if (not Mix) or (Cell2.Cell.Volume.Value <> 0) then
607 Cell1.Volume.Value := Cell2.Cell.Volume.Value;
608
528 if cpEffectCode in Cell2.Parts then 609 if cpEffectCode in Cell2.Parts then
529 if (not Mix) or (Cell2.Cell.EffectCode <> 0) then 610 if (not Mix) or (Cell2.Cell.EffectCode <> 0) then
530 Cell1.EffectCode := Cell2.Cell.EffectCode; 611 Cell1.EffectCode := Cell2.Cell.EffectCode;
@@ -538,7 +619,7 @@ var
538 begin 619 begin
539 try 620 try
540 for Y := 0 to High(Paste) do begin 621 for Y := 0 to High(Paste) do begin
541 if not InRange(Where.Y+Y, Low(TPattern), High(TPattern)) then Continue; 622 if not InRange(Where.Y+Y, 0, NumRows-1) then Continue;
542 for X := 0 to High(Paste[Y]) do begin 623 for X := 0 to High(Paste[Y]) do begin
543 if not InRange(Where.X+X, Low(Patterns), High(Patterns)) then Continue; 624 if not InRange(Where.X+X, Low(Patterns), High(Patterns)) then Continue;
544 OverlayCell(Patterns[Where.X + X]^[Where.Y + Y], Paste[Y, X]); 625 OverlayCell(Patterns[Where.X + X]^[Where.Y + Y], Paste[Y, X]);
@@ -575,7 +656,7 @@ begin
575 try 656 try
576 Selection := GetPastedCells; 657 Selection := GetPastedCells;
577 I := Cursor.Y; 658 I := Cursor.Y;
578 while I <= High(TPattern) do begin 659 while I < NumRows do begin
579 Cursor.Y := I; 660 Cursor.Y := I;
580 PerformPaste(Selection); 661 PerformPaste(Selection);
581 Inc(I, High(Selection)+1); 662 Inc(I, High(Selection)+1);
@@ -647,11 +728,14 @@ begin
647 // Save the "before" to our current undo action, so that EndUndoAction 728 // Save the "before" to our current undo action, so that EndUndoAction
648 // can save the "after" and commit it to the Performed stack. 729 // can save the "after" and commit it to the Performed stack.
649 CurrentUndoAction := Default(TUndoRedoAction); 730 CurrentUndoAction := Default(TUndoRedoAction);
650 for I := Low(Patterns) to High(Patterns) do 731 for I := Low(Patterns) to High(Patterns) do begin
732 SetLength(CurrentUndoAction.Before, NumColumns);
733 SetLength(CurrentUndoAction.After, NumColumns);
651 with CurrentUndoAction.Before[I] do begin 734 with CurrentUndoAction.Before[I] do begin
652 Pattern := Patterns[I]^; 735 Pattern := Patterns[I]^;
653 PatternNumber := PatternNumbers[I]; 736 PatternNumber := PatternNumbers[I];
654 end; 737 end;
738 end;
655 end; 739 end;
656 740
657 Inc(NestedUndoCount); 741 Inc(NestedUndoCount);
@@ -751,20 +835,20 @@ end;
751 835
752 procedure TTrackerGrid.ClampCursors; 836 procedure TTrackerGrid.ClampCursors;
753 begin 837 begin
754 if Cursor.X < Low(TPatternGrid) then 838 if Cursor.X < 0 then
755 Cursor.SelectedPart := Low(TCellPart); 839 Cursor.SelectedPart := Low(TCellPart);
756 if Cursor.X > High(TPatternGrid) then 840 if Cursor.X > (NumColumns-1) then
757 Cursor.SelectedPart := High(TCellPart); 841 Cursor.SelectedPart := High(TCellPart);
758 842
759 if Other.X < Low(TPatternGrid) then 843 if Other.X < 0 then
760 Other.SelectedPart := Low(TCellPart); 844 Other.SelectedPart := Low(TCellPart);
761 if Other.X > High(TPatternGrid) then 845 if Other.X > (NumColumns-1) then
762 Other.SelectedPart := High(TCellPart); 846 Other.SelectedPart := High(TCellPart);
763 847
764 Cursor.Y := EnsureRange(Cursor.Y, Low(TPattern), High(TPattern)); 848 Cursor.Y := EnsureRange(Cursor.Y, 0, NumRows-1);
765 Cursor.X := EnsureRange(Cursor.X, Low(TPatternGrid), High(TPatternGrid)); 849 Cursor.X := EnsureRange(Cursor.X, Low(TPatternGrid), (NumColumns-1));
766 Other.Y := EnsureRange(Other.Y, Low(TPattern), High(TPattern)); 850 Other.Y := EnsureRange(Other.Y, 0, NumRows-1);
767 Other.X := EnsureRange(Other.X, Low(TPatternGrid), High(TPatternGrid)); 851 Other.X := EnsureRange(Other.X, Low(TPatternGrid), (NumColumns-1));
768 end; 852 end;
769 853
770 procedure TTrackerGrid.NormalizeCursors; 854 procedure TTrackerGrid.NormalizeCursors;
@@ -1159,8 +1243,8 @@ begin
1159 X := EnsureRange(Width-1, 0, X); 1243 X := EnsureRange(Width-1, 0, X);
1160 Y := EnsureRange(Height-1, 0, Y); 1244 Y := EnsureRange(Height-1, 0, Y);
1161 1245
1162 Result.X := Trunc((X/Width)*NUM_COLUMNS); 1246 Result.X := Trunc((X/Width)*NumColumns);
1163 Result.Y := Trunc((Y/Height)*NUM_ROWS); 1247 Result.Y := Trunc((Y/Height)*NumRows);
1164 1248
1165 if OrigX <= 0 then 1249 if OrigX <= 0 then
1166 Result.SelectedPart := cpNote 1250 Result.SelectedPart := cpNote
@@ -1233,8 +1317,8 @@ begin
1233 CharWidth := GetTextWidth('C'); 1317 CharWidth := GetTextWidth('C');
1234 end; 1318 end;
1235 1319
1236 Width := ColumnWidth*4; 1320 Width := ColumnWidth*NumColumns;
1237 Height := RowHeight*64; 1321 Height := RowHeight*NumRows;
1238 end; 1322 end;
1239 1323
1240 procedure TTrackerGrid.SetFontSize(AValue: Integer); 1324 procedure TTrackerGrid.SetFontSize(AValue: Integer);
@@ -1305,7 +1389,7 @@ begin
1305 case SelectionPos.SelectedPart of 1389 case SelectionPos.SelectedPart of
1306 cpNote: Note := NO_NOTE; 1390 cpNote: Note := NO_NOTE;
1307 cpInstrument: Instrument := 0; 1391 cpInstrument: Instrument := 0;
1308 cpVolume:; 1392 cpVolume: Volume := 0;
1309 cpEffectCode: EffectCode := 0; 1393 cpEffectCode: EffectCode := 0;
1310 cpEffectParams: EffectParams.Value := 0; 1394 cpEffectParams: EffectParams.Value := 0;
1311 end; 1395 end;
@@ -1318,7 +1402,7 @@ begin
1318 BeginUndoAction; 1402 BeginUndoAction;
1319 NormalizeCursors; 1403 NormalizeCursors;
1320 1404
1321 for I := High(TPattern) downto Cursor.Y do 1405 for I := NumRows-1 downto Cursor.Y do
1322 Patterns[Pattern]^[I] := Patterns[Pattern]^[I-1]; 1406 Patterns[Pattern]^[I] := Patterns[Pattern]^[I-1];
1323 1407
1324 BlankCell(Patterns[Pattern]^[Cursor.Y]); 1408 BlankCell(Patterns[Pattern]^[Cursor.Y]);
@@ -1347,10 +1431,10 @@ begin
1347 BeginUndoAction; 1431 BeginUndoAction;
1348 NormalizeCursors; 1432 NormalizeCursors;
1349 1433
1350 for I := Cursor.Y to High(TPattern)-1 do 1434 for I := Cursor.Y to NumRows-2 do
1351 Patterns[Pattern]^[I] := Patterns[Pattern]^[I+1]; 1435 Patterns[Pattern]^[I] := Patterns[Pattern]^[I+1];
1352 1436
1353 BlankCell(Patterns[Pattern]^[High(TPattern)]); 1437 BlankCell(Patterns[Pattern]^[NumRows-1]);
1354 1438
1355 Invalidate; 1439 Invalidate;
1356 EndUndoAction; 1440 EndUndoAction;
@@ -1375,7 +1459,7 @@ begin
1375 Cursor.Y := 0; 1459 Cursor.Y := 0;
1376 Cursor.SelectedPart := cpNote; 1460 Cursor.SelectedPart := cpNote;
1377 Other.X := High(Patterns); 1461 Other.X := High(Patterns);
1378 Other.Y := High(TPattern); 1462 Other.Y := NumRows-1;
1379 Other.SelectedPart := cpEffectParams; 1463 Other.SelectedPart := cpEffectParams;
1380 1464
1381 Invalidate; 1465 Invalidate;
@@ -1384,7 +1468,7 @@ end;
1384 procedure TTrackerGrid.SelectColumn; 1468 procedure TTrackerGrid.SelectColumn;
1385 begin 1469 begin
1386 Cursor.Y := 0; 1470 Cursor.Y := 0;
1387 Other.Y := High(TPattern); 1471 Other.Y := NumRows-1;
1388 Cursor.SelectedPart := Low(TCellPart); 1472 Cursor.SelectedPart := Low(TCellPart);
1389 Other.SelectedPart := High(TCellPart); 1473 Other.SelectedPart := High(TCellPart);
1390 1474
@@ -1399,4 +1483,3 @@ begin
1399 end; 1483 end;
1400 1484
1401 end. 1485 end.
1402
Modifiedutils.pas +1−72
@@ -5,7 +5,7 @@ unit Utils;
5 interface 5 interface
6 6
7 uses 7 uses
8 Classes, SysUtils, Song, Waves, HugeDatatypes, Constants, gHashSet, fgl, instruments, math; 8 Classes, SysUtils, Song, HugeDatatypes, Constants, gHashSet, fgl, instruments, math;
9 9
10 function Lerp(v0, v1, t: Double): Double; 10 function Lerp(v0, v1, t: Double): Double;
11 function Snap(Value, Every: Integer): Integer; 11 function Snap(Value, Every: Integer): Integer;
@@ -16,7 +16,6 @@ procedure BlankPattern(Pat: PPattern);
16 procedure BlankCell(var Cell: TCell); 16 procedure BlankCell(var Cell: TCell);
17 function EffectCodeToStr(Code: Integer; Params: TEffectParams): String; 17 function EffectCodeToStr(Code: Integer; Params: TEffectParams): String;
18 function EffectToExplanation(Code: Integer; Params: TEffectParams): String; 18 function EffectToExplanation(Code: Integer; Params: TEffectParams): String;
19 //function UniqueOrdersDuringPlayback(Song: TSong; FromPos, ToPos: Integer): Integer;
20 19
21 function ModInst(Inst: Integer): Integer; 20 function ModInst(Inst: Integer): Integer;
22 function UnmodInst(Bank: TInstrumentType; Inst: Integer): Integer; 21 function UnmodInst(Bank: TInstrumentType; Inst: Integer): Integer;
@@ -104,76 +103,6 @@ begin
104 end; 103 end;
105 end; 104 end;
106 105
107 {function UniqueOrdersDuringPlayback(Song: TSong; FromPos, ToPos: Integer
108 ): Integer;
109 var
110 Seen: array of Integer;
111 CurOrder, CurRow: Integer;
112 OrderChanged: Boolean;
113 NextOrder, NextRow: Integer;
114 OrderCount, TotalSeenOrders: Integer;
115 Cell: TCell;
116 I: Integer;
117 Pat: TPattern;
118 begin
119 CurOrder := FromPos;
120 CurRow := 0;
121 OrderChanged := True;
122 TotalSeenOrders := 0;
123
124 with Song do
125 OrderCount := MaxIntValue([High(OrderMatrix[0]), High(OrderMatrix[1]),
126 High(OrderMatrix[2]), High(OrderMatrix[3])]);
127
128 SetLength(Seen, OrderCount);
129
130 NextOrder := -1;
131 NextRow := -1;
132 repeat
133 if OrderChanged then begin
134 OrderChanged := False;
135 Inc(Seen[CurOrder]);
136 Inc(TotalSeenOrders);
137 end;
138
139 for I := 0 to 3 do begin
140 Pat := Song.Patterns[Song.OrderMatrix[I, CurOrder]]^;
141 Cell := Pat[CurRow];
142 case Cell.EffectCode of
143 $B: NextOrder := Max(Cell.EffectParams.Value-1, OrderCount-1);
144 $D: NextRow := Cell.EffectParams.Value;
145 end;
146 end;
147
148 if NextOrder = -1 then
149 NextOrder := CurOrder;
150
151 if NextRow = -1 then
152 NextRow := CurRow + 1;
153
154 if NextRow > High(TPattern) then begin
155 NextRow := 0;
156 NextOrder := CurOrder + 1;
157 end;
158
159 if NextOrder > OrderCount-1 then begin
160 OrderChanged := True;
161 NextOrder := 0;
162 end;
163
164 if CurOrder <> NextOrder then
165 OrderChanged := True;
166
167 CurOrder := NextOrder;
168 CurRow := NextRow;
169 NextOrder := -1;
170 NextRow := -1;
171 writeln(CurOrder, ' ', curRow);
172 until (Seen[CurOrder] > 1) or (CurOrder = ToPos);
173
174 Result := TotalSeenOrders;
175 end;}
176
177 function ModInst(Inst: Integer): Integer; 106 function ModInst(Inst: Integer): Integer;
178 begin 107 begin
179 Result := ((Inst-1) mod 15)+1; 108 Result := ((Inst-1) mod 15)+1;
Deletedwaves.pas +0−33
@@ -1,33 +0,0 @@
1 unit Waves;
2
3 {$mode delphi}
4
5 interface
6
7 uses
8 Classes, SysUtils;
9
10 type
11 TWaveV1 = packed array[0..32] of Byte;
12 TWaveV2 = packed array[0..31] of Byte;
13 TWave = TWaveV2;
14 T4bitWave = packed array[0..15] of Byte;
15
16 const
17 DefaultWaves: array[0..10] of TWave =
18 (($0,$0,$0,$0,$f,$f,$f,$f,$f,$f,$f,$f,$f,$f,$f,$f,$f,$f,$f,$f,$f,$f,$f,$f,$f,$f,$f,$f,$f,$f,$f,$f),
19 ($0,$0,$0,$0,$0,$0,$0,$0,$f,$f,$f,$f,$f,$f,$f,$f,$f,$f,$f,$f,$f,$f,$f,$f,$f,$f,$f,$f,$f,$f,$f,$f),
20 ($0,$0,$0,$0,$0,$0,$0,$0,$0,$0,$0,$0,$0,$0,$0,$0,$f,$f,$f,$f,$f,$f,$f,$f,$f,$f,$f,$f,$f,$f,$f,$f),
21 ($0,$0,$0,$0,$0,$0,$0,$0,$0,$0,$0,$0,$0,$0,$0,$0,$0,$0,$0,$0,$0,$0,$0,$0,$f,$f,$f,$f,$f,$f,$f,$f),
22 ($0,$0,$0,$1,$1,$2,$2,$3,$3,$4,$4,$5,$5,$6,$6,$7,$7,$8,$8,$9,$9,$a,$a,$b,$b,$c,$c,$d,$d,$e,$e,$f),
23 ($f,$e,$d,$c,$b,$a,$9,$8,$7,$6,$5,$4,$3,$2,$1,$0,$1,$2,$3,$4,$5,$6,$7,$8,$9,$a,$b,$c,$d,$e,$f,$f),
24 ($7,$a,$c,$d,$d,$b,$7,$5,$2,$1,$1,$3,$6,$8,$b,$d,$d,$c,$9,$7,$4,$1,$0,$1,$4,$7,$9,$c,$d,$d,$b,$8),
25 ($0,$f,$0,$f,$0,$f,$0,$f,$0,$f,$0,$f,$0,$f,$0,$f,$0,$f,$0,$f,$0,$f,$0,$f,$0,$f,$0,$f,$0,$f,$0,$f),
26 ($f,$e,$f,$c,$f,$a,$f,$8,$f,$6,$f,$4,$f,$2,$f,$0,$f,$2,$f,$4,$f,$6,$f,$8,$f,$a,$f,$c,$f,$e,$f,$f),
27 ($f,$e,$d,$d,$c,$c,$b,$b,$a,$a,$9,$9,$8,$8,$7,$7,$8,$a,$b,$d,$f,$1,$2,$4,$5,$7,$8,$a,$b,$d,$e,$e),
28 ($8,$4,$1,$1,$6,$1,$e,$d,$5,$7,$4,$7,$5,$a,$a,$d,$c,$e,$a,$3,$1,$7,$7,$9,$d,$d,$2,$0,$0,$3,$4,$7));
29
30 implementation
31
32 end.
33