Skip to content

Commit 2cc0748

Browse files
committed
fix waveform detection bug
1 parent 1b6f5ef commit 2cc0748

File tree

1 file changed

+11
-12
lines changed

1 file changed

+11
-12
lines changed

src/codegen.pas

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -89,21 +89,20 @@ function FindUsedStuff(const Song: TSong): TUsedStuff;
8989
Result.HighestWaveform := Waveform;
9090
end;
9191

92-
if Cell.Instrument = 0 then Continue;
93-
94-
if InRange(Cell.Instrument, 0, 15) then
95-
InstValue := Cell.Instrument
96-
else
97-
InstValue := 0;
92+
if InRange(Cell.Instrument, 1, 15) then begin
93+
InstValue := Cell.Instrument;
94+
if (I = 2) then begin // Wave channel
95+
Waveform := Song.Instruments.Wave[Cell.Instrument].Waveform;
96+
if Waveform > Result.HighestWaveform then
97+
Result.HighestWaveform := Waveform;
98+
end
99+
end
100+
else begin
101+
InstValue := 0
102+
end;
98103

99104
if InstValue > Highest^ then
100105
Highest^ := InstValue;
101-
102-
if (I = 2) then begin // Wave channel
103-
Waveform := Song.Instruments.Wave[Cell.Instrument].Waveform;
104-
if Waveform > Result.HighestWaveform then
105-
Result.HighestWaveform := Waveform;
106-
end;
107106
end;
108107
end;
109108
end;

0 commit comments

Comments
 (0)