dev136 - add auto patchbay toggle
This commit is contained in:
parent
02838e0a07
commit
2fbec000d7
|
@ -32,6 +32,7 @@ these fields are 0 in format versions prior to 100 (0.6pre1).
|
||||||
|
|
||||||
the format versions are:
|
the format versions are:
|
||||||
|
|
||||||
|
- 136: Furnace dev136
|
||||||
- 135: Furnace dev135
|
- 135: Furnace dev135
|
||||||
- 134: Furnace dev134
|
- 134: Furnace dev134
|
||||||
- 133: Furnace 0.6pre3
|
- 133: Furnace 0.6pre3
|
||||||
|
@ -396,6 +397,7 @@ size | description
|
||||||
4 | patchbay connection count
|
4 | patchbay connection count
|
||||||
4?? | patchbay
|
4?? | patchbay
|
||||||
| - see next section for more details.
|
| - see next section for more details.
|
||||||
|
1 | automatic patchbay (>=136)
|
||||||
```
|
```
|
||||||
|
|
||||||
# patchbay
|
# patchbay
|
||||||
|
|
|
@ -1693,6 +1693,27 @@ bool DivEngine::addSystem(DivSystem which) {
|
||||||
BUSY_END;
|
BUSY_END;
|
||||||
initDispatch();
|
initDispatch();
|
||||||
BUSY_BEGIN;
|
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();
|
renderSamples();
|
||||||
reset();
|
reset();
|
||||||
BUSY_END;
|
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.system[index]=DIV_SYSTEM_NULL;
|
||||||
song.systemLen--;
|
song.systemLen--;
|
||||||
for (int i=index; i<song.systemLen; i++) {
|
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[src]=song.systemFlags[dest];
|
||||||
song.systemFlags[dest]=oldFlags;
|
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();
|
recalcChans();
|
||||||
saveLock.unlock();
|
saveLock.unlock();
|
||||||
BUSY_END;
|
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) {
|
bool DivEngine::patchConnect(unsigned int src, unsigned int dest) {
|
||||||
unsigned int armed=(src<<16)|(dest&0xffff);
|
unsigned int armed=(src<<16)|(dest&0xffff);
|
||||||
for (unsigned int i: song.patchbay) {
|
for (unsigned int i: song.patchbay) {
|
||||||
|
@ -3802,6 +3848,7 @@ bool DivEngine::patchConnect(unsigned int src, unsigned int dest) {
|
||||||
BUSY_BEGIN;
|
BUSY_BEGIN;
|
||||||
saveLock.lock();
|
saveLock.lock();
|
||||||
song.patchbay.push_back(armed);
|
song.patchbay.push_back(armed);
|
||||||
|
song.patchbayAuto=false;
|
||||||
saveLock.unlock();
|
saveLock.unlock();
|
||||||
BUSY_END;
|
BUSY_END;
|
||||||
return true;
|
return true;
|
||||||
|
@ -3814,6 +3861,7 @@ bool DivEngine::patchDisconnect(unsigned int src, unsigned int dest) {
|
||||||
BUSY_BEGIN;
|
BUSY_BEGIN;
|
||||||
saveLock.lock();
|
saveLock.lock();
|
||||||
song.patchbay.erase(i);
|
song.patchbay.erase(i);
|
||||||
|
song.patchbayAuto=false;
|
||||||
saveLock.unlock();
|
saveLock.unlock();
|
||||||
BUSY_END;
|
BUSY_END;
|
||||||
return true;
|
return true;
|
||||||
|
@ -3961,6 +4009,14 @@ void DivEngine::updateSysFlags(int system, bool restart) {
|
||||||
BUSY_BEGIN_SOFT;
|
BUSY_BEGIN_SOFT;
|
||||||
disCont[system].dispatch->setFlags(song.systemFlags[system]);
|
disCont[system].dispatch->setFlags(song.systemFlags[system]);
|
||||||
disCont[system].setRates(got.rate);
|
disCont[system].setRates(got.rate);
|
||||||
|
|
||||||
|
// patchbay
|
||||||
|
if (song.patchbayAuto) {
|
||||||
|
saveLock.lock();
|
||||||
|
autoPatchbay();
|
||||||
|
saveLock.unlock();
|
||||||
|
}
|
||||||
|
|
||||||
if (restart && isPlaying()) {
|
if (restart && isPlaying()) {
|
||||||
playSub(false);
|
playSub(false);
|
||||||
}
|
}
|
||||||
|
|
|
@ -47,8 +47,8 @@
|
||||||
#define BUSY_BEGIN_SOFT softLocked=true; isBusy.lock();
|
#define BUSY_BEGIN_SOFT softLocked=true; isBusy.lock();
|
||||||
#define BUSY_END isBusy.unlock(); softLocked=false;
|
#define BUSY_END isBusy.unlock(); softLocked=false;
|
||||||
|
|
||||||
#define DIV_VERSION "dev135"
|
#define DIV_VERSION "dev136"
|
||||||
#define DIV_ENGINE_VERSION 135
|
#define DIV_ENGINE_VERSION 136
|
||||||
// for imports
|
// for imports
|
||||||
#define DIV_VERSION_MOD 0xff01
|
#define DIV_VERSION_MOD 0xff01
|
||||||
#define DIV_VERSION_FC 0xff02
|
#define DIV_VERSION_FC 0xff02
|
||||||
|
@ -837,6 +837,7 @@ class DivEngine {
|
||||||
|
|
||||||
// automatic patchbay
|
// automatic patchbay
|
||||||
void autoPatchbay();
|
void autoPatchbay();
|
||||||
|
void autoPatchbayP();
|
||||||
|
|
||||||
// connect in patchbay
|
// connect in patchbay
|
||||||
// returns false if connection already made
|
// 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
|
// read system flags
|
||||||
if (ds.version>=119) {
|
if (ds.version>=119) {
|
||||||
logD("reading chip flags...");
|
logD("reading chip flags...");
|
||||||
|
@ -4489,6 +4491,7 @@ SafeWriter* DivEngine::saveFur(bool notPrimary) {
|
||||||
for (unsigned int i: song.patchbay) {
|
for (unsigned int i: song.patchbay) {
|
||||||
w->writeI(i);
|
w->writeI(i);
|
||||||
}
|
}
|
||||||
|
w->writeC(song.patchbayAuto);
|
||||||
|
|
||||||
blockEndSeek=w->tell();
|
blockEndSeek=w->tell();
|
||||||
w->seek(blockStartSeek,SEEK_SET);
|
w->seek(blockStartSeek,SEEK_SET);
|
||||||
|
|
|
@ -329,6 +329,7 @@ struct DivSong {
|
||||||
bool disableSampleMacro;
|
bool disableSampleMacro;
|
||||||
bool autoSystem;
|
bool autoSystem;
|
||||||
bool oldArpStrategy;
|
bool oldArpStrategy;
|
||||||
|
bool patchbayAuto;
|
||||||
|
|
||||||
std::vector<DivInstrument*> ins;
|
std::vector<DivInstrument*> ins;
|
||||||
std::vector<DivWavetable*> wave;
|
std::vector<DivWavetable*> wave;
|
||||||
|
@ -437,7 +438,8 @@ struct DivSong {
|
||||||
snNoLowPeriods(false),
|
snNoLowPeriods(false),
|
||||||
disableSampleMacro(false),
|
disableSampleMacro(false),
|
||||||
autoSystem(true),
|
autoSystem(true),
|
||||||
oldArpStrategy(false) {
|
oldArpStrategy(false),
|
||||||
|
patchbayAuto(true) {
|
||||||
for (int i=0; i<DIV_MAX_CHIPS; i++) {
|
for (int i=0; i<DIV_MAX_CHIPS; i++) {
|
||||||
system[i]=DIV_SYSTEM_NULL;
|
system[i]=DIV_SYSTEM_NULL;
|
||||||
systemVol[i]=1.0;
|
systemVol[i]=1.0;
|
||||||
|
|
|
@ -6026,6 +6026,7 @@ FurnaceGUI::FurnaceGUI():
|
||||||
hoveredPortSet(0x1fff),
|
hoveredPortSet(0x1fff),
|
||||||
hoveredSubPort(-1),
|
hoveredSubPort(-1),
|
||||||
portDragActive(false),
|
portDragActive(false),
|
||||||
|
displayHiddenPorts(false),
|
||||||
subPortPos(0.0f,0.0f),
|
subPortPos(0.0f,0.0f),
|
||||||
oscTotal(0),
|
oscTotal(0),
|
||||||
oscZoom(0.5f),
|
oscZoom(0.5f),
|
||||||
|
|
|
@ -1664,7 +1664,7 @@ class FurnaceGUI {
|
||||||
int selectedSubPort;
|
int selectedSubPort;
|
||||||
unsigned int hoveredPortSet;
|
unsigned int hoveredPortSet;
|
||||||
int hoveredSubPort;
|
int hoveredSubPort;
|
||||||
bool portDragActive;
|
bool portDragActive, displayHiddenPorts;
|
||||||
ImVec2 subPortPos;
|
ImVec2 subPortPos;
|
||||||
|
|
||||||
// oscilloscope
|
// oscilloscope
|
||||||
|
|
|
@ -249,7 +249,12 @@ void FurnaceGUI::drawMixer() {
|
||||||
ImGui::EndTable();
|
ImGui::EndTable();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
ImGui::Dummy(ImVec2(1.0f,ImGui::GetFrameHeightWithSpacing()*4.0f));
|
if (ImGui::Checkbox("Automatic patchbay",&e->song.patchbayAuto)) {
|
||||||
|
if (e->song.patchbayAuto) e->autoPatchbayP();
|
||||||
|
MARK_MODIFIED;
|
||||||
|
}
|
||||||
|
ImGui::Checkbox("Display hidden ports",&displayHiddenPorts);
|
||||||
|
ImGui::Dummy(ImVec2(1.0f,ImGui::GetFrameHeightWithSpacing()*2.0f));
|
||||||
}
|
}
|
||||||
|
|
||||||
hoveredPortSet=0x1fff;
|
hoveredPortSet=0x1fff;
|
||||||
|
@ -260,6 +265,8 @@ void FurnaceGUI::drawMixer() {
|
||||||
ImVec2 topPos=ImGui::GetCursorPos();
|
ImVec2 topPos=ImGui::GetCursorPos();
|
||||||
topPos.x+=ImGui::GetContentRegionAvail().x-60.0*dpiScale;
|
topPos.x+=ImGui::GetContentRegionAvail().x-60.0*dpiScale;
|
||||||
|
|
||||||
|
if (ImGui::IsWindowHovered() && ImGui::IsMouseClicked(ImGuiMouseButton_Left)) selectedPortSet=0x1fff;
|
||||||
|
|
||||||
if (portDragActive) {
|
if (portDragActive) {
|
||||||
dl->AddLine(subPortPos,ImGui::GetMousePos(),ImGui::GetColorU32(uiColors[GUI_COLOR_PATCHBAY_CONNECTION]),2.0f*dpiScale);
|
dl->AddLine(subPortPos,ImGui::GetMousePos(),ImGui::GetColorU32(uiColors[GUI_COLOR_PATCHBAY_CONNECTION]),2.0f*dpiScale);
|
||||||
}
|
}
|
||||||
|
@ -281,7 +288,7 @@ void FurnaceGUI::drawMixer() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ImGui::SetCursorPos(topPos);
|
ImGui::SetCursorPos(topPos);
|
||||||
if (portSet("System",0x1000,e->getAudioDescGot().outChans,0,e->getAudioDescGot().outChans,0,selectedSubPort,portPos)) {
|
if (portSet("System",0x1000,displayHiddenPorts?DIV_MAX_OUTPUTS:e->getAudioDescGot().outChans,0,e->getAudioDescGot().outChans,0,selectedSubPort,portPos)) {
|
||||||
selectedPortSet=0x1000;
|
selectedPortSet=0x1000;
|
||||||
if (selectedSubPort>=0) {
|
if (selectedSubPort>=0) {
|
||||||
portDragActive=true;
|
portDragActive=true;
|
||||||
|
|
Loading…
Reference in a new issue