Commit eb3a71d4 authored by Hanspeter Portner's avatar Hanspeter Portner

one UI for all

parent 2067e7dd
......@@ -43,7 +43,7 @@ install(TARGETS lua DESTINATION ${DEST})
add_library(lua_ui MODULE
lua_lv2_ui.c
lua_control_ui.c)
lua_common_ui.c)
target_link_libraries(lua_ui ${LIBS_UI})
set_target_properties(lua_ui PROPERTIES PREFIX "")
install(TARGETS lua_ui DESTINATION ${DEST})
......@@ -66,7 +66,7 @@ add_custom_command(
${PROJECT_BINARY_DIR}/lua.edj
MAIN_DEPENDENCY
${PROJECT_SOURCE_DIR}/lua.edc
${PROJECT_SOURCE_DIR}/lua_control.edc)
${PROJECT_SOURCE_DIR}/lua_common.edc)
add_custom_target(THEME ALL DEPENDS ${PROJECT_BINARY_DIR}/lua.edj)
install(FILES ${PROJECT_BINARY_DIR}/manifest.ttl DESTINATION ${DEST})
......
......@@ -8,5 +8,5 @@
#define LUA_URI "http://open-music-kontrollers.ch/lv2/lua"
collections {
# include <lua_control.edc>
# include <lua_common.edc>
}
# Copyright (c) 2014 Hanspeter Portner (dev@open-music-kontrollers.ch)
#
# This software is provided 'as-is', without any express or implied
# warranty. In no event will the authors be held liable for any damages
# arising from the use of this software.
#
# Permission is granted to anyone to use this software for any purpose,
# including commercial applications, and to alter it and redistribute it
# freely, subject to the following restrictions:
#
# 1. The origin of this software must not be misrepresented; you must not
# claim that you wrote the original software. If you use this software
# in a product, an acknowledgment in the product documentation would be
# appreciated but is not required.
#
# 2. Altered source versions must be plainly marked as such, and must not be
# misrepresented as being the original software.
#
# 3. This notice may not be removed or altered from any source
# distribution.
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix foaf: <http://xmlns.com/foaf/0.1/> .
@prefix doap: <http://usefulinc.com/ns/doap#> .
......@@ -21,7 +42,7 @@
doap:name "Lua bundle" .
# Plugin UI
<http://open-music-kontrollers.ch/lv2/lua#control/ui>
<http://open-music-kontrollers.ch/lv2/lua#common/ui>
a ui:X11UI ;
lv2:requiredFeature ui:idleInterface ;
lv2:optionalFeature ui:noUserResize ;
......
......@@ -5,8 +5,8 @@
* Creative Commons Attribution Non-Commercial Share-Alike License 3.0
*/
#define LUA_CONTROL_URI LUA_URI"#control"
#define LUA_CONTROL_UI_URI LUA_CONTROL_URI"/ui"
#define LUA_COMMON_URI LUA_URI"#common"
#define LUA_COMMON_UI_URI LUA_COMMON_URI"/ui"
images {
image: "encapsulation.png" COMP;
......@@ -14,7 +14,7 @@ images {
}
group {
name: LUA_CONTROL_UI_URI"/theme";
name: LUA_COMMON_UI_URI"/theme";
parts {
part {
......
......@@ -116,7 +116,9 @@ instantiate(const LV2UI_Descriptor *descriptor, const char *plugin_uri, const ch
//edje_frametime_set(0.04);
if(strcmp(plugin_uri, LUA_CONTROL_URI))
if( strcmp(plugin_uri, LUA_CONTROL_URI)
&& strcmp(plugin_uri, LUA_MIDI_URI)
&& strcmp(plugin_uri, LUA_OSC_URI) )
return NULL;
UI *ui = calloc(1, sizeof(UI));
......@@ -154,7 +156,7 @@ instantiate(const LV2UI_Descriptor *descriptor, const char *plugin_uri, const ch
sprintf(ui->theme_path, "%s/lua.edj", bundle_path);
ui->theme = edje_object_add(ui->e);
edje_object_file_set(ui->theme, ui->theme_path, LUA_CONTROL_UI_URI"/theme");
edje_object_file_set(ui->theme, ui->theme_path, LUA_COMMON_UI_URI"/theme");
evas_object_resize(ui->theme, ui->w, ui->h);
evas_object_show(ui->theme);
......@@ -221,8 +223,8 @@ extension_data(const char *uri)
return NULL;
}
const LV2UI_Descriptor lv2_lua_control_ui = {
.URI = LUA_CONTROL_UI_URI,
const LV2UI_Descriptor lv2_lua_common_ui = {
.URI = LUA_COMMON_UI_URI,
.instantiate = instantiate,
.cleanup = cleanup,
.port_event = port_event,
......
/*
* Copyright (c) 2014 Hanspeter Portner (dev@open-music-kontrollers.ch)
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
* arising from the use of this software.
*
* Permission is granted to anyone to use this software for any purpose,
* including commercial applications, and to alter it and redistribute it
* freely, subject to the following restrictions:
*
* 1. The origin of this software must not be misrepresented; you must not
* claim that you wrote the original software. If you use this software
* in a product, an acknowledgment in the product documentation would be
* appreciated but is not required.
*
* 2. Altered source versions must be plainly marked as such, and must not be
* misrepresented as being the original software.
*
* 3. This notice may not be removed or altered from any source
* distribution.
*/
#include <lua_lv2.h>
#include <lauxlib.h>
......
/*
* Copyright (c) 2014 Hanspeter Portner (dev@open-music-kontrollers.ch)
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
* arising from the use of this software.
*
* Permission is granted to anyone to use this software for any purpose,
* including commercial applications, and to alter it and redistribute it
* freely, subject to the following restrictions:
*
* 1. The origin of this software must not be misrepresented; you must not
* claim that you wrote the original software. If you use this software
* in a product, an acknowledgment in the product documentation would be
* appreciated but is not required.
*
* 2. Altered source versions must be plainly marked as such, and must not be
* misrepresented as being the original software.
*
* 3. This notice may not be removed or altered from any source
* distribution.
*/
#include <lua_lv2.h>
#include <sys/mman.h>
......
/*
* Copyright (c) 2014 Hanspeter Portner (dev@open-music-kontrollers.ch)
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
* arising from the use of this software.
*
* Permission is granted to anyone to use this software for any purpose,
* including commercial applications, and to alter it and redistribute it
* freely, subject to the following restrictions:
*
* 1. The origin of this software must not be misrepresented; you must not
* claim that you wrote the original software. If you use this software
* in a product, an acknowledgment in the product documentation would be
* appreciated but is not required.
*
* 2. Altered source versions must be plainly marked as such, and must not be
* misrepresented as being the original software.
*
* 3. This notice may not be removed or altered from any source
* distribution.
*/
#ifndef _LUA_LV2_H
#define _LUA_LV2_H
......@@ -24,14 +47,12 @@
#define LUA_URI "http://open-music-kontrollers.ch/lv2/lua"
#define LUA_CONTROL_URI LUA_URI"#control"
#define LUA_CONTROL_UI_URI LUA_CONTROL_URI"/ui"
#define LUA_COMMON_URI LUA_URI"#common"
#define LUA_COMMON_UI_URI LUA_COMMON_URI"/ui"
#define LUA_CONTROL_URI LUA_URI"#control"
#define LUA_MIDI_URI LUA_URI"#midi"
#define LUA_MIDI_UI_URI LUA_MIDI_URI"/ui"
#define LUA_OSC_URI LUA_URI"#osc"
#define LUA_OSC_UI_URI LUA_OSC_URI"/ui"
typedef struct _Lua_VM Lua_VM;
......
......@@ -23,7 +23,7 @@
#include <lua_lv2.h>
extern const LV2UI_Descriptor lv2_lua_control_ui;
extern const LV2UI_Descriptor lv2_lua_common_ui;
LV2_SYMBOL_EXPORT const LV2UI_Descriptor*
lv2ui_descriptor(uint32_t index)
......@@ -31,7 +31,7 @@ lv2ui_descriptor(uint32_t index)
switch(index)
{
case 0:
return &lv2_lua_control_ui;
return &lv2_lua_common_ui;
default:
return NULL;
}
......
/*
* Copyright (c) 2014 Hanspeter Portner (dev@open-music-kontrollers.ch)
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
* arising from the use of this software.
*
* Permission is granted to anyone to use this software for any purpose,
* including commercial applications, and to alter it and redistribute it
* freely, subject to the following restrictions:
*
* 1. The origin of this software must not be misrepresented; you must not
* claim that you wrote the original software. If you use this software
* in a product, an acknowledgment in the product documentation would be
* appreciated but is not required.
*
* 2. Altered source versions must be plainly marked as such, and must not be
* misrepresented as being the original software.
*
* 3. This notice may not be removed or altered from any source
* distribution.
*/
#include <lua_lv2.h>
typedef struct _Handle Handle;
......
/*
* Copyright (c) 2014 Hanspeter Portner (dev@open-music-kontrollers.ch)
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
* arising from the use of this software.
*
* Permission is granted to anyone to use this software for any purpose,
* including commercial applications, and to alter it and redistribute it
* freely, subject to the following restrictions:
*
* 1. The origin of this software must not be misrepresented; you must not
* claim that you wrote the original software. If you use this software
* in a product, an acknowledgment in the product documentation would be
* appreciated but is not required.
*
* 2. Altered source versions must be plainly marked as such, and must not be
* misrepresented as being the original software.
*
* 3. This notice may not be removed or altered from any source
* distribution.
*/
#include <lua_lv2.h>
#include <osc.h>
......@@ -114,12 +137,57 @@ _osc(lua_State *L)
break;
}
case OSC_STRING:
case OSC_SYMBOL:
{
const char *s = luaL_checkstring(L, pos++);
ptr = osc_set_string(ptr, end, s);
break;
}
//TODO pop arguments
case OSC_INT64:
{
int64_t h = luaL_checkint(L, pos++);
ptr = osc_set_int64(ptr, end, h);
break;
}
case OSC_TIMETAG:
{
osc_time_t t = luaL_checkint(L, pos++);
ptr = osc_set_timetag(ptr, end, t);
break;
}
case OSC_DOUBLE:
{
double d = luaL_checknumber(L, pos++);
ptr = osc_set_double(ptr, end, d);
break;
}
case OSC_MIDI:
{
uint8_t m[4];
for(int i=0; i<4; i++)
{
lua_rawgeti(L, pos, i+1);
m[i] = luaL_checkint(L, -1);
lua_pop(L, 1);
}
pos++;
ptr = osc_set_midi(ptr, end, m);
break;
}
case OSC_CHAR:
{
char c = luaL_checkint(L, pos++);
ptr = osc_set_char(ptr, end, c);
break;
}
case OSC_BLOB:
//FIXME
break;
case OSC_NIL:
case OSC_BANG:
case OSC_TRUE:
case OSC_FALSE:
break;
default:
break;
}
......@@ -242,13 +310,61 @@ _through(osc_time_t time, const char *path, const char *fmt, osc_data_t *arg, si
break;
}
case OSC_STRING:
case OSC_SYMBOL:
{
const char *s;
ptr = osc_get_string(ptr, &s);
lua_pushstring(L, s);
break;
}
//TODO push arguments
case OSC_INT64:
{
int64_t h;
ptr = osc_get_int64(ptr, &h);
lua_pushnumber(L, h);
break;
}
case OSC_DOUBLE:
{
double d;
ptr = osc_get_double(ptr, &d);
lua_pushnumber(L, d);
break;
}
case OSC_TIMETAG:
{
osc_time_t t;
ptr = osc_get_timetag(ptr, &t);
lua_pushnumber(L, t);
break;
}
case OSC_CHAR:
{
char c;
ptr = osc_get_char(ptr, &c);
lua_pushnumber(L, c);
break;
}
case OSC_MIDI:
{
uint8_t *m;
ptr = osc_get_midi(ptr, &m);
lua_createtable(L, 4, 0);
for(int i=0; i<4; i++)
{
lua_pushnumber(L, m[i]);
lua_rawseti(L, -2, i+1);
}
break;
}
case OSC_BLOB:
//FIXME
break;
case OSC_NIL:
case OSC_BANG:
case OSC_TRUE:
case OSC_FALSE:
break;
default:
break;
}
......
# Copyright (c) 2014 Hanspeter Portner (dev@open-music-kontrollers.ch)
#
# This software is provided 'as-is', without any express or implied
# warranty. In no event will the authors be held liable for any damages
# arising from the use of this software.
#
# Permission is granted to anyone to use this software for any purpose,
# including commercial applications, and to alter it and redistribute it
# freely, subject to the following restrictions:
#
# 1. The origin of this software must not be misrepresented; you must not
# claim that you wrote the original software. If you use this software
# in a product, an acknowledgment in the product documentation would be
# appreciated but is not required.
#
# 2. Altered source versions must be plainly marked as such, and must not be
# misrepresented as being the original software.
#
# 3. This notice may not be removed or altered from any source
# distribution.
@prefix lv2: <http://lv2plug.in/ns/lv2core#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix ui: <http://lv2plug.in/ns/extensions/ui#> .
......@@ -5,20 +26,22 @@
<http://open-music-kontrollers.ch/lv2/lua#control>
a lv2:Plugin ;
lv2:binary <lua@LIB_EXT@> ;
ui:ui <http://open-music-kontrollers.ch/lv2/lua#control/ui> ;
ui:ui <http://open-music-kontrollers.ch/lv2/lua#common/ui> ;
rdfs:seeAlso <lua.ttl> .
<http://open-music-kontrollers.ch/lv2/lua#midi>
a lv2:Plugin ;
lv2:binary <lua@LIB_EXT@> ;
ui:ui <http://open-music-kontrollers.ch/lv2/lua#common/ui> ;
rdfs:seeAlso <lua.ttl> .
<http://open-music-kontrollers.ch/lv2/lua#osc>
a lv2:Plugin ;
lv2:binary <lua@LIB_EXT@> ;
ui:ui <http://open-music-kontrollers.ch/lv2/lua#common/ui> ;
rdfs:seeAlso <lua.ttl> .
<http://open-music-kontrollers.ch/lv2/lua#control/ui>
<http://open-music-kontrollers.ch/lv2/lua#common/ui>
a ui:X11UI ;
ui:binary <lua_ui@LIB_EXT@> ;
rdfs:seeAlso <lua.ttl> .
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