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
... ...
@@ -14,46 +14,81 @@
14 14
 
15 15
 #include <cstdint>
16 16
 
17
-const uint32_t ARM7_CLOCK = 33513982;
18
-const double SecondsPerClockCycle = 64.0 * 2728.0 / ARM7_CLOCK;
17
+inline constexpr std::uint32_t ARM7_CLOCK = 33513982;
18
+inline constexpr double SecondsPerClockCycle = 64.0 * 2728.0 / ARM7_CLOCK;
19 19
 
20
-inline uint32_t BIT(uint32_t n) { return 1 << n; }
20
+inline std::uint32_t BIT(std::uint32_t n) { return 1 << n; }
21 21
 
22
-enum { TS_ALLOCBIT, TS_NOTEWAIT, TS_PORTABIT, TS_TIEBIT, TS_END, TS_BITS };
22
+enum class TrackState
23
+{
24
+	AllocateBit,
25
+	NoteWait,
26
+	PortamentoBit,
27
+	TieBit,
28
+	End,
29
+	Bits
30
+};
23 31
 
24
-enum { TUF_VOL, TUF_PAN, TUF_TIMER, TUF_MOD, TUF_LEN, TUF_BITS };
32
+enum class TrackUpdateFlag
33
+{
34
+	Volume,
35
+	Pan,
36
+	Timer,
37
+	Modulation,
38
+	Length,
39
+	Bits
40
+};
25 41
 
26
-enum { CS_NONE, CS_START, CS_ATTACK, CS_DECAY, CS_SUSTAIN, CS_RELEASE };
42
+enum class ChannelState
43
+{
44
+	None,
45
+	Start,
46
+	Attack,
47
+	Decay,
48
+	Sustain,
49
+	Release
50
+};
27 51
 
28
-enum { CF_UPDVOL, CF_UPDPAN, CF_UPDTMR, CF_BITS };
52
+enum class ChannelFlag
53
+{
54
+	UpdateVolume,
55
+	UpdatePan,
56
+	UpdateTimer,
57
+	Bits
58
+};
29 59
 
30
-enum { TYPE_PCM, TYPE_PSG, TYPE_NOISE };
60
+enum class ChannelAllocateType
61
+{
62
+	PCM,
63
+	PSG,
64
+	Noise
65
+};
31 66
 
32
-const int FSS_TRACKCOUNT = 16;
33
-const int FSS_MAXTRACKS = 32;
34
-const int FSS_TRACKSTACKSIZE = 3;
35
-const int AMPL_K = 723;
36
-const int AMPL_MIN = -AMPL_K;
37
-const int AMPL_THRESHOLD = AMPL_MIN * 128;
67
+inline constexpr int FSS_TRACKCOUNT = 16;
68
+inline constexpr int FSS_MAXTRACKS = 32;
69
+inline constexpr int FSS_TRACKSTACKSIZE = 3;
70
+inline constexpr int AMPL_K = 723;
71
+inline constexpr int AMPL_MIN = -AMPL_K;
72
+inline constexpr int AMPL_THRESHOLD = AMPL_MIN * 128;
38 73
 
39 74
 inline int SOUND_FREQ(int n) { return -0x1000000 / n; }
40 75
 
