gearmulator

Emulation of classic VA synths of the late 90s/2000s that are based on Motorola 56300 family DSPs
Log | Files | Refs | Submodules | README | LICENSE

commit 780dba9ab0b42b5871e2c95627b3812e48ea6af4
parent 3e1941ba8f880e2a93177392ee08bb5b75148b7a
Author: dsp56300 <dsp56300@users.noreply.github.com>
Date:   Sat, 28 Sep 2024 23:11:56 +0200

missing file

Diffstat:
Asource/xtLib/xtId.cpp | 1+
Asource/xtLib/xtId.h | 49+++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 50 insertions(+), 0 deletions(-)

diff --git a/source/xtLib/xtId.cpp b/source/xtLib/xtId.cpp @@ -0,0 +1 @@ +#include "xtId.h" diff --git a/source/xtLib/xtId.h b/source/xtLib/xtId.h @@ -0,0 +1,49 @@ +#pragma once + +#include <cstdint> +#include <limits> + +namespace xt +{ + enum class IdType + { + WaveId, + TableId, + TableIndex + }; + + template<typename TId, IdType Type> + class Id + { + public: + using RawType = TId; + static constexpr IdType IdType = Type; + + constexpr Id() : m_id(Invalid) + { + } + constexpr explicit Id(const TId& _id) : m_id(_id) + { + } + + bool operator < (const Id& _id) const { return m_id < _id.m_id; } + bool operator > (const Id& _id) const { return m_id > _id.m_id; } + bool operator == (const Id& _id) const { return m_id == _id.m_id; } + bool operator != (const Id& _id) const { return m_id != _id.m_id; } + + const auto& rawId() const { return m_id; } + + constexpr static Id invalid() { return Id(Invalid); } + bool isValid() const { return m_id != Invalid; } + void invalidate() { m_id = Invalid; } + + private: + static constexpr TId Invalid = std::numeric_limits<TId>::max(); + + TId m_id; + }; + + using WaveId = Id<uint16_t, IdType::WaveId>; + using TableId = Id<uint16_t, IdType::TableId>; + using TableIndex = Id<uint16_t, IdType::TableIndex>; +}