From 6e44b54cfbd5cf285599f4bc2004da2248061e3b Mon Sep 17 00:00:00 2001 From: David Robillard Date: Wed, 9 Nov 2011 08:09:44 +0000 Subject: Link Atom classes to C type identifiers. Define C types for all Atom classes where a useful C type is possible. --- ext/atom.lv2/atom.h | 53 ++++++++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 44 insertions(+), 9 deletions(-) (limited to 'ext/atom.lv2/atom.h') diff --git a/ext/atom.lv2/atom.h b/ext/atom.lv2/atom.h index 4b57040..39d721c 100644 --- a/ext/atom.lv2/atom.h +++ b/ext/atom.lv2/atom.h @@ -76,13 +76,13 @@ typedef struct { } LV2_Atom_Literal; /** - An atom:ID. + An atom:URID or atom:BlankID. This type may safely be cast to LV2_Atom. */ typedef struct { uint32_t type; /**< Type of this atom (mapped URI). */ uint32_t size; /**< Size in bytes, not including type and size. */ - uint32_t id; /**< Value, a URI mapped to an integer. */ + uint32_t id; /**< URID (integer mapped URI) or blank node ID. */ } LV2_Atom_ID; /** @@ -119,13 +119,8 @@ typedef struct { } LV2_Thing; /** - An Event (a timestamped Atom). - - Note this struct is different from the other structs in this header in that - it does not describe the body of some LV2_Atom, but instead is a "larger" - type which contains an LV2_Atom as its payload. This makes it possible for - an Event to be interpreted as an Atom in-place by simply pointing at - the @ref body field of the Event. + An atom:Event, a timestamped Atom. + Note this type is not an LV2_Atom, but contains an Atom as payload. */ typedef struct { uint32_t frames; /**< Time in frames relative to this block. */ @@ -133,6 +128,46 @@ typedef struct { LV2_Atom body; /**< Event body. */ } LV2_Atom_Event; +/** + An atom:Int32, a signed 32-bit integer. + This type may safely be cast to LV2_Atom. +*/ +typedef struct { + uint32_t type; + uint32_t size; + int32_t value; +} LV2_Atom_Int32; + +/** + An atom:Int64, a signed 64-bit integer. + This type may safely be cast to LV2_Atom. +*/ +typedef struct { + uint32_t type; + uint32_t size; + int64_t value; +} LV2_Atom_Int64; + +/** + An atom:Float, a 32-bit IEEE-754 floating point number. + This type may safely be cast to LV2_Atom. +*/ +typedef struct { + uint32_t type; + uint32_t size; + float value; +} LV2_Atom_Float; + +/** + An atom:Double, a 64-bit IEEE-754 floating point number. + This type may safely be cast to LV2_Atom. +*/ +typedef struct { + uint32_t type; + uint32_t size; + double value; +} LV2_Atom_Double; + /** A buffer of events (the contents of an atom:EventPort). -- cgit v1.2.1