wave+sample drag&drop, and supporting swap via ctrl-drag

This commit is contained in:
yohannd1 2024-12-19 15:51:21 -03:00
parent 6ffc495c81
commit 32ea140a61
5 changed files with 104 additions and 33 deletions

View file

@ -3262,6 +3262,39 @@ bool DivEngine::swapInstruments(int a, int b) {
return true;
}
bool DivEngine::swapWaves(int a, int b) {
if (a<0 || a>=(int)song.wave.size() || b<0 || b>=(int)song.wave.size()) return false;
BUSY_BEGIN;
DivWavetable* temp=song.wave[a];
saveLock.lock();
song.wave[a]=song.wave[b];
song.wave[b]=temp;
exchangeWave(a,b);
moveAsset(song.waveDir,a,b);
saveLock.unlock();
BUSY_END;
return true;
}
bool DivEngine::swapSamples(int a, int b) {
if (a<0 || a>=(int)song.sample.size() || b<0 || b>=(int)song.sample.size()) return false;
BUSY_BEGIN;
sPreview.sample=-1;
sPreview.pos=0;
sPreview.dir=false;
DivSample* temp=song.sample[a];
saveLock.lock();
song.sample[a]=song.sample[b];
song.sample[b]=temp;
exchangeSample(a,b);
moveAsset(song.sampleDir,a,b);
saveLock.unlock();
renderSamples();
BUSY_END;
return true;
}
void DivEngine::autoPatchbay() {
song.patchbay.clear();
for (unsigned int i=0; i<song.systemLen; i++) {