fix MIDI input not working on ins load preview

issue #2561
This commit is contained in:
tildearrow 2025-06-24 03:34:05 -05:00
parent 38e4245ee0
commit 6d7a354531
3 changed files with 11 additions and 11 deletions

View file

@ -577,7 +577,7 @@ class DivEngine {
DivWorkPool* renderPool;
// MIDI stuff
std::function<int(const TAMidiMessage&)> midiCallback=[](const TAMidiMessage&) -> int {return -2;};
std::function<int(const TAMidiMessage&)> midiCallback=[](const TAMidiMessage&) -> int {return -3;};
void processRowPre(int i);
void processRow(int i, bool afterDelay);
@ -1338,7 +1338,7 @@ class DivEngine {
void setMidiVolExp(float value);
// set MIDI input callback
// if the specified function returns -2, note feedback will be inhibited.
// if the specified function returns -3, note feedback will be inhibited.
void setMidiCallback(std::function<int(const TAMidiMessage&)> what);
// send MIDI message

View file

@ -2252,7 +2252,7 @@ void DivEngine::nextBuf(float** in, float** out, int inChans, int outChans, unsi
}
}
int ins=-1;
if ((ins=midiCallback(msg))!=-2) {
if ((ins=midiCallback(msg))!=-3) {
int chan=msg.type&15;
switch (msg.type&0xf0) {
case TA_MIDI_NOTE_OFF: {

View file

@ -7905,7 +7905,7 @@ bool FurnaceGUI::init() {
userEvents=SDL_RegisterEvents(1);
e->setMidiCallback([this](const TAMidiMessage& msg) -> int {
if (introPos<11.0) return -2;
if (introPos<11.0) return -3;
midiLock.lock();
midiQueue.push(msg);
if (userEvents!=0xffffffff && midiWakeUp) {
@ -7918,11 +7918,11 @@ bool FurnaceGUI::init() {
}
midiLock.unlock();
e->setMidiBaseChan(cursor.xCoarse);
if (msg.type==TA_MIDI_SYSEX) return -2;
if (midiMap.valueInputStyle!=0 && cursor.xFine!=0 && edit) return -2;
if (!midiMap.noteInput) return -2;
if (learning!=-1) return -2;
if (midiMap.at(msg)) return -2;
if (msg.type==TA_MIDI_SYSEX) return -3;
if (midiMap.valueInputStyle!=0 && cursor.xFine!=0 && edit) return -3;
if (!midiMap.noteInput) return -3;
if (learning!=-1) return -3;
if (midiMap.at(msg)) return -3;
if (curWindowThreadSafe==GUI_WINDOW_WAVE_EDIT || curWindowThreadSafe==GUI_WINDOW_WAVE_LIST) {
if ((msg.type&0xf0)==TA_MIDI_NOTE_ON) {
@ -7933,7 +7933,7 @@ bool FurnaceGUI::init() {
e->stopWavePreviewNoLock();
}
}
return -2;
return -3;
}
if (curWindowThreadSafe==GUI_WINDOW_SAMPLE_EDIT || curWindowThreadSafe==GUI_WINDOW_SAMPLE_LIST) {
@ -7945,7 +7945,7 @@ bool FurnaceGUI::init() {
e->stopSamplePreviewNoLock();
}
}
return -2;
return -3;
}
if (midiMap.directChannel && midiMap.directProgram) return -1;