diff --git a/CMakeLists.txt b/CMakeLists.txt index 9dd1418c8..dcd981669 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -624,6 +624,7 @@ src/gui/editing.cpp src/gui/editControls.cpp src/gui/effectList.cpp src/gui/findReplace.cpp +src/gui/fmPreview.cpp src/gui/gradient.cpp src/gui/grooves.cpp src/gui/insEdit.cpp diff --git a/src/gui/debugWindow.cpp b/src/gui/debugWindow.cpp index d7179204c..5042ec3a4 100644 --- a/src/gui/debugWindow.cpp +++ b/src/gui/debugWindow.cpp @@ -519,6 +519,18 @@ void FurnaceGUI::drawDebug() { ImGui::InputFloat("maxRr",&maxRr); ImGui::TreePop(); } + if (ImGui::TreeNode("FM Preview")) { + if (ImGui::Button("Generate")) { + DivInstrument* ins=e->getIns(curIns); + if (ins!=NULL) renderFMPreview(ins->fm); + } + float asFloat[FM_PREVIEW_SIZE]; + for (int i=0; i32767) aOut=32767; + fmPreview[i]=aOut; + } +} diff --git a/src/gui/gui.h b/src/gui/gui.h index a42c47429..8a24857e2 100644 --- a/src/gui/gui.h +++ b/src/gui/gui.h @@ -68,6 +68,8 @@ #define BIND_FOR(x) getKeyName(actionKeys[x],true).c_str() +#define FM_PREVIEW_SIZE 1024 + // TODO: // - add colors for FM envelope and waveform // - maybe add "alternate" color for FM modulators/carriers (a bit difficult) @@ -1192,6 +1194,7 @@ class FurnaceGUI { ImVec2 mobileEditButtonPos, mobileEditButtonSize; const int* curSysSection; DivInstrumentFM opllPreview; + short fmPreview[FM_PREVIEW_SIZE]; String pendingRawSample; int pendingRawSampleDepth, pendingRawSampleChannels; @@ -1887,6 +1890,7 @@ class FurnaceGUI { void drawGBEnv(unsigned char vol, unsigned char len, unsigned char sLen, bool dir, const ImVec2& size); bool drawSysConf(int chan, DivSystem type, DivConfig& flags, bool modifyOnChange); void kvsConfig(DivInstrument* ins); + void renderFMPreview(const DivInstrumentFM& params, int pos=0); // these ones offer ctrl-wheel fine value changes. bool CWSliderScalar(const char* label, ImGuiDataType data_type, void* p_data, const void* p_min, const void* p_max, const char* format=NULL, ImGuiSliderFlags flags=0);