summaryrefslogtreecommitdiff
path: root/src/events.h
diff options
context:
space:
mode:
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};
};