Skip to content

Commit

Permalink
fix waveform detection bug
Browse files Browse the repository at this point in the history
  • Loading branch information
SuperDisk committed Dec 31, 2024
1 parent 1b6f5ef commit 2cc0748
Showing 1 changed file with 11 additions and 12 deletions.
23 changes: 11 additions & 12 deletions src/codegen.pas
Original file line number Diff line number Diff line change
Expand Up @@ -89,21 +89,20 @@ function FindUsedStuff(const Song: TSong): TUsedStuff;
Result.HighestWaveform := Waveform;
end;

if Cell.Instrument = 0 then Continue;

if InRange(Cell.Instrument, 0, 15) then
InstValue := Cell.Instrument
else
InstValue := 0;
if InRange(Cell.Instrument, 1, 15) then begin
InstValue := Cell.Instrument;
if (I = 2) then begin // Wave channel
Waveform := Song.Instruments.Wave[Cell.Instrument].Waveform;
if Waveform > Result.HighestWaveform then
Result.HighestWaveform := Waveform;
end
end
else begin
InstValue := 0
end;

if InstValue > Highest^ then
Highest^ := InstValue;

if (I = 2) then begin // Wave channel
Waveform := Song.Instruments.Wave[Cell.Instrument].Waveform;
if Waveform > Result.HighestWaveform then
Result.HighestWaveform := Waveform;
end;
end;
end;
end;
Expand Down

0 comments on commit 2cc0748

Please sign in to comment.