summaryrefslogtreecommitdiff
path: root/src/events_ds.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/events_ds.h')
-rw-r--r--src/events_ds.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/events_ds.h b/src/events_ds.h
index 5855711..41287d1 100644
--- a/src/events_ds.h
+++ b/src/events_ds.h
@@ -96,6 +96,9 @@ public:
//! when startAddingNewGroup is again called.
void startAddingNewGroup(InstrumentID instrument_id = InstrumentID());
+ //! Clears the whole data structure to make it ready for a new drum kit.
+ void clear();
+
private:
struct ChannelData
{
@@ -146,6 +149,8 @@ private:
template <typename T, typename... Args>
T& EventsDS::emplace(channel_t ch, Args&&... args)
{
+ assert(ch < NUM_CHANNELS);
+
// add new event types here
static_assert(std::is_same<T, SampleEvent>::value, "Check event type");
@@ -177,6 +182,8 @@ T& EventsDS::get(EventID event_id)
template <typename T>
ContainerRange<std::vector<T>> EventsDS::iterateOver(channel_t ch)
{
+ assert(ch < NUM_CHANNELS);
+
// add new event types here
static_assert(std::is_same<T, SampleEvent>::value, "Check event type");
@@ -190,6 +197,8 @@ ContainerRange<std::vector<T>> EventsDS::iterateOver(channel_t ch)
template <typename T>
T& EventsDS::getSample(EventInfo const& info)
{
+ assert(info.ch < NUM_CHANNELS);
+
// add new event types here
static_assert(std::is_same<T, SampleEvent>::value, "Check event type");