mirror of
https://github.com/dyne/FreeJ.git
synced 2026-06-16 12:59:33 +02:00
namespace cleanup for controllers
This commit is contained in:
@@ -1,8 +1,11 @@
|
||||
INCLUDES = -I$(top_srcdir)/src/include \
|
||||
-I$(top_srcdir)/lib \
|
||||
-I$(top_srcdir)/lib/cwiid \
|
||||
-I$(top_srcdir)/lib/shout \
|
||||
-I$(top_srcdir)/lib/sdl_ttf \
|
||||
-I$(top_srcdir)/lib/javascript \
|
||||
-I$(top_srcdir)/lib/javascript/obj
|
||||
-I$(top_srcdir)/lib/javascript/obj
|
||||
|
||||
|
||||
FREEJ_FLAGS = @SDL_CFLAGS@ @FT2_CFLAGS@ @XIPH_CFLAGS@ @UNICAP_CFLAGS@ @FFMPEG_CFLAGS@
|
||||
|
||||
|
||||
+50
-7
@@ -1,10 +1,18 @@
|
||||
%module freej
|
||||
%module(directors="1") freej
|
||||
|
||||
%{
|
||||
#include "context.h"
|
||||
#include "console.h"
|
||||
#include "gen_f0r_layer.h"
|
||||
#include "text_layer.h"
|
||||
#include "kbd_ctrl.h"
|
||||
#include "trigger_ctrl.h"
|
||||
#include "midi_ctrl.h"
|
||||
#include "vimo_ctrl.h"
|
||||
#include "joy_ctrl.h"
|
||||
#include "mouse_ctrl.h"
|
||||
#include "wiimote_ctrl.h"
|
||||
#include "osc_ctrl.h"
|
||||
%}
|
||||
|
||||
//ditch some of the defines we have that don't need to be exposed to the user
|
||||
@@ -52,24 +60,61 @@ freej_entry_typemap_in(Encoder);
|
||||
|
||||
/* This dont compile... */
|
||||
%ignore Layer::layer_gc;
|
||||
%ignore Controller::JSCall;
|
||||
%ignore JSyncThread;
|
||||
|
||||
/* Now the freej headers.. */
|
||||
%include "freej.h"
|
||||
%include "jutils.h"
|
||||
%include "context.h"
|
||||
|
||||
%include "linklist.h"
|
||||
%template(EntryLinkList) Linklist<Entry>;
|
||||
|
||||
%include "parameter.h"
|
||||
%template(ParameterLinkList) Linklist<Parameter>;
|
||||
|
||||
%include "filter.h"
|
||||
%template(FilterLinkList) Linklist<Filter>;
|
||||
|
||||
%include "blitter.h"
|
||||
%include "plugger.h"
|
||||
%include "jsync.h"
|
||||
%include "layer.h"
|
||||
// %include "jsync.h"
|
||||
|
||||
%template(LayerLinkList) Linklist<Layer>;
|
||||
%include "jutils.h"
|
||||
%include "layer.h"
|
||||
// layers...
|
||||
%include "gen_f0r_layer.h"
|
||||
%include "text_layer.h"
|
||||
%include "context.h"
|
||||
|
||||
// controllers
|
||||
%include "controller.h"
|
||||
// extends virtual methods of the Controllers to be overloadable (as callbacks)
|
||||
|
||||
%feature("director") KbdController;
|
||||
%include "kbd_ctrl.h"
|
||||
|
||||
%feature("director") TriggerController;
|
||||
%include "trigger_ctrl.h"
|
||||
|
||||
%feature("director") JoyController;
|
||||
%include "joy_ctrl.h"
|
||||
|
||||
%feature("director") MidiController;
|
||||
%include "midi_ctrl.h"
|
||||
|
||||
%feature("director") MouseController;
|
||||
%include "mouse_ctrl.h"
|
||||
|
||||
%feature("director") OscController;
|
||||
%include "osc_ctrl.h"
|
||||
|
||||
%feature("director") WiiController;
|
||||
%include "wiimote_ctrl.h"
|
||||
|
||||
%feature("director") VimoController;
|
||||
%include "vimo_ctrl.h"
|
||||
|
||||
|
||||
%extend Layer
|
||||
{
|
||||
@@ -89,5 +134,3 @@ freej_entry_typemap_in(Encoder);
|
||||
%include "luapost.i"
|
||||
#endif
|
||||
// SWIGPERL5, SWIGRUBY, SWIGJAVA, SWIGLUA...
|
||||
|
||||
|
||||
|
||||
@@ -1,8 +1,12 @@
|
||||
INCLUDES = -I$(top_srcdir)/src/include \
|
||||
-I$(top_srcdir)/lib \
|
||||
-I$(top_srcdir)/lib/lo \
|
||||
-I$(top_srcdir)/lib/cwiid \
|
||||
-I$(top_srcdir)/lib/shout \
|
||||
-I$(top_srcdir)/lib/sdl_ttf \
|
||||
-I$(top_srcdir)/lib/javascript \
|
||||
-I$(top_srcdir)/lib/javascript/obj
|
||||
-I$(top_srcdir)/lib/javascript/obj
|
||||
|
||||
|
||||
FREEJ_FLAGS = @SDL_CFLAGS@ @FT2_CFLAGS@ @XIPH_CFLAGS@ @UNICAP_CFLAGS@ @FFMPEG_CFLAGS@
|
||||
|
||||
|
||||
@@ -1,8 +1,13 @@
|
||||
INCLUDES = -I$(top_srcdir)/src/include \
|
||||
-I$(top_srcdir)/lib \
|
||||
-I$(top_srcdir)/lib/lo \
|
||||
-I$(top_srcdir)/lib/cwiid \
|
||||
-I$(top_srcdir)/lib/shout \
|
||||
-I$(top_srcdir)/lib/sdl_ttf \
|
||||
-I$(top_srcdir)/lib/javascript \
|
||||
-I$(top_srcdir)/lib/javascript/obj
|
||||
-I$(top_srcdir)/lib/javascript/obj
|
||||
|
||||
|
||||
|
||||
FREEJ_FLAGS = @SDL_CFLAGS@ @FT2_CFLAGS@ @XIPH_CFLAGS@ @UNICAP_CFLAGS@ @FFMPEG_CFLAGS@
|
||||
|
||||
@@ -27,4 +32,4 @@ clean:
|
||||
rm -f "./so_locations"
|
||||
rm -f *.o
|
||||
rm -f *.lo
|
||||
rm -f freej_ruby.cpp
|
||||
rm -f freej_ruby.*
|
||||
|
||||
Executable
+5
@@ -0,0 +1,5 @@
|
||||
#!/bin/sh
|
||||
cd .libs
|
||||
ruby1.9 -e "require 'Freej'; puts Freej::constants.sort.join(\"\n\")"
|
||||
cd -
|
||||
|
||||
@@ -24,11 +24,11 @@
|
||||
|
||||
#include <SDL.h>
|
||||
|
||||
class JoyCtrl : public Controller {
|
||||
class JoyController : public Controller {
|
||||
|
||||
public:
|
||||
JoyCtrl();
|
||||
~JoyCtrl();
|
||||
JoyController();
|
||||
~JoyController();
|
||||
|
||||
bool init(JSContext *env, JSObject *obj);
|
||||
int poll();
|
||||
|
||||
@@ -23,11 +23,11 @@
|
||||
|
||||
#include <SDL.h>
|
||||
|
||||
class KbdCtrl: public Controller {
|
||||
class KbdController: public Controller {
|
||||
|
||||
public:
|
||||
KbdCtrl();
|
||||
~KbdCtrl();
|
||||
KbdController();
|
||||
~KbdController();
|
||||
|
||||
bool init(JSContext *env, JSObject *obj);
|
||||
virtual int dispatch();
|
||||
|
||||
@@ -33,10 +33,10 @@
|
||||
|
||||
class Context;
|
||||
|
||||
class MidiControl: public Controller {
|
||||
class MidiController: public Controller {
|
||||
public:
|
||||
MidiControl();
|
||||
~MidiControl();
|
||||
MidiController();
|
||||
~MidiController();
|
||||
|
||||
bool init(JSContext*, JSObject*);
|
||||
int poll();
|
||||
|
||||
@@ -24,11 +24,11 @@
|
||||
|
||||
#include <SDL.h>
|
||||
|
||||
class TriggerCtrl : public Controller {
|
||||
class TriggerController : public Controller {
|
||||
|
||||
public:
|
||||
TriggerCtrl();
|
||||
~TriggerCtrl();
|
||||
TriggerController();
|
||||
~TriggerController();
|
||||
|
||||
bool init(JSContext *env, JSObject *obj);
|
||||
int poll();
|
||||
|
||||
+8
-8
@@ -44,7 +44,7 @@ JSFunctionSpec js_joy_ctrl_methods[] = {
|
||||
|
||||
|
||||
|
||||
JoyCtrl::JoyCtrl()
|
||||
JoyController::JoyController()
|
||||
:Controller() {
|
||||
|
||||
set_name("Joystick");
|
||||
@@ -52,7 +52,7 @@ JoyCtrl::JoyCtrl()
|
||||
num = 0;
|
||||
}
|
||||
|
||||
JoyCtrl::~JoyCtrl() {
|
||||
JoyController::~JoyController() {
|
||||
int c;
|
||||
|
||||
for(c=0;c<num;c++)
|
||||
@@ -60,9 +60,9 @@ JoyCtrl::~JoyCtrl() {
|
||||
|
||||
}
|
||||
|
||||
bool JoyCtrl::init(JSContext *env, JSObject *obj) {
|
||||
//bool JoyCtrl::init(Context *context) {
|
||||
func("JoyCtrl::init()");
|
||||
bool JoyController::init(JSContext *env, JSObject *obj) {
|
||||
//bool JoyController::init(Context *context) {
|
||||
func("JoyController::init()");
|
||||
|
||||
int found = 0;
|
||||
int c;
|
||||
@@ -109,12 +109,12 @@ bool JoyCtrl::init(JSContext *env, JSObject *obj) {
|
||||
return(true);
|
||||
}
|
||||
|
||||
int JoyCtrl::poll() {
|
||||
int JoyController::poll() {
|
||||
poll_sdlevents(SDL_JOYEVENTMASK); // calls dispatch()
|
||||
return 0;
|
||||
}
|
||||
|
||||
int JoyCtrl::dispatch() {
|
||||
int JoyController::dispatch() {
|
||||
|
||||
switch(event.type) {
|
||||
|
||||
@@ -158,7 +158,7 @@ JS(js_joy_ctrl_constructor) {
|
||||
func("%u:%s:%s",__LINE__,__FILE__,__FUNCTION__);
|
||||
char excp_msg[MAX_ERR_MSG + 1];
|
||||
|
||||
JoyCtrl *joy = new JoyCtrl();
|
||||
JoyController *joy = new JoyController();
|
||||
|
||||
// initialize with javascript context
|
||||
if(! joy->init(cx, obj) ) {
|
||||
|
||||
+8
-8
@@ -42,18 +42,18 @@ JSFunctionSpec js_kbd_ctrl_methods[] = {
|
||||
};
|
||||
|
||||
|
||||
KbdCtrl::KbdCtrl()
|
||||
KbdController::KbdController()
|
||||
:Controller() {
|
||||
set_name("Keyboard");
|
||||
func("%s this=%p",__PRETTY_FUNCTION__, this);
|
||||
}
|
||||
|
||||
KbdCtrl::~KbdCtrl() {
|
||||
KbdController::~KbdController() {
|
||||
func("%s this=%p",__PRETTY_FUNCTION__, this);
|
||||
|
||||
}
|
||||
|
||||
bool KbdCtrl::init(JSContext *env, JSObject *obj) {
|
||||
bool KbdController::init(JSContext *env, JSObject *obj) {
|
||||
|
||||
/* enable key repeat */
|
||||
SDL_EnableKeyRepeat(SDL_REPEAT_DELAY, SDL_REPEAT_INTERVAL);
|
||||
@@ -66,12 +66,12 @@ bool KbdCtrl::init(JSContext *env, JSObject *obj) {
|
||||
return(true);
|
||||
}
|
||||
|
||||
int KbdCtrl::poll() {
|
||||
int KbdController::poll() {
|
||||
poll_sdlevents(SDL_KEYEVENTMASK); // calls dispatch() foreach SDL_Event
|
||||
return 1;
|
||||
}
|
||||
|
||||
int KbdCtrl::checksym(SDLKey key, const char *name) {
|
||||
int KbdController::checksym(SDLKey key, const char *name) {
|
||||
if(keysym->sym == key) {
|
||||
strcat(keyname,name);
|
||||
func("keyboard controller detected key: %s",keyname);
|
||||
@@ -86,7 +86,7 @@ int KbdCtrl::checksym(SDLKey key, const char *name) {
|
||||
}
|
||||
|
||||
|
||||
int KbdCtrl::dispatch() {
|
||||
int KbdController::dispatch() {
|
||||
char tmp[8];
|
||||
int res = 0;
|
||||
|
||||
@@ -200,7 +200,7 @@ int KbdCtrl::dispatch() {
|
||||
return res;
|
||||
}
|
||||
|
||||
int KbdCtrl::JSCall(const char *funcname) {
|
||||
int KbdController::JSCall(const char *funcname) {
|
||||
func("%s calling method %s()", __func__, funcname);
|
||||
JSBool res;
|
||||
return Controller::JSCall(funcname, 0, NULL, &res);
|
||||
@@ -210,7 +210,7 @@ int KbdCtrl::JSCall(const char *funcname) {
|
||||
JS(js_kbd_ctrl_constructor) {
|
||||
func("%u:%s:%s",__LINE__,__FILE__,__FUNCTION__);
|
||||
|
||||
KbdCtrl *kbd = new KbdCtrl();
|
||||
KbdController *kbd = new KbdController();
|
||||
|
||||
// initialize with javascript context
|
||||
if(! kbd->init(cx, obj) ) {
|
||||
|
||||
+8
-8
@@ -49,7 +49,7 @@ JSFunctionSpec js_midi_ctrl_methods[] = {
|
||||
|
||||
JS(js_midi_ctrl_constructor) {
|
||||
func("%u:%s:%s",__LINE__,__FILE__,__FUNCTION__);
|
||||
MidiControl *midi = new MidiControl();
|
||||
MidiController *midi = new MidiController();
|
||||
// assign instance into javascript object
|
||||
// initialize with javascript context
|
||||
if(! midi->init(cx, obj) ) {
|
||||
@@ -65,14 +65,14 @@ JS(js_midi_ctrl_constructor) {
|
||||
return JS_TRUE;
|
||||
}
|
||||
|
||||
MidiControl::MidiControl():Controller() {
|
||||
MidiController::MidiController():Controller() {
|
||||
set_name("Midi Controller");
|
||||
seq_handle = NULL;
|
||||
jsenv = NULL;
|
||||
jsobj = NULL;
|
||||
}
|
||||
|
||||
MidiControl::~MidiControl() {
|
||||
MidiController::~MidiController() {
|
||||
notice("midi close client %u", seq_client_id);
|
||||
if (seq_handle)
|
||||
snd_seq_close(seq_handle);
|
||||
@@ -83,7 +83,7 @@ JS(midi_connect_from) {
|
||||
JS_CHECK_ARGC(3);
|
||||
int res = 0;
|
||||
|
||||
MidiControl *midi = (MidiControl *) JS_GetPrivate(cx,obj);
|
||||
MidiController *midi = (MidiController *) JS_GetPrivate(cx,obj);
|
||||
if(!midi) {
|
||||
error("%u:%s:%s :: Midi core data is NULL",
|
||||
__LINE__,__FILE__,__FUNCTION__);
|
||||
@@ -99,7 +99,7 @@ JS(midi_connect_from) {
|
||||
return JS_NewNumberValue(cx, res, rval);
|
||||
}
|
||||
|
||||
int MidiControl::connect_from(int myport, int dest_client, int dest_port) {
|
||||
int MidiController::connect_from(int myport, int dest_client, int dest_port) {
|
||||
// Returns: 0 on success or negative error code
|
||||
int ret = snd_seq_connect_from(seq_handle, myport, dest_client, dest_port);
|
||||
if (ret != 0) {
|
||||
@@ -108,7 +108,7 @@ int MidiControl::connect_from(int myport, int dest_client, int dest_port) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
int MidiControl::dispatch() {
|
||||
int MidiController::dispatch() {
|
||||
snd_seq_event_t *ev;
|
||||
JSBool ret = JS_FALSE;
|
||||
|
||||
@@ -216,7 +216,7 @@ typedef struct snd_seq_event {
|
||||
} snd_seq_event_t;
|
||||
*/
|
||||
|
||||
bool MidiControl::init(JSContext* jsenv, JSObject *jsobj) {
|
||||
bool MidiController::init(JSContext* jsenv, JSObject *jsobj) {
|
||||
int portid;
|
||||
int result=snd_seq_open(&seq_handle, "default", SND_SEQ_OPEN_INPUT, SND_SEQ_NONBLOCK);
|
||||
if (result<0) {
|
||||
@@ -241,7 +241,7 @@ bool MidiControl::init(JSContext* jsenv, JSObject *jsobj) {
|
||||
return(true);
|
||||
}
|
||||
|
||||
int MidiControl::poll() {
|
||||
int MidiController::poll() {
|
||||
return dispatch();
|
||||
}
|
||||
|
||||
|
||||
@@ -45,15 +45,15 @@ JSFunctionSpec js_trigger_ctrl_methods[] = {
|
||||
|
||||
|
||||
|
||||
TriggerCtrl::TriggerCtrl()
|
||||
TriggerController::TriggerController()
|
||||
:Controller() {
|
||||
set_name("Trigger");
|
||||
}
|
||||
|
||||
TriggerCtrl::~TriggerCtrl() {
|
||||
TriggerController::~TriggerController() {
|
||||
}
|
||||
|
||||
bool TriggerCtrl::init(JSContext *env, JSObject *obj) {
|
||||
bool TriggerController::init(JSContext *env, JSObject *obj) {
|
||||
func("%u:%s:%s",__LINE__,__FILE__,__FUNCTION__);
|
||||
jsenv = env;
|
||||
jsobj = obj;
|
||||
@@ -62,11 +62,11 @@ bool TriggerCtrl::init(JSContext *env, JSObject *obj) {
|
||||
return(true);
|
||||
}
|
||||
|
||||
int TriggerCtrl::poll() {
|
||||
int TriggerController::poll() {
|
||||
return dispatch();
|
||||
}
|
||||
|
||||
int TriggerCtrl::dispatch() {
|
||||
int TriggerController::dispatch() {
|
||||
jsval fval = JSVAL_VOID;
|
||||
jsval ret = JSVAL_VOID;
|
||||
JSObject *objp;
|
||||
@@ -86,7 +86,7 @@ int TriggerCtrl::dispatch() {
|
||||
JS(js_trigger_ctrl_constructor) {
|
||||
func("%u:%s:%s",__LINE__,__FILE__,__FUNCTION__);
|
||||
|
||||
TriggerCtrl *trigger = new TriggerCtrl();
|
||||
TriggerController *trigger = new TriggerController();
|
||||
|
||||
// initialize with javascript context
|
||||
if(! trigger->init(cx, obj) ) {
|
||||
|
||||
Reference in New Issue
Block a user