Qt: Add sample rate option to settings
Jeffrey Pfau jeffrey@endrift.com
Sun, 09 Aug 2015 21:54:50 -0700
3 files changed,
84 insertions(+),
21 deletions(-)
M
src/platform/qt/SettingsView.cpp
→
src/platform/qt/SettingsView.cpp
@@ -22,6 +22,7 @@ loadSetting("bios", m_ui.bios);
loadSetting("useBios", m_ui.useBios); loadSetting("skipBios", m_ui.skipBios); loadSetting("audioBuffers", m_ui.audioBufferSize); + loadSetting("sampleRate", m_ui.sampleRate); loadSetting("videoSync", m_ui.videoSync); loadSetting("audioSync", m_ui.audioSync); loadSetting("frameskip", m_ui.frameskip);@@ -102,6 +103,7 @@ saveSetting("bios", m_ui.bios);
saveSetting("useBios", m_ui.useBios); saveSetting("skipBios", m_ui.skipBios); saveSetting("audioBuffers", m_ui.audioBufferSize); + saveSetting("sampleRate", m_ui.sampleRate); saveSetting("videoSync", m_ui.videoSync); saveSetting("audioSync", m_ui.audioSync); saveSetting("frameskip", m_ui.frameskip);
M
src/platform/qt/SettingsView.ui
→
src/platform/qt/SettingsView.ui
@@ -114,13 +114,20 @@ </item>
</layout> </item> <item row="2" column="0"> + <widget class="QLabel" name="label_19"> + <property name="text"> + <string>Sample rate:</string> + </property> + </widget> + </item> + <item row="3" column="0"> <widget class="QLabel" name="label_17"> <property name="text"> <string>Volume:</string> </property> </widget> </item> - <item row="2" column="1"> + <item row="3" column="1"> <layout class="QHBoxLayout" name="horizontalLayout_6"> <item> <widget class="QSlider" name="volume">@@ -147,28 +154,38 @@ </widget>
</item> </layout> </item> - <item row="3" column="0" colspan="2"> + <item row="4" column="0" colspan="2"> <widget class="Line" name="line"> <property name="orientation"> <enum>Qt::Horizontal</enum> </property> </widget> </item> - <item row="4" column="0"> + <item row="5" column="0"> <widget class="QLabel" name="label_10"> <property name="text"> <string>Display driver:</string> </property> </widget> </item> - <item row="5" column="0"> + <item row="5" column="1"> + <widget class="QComboBox" name="displayDriver"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Expanding" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + </widget> + </item> + <item row="6" column="0"> <widget class="QLabel" name="label_9"> <property name="text"> <string>Frameskip:</string> </property> </widget> </item> - <item row="5" column="1"> + <item row="6" column="1"> <layout class="QHBoxLayout" name="horizontalLayout_16"> <item> <widget class="QLabel" name="label_12">@@ -189,14 +206,14 @@ </widget>
</item> </layout> </item> - <item row="6" column="0"> + <item row="7" column="0"> <widget class="QLabel" name="label_3"> <property name="text"> <string>FPS target:</string> </property> </widget> </item> - <item row="6" column="1"> + <item row="7" column="1"> <layout class="QHBoxLayout" name="horizontalLayout_2"> <item> <widget class="QDoubleSpinBox" name="fpsTarget">@@ -220,21 +237,21 @@ </widget>
</item> </layout> </item> - <item row="7" column="0" colspan="2"> + <item row="8" column="0" colspan="2"> <widget class="Line" name="line_4"> <property name="orientation"> <enum>Qt::Horizontal</enum> </property> </widget> </item> - <item row="8" column="0"> + <item row="9" column="0"> <widget class="QLabel" name="label_2"> <property name="text"> <string>Sync:</string> </property> </widget> </item> - <item row="8" column="1"> + <item row="9" column="1"> <layout class="QHBoxLayout" name="horizontalLayout_10"> <item> <widget class="QCheckBox" name="videoSync">@@ -252,29 +269,63 @@ </widget>
</item> </layout> </item> - <item row="9" column="1"> + <item row="10" column="1"> <widget class="QCheckBox" name="lockAspectRatio"> <property name="text"> <string>Lock aspect ratio</string> </property> </widget> </item> - <item row="10" column="1"> + <item row="11" column="1"> <widget class="QCheckBox" name="resampleVideo"> <property name="text"> <string>Resample video</string> </property> </widget> </item> - <item row="4" column="1"> - <widget class="QComboBox" name="displayDriver"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Expanding" vsizetype="Fixed"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - </widget> + <item row="2" column="1"> + <layout class="QHBoxLayout" name="horizontalLayout_14"> + <item> + <widget class="QComboBox" name="sampleRate"> + <property name="editable"> + <bool>true</bool> + </property> + <property name="currentText"> + <string>44100</string> + </property> + <property name="currentIndex"> + <number>2</number> + </property> + <item> + <property name="text"> + <string>22050</string> + </property> + </item> + <item> + <property name="text"> + <string>32000</string> + </property> + </item> + <item> + <property name="text"> + <string>44100</string> + </property> + </item> + <item> + <property name="text"> + <string>48000</string> + </property> + </item> + </widget> + </item> + <item> + <widget class="QLabel" name="label_20"> + <property name="text"> + <string>Hz</string> + </property> + </widget> + </item> + </layout> </item> </layout> </item>
M
src/platform/qt/Window.cpp
→
src/platform/qt/Window.cpp
@@ -1122,6 +1122,16 @@ skipBios->connect([this](const QVariant& value) {
m_controller->setSkipBIOS(value.toBool()); }, this); + ConfigOption* buffers = m_config->addOption("audioBuffers"); + buffers->connect([this](const QVariant& value) { + emit audioBufferSamplesChanged(value.toInt()); + }, this); + + ConfigOption* sampleRate = m_config->addOption("sampleRate"); + sampleRate->connect([this](const QVariant& value) { + emit sampleRateChanged(value.toUInt()); + }, this); + ConfigOption* volume = m_config->addOption("volume"); volume->connect([this](const QVariant& value) { m_controller->setVolume(value.toInt());