diff --git a/includes/RhythmGameUtilities/Audio.cpp b/includes/RhythmGameUtilities/Audio.cpp index 375057b..991626b 100644 --- a/includes/RhythmGameUtilities/Audio.cpp +++ b/includes/RhythmGameUtilities/Audio.cpp @@ -4,6 +4,9 @@ #include "Audio.h" +namespace RhythmGameUtilities +{ + int **ConvertSamplesToWaveform(float *samples, int size, int width, int height) { auto waveform = new int *[width]; @@ -46,3 +49,5 @@ int **ConvertSamplesToWaveform(float *samples, int size, int width, int height) return waveform; } + +} // namespace RhythmGameUtilities diff --git a/includes/RhythmGameUtilities/Audio.h b/includes/RhythmGameUtilities/Audio.h index c8b5ef4..3a66eef 100644 --- a/includes/RhythmGameUtilities/Audio.h +++ b/includes/RhythmGameUtilities/Audio.h @@ -7,10 +7,15 @@ #define PACKAGE_API #endif +namespace RhythmGameUtilities +{ + extern "C" { PACKAGE_API int **ConvertSamplesToWaveform(float *samples, int size, int width, int height); } +} // namespace RhythmGameUtilities + #endif diff --git a/includes/RhythmGameUtilities/Enums/Difficulty.h b/includes/RhythmGameUtilities/Enums/Difficulty.h index 58f43fe..b794833 100644 --- a/includes/RhythmGameUtilities/Enums/Difficulty.h +++ b/includes/RhythmGameUtilities/Enums/Difficulty.h @@ -1,5 +1,8 @@ #pragma once +namespace RhythmGameUtilities +{ + enum Difficulty { @@ -12,3 +15,5 @@ enum Difficulty Expert }; + +} // namespace RhythmGameUtilities diff --git a/includes/RhythmGameUtilities/Enums/NamedSection.h b/includes/RhythmGameUtilities/Enums/NamedSection.h index deb63fd..fe309b3 100644 --- a/includes/RhythmGameUtilities/Enums/NamedSection.h +++ b/includes/RhythmGameUtilities/Enums/NamedSection.h @@ -2,6 +2,9 @@ #include +namespace RhythmGameUtilities +{ + namespace NamedSection { typedef std::string Type; @@ -22,3 +25,5 @@ Type SyncTrack = "SyncTrack"; Type Events = "Events"; }; // namespace NamedSection + +} // namespace RhythmGameUtilities diff --git a/includes/RhythmGameUtilities/Enums/TypeCode.h b/includes/RhythmGameUtilities/Enums/TypeCode.h index 0d1b765..3e33325 100644 --- a/includes/RhythmGameUtilities/Enums/TypeCode.h +++ b/includes/RhythmGameUtilities/Enums/TypeCode.h @@ -2,6 +2,9 @@ #include +namespace RhythmGameUtilities +{ + namespace TypeCode { typedef std::string Type; @@ -27,3 +30,5 @@ Type Note = "N"; Type Event = "E"; } // namespace TypeCode + +} // namespace RhythmGameUtilities diff --git a/includes/RhythmGameUtilities/Parsers.cpp b/includes/RhythmGameUtilities/Parsers.cpp index 5315fcb..8f26cfa 100644 --- a/includes/RhythmGameUtilities/Parsers.cpp +++ b/includes/RhythmGameUtilities/Parsers.cpp @@ -10,6 +10,9 @@ #include "Utilities.h" #include +namespace RhythmGameUtilities +{ + std::regex CHART_SECTION_PATTERN("\\[([a-z]+)\\]\\s*\\{([^\\}]+)\\}", std::regex_constants::icase); @@ -109,3 +112,5 @@ ChartSectionInternal *ParseSectionsFromChartInternal(const char *contents, return sections; } + +} // namespace RhythmGameUtilities diff --git a/includes/RhythmGameUtilities/Parsers.h b/includes/RhythmGameUtilities/Parsers.h index 7528738..2c0a3cb 100644 --- a/includes/RhythmGameUtilities/Parsers.h +++ b/includes/RhythmGameUtilities/Parsers.h @@ -8,6 +8,9 @@ #define PACKAGE_API #endif +namespace RhythmGameUtilities +{ + typedef struct { char *key; @@ -35,3 +38,5 @@ extern "C" PACKAGE_API ChartSectionInternal * ParseSectionsFromChartInternal(const char *contents, int *outSize); } + +} // namespace RhythmGameUtilities diff --git a/includes/RhythmGameUtilities/Structs/BeatBar.h b/includes/RhythmGameUtilities/Structs/BeatBar.h index 0335ca6..82249ad 100644 --- a/includes/RhythmGameUtilities/Structs/BeatBar.h +++ b/includes/RhythmGameUtilities/Structs/BeatBar.h @@ -1,5 +1,8 @@ #pragma once +namespace RhythmGameUtilities +{ + struct BeatBar { @@ -7,3 +10,5 @@ struct BeatBar int BPM; }; + +} // namespace RhythmGameUtilities diff --git a/includes/RhythmGameUtilities/Structs/Note.h b/includes/RhythmGameUtilities/Structs/Note.h index f617a33..bbb199a 100644 --- a/includes/RhythmGameUtilities/Structs/Note.h +++ b/includes/RhythmGameUtilities/Structs/Note.h @@ -1,5 +1,8 @@ #pragma once +namespace RhythmGameUtilities +{ + struct Note { @@ -9,3 +12,5 @@ struct Note int Length; }; + +} // namespace RhythmGameUtilities diff --git a/includes/RhythmGameUtilities/Structs/TrackEvent.h b/includes/RhythmGameUtilities/Structs/TrackEvent.h index cf3c538..7dda66e 100644 --- a/includes/RhythmGameUtilities/Structs/TrackEvent.h +++ b/includes/RhythmGameUtilities/Structs/TrackEvent.h @@ -2,6 +2,9 @@ #include +namespace RhythmGameUtilities +{ + struct TrackEvent { @@ -11,3 +14,5 @@ struct TrackEvent std::vector *Values; }; + +} // namespace RhythmGameUtilities diff --git a/includes/RhythmGameUtilities/Utilities.cpp b/includes/RhythmGameUtilities/Utilities.cpp index ebc48ca..7549208 100644 --- a/includes/RhythmGameUtilities/Utilities.cpp +++ b/includes/RhythmGameUtilities/Utilities.cpp @@ -12,6 +12,9 @@ #include "Structs/BeatBar.h" #include "Structs/Note.h" +namespace RhythmGameUtilities +{ + const float SECONDS_PER_MINUTE = 60.0f; float ConvertTickToPosition(float tick, int resolution) @@ -228,3 +231,5 @@ std::vector FindMatchGroups(const char *contents, return matches; } + +} // namespace RhythmGameUtilities diff --git a/includes/RhythmGameUtilities/Utilities.h b/includes/RhythmGameUtilities/Utilities.h index 716ce1e..6c376f7 100644 --- a/includes/RhythmGameUtilities/Utilities.h +++ b/includes/RhythmGameUtilities/Utilities.h @@ -14,6 +14,9 @@ #define PACKAGE_API #endif +namespace RhythmGameUtilities +{ + extern "C" { PACKAGE_API float ConvertTickToPosition(float tick, int resolution); @@ -56,3 +59,5 @@ std::vector FindAllMatches(const char *contents, std::vector FindMatchGroups(const char *contents, std::regex pattern); + +} // namespace RhythmGameUtilities diff --git a/tests/RhythmGameUtilities/Audio.cpp b/tests/RhythmGameUtilities/Audio.cpp index 824fd81..332dbc1 100644 --- a/tests/RhythmGameUtilities/Audio.cpp +++ b/tests/RhythmGameUtilities/Audio.cpp @@ -3,6 +3,8 @@ #include "RhythmGameUtilities/Audio.h" +using namespace RhythmGameUtilities; + void testConvertSamplesToWaveform() { int size = 5; diff --git a/tests/RhythmGameUtilities/Parsers.cpp b/tests/RhythmGameUtilities/Parsers.cpp index aae44dc..1586d8f 100644 --- a/tests/RhythmGameUtilities/Parsers.cpp +++ b/tests/RhythmGameUtilities/Parsers.cpp @@ -4,6 +4,8 @@ #include "RhythmGameUtilities/Parsers.h" +using namespace RhythmGameUtilities; + auto contents = R"([Song] { Name = "Example Song" diff --git a/tests/RhythmGameUtilities/Utilities.cpp b/tests/RhythmGameUtilities/Utilities.cpp index c7a7e81..6b290dd 100644 --- a/tests/RhythmGameUtilities/Utilities.cpp +++ b/tests/RhythmGameUtilities/Utilities.cpp @@ -5,6 +5,8 @@ #include "RhythmGameUtilities/Utilities.h" +using namespace RhythmGameUtilities; + void testConvertTickToPosition() { assert(4 == ConvertTickToPosition(768, 192));