summaryrefslogtreecommitdiff
path: root/soundlib/ModInstrument.h
diff options
context:
space:
mode:
authorJames Cowgill <jcowgill@debian.org>2017-09-29 21:07:02 +0100
committerJames Cowgill <jcowgill@debian.org>2017-09-29 21:07:02 +0100
commit24b4ac9afef21e7b350bafb876e0134857788d10 (patch)
treed3f87b16d0473bfb7b29d364c3c7214f7a4dc19d /soundlib/ModInstrument.h
parentf32cdc3ad7caac3602d9e0dab4282b267dc0cad2 (diff)
New upstream version 0.3.1
Diffstat (limited to 'soundlib/ModInstrument.h')
-rw-r--r--soundlib/ModInstrument.h16
1 files changed, 12 insertions, 4 deletions
diff --git a/soundlib/ModInstrument.h b/soundlib/ModInstrument.h
index e40ad53..be95a00 100644
--- a/soundlib/ModInstrument.h
+++ b/soundlib/ModInstrument.h
@@ -10,7 +10,7 @@
#pragma once
-#include "tuning.h"
+#include "tuningbase.h"
#include "Snd_defs.h"
#include "../common/FlagSet.h"
#include "../common/misc_util.h"
@@ -21,11 +21,16 @@ OPENMPT_NAMESPACE_BEGIN
// Instrument Nodes
struct EnvelopeNode
{
- uint16 tick; // Envelope node position (x axis)
- uint8 value; // Envelope node value (y axis)
+ typedef uint16 tick_t;
+ typedef uint8 value_t;
+
+ tick_t tick; // Envelope node position (x axis)
+ value_t value; // Envelope node value (y axis)
EnvelopeNode() : tick(0), value(0) { }
- EnvelopeNode(uint16 tick, uint8 value) : tick(tick), value(value) { }
+ EnvelopeNode(tick_t tick, value_t value) : tick(tick), value(value) { }
+
+ bool operator== (const EnvelopeNode &other) const { return tick == other.tick && value == other.value; }
};
// Instrument Envelopes
@@ -56,6 +61,9 @@ struct InstrumentEnvelope : public std::vector<EnvelopeNode>
void Sanitize(uint8 maxValue = ENVELOPE_MAX);
uint32 size() const { return static_cast<uint32>(std::vector<EnvelopeNode>::size()); }
+
+ using std::vector<EnvelopeNode>::push_back;
+ void push_back(EnvelopeNode::tick_t tick, EnvelopeNode::value_t value) { push_back(EnvelopeNode(tick, value)); }
};
// Instrument Struct