instrument swap implemented (thanks to @Eknous-P)
This commit is contained in:
parent
806e56a3b2
commit
6ffc495c81
|
@ -3248,6 +3248,20 @@ bool DivEngine::moveSampleDown(int which) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool DivEngine::swapInstruments(int a, int b) {
|
||||||
|
if (a<0 || a>=(int)song.ins.size() || b<0 || b>=(int)song.ins.size()) return false;
|
||||||
|
BUSY_BEGIN;
|
||||||
|
DivInstrument* temp=song.ins[a];
|
||||||
|
saveLock.lock();
|
||||||
|
song.ins[a]=song.ins[b];
|
||||||
|
song.ins[b]=temp;
|
||||||
|
moveAsset(song.insDir,a,b);
|
||||||
|
exchangeIns(a,b);
|
||||||
|
saveLock.unlock();
|
||||||
|
BUSY_END;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
void DivEngine::autoPatchbay() {
|
void DivEngine::autoPatchbay() {
|
||||||
song.patchbay.clear();
|
song.patchbay.clear();
|
||||||
for (unsigned int i=0; i<song.systemLen; i++) {
|
for (unsigned int i=0; i<song.systemLen; i++) {
|
||||||
|
|
|
@ -1107,6 +1107,9 @@ class DivEngine {
|
||||||
bool moveWaveDown(int which);
|
bool moveWaveDown(int which);
|
||||||
bool moveSampleDown(int which);
|
bool moveSampleDown(int which);
|
||||||
|
|
||||||
|
// swap things
|
||||||
|
bool swapInstruments(int a, int b);
|
||||||
|
|
||||||
// automatic patchbay
|
// automatic patchbay
|
||||||
void autoPatchbay();
|
void autoPatchbay();
|
||||||
void autoPatchbayP();
|
void autoPatchbayP();
|
||||||
|
|
|
@ -138,8 +138,10 @@ void FurnaceGUI::insListItem(int i, int dir, int asset) {
|
||||||
const ImGuiPayload* payload=ImGui::AcceptDragDropPayload("FUR_INS");
|
const ImGuiPayload* payload=ImGui::AcceptDragDropPayload("FUR_INS");
|
||||||
if (payload!=NULL) {
|
if (payload!=NULL) {
|
||||||
int targetIns=i;
|
int targetIns=i;
|
||||||
printf("From %d to %d\n",insToMove,targetIns);
|
if (insToMove!=targetIns && e->swapInstruments(insToMove,targetIns)) {
|
||||||
// TODO: actually swap the instruments
|
MARK_MODIFIED;
|
||||||
|
curIns=targetIns;
|
||||||
|
}
|
||||||
insToMove=-1;
|
insToMove=-1;
|
||||||
ImGui::EndDragDropTarget();
|
ImGui::EndDragDropTarget();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue