aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStapleButter <thetotalworm@gmail.com>2018-12-14 04:09:51 +0100
committerStapleButter <thetotalworm@gmail.com>2018-12-14 04:09:51 +0100
commitfd54abd90069705df99a6541f579ecb181ed6fe3 (patch)
treefd513f642cbb10e403c17b66a0c17b135a032e4d
parenta64e59bf9903ededa4492f2499991bb0e22a94ca (diff)
add dialog for audio settings, flesh it out
not functional yet tho
-rw-r--r--CMakeLists.txt1
-rw-r--r--melonDS.cbp2
-rw-r--r--src/libui_sdl/DlgAudioSettings.cpp142
-rw-r--r--src/libui_sdl/DlgAudioSettings.h29
-rw-r--r--src/libui_sdl/main.cpp22
5 files changed, 190 insertions, 6 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 718287a..4a6dc6c 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -8,6 +8,7 @@ PROJECT(${PROJECT_WX})
SET(SOURCES
src/libui_sdl/main.cpp
src/libui_sdl/Platform.cpp
+ src/libui_sdl/DlgAudioSettings.cpp
src/libui_sdl/DlgEmuSettings.cpp
src/libui_sdl/DlgInputConfig.cpp
src/ARM.cpp
diff --git a/melonDS.cbp b/melonDS.cbp
index 8831c70..3829187 100644
--- a/melonDS.cbp
+++ b/melonDS.cbp
@@ -144,6 +144,8 @@
<Unit filename="src/Wifi.h" />
<Unit filename="src/WifiAP.cpp" />
<Unit filename="src/WifiAP.h" />
+ <Unit filename="src/libui_sdl/DlgAudioSettings.cpp" />
+ <Unit filename="src/libui_sdl/DlgAudioSettings.h" />
<Unit filename="src/libui_sdl/DlgEmuSettings.cpp" />
<Unit filename="src/libui_sdl/DlgEmuSettings.h" />
<Unit filename="src/libui_sdl/DlgInputConfig.cpp" />
diff --git a/src/libui_sdl/DlgAudioSettings.cpp b/src/libui_sdl/DlgAudioSettings.cpp
new file mode 100644
index 0000000..cb16188
--- /dev/null
+++ b/src/libui_sdl/DlgAudioSettings.cpp
@@ -0,0 +1,142 @@
+/*
+ Copyright 2016-2019 StapleButter
+
+ This file is part of melonDS.
+
+ melonDS is free software: you can redistribute it and/or modify it under
+ the terms of the GNU General Public License as published by the Free
+ Software Foundation, either version 3 of the License, or (at your option)
+ any later version.
+
+ melonDS is distributed in the hope that it will be useful, but WITHOUT ANY
+ WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License along
+ with melonDS. If not, see http://www.gnu.org/licenses/.
+*/
+
+#include <stdlib.h>
+#include <stdio.h>
+
+#include "libui/ui.h"
+
+#include "../types.h"
+#include "../Config.h"
+
+#include "DlgAudioSettings.h"
+
+
+namespace DlgAudioSettings
+{
+
+bool opened;
+uiWindow* win;
+
+//
+
+
+int OnCloseWindow(uiWindow* window, void* blarg)
+{
+ opened = false;
+ return 1;
+}
+
+void OnCancel(uiButton* btn, void* blarg)
+{
+ uiControlDestroy(uiControl(win));
+ opened = false;
+}
+
+void OnOk(uiButton* btn, void* blarg)
+{
+ /*Config::DirectBoot = uiCheckboxChecked(cbDirectBoot);
+ Config::Threaded3D = uiCheckboxChecked(cbThreaded3D);
+ Config::SocketBindAnyAddr = uiCheckboxChecked(cbBindAnyAddr);*/
+
+ Config::Save();
+
+ uiControlDestroy(uiControl(win));
+ opened = false;
+}
+
+void Open()
+{
+ if (opened)
+ {
+ uiControlSetFocus(uiControl(win));
+ return;
+ }
+
+ opened = true;
+ win = uiNewWindow("Audio settings - melonDS", 400, 100, 0, 0);
+ uiWindowSetMargined(win, 1);
+ uiWindowOnClosing(win, OnCloseWindow, NULL);
+
+ uiBox* top = uiNewVerticalBox();
+ uiWindowSetChild(win, uiControl(top));
+ uiBoxSetPadded(top, 1);
+
+ {
+ uiGroup* grp = uiNewGroup("Audio output");
+ uiBoxAppend(top, uiControl(grp), 0);
+ uiGroupSetMargined(grp, 1);
+
+ uiBox* in_ctrl = uiNewVerticalBox();
+ uiGroupSetChild(grp, uiControl(in_ctrl));
+
+ uiLabel* label_vol = uiNewLabel("Volume:");
+ uiBoxAppend(in_ctrl, uiControl(label_vol), 0);
+
+ uiSlider* volslider = uiNewSlider(0, 255);
+ uiBoxAppend(in_ctrl, uiControl(volslider), 0);
+ }
+
+ {
+ uiGroup* grp = uiNewGroup("Microphone input");
+ uiBoxAppend(top, uiControl(grp), 0);
+ uiGroupSetMargined(grp, 1);
+
+ uiBox* in_ctrl = uiNewVerticalBox();
+ uiGroupSetChild(grp, uiControl(in_ctrl));
+
+ uiRadioButtons* mictypes = uiNewRadioButtons();
+ uiRadioButtonsAppend(mictypes, "None");
+ uiRadioButtonsAppend(mictypes, "Microphone");
+ uiRadioButtonsAppend(mictypes, "White noise");
+ uiRadioButtonsAppend(mictypes, "WAV file:");
+ uiBoxAppend(in_ctrl, uiControl(mictypes), 0);
+
+ uiBox* path_box = uiNewHorizontalBox();
+ uiBoxAppend(in_ctrl, uiControl(path_box), 0);
+
+ uiEntry* path_entry = uiNewEntry();
+ uiBoxAppend(path_box, uiControl(path_entry), 1);
+
+ uiButton* path_browse = uiNewButton("...");
+ uiBoxAppend(path_box, uiControl(path_browse), 0);
+ }
+
+ {
+ uiBox* in_ctrl = uiNewHorizontalBox();
+ uiBoxSetPadded(in_ctrl, 1);
+ uiBoxAppend(top, uiControl(in_ctrl), 0);
+
+ uiLabel* dummy = uiNewLabel("");
+ uiBoxAppend(in_ctrl, uiControl(dummy), 1);
+
+ uiButton* btncancel = uiNewButton("Cancel");
+ uiButtonOnClicked(btncancel, OnCancel, NULL);
+ uiBoxAppend(in_ctrl, uiControl(btncancel), 0);
+
+ uiButton* btnok = uiNewButton("Ok");
+ uiButtonOnClicked(btnok, OnOk, NULL);
+ uiBoxAppend(in_ctrl, uiControl(btnok), 0);
+ }
+
+ // shit
+
+ uiControlShow(uiControl(win));
+}
+
+}
diff --git a/src/libui_sdl/DlgAudioSettings.h b/src/libui_sdl/DlgAudioSettings.h
new file mode 100644
index 0000000..2333967
--- /dev/null
+++ b/src/libui_sdl/DlgAudioSettings.h
@@ -0,0 +1,29 @@
+/*
+ Copyright 2016-2019 StapleButter
+
+ This file is part of melonDS.
+
+ melonDS is free software: you can redistribute it and/or modify it under
+ the terms of the GNU General Public License as published by the Free
+ Software Foundation, either version 3 of the License, or (at your option)
+ any later version.
+
+ melonDS is distributed in the hope that it will be useful, but WITHOUT ANY
+ WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License along
+ with melonDS. If not, see http://www.gnu.org/licenses/.
+*/
+
+#ifndef DLGAUDIOSETTINGS_H
+#define DLGAUDIOSETTINGS_H
+
+namespace DlgAudioSettings
+{
+
+void Open();
+
+}
+
+#endif // DLGAUDIOSETTINGS_H
diff --git a/src/libui_sdl/main.cpp b/src/libui_sdl/main.cpp
index 0f202fa..f58ea5f 100644
--- a/src/libui_sdl/main.cpp
+++ b/src/libui_sdl/main.cpp
@@ -31,6 +31,7 @@
#include "DlgEmuSettings.h"
#include "DlgInputConfig.h"
+#include "DlgAudioSettings.h"
#include "../NDS.h"
#include "../GPU.h"
@@ -1350,6 +1351,11 @@ void OnOpenHotkeyConfig(uiMenuItem* item, uiWindow* window, void* blarg)
DlgInputConfig::Open(1);
}
+void OnOpenAudioSettings(uiMenuItem* item, uiWindow* window, void* blarg)
+{
+ DlgAudioSettings::Open();
+}
+
void OnSetSavestateSRAMReloc(uiMenuItem* item, uiWindow* window, void* param)
{
@@ -1615,12 +1621,16 @@ int main(int argc, char** argv)
MenuItem_Stop = menuitem;
menu = uiNewMenu("Config");
- menuitem = uiMenuAppendItem(menu, "Emu settings");
- uiMenuItemOnClicked(menuitem, OnOpenEmuSettings, NULL);
- menuitem = uiMenuAppendItem(menu, "Input config");
- uiMenuItemOnClicked(menuitem, OnOpenInputConfig, NULL);
- menuitem = uiMenuAppendItem(menu, "Hotkey config");
- uiMenuItemOnClicked(menuitem, OnOpenHotkeyConfig, NULL);
+ {
+ menuitem = uiMenuAppendItem(menu, "Emu settings");
+ uiMenuItemOnClicked(menuitem, OnOpenEmuSettings, NULL);
+ menuitem = uiMenuAppendItem(menu, "Input config");
+ uiMenuItemOnClicked(menuitem, OnOpenInputConfig, NULL);
+ menuitem = uiMenuAppendItem(menu, "Hotkey config");
+ uiMenuItemOnClicked(menuitem, OnOpenHotkeyConfig, NULL);
+ menuitem = uiMenuAppendItem(menu, "Audio settings");
+ uiMenuItemOnClicked(menuitem, OnOpenAudioSettings, NULL);
+ }
uiMenuAppendSeparator(menu);
{
uiMenu* submenu = uiNewMenu("Savestate settings");