mirror of
https://github.com/tildearrow/furnace.git
synced 2025-01-05 15:11:19 +00:00
add option to change SDL audio driver
This commit is contained in:
parent
ce2661df66
commit
5c97f9981a
4 changed files with 54 additions and 2 deletions
|
@ -4586,6 +4586,15 @@ bool DivEngine::initAudioBackend() {
|
|||
}
|
||||
}
|
||||
|
||||
#ifdef HAVE_SDL2
|
||||
if (audioEngine==DIV_AUDIO_SDL) {
|
||||
String audioDriver=getConfString("sdlAudioDriver","");
|
||||
if (!audioDriver.empty()) {
|
||||
SDL_SetHint("SDL_HINT_AUDIODRIVER",audioDriver.c_str());
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
lowQuality=getConfInt("audioQuality",0);
|
||||
forceMono=getConfInt("forceMono",0);
|
||||
clampSamples=getConfInt("clampSamples",0);
|
||||
|
@ -4594,7 +4603,7 @@ bool DivEngine::initAudioBackend() {
|
|||
midiOutClock=getConfInt("midiOutClock",0);
|
||||
midiOutTime=getConfInt("midiOutTime",0);
|
||||
midiOutTimeRate=getConfInt("midiOutTimeRate",0);
|
||||
midiOutProgramChange = getConfInt("midiOutProgramChange",0);
|
||||
midiOutProgramChange=getConfInt("midiOutProgramChange",0);
|
||||
midiOutMode=getConfInt("midiOutMode",DIV_MIDI_MODE_NOTE);
|
||||
if (metroVol<0.0f) metroVol=0.0f;
|
||||
if (metroVol>2.0f) metroVol=2.0f;
|
||||
|
|
|
@ -6329,6 +6329,19 @@ bool FurnaceGUI::init() {
|
|||
}
|
||||
#endif
|
||||
|
||||
int numDriversA=SDL_GetNumAudioDrivers();
|
||||
if (numDriversA<0) {
|
||||
logW("could not list audio drivers! %s",SDL_GetError());
|
||||
} else {
|
||||
for (int i=0; i<numDriversA; i++) {
|
||||
const char* r=SDL_GetAudioDriver(i);
|
||||
if (r==NULL) continue;
|
||||
if (strcmp(r,"disk")==0) continue;
|
||||
if (strcmp(r,"dummy")==0) continue;
|
||||
availAudioDrivers.push_back(String(r));
|
||||
}
|
||||
}
|
||||
|
||||
int numDrivers=SDL_GetNumRenderDrivers();
|
||||
if (numDrivers<0) {
|
||||
logW("could not list render drivers! %s",SDL_GetError());
|
||||
|
|
|
@ -1304,6 +1304,7 @@ class FurnaceGUI {
|
|||
std::deque<String> recentFile;
|
||||
std::vector<DivInstrumentType> makeInsTypeList;
|
||||
std::vector<String> availRenderDrivers;
|
||||
std::vector<String> availAudioDrivers;
|
||||
|
||||
bool quit, warnQuit, willCommit, edit, modified, displayError, displayExporting, vgmExportLoop, zsmExportLoop, vgmExportPatternHints;
|
||||
bool vgmExportDirectStream, displayInsTypeList;
|
||||
|
@ -1534,6 +1535,7 @@ class FurnaceGUI {
|
|||
String macroRelLabel;
|
||||
String emptyLabel;
|
||||
String emptyLabel2;
|
||||
String sdlAudioDriver;
|
||||
DivConfig initialSys;
|
||||
|
||||
Settings():
|
||||
|
@ -1686,7 +1688,8 @@ class FurnaceGUI {
|
|||
noteRelLabel("==="),
|
||||
macroRelLabel("REL"),
|
||||
emptyLabel("..."),
|
||||
emptyLabel2("..") {}
|
||||
emptyLabel2(".."),
|
||||
sdlAudioDriver("") {}
|
||||
} settings;
|
||||
|
||||
struct Tutorial {
|
||||
|
|
|
@ -807,6 +807,25 @@ void FurnaceGUI::drawSettings() {
|
|||
}
|
||||
#endif
|
||||
|
||||
if (settings.audioEngine==DIV_AUDIO_SDL) {
|
||||
ImGui::Text("Driver");
|
||||
ImGui::SameLine();
|
||||
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();
|
||||
}
|
||||
if (ImGui::IsItemHovered()) {
|
||||
ImGui::SetTooltip("you may need to restart Furnace for this setting to take effect.");
|
||||
}
|
||||
}
|
||||
|
||||
ImGui::Text("Device");
|
||||
ImGui::SameLine();
|
||||
String audioDevName=settings.audioDevice.empty()?"<System default>":settings.audioDevice;
|
||||
|
@ -1324,6 +1343,9 @@ void FurnaceGUI::drawSettings() {
|
|||
#endif
|
||||
ImGui::EndCombo();
|
||||
}
|
||||
if (ImGui::IsItemHovered()) {
|
||||
ImGui::SetTooltip("you may need to restart Furnace for this setting to take effect.");
|
||||
}
|
||||
if (curRenderBackend=="SDL") {
|
||||
if (ImGui::BeginCombo("Render driver",settings.renderDriver.empty()?"Automatic":settings.renderDriver.c_str())) {
|
||||
if (ImGui::Selectable("Automatic",settings.renderDriver.empty())) {
|
||||
|
@ -1336,6 +1358,9 @@ void FurnaceGUI::drawSettings() {
|
|||
}
|
||||
ImGui::EndCombo();
|
||||
}
|
||||
if (ImGui::IsItemHovered()) {
|
||||
ImGui::SetTooltip("you may need to restart Furnace for this setting to take effect.");
|
||||
}
|
||||
}
|
||||
|
||||
bool dpiScaleAuto=(settings.dpiScale<0.5f);
|
||||
|
@ -2638,6 +2663,7 @@ void FurnaceGUI::syncSettings() {
|
|||
settings.midiOutDevice=e->getConfString("midiOutDevice","");
|
||||
settings.c163Name=e->getConfString("c163Name",DIV_C163_DEFAULT_NAME);
|
||||
settings.renderDriver=e->getConfString("renderDriver","");
|
||||
settings.sdlAudioDriver=e->getConfString("sdlAudioDriver","");
|
||||
settings.audioQuality=e->getConfInt("audioQuality",0);
|
||||
settings.audioBufSize=e->getConfInt("audioBufSize",1024);
|
||||
settings.audioRate=e->getConfInt("audioRate",44100);
|
||||
|
@ -2986,6 +3012,7 @@ void FurnaceGUI::commitSettings() {
|
|||
e->setConf("midiOutDevice",settings.midiOutDevice);
|
||||
e->setConf("c163Name",settings.c163Name);
|
||||
e->setConf("renderDriver",settings.renderDriver);
|
||||
e->setConf("sdlAudioDriver",settings.sdlAudioDriver);
|
||||
e->setConf("audioQuality",settings.audioQuality);
|
||||
e->setConf("audioBufSize",settings.audioBufSize);
|
||||
e->setConf("audioRate",settings.audioRate);
|
||||
|
|
Loading…
Reference in a new issue