dev136 - add auto patchbay toggle
This commit is contained in:
parent
02838e0a07
commit
2fbec000d7
8 changed files with 78 additions and 6 deletions
|
|
@ -1693,6 +1693,27 @@ bool DivEngine::addSystem(DivSystem which) {
|
|||
BUSY_END;
|
||||
initDispatch();
|
||||
BUSY_BEGIN;
|
||||
saveLock.lock();
|
||||
if (song.patchbayAuto) {
|
||||
autoPatchbay();
|
||||
} else {
|
||||
int i=song.systemLen-1;
|
||||
if (disCont[i].dispatch!=NULL) {
|
||||
unsigned int outs=disCont[i].dispatch->getOutputCount();
|
||||
if (outs>16) outs=16;
|
||||
if (outs<2) {
|
||||
for (unsigned int j=0; j<DIV_MAX_OUTPUTS; j++) {
|
||||
song.patchbay.push_back((i<<20)|j);
|
||||
}
|
||||
} else {
|
||||
for (unsigned int j=0; j<outs; j++) {
|
||||
|
||||
song.patchbay.push_back((i<<20)|(j<<16)|j);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
saveLock.unlock();
|
||||
renderSamples();
|
||||
reset();
|
||||
BUSY_END;
|
||||
|
|
@ -1725,6 +1746,14 @@ bool DivEngine::removeSystem(int index, bool preserveOrder) {
|
|||
}
|
||||
}
|
||||
|
||||
// patchbay
|
||||
for (size_t i=0; i<song.patchbay.size(); i++) {
|
||||
if (((song.patchbay[i]>>20)&0xfff)==index) {
|
||||
song.patchbay.erase(song.patchbay.begin()+i);
|
||||
i--;
|
||||
}
|
||||
}
|
||||
|
||||
song.system[index]=DIV_SYSTEM_NULL;
|
||||
song.systemLen--;
|
||||
for (int i=index; i<song.systemLen; i++) {
|
||||
|
|
@ -1867,6 +1896,15 @@ bool DivEngine::swapSystem(int src, int dest, bool preserveOrder) {
|
|||
song.systemFlags[src]=song.systemFlags[dest];
|
||||
song.systemFlags[dest]=oldFlags;
|
||||
|
||||
// patchbay
|
||||
for (unsigned int& i: song.patchbay) {
|
||||
if (((i>>20)&0xfff)==src) {
|
||||
i=(i&(~0xfff00000))|((unsigned int)dest<<20);
|
||||
} else if (((i>>20)&0xfff)==dest) {
|
||||
i=(i&(~0xfff00000))|((unsigned int)src<<20);
|
||||
}
|
||||
}
|
||||
|
||||
recalcChans();
|
||||
saveLock.unlock();
|
||||
BUSY_END;
|
||||
|
|
@ -3794,6 +3832,14 @@ void DivEngine::autoPatchbay() {
|
|||
}
|
||||
}
|
||||
|
||||
void DivEngine::autoPatchbayP() {
|
||||
BUSY_BEGIN;
|
||||
saveLock.lock();
|
||||
autoPatchbay();
|
||||
saveLock.unlock();
|
||||
BUSY_END;
|
||||
}
|
||||
|
||||
bool DivEngine::patchConnect(unsigned int src, unsigned int dest) {
|
||||
unsigned int armed=(src<<16)|(dest&0xffff);
|
||||
for (unsigned int i: song.patchbay) {
|
||||
|
|
@ -3802,6 +3848,7 @@ bool DivEngine::patchConnect(unsigned int src, unsigned int dest) {
|
|||
BUSY_BEGIN;
|
||||
saveLock.lock();
|
||||
song.patchbay.push_back(armed);
|
||||
song.patchbayAuto=false;
|
||||
saveLock.unlock();
|
||||
BUSY_END;
|
||||
return true;
|
||||
|
|
@ -3814,6 +3861,7 @@ bool DivEngine::patchDisconnect(unsigned int src, unsigned int dest) {
|
|||
BUSY_BEGIN;
|
||||
saveLock.lock();
|
||||
song.patchbay.erase(i);
|
||||
song.patchbayAuto=false;
|
||||
saveLock.unlock();
|
||||
BUSY_END;
|
||||
return true;
|
||||
|
|
@ -3961,6 +4009,14 @@ void DivEngine::updateSysFlags(int system, bool restart) {
|
|||
BUSY_BEGIN_SOFT;
|
||||
disCont[system].dispatch->setFlags(song.systemFlags[system]);
|
||||
disCont[system].setRates(got.rate);
|
||||
|
||||
// patchbay
|
||||
if (song.patchbayAuto) {
|
||||
saveLock.lock();
|
||||
autoPatchbay();
|
||||
saveLock.unlock();
|
||||
}
|
||||
|
||||
if (restart && isPlaying()) {
|
||||
playSub(false);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -47,8 +47,8 @@
|
|||
#define BUSY_BEGIN_SOFT softLocked=true; isBusy.lock();
|
||||
#define BUSY_END isBusy.unlock(); softLocked=false;
|
||||
|
||||
#define DIV_VERSION "dev135"
|
||||
#define DIV_ENGINE_VERSION 135
|
||||
#define DIV_VERSION "dev136"
|
||||
#define DIV_ENGINE_VERSION 136
|
||||
// for imports
|
||||
#define DIV_VERSION_MOD 0xff01
|
||||
#define DIV_VERSION_FC 0xff02
|
||||
|
|
@ -837,6 +837,7 @@ class DivEngine {
|
|||
|
||||
// automatic patchbay
|
||||
void autoPatchbay();
|
||||
void autoPatchbayP();
|
||||
|
||||
// connect in patchbay
|
||||
// returns false if connection already made
|
||||
|
|
|
|||
|
|
@ -2220,6 +2220,8 @@ bool DivEngine::loadFur(unsigned char* file, size_t len) {
|
|||
}
|
||||
}
|
||||
|
||||
if (ds.version>=136) song.patchbayAuto=reader.readC();
|
||||
|
||||
// read system flags
|
||||
if (ds.version>=119) {
|
||||
logD("reading chip flags...");
|
||||
|
|
@ -4489,6 +4491,7 @@ SafeWriter* DivEngine::saveFur(bool notPrimary) {
|
|||
for (unsigned int i: song.patchbay) {
|
||||
w->writeI(i);
|
||||
}
|
||||
w->writeC(song.patchbayAuto);
|
||||
|
||||
blockEndSeek=w->tell();
|
||||
w->seek(blockStartSeek,SEEK_SET);
|
||||
|
|
|
|||
|
|
@ -329,6 +329,7 @@ struct DivSong {
|
|||
bool disableSampleMacro;
|
||||
bool autoSystem;
|
||||
bool oldArpStrategy;
|
||||
bool patchbayAuto;
|
||||
|
||||
std::vector<DivInstrument*> ins;
|
||||
std::vector<DivWavetable*> wave;
|
||||
|
|
@ -437,7 +438,8 @@ struct DivSong {
|
|||
snNoLowPeriods(false),
|
||||
disableSampleMacro(false),
|
||||
autoSystem(true),
|
||||
oldArpStrategy(false) {
|
||||
oldArpStrategy(false),
|
||||
patchbayAuto(true) {
|
||||
for (int i=0; i<DIV_MAX_CHIPS; i++) {
|
||||
system[i]=DIV_SYSTEM_NULL;
|
||||
systemVol[i]=1.0;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue