Commit f9fe74e

Nick committed on
Add a few default instruments
commit f9fe74ef13b5274eef10b2c7bb920b03a9fd3dfd parent a350be4
4 changed files +81−13
ModifiedGBEmu.lpr +2−0
@@ -47,6 +47,8 @@ end;
47 {$endif} 47 {$endif}
48 48
49 begin 49 begin
50 ReturnNilIfGrowHeapFails := False;
51
50 {$if declared(useHeapTrace)} 52 {$if declared(useHeapTrace)}
51 // Set up -gh output for the Leakview package: 53 // Set up -gh output for the Leakview package:
52 if FileExists('heap.trc') then 54 if FileExists('heap.trc') then
Modifiedsong.pas +52−1
@@ -70,6 +70,7 @@ type
70 procedure WriteSongToStream(S: TStream; const ASong: TSong); 70 procedure WriteSongToStream(S: TStream; const ASong: TSong);
71 procedure ReadSongFromStream(S: TStream; out ASong: TSong); 71 procedure ReadSongFromStream(S: TStream; out ASong: TSong);
72 procedure InitializeSong(var S: TSong); 72 procedure InitializeSong(var S: TSong);
73 procedure LoadDefaultInstruments(var S: TSong);
73 procedure DestroySong(var S: TSong); 74 procedure DestroySong(var S: TSong);
74 75
75 function UpgradeSong(S: TSongV1): TSong; overload; 76 function UpgradeSong(S: TSongV1): TSong; overload;
@@ -291,7 +292,7 @@ begin
291 Length := 0; 292 Length := 0;
292 LengthEnabled := False; 293 LengthEnabled := False;
293 OutputLevel := 1; 294 OutputLevel := 1;
294 Waveform := 0; 295 Waveform := I-1;
295 end; 296 end;
296 297
297 for I := Low(S.Instruments.Noise) to High(S.Instruments.Noise) do 298 for I := Low(S.Instruments.Noise) to High(S.Instruments.Noise) do
@@ -322,6 +323,56 @@ begin
322 S.Patterns := TPatternMap.Create; 323 S.Patterns := TPatternMap.Create;
323 end; 324 end;
324 325
326 procedure LoadDefaultInstruments(var S: TSong);
327 var
328 I: Integer;
329 begin
330 with S.Instruments do begin
331 Wave[1].Name := 'Square wave 12.5%';
332 Wave[2].Name := 'Square wave 25%';
333 Wave[3].Name := 'Square wave 50%';
334 Wave[4].Name := 'Square wave 75%';
335 Wave[5].Name := 'Sawtooth wave';
336 Wave[6].Name := 'Triangle wave';
337 Wave[7].Name := 'Sine wave';
338 Wave[8].Name := 'Toothy';
339 Wave[9].Name := 'Triangle Toothy';
340 Wave[10].Name := 'Pointy';
341 Wave[11].Name := 'Strange';
342
343 Duty[1].Name := 'Duty 12.5%';
344 Duty[1].Duty := 0;
345
346 Duty[2].Name := 'Duty 25%';
347 Duty[2].Duty := 1;
348
349 Duty[3].Name := 'Duty 50%';
350 Duty[3].Duty := 2;
351
352 Duty[4].Name := 'Duty 75%';
353 Duty[4].Duty := 3;
354
355 Duty[5].Name := 'Duty 12.5% plink';
356 Duty[5].Duty := 0;
357 Duty[5].VolSweepAmount := 1;
358
359 Duty[6].Name := 'Duty 25% plink';
360 Duty[6].Duty := 1;
361 Duty[6].VolSweepAmount := 1;
362
363 Duty[7].Name := 'Duty 50% plink';
364 Duty[7].Duty := 2;
365 Duty[7].VolSweepAmount := 1;
366
367 Duty[8].Name := 'Duty 75% plink';
368 Duty[8].Duty := 3;
369 Duty[8].VolSweepAmount := 1;
370 end;
371
372 for I := Low(DefaultWaves) to High(DefaultWaves) do
373 S.Waves[I] := DefaultWaves[I];
374 end;
375
325 procedure DestroySong(var S: TSong); 376 procedure DestroySong(var S: TSong);
326 var 377 var
327 I: Integer; 378 I: Integer;
Modifiedtracker.pas +13−12
@@ -1228,21 +1228,9 @@ begin
1228 1228
1229 VisualizerBuffer := TBGRABitmap.Create(Duty1Visualizer.Width, Duty1Visualizer.Height); 1229 VisualizerBuffer := TBGRABitmap.Create(Duty1Visualizer.Width, Duty1Visualizer.Height);
1230 1230
1231 ReturnNilIfGrowHeapFails := False;
1232 PreviewingInstrument := -1; 1231 PreviewingInstrument := -1;
1233 OptionsFile := TINIFile.Create('options.ini'); 1232 OptionsFile := TINIFile.Create('options.ini');
1234 1233
1235 InitializeSong(Song);
1236
1237 // Create pattern editor control
1238 RecreateTrackerGrid;
1239
1240 // Initialize ticks per row
1241 Song.TicksPerRow := TicksPerRowSpinEdit.Value;
1242
1243 LoadInstrument(itSquare, 1);
1244 LoadWave(0);
1245
1246 // Fetch the tree items 1234 // Fetch the tree items
1247 with TreeView1 do begin 1235 with TreeView1 do begin
1248 //PatternsNode := Items[0]; 1236 //PatternsNode := Items[0];
@@ -1266,6 +1254,18 @@ begin
1266 TreeView1.Items.AddChild(RoutinesNode, 'Routine '+IntToStr(PUI)).Data := {%H-}Pointer(PUI); 1254 TreeView1.Items.AddChild(RoutinesNode, 'Routine '+IntToStr(PUI)).Data := {%H-}Pointer(PUI);
1267 end; 1255 end;
1268 1256
1257 InitializeSong(Song);
1258 LoadDefaultInstruments(Song);
1259
1260 // Create pattern editor control
1261 RecreateTrackerGrid;
1262
1263 // Initialize ticks per row
1264 Song.TicksPerRow := TicksPerRowSpinEdit.Value;
1265
1266 LoadInstrument(itSquare, 1);
1267 LoadWave(0);
1268
1269 // Initialize order table (InitializeSong creates the default order table) 1269 // Initialize order table (InitializeSong creates the default order table)
1270 CopyOrderMatrixToOrderGrid; 1270 CopyOrderMatrixToOrderGrid;
1271 1271
@@ -2021,6 +2021,7 @@ begin
2021 2021
2022 DestroySong(Song); 2022 DestroySong(Song);
2023 InitializeSong(Song); 2023 InitializeSong(Song);
2024 LoadDefaultInstruments(Song);
2024 2025
2025 UpdateUIAfterLoad; 2026 UpdateUIAfterLoad;
2026 end; 2027 end;
Modifiedwaves.pas +14−0
@@ -13,6 +13,20 @@ type
13 TWave = TWaveV2; 13 TWave = TWaveV2;
14 T4bitWave = packed array[0..15] of Byte; 14 T4bitWave = packed array[0..15] of Byte;
15 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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