* 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,26 +10,29 @@ |
| 10 | 10 |
#pragma once |
| 11 | 11 |
|
| 12 | 12 |
#include <bitset> |
| 13 |
-#include "SSEQ.h" |
|
| 14 |
-#include "Track.h" |
|
| 13 |
+#include <cstdint> |
|
| 15 | 14 |
#include "Channel.h" |
| 15 |
+#include "Track.h" |
|
| 16 | 16 |
#include "consts.h" |
| 17 | 17 |
|
| 18 |
+enum class ChannelAllocateType; |
|
| 19 |
+struct SSEQ; |
|
| 20 |
+ |
|
| 18 | 21 |
struct Player |
| 19 | 22 |
{
|
| 20 |
- uint8_t prio, nTracks; |
|
| 21 |
- uint16_t tempo, tempoCount, tempoRate /* 8.8 fixed point */; |
|
| 22 |
- int16_t masterVol, sseqVol; |
|
| 23 |
+ std::uint8_t prio, nTracks; |
|
| 24 |
+ std::uint16_t tempo, tempoCount, tempoRate /* 8.8 fixed point */; |
|
| 25 |
+ std::int16_t masterVol, sseqVol; |
|
| 23 | 26 |
|
| 24 | 27 |
const SSEQ *sseq; |
| 25 | 28 |
|
| 26 |
- uint8_t trackIds[FSS_TRACKCOUNT]; |
|
| 29 |
+ std::uint8_t trackIds[FSS_TRACKCOUNT]; |
|
| 27 | 30 |
Track tracks[FSS_MAXTRACKS]; |
| 28 | 31 |
Channel channels[16]; |
| 29 | 32 |
std::bitset<16> allowedChannels; |
| 30 |
- int16_t variables[32]; |
|
| 33 |
+ std::int16_t variables[32]; |
|
| 31 | 34 |
|
| 32 |
- uint32_t sampleRate; |
|
| 35 |
+ std::uint32_t sampleRate; |
|
| 33 | 36 |
Interpolation interpolation; |
| 34 | 37 |
|
| 35 | 38 |
Player(); |
| ... | ... |
@@ -38,7 +41,7 @@ struct Player |
| 38 | 41 |
void ClearState(); |
| 39 | 42 |
void FreeTracks(); |
| 40 | 43 |
void Stop(bool bKillSound); |
| 41 |
- int ChannelAlloc(int type, int prio); |
|
| 44 |
+ int ChannelAlloc(ChannelAllocateType type, int prio); |
|
| 42 | 45 |
int TrackAlloc(); |
| 43 | 46 |
void Run(); |
| 44 | 47 |
void UpdateTracks(); |
(I never remember to update these and besides, GitHub history can show when they were last modified.)
Backwards compatibility is kept by treating the lack of PLAYER info as
if all channels are able to be allocated.
| ... | ... |
@@ -1,7 +1,7 @@ |
| 1 | 1 |
/* |
| 2 | 2 |
* SSEQ Player - Player structure |
| 3 | 3 |
* By Naram Qashat (CyberBotX) [cyberbotx@cyberbotx.com] |
| 4 |
- * Last modification on 2014-10-18 |
|
| 4 |
+ * Last modification on 2014-10-25 |
|
| 5 | 5 |
* |
| 6 | 6 |
* Adapted from source code of FeOS Sound System |
| 7 | 7 |
* By fincs |
| ... | ... |
@@ -10,6 +10,7 @@ |
| 10 | 10 |
|
| 11 | 11 |
#pragma once |
| 12 | 12 |
|
| 13 |
+#include <bitset> |
|
| 13 | 14 |
#include "SSEQ.h" |
| 14 | 15 |
#include "Track.h" |
| 15 | 16 |
#include "Channel.h" |
| ... | ... |
@@ -26,6 +27,7 @@ struct Player |
| 26 | 27 |
uint8_t trackIds[FSS_TRACKCOUNT]; |
| 27 | 28 |
Track tracks[FSS_MAXTRACKS]; |
| 28 | 29 |
Channel channels[16]; |
| 30 |
+ std::bitset<16> allowedChannels; |
|
| 29 | 31 |
int16_t variables[32]; |
| 30 | 32 |
|
| 31 | 33 |
uint32_t sampleRate; |
| ... | ... |
@@ -1,7 +1,7 @@ |
| 1 | 1 |
/* |
| 2 | 2 |
* SSEQ Player - Player structure |
| 3 | 3 |
* By Naram Qashat (CyberBotX) [cyberbotx@cyberbotx.com] |
| 4 |
- * Last modification on 2014-10-13 |
|
| 4 |
+ * Last modification on 2014-10-18 |
|
| 5 | 5 |
* |
| 6 | 6 |
* Adapted from source code of FeOS Sound System |
| 7 | 7 |
* By fincs |
| ... | ... |
@@ -19,7 +19,7 @@ struct Player |
| 19 | 19 |
{
|
| 20 | 20 |
uint8_t prio, nTracks; |
| 21 | 21 |
uint16_t tempo, tempoCount, tempoRate /* 8.8 fixed point */; |
| 22 |
- int16_t masterVol; |
|
| 22 |
+ int16_t masterVol, sseqVol; |
|
| 23 | 23 |
|
| 24 | 24 |
const SSEQ *sseq; |
| 25 | 25 |
|
| ... | ... |
@@ -1,7 +1,7 @@ |
| 1 | 1 |
/* |
| 2 | 2 |
* SSEQ Player - Player structure |
| 3 | 3 |
* By Naram Qashat (CyberBotX) [cyberbotx@cyberbotx.com] |
| 4 |
- * Last modification on 2014-09-08 |
|
| 4 |
+ * Last modification on 2014-10-13 |
|
| 5 | 5 |
* |
| 6 | 6 |
* Adapted from source code of FeOS Sound System |
| 7 | 7 |
* By fincs |
| ... | ... |
@@ -26,6 +26,7 @@ struct Player |
| 26 | 26 |
uint8_t trackIds[FSS_TRACKCOUNT]; |
| 27 | 27 |
Track tracks[FSS_MAXTRACKS]; |
| 28 | 28 |
Channel channels[16]; |
| 29 |
+ int16_t variables[32]; |
|
| 29 | 30 |
|
| 30 | 31 |
uint32_t sampleRate; |
| 31 | 32 |
Interpolation interpolation; |
| ... | ... |
@@ -1,15 +1,14 @@ |
| 1 | 1 |
/* |
| 2 | 2 |
* SSEQ Player - Player structure |
| 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 |
* Adapted from source code of FeOS Sound System |
| 7 | 7 |
* By fincs |
| 8 | 8 |
* https://github.com/fincs/FSS |
| 9 | 9 |
*/ |
| 10 | 10 |
|
| 11 |
-#ifndef SSEQPLAYER_PLAYER_H |
|
| 12 |
-#define SSEQPLAYER_PLAYER_H |
|
| 11 |
+#pragma once |
|
| 13 | 12 |
|
| 14 | 13 |
#include "SSEQ.h" |
| 15 | 14 |
#include "Track.h" |
| ... | ... |
@@ -43,5 +42,3 @@ struct Player |
| 43 | 42 |
void UpdateTracks(); |
| 44 | 43 |
void Timer(); |
| 45 | 44 |
}; |
| 46 |
- |
|
| 47 |
-#endif |
| ... | ... |
@@ -1,7 +1,7 @@ |
| 1 | 1 |
/* |
| 2 | 2 |
* SSEQ Player - Player structure |
| 3 | 3 |
* By Naram Qashat (CyberBotX) [cyberbotx@cyberbotx.com] |
| 4 |
- * Last modification on 2013-03-21 |
|
| 4 |
+ * Last modification on 2013-04-01 |
|
| 5 | 5 |
* |
| 6 | 6 |
* Adapted from source code of FeOS Sound System |
| 7 | 7 |
* By fincs |
| ... | ... |
@@ -35,6 +35,8 @@ struct Player |
| 35 | 35 |
|
| 36 | 36 |
bool Setup(const SSEQ *sseq); |
| 37 | 37 |
void ClearState(); |
| 38 |
+ void FreeTracks(); |
|
| 39 |
+ void Stop(bool bKillSound); |
|
| 38 | 40 |
int ChannelAlloc(int type, int prio); |
| 39 | 41 |
int TrackAlloc(); |
| 40 | 42 |
void Run(); |
| 1 | 1 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,45 @@ |
| 1 |
+/* |
|
| 2 |
+ * SSEQ Player - Player structure |
|
| 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 |
+ |
|
| 11 |
+#ifndef SSEQPLAYER_PLAYER_H |
|
| 12 |
+#define SSEQPLAYER_PLAYER_H |
|
| 13 |
+ |
|
| 14 |
+#include "SSEQ.h" |
|
| 15 |
+#include "Track.h" |
|
| 16 |
+#include "Channel.h" |
|
| 17 |
+#include "consts.h" |
|
| 18 |
+ |
|
| 19 |
+struct Player |
|
| 20 |
+{
|
|
| 21 |
+ uint8_t prio, nTracks; |
|
| 22 |
+ uint16_t tempo, tempoCount, tempoRate /* 8.8 fixed point */; |
|
| 23 |
+ int16_t masterVol; |
|
| 24 |
+ |
|
| 25 |
+ const SSEQ *sseq; |
|
| 26 |
+ |
|
| 27 |
+ uint8_t trackIds[FSS_TRACKCOUNT]; |
|
| 28 |
+ Track tracks[FSS_MAXTRACKS]; |
|
| 29 |
+ Channel channels[16]; |
|
| 30 |
+ |
|
| 31 |
+ uint32_t sampleRate; |
|
| 32 |
+ Interpolation interpolation; |
|
| 33 |
+ |
|
| 34 |
+ Player(); |
|
| 35 |
+ |
|
| 36 |
+ bool Setup(const SSEQ *sseq); |
|
| 37 |
+ void ClearState(); |
|
| 38 |
+ int ChannelAlloc(int type, int prio); |
|
| 39 |
+ int TrackAlloc(); |
|
| 40 |
+ void Run(); |
|
| 41 |
+ void UpdateTracks(); |
|
| 42 |
+ void Timer(); |
|
| 43 |
+}; |
|
| 44 |
+ |
|
| 45 |
+#endif |