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;
|
||||
}
|
||||
|
||||
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() {
|
||||
song.patchbay.clear();
|
||||
for (unsigned int i=0; i<song.systemLen; i++) {
|
||||
|
|
|
@ -1107,6 +1107,9 @@ class DivEngine {
|
|||
bool moveWaveDown(int which);
|
||||
bool moveSampleDown(int which);
|
||||
|
||||
// swap things
|
||||
bool swapInstruments(int a, int b);
|
||||
|
||||
// automatic patchbay
|
||||
void autoPatchbay();
|
||||
void autoPatchbayP();
|
||||
|
|
|
@ -138,8 +138,10 @@ void FurnaceGUI::insListItem(int i, int dir, int asset) {
|
|||
const ImGuiPayload* payload=ImGui::AcceptDragDropPayload("FUR_INS");
|
||||
if (payload!=NULL) {
|
||||
int targetIns=i;
|
||||
printf("From %d to %d\n",insToMove,targetIns);
|
||||
// TODO: actually swap the instruments
|
||||
if (insToMove!=targetIns && e->swapInstruments(insToMove,targetIns)) {
|
||||
MARK_MODIFIED;
|
||||
curIns=targetIns;
|
||||
}
|
||||
insToMove=-1;
|
||||
ImGui::EndDragDropTarget();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue