* Use enum class instead of enum (except for the enums for the resource IDs, not really necessary there).
* For NCSF specifically, included a function to convert an enum class to its underlying integral type (as this is needed for use with the std::bitset class).
* Cleanup headers so all the ones needed in a file are explicitly included even if they may possibly be included in another header.
* Used forward declarations in a few spots.
* Explicitly namespaced all (u)int*_t uses (this might seem like overkill, but it helps me see when the standard types are being used with a simple search for std::).
* Made sure it all builds with MinGW-w64 as well (both gcc and clang).
* Removed some std::move from DialogBuilder.cpp based on clang's warnings for that.
* Replaced use of std::copy_n on strings in DialogBuilder.cpp with my CopyToString functions that use wcscpy.
* Replaced CHAR_MIN/CHAR_MAX in eqstr.h and ltstr.h with std::numeric_limits<char>::min/max().
| ... | ... |
@@ -9,6 +9,11 @@ |
| 9 | 9 |
* snes9x. |
| 10 | 10 |
*/ |
| 11 | 11 |
|
| 12 |
+#include <bitset> |
|
| 13 |
+#include <sstream> |
|
| 14 |
+#include <string> |
|
| 15 |
+#include <cstdint> |
|
| 16 |
+#include "windowsh_wrapper.h" |
|
| 12 | 17 |
#include "XSFConfig_SNSF.h" |
| 13 | 18 |
#include "convert.h" |
| 14 | 19 |
#include "snes9x/apu/apu.h" |
| ... | ... |
@@ -68,15 +73,15 @@ void XSFConfig_SNSF::SaveSpecificConfig() |
| 68 | 73 |
|
| 69 | 74 |
void XSFConfig_SNSF::GenerateSpecificDialogs() |
| 70 | 75 |
{
|
| 71 |
- /*this->configDialog.AddCheckBoxControl(DialogCheckBoxBuilder(L"Sixteen-Bit Sound").WithSize(80, 10).InGroup(L"Output").WithRelativePositionToSibling(RelativePosition::FROM_BOTTOMLEFT, Point<short>(0, 7), 2).WithTabStop(). |
|
| 76 |
+ /*this->configDialog.AddCheckBoxControl(DialogCheckBoxBuilder(L"Sixteen-Bit Sound").WithSize(80, 10).InGroup(L"Output").WithRelativePositionToSibling(RelativePosition::PositionType::FromBottomLeft, Point<short>(0, 7), 2).WithTabStop(). |
|
| 72 | 77 |
WithID(idSixteenBitSound));*/ |
| 73 |
- this->configDialog.AddCheckBoxControl(DialogCheckBoxBuilder(L"Reverse Stereo").WithSize(80, 10).InGroup(L"Output").WithRelativePositionToSibling(RelativePosition::FROM_BOTTOMLEFT, Point<short>(0, 7), 2).WithTabStop(). |
|
| 78 |
+ this->configDialog.AddCheckBoxControl(DialogCheckBoxBuilder(L"Reverse Stereo").WithSize(80, 10).InGroup(L"Output").WithRelativePositionToSibling(RelativePosition::PositionType::FromBottomLeft, Point<short>(0, 7), 2).WithTabStop(). |
|
| 74 | 79 |
WithID(idReverseStereo)); |
| 75 |
- this->configDialog.AddLabelControl(DialogLabelBuilder(L"Resampler").WithSize(50, 8).InGroup(L"Output").WithRelativePositionToSibling(RelativePosition::FROM_BOTTOMLEFT, Point<short>(0, 10)).IsLeftJustified()); |
|
| 76 |
- this->configDialog.AddComboBoxControl(DialogComboBoxBuilder().WithSize(78, 14).InGroup(L"Output").WithRelativePositionToSibling(RelativePosition::FROM_TOPRIGHT, Point<short>(5, -3)).WithTabStop().IsDropDownList(). |
|
| 80 |
+ this->configDialog.AddLabelControl(DialogLabelBuilder(L"Resampler").WithSize(50, 8).InGroup(L"Output").WithRelativePositionToSibling(RelativePosition::PositionType::FromBottomLeft, Point<short>(0, 10)).IsLeftJustified()); |
|
| 81 |
+ this->configDialog.AddComboBoxControl(DialogComboBoxBuilder().WithSize(78, 14).InGroup(L"Output").WithRelativePositionToSibling(RelativePosition::PositionType::FromTopRight, Point<short>(5, -3)).WithTabStop().IsDropDownList(). |
|
| 77 | 82 |
WithID(idResampler)); |
| 78 |
- this->configDialog.AddLabelControl(DialogLabelBuilder(L"Mute").WithSize(50, 8).InGroup(L"Output").WithRelativePositionToSibling(RelativePosition::FROM_BOTTOMLEFT, Point<short>(0, 10), 2).IsLeftJustified()); |
|
| 79 |
- this->configDialog.AddListBoxControl(DialogListBoxBuilder().WithSize(78, 45).WithExactHeight().InGroup(L"Output").WithRelativePositionToSibling(RelativePosition::FROM_TOPRIGHT, Point<short>(5, -3)).WithID(idMutes).WithBorder(). |
|
| 83 |
+ this->configDialog.AddLabelControl(DialogLabelBuilder(L"Mute").WithSize(50, 8).InGroup(L"Output").WithRelativePositionToSibling(RelativePosition::PositionType::FromBottomLeft, Point<short>(0, 10), 2).IsLeftJustified()); |
|
| 84 |
+ this->configDialog.AddListBoxControl(DialogListBoxBuilder().WithSize(78, 45).WithExactHeight().InGroup(L"Output").WithRelativePositionToSibling(RelativePosition::PositionType::FromTopRight, Point<short>(5, -3)).WithID(idMutes).WithBorder(). |
|
| 80 | 85 |
WithVerticalScrollbar().WithMultipleSelect().WithTabStop()); |
| 81 | 86 |
} |
| 82 | 87 |
|
| ... | ... |
@@ -140,7 +145,7 @@ void XSFConfig_SNSF::CopySpecificConfigToMemory(XSFPlayer *, bool preLoad) |
| 140 | 145 |
Settings.ReverseStereo = this->reverseStereo; |
| 141 | 146 |
} |
| 142 | 147 |
else |
| 143 |
- S9xSetSoundControl(static_cast<uint8_t>(this->mutes.to_ulong()) ^ 0xFF); |
|
| 148 |
+ S9xSetSoundControl(static_cast<std::uint8_t>(this->mutes.to_ulong()) ^ 0xFF); |
|
| 144 | 149 |
} |
| 145 | 150 |
|
| 146 | 151 |
void XSFConfig_SNSF::About(HWND parent) |
* Replace the (w)stringify functions with the standard std::to_(w)string functions.
* Replace convertTo with versions that use type_traits to determine which standard string conversion function to call, as well as handle enums specically.
| ... | ... |
@@ -101,7 +101,7 @@ INT_PTR CALLBACK XSFConfig_SNSF::ConfigDialogProc(HWND hwndDlg, UINT uMsg, WPARA |
| 101 | 101 |
// Mutes |
| 102 | 102 |
for (int x = 0, numMutes = this->mutes.size(); x < numMutes; ++x) |
| 103 | 103 |
{
|
| 104 |
- SendMessageW(GetDlgItem(hwndDlg, idMutes), LB_ADDSTRING, 0, reinterpret_cast<LPARAM>((L"BRRPCM " + wstringify(x + 1)).c_str())); |
|
| 104 |
+ SendMessageW(GetDlgItem(hwndDlg, idMutes), LB_ADDSTRING, 0, reinterpret_cast<LPARAM>((L"BRRPCM " + std::to_wstring(x + 1)).c_str())); |
|
| 105 | 105 |
SendMessageW(GetDlgItem(hwndDlg, idMutes), LB_SETSEL, this->mutes[x], x); |
| 106 | 106 |
} |
| 107 | 107 |
break; |
(I never remember to update these and besides, GitHub history can show when they were last modified.)
* Removed my custom String class, as well as removed the really old
Unicode ConvertUTF, the UTF Converter, and the UTF Encode/Decode
functions.
* Replaced the above with using standard C++ std::wstring_convert and
std::codecvt_utf8.
* Added headers adapted from llvm's libc++ project for allowing the
above C++ classes to exist with GCC and Clang when libc++ isn't being
used.
* Used std::string over std::wstring whenever possible.
* Added header adapted from llvm's libc++ project to create special
versions of the ifstream and ofstream classes that would utilize _wfopen
on non-MSVC Windows compilers, so those compilers could access files on
Windows that use characters outside the current codepage.
* Removed the -static-libgcc and -static-libstdc++ flags from the
Makefile for non-MSVC builds. The generated DLLs will require extra DLLs
from either Cygwin or MinGW (whichever is used to compile), I've only
tested with MinGW and for some reason they crash Winamp on exit, I have
no idea why.
| ... | ... |
@@ -1,7 +1,7 @@ |
| 1 | 1 |
/* |
| 2 | 2 |
* xSF - SNSF configuration |
| 3 | 3 |
* By Naram Qashat (CyberBotX) [cyberbotx@cyberbotx.com] |
| 4 |
- * Last modification on 2014-09-17 |
|
| 4 |
+ * Last modification on 2014-09-24 |
|
| 5 | 5 |
* |
| 6 | 6 |
* Partially based on the vio*sf framework |
| 7 | 7 |
* |
| ... | ... |
@@ -12,7 +12,6 @@ |
| 12 | 12 |
|
| 13 | 13 |
#include "XSFConfig_SNSF.h" |
| 14 | 14 |
#include "convert.h" |
| 15 |
-#include "BigSString.h" |
|
| 16 | 15 |
#include "snes9x/apu/apu.h" |
| 17 | 16 |
|
| 18 | 17 |
enum |
| ... | ... |
@@ -24,12 +23,12 @@ enum |
| 24 | 23 |
}; |
| 25 | 24 |
|
| 26 | 25 |
unsigned XSFConfig::initSampleRate = 44100; |
| 27 |
-std::wstring XSFConfig::commonName = L"SNSF Decoder"; |
|
| 28 |
-std::wstring XSFConfig::versionNumber = L"0.9b"; |
|
| 26 |
+std::string XSFConfig::commonName = "SNSF Decoder"; |
|
| 27 |
+std::string XSFConfig::versionNumber = "0.9b"; |
|
| 29 | 28 |
//bool XSFConfig_SNSF::initSixteenBitSound = true; |
| 30 | 29 |
bool XSFConfig_SNSF::initReverseStereo = false; |
| 31 | 30 |
unsigned XSFConfig_SNSF::initResampler = 1; |
| 32 |
-std::wstring XSFConfig_SNSF::initMutes = L"00000000"; |
|
| 31 |
+std::string XSFConfig_SNSF::initMutes = "00000000"; |
|
| 33 | 32 |
|
| 34 | 33 |
XSFConfig *XSFConfig::Create() |
| 35 | 34 |
{
|
| ... | ... |
@@ -53,19 +52,19 @@ XSFConfig_SNSF::XSFConfig_SNSF() : XSFConfig(), /*sixteenBitSound(false), */reve |
| 53 | 52 |
|
| 54 | 53 |
void XSFConfig_SNSF::LoadSpecificConfig() |
| 55 | 54 |
{
|
| 56 |
- //this->sixteenBitSound = this->configIO->GetValue(L"SixteenBitSound", XSFConfig_SNSF::initSixteenBitSound); |
|
| 57 |
- this->reverseStereo = this->configIO->GetValue(L"ReverseStereo", XSFConfig_SNSF::initReverseStereo); |
|
| 58 |
- this->resampler = this->configIO->GetValue(L"Resampler", XSFConfig_SNSF::initResampler); |
|
| 59 |
- std::wstringstream mutesSS(this->configIO->GetValue(L"Mutes", XSFConfig_SNSF::initMutes)); |
|
| 55 |
+ //this->sixteenBitSound = this->configIO->GetValue("SixteenBitSound", XSFConfig_SNSF::initSixteenBitSound);
|
|
| 56 |
+ this->reverseStereo = this->configIO->GetValue("ReverseStereo", XSFConfig_SNSF::initReverseStereo);
|
|
| 57 |
+ this->resampler = this->configIO->GetValue("Resampler", XSFConfig_SNSF::initResampler);
|
|
| 58 |
+ std::stringstream mutesSS(this->configIO->GetValue("Mutes", XSFConfig_SNSF::initMutes));
|
|
| 60 | 59 |
mutesSS >> this->mutes; |
| 61 | 60 |
} |
| 62 | 61 |
|
| 63 | 62 |
void XSFConfig_SNSF::SaveSpecificConfig() |
| 64 | 63 |
{
|
| 65 |
- //this->configIO->SetValue(L"SixteenBitSound", this->sixteenBitSound); |
|
| 66 |
- this->configIO->SetValue(L"ReverseStereo", this->reverseStereo); |
|
| 67 |
- this->configIO->SetValue(L"Resampler", this->resampler); |
|
| 68 |
- this->configIO->SetValue(L"Mutes", this->mutes.to_string<wchar_t>()); |
|
| 64 |
+ //this->configIO->SetValue("SixteenBitSound", this->sixteenBitSound);
|
|
| 65 |
+ this->configIO->SetValue("ReverseStereo", this->reverseStereo);
|
|
| 66 |
+ this->configIO->SetValue("Resampler", this->resampler);
|
|
| 67 |
+ this->configIO->SetValue("Mutes", this->mutes.to_string<char>());
|
|
| 69 | 68 |
} |
| 70 | 69 |
|
| 71 | 70 |
void XSFConfig_SNSF::GenerateSpecificDialogs() |
| ... | ... |
@@ -147,6 +146,6 @@ void XSFConfig_SNSF::CopySpecificConfigToMemory(XSFPlayer *, bool preLoad) |
| 147 | 146 |
|
| 148 | 147 |
void XSFConfig_SNSF::About(HWND parent) |
| 149 | 148 |
{
|
| 150 |
- MessageBoxW(parent, (XSFConfig::commonName + L" v" + XSFConfig::versionNumber + L", using xSF Winamp plugin framework (based on the vio*sf plugins) by Naram Qashat (CyberBotX) [cyberbotx@cyberbotx.com]\n\n" |
|
| 151 |
- L"Utilizes modified snes9x v1.53 for audio playback.").c_str(), (XSFConfig::commonName + L" v" + XSFConfig::versionNumber).c_str(), MB_OK); |
|
| 149 |
+ MessageBoxW(parent, ConvertFuncs::StringToWString(XSFConfig::commonName + " v" + XSFConfig::versionNumber + ", using xSF Winamp plugin framework (based on the vio*sf plugins) by Naram Qashat (CyberBotX) [cyberbotx@cyberbotx.com]\n\n" |
|
| 150 |
+ "Utilizes modified snes9x v1.53 for audio playback.").c_str(), ConvertFuncs::StringToWString(XSFConfig::commonName + " v" + XSFConfig::versionNumber).c_str(), MB_OK); |
|
| 152 | 151 |
} |
* [2SF] Used more up-to-date asmjit, despite the ugly looking code.
| ... | ... |
@@ -1,7 +1,7 @@ |
| 1 | 1 |
/* |
| 2 | 2 |
* xSF - SNSF configuration |
| 3 | 3 |
* By Naram Qashat (CyberBotX) [cyberbotx@cyberbotx.com] |
| 4 |
- * Last modification on 2013-05-08 |
|
| 4 |
+ * Last modification on 2014-09-17 |
|
| 5 | 5 |
* |
| 6 | 6 |
* Partially based on the vio*sf framework |
| 7 | 7 |
* |
| ... | ... |
@@ -133,7 +133,7 @@ void XSFConfig_SNSF::SaveSpecificConfigDialog(HWND hwndDlg) |
| 133 | 133 |
this->mutes[x] = !!SendMessageW(GetDlgItem(hwndDlg, idMutes), LB_GETSEL, x, 0); |
| 134 | 134 |
} |
| 135 | 135 |
|
| 136 |
-void XSFConfig_SNSF::CopySpecificConfigToMemory(XSFPlayer *xSFPlayer, bool preLoad) |
|
| 136 |
+void XSFConfig_SNSF::CopySpecificConfigToMemory(XSFPlayer *, bool preLoad) |
|
| 137 | 137 |
{
|
| 138 | 138 |
if (preLoad) |
| 139 | 139 |
{
|
| ... | ... |
@@ -147,6 +147,6 @@ void XSFConfig_SNSF::CopySpecificConfigToMemory(XSFPlayer *xSFPlayer, bool preLo |
| 147 | 147 |
|
| 148 | 148 |
void XSFConfig_SNSF::About(HWND parent) |
| 149 | 149 |
{
|
| 150 |
- MessageBox(parent, (XSFConfig::commonName + L" v" + XSFConfig::versionNumber + L", using xSF Winamp plugin framework (based on the vio*sf plugins) by Naram Qashat (CyberBotX) [cyberbotx@cyberbotx.com]\n\n" |
|
| 150 |
+ MessageBoxW(parent, (XSFConfig::commonName + L" v" + XSFConfig::versionNumber + L", using xSF Winamp plugin framework (based on the vio*sf plugins) by Naram Qashat (CyberBotX) [cyberbotx@cyberbotx.com]\n\n" |
|
| 151 | 151 |
L"Utilizes modified snes9x v1.53 for audio playback.").c_str(), (XSFConfig::commonName + L" v" + XSFConfig::versionNumber).c_str(), MB_OK); |
| 152 | 152 |
} |
| ... | ... |
@@ -1,7 +1,7 @@ |
| 1 | 1 |
/* |
| 2 | 2 |
* xSF - SNSF configuration |
| 3 | 3 |
* By Naram Qashat (CyberBotX) [cyberbotx@cyberbotx.com] |
| 4 |
- * Last modification on 2013-04-12 |
|
| 4 |
+ * Last modification on 2013-05-08 |
|
| 5 | 5 |
* |
| 6 | 6 |
* Partially based on the vio*sf framework |
| 7 | 7 |
* |
| ... | ... |
@@ -98,6 +98,7 @@ INT_PTR CALLBACK XSFConfig_SNSF::ConfigDialogProc(HWND hwndDlg, UINT uMsg, WPARA |
| 98 | 98 |
SendMessageW(GetDlgItem(hwndDlg, idResampler), CB_ADDSTRING, 0, reinterpret_cast<LPARAM>(L"Hermite Resampler")); |
| 99 | 99 |
SendMessageW(GetDlgItem(hwndDlg, idResampler), CB_ADDSTRING, 0, reinterpret_cast<LPARAM>(L"Bspline Resampler")); |
| 100 | 100 |
SendMessageW(GetDlgItem(hwndDlg, idResampler), CB_ADDSTRING, 0, reinterpret_cast<LPARAM>(L"Osculating Resampler")); |
| 101 |
+ SendMessageW(GetDlgItem(hwndDlg, idResampler), CB_ADDSTRING, 0, reinterpret_cast<LPARAM>(L"Sinc Resampler")); |
|
| 101 | 102 |
SendMessageW(GetDlgItem(hwndDlg, idResampler), CB_SETCURSEL, this->resampler, 0); |
| 102 | 103 |
// Mutes |
| 103 | 104 |
for (int x = 0, numMutes = this->mutes.size(); x < numMutes; ++x) |
| ... | ... |
@@ -1,7 +1,7 @@ |
| 1 | 1 |
/* |
| 2 | 2 |
* xSF - SNSF configuration |
| 3 | 3 |
* By Naram Qashat (CyberBotX) [cyberbotx@cyberbotx.com] |
| 4 |
- * Last modification on 2013-03-25 |
|
| 4 |
+ * Last modification on 2013-04-12 |
|
| 5 | 5 |
* |
| 6 | 6 |
* Partially based on the vio*sf framework |
| 7 | 7 |
* |
| ... | ... |
@@ -97,7 +97,7 @@ INT_PTR CALLBACK XSFConfig_SNSF::ConfigDialogProc(HWND hwndDlg, UINT uMsg, WPARA |
| 97 | 97 |
SendMessageW(GetDlgItem(hwndDlg, idResampler), CB_ADDSTRING, 0, reinterpret_cast<LPARAM>(L"Linear Resampler")); |
| 98 | 98 |
SendMessageW(GetDlgItem(hwndDlg, idResampler), CB_ADDSTRING, 0, reinterpret_cast<LPARAM>(L"Hermite Resampler")); |
| 99 | 99 |
SendMessageW(GetDlgItem(hwndDlg, idResampler), CB_ADDSTRING, 0, reinterpret_cast<LPARAM>(L"Bspline Resampler")); |
| 100 |
- SendMessageW(GetDlgItem(hwndDlg, idResampler), CB_ADDSTRING, 0, reinterpret_cast<LPARAM>(L"Optimal Resampler")); |
|
| 100 |
+ SendMessageW(GetDlgItem(hwndDlg, idResampler), CB_ADDSTRING, 0, reinterpret_cast<LPARAM>(L"Osculating Resampler")); |
|
| 101 | 101 |
SendMessageW(GetDlgItem(hwndDlg, idResampler), CB_SETCURSEL, this->resampler, 0); |
| 102 | 102 |
// Mutes |
| 103 | 103 |
for (int x = 0, numMutes = this->mutes.size(); x < numMutes; ++x) |
| ... | ... |
@@ -96,6 +96,8 @@ INT_PTR CALLBACK XSFConfig_SNSF::ConfigDialogProc(HWND hwndDlg, UINT uMsg, WPARA |
| 96 | 96 |
// Resampler |
| 97 | 97 |
SendMessageW(GetDlgItem(hwndDlg, idResampler), CB_ADDSTRING, 0, reinterpret_cast<LPARAM>(L"Linear Resampler")); |
| 98 | 98 |
SendMessageW(GetDlgItem(hwndDlg, idResampler), CB_ADDSTRING, 0, reinterpret_cast<LPARAM>(L"Hermite Resampler")); |
| 99 |
+ SendMessageW(GetDlgItem(hwndDlg, idResampler), CB_ADDSTRING, 0, reinterpret_cast<LPARAM>(L"Bspline Resampler")); |
|
| 100 |
+ SendMessageW(GetDlgItem(hwndDlg, idResampler), CB_ADDSTRING, 0, reinterpret_cast<LPARAM>(L"Optimal Resampler")); |
|
| 99 | 101 |
SendMessageW(GetDlgItem(hwndDlg, idResampler), CB_SETCURSEL, this->resampler, 0); |
| 100 | 102 |
// Mutes |
| 101 | 103 |
for (int x = 0, numMutes = this->mutes.size(); x < numMutes; ++x) |
| 1 | 1 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,149 @@ |
| 1 |
+/* |
|
| 2 |
+ * xSF - SNSF configuration |
|
| 3 |
+ * By Naram Qashat (CyberBotX) [cyberbotx@cyberbotx.com] |
|
| 4 |
+ * Last modification on 2013-03-25 |
|
| 5 |
+ * |
|
| 6 |
+ * Partially based on the vio*sf framework |
|
| 7 |
+ * |
|
| 8 |
+ * NOTE: 16-bit sound is always enabled, the player is currently limited to |
|
| 9 |
+ * creating a 16-bit PCM for Winamp and can not handle 8-bit sound from |
|
| 10 |
+ * snes9x. |
|
| 11 |
+ */ |
|
| 12 |
+ |
|
| 13 |
+#include "XSFConfig_SNSF.h" |
|
| 14 |
+#include "convert.h" |
|
| 15 |
+#include "BigSString.h" |
|
| 16 |
+#include "snes9x/apu/apu.h" |
|
| 17 |
+ |
|
| 18 |
+enum |
|
| 19 |
+{
|
|
| 20 |
+ idSixteenBitSound = 1000, |
|
| 21 |
+ idReverseStereo, |
|
| 22 |
+ idResampler, |
|
| 23 |
+ idMutes |
|
| 24 |
+}; |
|
| 25 |
+ |
|
| 26 |
+unsigned XSFConfig::initSampleRate = 44100; |
|
| 27 |
+std::wstring XSFConfig::commonName = L"SNSF Decoder"; |
|
| 28 |
+std::wstring XSFConfig::versionNumber = L"0.9b"; |
|
| 29 |
+//bool XSFConfig_SNSF::initSixteenBitSound = true; |
|
| 30 |
+bool XSFConfig_SNSF::initReverseStereo = false; |
|
| 31 |
+unsigned XSFConfig_SNSF::initResampler = 1; |
|
| 32 |
+std::wstring XSFConfig_SNSF::initMutes = L"00000000"; |
|
| 33 |
+ |
|
| 34 |
+XSFConfig *XSFConfig::Create() |
|
| 35 |
+{
|
|
| 36 |
+ return new XSFConfig_SNSF(); |
|
| 37 |
+} |
|
| 38 |
+ |
|
| 39 |
+XSFConfig_SNSF::XSFConfig_SNSF() : XSFConfig(), /*sixteenBitSound(false), */reverseStereo(false), mutes(), resampler(0) |
|
| 40 |
+{
|
|
| 41 |
+ this->supportedSampleRates.push_back(8000); |
|
| 42 |
+ this->supportedSampleRates.push_back(11025); |
|
| 43 |
+ this->supportedSampleRates.push_back(16000); |
|
| 44 |
+ this->supportedSampleRates.push_back(22050); |
|
| 45 |
+ this->supportedSampleRates.push_back(32000); |
|
| 46 |
+ this->supportedSampleRates.push_back(44100); |
|
| 47 |
+ this->supportedSampleRates.push_back(48000); |
|
| 48 |
+ this->supportedSampleRates.push_back(88200); |
|
| 49 |
+ this->supportedSampleRates.push_back(96000); |
|
| 50 |
+ this->supportedSampleRates.push_back(176400); |
|
| 51 |
+ this->supportedSampleRates.push_back(192000); |
|
| 52 |
+} |
|
| 53 |
+ |
|
| 54 |
+void XSFConfig_SNSF::LoadSpecificConfig() |
|
| 55 |
+{
|
|
| 56 |
+ //this->sixteenBitSound = this->configIO->GetValue(L"SixteenBitSound", XSFConfig_SNSF::initSixteenBitSound); |
|
| 57 |
+ this->reverseStereo = this->configIO->GetValue(L"ReverseStereo", XSFConfig_SNSF::initReverseStereo); |
|
| 58 |
+ this->resampler = this->configIO->GetValue(L"Resampler", XSFConfig_SNSF::initResampler); |
|
| 59 |
+ std::wstringstream mutesSS(this->configIO->GetValue(L"Mutes", XSFConfig_SNSF::initMutes)); |
|
| 60 |
+ mutesSS >> this->mutes; |
|
| 61 |
+} |
|
| 62 |
+ |
|
| 63 |
+void XSFConfig_SNSF::SaveSpecificConfig() |
|
| 64 |
+{
|
|
| 65 |
+ //this->configIO->SetValue(L"SixteenBitSound", this->sixteenBitSound); |
|
| 66 |
+ this->configIO->SetValue(L"ReverseStereo", this->reverseStereo); |
|
| 67 |
+ this->configIO->SetValue(L"Resampler", this->resampler); |
|
| 68 |
+ this->configIO->SetValue(L"Mutes", this->mutes.to_string<wchar_t>()); |
|
| 69 |
+} |
|
| 70 |
+ |
|
| 71 |
+void XSFConfig_SNSF::GenerateSpecificDialogs() |
|
| 72 |
+{
|
|
| 73 |
+ /*this->configDialog.AddCheckBoxControl(DialogCheckBoxBuilder(L"Sixteen-Bit Sound").WithSize(80, 10).InGroup(L"Output").WithRelativePositionToSibling(RelativePosition::FROM_BOTTOMLEFT, Point<short>(0, 7), 2).WithTabStop(). |
|
| 74 |
+ WithID(idSixteenBitSound));*/ |
|
| 75 |
+ this->configDialog.AddCheckBoxControl(DialogCheckBoxBuilder(L"Reverse Stereo").WithSize(80, 10).InGroup(L"Output").WithRelativePositionToSibling(RelativePosition::FROM_BOTTOMLEFT, Point<short>(0, 7), 2).WithTabStop(). |
|
| 76 |
+ WithID(idReverseStereo)); |
|
| 77 |
+ this->configDialog.AddLabelControl(DialogLabelBuilder(L"Resampler").WithSize(50, 8).InGroup(L"Output").WithRelativePositionToSibling(RelativePosition::FROM_BOTTOMLEFT, Point<short>(0, 10)).IsLeftJustified()); |
|
| 78 |
+ this->configDialog.AddComboBoxControl(DialogComboBoxBuilder().WithSize(78, 14).InGroup(L"Output").WithRelativePositionToSibling(RelativePosition::FROM_TOPRIGHT, Point<short>(5, -3)).WithTabStop().IsDropDownList(). |
|
| 79 |
+ WithID(idResampler)); |
|
| 80 |
+ this->configDialog.AddLabelControl(DialogLabelBuilder(L"Mute").WithSize(50, 8).InGroup(L"Output").WithRelativePositionToSibling(RelativePosition::FROM_BOTTOMLEFT, Point<short>(0, 10), 2).IsLeftJustified()); |
|
| 81 |
+ this->configDialog.AddListBoxControl(DialogListBoxBuilder().WithSize(78, 45).WithExactHeight().InGroup(L"Output").WithRelativePositionToSibling(RelativePosition::FROM_TOPRIGHT, Point<short>(5, -3)).WithID(idMutes).WithBorder(). |
|
| 82 |
+ WithVerticalScrollbar().WithMultipleSelect().WithTabStop()); |
|
| 83 |
+} |
|
| 84 |
+ |
|
| 85 |
+INT_PTR CALLBACK XSFConfig_SNSF::ConfigDialogProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) |
|
| 86 |
+{
|
|
| 87 |
+ switch (uMsg) |
|
| 88 |
+ {
|
|
| 89 |
+ case WM_INITDIALOG: |
|
| 90 |
+ // Sixteen-Bit Sound |
|
| 91 |
+ /*if (this->sixteenBitSound) |
|
| 92 |
+ SendMessageW(GetDlgItem(hwndDlg, idSixteenBitSound), BM_SETCHECK, BST_CHECKED, 0);*/ |
|
| 93 |
+ // Reverse Stereo |
|
| 94 |
+ if (this->reverseStereo) |
|
| 95 |
+ SendMessageW(GetDlgItem(hwndDlg, idReverseStereo), BM_SETCHECK, BST_CHECKED, 0); |
|
| 96 |
+ // Resampler |
|
| 97 |
+ SendMessageW(GetDlgItem(hwndDlg, idResampler), CB_ADDSTRING, 0, reinterpret_cast<LPARAM>(L"Linear Resampler")); |
|
| 98 |
+ SendMessageW(GetDlgItem(hwndDlg, idResampler), CB_ADDSTRING, 0, reinterpret_cast<LPARAM>(L"Hermite Resampler")); |
|
| 99 |
+ SendMessageW(GetDlgItem(hwndDlg, idResampler), CB_SETCURSEL, this->resampler, 0); |
|
| 100 |
+ // Mutes |
|
| 101 |
+ for (int x = 0, numMutes = this->mutes.size(); x < numMutes; ++x) |
|
| 102 |
+ {
|
|
| 103 |
+ SendMessageW(GetDlgItem(hwndDlg, idMutes), LB_ADDSTRING, 0, reinterpret_cast<LPARAM>((L"BRRPCM " + wstringify(x + 1)).c_str())); |
|
| 104 |
+ SendMessageW(GetDlgItem(hwndDlg, idMutes), LB_SETSEL, this->mutes[x], x); |
|
| 105 |
+ } |
|
| 106 |
+ break; |
|
| 107 |
+ case WM_COMMAND: |
|
| 108 |
+ break; |
|
| 109 |
+ } |
|
| 110 |
+ |
|
| 111 |
+ return XSFConfig::ConfigDialogProc(hwndDlg, uMsg, wParam, lParam); |
|
| 112 |
+} |
|
| 113 |
+ |
|
| 114 |
+void XSFConfig_SNSF::ResetSpecificConfigDefaults(HWND hwndDlg) |
|
| 115 |
+{
|
|
| 116 |
+ //SendMessageW(GetDlgItem(hwndDlg, idSixteenBitSound), BM_SETCHECK, XSFConfig_SNSF::initSixteenBitSound ? BST_CHECKED : BST_UNCHECKED, 0); |
|
| 117 |
+ SendMessageW(GetDlgItem(hwndDlg, idReverseStereo), BM_SETCHECK, XSFConfig_SNSF::initReverseStereo ? BST_CHECKED : BST_UNCHECKED, 0); |
|
| 118 |
+ SendMessageW(GetDlgItem(hwndDlg, idResampler), CB_SETCURSEL, XSFConfig_SNSF::initResampler, 0); |
|
| 119 |
+ auto tmpMutes = std::bitset<8>(XSFConfig_SNSF::initMutes); |
|
| 120 |
+ for (int x = 0, numMutes = tmpMutes.size(); x < numMutes; ++x) |
|
| 121 |
+ SendMessageW(GetDlgItem(hwndDlg, idMutes), LB_SETSEL, tmpMutes[x], x); |
|
| 122 |
+} |
|
| 123 |
+ |
|
| 124 |
+void XSFConfig_SNSF::SaveSpecificConfigDialog(HWND hwndDlg) |
|
| 125 |
+{
|
|
| 126 |
+ //this->sixteenBitSound = SendMessageW(GetDlgItem(hwndDlg, idSixteenBitSound), BM_GETCHECK, 0, 0) == BST_CHECKED; |
|
| 127 |
+ this->reverseStereo = SendMessageW(GetDlgItem(hwndDlg, idReverseStereo), BM_GETCHECK, 0, 0) == BST_CHECKED; |
|
| 128 |
+ this->resampler = static_cast<unsigned>(SendMessageW(GetDlgItem(hwndDlg, idResampler), CB_GETCURSEL, 0, 0)); |
|
| 129 |
+ for (int x = 0, numMutes = this->mutes.size(); x < numMutes; ++x) |
|
| 130 |
+ this->mutes[x] = !!SendMessageW(GetDlgItem(hwndDlg, idMutes), LB_GETSEL, x, 0); |
|
| 131 |
+} |
|
| 132 |
+ |
|
| 133 |
+void XSFConfig_SNSF::CopySpecificConfigToMemory(XSFPlayer *xSFPlayer, bool preLoad) |
|
| 134 |
+{
|
|
| 135 |
+ if (preLoad) |
|
| 136 |
+ {
|
|
| 137 |
+ memset(&Settings, 0, sizeof(Settings)); |
|
| 138 |
+ //Settings.SixteenBitSound = this->sixteenBitSound; |
|
| 139 |
+ Settings.ReverseStereo = this->reverseStereo; |
|
| 140 |
+ } |
|
| 141 |
+ else |
|
| 142 |
+ S9xSetSoundControl(static_cast<uint8_t>(this->mutes.to_ulong()) ^ 0xFF); |
|
| 143 |
+} |
|
| 144 |
+ |
|
| 145 |
+void XSFConfig_SNSF::About(HWND parent) |
|
| 146 |
+{
|
|
| 147 |
+ MessageBox(parent, (XSFConfig::commonName + L" v" + XSFConfig::versionNumber + L", using xSF Winamp plugin framework (based on the vio*sf plugins) by Naram Qashat (CyberBotX) [cyberbotx@cyberbotx.com]\n\n" |
|
| 148 |
+ L"Utilizes modified snes9x v1.53 for audio playback.").c_str(), (XSFConfig::commonName + L" v" + XSFConfig::versionNumber).c_str(), MB_OK); |
|
| 149 |
+} |