This commit is contained in:
Eknous-P 2023-08-26 14:03:34 +04:00
parent b993d4b58d
commit eef3dacc78

View file

@ -724,119 +724,119 @@ void FurnaceGUI::drawSettings() {
ImGui::TableSetupColumn("##Label",ImGuiTableColumnFlags_WidthFixed); ImGui::TableSetupColumn("##Label",ImGuiTableColumnFlags_WidthFixed);
ImGui::TableSetupColumn("##Combo",ImGuiTableColumnFlags_WidthStretch); ImGui::TableSetupColumn("##Combo",ImGuiTableColumnFlags_WidthStretch);
#ifdef HAVE_JACK #ifdef HAVE_JACK
ImGui::TableNextRow(); ImGui::TableNextRow();
ImGui::TableNextColumn(); ImGui::TableNextColumn();
ImGui::AlignTextToFramePadding(); ImGui::AlignTextToFramePadding();
ImGui::Text("Backend"); ImGui::Text("Backend");
ImGui::TableNextColumn(); ImGui::TableNextColumn();
int prevAudioEngine=settings.audioEngine; int prevAudioEngine=settings.audioEngine;
if (ImGui::Combo("##Backend",&settings.audioEngine,audioBackends,2)) { if (ImGui::Combo("##Backend",&settings.audioEngine,audioBackends,2)) {
if (settings.audioEngine!=prevAudioEngine) { if (settings.audioEngine!=prevAudioEngine) {
if (!isProAudio[settings.audioEngine]) settings.audioChans=2; if (!isProAudio[settings.audioEngine]) settings.audioChans=2;
}
} }
}
#endif #endif
ImGui::TableNextRow(); ImGui::TableNextRow();
ImGui::TableNextColumn();
if (settings.audioEngine==DIV_AUDIO_SDL) {
ImGui::AlignTextToFramePadding();
ImGui::Text("Driver");
ImGui::TableNextColumn(); ImGui::TableNextColumn();
if (ImGui::BeginCombo("##SDLADriver",settings.sdlAudioDriver.empty()?"Automatic":settings.sdlAudioDriver.c_str())) { if (settings.audioEngine==DIV_AUDIO_SDL) {
if (ImGui::Selectable("Automatic",settings.sdlAudioDriver.empty())) { ImGui::AlignTextToFramePadding();
settings.sdlAudioDriver=""; ImGui::Text("Driver");
ImGui::TableNextColumn();
if (ImGui::BeginCombo("##SDLADriver",settings.sdlAudioDriver.empty()?"Automatic":settings.sdlAudioDriver.c_str())) {
if (ImGui::Selectable("Automatic",settings.sdlAudioDriver.empty())) {
settings.sdlAudioDriver="";
}
for (String& i: availAudioDrivers) {
if (ImGui::Selectable(i.c_str(),i==settings.sdlAudioDriver)) {
settings.sdlAudioDriver=i;
}
}
ImGui::EndCombo();
} }
for (String& i: availAudioDrivers) { if (ImGui::IsItemHovered()) {
if (ImGui::Selectable(i.c_str(),i==settings.sdlAudioDriver)) { ImGui::SetTooltip("you may need to restart Furnace for this setting to take effect.");
settings.sdlAudioDriver=i; }
}
ImGui::TableNextRow();
ImGui::TableNextColumn();
ImGui::AlignTextToFramePadding();
ImGui::Text("Device");
ImGui::TableNextColumn();
String audioDevName=settings.audioDevice.empty()?"<System default>":settings.audioDevice;
if (ImGui::BeginCombo("##AudioDevice",audioDevName.c_str())) {
if (ImGui::Selectable("<System default>",settings.audioDevice.empty())) {
settings.audioDevice="";
}
for (String& i: e->getAudioDevices()) {
if (ImGui::Selectable(i.c_str(),i==settings.audioDevice)) {
settings.audioDevice=i;
} }
} }
ImGui::EndCombo(); ImGui::EndCombo();
} }
if (ImGui::IsItemHovered()) {
ImGui::SetTooltip("you may need to restart Furnace for this setting to take effect."); ImGui::TableNextRow();
}
}
ImGui::TableNextRow();
ImGui::TableNextColumn();
ImGui::AlignTextToFramePadding();
ImGui::Text("Device");
ImGui::TableNextColumn();
String audioDevName=settings.audioDevice.empty()?"<System default>":settings.audioDevice;
if (ImGui::BeginCombo("##AudioDevice",audioDevName.c_str())) {
if (ImGui::Selectable("<System default>",settings.audioDevice.empty())) {
settings.audioDevice="";
}
for (String& i: e->getAudioDevices()) {
if (ImGui::Selectable(i.c_str(),i==settings.audioDevice)) {
settings.audioDevice=i;
}
}
ImGui::EndCombo();
}
ImGui::TableNextRow();
ImGui::TableNextColumn();
ImGui::AlignTextToFramePadding();
ImGui::Text("Sample rate");
ImGui::TableNextColumn();
String sr=fmt::sprintf("%d",settings.audioRate);
if (ImGui::BeginCombo("##SampleRate",sr.c_str())) {
SAMPLE_RATE_SELECTABLE(8000);
SAMPLE_RATE_SELECTABLE(16000);
SAMPLE_RATE_SELECTABLE(22050);
SAMPLE_RATE_SELECTABLE(32000);
SAMPLE_RATE_SELECTABLE(44100);
SAMPLE_RATE_SELECTABLE(48000);
SAMPLE_RATE_SELECTABLE(88200);
SAMPLE_RATE_SELECTABLE(96000);
SAMPLE_RATE_SELECTABLE(192000);
ImGui::EndCombo();
}
ImGui::TableNextRow();
ImGui::TableNextColumn();
if (isProAudio[settings.audioEngine]) {
ImGui::AlignTextToFramePadding();
ImGui::Text("Outputs");
ImGui::TableNextColumn(); ImGui::TableNextColumn();
if (ImGui::InputInt("##AudioChansI",&settings.audioChans,1,1)) {
if (settings.audioChans<1) settings.audioChans=1;
if (settings.audioChans>16) settings.audioChans=16;
}
} else {
ImGui::AlignTextToFramePadding(); ImGui::AlignTextToFramePadding();
ImGui::Text("Channels"); ImGui::Text("Sample rate");
ImGui::TableNextColumn(); ImGui::TableNextColumn();
String chStr=(settings.audioChans<1 || settings.audioChans>8)?"What?":nonProAudioOuts[settings.audioChans-1]; String sr=fmt::sprintf("%d",settings.audioRate);
if (ImGui::BeginCombo("##AudioChans",chStr.c_str())) { if (ImGui::BeginCombo("##SampleRate",sr.c_str())) {
CHANS_SELECTABLE(1); SAMPLE_RATE_SELECTABLE(8000);
CHANS_SELECTABLE(2); SAMPLE_RATE_SELECTABLE(16000);
CHANS_SELECTABLE(4); SAMPLE_RATE_SELECTABLE(22050);
CHANS_SELECTABLE(6); SAMPLE_RATE_SELECTABLE(32000);
CHANS_SELECTABLE(8); SAMPLE_RATE_SELECTABLE(44100);
SAMPLE_RATE_SELECTABLE(48000);
SAMPLE_RATE_SELECTABLE(88200);
SAMPLE_RATE_SELECTABLE(96000);
SAMPLE_RATE_SELECTABLE(192000);
ImGui::EndCombo(); ImGui::EndCombo();
} }
}
ImGui::TableNextRow();
ImGui::TableNextRow(); ImGui::TableNextColumn();
ImGui::TableNextColumn(); if (isProAudio[settings.audioEngine]) {
ImGui::AlignTextToFramePadding(); ImGui::AlignTextToFramePadding();
ImGui::Text("Buffer size"); ImGui::Text("Outputs");
ImGui::TableNextColumn(); ImGui::TableNextColumn();
String bs=fmt::sprintf("%d (latency: ~%.1fms)",settings.audioBufSize,2000.0*(double)settings.audioBufSize/(double)MAX(1,settings.audioRate)); if (ImGui::InputInt("##AudioChansI",&settings.audioChans,1,1)) {
if (ImGui::BeginCombo("##BufferSize",bs.c_str())) { if (settings.audioChans<1) settings.audioChans=1;
BUFFER_SIZE_SELECTABLE(64); if (settings.audioChans>16) settings.audioChans=16;
BUFFER_SIZE_SELECTABLE(128); }
BUFFER_SIZE_SELECTABLE(256); } else {
BUFFER_SIZE_SELECTABLE(512); ImGui::AlignTextToFramePadding();
BUFFER_SIZE_SELECTABLE(1024); ImGui::Text("Channels");
BUFFER_SIZE_SELECTABLE(2048); ImGui::TableNextColumn();
ImGui::EndCombo(); String chStr=(settings.audioChans<1 || settings.audioChans>8)?"What?":nonProAudioOuts[settings.audioChans-1];
} if (ImGui::BeginCombo("##AudioChans",chStr.c_str())) {
ImGui::EndTable(); CHANS_SELECTABLE(1);
CHANS_SELECTABLE(2);
CHANS_SELECTABLE(4);
CHANS_SELECTABLE(6);
CHANS_SELECTABLE(8);
ImGui::EndCombo();
}
}
ImGui::TableNextRow();
ImGui::TableNextColumn();
ImGui::AlignTextToFramePadding();
ImGui::Text("Buffer size");
ImGui::TableNextColumn();
String bs=fmt::sprintf("%d (latency: ~%.1fms)",settings.audioBufSize,2000.0*(double)settings.audioBufSize/(double)MAX(1,settings.audioRate));
if (ImGui::BeginCombo("##BufferSize",bs.c_str())) {
BUFFER_SIZE_SELECTABLE(64);
BUFFER_SIZE_SELECTABLE(128);
BUFFER_SIZE_SELECTABLE(256);
BUFFER_SIZE_SELECTABLE(512);
BUFFER_SIZE_SELECTABLE(1024);
BUFFER_SIZE_SELECTABLE(2048);
ImGui::EndCombo();
}
ImGui::EndTable();
} }
bool lowLatencyB=settings.lowLatency; bool lowLatencyB=settings.lowLatency;