Browse code

Rename SBNKInstrument(Range) to SBNKInstrument(Entry).

(SBNKInstrument -> SBNKInstrumentEntry and SBNKIntrumentRange -> SBNKInstrument)
The old names didn't really make much sense when I started porting the creation tools code to C#, so might as well fix them here too.

Naram Qashat authored on 2021/03/21 03:26:56
Showing 1 changed files
... ...
@@ -16,7 +16,7 @@
16 16
 struct PseudoFile;
17 17
 struct SWAR;
18 18
 
19
-struct SBNKInstrumentRange
19
+struct SBNKInstrument
20 20
 {
21 21
 	std::uint8_t lowNote;
22 22
 	std::uint8_t highNote;
... ...
@@ -30,17 +30,17 @@ struct SBNKInstrumentRange
30 30
 	std::uint8_t releaseRate;
31 31
 	std::uint8_t pan;
32 32
 
33
-	SBNKInstrumentRange(std::uint8_t lowerNote, std::uint8_t upperNote, int recordType);
33
+	SBNKInstrument(std::uint8_t lowerNote, std::uint8_t upperNote, int recordType);
34 34
 
35 35
 	void Read(PseudoFile &file);
36 36
 };
37 37
 
38
-struct SBNKInstrument
38
+struct SBNKInstrumentEntry
39 39
 {
40 40
 	std::uint8_t record;
41
-	std::vector<SBNKInstrumentRange> ranges;
41
+	std::vector<SBNKInstrument> instruments;
42 42
 
43
-	SBNKInstrument();
43
+	SBNKInstrumentEntry();
44 44
 
45 45
 	void Read(PseudoFile &file, std::uint32_t startOffset);
46 46
 };
... ...
@@ -48,7 +48,7 @@ struct SBNKInstrument
48 48
 struct SBNK
49 49
 {
50 50
 	std::string filename;
51
-	std::vector<SBNKInstrument> instruments;
51
+	std::vector<SBNKInstrumentEntry> entries;
52 52
 
53 53
 	const SWAR *waveArc[4];
54 54
 	INFOEntryBANK info;
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
... ...
@@ -8,37 +8,41 @@
8 8
 
9 9
 #pragma once
10 10
 
11
-#include "SWAR.h"
11
+#include <string>
12
+#include <vector>
13
+#include <cstdint>
12 14
 #include "INFOEntry.h"
13
-#include "common.h"
15
+
16
+struct PseudoFile;
17
+struct SWAR;
14 18
 
15 19
 struct SBNKInstrumentRange
16 20
 {
17
-	uint8_t lowNote;
18
-	uint8_t highNote;
19
-	uint16_t record;
20
-	uint16_t swav;
21
-	uint16_t swar;
22
-	uint8_t noteNumber;
23
-	uint8_t attackRate;
24
-	uint8_t decayRate;
25
-	uint8_t sustainLevel;
26
-	uint8_t releaseRate;
27
-	uint8_t pan;
28
-
29
-	SBNKInstrumentRange(uint8_t lowerNote, uint8_t upperNote, int recordType);
21
+	std::uint8_t lowNote;
22
+	std::uint8_t highNote;
23
+	std::uint16_t record;
24
+	std::uint16_t swav;
25
+	std::uint16_t swar;
26
+	std::uint8_t noteNumber;
27
+	std::uint8_t attackRate;
28
+	std::uint8_t decayRate;
29
+	std::uint8_t sustainLevel;
30
+	std::uint8_t releaseRate;
31
+	std::uint8_t pan;
32
+
33
+	SBNKInstrumentRange(std::uint8_t lowerNote, std::uint8_t upperNote, int recordType);
30 34
 
31 35
 	void Read(PseudoFile &file);
32 36
 };
33 37
 
34 38
 struct SBNKInstrument
35 39
 {
36
-	uint8_t record;
40
+	std::uint8_t record;
37 41
 	std::vector<SBNKInstrumentRange> ranges;
38 42
 
39 43
 	SBNKInstrument();
40 44
 
41
-	void Read(PseudoFile &file, uint32_t startOffset);
45
+	void Read(PseudoFile &file, std::uint32_t startOffset);
42 46
 };
43 47
 
44 48
 struct SBNK
Browse code

Remove the copy constructors from SBNK, SDAT and SSEQ.

(They were probably holdovers from copying the code from the NCSF creation tools.)

Naram Qashat authored on 2021/03/19 15:54:35
Showing 1 changed files
... ...
@@ -50,8 +50,6 @@ struct SBNK
50 50
 	INFOEntryBANK info;
51 51
 
52 52
 	SBNK(const std::string &fn = "");
53
-	SBNK(const SBNK &sbnk);
54
-	SBNK &operator=(const SBNK &sbnk);
55 53
 
56 54
 	void Read(PseudoFile &file);
57 55
 };
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 - SDAT SBNK (Sound Bank) structures
3 3
  * By Naram Qashat (CyberBotX) [cyberbotx@cyberbotx.com]
