GUI: add option to copy WaveSynth out to new wave
This commit is contained in:
parent
d4b77bc3dc
commit
27935cec11
|
@ -6573,6 +6573,7 @@ FurnaceGUI::FurnaceGUI():
|
||||||
wavePreviewLen(32),
|
wavePreviewLen(32),
|
||||||
wavePreviewHeight(255),
|
wavePreviewHeight(255),
|
||||||
wavePreviewInit(true),
|
wavePreviewInit(true),
|
||||||
|
wavePreviewPaused(false),
|
||||||
pgSys(0),
|
pgSys(0),
|
||||||
pgAddr(0),
|
pgAddr(0),
|
||||||
pgVal(0),
|
pgVal(0),
|
||||||
|
|
|
@ -1633,7 +1633,7 @@ class FurnaceGUI {
|
||||||
|
|
||||||
DivWaveSynth wavePreview;
|
DivWaveSynth wavePreview;
|
||||||
int wavePreviewLen, wavePreviewHeight;
|
int wavePreviewLen, wavePreviewHeight;
|
||||||
bool wavePreviewInit;
|
bool wavePreviewInit, wavePreviewPaused;
|
||||||
|
|
||||||
// bit 31: ctrl
|
// bit 31: ctrl
|
||||||
// bit 30: reserved for SDL scancode mask
|
// bit 30: reserved for SDL scancode mask
|
||||||
|
|
|
@ -5153,7 +5153,9 @@ void FurnaceGUI::drawInsEdit() {
|
||||||
wavePreview2[i]=wave2->data[i];
|
wavePreview2[i]=wave2->data[i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (ins->ws.enabled) wavePreview.tick(true);
|
if (ins->ws.enabled && (!wavePreviewPaused || wavePreviewInit)) {
|
||||||
|
wavePreview.tick(true);
|
||||||
|
}
|
||||||
for (int i=0; i<wavePreviewLen; i++) {
|
for (int i=0; i<wavePreviewLen; i++) {
|
||||||
if (wave2->data[i]>wavePreviewHeight) {
|
if (wave2->data[i]>wavePreviewHeight) {
|
||||||
wavePreview3[i]=wavePreviewHeight;
|
wavePreview3[i]=wavePreviewHeight;
|
||||||
|
@ -5199,9 +5201,43 @@ void FurnaceGUI::drawInsEdit() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ImGui::TableNextColumn();
|
ImGui::TableNextColumn();
|
||||||
|
if (ImGui::Button(wavePreviewPaused?(ICON_FA_PLAY "##WSPause"):(ICON_FA_PAUSE "##WSPause"))) {
|
||||||
|
wavePreviewPaused=!wavePreviewPaused;
|
||||||
|
}
|
||||||
|
if (ImGui::IsItemHovered()) {
|
||||||
|
if (wavePreviewPaused) {
|
||||||
|
ImGui::SetTooltip("Resume preview");
|
||||||
|
} else {
|
||||||
|
ImGui::SetTooltip("Pause preview");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ImGui::SameLine();
|
||||||
if (ImGui::Button(ICON_FA_REPEAT "##WSRestart")) {
|
if (ImGui::Button(ICON_FA_REPEAT "##WSRestart")) {
|
||||||
wavePreviewInit=true;
|
wavePreviewInit=true;
|
||||||
}
|
}
|
||||||
|
if (ImGui::IsItemHovered()) {
|
||||||
|
ImGui::SetTooltip("Restart preview");
|
||||||
|
}
|
||||||
|
ImGui::SameLine();
|
||||||
|
if (ImGui::Button(ICON_FA_UPLOAD "##WSCopy")) {
|
||||||
|
curWave=e->addWave();
|
||||||
|
if (curWave==-1) {
|
||||||
|
showError("too many wavetables!");
|
||||||
|
} else {
|
||||||
|
wantScrollList=true;
|
||||||
|
MARK_MODIFIED;
|
||||||
|
RESET_WAVE_MACRO_ZOOM;
|
||||||
|
nextWindow=GUI_WINDOW_WAVE_EDIT;
|
||||||
|
|
||||||
|
DivWavetable* copyWave=e->song.wave[curWave];
|
||||||
|
copyWave->len=wavePreviewLen;
|
||||||
|
copyWave->max=wavePreviewHeight;
|
||||||
|
memcpy(copyWave->data,wavePreview.output,256*sizeof(int));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (ImGui::IsItemHovered()) {
|
||||||
|
ImGui::SetTooltip("Copy to new wavetable");
|
||||||
|
}
|
||||||
ImGui::SameLine();
|
ImGui::SameLine();
|
||||||
ImGui::Text("(%d×%d)",wavePreviewLen,wavePreviewHeight+1);
|
ImGui::Text("(%d×%d)",wavePreviewLen,wavePreviewHeight+1);
|
||||||
ImGui::EndTable();
|
ImGui::EndTable();
|
||||||
|
|
Loading…
Reference in New Issue