Browse Source

Update LV2 headers

gh-pages
falkTX 11 years ago
parent
commit
3c38575b21
16 changed files with 338 additions and 122 deletions
  1. +154
    -26
      distrho/src/lv2/atom-forge.h
  2. +16
    -22
      distrho/src/lv2/atom-helpers.h
  3. +58
    -13
      distrho/src/lv2/atom-util.h
  4. +1
    -1
      distrho/src/lv2/atom.h
  5. +18
    -15
      distrho/src/lv2/event-helpers.h
  6. +2
    -1
      distrho/src/lv2/logger.h
  7. +6
    -6
      distrho/src/lv2/lv2-midifunctions.h
  8. +2
    -1
      distrho/src/lv2/lv2.h
  9. +8
    -6
      distrho/src/lv2/lv2_external_ui.h
  10. +14
    -0
      distrho/src/lv2/lv2_rtmempool.h
  11. +2
    -2
      distrho/src/lv2/morph.h
  12. +24
    -23
      distrho/src/lv2/patch.h
  13. +30
    -3
      distrho/src/lv2/ui.h
  14. +1
    -1
      distrho/src/lv2/uri-map.h
  15. +1
    -1
      distrho/src/lv2/urid.h
  16. +1
    -1
      distrho/src/lv2/worker.h

+ 154
- 26
distrho/src/lv2/atom-forge.h View File

@@ -1,5 +1,5 @@
/*
Copyright 2008-2012 David Robillard <http://drobilla.net>
Copyright 2008-2013 David Robillard <http://drobilla.net>

Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
@@ -48,6 +48,12 @@
#include "atom-util.h"
#include "urid.h"

#if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1)
# define LV2_ATOM_FORGE_DEPRECATED __attribute__((__deprecated__))
#else
# define LV2_ATOM_FORGE_DEPRECATED
#endif

#ifdef __cplusplus
extern "C" {
#else
@@ -89,7 +95,7 @@ typedef struct {

LV2_Atom_Forge_Frame* stack;

LV2_URID Blank;
LV2_URID Blank LV2_ATOM_FORGE_DEPRECATED;
LV2_URID Bool;
LV2_URID Chunk;
LV2_URID Double;
@@ -97,9 +103,10 @@ typedef struct {
LV2_URID Int;
LV2_URID Long;
LV2_URID Literal;
LV2_URID Object;
LV2_URID Path;
LV2_URID Property;
LV2_URID Resource;
LV2_URID Resource LV2_ATOM_FORGE_DEPRECATED;
LV2_URID Sequence;
LV2_URID String;
LV2_URID Tuple;
@@ -120,6 +127,13 @@ lv2_atom_forge_set_buffer(LV2_Atom_Forge* forge, uint8_t* buf, size_t size);
static inline void
lv2_atom_forge_init(LV2_Atom_Forge* forge, LV2_URID_Map* map)
{
#if defined(__clang__)
# pragma clang diagnostic push
# pragma clang diagnostic ignored "-Wdeprecated-declarations"
#elif defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6))
# pragma GCC diagnostic push
# pragma GCC diagnostic ignored "-Wdeprecated-declarations"
#endif
lv2_atom_forge_set_buffer(forge, NULL, 0);
forge->Blank = map->map(map->handle, LV2_ATOM__Blank);
forge->Bool = map->map(map->handle, LV2_ATOM__Bool);
@@ -129,6 +143,7 @@ lv2_atom_forge_init(LV2_Atom_Forge* forge, LV2_URID_Map* map)
forge->Int = map->map(map->handle, LV2_ATOM__Int);
forge->Long = map->map(map->handle, LV2_ATOM__Long);
forge->Literal = map->map(map->handle, LV2_ATOM__Literal);
forge->Object = map->map(map->handle, LV2_ATOM__Object);
forge->Path = map->map(map->handle, LV2_ATOM__Path);
forge->Property = map->map(map->handle, LV2_ATOM__Property);
forge->Resource = map->map(map->handle, LV2_ATOM__Resource);
@@ -138,6 +153,11 @@ lv2_atom_forge_init(LV2_Atom_Forge* forge, LV2_URID_Map* map)
forge->URI = map->map(map->handle, LV2_ATOM__URI);
forge->URID = map->map(map->handle, LV2_ATOM__URID);
forge->Vector = map->map(map->handle, LV2_ATOM__Vector);
#if defined(__clang__)
# pragma clang diagnostic pop
#elif defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6))
# pragma GCC diagnostic pop
#endif
}

static inline LV2_Atom*
@@ -184,8 +204,51 @@ lv2_atom_forge_pop(LV2_Atom_Forge* forge, LV2_Atom_Forge_Frame* frame)
static inline bool
lv2_atom_forge_top_is(LV2_Atom_Forge* forge, uint32_t type)
{
return forge->stack &&
lv2_atom_forge_deref(forge, forge->stack->ref)->type == type;
return forge->stack && forge->stack->ref &&
(lv2_atom_forge_deref(forge, forge->stack->ref)->type == type);
}

/** Return true iff @p type is an atom:Object. */
static inline bool
lv2_atom_forge_is_object_type(const LV2_Atom_Forge* forge, uint32_t type)
{
#if defined(__clang__)
# pragma clang diagnostic push
# pragma clang diagnostic ignored "-Wdeprecated-declarations"
#elif defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6))
# pragma GCC diagnostic push
# pragma GCC diagnostic ignored "-Wdeprecated-declarations"
#endif
return (type == forge->Object ||
type == forge->Blank ||
type == forge->Resource);
#if defined(__clang__)
# pragma clang diagnostic pop
#elif defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6))
# pragma GCC diagnostic pop
#endif
}

