| ... | ... |
@@ -38,10 +38,10 @@ class XSFPlayer_NCSF : public XSFPlayer |
| 38 | 38 |
bool LoadNCSF(); |
| 39 | 39 |
public: |
| 40 | 40 |
XSFPlayer_NCSF(const std::filesystem::path &path); |
| 41 |
- ~XSFPlayer_NCSF(); |
|
| 42 |
- bool Load(); |
|
| 43 |
- void GenerateSamples(std::vector<std::uint8_t> &buf, unsigned offset, unsigned samples); |
|
| 44 |
- void Terminate(); |
|
| 41 |
+ ~XSFPlayer_NCSF() override; |
|
| 42 |
+ bool Load() override; |
|
| 43 |
+ void GenerateSamples(std::vector<std::uint8_t> &buf, unsigned offset, unsigned samples) override; |
|
| 44 |
+ void Terminate() override; |
|
| 45 | 45 |
|
| 46 | 46 |
void SetInterpolation(unsigned interpolation); |
| 47 | 47 |
void SetMutes(const std::bitset<16> &newMutes); |
| ... | ... |
@@ -11,6 +11,7 @@ |
| 11 | 11 |
#pragma once |
| 12 | 12 |
|
| 13 | 13 |
#include <bitset> |
| 14 |
+#include <filesystem> |
|
| 14 | 15 |
#include <memory> |
| 15 | 16 |
#include <string> |
| 16 | 17 |
#include <vector> |
| ... | ... |
@@ -36,10 +37,7 @@ class XSFPlayer_NCSF : public XSFPlayer |
| 36 | 37 |
bool RecursiveLoadNCSF(XSFFile *xSFToLoad, int level); |
| 37 | 38 |
bool LoadNCSF(); |
| 38 | 39 |
public: |
| 39 |
- XSFPlayer_NCSF(const std::string &filename); |
|
| 40 |
-#ifdef _WIN32 |
|
| 41 |
- XSFPlayer_NCSF(const std::wstring &filename); |
|
| 42 |
-#endif |
|
| 40 |
+ XSFPlayer_NCSF(const std::filesystem::path &path); |
|
| 43 | 41 |
~XSFPlayer_NCSF(); |
| 44 | 42 |
bool Load(); |
| 45 | 43 |
void GenerateSamples(std::vector<std::uint8_t> &buf, unsigned offset, unsigned samples); |
* 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().
| ... | ... |
@@ -10,22 +10,28 @@ |
| 10 | 10 |
|
| 11 | 11 |
#pragma once |
| 12 | 12 |
|
| 13 |
-#include <memory> |
|
| 14 | 13 |
#include <bitset> |
| 14 |
+#include <memory> |
|
| 15 |
+#include <string> |
|
| 16 |
+#include <vector> |
|
| 17 |
+#ifdef _DEBUG |
|
| 18 |
+# include <cstddef> |
|
| 19 |
+#endif |
|
| 20 |
+#include <cstdint> |
|
| 15 | 21 |
#include "XSFPlayer.h" |
| 16 | 22 |
#include "SSEQPlayer/SDAT.h" |
| 17 | 23 |
#include "SSEQPlayer/Player.h" |
| 18 | 24 |
|
| 19 | 25 |
class XSFPlayer_NCSF : public XSFPlayer |
| 20 | 26 |
{
|
| 21 |
- uint32_t sseq; |
|
| 22 |
- std::vector<uint8_t> sdatData; |
|
| 27 |
+ std::uint32_t sseq; |
|
| 28 |
+ std::vector<std::uint8_t> sdatData; |
|
| 23 | 29 |
std::unique_ptr<SDAT> sdat; |
| 24 | 30 |
Player player; |
| 25 | 31 |
double secondsPerSample, secondsIntoPlayback, secondsUntilNextClock; |
| 26 | 32 |
std::bitset<16> mutes; |
| 27 | 33 |
|
| 28 |
- void MapNCSFSection(const std::vector<uint8_t> §ion); |
|
| 34 |
+ void MapNCSFSection(const std::vector<std::uint8_t> §ion); |
|
| 29 | 35 |
bool MapNCSF(XSFFile *xSFToLoad); |
| 30 | 36 |
bool RecursiveLoadNCSF(XSFFile *xSFToLoad, int level); |
| 31 | 37 |
bool LoadNCSF(); |
| ... | ... |
@@ -36,12 +42,12 @@ public: |
| 36 | 42 |
#endif |
| 37 | 43 |
~XSFPlayer_NCSF(); |
| 38 | 44 |
bool Load(); |
| 39 |
- void GenerateSamples(std::vector<uint8_t> &buf, unsigned offset, unsigned samples); |
|
| 45 |
+ void GenerateSamples(std::vector<std::uint8_t> &buf, unsigned offset, unsigned samples); |
|
| 40 | 46 |
void Terminate(); |
| 41 | 47 |
|
| 42 | 48 |
void SetInterpolation(unsigned interpolation); |
| 43 | 49 |
void SetMutes(const std::bitset<16> &newMutes); |
| 44 | 50 |
#ifdef _DEBUG |
| 45 |
- const Channel &GetChannel(size_t chanNum) const; |
|
| 51 |
+ const Channel &GetChannel(std::size_t chanNum) const; |
|
| 46 | 52 |
#endif |
| 47 | 53 |
}; |
(I never remember to update these and besides, GitHub history can show when they were last modified.)
| ... | ... |
@@ -1,7 +1,7 @@ |
| 1 | 1 |
/* |
| 2 | 2 |
* xSF - NCSF Player |
| 3 | 3 |
* By Naram Qashat (CyberBotX) [cyberbotx@cyberbotx.com] |
| 4 |
- * Last modification on 2014-10-05 |
|
| 4 |
+ * Last modification on 2014-10-18 |
|
| 5 | 5 |
* |
| 6 | 6 |
* Partially based on the vio*sf framework |
| 7 | 7 |
* |
| ... | ... |
@@ -23,7 +23,6 @@ class XSFPlayer_NCSF : public XSFPlayer |
| 23 | 23 |
std::vector<uint8_t> sdatData; |
| 24 | 24 |
std::unique_ptr<SDAT> sdat; |
| 25 | 25 |
Player player; |
| 26 |
- uint8_t sseqVol; |
|
| 27 | 26 |
double secondsPerSample, secondsIntoPlayback, secondsUntilNextClock; |
| 28 | 27 |
std::bitset<16> mutes; |
| 29 | 28 |
|
Also added a clone of DeSmuME's Sound View that is only build during a
debug build, which helped to identify the above issues.
| ... | ... |
@@ -1,7 +1,7 @@ |
| 1 | 1 |
/* |
| 2 | 2 |
* xSF - NCSF Player |
| 3 | 3 |
* By Naram Qashat (CyberBotX) [cyberbotx@cyberbotx.com] |
| 4 |
- * Last modification on 2014-09-24 |
|
| 4 |
+ * Last modification on 2014-10-05 |
|
| 5 | 5 |
* |
| 6 | 6 |
* Partially based on the vio*sf framework |
| 7 | 7 |
* |
| ... | ... |
@@ -36,10 +36,14 @@ public: |
| 36 | 36 |
#ifdef _WIN32 |
| 37 | 37 |
XSFPlayer_NCSF(const std::wstring &filename); |
| 38 | 38 |
#endif |
| 39 |
+ ~XSFPlayer_NCSF(); |
|
| 39 | 40 |
bool Load(); |
| 40 | 41 |
void GenerateSamples(std::vector<uint8_t> &buf, unsigned offset, unsigned samples); |
| 41 | 42 |
void Terminate(); |
| 42 | 43 |
|
| 43 | 44 |
void SetInterpolation(unsigned interpolation); |
| 44 | 45 |
void SetMutes(const std::bitset<16> &newMutes); |
| 46 |
+#ifdef _DEBUG |
|
| 47 |
+ const Channel &GetChannel(size_t chanNum) const; |
|
| 48 |
+#endif |
|
| 45 | 49 |
}; |
* 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 - NCSF Player |
| 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 |
* |
| ... | ... |
@@ -33,7 +33,7 @@ class XSFPlayer_NCSF : public XSFPlayer |
| 33 | 33 |
bool LoadNCSF(); |
| 34 | 34 |
public: |
| 35 | 35 |
XSFPlayer_NCSF(const std::string &filename); |
| 36 |
-#ifdef _MSC_VER |
|
| 36 |
+#ifdef _WIN32 |
|
| 37 | 37 |
XSFPlayer_NCSF(const std::wstring &filename); |
| 38 | 38 |
#endif |
| 39 | 39 |
bool Load(); |
* [2SF] Used more up-to-date asmjit, despite the ugly looking code.
| ... | ... |
@@ -1,7 +1,7 @@ |
| 1 | 1 |
/* |
| 2 | 2 |
* xSF - NCSF Player |
| 3 | 3 |
* By Naram Qashat (CyberBotX) [cyberbotx@cyberbotx.com] |
| 4 |
- * Last modification on 2014-09-08 |
|
| 4 |
+ * Last modification on 2014-09-17 |
|
| 5 | 5 |
* |
| 6 | 6 |
* Partially based on the vio*sf framework |
| 7 | 7 |
* |
| ... | ... |
@@ -33,7 +33,9 @@ class XSFPlayer_NCSF : public XSFPlayer |
| 33 | 33 |
bool LoadNCSF(); |
| 34 | 34 |
public: |
| 35 | 35 |
XSFPlayer_NCSF(const std::string &filename); |
| 36 |
+#ifdef _MSC_VER |
|
| 36 | 37 |
XSFPlayer_NCSF(const std::wstring &filename); |
| 38 |
+#endif |
|
| 37 | 39 |
bool Load(); |
| 38 | 40 |
void GenerateSamples(std::vector<uint8_t> &buf, unsigned offset, unsigned samples); |
| 39 | 41 |
void Terminate(); |
| ... | ... |
@@ -1,7 +1,7 @@ |
| 1 | 1 |
/* |
| 2 | 2 |
* xSF - NCSF Player |
| 3 | 3 |
* By Naram Qashat (CyberBotX) [cyberbotx@cyberbotx.com] |
| 4 |
- * Last modification on 2013-04-01 |
|
| 4 |
+ * Last modification on 2014-09-08 |
|
| 5 | 5 |
* |
| 6 | 6 |
* Partially based on the vio*sf framework |
| 7 | 7 |
* |
| ... | ... |
@@ -9,8 +9,7 @@ |
| 9 | 9 |
* https://github.com/fincs/FSS |
| 10 | 10 |
*/ |
| 11 | 11 |
|
| 12 |
-#ifndef XSFPLAYER_NCSF_H |
|
| 13 |
-#define XSFPLAYER_NCSF_H |
|
| 12 |
+#pragma once |
|
| 14 | 13 |
|
| 15 | 14 |
#include <memory> |
| 16 | 15 |
#include <bitset> |
| ... | ... |
@@ -42,5 +41,3 @@ public: |
| 42 | 41 |
void SetInterpolation(unsigned interpolation); |
| 43 | 42 |
void SetMutes(const std::bitset<16> &newMutes); |
| 44 | 43 |
}; |
| 45 |
- |
|
| 46 |
-#endif |
| ... | ... |
@@ -1,7 +1,7 @@ |
| 1 | 1 |
/* |
| 2 | 2 |
* xSF - NCSF Player |
| 3 | 3 |
* By Naram Qashat (CyberBotX) [cyberbotx@cyberbotx.com] |
| 4 |
- * Last modification on 2013-03-30 |
|
| 4 |
+ * Last modification on 2013-04-01 |
|
| 5 | 5 |
* |
| 6 | 6 |
* Partially based on the vio*sf framework |
| 7 | 7 |
* |
| ... | ... |
@@ -36,7 +36,7 @@ public: |
| 36 | 36 |
XSFPlayer_NCSF(const std::wstring &filename); |
| 37 | 37 |
bool Load(); |
| 38 | 38 |
void GenerateSamples(std::vector<uint8_t> &buf, unsigned offset, unsigned samples); |
| 39 |
- void Terminate() { }
|
|
| 39 |
+ void Terminate(); |
|
| 40 | 40 |
|
| 41 | 41 |
void SetInterpolation(unsigned interpolation); |
| 42 | 42 |
void SetMutes(const std::bitset<16> &newMutes); |
| ... | ... |
@@ -22,7 +22,7 @@ class XSFPlayer_NCSF : public XSFPlayer |
| 22 | 22 |
{
|
| 23 | 23 |
uint32_t sseq; |
| 24 | 24 |
std::vector<uint8_t> sdatData; |
| 25 |
- std::auto_ptr<SDAT> sdat; |
|
| 25 |
+ std::unique_ptr<SDAT> sdat; |
|
| 26 | 26 |
Player player; |
| 27 | 27 |
double secondsPerSample, secondsIntoPlayback, secondsUntilNextClock; |
| 28 | 28 |
std::bitset<16> mutes; |
| 1 | 1 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,45 @@ |
| 1 |
+/* |
|
| 2 |
+ * xSF - NCSF Player |
|
| 3 |
+ * By Naram Qashat (CyberBotX) [cyberbotx@cyberbotx.com] |
|
| 4 |
+ * Last modification on 2013-03-21 |
|
| 5 |
+ * |
|
| 6 |
+ * Partially based on the vio*sf framework |
|
| 7 |
+ * |
|
| 8 |
+ * Utilizes a modified FeOS Sound System for playback |
|
| 9 |
+ * https://github.com/fincs/FSS |
|
| 10 |
+ */ |
|
| 11 |
+ |
|
| 12 |
+#ifndef XSFPLAYER_NCSF_H |
|
| 13 |
+#define XSFPLAYER_NCSF_H |
|
| 14 |
+ |
|
| 15 |
+#include <memory> |
|
| 16 |
+#include <bitset> |
|
| 17 |
+#include "XSFPlayer.h" |
|
| 18 |
+#include "SSEQPlayer/SDAT.h" |
|
| 19 |
+#include "SSEQPlayer/Player.h" |
|
| 20 |
+ |
|
| 21 |
+class XSFPlayer_NCSF : public XSFPlayer |
|
| 22 |
+{
|
|
| 23 |
+ uint32_t sseq; |
|
| 24 |
+ std::vector<uint8_t> sdatData; |
|
| 25 |
+ std::auto_ptr<SDAT> sdat; |
|
| 26 |
+ Player player; |
|
| 27 |
+ double secondsPerSample, secondsIntoPlayback, secondsUntilNextClock; |
|
| 28 |
+ std::bitset<16> mutes; |
|
| 29 |
+ |
|
| 30 |
+ void MapNCSFSection(const std::vector<uint8_t> §ion); |
|
| 31 |
+ bool MapNCSF(XSFFile *xSFToLoad); |
|
| 32 |
+ bool RecursiveLoadNCSF(XSFFile *xSFToLoad, int level); |
|
| 33 |
+ bool LoadNCSF(); |
|
| 34 |
+public: |
|
| 35 |
+ XSFPlayer_NCSF(const std::string &filename); |
|
| 36 |
+ XSFPlayer_NCSF(const std::wstring &filename); |
|
| 37 |
+ bool Load(); |
|
| 38 |
+ void GenerateSamples(std::vector<uint8_t> &buf, unsigned offset, unsigned samples); |
|
| 39 |
+ void Terminate() { }
|
|
| 40 |
+ |
|
| 41 |
+ void SetInterpolation(unsigned interpolation); |
|
| 42 |
+ void SetMutes(const std::bitset<16> &newMutes); |
|
| 43 |
+}; |
|
| 44 |
+ |
|
| 45 |
+#endif |