[LAD] LV2 Atom Sequence timestamps

David Robillard d at drobilla.net
Tue Jun 5 19:44:02 UTC 2012


On Tue, 2012-06-05 at 06:34 -0400, Jeremy Salwen wrote:
> Hi All,
> 
> From what I can tell, it looks like the LV2 Atom Sequence
> specification allows you to send events with arbitrary units for the
> timestamp.
> 
> I have a few questions about this:
> 
> 1. How are we to know whether a particular unit uses the double field
> in the timestamp union, or the uint64_t field in the timestamp union.

Context.  When used as event ports in the run() callback, it is always
frames, like everything else.

I deliberately avoided complicating it with a bunch of stuff to handle
beat-based time stamps in this context since this would almost certainly
be unused (learned that lesson with the event extension).  It can be
added later if need be.

> 2. The specification says "The unit field is either a URID that
> described an appropriate time stamp type, or may be 0 where a default
> stamp type is known."  In what circumstances would the timestamp be
> known?  When can I expect to see a zero in that field?

See above.

> 3. Are the timestamps absolute times?  Or relative to the previous
> event?  Or relative to the start of the audio chunk? Does it depend on
> the units used?

Absolute from the start of the Sequence.

> 4. Why does the documentation show |FRAMES |SUBFRMS| as the timestamp
> field? From what I can tell, there is no unit which includes frames
> and subframes subdivided that way, and the sampler example just uses
> the full 64 bits as a frames field.  Is this just a relic from the old
> event port documentation? (the diagram seems familiar).

Oops, relic.  I will fix this.

> 5. How are hosts/plugins supposed to deal with the multiplicity of
> units?  For example, suppose I'm a plugin or host that wants to
> receive MIDI data. How am I supposed to know what timestamp unit to
> expect?  Is there a facility for converting between different units
> automatically?  The only extra information required to convert between
> any two time units would be the bpm and sample rate.  It would be
> rather annoying to have to implement a bunch of unit conversion code
> in every host/plugin you write in order to make sure it can handle any
> unit which is tossed at it.

Indeed it would be.  Hence why none of this is there, so the extension
does not imply you are expected to have to deal with any of that.  I
suppose the fact that it is audio frames in this context needs to be
more clear.

In short, when used as port buffers, it's always frames, don't worry
about it.  The potential for other time stamp types is there for other
cases, since it's possible to use Sequences in other non-port-buffer
ways (e.g. you could send around events with entire sequences as their
payloads)

Cheers,

-dr

P.S. lv2-dev is a better place for this sort of thing




More information about the Linux-audio-dev mailing list