Browse code

Replace the Sound View dialog with a wxWidgets-based one.

* 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.

Naram Qashat authored on 2021/04/10 15:19:43
Showing 1 changed files
... ...
@@ -17,9 +17,9 @@
17 17
 #include <vector>
18 18
 #include <cstddef>
19 19
 #include <cstdint>
20
-#include "XSFPlayer.h"
21
-#include "SSEQPlayer/SDAT.h"
22 20
 #include "SSEQPlayer/Player.h"
21
+#include "SSEQPlayer/SDAT.h"
22
+#include "XSFPlayer.h"
23 23
 
24 24
 class XSFFile;
25 25
 
Browse code

Make the NCSF Sound View dialog always available.

(Before it was only available under Debug builds.)

Naram Qashat authored on 2021/04/06 22:29:00
Showing 1 changed files
... ...
@@ -15,9 +15,7 @@
15 15
 #include <memory>
16 16
 #include <string>
17 17
 #include <vector>
18
-#ifndef NDEBUG
19
-# include <cstddef>
20
-#endif
18
+#include <cstddef>
21 19
 #include <cstdint>
22 20
 #include "XSFPlayer.h"
23 21
 #include "SSEQPlayer/SDAT.h"
... ...
@@ -33,9 +31,7 @@ class XSFPlayer_NCSF : public XSFPlayer
33 31
 	Player player;
34 32
 	double secondsPerSample, secondsIntoPlayback, secondsUntilNextClock;
35 33
 	std::bitset<16> mutes;
36
-#ifndef NDEBUG
37 34
 	bool useSoundViewDialog;
38
-#endif
39 35
 
40 36
 	void MapNCSFSection(const std::vector<std::uint8_t> &section);
41 37
 	bool MapNCSF(XSFFile *xSFToLoad);
... ...
@@ -48,12 +44,8 @@ public:
48 44
 	void GenerateSamples(std::vector<std::uint8_t> &buf, unsigned offset, unsigned samples) override;
49 45
 	void Terminate() override;
50 46
 
51
-#ifndef NDEBUG
52 47
 	void SetUseSoundViewDialog(bool newUseSoundViewDialog);
53
-#endif
54 48
 	void SetInterpolation(unsigned interpolation);
55 49
 	void SetMutes(const std::bitset<16> &newMutes);
56
-#ifndef NDEBUG
57 50
 	const Channel &GetChannel(std::size_t chanNum) const;
58
-#endif
59 51
 };
Browse code

Use std::filesystem::path for reading/writing files.

Also remove fstream_wfopen.h as it is no longer needed.
Also make XSFFile not store the string of the path but store the path as std::filesystem::path.

Naram Qashat authored on 2021/04/05 00:20:56
Showing 1 changed files
... ...
@@ -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>
... ...
@@ -41,10 +42,7 @@ class XSFPlayer_NCSF : public XSFPlayer
41 42
 	bool RecursiveLoadNCSF(XSFFile *xSFToLoad, int level);
42 43
 	bool LoadNCSF();
43 44
 public:
44
-	XSFPlayer_NCSF(const std::string &filename);
45
-#ifdef _WIN32
46
-	XSFPlayer_NCSF(const std::wstring &filename);
47
-#endif
45
+	XSFPlayer_NCSF(const std::filesystem::path &path);
48 46
 	~XSFPlayer_NCSF() override;
49 47
 	bool Load() override;
50 48
 	void GenerateSamples(std::vector<std::uint8_t> &buf, unsigned offset, unsigned samples) override;
Browse code

Add warnings to building with GCC/Clang.

