Skip to content

Commit

Permalink
v2.1.0 update
Browse files Browse the repository at this point in the history
  • Loading branch information
cuinjune committed May 13, 2019
1 parent 8b335cd commit 51c42fb
Show file tree
Hide file tree
Showing 3 changed files with 78 additions and 2 deletions.
5 changes: 3 additions & 2 deletions ofelia/CHANGES.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
v2.1.0: 6 May 2019
v2.1.0: 13 May 2019

* rebuilt using openFrameworks 0.10.1
* fixed ofelia get/set issue with inlets
* enabled ofUnicode, ofAlphabet and ofTrueTypeFontSettings classes
* fixed handling of list with 0 or 1 argument
* enabled ofUnicode, ofAlphabet and ofTrueTypeFontSettings classes in swig
* added "examples/text/unicode" example

v2.0.4: 17 Dec 2018
Expand Down
60 changes: 60 additions & 0 deletions ofelia/src/ofeliaClient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
==============================================================================*/

#include "ofeliaClient.h"
#include <string.h>

bool ofeliaClient::isDataValid()
{
Expand All @@ -32,30 +33,89 @@ bool ofeliaClient::isDataValid()
void ofeliaClient::bangMethod()
{
if (!isDataValid()) return;
if (data.io.hasMultiControlInlets)
{
int ac = data.io.numInlets - 1;
t_atom *av = static_cast<t_atom *>(getbytes(sizeof(t_atom) * ac));
data.io.doList(ac, av);
freebytes(av, sizeof(t_atom) * ac);
return;
}
data.lua.doFunction(&s_bang);
}

void ofeliaClient::floatMethod(t_floatarg f)
{
if (!isDataValid()) return;
if (data.io.hasMultiControlInlets)
{
int ac = data.io.numInlets;
t_atom *av = static_cast<t_atom *>(getbytes(sizeof(t_atom) * ac));
SETFLOAT(av, f);
data.io.doList(ac, av);
freebytes(av, sizeof(t_atom) * ac);
return;
}
data.lua.doFunction(&s_float, f);
}

void ofeliaClient::symbolMethod(t_symbol *s)
{
if (!isDataValid()) return;
if (data.io.hasMultiControlInlets)
{
int ac = data.io.numInlets;
t_atom *av = static_cast<t_atom *>(getbytes(sizeof(t_atom) * ac));
SETSYMBOL(av, s);
data.io.doList(ac, av);
freebytes(av, sizeof(t_atom) * ac);
return;
}
data.lua.doFunction(&s_symbol, s);
}

void ofeliaClient::pointerMethod(t_gpointer *p)
{
if (!isDataValid()) return;
if (data.io.hasMultiControlInlets)
{
int ac = data.io.numInlets;
t_atom *av = static_cast<t_atom *>(getbytes(sizeof(t_atom) * ac));
SETPOINTER(av, p);
data.io.doList(ac, av);
freebytes(av, sizeof(t_atom) * ac);
return;
}
data.lua.doFunction(&s_pointer, p);
}

void ofeliaClient::listMethod(t_symbol *s, int argc, t_atom *argv)
{
if (!isDataValid()) return;
if (!argc)
{
bangMethod();
return;
}
if (argc == 1)
{
if (argv->a_type == A_FLOAT)
floatMethod(argv->a_w.w_float);
else if (argv->a_type == A_SYMBOL)
symbolMethod(argv->a_w.w_symbol);
else if (argv->a_type == A_POINTER)
pointerMethod(argv->a_w.w_gpointer);
return;
}
if (data.io.hasMultiControlInlets)
{
int ac = data.io.numInlets + argc - 1;
t_atom *av = static_cast<t_atom *>(getbytes(sizeof(t_atom) * ac));
memcpy(av, argv, sizeof(t_atom) * argc);
data.io.doList(ac, av);
freebytes(av, sizeof(t_atom) * ac);
return;
}
data.lua.doFunction(&s_list, argc, argv);
}

Expand Down
15 changes: 15 additions & 0 deletions ofelia/src/ofeliaDefine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,21 @@ void ofeliaDefine::pointerMethod(t_gpointer *p)

void ofeliaDefine::listMethod(t_symbol *s, int argc, t_atom *argv)
{
if (!argc)
{
bangMethod();
return;
}
if (argc == 1)
{
if (argv->a_type == A_FLOAT)
floatMethod(argv->a_w.w_float);
else if (argv->a_type == A_SYMBOL)
symbolMethod(argv->a_w.w_symbol);
else if (argv->a_type == A_POINTER)
pointerMethod(argv->a_w.w_gpointer);
return;
}
if (data.io.hasMultiControlInlets)
{
int ac = data.io.numInlets + argc - 1;
Expand Down

0 comments on commit 51c42fb

Please sign in to comment.