Skip to content

Commit

Permalink
Reset new mod instruments in ChangeChannelCount
Browse files Browse the repository at this point in the history
Closes johnnesky#69.
  • Loading branch information
leovoel committed Aug 23, 2023
1 parent 954ed1e commit ac23031
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion editor/changes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1441,12 +1441,13 @@ export class ChangeChannelCount extends Change {
newChannels[channelIndex].octave = octave;
for (let j: number = 0; j < Config.instrumentCountMin; j++) {
const instrument: Instrument = new Instrument(isNoise, isMod);
if (isMod) instrument.type = 9;
if (!isMod) {
const presetValue: number = pickRandomPresetValue(isNoise);
const preset: Preset = EditorConfig.valueToPreset(presetValue)!;
instrument.fromJsonObject(preset.settings, isNoise, isMod, doc.song.rhythm == 0 || doc.song.rhythm == 2, doc.song.rhythm >= 2);
instrument.preset = presetValue;
} else {
instrument.setTypeAndReset(InstrumentType.mod, isNoise, isMod);
}
newChannels[channelIndex].instruments[j] = instrument;
}
Expand Down

0 comments on commit ac23031

Please sign in to comment.