GUI: it doesn't work!

This commit is contained in:
tildearrow 2023-01-08 19:23:17 -05:00
parent fc6bc13729
commit 9b79bc0e7b
5 changed files with 176 additions and 17 deletions

View file

@ -3794,6 +3794,34 @@ void DivEngine::autoPatchbay() {
}
}
bool DivEngine::patchConnect(unsigned int src, unsigned int dest) {
unsigned int armed=(src<<16)|(dest&0xffff);
for (unsigned int i: song.patchbay) {
if (i==armed) return false;
}
BUSY_BEGIN;
saveLock.lock();
song.patchbay.push_back(armed);
saveLock.unlock();
BUSY_END;
return true;
}
bool DivEngine::patchDisconnect(unsigned int src, unsigned int dest) {
unsigned int armed=(src<<16)|(dest&0xffff);
for (auto i=song.patchbay.begin(); i!=song.patchbay.end(); i++) {
if (*i==armed) {
BUSY_BEGIN;
saveLock.lock();
song.patchbay.erase(i);
saveLock.unlock();
BUSY_END;
return true;
}
}
return false;
}
void DivEngine::noteOn(int chan, int ins, int note, int vol) {
if (chan<0 || chan>=chans) return;
BUSY_BEGIN;

View file

@ -838,6 +838,14 @@ class DivEngine {
// automatic patchbay
void autoPatchbay();
// connect in patchbay
// returns false if connection already made
bool patchConnect(unsigned int src, unsigned int dest);
// disconnect in patchbay
// returns false if connection doesn't exist
bool patchDisconnect(unsigned int src, unsigned int dest);
// play note
void noteOn(int chan, int ins, int note, int vol=-1);