Skip to content

Commit

Permalink
Bugfix: Preview Playback of Percussion didn't work
Browse files Browse the repository at this point in the history
  • Loading branch information
leecher1337 committed Jul 8, 2023
1 parent 8ce568e commit 1729123
Showing 1 changed file with 42 additions and 35 deletions.
77 changes: 42 additions & 35 deletions src/esfmbank.c
Original file line number Diff line number Diff line change
Expand Up @@ -852,42 +852,49 @@ LRESULT CALLBACK MainDlgProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lPar

// Temporarily apply current settings for preview
PatchsetChanged(hWnd, &m_patches.patches[iInstrument], TRUE);
MidiMessage(0xc0 | (iInstrument << 8));
MidiMessage(0x7f0090 | (n << 8));
switch (LOWORD(wParam))
if (iInstrument > 127)
{
case IDC_PLAYMJCHORD:
MidiMessage(0x7f0090 | ((n-12) << 8));
MidiMessage(0x7f0090 | ((n+4) << 8));
MidiMessage(0x7f0090 | ((n-5) << 8));
break;
case IDC_PLAYMNCHORD:
MidiMessage(0x7f0090 | ((n-12) << 8));
MidiMessage(0x7f0090 | ((n+3) << 8));
MidiMessage(0x7f0090 | ((n-5) << 8));
break;
case IDC_PLAYAUGCHORD:
MidiMessage(0x7f0090 | ((n-12) << 8));
MidiMessage(0x7f0090 | ((n+3) << 8));
MidiMessage(0x7f0090 | ((n-4) << 8));
break;
case IDC_PLAYDIMCHORD:
MidiMessage(0x7f0090 | ((n-12) << 8));
MidiMessage(0x7f0090 | ((n+3) << 8));
MidiMessage(0x7f0090 | ((n-6) << 8));
break;
case IDC_PLAYMJ7CHORD:
MidiMessage(0x7f0090 | ((n-12) << 8));
MidiMessage(0x7f0090 | ((n-2) << 8));
MidiMessage(0x7f0090 | ((n+4) << 8));
MidiMessage(0x7f0090 | ((n-5) << 8));
break;
case IDC_PLAYMN7CHORD:
MidiMessage(0x7f0090 | ((n-12) << 8));
MidiMessage(0x7f0090 | ((n-2) << 8));
MidiMessage(0x7f0090 | ((n+3) << 8));
MidiMessage(0x7f0090 | ((n-5) << 8));
break;
MidiMessage(0x7f0099 | ((iInstrument - 128) << 8));
}
else
{
MidiMessage(0xc0 | (iInstrument << 8));
MidiMessage(0x7f0090 | (n << 8));
switch (LOWORD(wParam))
{
case IDC_PLAYMJCHORD:
MidiMessage(0x7f0090 | ((n-12) << 8));
MidiMessage(0x7f0090 | ((n+4) << 8));
MidiMessage(0x7f0090 | ((n-5) << 8));
break;
case IDC_PLAYMNCHORD:
MidiMessage(0x7f0090 | ((n-12) << 8));
MidiMessage(0x7f0090 | ((n+3) << 8));
MidiMessage(0x7f0090 | ((n-5) << 8));
break;
case IDC_PLAYAUGCHORD:
MidiMessage(0x7f0090 | ((n-12) << 8));
MidiMessage(0x7f0090 | ((n+3) << 8));
MidiMessage(0x7f0090 | ((n-4) << 8));
break;
case IDC_PLAYDIMCHORD:
MidiMessage(0x7f0090 | ((n-12) << 8));
MidiMessage(0x7f0090 | ((n+3) << 8));
MidiMessage(0x7f0090 | ((n-6) << 8));
break;
case IDC_PLAYMJ7CHORD:
MidiMessage(0x7f0090 | ((n-12) << 8));
MidiMessage(0x7f0090 | ((n-2) << 8));
MidiMessage(0x7f0090 | ((n+4) << 8));
MidiMessage(0x7f0090 | ((n-5) << 8));
break;
case IDC_PLAYMN7CHORD:
MidiMessage(0x7f0090 | ((n-12) << 8));
MidiMessage(0x7f0090 | ((n-2) << 8));
MidiMessage(0x7f0090 | ((n+3) << 8));
MidiMessage(0x7f0090 | ((n-5) << 8));
break;
}
}
m_patches.patches[iInstrument] = psBak;
break;
Expand Down

0 comments on commit 1729123

Please sign in to comment.