summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorAdam Szmigin <smidge@xsco.net>2020-08-23 22:24:14 +0100
committerAdam Szmigin <smidge@xsco.net>2020-09-16 22:09:43 +0100
commite6854c28d633532c9a5061ce0fd1a06d2f59094a (patch)
tree09c192184557bb0598b11a0d1dfe54ceeb771a3f /include
parentf14366864b6d66fc69741141acbb4e66b88d9854 (diff)
Support Engine Prime schema versions up to 1.18.0
* Added a test of reference DB files. * Test crate and track creation across all supported versions. * Support for all schema versions seen by EP and SC5000 players.
Diffstat (limited to 'include')
-rw-r--r--include/djinterop/database.hpp3
-rw-r--r--include/djinterop/enginelibrary.hpp55
-rw-r--r--include/djinterop/track.hpp4
3 files changed, 56 insertions, 6 deletions
diff --git a/include/djinterop/database.hpp b/include/djinterop/database.hpp
index b947733..8be42ba 100644
--- a/include/djinterop/database.hpp
+++ b/include/djinterop/database.hpp
@@ -108,6 +108,9 @@ public:
/// Returns the schema version of the database
semantic_version version() const;
+ /// Returns a descriptive name for the database version.
+ std::string version_name() const;
+
/// Removes a crate from the database
///
/// All handles to that crate become invalid.
diff --git a/include/djinterop/enginelibrary.hpp b/include/djinterop/enginelibrary.hpp
index 588d293..9871d3c 100644
--- a/include/djinterop/enginelibrary.hpp
+++ b/include/djinterop/enginelibrary.hpp
@@ -29,6 +29,7 @@
#include <vector>
#include <djinterop/config.hpp>
+#include <djinterop/database.hpp>
#include <djinterop/pad_color.hpp>
#include <djinterop/semantic_version.hpp>
@@ -39,9 +40,48 @@ struct beatgrid_marker;
namespace enginelibrary
{
-static constexpr semantic_version version_1_6_0{1, 6, 0};
-static constexpr semantic_version version_1_7_1{1, 7, 1};
-static constexpr semantic_version version_latest = version_1_7_1;
+/// The schema associated with SC5000 Firmware 1.0.0.
+constexpr const semantic_version version_1_6_0{1, 6, 0};
+
+/// The schema associated with SC5000 Firmware 1.0.3.
+constexpr const semantic_version version_1_7_1{1, 7, 1};
+
+/// The schema associated with Engine Prime 1.1.1.
+constexpr const semantic_version version_1_9_1{1, 9, 1};
+
+/// The schema associated with SC5000 Firmware 1.2.0.
+constexpr const semantic_version version_1_11_1{1, 11, 1};
+
+/// The schema associated with SC5000 Firmware 1.2.2.
+constexpr const semantic_version version_1_13_0{1, 13, 0};
+
+/// The schema associated with Engine Prime 1.2.2.
+constexpr const semantic_version version_1_13_1{1, 13, 1};
+
+/// The schema associated with SC5000 Firmware 1.3.1.
+constexpr const semantic_version version_1_13_2{1, 13, 2};
+
+/// The schema associated with SC5000 Firmware 1.4.0.
+constexpr const semantic_version version_1_15_0{1, 15, 0};
+
+/// The schema associated with SC5000 Firmware 1.5.1/1.5.2.
+constexpr const semantic_version version_1_17_0{1, 17, 0};
+
+/// The schema associated with Engine Prime 1.5.1.
+constexpr const semantic_version version_1_18_0{1, 18, 0};
+
+/// Set of available schemas.
+constexpr const std::array<semantic_version, 10> all_versions{
+ version_1_6_0, version_1_7_1, version_1_9_1, version_1_11_1,
+ version_1_13_0, version_1_13_1, version_1_13_2, version_1_15_0,
+ version_1_17_0, version_1_18_0,
+};
+
+/// The most recent schema version supported by the library.
+constexpr semantic_version version_latest = version_1_18_0;
+
+/// The most recent "firmware-usable" schema version supported by the library.
+constexpr semantic_version version_latest_firmware = version_1_17_0;
namespace standard_pad_colors
{
@@ -61,6 +101,9 @@ constexpr const std::array<pad_color, 8> pads{pad_1, pad_2, pad_3, pad_4,
constexpr const char* default_database_dir_name = "Engine Library";
+/// Gets a descriptive name for a given schema version.
+std::string DJINTEROP_PUBLIC version_name(const semantic_version& version);
+
/// Creates a new, empty database in a directory using the schema version
/// provided.
///
@@ -68,7 +111,7 @@ constexpr const char* default_database_dir_name = "Engine Library";
/// a database already exists in the target directory, an exception will be
/// thrown.
database DJINTEROP_PUBLIC create_database(
- std::string directory,
+ const std::string& directory,
const semantic_version& schema_version = version_latest);
/// Create or load an Engine Library database in a given directory.
@@ -78,7 +121,7 @@ database DJINTEROP_PUBLIC create_database(
/// database is returned. The boolean reference parameter `created` can be used
/// to determine whether the database was created or merely loaded.
database DJINTEROP_PUBLIC create_or_load_database(
- std::string directory, const semantic_version& schema_version,
+ const std::string& directory, const semantic_version& schema_version,
bool& created);
/// Returns a boolean indicating whether an Engine Library already exists in a
@@ -86,7 +129,7 @@ database DJINTEROP_PUBLIC create_or_load_database(
bool DJINTEROP_PUBLIC database_exists(const std::string& directory);
/// Loads an Engine Library database from a given directory.
-database DJINTEROP_PUBLIC load_database(std::string directory);
+database DJINTEROP_PUBLIC load_database(const std::string& directory);
/// Given an Engine Library database, returns the path to its m.db sqlite
/// database file
diff --git a/include/djinterop/track.hpp b/include/djinterop/track.hpp
index ff649cc..16d0f90 100644
--- a/include/djinterop/track.hpp
+++ b/include/djinterop/track.hpp
@@ -165,6 +165,8 @@ public:
/// Returns the duration (metadata) of the track
stdx::optional<std::chrono::milliseconds> duration() const;
+ // TODO (mr-smidge): Add `file_bytes()` and `set_file_bytes()` methods.
+
/// Returns the file extension part of `track::relative_path()`
///
/// An empty string is returned if the file doesn't have an extension.
@@ -304,6 +306,8 @@ public:
void set_track_number(stdx::optional<int32_t> track_number) const;
void set_track_number(int32_t track_number) const;
+ // TODO (mr-smidge): Add `uri()` and `set_uri()` methods.
+
std::vector<waveform_entry> waveform() const;
void set_waveform(std::vector<waveform_entry> waveform) const;