41
-inline uint32_t SOUND_VOL(int n) { return n; }
42
-inline uint32_t SOUND_VOLDIV(int n) { return n << 8; }
43
-inline uint32_t SOUND_PAN(int n) { return n << 16; }
44
-inline uint32_t SOUND_DUTY(int n) { return n << 24; }
45
-const uint32_t SOUND_REPEAT = BIT(27);
46
-const uint32_t SOUND_ONE_SHOT = BIT(28);
47
-inline uint32_t SOUND_LOOP(bool a) { return a ? SOUND_REPEAT : SOUND_ONE_SHOT; }
48
-const uint32_t SOUND_FORMAT_PSG = 3 << 29;
49
-inline uint32_t SOUND_FORMAT(int n) { return n << 29; }
50
-const uint32_t SCHANNEL_ENABLE = BIT(31);
51
-
52
-enum Interpolation
76
+inline std::uint32_t SOUND_VOL(int n) { return n; }
77
+inline std::uint32_t SOUND_VOLDIV(int n) { return n << 8; }
78
+inline std::uint32_t SOUND_PAN(int n) { return n << 16; }
79
+inline std::uint32_t SOUND_DUTY(int n) { return n << 24; }
80
+inline const std::uint32_t SOUND_REPEAT = BIT(27);
81
+inline const std::uint32_t SOUND_ONE_SHOT = BIT(28);
82
+inline std::uint32_t SOUND_LOOP(bool a) { return a ? SOUND_REPEAT : SOUND_ONE_SHOT; }
83
+inline constexpr std::uint32_t SOUND_FORMAT_PSG = 3 << 29;
84
+inline std::uint32_t SOUND_FORMAT(int n) { return n << 29; }
85
+inline const std::uint32_t SCHANNEL_ENABLE = BIT(31);
86
+
87
+enum class Interpolation
53 88
 {
54
-	INTERPOLATION_NONE,
55
-	INTERPOLATION_LINEAR,
56
-	INTERPOLATION_4POINTLEGRANGE,
57
-	INTERPOLATION_6POINTLEGRANGE,
58
-	INTERPOLATION_SINC
89
+	None,
90
+	Linear,
91
+	FourPointLegrange,
92
+	SixPointLegrange,
93
+	Sinc
59 94
 };
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
  * SSEQ Player - Constants/Macros
3 3
  * By Naram Qashat (CyberBotX) [cyberbotx@cyberbotx.com]
4
- * Last modification on 2014-09-08
5 4
  *
6 5
  * Adapted from source code of FeOS Sound System
7 6
  * By fincs
Browse code

fix mingw build, clean up new warnings

Adam Higerd authored on 2021/02/11 17:42:05
Showing 1 changed files
... ...
@@ -35,7 +35,7 @@ const int FSS_MAXTRACKS = 32;
35 35
 const int FSS_TRACKSTACKSIZE = 3;
36 36
 const int AMPL_K = 723;
37 37
 const int AMPL_MIN = -AMPL_K;
38
-const int AMPL_THRESHOLD = AMPL_MIN << 7;
38
+const int AMPL_THRESHOLD = AMPL_MIN * 128;
39 39
 
40 40
 inline int SOUND_FREQ(int n) { return -0x1000000 / n; }
41 41
 
Browse code

[NCSF] Interpolation changes:

* Removed Cosine, 4-Point B-Spline, 6-Point B-Spline, and 6-point
Osculating.
* Added 4-Point Legrange and 6-Point Legrange.
* Changed wording of the Sinc interpolation to mention that it is
16-point.

Naram Qashat authored on 2014/09/28 00:07:18
Showing 1 changed files
... ...
@@ -54,9 +54,7 @@ enum Interpolation
54 54
 {
55 55
 	INTERPOLATION_NONE,
56 56
 	INTERPOLATION_LINEAR,
57
-	INTERPOLATION_COSINE,
58
-	INTERPOLATION_4POINTBSPLINE,
59
-	INTERPOLATION_6POINTOSCULATING,
60
-	INTERPOLATION_6POINTBSPLINE,
57
+	INTERPOLATION_4POINTLEGRANGE,
58
+	INTERPOLATION_6POINTLEGRANGE,
61 59
 	INTERPOLATION_SINC
62 60
 };
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
  * SSEQ Player - Constants/Macros
3 3
  * By Naram Qashat (CyberBotX) [cyberbotx@cyberbotx.com]
4
- * Last modification on 2013-05-07
4
+ * Last modification on 2014-09-08
5 5
  *
6 6
  * Adapted from source code of FeOS Sound System
7 7
  * By fincs
... ...
@@ -11,8 +11,7 @@
11 11
  * http://devkitpro.org/
12 12
  */
13 13
 
14
-#ifndef SSEQPLAYER_CONSTS_H
15
-#define SSEQPLAYER_CONSTS_H
14
+#pragma once
16 15
 
17 16
 #include <cstdint>
18 17
 
... ...
@@ -61,5 +60,3 @@ enum Interpolation
61 60
 	INTERPOLATION_6POINTBSPLINE,
