> In my lv2 plugin, I need to communicate
information from the DSP to
> the UI, but I don't want to break the DSP/UI separation principle (no
> Instance or Data access). On top of that, I'm using LVTK.
he, he, yeah it can get a little confusing... maybe
this will help.
// you're sending things in an atom sequence so get the size information
// from the port buffer
LV2_Atom_Sequence* aseq = (LV2_Atom_Sequence*) p (p_notify);
m_forge->set_buffer ((uint8_t*) aseq, aseq->atom.size);
m_forge->sequence_head (m_notify_frame, 0);
// sequences need a timestamp for each event added
m_forge->frame_time (0);
// after forging a frame_time, just write a normal float (no blank object needed)
m_forge->write_float (1604);
Your ttl file has atom:Float as the buffer type.
I've never used
anything besides atom:Sequence. I imagine this buffer type doesn't need a
sequence head forged first. Maybe David will jump in on how atom:Float
bufferType'd ports are supposed to forged into and out of.
Ok, so I changed my code the way you proposed (with switching in the
ttl to Sequence), but still don't manage to make it work.
I'm wondering if there isn't something wrong with the way I setup the
Forge in the first place. I'm a bit confused with the way to interact
wiith the map object in LVTK.
Scope::Scope(double rate) : Plugin<Scope, URID<true>,
Options<true>>(p_n_ports)
{
m_forge = new AtomForge(p_map);
}
void Scope::run(uint32_t nframes)
{
// you're sending things in an atom sequence so get the size information
// from the port buffer
LV2_Atom_Sequence* aseq = (LV2_Atom_Sequence*) p (p_notify);
m_forge->set_buffer ((uint8_t*) aseq, aseq->atom.size);
m_forge->sequence_head(m_notify_frame, 0);
// sequences need a timestamp for each event added
m_forge->frame_time(0);
m_forge->write_float(1604);
}
I recommend, if you want to use LVTK to do atom
forging, that you subclass
lvtk::AtomForge and add appropriate methods to it...
Here's a snippet that shows how to write patch get/set messages with a
subclassed AtomForge. It also shows how to write raw midi.
http://pastebin.com/C1LYtXpv -- the code in there uses small uses the
nullptr macro. just change those to "0" if you're not using c++11
Could you tell me the advantages of doing that?
But I had a look at the code, I still need to understand how to work
with LV2_URID_Map in LVTK (I cannot find any examples using it).