Long context, sorry

> > Do let me see if I get this right:
> >
> > Host allocates the VVID pool (perhaps a bitmask or some other way
> > of indicating usage)
> > Host wants to send a VOICE_ON:
> >     allocates an unused VVID
> >     sends VOICE_ON with that VVID
> >     when it sends a VOICE_OFF or receives a VOICE_OFF it can mark that
> >        VVID as unused again.
> 
> It seems like this would be a host global matter... What would be the 
> point in that? All you need is a way to address Voices within *one 
> Channel* - you don't have to worry about other Plugins, or even other 
> Channels on the same Plugin. (For table based implementations, 
> plugins have one table per Channel, and for tag/search 
> implementations, you just tag Voices with VVIDs *and* Channel 
> indices.)
> 
> > Plugin wants to send a VOICE_ON:
> >     calls host->get_vvids(32)
> >     host allocates it 32 VVIDs
> 
> You do this when the host tells you to connect to an event port, and 
> what you do is actually:
> 
>       first_id = host->get_vvids(target_port, number_of_VVIDs);
>       if(first_id < 0)
>               give_up;
> 
> Note that the first_id thing is actually *only* needed when the host 
> connects multiple output ports to the same input port. Normally, it 
> will be 0.
> 
> The host will at some point ask the plugin, or rather *tell* the 
> plugin how many VVIDs are needed for each Event Input port it wants 
> to connect. Plugins may say
> 
>       "I don't have Voices!"
>               (No need for VVIDs...)
> 
> or
> 
>       "Anything that fits makes a fine VVID for me."
>               (Full 32 bit range, no actual allocation needed.
> 
> or
> 
>       "I need internal tables. How many VVIDs do you need?"
>               (Host says N, and plugin allocates tables for N
>               VVIDs, addressed as 0..N-1.)

OK, let me again see if I understand (sorry for being dense, something is
not clicking this week..)

// Normal case of host connecting to an event_port
Host somewhere:
  evp = instrument->get_event_port(n);
  vvid_max = instrument->alloc_vvids(evp, 256); /* should be enough! */
Plugin alloc_vvids:
  /* make room for specified number of vvids, or what not */
  return the requested # back, or negative on error
Host again:
  store the number of VVIDs somehow - array/list


So how does a plugin controlling another plugin go?

Reply via email to