Notable differences from upstream:
* Did not use the same #include setup for the new byuu apu and instead chose to do things more traditionally, as the latter is also much easier to deal with in Visual Studio than just including .cpp files into other .cpp files...
* MSU1 support not included (I see no need for this in a plugin meant to be used for original SNES music).
* The dynamic rate control on the APU not included (I also see no need for it in this plugin).
* The extra resamplers I added in were removed as the original hermite resampler was folded into a single non-inhertiable resampler.
* Bits of cleanup.
| ... | ... |
@@ -3,10 +3,6 @@ |
| 3 | 3 |
* By Naram Qashat (CyberBotX) [cyberbotx@cyberbotx.com] |
| 4 | 4 |
* |
| 5 | 5 |
* Partially based on the vio*sf framework |
| 6 |
- * |
|
| 7 |
- * NOTE: 16-bit sound is always enabled, the player is currently limited to |
|
| 8 |
- * creating a 16-bit PCM for Winamp and can not handle 8-bit sound from |
|
| 9 |
- * snes9x. |
|
| 10 | 6 |
*/ |
| 11 | 7 |
|
| 12 | 8 |
#include <bitset> |
| ... | ... |
@@ -40,7 +36,7 @@ XSFConfig *XSFConfig::Create() |
| 40 | 36 |
return new XSFConfig_SNSF(); |
| 41 | 37 |
} |
| 42 | 38 |
|
| 43 |
-XSFConfig_SNSF::XSFConfig_SNSF() : XSFConfig(), /*sixteenBitSound(false), */reverseStereo(false), mutes(), resampler(0) |
|
| 39 |
+XSFConfig_SNSF::XSFConfig_SNSF() : XSFConfig(), separateEchoBuffer(false), interpolation(0), mutes() |
|
| 44 | 40 |
{
|
| 45 | 41 |
this->supportedSampleRates.push_back(8000); |
| 46 | 42 |
this->supportedSampleRates.push_back(11025); |
| ... | ... |
@@ -57,26 +53,24 @@ XSFConfig_SNSF::XSFConfig_SNSF() : XSFConfig(), /*sixteenBitSound(false), */reve |
| 57 | 53 |
|
| 58 | 54 |
void XSFConfig_SNSF::LoadSpecificConfig() |
| 59 | 55 |
{
|
| 60 |
- //this->sixteenBitSound = this->configIO->GetValue("SixteenBitSound", XSFConfig_SNSF::initSixteenBitSound);
|
|
| 61 |
- this->reverseStereo = this->configIO->GetValue("ReverseStereo", XSFConfig_SNSF::initReverseStereo);
|
|
| 62 |
- this->resampler = this->configIO->GetValue("Resampler", XSFConfig_SNSF::initResampler);
|
|
| 56 |
+ this->separateEchoBuffer = this->configIO->GetValue("SeparateEchoBuffer", XSFConfig_SNSF::initSeparateEchoBuffer);
|
|
| 57 |
+ this->interpolation = this->configIO->GetValue("Interpolation", XSFConfig_SNSF::initInterpolation);
|
|
| 63 | 58 |
std::stringstream mutesSS(this->configIO->GetValue("Mutes", XSFConfig_SNSF::initMutes));
|
| 64 | 59 |
mutesSS >> this->mutes; |
| 65 | 60 |
} |
| 66 | 61 |
|
| 67 | 62 |
void XSFConfig_SNSF::SaveSpecificConfig() |
| 68 | 63 |
{
|
| 69 |
- //this->configIO->SetValue("SixteenBitSound", this->sixteenBitSound);
|
|
| 70 |
- this->configIO->SetValue("ReverseStereo", this->reverseStereo);
|
|
| 71 |
- this->configIO->SetValue("Resampler", this->resampler);
|
|
| 64 |
+ this->configIO->SetValue("SeparateEchoBuffer", this->separateEchoBuffer);
|
|
| 65 |
+ this->configIO->SetValue("Interpolation", this->interpolation);
|
|
| 72 | 66 |
this->configIO->SetValue("Mutes", this->mutes.to_string<char>());
|
| 73 | 67 |
} |
| 74 | 68 |
|
| 75 | 69 |
void XSFConfig_SNSF::InitializeSpecificConfigDialog(XSFConfigDialog *dialog) |
| 76 | 70 |
{
|
| 77 | 71 |
auto snsfDialog = static_cast<XSFConfigDialog_SNSF *>(dialog); |
| 78 |
- snsfDialog->reverseStereo = this->reverseStereo; |
|
| 79 |
- snsfDialog->resampler = static_cast<int>(this->resampler); |
|
| 72 |
+ snsfDialog->separateEchoBuffer = this->separateEchoBuffer; |
|
| 73 |
+ snsfDialog->interpolation = static_cast<int>(this->interpolation); |
|
| 80 | 74 |
for (std::size_t x = 0, numMutes = this->mutes.size(); x < numMutes; ++x) |
| 81 | 75 |
if (this->mutes[x]) |
| 82 | 76 |
snsfDialog->mute.Add(x); |
| ... | ... |
@@ -85,8 +79,8 @@ void XSFConfig_SNSF::InitializeSpecificConfigDialog(XSFConfigDialog *dialog) |
| 85 | 79 |
void XSFConfig_SNSF::ResetSpecificConfigDefaults(XSFConfigDialog *dialog) |
| 86 | 80 |
{
|
| 87 | 81 |
auto snsfDialog = static_cast<XSFConfigDialog_SNSF *>(dialog); |
| 88 |
- snsfDialog->reverseStereo = XSFConfig_SNSF::initReverseStereo; |
|
| 89 |
- snsfDialog->resampler = XSFConfig_SNSF::initResampler; |
|
| 82 |
+ snsfDialog->separateEchoBuffer = XSFConfig_SNSF::initSeparateEchoBuffer; |
|
| 83 |
+ snsfDialog->interpolation = XSFConfig_SNSF::initInterpolation; |
|
| 90 | 84 |
snsfDialog->mute.Clear(); |
| 91 | 85 |
auto tmpMutes = std::bitset<8>(XSFConfig_SNSF::initMutes); |
| 92 | 86 |
for (std::size_t x = 0, numMutes = tmpMutes.size(); x < numMutes; ++x) |
| ... | ... |
@@ -97,8 +91,8 @@ void XSFConfig_SNSF::ResetSpecificConfigDefaults(XSFConfigDialog *dialog) |
| 97 | 91 |
void XSFConfig_SNSF::SaveSpecificConfigDialog(XSFConfigDialog *dialog) |
| 98 | 92 |
{
|
| 99 | 93 |
auto snsfDialog = static_cast<XSFConfigDialog_SNSF *>(dialog); |
| 100 |
- this->reverseStereo = snsfDialog->reverseStereo; |
|
| 101 |
- this->resampler = snsfDialog->resampler; |
|
| 94 |
+ this->separateEchoBuffer = snsfDialog->separateEchoBuffer; |
|
| 95 |
+ this->interpolation = snsfDialog->interpolation; |
|
| 102 | 96 |
for (std::size_t x = 0, numMutes = this->mutes.size(); x < numMutes; ++x) |
| 103 | 97 |
this->mutes[x] = snsfDialog->mute.Index(x) != wxNOT_FOUND; |
| 104 | 98 |
} |
| ... | ... |
@@ -108,8 +102,8 @@ void XSFConfig_SNSF::CopySpecificConfigToMemory(XSFPlayer *, bool preLoad) |
| 108 | 102 |
if (preLoad) |
| 109 | 103 |
{
|
| 110 | 104 |
memset(&Settings, 0, sizeof(Settings)); |
| 111 |
- //Settings.SixteenBitSound = this->sixteenBitSound; |
|
| 112 |
- Settings.ReverseStereo = this->reverseStereo; |
|
| 105 |
+ Settings.SeparateEchoBuffer = this->separateEchoBuffer; |
|
| 106 |
+ Settings.InterpolationMethod = this->interpolation; |
|
| 113 | 107 |
} |
| 114 | 108 |
else |
| 115 | 109 |
S9xSetSoundControl(static_cast<std::uint8_t>(this->mutes.to_ulong()) ^ 0xFF); |
| ... | ... |
@@ -118,7 +112,7 @@ void XSFConfig_SNSF::CopySpecificConfigToMemory(XSFPlayer *, bool preLoad) |
| 118 | 112 |
void XSFConfig_SNSF::About(HWND parent) |
| 119 | 113 |
{
|
| 120 | 114 |
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" |
| 121 |
- "Utilizes modified snes9x v1.53 for audio playback.").c_str(), ConvertFuncs::StringToWString(XSFConfig::commonName + " v" + XSFConfig::versionNumber).c_str(), MB_OK); |
|
| 115 |
+ "Utilizes modified snes9x v" VERSION " for audio playback.").c_str(), ConvertFuncs::StringToWString(XSFConfig::commonName + " v" + XSFConfig::versionNumber).c_str(), MB_OK); |
|
| 122 | 116 |
} |
| 123 | 117 |
|
| 124 | 118 |
XSFConfigDialog *XSFConfig_SNSF::CreateDialogBox(wxWindow *window, const std::string &title) |
* Removes the one that was orignally based entirely on the DeSmuME one, while still looking most the same but cleaner.
* To accommodate this, I needed to rework how wxWidgets was initialized so the configuration dialog boxes could also work alongside this.
* Needed to add a custom wxApp to handle the above.
* This also means that the configuration dialog no longer needs the plugin's HINSTANCE passed along.
* Had to not disable wxGauge or wxToogleButton for the Sound View dialog.
* Also remove the now-unneeded enums in the XSFConfig*.cpp files.
* Sound View is still done in a thread so its event loop can run independently from the rest of the plugin.
* XSFConfig_NCSF doesn't need to be the one to start the Sound View dialog now.
| ... | ... |
@@ -15,6 +15,7 @@ |
| 15 | 15 |
#include <cstddef> |
| 16 | 16 |
#include <cstdint> |
| 17 | 17 |
#include "windowsh_wrapper.h" |
| 18 |
+#include "XSFApp.h" |
|
| 18 | 19 |
#include "XSFConfig.h" |
| 19 | 20 |
#include "XSFConfig_SNSF.h" |
| 20 | 21 |
#include "XSFConfigDialog_SNSF.h" |
| ... | ... |
@@ -25,18 +26,15 @@ class wxWindow; |
| 25 | 26 |
class XSFConfigDialog; |
| 26 | 27 |
class XSFPlayer; |
| 27 | 28 |
|
| 28 |
-enum |
|
| 29 |
-{
|
|
| 30 |
- idSixteenBitSound = 1000, |
|
| 31 |
- idReverseStereo, |
|
| 32 |
- idResampler, |
|
| 33 |
- idMutes |
|
| 34 |
-}; |
|
| 35 |
- |
|
| 36 | 29 |
const unsigned XSFConfig::initSampleRate = 44100; |
| 37 | 30 |
const std::string XSFConfig::commonName = "SNSF Decoder"; |
| 38 | 31 |
const std::string XSFConfig::versionNumber = "0.9b"; |
| 39 | 32 |
|
| 33 |
+XSFApp *XSFApp::Create() |
|
| 34 |
+{
|
|
| 35 |
+ return new XSFApp(); |
|
| 36 |
+} |
|
| 37 |
+ |
|
| 40 | 38 |
XSFConfig *XSFConfig::Create() |
| 41 | 39 |
{
|
| 42 | 40 |
return new XSFConfig_SNSF(); |
* Removes the configuration dialog boxes that used my DialogBuilder.
* Move default configuration values to be inlined within the headers.
* Moved 2SF's and GSF's XSFConfig classes to their own headers to accommodate the new wxWidgets dialog boxes.
* Make it so NCSF's SoundView dialog can be toggled on or off from the configuration dialog box.
| ... | ... |
@@ -12,12 +12,19 @@ |
| 12 | 12 |
#include <bitset> |
| 13 | 13 |
#include <sstream> |
| 14 | 14 |
#include <string> |
| 15 |
+#include <cstddef> |
|
| 15 | 16 |
#include <cstdint> |
| 16 | 17 |
#include "windowsh_wrapper.h" |
| 18 |
+#include "XSFConfig.h" |
|
| 17 | 19 |
#include "XSFConfig_SNSF.h" |
| 20 |
+#include "XSFConfigDialog_SNSF.h" |
|
| 18 | 21 |
#include "convert.h" |
| 19 | 22 |
#include "snes9x/apu/apu.h" |
| 20 | 23 |
|
| 24 |
+class wxWindow; |
|
| 25 |
+class XSFConfigDialog; |
|
| 26 |
+class XSFPlayer; |
|
| 27 |
+ |
|
| 21 | 28 |
enum |
| 22 | 29 |
{
|
| 23 | 30 |
idSixteenBitSound = 1000, |
| ... | ... |
@@ -26,13 +33,9 @@ enum |
| 26 | 33 |
idMutes |
| 27 | 34 |
}; |
| 28 | 35 |
|
| 29 |
-unsigned XSFConfig::initSampleRate = 44100; |
|
| 30 |
-std::string XSFConfig::commonName = "SNSF Decoder"; |
|
| 31 |
-std::string XSFConfig::versionNumber = "0.9b"; |
|
| 32 |
-//bool XSFConfig_SNSF::initSixteenBitSound = true; |
|
| 33 |
-bool XSFConfig_SNSF::initReverseStereo = false; |
|
| 34 |
-unsigned XSFConfig_SNSF::initResampler = 1; |
|
| 35 |
-std::string XSFConfig_SNSF::initMutes = "00000000"; |
|
| 36 |
+const unsigned XSFConfig::initSampleRate = 44100; |
|
| 37 |
+const std::string XSFConfig::commonName = "SNSF Decoder"; |
|
| 38 |
+const std::string XSFConfig::versionNumber = "0.9b"; |
|
| 36 | 39 |
|
| 37 | 40 |
XSFConfig *XSFConfig::Create() |
| 38 | 41 |
{
|
| ... | ... |
@@ -71,69 +74,35 @@ void XSFConfig_SNSF::SaveSpecificConfig() |
| 71 | 74 |
this->configIO->SetValue("Mutes", this->mutes.to_string<char>());
|
| 72 | 75 |
} |
| 73 | 76 |
|
| 74 |
-void XSFConfig_SNSF::GenerateSpecificDialogs() |
|
| 77 |
+void XSFConfig_SNSF::InitializeSpecificConfigDialog(XSFConfigDialog *dialog) |
|
| 75 | 78 |
{
|
| 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(). |
|
| 77 |
- WithID(idSixteenBitSound));*/ |
|
| 78 |
- this->configDialog.AddCheckBoxControl(DialogCheckBoxBuilder(L"Reverse Stereo").WithSize(80, 10).InGroup(L"Output").WithRelativePositionToSibling(RelativePosition::PositionType::FromBottomLeft, Point<short>(0, 7), 2).WithTabStop(). |
|
| 79 |
- WithID(idReverseStereo)); |
|
| 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(). |
|
| 82 |
- WithID(idResampler)); |
|
| 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(). |
|
| 85 |
- WithVerticalScrollbar().WithMultipleSelect().WithTabStop()); |
|
| 86 |
-} |
|
| 87 |
- |
|
| 88 |
-INT_PTR CALLBACK XSFConfig_SNSF::ConfigDialogProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) |
|
| 89 |
-{
|
|
| 90 |
- switch (uMsg) |
|
| 91 |
- {
|
|
| 92 |
- case WM_INITDIALOG: |
|
| 93 |
- // Sixteen-Bit Sound |
|
| 94 |
- /*if (this->sixteenBitSound) |
|
| 95 |
- SendMessageW(GetDlgItem(hwndDlg, idSixteenBitSound), BM_SETCHECK, BST_CHECKED, 0);*/ |
|
| 96 |
- // Reverse Stereo |
|
| 97 |
- if (this->reverseStereo) |
|
| 98 |
- SendMessageW(GetDlgItem(hwndDlg, idReverseStereo), BM_SETCHECK, BST_CHECKED, 0); |
|
| 99 |
- // Resampler |
|
| 100 |
- SendMessageW(GetDlgItem(hwndDlg, idResampler), CB_ADDSTRING, 0, reinterpret_cast<LPARAM>(L"Linear Resampler")); |
|
| 101 |
- SendMessageW(GetDlgItem(hwndDlg, idResampler), CB_ADDSTRING, 0, reinterpret_cast<LPARAM>(L"Hermite Resampler")); |
|
| 102 |
- SendMessageW(GetDlgItem(hwndDlg, idResampler), CB_ADDSTRING, 0, reinterpret_cast<LPARAM>(L"Bspline Resampler")); |
|
| 103 |
- SendMessageW(GetDlgItem(hwndDlg, idResampler), CB_ADDSTRING, 0, reinterpret_cast<LPARAM>(L"Osculating Resampler")); |
|
| 104 |
- SendMessageW(GetDlgItem(hwndDlg, idResampler), CB_ADDSTRING, 0, reinterpret_cast<LPARAM>(L"Sinc Resampler")); |
|
| 105 |
- SendMessageW(GetDlgItem(hwndDlg, idResampler), CB_SETCURSEL, this->resampler, 0); |
|
| 106 |
- // Mutes |
|
| 107 |
- for (int x = 0, numMutes = this->mutes.size(); x < numMutes; ++x) |
|
| 108 |
- {
|
|
| 109 |
- SendMessageW(GetDlgItem(hwndDlg, idMutes), LB_ADDSTRING, 0, reinterpret_cast<LPARAM>((L"BRRPCM " + std::to_wstring(x + 1)).c_str())); |
|
| 110 |
- SendMessageW(GetDlgItem(hwndDlg, idMutes), LB_SETSEL, this->mutes[x], x); |
|
| 111 |
- } |
|
| 112 |
- break; |
|
| 113 |
- case WM_COMMAND: |
|
| 114 |
- break; |
|
| 115 |
- } |
|
| 116 |
- |
|
| 117 |
- return XSFConfig::ConfigDialogProc(hwndDlg, uMsg, wParam, lParam); |
|
| 79 |
+ auto snsfDialog = static_cast<XSFConfigDialog_SNSF *>(dialog); |
|
| 80 |
+ snsfDialog->reverseStereo = this->reverseStereo; |
|
| 81 |
+ snsfDialog->resampler = static_cast<int>(this->resampler); |
|
| 82 |
+ for (std::size_t x = 0, numMutes = this->mutes.size(); x < numMutes; ++x) |
|
| 83 |
+ if (this->mutes[x]) |
|
| 84 |
+ snsfDialog->mute.Add(x); |
|
| 118 | 85 |
} |
| 119 | 86 |
|
| 120 |
-void XSFConfig_SNSF::ResetSpecificConfigDefaults(HWND hwndDlg) |
|
| 87 |
+void XSFConfig_SNSF::ResetSpecificConfigDefaults(XSFConfigDialog *dialog) |
|
| 121 | 88 |
{
|
| 122 |
- //SendMessageW(GetDlgItem(hwndDlg, idSixteenBitSound), BM_SETCHECK, XSFConfig_SNSF::initSixteenBitSound ? BST_CHECKED : BST_UNCHECKED, 0); |
|
| 123 |
- SendMessageW(GetDlgItem(hwndDlg, idReverseStereo), BM_SETCHECK, XSFConfig_SNSF::initReverseStereo ? BST_CHECKED : BST_UNCHECKED, 0); |
|
| 124 |
- SendMessageW(GetDlgItem(hwndDlg, idResampler), CB_SETCURSEL, XSFConfig_SNSF::initResampler, 0); |
|
| 89 |
+ auto snsfDialog = static_cast<XSFConfigDialog_SNSF *>(dialog); |
|
| 90 |
+ snsfDialog->reverseStereo = XSFConfig_SNSF::initReverseStereo; |
|
| 91 |
+ snsfDialog->resampler = XSFConfig_SNSF::initResampler; |
|
| 92 |
+ snsfDialog->mute.Clear(); |
|
| 125 | 93 |
auto tmpMutes = std::bitset<8>(XSFConfig_SNSF::initMutes); |
| 126 |
- for (int x = 0, numMutes = tmpMutes.size(); x < numMutes; ++x) |
|
| 127 |
- SendMessageW(GetDlgItem(hwndDlg, idMutes), LB_SETSEL, tmpMutes[x], x); |
|
| 94 |
+ for (std::size_t x = 0, numMutes = tmpMutes.size(); x < numMutes; ++x) |
|
| 95 |
+ if (tmpMutes[x]) |
|
| 96 |
+ snsfDialog->mute.Add(x); |
|
| 128 | 97 |
} |
| 129 | 98 |
|
| 130 |
-void XSFConfig_SNSF::SaveSpecificConfigDialog(HWND hwndDlg) |
|
| 99 |
+void XSFConfig_SNSF::SaveSpecificConfigDialog(XSFConfigDialog *dialog) |
|
| 131 | 100 |
{
|
| 132 |
- //this->sixteenBitSound = SendMessageW(GetDlgItem(hwndDlg, idSixteenBitSound), BM_GETCHECK, 0, 0) == BST_CHECKED; |
|
| 133 |
- this->reverseStereo = SendMessageW(GetDlgItem(hwndDlg, idReverseStereo), BM_GETCHECK, 0, 0) == BST_CHECKED; |
|
| 134 |
- this->resampler = static_cast<unsigned>(SendMessageW(GetDlgItem(hwndDlg, idResampler), CB_GETCURSEL, 0, 0)); |
|
| 135 |
- for (int x = 0, numMutes = this->mutes.size(); x < numMutes; ++x) |
|
| 136 |
- this->mutes[x] = !!SendMessageW(GetDlgItem(hwndDlg, idMutes), LB_GETSEL, x, 0); |
|
| 101 |
+ auto snsfDialog = static_cast<XSFConfigDialog_SNSF *>(dialog); |
|
| 102 |
+ this->reverseStereo = snsfDialog->reverseStereo; |
|
| 103 |
+ this->resampler = snsfDialog->resampler; |
|
| 104 |
+ for (std::size_t x = 0, numMutes = this->mutes.size(); x < numMutes; ++x) |
|
| 105 |
+ this->mutes[x] = snsfDialog->mute.Index(x) != wxNOT_FOUND; |
|
| 137 | 106 |
} |
| 138 | 107 |
|
| 139 | 108 |
void XSFConfig_SNSF::CopySpecificConfigToMemory(XSFPlayer *, bool preLoad) |
| ... | ... |
@@ -153,3 +122,8 @@ void XSFConfig_SNSF::About(HWND parent) |
| 153 | 122 |
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" |
| 154 | 123 |
"Utilizes modified snes9x v1.53 for audio playback.").c_str(), ConvertFuncs::StringToWString(XSFConfig::commonName + " v" + XSFConfig::versionNumber).c_str(), MB_OK); |
| 155 | 124 |
} |
| 125 |
+ |
|
| 126 |
+XSFConfigDialog *XSFConfig_SNSF::CreateDialogBox(wxWindow *window, const std::string &title) |
|
| 127 |
+{
|
|
| 128 |
+ return new XSFConfigDialog_SNSF(*this, window, title); |
|
| 129 |
+} |
* 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 |
+} |