/** Return true iff @p type is an atom:Object with a blank ID. */
static inline bool
lv2_atom_forge_is_blank(const LV2_Atom_Forge* forge,
uint32_t type,
const LV2_Atom_Object_Body* body)
{
#if defined(__clang__)
# pragma clang diagnostic push
# pragma clang diagnostic ignored "-Wdeprecated-declarations"
#elif defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6))
# pragma GCC diagnostic push
# pragma GCC diagnostic ignored "-Wdeprecated-declarations"
#endif
return (type == forge->Blank ||
(type == forge->Object && body->id == 0));
#if defined(__clang__)
# pragma clang diagnostic pop
#elif defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6))
# pragma GCC diagnostic pop
#endif
}

/**
@@ -199,7 +262,7 @@ static inline void
lv2_atom_forge_set_buffer(LV2_Atom_Forge* forge, uint8_t* buf, size_t size)
{
forge->buf = buf;
forge->size = size;
forge->size = (uint32_t)size;
forge->offset = 0;
forge->deref = NULL;
forge->sink = NULL;
@@ -253,7 +316,7 @@ lv2_atom_forge_raw(LV2_Atom_Forge* forge, const void* data, uint32_t size)
if (forge->sink) {
out = forge->sink(forge->handle, data, size);
} else {
out = (LV2_Atom_Forge_Ref)forge->buf + forge->offset;
out = (LV2_Atom_Forge_Ref)forge->buf + (LV2_Atom_Forge_Ref)forge->offset;
uint8_t* mem = forge->buf + forge->offset;
if (forge->offset + size > forge->size) {
return 0;
@@ -321,7 +384,8 @@ lv2_atom_forge_primitive(LV2_Atom_Forge* forge, const LV2_Atom* a)
if (lv2_atom_forge_top_is(forge, forge->Vector)) {
return lv2_atom_forge_raw(forge, LV2_ATOM_BODY_CONST(a), a->size);
} else {
return lv2_atom_forge_write(forge, a, sizeof(LV2_Atom) + a->size);
return lv2_atom_forge_write(
forge, a, (uint32_t)sizeof(LV2_Atom) + a->size);
}
}

@@ -503,7 +567,7 @@ lv2_atom_forge_tuple(LV2_Atom_Forge* forge, LV2_Atom_Forge_Frame* frame)
}

/**
Write the header of an atom:Resource.
Write the header of an atom:Object.

The passed frame will be initialised to represent this object. To complete
the object, write a sequence of properties, then pop the frame with
@@ -514,12 +578,12 @@ lv2_atom_forge_tuple(LV2_Atom_Forge* forge, LV2_Atom_Forge_Frame* frame)
LV2_URID eg_Cat = map("http://example.org/Cat");
LV2_URID eg_name = map("http://example.org/name");

// Write object header
// Start object with type eg_Cat and blank ID
LV2_Atom_Forge_Frame frame;
lv2_atom_forge_resource(forge, &frame, 1, eg_Cat);
lv2_atom_forge_object(forge, &frame, 0, eg_Cat);

// Write property: eg:name = "Hobbes"
lv2_atom_forge_property_head(forge, eg_name, 0);
// Append property eg:name = "Hobbes"
lv2_atom_forge_key(forge, eg_name);
lv2_atom_forge_string(forge, "Hobbes", strlen("Hobbes"));

// Finish object
@@ -527,39 +591,103 @@ lv2_atom_forge_tuple(LV2_Atom_Forge* forge, LV2_Atom_Forge_Frame* frame)
@endcode
*/
static inline LV2_Atom_Forge_Ref
lv2_atom_forge_object(LV2_Atom_Forge* forge,
LV2_Atom_Forge_Frame* frame,
LV2_URID id,
LV2_URID otype)
{
const LV2_Atom_Object a = {
{ (uint32_t)sizeof(LV2_Atom_Object_Body), forge->Object },
{ id, otype }
};
return lv2_atom_forge_push(
forge, frame, lv2_atom_forge_write(forge, &a, sizeof(a)));
}

/**
The same as lv2_atom_forge_object(), but for object:Resource.

This function is deprecated and should not be used in new code.
Use lv2_atom_forge_object() directly instead.
*/
LV2_ATOM_FORGE_DEPRECATED
static inline LV2_Atom_Forge_Ref
lv2_atom_forge_resource(LV2_Atom_Forge* forge,
LV2_Atom_Forge_Frame* frame,
LV2_URID id,
LV2_URID otype)
{
#if defined(__clang__)
# pragma clang diagnostic push
# pragma clang diagnostic ignored "-Wdeprecated-declarations"
#elif defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6))
# pragma GCC diagnostic push
# pragma GCC diagnostic ignored "-Wdeprecated-declarations"
#endif
const LV2_Atom_Object a = {
{ sizeof(LV2_Atom_Object) - sizeof(LV2_Atom), forge->Resource },
{ (uint32_t)sizeof(LV2_Atom_Object_Body), forge->Resource },
{ id, otype }
};
LV2_Atom_Forge_Ref out = lv2_atom_forge_write(forge, &a, sizeof(a));
return lv2_atom_forge_push(forge, frame, out);
return lv2_atom_forge_push(
forge, frame, lv2_atom_forge_write(forge, &a, sizeof(a)));
#if defined(__clang__)
# pragma clang diagnostic pop
#elif defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6))
# pragma GCC diagnostic pop
#endif
}

