- ola2pd modifications

This commit is contained in:
Santi Noreña 2013-04-29 19:18:42 +02:00
parent 4c206ad6ff
commit a40086b69f
4 changed files with 27 additions and 17 deletions

0
src/ola2pd/LICENSE.txt Executable file → Normal file
View file

View file

@ -81,7 +81,7 @@ public:
// --- define inlets and outlets ---
AddInAnything(); // default inlet
AddOutList(); // outlet for DMX list
post("ola2pd v0.02 - an interface to Open Lighting Arquitecture");
post("ola2pd v0.03 - an interface to Open Lighting Arquitecture");
post("(C) 2012-2013 Santi Nore libremediaserver@gmail.com");
}
void NewDmx(unsigned int universe,

View file

@ -1,3 +1,6 @@
///////////////////////////////////////////////////////////////////////////////////////////
/*
* ola2pd - interface from Open Lighting Arquitecture to Pure Data
* v 0.03
@ -27,17 +30,22 @@
*
*/
#include <m_pd.h>
#include "m_pd.h"
//#include <m_pd.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <ola/BaseTypes.h>
#include <iostream>
//#include <ola/BaseTypes.h>
#include <ola/Callback.h>
#include <ola/DmxBuffer.h>
#include <ola/OlaCallbackClient.h>
#include <ola/OlaClientWrapper.h>
#include <ola/DmxBuffer.h>
#include <ola/io/SelectServer.h>
#include <ola/network/TCPSocket.h>
//#include <ola/io/SelectServer.h>
//#include <ola/network/TCPSocket.h>
//static char *version = "$Revision: 0.01 $";
@ -47,26 +55,24 @@
/*------------------------------------------------------------------------------
* CLASS DEF
*/
static t_class *ola2pd_class;
//static t_class *ola2pd_class;
typedef struct _ola2pd {
t_object x_obj;
t_outlet *x_out;
unsigned int x_universe;
unsigned int x_counter;
unsigned int x_universe;
unsigned int x_counter;
OlaCallbackClient *x_clientpointer;
} t_ola2pd;
struct timeval m_last_data;
OlaCallbackClientWrapper m_client;
/*------------------------------------------------------------------------------
* IMPLEMENTATION
*/
static void ola2pd_open(t_ola2pd* x)
void ola2pd_open(t_ola2pd* x)
{
if (x->x_clientpointer == NULL)
{
@ -81,7 +87,7 @@ static void ola2pd_open(t_ola2pd* x)
}
}
static void ola2pd_close(t_ola2pd* x)
void ola2pd_close(t_ola2pd* x)
{
if (x->x_clientpointer != NULL)
{
@ -92,12 +98,12 @@ static void ola2pd_close(t_ola2pd* x)
}
}
static void ola2pd_universe(t_ola2pd* x, t_floatarg f)
void ola2pd_universe(t_ola2pd* x, t_floatarg f)
{
x->x_universe = f;
}
static void ola2pd_bang(t_ola2pd* x)
void ola2pd_bang(t_ola2pd* x)
{
if (x->x_clientpointer != NULL) {post("%s listening on universe %d",thisName(),x->x_universe);}
else {post("%s configured on universe %d. Send open to start listening",thisName(),x->x_universe);}
@ -144,14 +150,16 @@ void ola2pd::RegisterComplete(const string &error) {
}
}
static void *ola2pd_new()
t_class *ola2pd_class;
void *ola2pd_new()
{
t_ola2pd *x = (t_ola2pd *)pd_new(ola2pd_class);
x->x_out = outlet_new((t_object *)x, &s_symbol);
x->x_pattern = gensym("empty");
x->x_universe = 0;
x->x_counter = 0;
return (x);
return (void *)x;
}
void ola2pd_setup(void)
@ -162,9 +170,11 @@ void ola2pd_setup(void)
class_addmethod(ola2pd_class,(t_method)ola2pd_file,gensym("open"),0);
class_addmethod(ola2pd_class,(t_method)ola2pd_type,gensym("close"),0);
class_addmethod(ola2pd_class,(t_method)ola2pd_type,gensym("universe"),A_FLOAT, 0);
class_addfloat(ola2pd_class, ola2pd_universe);
}

Binary file not shown.