diff options
author | David Robillard <d@drobilla.net> | 2012-05-31 06:23:57 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2012-05-31 06:23:57 +0000 |
commit | 7b20413c84b14d2c2bc1037bb08134dcdf152ddb (patch) | |
tree | c7c339d6c4d0d26b01e654163e7a8a203f62baf4 /src/sequencer.c | |
parent | 46caaf6b96f185a4a25d1d12fc85720a03220e97 (diff) | |
download | blop.lv2-7b20413c84b14d2c2bc1037bb08134dcdf152ddb.tar.gz blop.lv2-7b20413c84b14d2c2bc1037bb08134dcdf152ddb.tar.bz2 blop.lv2-7b20413c84b14d2c2bc1037bb08134dcdf152ddb.zip |
Umm... commit pretty much all the work of the past few days. Again.
git-svn-id: http://svn.drobilla.net/lad/trunk/plugins/blop.lv2@4488 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/sequencer.c')
-rw-r--r-- | src/sequencer.c | 29 |
1 files changed, 26 insertions, 3 deletions
diff --git a/src/sequencer.c b/src/sequencer.c index ef22a8a..e5c97c7 100644 --- a/src/sequencer.c +++ b/src/sequencer.c @@ -94,6 +94,9 @@ instantiate(const LV2_Descriptor* descriptor, const LV2_Feature* const* features) { Sequencer* plugin = (Sequencer*)malloc(sizeof(Sequencer)); + if (!plugin) { + return NULL; + } plugin->srate = (float)sample_rate; plugin->inv_srate = 1.0f / plugin->srate; @@ -113,8 +116,8 @@ activate(LV2_Handle instance) } static void -runSequencer(LV2_Handle instance, - uint32_t sample_count) +run(LV2_Handle instance, + uint32_t sample_count) { Sequencer* plugin = (Sequencer*)instance; @@ -145,7 +148,7 @@ runSequencer(LV2_Handle instance, unsigned int step_index = plugin->step_index; unsigned int loop_index = LRINTF(loop_steps); - int rst = LRINTF(reset); + int rst = reset > 0.0f; int i; loop_index = loop_index == 0 ? 1 : loop_index; @@ -191,3 +194,23 @@ runSequencer(LV2_Handle instance, plugin->last_value = last_value; plugin->step_index = step_index; } + +static const LV2_Descriptor descriptor = { + SEQUENCER_URI, + instantiate, + connect_port, + activate, + run, + NULL, + cleanup, + NULL +}; + +LV2_SYMBOL_EXPORT const LV2_Descriptor* +lv2_descriptor(uint32_t index) +{ + switch (index) { + case 0: return &descriptor; + default: return NULL; + } +} |