/**
The same as lv2_atom_forge_resource(), but for object:Blank.
The same as lv2_atom_forge_object(), but for object:Blank.

This function is deprecated and should not be used in new code.
Use lv2_atom_forge_object() directly instead.
*/
LV2_ATOM_FORGE_DEPRECATED
static inline LV2_Atom_Forge_Ref
lv2_atom_forge_blank(LV2_Atom_Forge* forge,
LV2_Atom_Forge_Frame* frame,
uint32_t id,
LV2_URID otype)
{
#if defined(__clang__)
# pragma clang diagnostic push
# pragma clang diagnostic ignored "-Wdeprecated-declarations"
#elif defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6))
# pragma GCC diagnostic push
# pragma GCC diagnostic ignored "-Wdeprecated-declarations"
#endif
const LV2_Atom_Object a = {
{ sizeof(LV2_Atom_Object) - sizeof(LV2_Atom), forge->Blank },
{ (uint32_t)sizeof(LV2_Atom_Object_Body), forge->Blank },
{ id, otype }
};
LV2_Atom_Forge_Ref out = lv2_atom_forge_write(forge, &a, sizeof(a));
return lv2_atom_forge_push(forge, frame, out);
return lv2_atom_forge_push(
forge, frame, lv2_atom_forge_write(forge, &a, sizeof(a)));
#if defined(__clang__)
# pragma clang diagnostic pop
#elif defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6))
# pragma GCC diagnostic pop
#endif
}

/**
Write a property key in an Object, to be followed by the value.

See lv2_atom_forge_object() documentation for an example.
*/
static inline LV2_Atom_Forge_Ref
lv2_atom_forge_key(LV2_Atom_Forge* forge,
LV2_URID key)
{
const LV2_Atom_Property_Body a = { key, 0, { 0, 0 } };
return lv2_atom_forge_write(forge, &a, 2 * (uint32_t)sizeof(uint32_t));
}

