Use literal for compatibility
[ardour.git] / libs / plugins / reasonablesynth.lv2 / lv2.c
index 586ca54c86a37a32a6e0f6eff3431a94168ba815..bc3715ac4e8f0f37417247de1514a92c8fee5103 100644 (file)
@@ -100,7 +100,7 @@ instantiate(const LV2_Descriptor*     descriptor,
   self->synth = synth_alloc();
   synth_init(self->synth, rate);
 
-
+#ifndef PLATFORM_WINDOWS // easter egg is for sane platforms with native support for localtime_r only
   struct tm date;
   time_t now;
   time(&now);
@@ -109,6 +109,7 @@ instantiate(const LV2_Descriptor*     descriptor,
     printf("reasonable synth.lv2 says: happy holidays!\n");
     self->xmas = true;
   }
+#endif
 
   return (LV2_Handle)self;
 }
@@ -146,12 +147,19 @@ run(LV2_Handle handle, uint32_t n_samples)
 
   /* Process incoming MIDI events */
   if (self->midiin) {
-    LV2_Atom_Event const* ev = (LV2_Atom_Event const*)((&(self->midiin)->body) + 1); // lv2_atom_sequence_begin
+    LV2_Atom_Event const* ev = (LV2_Atom_Event const*)((uintptr_t)((&(self->midiin)->body) + 1)); // lv2_atom_sequence_begin
     while( // !lv2_atom_sequence_is_end
         (const uint8_t*)ev < ((const uint8_t*) &(self->midiin)->body + (self->midiin)->atom.size)
         )
     {
       if (ev->body.type == self->midi_MidiEvent) {
+#ifdef DEBUG_MIDI_EVENT // debug midi messages in synth -- not rt-safe(!)
+        printf ("%5d (%d):", ev->time.frames,  ev->body.size);
+        for (uint8_t i = 0; i < ev->body.size; ++i) {
+          printf (" %02x", ((const uint8_t*)(ev+1))[i]);
+        }
+        printf ("\n");
+#endif
         if (written + BUFFER_SIZE_SAMPLES < ev->time.frames
             && ev->time.frames < n_samples) {
           /* first synthesize sound up until the message timestamp */
@@ -165,7 +173,7 @@ run(LV2_Handle handle, uint32_t n_samples)
         }
       }
       ev = (LV2_Atom_Event const*) // lv2_atom_sequence_next()
-        ((const uint8_t*)ev + sizeof(LV2_Atom_Event) + ((ev->body.size + 7) & ~7));
+             ((uintptr_t)((const uint8_t*)ev + sizeof(LV2_Atom_Event) + ((ev->body.size + 7) & ~7)));
     }
   }