mirror of
https://github.com/tildearrow/furnace.git
synced 2024-12-31 20:11:29 +00:00
allow moving ins/wave/samples up or down
This commit is contained in:
parent
020d278f00
commit
4c5fbc252b
3 changed files with 76 additions and 8 deletions
|
@ -2719,6 +2719,66 @@ void DivEngine::moveOrderDown() {
|
|||
isBusy.unlock();
|
||||
}
|
||||
|
||||
bool DivEngine::moveInsUp(int which) {
|
||||
if (which<1 || which>=(int)song.ins.size()) return false;
|
||||
isBusy.lock();
|
||||
DivInstrument* prev=song.ins[which];
|
||||
song.ins[which]=song.ins[which-1];
|
||||
song.ins[which-1]=prev;
|
||||
isBusy.unlock();
|
||||
return true;
|
||||
}
|
||||
|
||||
bool DivEngine::moveWaveUp(int which) {
|
||||
if (which<1 || which>=(int)song.wave.size()) return false;
|
||||
isBusy.lock();
|
||||
DivWavetable* prev=song.wave[which];
|
||||
song.wave[which]=song.wave[which-1];
|
||||
song.wave[which-1]=prev;
|
||||
isBusy.unlock();
|
||||
return true;
|
||||
}
|
||||
|
||||
bool DivEngine::moveSampleUp(int which) {
|
||||
if (which<1 || which>=(int)song.sample.size()) return false;
|
||||
isBusy.lock();
|
||||
DivSample* prev=song.sample[which];
|
||||
song.sample[which]=song.sample[which-1];
|
||||
song.sample[which-1]=prev;
|
||||
isBusy.unlock();
|
||||
return true;
|
||||
}
|
||||
|
||||
bool DivEngine::moveInsDown(int which) {
|
||||
if (which<0 || which>=((int)song.ins.size())-1) return false;
|
||||
isBusy.lock();
|
||||
DivInstrument* prev=song.ins[which];
|
||||
song.ins[which]=song.ins[which+1];
|
||||
song.ins[which+1]=prev;
|
||||
isBusy.unlock();
|
||||
return true;
|
||||
}
|
||||
|
||||
bool DivEngine::moveWaveDown(int which) {
|
||||
if (which<0 || which>=((int)song.wave.size())-1) return false;
|
||||
isBusy.lock();
|
||||
DivWavetable* prev=song.wave[which];
|
||||
song.wave[which]=song.wave[which+1];
|
||||
song.wave[which+1]=prev;
|
||||
isBusy.unlock();
|
||||
return true;
|
||||
}
|
||||
|
||||
bool DivEngine::moveSampleDown(int which) {
|
||||
if (which<0 || which>=((int)song.sample.size())-1) return false;
|
||||
isBusy.lock();
|
||||
DivSample* prev=song.sample[which];
|
||||
song.sample[which]=song.sample[which+1];
|
||||
song.sample[which+1]=prev;
|
||||
isBusy.unlock();
|
||||
return true;
|
||||
}
|
||||
|
||||
void DivEngine::noteOn(int chan, int ins, int note, int vol) {
|
||||
isBusy.lock();
|
||||
pendingNotes.push(DivNoteEvent(chan,ins,note,vol,true));
|
||||
|
|
|
@ -349,6 +349,16 @@ class DivEngine {
|
|||
// move order down
|
||||
void moveOrderDown();
|
||||
|
||||
// move thing up
|
||||
bool moveInsUp(int which);
|
||||
bool moveWaveUp(int which);
|
||||
bool moveSampleUp(int which);
|
||||
|
||||
// move thing down
|
||||
bool moveInsDown(int which);
|
||||
bool moveWaveDown(int which);
|
||||
bool moveSampleDown(int which);
|
||||
|
||||
// play note
|
||||
void noteOn(int chan, int ins, int note, int vol=-1);
|
||||
|
||||
|
|
|
@ -511,11 +511,11 @@ void FurnaceGUI::drawInsList() {
|
|||
}
|
||||
ImGui::SameLine();
|
||||
if (ImGui::ArrowButton("InsUp",ImGuiDir_Up)) {
|
||||
// TODO
|
||||
if (e->moveInsUp(curIns)) curIns--;
|
||||
}
|
||||
ImGui::SameLine();
|
||||
if (ImGui::ArrowButton("InsDown",ImGuiDir_Down)) {
|
||||
// TODO
|
||||
if (e->moveInsDown(curIns)) curIns++;
|
||||
}
|
||||
ImGui::SameLine();
|
||||
if (ImGui::Button(ICON_FA_TIMES "##InsDelete")) {
|
||||
|
@ -582,8 +582,6 @@ const char* ssgEnvTypes[8]={
|
|||
"Down Down Down", "Down.", "Down Up Down Up", "Down UP", "Up Up Up", "Up.", "Up Down Up Down", "Up DOWN"
|
||||
};
|
||||
|
||||
// TODO: BUTTONS TO SELECT BETWEEN 15 AND 31
|
||||
// AND DUTY TOO
|
||||
void FurnaceGUI::drawInsEdit() {
|
||||
if (!insEditOpen) return;
|
||||
if (ImGui::Begin("Instrument Editor",&insEditOpen,ImGuiWindowFlags_NoDocking)) {
|
||||
|
@ -1006,11 +1004,11 @@ void FurnaceGUI::drawWaveList() {
|
|||
}
|
||||
ImGui::SameLine();
|
||||
if (ImGui::ArrowButton("WaveUp",ImGuiDir_Up)) {
|
||||
// TODO
|
||||
if (e->moveWaveUp(curWave)) curWave--;
|
||||
}
|
||||
ImGui::SameLine();
|
||||
if (ImGui::ArrowButton("WaveDown",ImGuiDir_Down)) {
|
||||
// TODO
|
||||
if (e->moveWaveDown(curWave)) curWave++;
|
||||
}
|
||||
ImGui::SameLine();
|
||||
if (ImGui::Button(ICON_FA_TIMES "##WaveDelete")) {
|
||||
|
@ -1117,11 +1115,11 @@ void FurnaceGUI::drawSampleList() {
|
|||
}
|
||||
ImGui::SameLine();
|
||||
if (ImGui::ArrowButton("SampleUp",ImGuiDir_Up)) {
|
||||
// TODO
|
||||
if (e->moveSampleUp(curSample)) curSample--;
|
||||
}
|
||||
ImGui::SameLine();
|
||||
if (ImGui::ArrowButton("SampleDown",ImGuiDir_Down)) {
|
||||
// TODO
|
||||
if (e->moveSampleDown(curSample)) curSample++;
|
||||
}
|
||||
ImGui::SameLine();
|
||||
if (ImGui::Button(ICON_FA_TIMES "##SampleDelete")) {
|
||||
|
|
Loading…
Reference in a new issue