/**
Write the header for a property body (likely in an Object).
See lv2_atom_forge_resource() documentation for an example.
Write the header for a property body in an object, with context.

If you do not need the context, which is almost certainly the case,
use the simpler lv2_atom_forge_key() instead.
*/
static inline LV2_Atom_Forge_Ref
lv2_atom_forge_property_head(LV2_Atom_Forge* forge,
@@ -567,7 +695,7 @@ lv2_atom_forge_property_head(LV2_Atom_Forge* forge,
LV2_URID context)
{
const LV2_Atom_Property_Body a = { key, context, { 0, 0 } };
return lv2_atom_forge_write(forge, &a, 2 * sizeof(uint32_t));
return lv2_atom_forge_write(forge, &a, 2 * (uint32_t)sizeof(uint32_t));
}

/**
@@ -579,11 +707,11 @@ lv2_atom_forge_sequence_head(LV2_Atom_Forge* forge,
uint32_t unit)
{
const LV2_Atom_Sequence a = {
{ sizeof(LV2_Atom_Sequence) - sizeof(LV2_Atom), forge->Sequence },
{ (uint32_t)sizeof(LV2_Atom_Sequence_Body), forge->Sequence },
{ unit, 0 }
};
LV2_Atom_Forge_Ref out = lv2_atom_forge_write(forge, &a, sizeof(a));
return lv2_atom_forge_push(forge, frame, out);
return lv2_atom_forge_push(
forge, frame, lv2_atom_forge_write(forge, &a, sizeof(a)));
}

/**


+ 16
- 22
distrho/src/lv2/atom-helpers.h View File

@@ -1,7 +1,7 @@
// lv2_atom_helpers.h
//
/****************************************************************************
Copyright (C) 2005-2012, rncbc aka Rui Nuno Capela. All rights reserved.
Copyright (C) 2005-2013, rncbc aka Rui Nuno Capela. All rights reserved.

This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
@@ -40,7 +40,7 @@
#include <stdlib.h>
#include <assert.h>

#include "atom.h"
#include "atom-util.h"

#ifdef __cplusplus
extern "C" {
@@ -59,28 +59,18 @@ struct _LV2_Atom_Buffer
} LV2_Atom_Buffer;


// Pad a size to 64 bits (for LV2 atom:Sequence event sizes).
//
static inline
uint32_t lv2_atom_buffer_pad_size ( uint32_t size )
{
return (size + 7) & (~7);
}


// Clear and initialize an existing LV2 atom:Sequenece buffer.
//
static inline
void lv2_atom_buffer_reset ( LV2_Atom_Buffer *buf, bool input )
{
if (input)
if (input) {
buf->atoms.atom.size = sizeof(LV2_Atom_Sequence_Body);
else
buf->atoms.atom.type = buf->sequence_type;
} else {
buf->atoms.atom.size = buf->capacity;

buf->atoms.atom.type = buf->sequence_type;
buf->atoms.body.unit = 0;
buf->atoms.body.pad = 0;
buf->atoms.atom.type = buf->chunk_type;
}
}


@@ -88,12 +78,13 @@ void lv2_atom_buffer_reset ( LV2_Atom_Buffer *buf, bool input )
//
static inline
LV2_Atom_Buffer *lv2_atom_buffer_new (
uint32_t capacity, uint32_t sequence_type, bool input )
uint32_t capacity, uint32_t chunk_type, uint32_t sequence_type, bool input )
{
LV2_Atom_Buffer *buf = (LV2_Atom_Buffer *)
malloc(sizeof(LV2_Atom_Buffer) + sizeof(LV2_Atom_Sequence) + capacity);

buf->capacity = capacity;
buf->chunk_type = chunk_type;
buf->sequence_type = sequence_type;

lv2_atom_buffer_reset(buf, input);
@@ -116,7 +107,10 @@ void lv2_atom_buffer_free ( LV2_Atom_Buffer *buf )
static inline
uint32_t lv2_atom_buffer_get_size ( LV2_Atom_Buffer *buf )
{
return buf->atoms.atom.size - sizeof(LV2_Atom_Sequence_Body);
if (buf->atoms.atom.type == buf->sequence_type)
return buf->atoms.atom.size - uint32_t(sizeof(LV2_Atom_Sequence_Body));
else
return 0;
}


@@ -160,7 +154,7 @@ bool lv2_atom_buffer_end (
LV2_Atom_Buffer_Iterator *iter, LV2_Atom_Buffer *buf )
{
iter->buf = buf;
iter->offset = lv2_atom_buffer_pad_size(lv2_atom_buffer_get_size(buf));
iter->offset = lv2_atom_pad_size(lv2_atom_buffer_get_size(buf));

return (iter->offset < buf->capacity - sizeof(LV2_Atom_Event));
}
@@ -187,7 +181,7 @@ bool lv2_atom_buffer_increment ( LV2_Atom_Buffer_Iterator *iter )
LV2_Atom_Sequence *atoms = &buf->atoms;
uint32_t size = ((LV2_Atom_Event *) ((char *)
LV2_ATOM_CONTENTS(LV2_Atom_Sequence, atoms) + iter->offset))->body.size;
iter->offset += lv2_atom_buffer_pad_size(sizeof(LV2_Atom_Event) + size);
iter->offset += lv2_atom_pad_size(uint32_t(sizeof(LV2_Atom_Event)) + size);

return true;
}
@@ -239,7 +233,7 @@ bool lv2_atom_buffer_write (

memcpy(LV2_ATOM_BODY(&ev->body), data, size);

size = lv2_atom_buffer_pad_size(sizeof(LV2_Atom_Event) + size);
size = lv2_atom_pad_size(uint32_t(sizeof(LV2_Atom_Event)) + size);
atoms->atom.size += size;
iter->offset += size;



+ 58
- 13
distrho/src/lv2/atom-util.h View File

@@ -1,5 +1,5 @@
/*
Copyright 2008-2012 David Robillard <http://drobilla.net>
Copyright 2008-2013 David Robillard <http://drobilla.net>

Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
@@ -41,14 +41,14 @@ extern "C" {
static inline uint32_t
lv2_atom_pad_size(uint32_t size)
{
return (size + 7) & (~7);
return (size + 7U) & (~7U);
}

/** Return the total size of @p atom, including the header. */
static inline uint32_t
lv2_atom_total_size(const LV2_Atom* atom)
{
return sizeof(LV2_Atom) + atom->size;
return (uint32_t)sizeof(LV2_Atom) + atom->size;
}

/** Return true iff @p atom is null. */
@@ -80,10 +80,10 @@ lv2_atom_sequence_begin(const LV2_Atom_Sequence_Body* body)
}

/** Get an iterator pointing to the end of a Sequence body. */
static inline const LV2_Atom_Event*
lv2_atom_sequence_end(const LV2_Atom_Sequence_Body* body, uint32_t size)
static inline LV2_Atom_Event*
lv2_atom_sequence_end(LV2_Atom_Sequence_Body* body, uint32_t size)
{
return (const LV2_Atom_Event*)((const uint8_t*)body + lv2_atom_pad_size(size));
return (LV2_Atom_Event*)((uint8_t*)body + lv2_atom_pad_size(size));
}

