improve audio export options - UNTESTED/UNFINISHED

This commit is contained in:
tildearrow 2024-05-10 20:01:12 -05:00
parent e5026e43aa
commit 008fe4b6b8
8 changed files with 112 additions and 60 deletions

View file

@ -26,14 +26,35 @@
void FurnaceGUI::drawExportAudio(bool onWindow) {
exitDisabledTimer=1;
ImGui::RadioButton("one file",&audioExportType,0);
ImGui::RadioButton("multiple files (one per chip)",&audioExportType,1);
ImGui::RadioButton("multiple files (one per channel)",&audioExportType,2);
if (ImGui::InputInt("Loops",&exportLoops,1,2)) {
if (exportLoops<0) exportLoops=0;
ImGui::Text("Export type:");
ImGui::Indent();
if (ImGui::RadioButton("one file",audioExportOptions.mode==DIV_EXPORT_MODE_ONE)) {
audioExportOptions.mode=DIV_EXPORT_MODE_ONE;
}
if (ImGui::InputDouble("Fade out (seconds)",&exportFadeOut,1.0,2.0,"%.1f")) {
if (exportFadeOut<0.0) exportFadeOut=0.0;
if (ImGui::RadioButton("multiple files (one per chip)",audioExportOptions.mode==DIV_EXPORT_MODE_MANY_SYS)) {
audioExportOptions.mode=DIV_EXPORT_MODE_MANY_SYS;
}
if (ImGui::RadioButton("multiple files (one per channel)",audioExportOptions.mode==DIV_EXPORT_MODE_MANY_CHAN)) {
audioExportOptions.mode=DIV_EXPORT_MODE_MANY_CHAN;
}
ImGui::Unindent();
if (ImGui::InputInt("Sample rate",&audioExportOptions.sampleRate,100,10000)) {
if (audioExportOptions.sampleRate<8000) audioExportOptions.sampleRate=8000;
if (audioExportOptions.sampleRate>384000) audioExportOptions.sampleRate=384000;
}
if (ImGui::InputInt("Channels in file",&audioExportOptions.chans,1,1)) {
if (audioExportOptions.chans<1) audioExportOptions.chans=1;
if (audioExportOptions.chans>16) audioExportOptions.chans=16;
}
if (ImGui::InputInt("Loops",&audioExportOptions.loops,1,2)) {
if (audioExportOptions.loops<0) audioExportOptions.loops=0;
}
if (ImGui::InputDouble("Fade out (seconds)",&audioExportOptions.fadeOut,1.0,2.0,"%.1f")) {
if (audioExportOptions.fadeOut<0.0) audioExportOptions.fadeOut=0.0;
}
if (onWindow) {
@ -43,14 +64,14 @@ void FurnaceGUI::drawExportAudio(bool onWindow) {
}
if (ImGui::Button("Export",ImVec2(200.0f*dpiScale,0))) {
switch (audioExportType) {
case 0:
switch (audioExportOptions.mode) {
case DIV_EXPORT_MODE_ONE:
openFileDialog(GUI_FILE_EXPORT_AUDIO_ONE);
break;
case 1:
case DIV_EXPORT_MODE_MANY_SYS:
openFileDialog(GUI_FILE_EXPORT_AUDIO_PER_SYS);
break;
case 2:
case DIV_EXPORT_MODE_MANY_CHAN:
openFileDialog(GUI_FILE_EXPORT_AUDIO_PER_CHANNEL);
break;
}

View file

@ -2436,7 +2436,7 @@ int FurnaceGUI::loadStream(String path) {
void FurnaceGUI::exportAudio(String path, DivAudioExportModes mode) {
e->saveAudio(path.c_str(),exportLoops+1,mode,exportFadeOut);
e->saveAudio(path.c_str(),audioExportOptions);
displayExporting=true;
}
@ -6761,10 +6761,10 @@ bool FurnaceGUI::init() {
followOrders=e->getConfBool("followOrders",true);
followPattern=e->getConfBool("followPattern",true);
noteInputPoly=e->getConfBool("noteInputPoly",true);
exportLoops=e->getConfInt("exportLoops",0);
if (exportLoops<0) exportLoops=0;
exportFadeOut=e->getConfDouble("exportFadeOut",0.0);
if (exportFadeOut<0.0) exportFadeOut=0.0;
audioExportOptions.loops=e->getConfInt("exportLoops",0);
if (audioExportOptions.loops<0) audioExportOptions.loops=0;
audioExportOptions.fadeOut=e->getConfDouble("exportFadeOut",0.0);
if (audioExportOptions.fadeOut<0.0) audioExportOptions.fadeOut=0.0;
orderEditMode=e->getConfInt("orderEditMode",0);
if (orderEditMode<0) orderEditMode=0;
if (orderEditMode>3) orderEditMode=3;
@ -6826,8 +6826,8 @@ bool FurnaceGUI::init() {
syncTutorial();
if (!settings.persistFadeOut) {
exportLoops=settings.exportLoops;
exportFadeOut=settings.exportFadeOut;
audioExportOptions.loops=settings.exportLoops;
audioExportOptions.fadeOut=settings.exportFadeOut;
}
for (int i=0; i<settings.maxRecentFile; i++) {
@ -7320,8 +7320,8 @@ void FurnaceGUI::commitState() {
e->setConf("orderEditMode",orderEditMode);
e->setConf("noteInputPoly",noteInputPoly);
if (settings.persistFadeOut) {
e->setConf("exportLoops",exportLoops);
e->setConf("exportFadeOut",exportFadeOut);
e->setConf("exportLoops",audioExportOptions.loops);
e->setConf("exportFadeOut",audioExportOptions.fadeOut);
}
// commit oscilloscope state
@ -7581,7 +7581,6 @@ FurnaceGUI::FurnaceGUI():
oldRow(0),
editStep(1),
editStepCoarse(16),
exportLoops(0),
soloChan(-1),
orderEditMode(0),
orderCursor(-1),
@ -7604,7 +7603,6 @@ FurnaceGUI::FurnaceGUI():
curPaletteChoice(0),
curPaletteType(0),
soloTimeout(0.0f),
exportFadeOut(5.0),
patExtraButtons(false),
patChannelNames(false),
patChannelPairs(true),
@ -7955,7 +7953,6 @@ FurnaceGUI::FurnaceGUI():
introStopped(false),
curTutorial(-1),
curTutorialStep(0),
audioExportType(0),
dmfExportVersion(0),
curExportType(GUI_EXPORT_NONE) {
// value keys

View file

@ -2194,15 +2194,13 @@ class FurnaceGUI {
int pendingLayoutImportStep;
FixedQueue<bool*,64> pendingLayoutImportReopen;
int curIns, curWave, curSample, curOctave, curOrder, playOrder, prevIns, oldRow, editStep, editStepCoarse, exportLoops, soloChan, orderEditMode, orderCursor;
int curIns, curWave, curSample, curOctave, curOrder, playOrder, prevIns, oldRow, editStep, editStepCoarse, soloChan, orderEditMode, orderCursor;
int loopOrder, loopRow, loopEnd, isClipping, newSongCategory, latchTarget;
int wheelX, wheelY, dragSourceX, dragSourceXFine, dragSourceY, dragDestinationX, dragDestinationXFine, dragDestinationY, oldBeat, oldBar;
int curGroove, exitDisabledTimer;
int curPaletteChoice, curPaletteType;
float soloTimeout;
double exportFadeOut;
bool patExtraButtons, patChannelNames, patChannelPairs;
unsigned char patChannelHints;
@ -2603,7 +2601,7 @@ class FurnaceGUI {
ImGuiListClipper csClipper;
// export options
int audioExportType;
DivAudioExportOptions audioExportOptions;
int dmfExportVersion;
FurnaceGUIExportTypes curExportType;

View file

@ -705,13 +705,13 @@ void FurnaceGUI::drawSettings() {
ImGui::BeginDisabled(settings.persistFadeOut);
ImGui::Indent();
if (ImGui::InputInt("Loops",&settings.exportLoops,1,2)) {
if (exportLoops<0) exportLoops=0;
exportLoops=settings.exportLoops;
if (settings.exportLoops<0) settings.exportLoops=0;
audioExportOptions.loops=settings.exportLoops;
settingsChanged=true;
}
if (ImGui::InputDouble("Fade out (seconds)",&settings.exportFadeOut,1.0,2.0,"%.1f")) {
if (exportFadeOut<0.0) exportFadeOut=0.0;
exportFadeOut=settings.exportFadeOut;
if (settings.exportFadeOut<0.0) settings.exportFadeOut=0.0;
audioExportOptions.fadeOut=settings.exportFadeOut;
settingsChanged=true;
}
ImGui::Unindent();