4
- * Last modification on 2014-09-08
5 4
  *
6 5
  * Nintendo DS Nitro Composer (SDAT) Specification document found at
7 6
  * http://www.feshrine.net/hacking/doc/nds-sdat.html
Browse code

Use #pragma once instead of include guards.

Naram Qashat authored on 2014/09/08 14:47:36
Showing 1 changed files
... ...
@@ -1,14 +1,13 @@
1 1
 /*
2 2
  * SSEQ Player - SDAT SBNK (Sound Bank) structures
3 3
  * By Naram Qashat (CyberBotX) [cyberbotx@cyberbotx.com]
4
- * Last modification on 2013-03-21
4
+ * Last modification on 2014-09-08
5 5
  *
6 6
  * Nintendo DS Nitro Composer (SDAT) Specification document found at
7 7
  * http://www.feshrine.net/hacking/doc/nds-sdat.html
8 8
  */
9 9
 
10
-#ifndef SSEQPLAYER_SBNK_H
11
-#define SSEQPLAYER_SBNK_H
10
+#pragma once
12 11
 
13 12
 #include "SWAR.h"
14 13
 #include "INFOEntry.h"
... ...
@@ -57,5 +56,3 @@ struct SBNK
57 56
 
58 57
 	void Read(PseudoFile &file);
59 58
 };
60
-
61
-#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,61 @@
1
+/*
2
+ * SSEQ Player - SDAT SBNK (Sound Bank) structures
3
+ * By Naram Qashat (CyberBotX) [cyberbotx@cyberbotx.com]
4
+ * Last modification on 2013-03-21
5
+ *
6
+ * Nintendo DS Nitro Composer (SDAT) Specification document found at
7
+ * http://www.feshrine.net/hacking/doc/nds-sdat.html
8
+ */
9
+
10
+#ifndef SSEQPLAYER_SBNK_H
11
+#define SSEQPLAYER_SBNK_H
12
+
13
+#include "SWAR.h"
14
+#include "INFOEntry.h"
15
+#include "common.h"
16
+
17
+struct SBNKInstrumentRange
18
+{
19
+	uint8_t lowNote;
20
+	uint8_t highNote;
21
+	uint16_t record;
22
+	uint16_t swav;
23
+	uint16_t swar;
24
+	uint8_t noteNumber;
25
+	uint8_t attackRate;
26
+	uint8_t decayRate;
27
+	uint8_t sustainLevel;
28
+	uint8_t releaseRate;
29
+	uint8_t pan;
30
+
31
+	SBNKInstrumentRange(uint8_t lowerNote, uint8_t upperNote, int recordType);
32
+
33
+	void Read(PseudoFile &file);
34
+};
35
+
36
+struct SBNKInstrument
37
+{
38
+	uint8_t record;
39
+	std::vector<SBNKInstrumentRange> ranges;
40
+
41
+	SBNKInstrument();
42
+
43
+	void Read(PseudoFile &file, uint32_t startOffset);
44
+};
45
+
46
+struct SBNK
47
+{
48
+	std::string filename;
49
+	std::vector<SBNKInstrument> instruments;
50
+
51
+	const SWAR *waveArc[4];
52
+	INFOEntryBANK info;
53
+
54
+	SBNK(const std::string &fn = "");
55
+	SBNK(const SBNK &sbnk);
56
+	SBNK &operator=(const SBNK &sbnk);
57
+
58
+	void Read(PseudoFile &file);
59
+};
60
+
61
+#endif