/** Return true iff @p i has reached the end of @p body. */
@@ -99,7 +99,6 @@ lv2_atom_sequence_is_end(const LV2_Atom_Sequence_Body* body,
static inline const LV2_Atom_Event*
lv2_atom_sequence_next(const LV2_Atom_Event* i)
{
if (!i) return NULL;
return (const LV2_Atom_Event*)((const uint8_t*)i
+ sizeof(LV2_Atom_Event)
+ lv2_atom_pad_size(i->body.size));
@@ -128,6 +127,52 @@ lv2_atom_sequence_next(const LV2_Atom_Event* i)
!lv2_atom_sequence_is_end(body, size, (iter)); \
(iter) = lv2_atom_sequence_next(iter))

/**
@}
@name Sequence Utilities
@{
*/

/**
Clear all events from @p sequence.

This simply resets the size field, the other fields are left untouched.
*/
static inline void
lv2_atom_sequence_clear(LV2_Atom_Sequence* seq)
{
seq->atom.size = sizeof(LV2_Atom_Sequence_Body);
}

/**
Append an event at the end of @p sequence.

@param seq Sequence to append to.
@param capacity Total capacity of the sequence atom
(e.g. as set by the host for sequence output ports).
@param event Event to write.

@return A pointer to the newly written event in @p seq,
or NULL on failure (insufficient space).
*/
static inline LV2_Atom_Event*
lv2_atom_sequence_append_event(LV2_Atom_Sequence* seq,
uint32_t capacity,
const LV2_Atom_Event* event)
{
const uint32_t total_size = (uint32_t)sizeof(*event) + event->body.size;
if (capacity - seq->atom.size < total_size) {
return NULL;
}

LV2_Atom_Event* e = lv2_atom_sequence_end(&seq->body, seq->atom.size);
memcpy(e, event, total_size);

seq->atom.size += lv2_atom_pad_size(total_size);

return e;
}

/**
@}
@name Tuple Iterator
@@ -143,7 +188,7 @@ lv2_atom_tuple_begin(const LV2_Atom_Tuple* tup)

/** Return true iff @p i has reached the end of @p body. */
static inline bool
lv2_atom_tuple_is_end(const void* body, uint32_t size, LV2_Atom* i)
lv2_atom_tuple_is_end(const void* body, uint32_t size, const LV2_Atom* i)
{
return (const uint8_t*)i >= ((const uint8_t*)body + size);
}
@@ -169,13 +214,13 @@ lv2_atom_tuple_next(const LV2_Atom* i)
@endcode
*/
#define LV2_ATOM_TUPLE_FOREACH(tuple, iter) \
for (LV2_Atom* (iter) = lv2_atom_tuple_begin(tuple); \
!lv2_atom_tuple_is_end(LV2_ATOM_BODY(tuple), (tuple)->size, (iter)); \
for (const LV2_Atom* (iter) = lv2_atom_tuple_begin(tuple); \
!lv2_atom_tuple_is_end(LV2_ATOM_BODY_CONST(tuple), (tuple)->size, (iter)); \
(iter) = lv2_atom_tuple_next(iter))

/** Like LV2_ATOM_TUPLE_FOREACH but for a headerless tuple body. */
#define LV2_ATOM_TUPLE_BODY_FOREACH(body, size, iter) \
for (LV2_Atom* (iter) = (LV2_Atom*)body; \
for (const LV2_Atom* (iter) = (const LV2_Atom*)body; \
!lv2_atom_tuple_is_end(body, size, (iter)); \
(iter) = lv2_atom_tuple_next(iter))

@@ -208,8 +253,8 @@ lv2_atom_object_next(const LV2_Atom_Property_Body* i)
const LV2_Atom* const value = (const LV2_Atom*)(
(const uint8_t*)i + 2 * sizeof(uint32_t));
return (const LV2_Atom_Property_Body*)(
(const uint8_t*)i + lv2_atom_pad_size(sizeof(LV2_Atom_Property_Body)
+ value->size));
(const uint8_t*)i + lv2_atom_pad_size(
(uint32_t)sizeof(LV2_Atom_Property_Body) + value->size));
}

/**


+ 1
- 1
distrho/src/lv2/atom.h View File

@@ -189,7 +189,7 @@ typedef struct {

/** The body of an atom:Object. May be cast to LV2_Atom. */
typedef struct {
uint32_t id; /**< URID (atom:Resource) or blank ID (atom:Blank). */
uint32_t id; /**< URID, or 0 for blank. */
uint32_t otype; /**< Type URID (same as rdf:type, for fast dispatch). */
/* Contents (a series of property bodies) follow here. */
} LV2_Atom_Object_Body;


+ 18
- 15
distrho/src/lv2/event-helpers.h View File

@@ -50,7 +50,7 @@ extern "C" {
static inline uint16_t
lv2_event_pad_size(uint16_t size)
{
return (size + 7) & (~7);
return (uint16_t)(size + 7U) & (uint16_t)(~7U);
}


@@ -60,7 +60,7 @@ lv2_event_pad_size(uint16_t size)
static inline void
lv2_event_buffer_reset(LV2_Event_Buffer* buf,
uint16_t stamp_type,
uint8_t *data)
uint8_t* data)
{
buf->data = data;
buf->header_size = sizeof(LV2_Event_Buffer);
@@ -130,7 +130,8 @@ lv2_event_increment(LV2_Event_Iterator* iter)
LV2_Event* const ev = (LV2_Event*)(
(uint8_t*)iter->buf->data + iter->offset);

iter->offset += lv2_event_pad_size(sizeof(LV2_Event) + ev->size);
iter->offset += lv2_event_pad_size(
(uint16_t)((uint16_t)sizeof(LV2_Event) + ev->size));

return true;
}
@@ -190,7 +191,7 @@ lv2_event_write(LV2_Event_Iterator* iter,
memcpy((uint8_t*)ev + sizeof(LV2_Event), data, size);
++iter->buf->event_count;

size = lv2_event_pad_size(sizeof(LV2_Event) + size);
size = lv2_event_pad_size((uint16_t)(sizeof(LV2_Event) + size));
iter->buf->size += size;
iter->offset += size;

@@ -208,11 +209,12 @@ lv2_event_reserve(LV2_Event_Iterator* iter,
uint16_t type,
uint16_t size)
{
if (iter->buf->capacity - iter->buf->size < sizeof(LV2_Event) + size)
const uint16_t total_size = (uint16_t)(sizeof(LV2_Event) + size);
if (iter->buf->capacity - iter->buf->size < total_size)
return NULL;

LV2_Event* const ev = (LV2_Event*)((uint8_t*)iter->buf->data +
iter->offset);
LV2_Event* const ev = (LV2_Event*)(
(uint8_t*)iter->buf->data + iter->offset);

ev->frames = frames;
ev->subframes = subframes;
@@ -220,9 +222,9 @@ lv2_event_reserve(LV2_Event_Iterator* iter,
ev->size = size;
++iter->buf->event_count;

size = lv2_event_pad_size(sizeof(LV2_Event) + size);
iter->buf->size += size;
iter->offset += size;
const uint16_t padded_size = lv2_event_pad_size(total_size);
iter->buf->size += padded_size;
iter->offset += padded_size;

return (uint8_t*)ev + sizeof(LV2_Event);
}
@@ -238,19 +240,20 @@ lv2_event_write_event(LV2_Event_Iterator* iter,
const LV2_Event* ev,
const uint8_t* data)
{
if (iter->buf->capacity - iter->buf->size < sizeof(LV2_Event) + ev->size)
const uint16_t total_size = (uint16_t)(sizeof(LV2_Event) + ev->size);
if (iter->buf->capacity - iter->buf->size < total_size)
return false;

LV2_Event* const write_ev = (LV2_Event*)(
(uint8_t*)iter->buf->data + iter->offset);
(uint8_t*)iter->buf->data + iter->offset);

*write_ev = *ev;
memcpy((uint8_t*)write_ev + sizeof(LV2_Event), data, ev->size);
++iter->buf->event_count;

const uint16_t size = lv2_event_pad_size(sizeof(LV2_Event) + ev->size);
iter->buf->size += size;
iter->offset += size;
const uint16_t padded_size = lv2_event_pad_size(total_size);
iter->buf->size += padded_size;
iter->offset += padded_size;

return true;
}


+ 2
- 1
distrho/src/lv2/logger.h View File

@@ -1,5 +1,5 @@
/*
Copyright 2012 David Robillard <http://drobilla.net>
Copyright 2012-2013 David Robillard <http://drobilla.net>

Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
@@ -28,6 +28,7 @@
#define LV2_ATOM_LOGGER_H

#include <stdio.h>
#include <string.h>

#include "log.h"



+ 6
- 6
distrho/src/lv2/lv2-midifunctions.h View File

@@ -50,7 +50,7 @@ inline double lv2midi_get_event(LV2_MIDIState* state,
}
*timestamp = *(double*)(state->midi->data + state->position);
*size = *(size_t*)(state->midi->data + state->position + sizeof(double));
*size = (uint32_t)*(size_t*)(state->midi->data + state->position + sizeof(double));
*data = state->midi->data + state->position +
sizeof(double) + sizeof(size_t);
return *timestamp;
@@ -64,10 +64,10 @@ inline double lv2midi_step(LV2_MIDIState* state) {
return state->frame_count;
}
state->position += sizeof(double);
state->position += (uint32_t)sizeof(double);
size_t size = *(size_t*)(state->midi->data + state->position);
state->position += sizeof(size_t);
state->position += size;
state->position += (uint32_t)sizeof(size_t);
state->position += (uint32_t)size;
return *(double*)(state->midi->data + state->position);
}

@@ -80,9 +80,9 @@ inline void lv2midi_put_event(LV2_MIDIState* state,
if (state->midi->size + sizeof(double) + sizeof(size_t) + size < state->midi->capacity)
{
*((double*)(state->midi->data + state->midi->size)) = timestamp;
state->midi->size += sizeof(double);
state->midi->size += (uint32_t)sizeof(double);
*((size_t*)(state->midi->data + state->midi->size)) = size;
state->midi->size += sizeof(size_t);
state->midi->size += (uint32_t)sizeof(size_t);
memcpy(state->midi->data + state->midi->size, data, size);

state->midi->size += size;


+ 2
- 1
distrho/src/lv2/lv2.h View File

@@ -21,7 +21,7 @@
/**
@file lv2.h
API for the LV2 specification <http://lv2plug.in/ns/lv2core>.
Revision: 6.5
Revision: 12.0
*/

#ifndef LV2_H_INCLUDED
@@ -109,6 +109,7 @@
#define LV2_CORE__port LV2_CORE_PREFIX "port"
#define LV2_CORE__portProperty LV2_CORE_PREFIX "portProperty"
#define LV2_CORE__project LV2_CORE_PREFIX "project"
#define LV2_CORE__prototype LV2_CORE_PREFIX "prototype"
#define LV2_CORE__reportsLatency LV2_CORE_PREFIX "reportsLatency"
#define LV2_CORE__requiredFeature LV2_CORE_PREFIX "requiredFeature"
#define LV2_CORE__sampleRate LV2_CORE_PREFIX "sampleRate"


+ 8
- 6
distrho/src/lv2/lv2_external_ui.h View File

@@ -73,17 +73,19 @@ typedef struct _LV2_External_UI_Widget {
*/
typedef struct _LV2_External_UI_Host {
/**
* Callback that plugin UI will call
* when UI (GUI window) is closed by user.
* Callback that plugin UI will call when UI (GUI window) is closed by user.
* This callback will be called during execution of LV2_External_UI_Widget::run()
* (i.e. not from background thread).
*
* After this callback is called, UI is defunct. Host must call
* LV2UI_Descriptor::cleanup(). If host wants to make the UI visible
* again UI must be reinstantiated.
* After this callback is called, UI is defunct. Host must call LV2UI_Descriptor::cleanup().
* If host wants to make the UI visible again, the UI must be reinstantiated.
*
* @note When using the depreated URI LV2_EXTERNAL_UI_DEPRECATED_URI,
* some hosts will not call LV2UI_Descriptor::cleanup() as they should,
* and may call show() again without re-initialization.
*
* @param controller Host context associated with plugin UI, as
* supplied to LV2UI_Descriptor::instantiate()
* supplied to LV2UI_Descriptor::instantiate().
*/
void (*ui_closed)(LV2UI_Controller controller);



+ 14
- 0
distrho/src/lv2/lv2_rtmempool.h View File

@@ -27,6 +27,9 @@
/** max size of memory pool name, in chars, including terminating zero char */
#define LV2_RTSAFE_MEMORY_POOL_NAME_MAX 128

/** This extension used to be defined by a different URI */
#define LV2_RTSAFE_MEMORY_POOL_DEPRECATED_URI "http://home.gna.org/lv2dynparam/rtmempool/v1"

#ifdef __cplusplus
extern "C" {
#else
@@ -98,6 +101,17 @@ typedef struct _LV2_RtMemPool_Pool {

} LV2_RtMemPool_Pool;

/**
* Deprecated feature for backwards compatibility.
*/
typedef struct _LV2_RtMemPool_Pool_Deprecated {
unsigned char (*create)(const char*,size_t,size_t,size_t,LV2_RtMemPool_Handle*);
void (*destroy)(LV2_RtMemPool_Handle);
void* (*allocate_atomic)(LV2_RtMemPool_Handle);
void* (*allocate_sleepy)(LV2_RtMemPool_Handle);
void (*deallocate)(LV2_RtMemPool_Handle,void*);
} LV2_RtMemPool_Pool_Deprecated;

#ifdef __cplusplus
} /* extern "C" */
#endif


+ 2
- 2
distrho/src/lv2/morph.h View File

@@ -19,8 +19,8 @@

#include <stdint.h>

#include "lv2/lv2plug.in/ns/lv2core/lv2.h"
#include "lv2/lv2plug.in/ns/ext/urid/urid.h"
#include "lv2.h"
#include "urid.h"

#define LV2_MORPH_URI "http://lv2plug.in/ns/ext/morph"
#define LV2_MORPH_PREFIX LV2_MORPH_URI "#"


+ 24
- 23
distrho/src/lv2/patch.h View File

@@ -28,28 +28,29 @@
#define LV2_PATCH_URI "http://lv2plug.in/ns/ext/patch"
#define LV2_PATCH_PREFIX LV2_PATCH_URI "#"

#define LV2_PATCH__Ack LV2_PATCH_PREFIX "Ack"
#define LV2_PATCH__Delete LV2_PATCH_PREFIX "Delete"
#define LV2_PATCH__Error LV2_PATCH_PREFIX "Error"
#define LV2_PATCH__Get LV2_PATCH_PREFIX "Get"
#define LV2_PATCH__Message LV2_PATCH_PREFIX "Message"
#define LV2_PATCH__Move LV2_PATCH_PREFIX "Move"
#define LV2_PATCH__Patch LV2_PATCH_PREFIX "Patch"
#define LV2_PATCH__Post LV2_PATCH_PREFIX "Post"
#define LV2_PATCH__Put LV2_PATCH_PREFIX "Put"
#define LV2_PATCH__Request LV2_PATCH_PREFIX "Request"
#define LV2_PATCH__Response LV2_PATCH_PREFIX "Response"
#define LV2_PATCH__Set LV2_PATCH_PREFIX "Set"
#define LV2_PATCH__add LV2_PATCH_PREFIX "add"
#define LV2_PATCH__body LV2_PATCH_PREFIX "body"
#define LV2_PATCH__destination LV2_PATCH_PREFIX "destination"
#define LV2_PATCH__property LV2_PATCH_PREFIX "property"
#define LV2_PATCH__readable LV2_PATCH_PREFIX "readable"
#define LV2_PATCH__remove LV2_PATCH_PREFIX "remove"
#define LV2_PATCH__request LV2_PATCH_PREFIX "request"
#define LV2_PATCH__subject LV2_PATCH_PREFIX "subject"
#define LV2_PATCH__value LV2_PATCH_PREFIX "value"
#define LV2_PATCH__wildcard LV2_PATCH_PREFIX "wildcard"
#define LV2_PATCH__writable LV2_PATCH_PREFIX "writable"
#define LV2_PATCH__Ack LV2_PATCH_PREFIX "Ack"
#define LV2_PATCH__Delete LV2_PATCH_PREFIX "Delete"
#define LV2_PATCH__Error LV2_PATCH_PREFIX "Error"
#define LV2_PATCH__Get LV2_PATCH_PREFIX "Get"
#define LV2_PATCH__Message LV2_PATCH_PREFIX "Message"
#define LV2_PATCH__Move LV2_PATCH_PREFIX "Move"
#define LV2_PATCH__Patch LV2_PATCH_PREFIX "Patch"
#define LV2_PATCH__Post LV2_PATCH_PREFIX "Post"
#define LV2_PATCH__Put LV2_PATCH_PREFIX "Put"
#define LV2_PATCH__Request LV2_PATCH_PREFIX "Request"
#define LV2_PATCH__Response LV2_PATCH_PREFIX "Response"
#define LV2_PATCH__Set LV2_PATCH_PREFIX "Set"
#define LV2_PATCH__add LV2_PATCH_PREFIX "add"
#define LV2_PATCH__body LV2_PATCH_PREFIX "body"
#define LV2_PATCH__destination LV2_PATCH_PREFIX "destination"
#define LV2_PATCH__property LV2_PATCH_PREFIX "property"
#define LV2_PATCH__readable LV2_PATCH_PREFIX "readable"
#define LV2_PATCH__remove LV2_PATCH_PREFIX "remove"
#define LV2_PATCH__request LV2_PATCH_PREFIX "request"
#define LV2_PATCH__subject LV2_PATCH_PREFIX "subject"
#define LV2_PATCH__sequenceNumber LV2_PATCH_PREFIX "sequenceNumber"
#define LV2_PATCH__value LV2_PATCH_PREFIX "value"
#define LV2_PATCH__wildcard LV2_PATCH_PREFIX "wildcard"
#define LV2_PATCH__writable LV2_PATCH_PREFIX "writable"

#endif /* LV2_PATCH_H */

+ 30
- 3
distrho/src/lv2/ui.h View File

@@ -1,6 +1,6 @@
/*
LV2 UI Extension
Copyright 2009-2012 David Robillard <d@drobilla.net>
Copyright 2009-2013 David Robillard <d@drobilla.net>
Copyright 2006-2011 Lars Luthman <lars.luthman@gmail.com>

Permission to use, copy, modify, and/or distribute this software for any
@@ -51,8 +51,10 @@
#define LV2_UI__portNotification LV2_UI_PREFIX "portNotification"
#define LV2_UI__portSubscribe LV2_UI_PREFIX "portSubscribe"
#define LV2_UI__resize LV2_UI_PREFIX "resize"
#define LV2_UI__showInterface LV2_UI_PREFIX "showInterface"
#define LV2_UI__touch LV2_UI_PREFIX "touch"
#define LV2_UI__ui LV2_UI_PREFIX "ui"
#define LV2_UI__updateRate LV2_UI_PREFIX "updateRate"

/**
The index returned by LV2_UI_Port_Port::port_index() for unknown ports.
@@ -260,7 +262,7 @@ typedef struct _LV2UI_Port_Map {
/**
Get the index for the port with the given @p symbol.

@return The index of the port, or LV2_UI_INVALID_PORT_INDEX if no such
@return The index of the port, or LV2UI_INVALID_PORT_INDEX if no such
port is found.
*/
uint32_t (*port_index)(LV2UI_Feature_Handle handle, const char* symbol);
@@ -339,7 +341,7 @@ typedef struct _LV2UI_Touch {
} LV2UI_Touch;

/**
UI Idle Feature (LV2_UI__idle)
UI Idle Feature (LV2_UI__idleInterface)

This feature is an addition to the UI API that provides a callback for the
host to call rapidly, e.g. to drive the idle callback of a toolkit.
@@ -356,6 +358,31 @@ typedef struct _LV2UI_Idle_Interface {
int (*idle)(LV2UI_Handle ui);
} LV2UI_Idle_Interface;

/**
UI Show Interface (LV2_UI__showInterface)

UIs can use this interface to provide show/hide methods to pop up a window,
which allows them to function in hosts unable to embed their widget type.

If used, LV2UI_Idle_Interface should also be used to drive the UI. The UI
should return non-zero from idle() when the window has been closed.
*/
typedef struct _LV2UI_Show_Interface {
/**
Show a window for this UI.

@return 0 on success, or anything else to stop being called.
*/
int (*show)(LV2UI_Handle ui);

/**
Hide the window for this UI.

@return 0 on success, or anything else to stop being called.
*/
int (*hide)(LV2UI_Handle ui);
} LV2UI_Show_Interface;

/**
Peak data for a slice of time, the update format for ui:peakProtocol.
*/


+ 1
- 1
distrho/src/lv2/uri-map.h View File

@@ -92,7 +92,7 @@ typedef struct {
} LV2_URI_Map_Feature;

#ifdef __cplusplus
} /* extern "C" */
} /* extern "C" */
#endif

#endif /* LV2_URI_MAP_H */

+ 1
- 1
distrho/src/lv2/urid.h View File

@@ -123,7 +123,7 @@ typedef struct _LV2_URID_Unmap {
} LV2_URID_Unmap;

#ifdef __cplusplus
} /* extern "C" */
} /* extern "C" */
#endif

#endif /* LV2_URID_H */

+ 1
- 1
distrho/src/lv2/worker.h View File

@@ -152,7 +152,7 @@ typedef struct _LV2_Worker_Schedule {
} LV2_Worker_Schedule;

#ifdef __cplusplus
} /* extern "C" */
} /* extern "C" */
#endif

#endif /* LV2_WORKER_H */

Loading…
Cancel
Save