* These were mostly copied from the old Makefile.
* The files including wxWidgets need -Wno-old-style-cast done in the code via pragmas because I do not want to disable that warning for the rest of the files. (It might've been overkill for some places where wxWidgets was included, but whatever.)

Naram Qashat authored on 2021/04/04 23:35:09
Showing 1 changed files
... ...
@@ -31,10 +31,10 @@ class XSFPlayer_NCSF : public XSFPlayer
31 31
 	std::unique_ptr<SDAT> sdat;
32 32
 	Player player;
33 33
 	double secondsPerSample, secondsIntoPlayback, secondsUntilNextClock;
34
+	std::bitset<16> mutes;
34 35
 #ifndef NDEBUG
35 36
 	bool useSoundViewDialog;
36 37
 #endif
37
-	std::bitset<16> mutes;
38 38
 
39 39
 	void MapNCSFSection(const std::vector<std::uint8_t> &section);
40 40
 	bool MapNCSF(XSFFile *xSFToLoad);
Browse code

Add wxWidgets-based configuration dialog boxes.

* 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.

Naram Qashat authored on 2021/04/04 12:46:14
Showing 1 changed files
... ...
@@ -22,6 +22,8 @@
22 22
 #include "SSEQPlayer/SDAT.h"
23 23
 #include "SSEQPlayer/Player.h"
24 24
 
25
+class XSFFile;
26
+
25 27
 class XSFPlayer_NCSF : public XSFPlayer
26 28
 {
27 29
 	std::uint32_t sseq;
... ...
@@ -29,6 +31,9 @@ class XSFPlayer_NCSF : public XSFPlayer
29 31
 	std::unique_ptr<SDAT> sdat;
30 32
 	Player player;
31 33
 	double secondsPerSample, secondsIntoPlayback, secondsUntilNextClock;
34
+#ifndef NDEBUG
35
+	bool useSoundViewDialog;
36
+#endif
32 37
 	std::bitset<16> mutes;
33 38
 
34 39
 	void MapNCSFSection(const std::vector<std::uint8_t> &section);
... ...
@@ -45,6 +50,9 @@ public:
45 50
 	void GenerateSamples(std::vector<std::uint8_t> &buf, unsigned offset, unsigned samples) override;
46 51
 	void Terminate() override;
47 52
 
53
+#ifndef NDEBUG
54
+	void SetUseSoundViewDialog(bool newUseSoundViewDialog);
55
+#endif
48 56
 	void SetInterpolation(unsigned interpolation);
49 57
 	void SetMutes(const std::bitset<16> &newMutes);
50 58
 #ifndef NDEBUG
Browse code

Replace #ifdef _DEBUG with #ifndef NDEBUG

Naram Qashat authored on 2021/04/03 11:24:08
Showing 1 changed files
... ...
@@ -14,7 +14,7 @@
14 14
 #include <memory>
15 15
 #include <string>
16 16
 #include <vector>
17
-#ifdef _DEBUG
17
+#ifndef NDEBUG
18 18
 # include <cstddef>
19 19
 #endif
20 20
 #include <cstdint>
... ...
@@ -47,7 +47,7 @@ public:
47 47
 
48 48
 	void SetInterpolation(unsigned interpolation);
49 49
 	void SetMutes(const std::bitset<16> &newMutes);
50
-#ifdef _DEBUG
50
+#ifndef NDEBUG
51 51
 	const Channel &GetChannel(std::size_t chanNum) const;
52 52
 #endif
53 53
 };
Browse code

Add override keyword.

Naram Qashat authored on 2021/03/30 01:29:32
Showing 1 changed files
... ...
@@ -40,10 +40,10 @@ public:
40 40
 #ifdef _WIN32
41 41
 	XSFPlayer_NCSF(const std::wstring &filename);
42 42
 #endif
43
-	~XSFPlayer_NCSF();
44
-	bool Load();
45
-	void GenerateSamples(std::vector<std::uint8_t> &buf, unsigned offset, unsigned samples);
46
-	void Terminate();
43
+	~XSFPlayer_NCSF() override;
44
+	bool Load() override;
45
+	void GenerateSamples(std::vector<std::uint8_t> &buf, unsigned offset, unsigned samples) override;
46
+	void Terminate() override;
47 47
 
48 48
 	void SetInterpolation(unsigned interpolation);
49 49
 	void SetMutes(const std::bitset<16> &newMutes);
Browse code

Various changes:

* 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().

Naram Qashat authored on 2021/03/21 03:16:45
Showing 1 changed files
... ...
@@ -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> &section);
34
+	void MapNCSFSection(const std::vector<std::uint8_t> &section);
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
 };
Browse code

Remove last modification date from files.

(I never remember to update these and besides, GitHub history can show when they were last modified.)

Naram Qashat authored on 2021/03/19 10:58:12
Showing 1 changed files
... ...
@@ -1,7 +1,6 @@
1 1
 /*
2 2
  * xSF - NCSF Player
3 3
  * By Naram Qashat (CyberBotX) [cyberbotx@cyberbotx.com]
4
- * Last modification on 2014-10-18
5 4
  *
6 5
  * Partially based on the vio*sf framework
7 6
  *
Browse code

[NCSF] Correctly handle the SSEQ volume from the INFO block.

Naram Qashat authored on 2014/10/18 04:20:53
Showing 1 changed files
... ...
@@ -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
 
Browse code

[NCSF] Fix volume issues with a little help from the Nintendo DS SDK.

Also added a clone of DeSmuME's Sound View that is only build during a
debug build, which helped to identify the above issues.

Naram Qashat authored on 2014/10/05 20:00:09
Showing 1 changed files
... ...
@@ -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
 };
Browse code

Lots of changes in regards to strings, as follows:

* 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.

Naram Qashat authored on 2014/09/24 13:58:55
Showing 1 changed files
... ...
@@ -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();
Browse code

* Fixes for gcc and clang (while they can compile the code, the DLLs made aren't functional, but oh well).

* [2SF] Used more up-to-date asmjit, despite the ugly looking code.

Naram Qashat authored on 2014/09/17 19:51:45
Showing 1 changed files
... ...
@@ -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();
Browse code

Use #pragma once instead of include guards.

Naram Qashat authored on 2014/09/08 14:47:36
Showing 1 changed files
... ...
@@ -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
Browse code

Utilize SSEQ's volume from it's INFO section, plus some minor optimizations.

Naram Qashat authored on 2013/04/07 16:39:00
Showing 1 changed files
... ...
@@ -24,6 +24,7 @@ class XSFPlayer_NCSF : public XSFPlayer
24 24
 	std::vector<uint8_t> sdatData;
25 25
 	std::unique_ptr<SDAT> sdat;
26 26
 	Player player;
27
+	uint8_t sseqVol;
27 28
 	double secondsPerSample, secondsIntoPlayback, secondsUntilNextClock;
28 29
 	std::bitset<16> mutes;
29 30
 
Browse code

Corrected issue with terminating the SSEQ player by actually making it stop properly.

Naram Qashat authored on 2013/04/02 03:03:26
Showing 1 changed files
... ...
@@ -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);
Browse code

Cleanup of some warnings, updating modification dates, using nullptr instead of NULL in some cases.

Naram Qashat authored on 2013/03/30 16:17:42
Showing 1 changed files
... ...
@@ -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-21
4
+ * Last modification on 2013-03-30
5 5
  *
6 6
  * Partially based on the vio*sf framework
7 7
  *
Browse code

Utilized more C++11 constructs. Also attempted to fix issue with the Info Box not wanting to come up anymore if the file doesn't exist.

Naram Qashat authored on 2013/03/30 07:36:38
Showing 1 changed files
... ...
@@ -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;
Browse code

Import actual code.

Naram Qashat authored on 2013/03/26 02:41:19
Showing 1 changed files
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> &section);
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