X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=libs%2Fplugins%2Freasonablesynth.lv2%2Flv2.c;h=6b9c81d8dd06a65df303dcfc9acdfde0a5480d7e;hb=a1a3f6c8265264227ce19f731bf1863aff229a94;hp=1fcfba868e0496cbb71614244e92aa363d6b548c;hpb=2cad99bf39348222ef554c5134c7950e49afabb5;p=ardour.git diff --git a/libs/plugins/reasonablesynth.lv2/lv2.c b/libs/plugins/reasonablesynth.lv2/lv2.c index 1fcfba868e..6b9c81d8dd 100644 --- a/libs/plugins/reasonablesynth.lv2/lv2.c +++ b/libs/plugins/reasonablesynth.lv2/lv2.c @@ -22,6 +22,7 @@ #include #include #include +#include /* LV2 */ #include "lv2/lv2plug.in/ns/lv2core/lv2.h" @@ -56,6 +57,7 @@ typedef struct { double SampleRateD; void *synth; + bool xmas; } RSynth; /* main LV2 */ @@ -98,6 +100,16 @@ instantiate(const LV2_Descriptor* descriptor, self->synth = synth_alloc(); synth_init(self->synth, rate); + + struct tm date; + time_t now; + time(&now); + localtime_r(&now, &date); + if (getenv("ITSXMAS") || (date.tm_mon == 11 /*dec*/ && date.tm_mday == 25)) { + printf("reasonable synth.lv2 says: happy holidays!\n"); + self->xmas = true; + } + return (LV2_Handle)self; } @@ -146,7 +158,11 @@ run(LV2_Handle handle, uint32_t n_samples) written = synth_sound(self->synth, written, ev->time.frames, audio); } /* send midi message to synth */ - synth_parse_midi(self->synth, (const uint8_t*)(ev+1), ev->body.size); + if (self->xmas) { + synth_parse_xmas(self->synth, (const uint8_t*)(ev+1), ev->body.size); + } else { + synth_parse_midi(self->synth, (const uint8_t*)(ev+1), ev->body.size); + } } ev = (LV2_Atom_Event const*) // lv2_atom_sequence_next() ((const uint8_t*)ev + sizeof(LV2_Atom_Event) + ((ev->body.size + 7) & ~7)); @@ -185,9 +201,9 @@ static const LV2_Descriptor descriptor = { LV2_SYMBOL_EXPORT const LV2_Descriptor* -lv2_descriptor(uint32_t index) +lv2_descriptor(uint32_t idx) { - switch (index) { + switch (idx) { case 0: return &descriptor; default: