<div dir="ltr">That was the problem, the output atom should be sequence, now its working! Thanks =)</div><div class="gmail_extra"><br><br><div class="gmail_quote">2014-04-04 14:36 GMT-03:00 David Robillard <span dir="ltr"><<a href="mailto:d@drobilla.net" target="_blank">d@drobilla.net</a>></span>:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="">On Thu, 2014-04-03 at 20:11 -0300, Lucas Takejame wrote:<br>
> Hello everybody, Im trying to make a lv2 plugin that translate audio to<br>
> MIDI, im using Aubio lib and Im having trouble to send the MIDI output. I<br>
> already saw a bunch of lv2 examples, like fifths, sampler and gxtuner but<br>
> couldn't solve my problem... I'm confuse about the steps i should follow to<br>
> prepare my LV2_Atom_Sequence struct to output. Here's what i did until now<br>
> (This is not the actual code, I modified it to give a context, tried to put<br>
> only things related to the midi output port):<br>
<br>
</div>Your best bet is to literally copy from these examples, that's what they<br>
are for.<br>
<div class=""><br>
>     Note2midi *plugin = new Note2midi();<br>
>     plugin->out = new LV2_Atom_Sequence();<br>
<br>
</div>Oh my.  Atoms are C structs, not C++ objects, allocation does not work<br>
this way.  LV2_Atom_Sequence is just a header, it is not large enough to<br>
actually contain any data.  I suggest testing with valgrind to find<br>
memory errors.<br>
<br>
In any case, outputs are allocated by the *host*, not the plugin, so<br>
this is probably just being overwritten anyway.<br>
<div class=""><br>
> plugin->out->atom.type = plugin->midi_event;<br>
>     plugin->out->atom.size = sizeof(plugin->note.msg);<br>
<br>
</div>This is incorrect, the output atom is a Sequence, not a MidiEvent.  This<br>
is probably your real problem.  Set the type to atom:Sequence, and leave<br>
the clearing to lv2_atom_sequence_clear.  Both of these things need to<br>
be done in run() every cycle, not just once at startup.<br>
<br>
Assuming you are okay with using the new utility functions like<br>
lv2_atom_sequence_clear (which you're already doing, so I assume you<br>
are), you should just do exactly what fifths does to set up its output<br>
buffer, except instead of being able to simply copy the type from the<br>
input, if you don't have a MIDI input you'll have to map atom:Sequence<br>
and set it to that instead of in_port->atom.type<br>
<div class=""><br>
> Hope this is not asking too much =)<br>
<br>
</div>That's what the list is here for :)<br>
<span class="HOEnZb"><font color="#888888"><br>
--<br>
dr<br>
<br>
<br>
</font></span></blockquote></div><br><br clear="all"><div><br></div>-- <br>Lucas Conejero Takejame<div>Engenharia Elétrica - ênfase em computação</div><div>Escola Politécnica - USP</div>
</div>