62 61
 	INTERPOLATION_SINC
63 62
 };
64
-
65
-#endif
Browse code

* Replaced Lanczos window with Hann window for the windowed sinc function in the NCSF plugin. * Added a ring buffer specifically designed for working with SWAVs to replace the one provided by kode54, still have to give him thanks for the original though. * Fixed clipping issue caused by invalid clamping values. * Minor fix to using the min()/max() functions of numeric_limits because Winamp's out.h includes windows.h without my specific wrapper to redefine things.

Naram Qashat authored on 2013/05/07 05:42:46
Showing 1 changed files
... ...
@@ -1,7 +1,7 @@
1 1
 /*
2 2
  * SSEQ Player - Constants/Macros
3 3
  * By Naram Qashat (CyberBotX) [cyberbotx@cyberbotx.com]
4
- * Last modification on 2013-04-26
4
+ * Last modification on 2013-05-07
5 5
  *
6 6
  * Adapted from source code of FeOS Sound System
7 7
  * By fincs
... ...
@@ -59,7 +59,7 @@ enum Interpolation
59 59
 	INTERPOLATION_4POINTBSPLINE,
60 60
 	INTERPOLATION_6POINTOSCULATING,
61 61
 	INTERPOLATION_6POINTBSPLINE,
62
-	INTERPOLATION_LANCZOS
62
+	INTERPOLATION_SINC
63 63
 };
64 64
 
65 65
 #endif
Browse code

Fixed up the Lanczos interpolation in NCSF (thanks to kode54), also allowed the NCSF plugin to use 32-bit samples in it's GenerateSamples function.

Naram Qashat authored on 2013/04/26 00:54:28
Showing 1 changed files
... ...
@@ -1,7 +1,7 @@
1 1
 /*
2 2
  * SSEQ Player - Constants/Macros
3 3
  * By Naram Qashat (CyberBotX) [cyberbotx@cyberbotx.com]
4
- * Last modification on 2013-04-23
4
+ * Last modification on 2013-04-26
5 5
  *
6 6
  * Adapted from source code of FeOS Sound System
7 7
  * By fincs
... ...
@@ -59,7 +59,7 @@ enum Interpolation
59 59
 	INTERPOLATION_4POINTBSPLINE,
60 60
 	INTERPOLATION_6POINTOSCULATING,
61 61
 	INTERPOLATION_6POINTBSPLINE,
62
-	INTERPOLATION_6POINTLANCZOS
62
+	INTERPOLATION_LANCZOS
63 63
 };
64 64
 
65 65
 #endif
Browse code

Added Lanczos interpolation to the NCSF plugin, and cleaned up a bit of the other code, as well as removing pstdint.h since it's no longer needed.

Naram Qashat authored on 2013/04/23 20:29:21
Showing 1 changed files
... ...
@@ -1,7 +1,7 @@
1 1
 /*
2 2
  * SSEQ Player - Constants/Macros
3 3
  * By Naram Qashat (CyberBotX) [cyberbotx@cyberbotx.com]
4
- * Last modification on 2013-04-12
4
+ * Last modification on 2013-04-23
5 5
  *
6 6
  * Adapted from source code of FeOS Sound System
7 7
  * By fincs
... ...
@@ -14,7 +14,7 @@
14 14
 #ifndef SSEQPLAYER_CONSTS_H
15 15
 #define SSEQPLAYER_CONSTS_H
16 16
 
17
-#include "pstdint.h"
17
+#include <cstdint>
18 18
 
19 19
 const uint32_t ARM7_CLOCK = 33513982;
20 20
 const double SecondsPerClockCycle = 64.0 * 2728.0 / ARM7_CLOCK;
... ...
@@ -58,7 +58,8 @@ enum Interpolation
58 58
 	INTERPOLATION_COSINE,
59 59
 	INTERPOLATION_4POINTBSPLINE,
60 60
 	INTERPOLATION_6POINTOSCULATING,
61
-	INTERPOLATION_6POINTBSPLINE
61
+	INTERPOLATION_6POINTBSPLINE,
62
+	INTERPOLATION_6POINTLANCZOS
62 63
 };
63 64
 
64 65
 #endif
Browse code

Removed the optimal, lagrange, and hermite interpolations and added in 2nd-order osculating.

Naram Qashat authored on 2013/04/12 10:25:49
Showing 1 changed files
... ...
@@ -1,7 +1,7 @@
1 1
 /*
2 2
  * SSEQ Player - Constants/Macros
3 3
  * By Naram Qashat (CyberBotX) [cyberbotx@cyberbotx.com]
4
- * Last modification on 2013-04-10
4
+ * Last modification on 2013-04-12
5 5
  *
6 6
  * Adapted from source code of FeOS Sound System
7 7
  * By fincs
... ...
@@ -56,15 +56,9 @@ enum Interpolation
56 56
 	INTERPOLATION_NONE,
57 57
 	INTERPOLATION_LINEAR,
58 58
 	INTERPOLATION_COSINE,
59
-	INTERPOLATION_2POINTOPTIMAL,
60
-	INTERPOLATION_4POINTHERMITE,
61
-	INTERPOLATION_4POINTLAGRANGE,
62 59
 	INTERPOLATION_4POINTBSPLINE,
63
-	INTERPOLATION_4POINTOPTIMAL,
64
-	INTERPOLATION_6POINTHERMITE,
65
-	INTERPOLATION_6POINTLAGRANGE,
66
-	INTERPOLATION_6POINTBSPLINE,
67
-	INTERPOLATION_6POINTOPTIMAL
60
+	INTERPOLATION_6POINTOSCULATING,
61
+	INTERPOLATION_6POINTBSPLINE
68 62
 };
69 63
 
70 64
 #endif
Browse code

* Added more interpolation methods to in_ncsf. * Cleaned up a little of the code in the Interpolate function in in_ncsf. * Made it so changes in the config can apply to a running song, depending on the player. * Slight optimization of in_ncsf's interpolation so it doesn't have as much std::vector accessing. * Stopped trying to use the slope of the points to determine points outside the sample's range, hopefully will stop some of the clipping.

Naram Qashat authored on 2013/04/10 14:39:59
Showing 1 changed files
... ...
@@ -1,7 +1,7 @@
1 1
 /*
2 2
  * SSEQ Player - Constants/Macros
3 3
  * By Naram Qashat (CyberBotX) [cyberbotx@cyberbotx.com]
4
- * Last modification on 2013-04-02
4
+ * Last modification on 2013-04-10
5 5
  *
6 6
  * Adapted from source code of FeOS Sound System
7 7
  * By fincs
... ...
@@ -51,6 +51,20 @@ const uint32_t SOUND_FORMAT_PSG = 3 << 29;
51 51
 inline uint32_t SOUND_FORMAT(int n) { return n << 29; }
52 52
 const uint32_t SCHANNEL_ENABLE = BIT(31);
53 53
 
54
-enum Interpolation { INTERPOLATION_NONE, INTERPOLATION_LINEAR, INTERPOLATION_COSINE, INTERPOLATION_BSPLINE, INTERPOLATION_HERMITE, INTERPOLATION_OPTIMAL };
54
+enum Interpolation
55
+{
56
+	INTERPOLATION_NONE,
57
+	INTERPOLATION_LINEAR,
58
+	INTERPOLATION_COSINE,
59
+	INTERPOLATION_2POINTOPTIMAL,
60
+	INTERPOLATION_4POINTHERMITE,
61
+	INTERPOLATION_4POINTLAGRANGE,
62
+	INTERPOLATION_4POINTBSPLINE,
63
+	INTERPOLATION_4POINTOPTIMAL,
64
+	INTERPOLATION_6POINTHERMITE,
65
+	INTERPOLATION_6POINTLAGRANGE,
66
+	INTERPOLATION_6POINTBSPLINE,
67
+	INTERPOLATION_6POINTOPTIMAL
68
+};
55 69
 
56 70
 #endif
Browse code

Added new interpolation methods, added version number in plugin description.

Naram Qashat authored on 2013/04/02 22:40:32
Showing 1 changed files
... ...
@@ -1,7 +1,7 @@
1 1
 /*
2 2
  * SSEQ Player - Constants/Macros
3 3
  * By Naram Qashat (CyberBotX) [cyberbotx@cyberbotx.com]
4
- * Last modification on 2013-03-21
4
+ * Last modification on 2013-04-02
5 5
  *
6 6
  * Adapted from source code of FeOS Sound System
7 7
  * By fincs
... ...
@@ -51,6 +51,6 @@ const uint32_t SOUND_FORMAT_PSG = 3 << 29;
51 51
 inline uint32_t SOUND_FORMAT(int n) { return n << 29; }
52 52
 const uint32_t SCHANNEL_ENABLE = BIT(31);
53 53
 
54
-enum Interpolation { INTERPOLATION_NONE, INTERPOLATION_LINEAR, INTERPOLATION_COSINE };
54
+enum Interpolation { INTERPOLATION_NONE, INTERPOLATION_LINEAR, INTERPOLATION_COSINE, INTERPOLATION_BSPLINE, INTERPOLATION_HERMITE, INTERPOLATION_OPTIMAL };
55 55
 
56 56
 #endif
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,56 @@
1
+/*
2
+ * SSEQ Player - Constants/Macros
3
+ * By Naram Qashat (CyberBotX) [cyberbotx@cyberbotx.com]
4
+ * Last modification on 2013-03-21
5
+ *
6
+ * Adapted from source code of FeOS Sound System
7
+ * By fincs
8
+ * https://github.com/fincs/FSS
9
+ *
10
+ * Some constants/macros also taken from libdns, part of the devkitARM portion of devkitPro
11
+ * http://devkitpro.org/
12
+ */
13
+
14
+#ifndef SSEQPLAYER_CONSTS_H
15
+#define SSEQPLAYER_CONSTS_H
16
+
17
+#include "pstdint.h"
18
+
19
+const uint32_t ARM7_CLOCK = 33513982;
20
+const double SecondsPerClockCycle = 64.0 * 2728.0 / ARM7_CLOCK;
21
+
22
+inline uint32_t BIT(uint32_t n) { return 1 << n; }
23
+
24
+enum { TS_ALLOCBIT, TS_NOTEWAIT, TS_PORTABIT, TS_TIEBIT, TS_END, TS_BITS };
25
+
26
+enum { TUF_VOL, TUF_PAN, TUF_TIMER, TUF_MOD, TUF_LEN, TUF_BITS };
27
+
28
+enum { CS_NONE, CS_START, CS_ATTACK, CS_DECAY, CS_SUSTAIN, CS_RELEASE };
29
+
30
+enum { CF_UPDVOL, CF_UPDPAN, CF_UPDTMR, CF_BITS };
31
+
32
+enum { TYPE_PCM, TYPE_PSG, TYPE_NOISE };
33
+
34
+const int FSS_TRACKCOUNT = 16;
35
+const int FSS_MAXTRACKS = 32;
36
+const int FSS_TRACKSTACKSIZE = 3;
37
+const int AMPL_K = 723;
38
+const int AMPL_MIN = -AMPL_K;
39
+const int AMPL_THRESHOLD = AMPL_MIN << 7;
40
+
41
+inline int SOUND_FREQ(int n) { return -0x1000000 / n; }
42
+
43
+inline uint32_t SOUND_VOL(int n) { return n; }
44
+inline uint32_t SOUND_VOLDIV(int n) { return n << 8; }
45
+inline uint32_t SOUND_PAN(int n) { return n << 16; }
46
+inline uint32_t SOUND_DUTY(int n) { return n << 24; }
47
+const uint32_t SOUND_REPEAT = BIT(27);
48
+const uint32_t SOUND_ONE_SHOT = BIT(28);
49
+inline uint32_t SOUND_LOOP(bool a) { return a ? SOUND_REPEAT : SOUND_ONE_SHOT; }
50
+const uint32_t SOUND_FORMAT_PSG = 3 << 29;
51
+inline uint32_t SOUND_FORMAT(int n) { return n << 29; }
52
+const uint32_t SCHANNEL_ENABLE = BIT(31);
53
+
54
+enum Interpolation { INTERPOLATION_NONE, INTERPOLATION_LINEAR, INTERPOLATION_COSINE };
55
+
56
+#endif