Skip to content

Commit

Permalink
fix(DmSynth): fixup channel pan assignments
Browse files Browse the repository at this point in the history
  • Loading branch information
lmichaelis committed May 1, 2024
1 parent 19120d1 commit f5e7bd8
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/Synth.c
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ static DmSynthInstrument* DmSynth_getInstrument(DmSynth* slf, DmInstrument* ins)
uint32_t bank = (ins->patch & 0xFF00U) >> 8;
uint32_t patch = ins->patch & 0xFFU;
if (slf->instruments.data[i].dls == ins->dls && slf->instruments.data[i].bank == bank &&
slf->instruments.data[i].patch == patch && slf->instruments.data[i].channel == ins->channel) {
slf->instruments.data[i].patch == patch) {
return &slf->instruments.data[i];
}
}
Expand Down Expand Up @@ -88,7 +88,6 @@ static DmResult DmSynth_updateInstruments(DmSynth* slf, DmBand* band) {
new_ins.volume_reset = DmInt_VOLUME_MAX;
new_ins.pan_reset = DmInt_PAN_CENTER;
new_ins.transpose = 0;
new_ins.channel = ins->channel;

rv = DmSynthInstrumentArray_add(&slf->instruments, new_ins);
if (rv != DmResult_SUCCESS) {
Expand All @@ -100,8 +99,8 @@ static DmResult DmSynth_updateInstruments(DmSynth* slf, DmBand* band) {

// Set the instrument's properties
if (ins->options & DmInstrument_VALID_PAN) {
tsf_channel_set_pan(sin->synth, 0, ins->pan);
sin->pan_reset = ins->pan;
tsf_channel_set_pan(sin->synth, 0, (float) ins->pan / (float) DmInt_MIDI_MAX);
sin->pan_reset = (float) ins->pan / (float) DmInt_MIDI_MAX;
}

if (ins->options & DmInstrument_VALID_VOLUME) {
Expand Down

0 comments on commit f5e7bd8

Please sign in to comment.