GUI: make the new button work
This commit is contained in:
parent
6635d1c3ec
commit
8428f7da32
|
@ -1428,6 +1428,22 @@ void DivEngine::renderSamples() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DivEngine::createNew() {
|
||||||
|
DivSystem sys=song.system;
|
||||||
|
quitDispatch();
|
||||||
|
isBusy.lock();
|
||||||
|
song.unload();
|
||||||
|
song=DivSong();
|
||||||
|
song.system=sys;
|
||||||
|
chans=getChannelCount(song.system);
|
||||||
|
renderSamples();
|
||||||
|
isBusy.unlock();
|
||||||
|
initDispatch();
|
||||||
|
isBusy.lock();
|
||||||
|
reset();
|
||||||
|
isBusy.unlock();
|
||||||
|
}
|
||||||
|
|
||||||
void DivEngine::changeSystem(DivSystem which) {
|
void DivEngine::changeSystem(DivSystem which) {
|
||||||
quitDispatch();
|
quitDispatch();
|
||||||
isBusy.lock();
|
isBusy.lock();
|
||||||
|
|
|
@ -130,6 +130,8 @@ class DivEngine {
|
||||||
void nextBuf(float** in, float** out, int inChans, int outChans, unsigned int size);
|
void nextBuf(float** in, float** out, int inChans, int outChans, unsigned int size);
|
||||||
DivInstrument* getIns(int index);
|
DivInstrument* getIns(int index);
|
||||||
DivWavetable* getWave(int index);
|
DivWavetable* getWave(int index);
|
||||||
|
// start fresh
|
||||||
|
void createNew();
|
||||||
// load a .dmf.
|
// load a .dmf.
|
||||||
bool load(unsigned char* f, size_t length);
|
bool load(unsigned char* f, size_t length);
|
||||||
// save as .dmf.
|
// save as .dmf.
|
||||||
|
|
|
@ -2237,10 +2237,11 @@ bool FurnaceGUI::loop() {
|
||||||
|
|
||||||
ImGui::BeginMainMenuBar();
|
ImGui::BeginMainMenuBar();
|
||||||
if (ImGui::BeginMenu("file")) {
|
if (ImGui::BeginMenu("file")) {
|
||||||
ImGui::MenuItem("new");
|
if (ImGui::MenuItem("new")) {
|
||||||
|
e->createNew();
|
||||||
|
}
|
||||||
if (ImGui::MenuItem("open...")) {
|
if (ImGui::MenuItem("open...")) {
|
||||||
openFileDialog(GUI_FILE_OPEN);
|
openFileDialog(GUI_FILE_OPEN);
|
||||||
|
|
||||||
}
|
}
|
||||||
ImGui::Separator();
|
ImGui::Separator();
|
||||||
ImGui::MenuItem("save");
|
ImGui::MenuItem("save");
|
||||||
|
|
Loading…
Reference in a new issue