Commit cca61791 authored by Hanspeter Portner's avatar Hanspeter Portner

update xpress.lv2.

parent 6f4dd2cf
......@@ -50,18 +50,18 @@ static const size_t moony_sz [MOONY_UDATA_COUNT] = {
[MOONY_UDATA_STASH] = sizeof(lstash_t)
};
static _Atomic uint32_t voice_id = ATOMIC_VAR_INIT(UINT32_MAX);
static _Atomic xpress_uuid_t voice_uuid = ATOMIC_VAR_INIT(0);
static uint32_t
_voice_map_new_id(void *handle)
static int64_t
_voice_map_new_uuid(void *handle)
{
(void) handle;
return atomic_fetch_sub_explicit(&voice_id, 1, memory_order_relaxed);
_Atomic xpress_uuid_t *uuid = handle;
return atomic_fetch_add_explicit(uuid, 1, memory_order_relaxed);
}
static xpress_map_t voice_map_fallback = {
.handle = NULL,
.new_id = _voice_map_new_id
.handle = &voice_uuid,
.new_uuid = _voice_map_new_uuid
};
static int
......@@ -169,7 +169,7 @@ _lvoice_map(lua_State *L)
{
moony_t *moony = lua_touserdata(L, lua_upvalueindex(1));
lua_pushinteger(L, moony->voice_map->new_id(moony->voice_map->handle));
lua_pushinteger(L, moony->voice_map->new_uuid(moony->voice_map->handle));
return 1;
}
......
......@@ -104,12 +104,13 @@ extern const LV2UI_Descriptor web_ui;
extern const LV2UI_Descriptor web_kx;
// xpress:voiceMap
typedef int64_t xpress_uuid_t;
typedef struct _xpress_map_t xpress_map_t;
typedef uint32_t (*xpress_map_new_id_t)(void *handle);
typedef xpress_uuid_t (*xpress_map_new_uuid_t)(void *handle);
struct _xpress_map_t {
void *handle;
xpress_map_new_id_t new_id;
xpress_map_new_uuid_t new_uuid;
};
typedef enum _moony_udata_t {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment