summaryrefslogtreecommitdiff
path: root/src/events.h
diff options
context:
space:
mode:
authorAndré Nusser <andre.nusser@googlemail.com>2018-08-02 10:49:39 +0200
committerAndré Nusser <andre.nusser@googlemail.com>2018-08-02 14:06:34 +0200
commit84730760698833df09eb8b082a5473be5fc85c85 (patch)
tree18db88656718463c3af7349637c613cf9c889e5d /src/events.h
parente39d82f5a06db9d4c4c505d30c4ac116037e1399 (diff)
Fix rampdown issue and clean up a bit while at it.
Diffstat (limited to 'src/events.h')
-rw-r--r--src/events.h33
1 files changed, 21 insertions, 12 deletions
diff --git a/src/events.h b/src/events.h
index f953031..b78dd79 100644
--- a/src/events.h
+++ b/src/events.h
@@ -42,6 +42,11 @@ typedef unsigned int timepos_t;
class Event
{
public:
+ Event(channel_t channel, timepos_t offset = 0)
+ : channel(channel), offset(offset)
+ {
+ }
+
virtual ~Event()
{
}
@@ -57,22 +62,21 @@ public:
timepos_t offset; //< Global position (ie. not relative to buffer)
};
-#define NO_RAMPDOWN -1
class EventSample : public Event
{
public:
EventSample(channel_t c, float g, AudioFile* af,
const std::string& grp, void* instr)
+ : Event(c)
+ , cache_id(CACHE_NOID)
+ , gain(g)
+ , t(0)
+ , file(af)
+ , group(grp)
+ , instrument(instr)
+ , rampdown_count(-1)
+ , ramp_length(0)
{
- cache_id = CACHE_NOID;
- channel = c;
- gain = g;
- t = 0;
- file = af;
- group = grp;
- instrument = instr;
- rampdown = NO_RAMPDOWN;
- ramp_start = 0;
}
Event::type_t getType() const
@@ -80,6 +84,11 @@ public:
return Event::sample;
}
+ bool rampdownInProgress() const
+ {
+ return rampdown_count != -1;
+ }
+
cacheid_t cache_id;
sample_t* buffer;
size_t buffer_size;
@@ -89,8 +98,8 @@ public:
AudioFile* file;
std::string group;
void* instrument;
- int rampdown;
- int ramp_start;
+ int rampdown_count;
+ int ramp_length;
float scale{1.0f};
};