Make the NCSF Sound View dialog always available.
(Before it was only available under Debug builds.)
--- a/src/in_ncsf/XSFConfigDialog_NCSF.cpp
+++ b/src/in_ncsf/XSFConfigDialog_NCSF.cpp
@@ -31,10 +31,8 @@
XSFConfigDialog_NCSF::XSFConfigDialog_NCSF(XSFConfig &newConfig, wxWindow *parent, const wxString &title) : XSFConfigDialog(newConfig, parent, title)
{
-#ifndef NDEBUG
auto useSoundViewCheckBox = new wxCheckBox(this->generalPanel, wxID_ANY, "Use Sound View Window", wxDefaultPosition, wxDefaultSize, 0, wxGenericValidator{ &this->useSoundView });
this->generalSizer->Add(useSoundViewCheckBox, { 5, 0 }, { 1, 2 }, wxALL, 5);
-#endif
auto interpolationLabel = new wxStaticText(this->outputPanel, wxID_ANY, "Interpolation");
this->outputSizer->Add(interpolationLabel, { 4, 0 }, { 1, 1 }, wxALIGN_CENTER_VERTICAL | wxALL, 5);
--- a/src/in_ncsf/XSFConfigDialog_NCSF.h
+++ b/src/in_ncsf/XSFConfigDialog_NCSF.h
@@ -31,9 +31,7 @@
public:
XSFConfigDialog_NCSF(XSFConfig &newConfig, wxWindow *parent, const wxString &title);
-#ifndef NDEBUG
bool useSoundView;
-#endif
int interpolation;
wxArrayInt mute;
};
--- a/src/in_ncsf/XSFConfig_NCSF.cpp
+++ b/src/in_ncsf/XSFConfig_NCSF.cpp
@@ -9,20 +9,18 @@
#include <sstream>
#include <string>
#include <cstddef>
+#include <cstdint>
#include "windowsh_wrapper.h"
#include <windowsx.h>
+#include <CommCtrl.h>
+#include "SSEQPlayer/common.h"
+#include "SSEQPlayer/consts.h"
#include "XSFConfig.h"
#include "XSFConfig_NCSF.h"
#include "XSFConfigDialog_NCSF.h"
#include "XSFPlayer_NCSF.h"
#include "convert.h"
-#ifndef NDEBUG
-# include <cstdint>
-# include "SSEQPlayer/common.h"
-# include "SSEQPlayer/consts.h"
-# include "resource.h"
-# include <CommCtrl.h>
-#endif
+#include "resource.h"
class wxWindow;
class XSFConfigDialog;
@@ -43,10 +41,7 @@
return new XSFConfig_NCSF();
}
-XSFConfig_NCSF::XSFConfig_NCSF() : XSFConfig(), interpolation(0), mutes()
-#ifndef NDEBUG
- , useSoundViewDialog(false), soundViewData()
-#endif
+XSFConfig_NCSF::XSFConfig_NCSF() : XSFConfig(), interpolation(0), mutes(), useSoundViewDialog(false), soundViewData()
{
this->supportedSampleRates.push_back(8000);
this->supportedSampleRates.push_back(11025);
@@ -63,9 +58,7 @@
void XSFConfig_NCSF::LoadSpecificConfig()
{
-#ifndef NDEBUG
this->useSoundViewDialog = this->configIO->GetValue("UseSoundViewDialog", XSFConfig_NCSF::initUseSoundViewDialog);
-#endif
this->interpolation = this->configIO->GetValue("Interpolation", XSFConfig_NCSF::initInterpolation);
std::stringstream mutesSS(this->configIO->GetValue("Mutes", XSFConfig_NCSF::initMutes));
mutesSS >> this->mutes;
@@ -73,9 +66,7 @@
void XSFConfig_NCSF::SaveSpecificConfig()
{
-#ifndef NDEBUG
this->configIO->SetValue("UseSoundViewDialog", this->useSoundViewDialog);
-#endif
this->configIO->SetValue("Interpolation", this->interpolation);
this->configIO->SetValue("Mutes", this->mutes.to_string<char>());
}
@@ -83,9 +74,7 @@
void XSFConfig_NCSF::InitializeSpecificConfigDialog(XSFConfigDialog *dialog)
{
auto ncsfDialog = static_cast<XSFConfigDialog_NCSF *>(dialog);
-#ifndef NDEBUG
ncsfDialog->useSoundView = this->useSoundViewDialog;
-#endif
ncsfDialog->interpolation = static_cast<int>(this->interpolation);
for (std::size_t x = 0, numMutes = this->mutes.size(); x < numMutes; ++x)
if (this->mutes[x])
@@ -95,9 +84,7 @@
void XSFConfig_NCSF::ResetSpecificConfigDefaults(XSFConfigDialog *dialog)
{
auto ncsfDialog = static_cast<XSFConfigDialog_NCSF *>(dialog);
-#ifndef NDEBUG
ncsfDialog->useSoundView = XSFConfig_NCSF::initUseSoundViewDialog;
-#endif
ncsfDialog->interpolation = XSFConfig_NCSF::initInterpolation;
ncsfDialog->mute.Clear();
auto tmpMutes = std::bitset<16>(XSFConfig_NCSF::initMutes);
@@ -109,9 +96,7 @@
void XSFConfig_NCSF::SaveSpecificConfigDialog(XSFConfigDialog *dialog)
{
auto ncsfDialog = static_cast<XSFConfigDialog_NCSF *>(dialog);
-#ifndef NDEBUG
this->useSoundViewDialog = ncsfDialog->useSoundView;
-#endif
this->interpolation = ncsfDialog->interpolation;
for (std::size_t x = 0, numMutes = this->mutes.size(); x < numMutes; ++x)
this->mutes[x] = ncsfDialog->mute.Index(x) != wxNOT_FOUND;
@@ -120,9 +105,7 @@
void XSFConfig_NCSF::CopySpecificConfigToMemory(XSFPlayer *xSFPlayer, bool)
{
auto NCSFPlayer = static_cast<XSFPlayer_NCSF *>(xSFPlayer);
-#ifndef NDEBUG
NCSFPlayer->SetUseSoundViewDialog(this->useSoundViewDialog);
-#endif
NCSFPlayer->SetInterpolation(this->interpolation);
NCSFPlayer->SetMutes(this->mutes);
}
@@ -138,7 +121,6 @@
return new XSFConfigDialog_NCSF(*this, window, title);
}
-#ifndef NDEBUG
INT_PTR CALLBACK XSFConfig_NCSF::SoundViewDialogProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
auto data = reinterpret_cast<SoundViewData *>(GetWindowLongW(hwndDlg, DWLP_USER));
@@ -352,5 +334,4 @@
this->soundViewData.reset();
}
}
-#endif
-
+
--- a/src/in_ncsf/XSFConfig_NCSF.h
+++ b/src/in_ncsf/XSFConfig_NCSF.h
@@ -7,26 +7,21 @@
#pragma once
+#include <algorithm>
#include <bitset>
+#include <memory>
#include <string>
-#ifndef NDEBUG
-# include <algorithm>
-# include <memory>
-# include <cstdint>
-# include "SSEQPlayer/consts.h"
-#endif
+#include <cstdint>
#include "windowsh_wrapper.h"
+#include "SSEQPlayer/consts.h"
#include "XSFConfig.h"
class wxWindow;
class XSFConfig_NCSF;
class XSFConfigDialog;
class XSFPlayer;
-#ifndef DEBUG
class XSFPlayer_NCSF;
-#endif
-#ifndef NDEBUG
struct SoundViewData
{
XSFConfig_NCSF *config;
@@ -41,14 +36,17 @@
std::fill_n(&this->channelLastStates[0], sizeof(this->channelLastStates), ChannelState::Start);
}
};
-#endif
class XSFConfig_NCSF : public XSFConfig
{
protected:
-#ifndef NDEBUG
- static constexpr bool initUseSoundViewDialog = true;
+ static constexpr bool initUseSoundViewDialog =
+#ifdef NDEBUG
+ false
+#else
+ true
#endif
+ ;
static constexpr unsigned initInterpolation = 4;
inline static const std::string initMutes = "0000000000000000";
@@ -65,20 +63,16 @@
void SaveSpecificConfigDialog(XSFConfigDialog *dialog) override;
void CopySpecificConfigToMemory(XSFPlayer *xSFPlayer, bool preLoad) override;
-#ifndef NDEBUG
bool useSoundViewDialog;
std::unique_ptr<SoundViewData> soundViewData;
static INT_PTR CALLBACK SoundViewDialogProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
-#endif
public:
void About(HWND parent) override;
XSFConfigDialog *CreateDialogBox(wxWindow *window, const std::string &title) override;
-#ifndef NDEBUG
void CallSoundView(XSFPlayer *xSFPlayer, HINSTANCE hInstance, HWND hwndParent);
void RefreshSoundView();
void CloseSoundView();
-#endif
};
--- a/src/in_ncsf/XSFPlayer_NCSF.cpp
+++ b/src/in_ncsf/XSFPlayer_NCSF.cpp
@@ -96,16 +96,12 @@
return this->RecursiveLoadNCSF(this->xSF.get(), 1);
}
-XSFPlayer_NCSF::XSFPlayer_NCSF(const std::filesystem::path &path) : XSFPlayer(), sseq(0), sdatData(), sdat(), player(), secondsPerSample(0), secondsIntoPlayback(0), secondsUntilNextClock(0), mutes()
-#ifndef NDEBUG
- , useSoundViewDialog(false)
-#endif
+XSFPlayer_NCSF::XSFPlayer_NCSF(const std::filesystem::path &path) : XSFPlayer(), sseq(0), sdatData(), sdat(), player(), secondsPerSample(0), secondsIntoPlayback(0), secondsUntilNextClock(0), mutes(), useSoundViewDialog(false)
{
this->uses32BitSamplesClampedTo16Bit = true;
this->xSF.reset(new XSFFile(path, 8, 12));
}
-#ifndef NDEBUG
static HANDLE soundViewThreadHandle = INVALID_HANDLE_VALUE;
static bool killSoundViewThread;
@@ -126,7 +122,6 @@
xSFConfig_NCSF->CloseSoundView();
return 0;
}
-#endif
XSFPlayer_NCSF::~XSFPlayer_NCSF()
{
@@ -138,13 +133,11 @@
if (!this->LoadNCSF())
return false;
-#ifndef NDEBUG
if (this->useSoundViewDialog)
{
killSoundViewThread = false;
soundViewThreadHandle = CreateThread(nullptr, 0, soundViewThread, this, 0, nullptr);
}
-#endif
PseudoFile file;
file.data = &this->sdatData;
@@ -221,7 +214,6 @@
{
this->player.Stop(true);
-#ifndef NDEBUG
if (soundViewThreadHandle != INVALID_HANDLE_VALUE)
{
killSoundViewThread = true;
@@ -233,15 +225,12 @@
CloseHandle(soundViewThreadHandle);
soundViewThreadHandle = INVALID_HANDLE_VALUE;
}
-#endif
-}
-
-#ifndef NDEBUG
+}
+
void XSFPlayer_NCSF::SetUseSoundViewDialog(bool newUseSoundViewDialog)
{
this->useSoundViewDialog = newUseSoundViewDialog;
}
-#endif
void XSFPlayer_NCSF::SetInterpolation(unsigned interpolation)
{
@@ -253,10 +242,8 @@
this->mutes = newMutes;
}
-#ifndef NDEBUG
const Channel &XSFPlayer_NCSF::GetChannel(std::size_t chanNum) const
{
return this->player.channels[chanNum];
}
-#endif
-
+
--- a/src/in_ncsf/XSFPlayer_NCSF.h
+++ b/src/in_ncsf/XSFPlayer_NCSF.h
@@ -15,9 +15,7 @@
#include <memory>
#include <string>
#include <vector>
-#ifndef NDEBUG
-# include <cstddef>
-#endif
+#include <cstddef>
#include <cstdint>
#include "XSFPlayer.h"
#include "SSEQPlayer/SDAT.h"
@@ -33,9 +31,7 @@
Player player;
double secondsPerSample, secondsIntoPlayback, secondsUntilNextClock;
std::bitset<16> mutes;
-#ifndef NDEBUG
bool useSoundViewDialog;
-#endif
void MapNCSFSection(const std::vector<std::uint8_t> §ion);
bool MapNCSF(XSFFile *xSFToLoad);
@@ -48,13 +44,9 @@
void GenerateSamples(std::vector<std::uint8_t> &buf, unsigned offset, unsigned samples) override;
void Terminate() override;
-#ifndef NDEBUG
void SetUseSoundViewDialog(bool newUseSoundViewDialog);
-#endif
void SetInterpolation(unsigned interpolation);
void SetMutes(const std::bitset<16> &newMutes);
-#ifndef NDEBUG
const Channel &GetChannel(std::size_t chanNum) const;
-#endif
};