Commit b920c4b3 authored by thomas's avatar thomas
Browse files

changes for wmax


git-svn-id: https://svn.grrrr.org/ext/trunk@697 4d9ac71a-51e6-0310-8455-cad1006bcd31
parent a99b8b67
......@@ -274,6 +274,9 @@ general:
- make links flext.a -> libflext.a for compatibility
- add double handlers
- add signal in/out connection query function
bugs:
- PD: problems with timed buffer redrawing (takes a lot of cpu time)
- hard thread termination upon object destruction doesn't seem to work properly -> crash
......
This diff is collapsed.
......@@ -249,8 +249,12 @@ class FLEXT_SHARE FLEXT_CLASSDEF(flext_obj):
#if FLEXT_SYS == FLEXT_SYS_JMAX
static void obj_new(fts_object_t *o, int winlet, fts_symbol_t s, int ac, const fts_atom_t *at);
static void obj_free(fts_object_t *o, int winlet, fts_symbol_t s, int ac, const fts_atom_t *at);
#else
#if FLEXT_SYS == FLEXT_SYS_MAX
static flext_hdr *obj_new(const t_symbol *s,short argc,t_atom *argv);
#else
static flext_hdr *obj_new(const t_symbol *s,int argc,t_atom *argv);
#endif
static void obj_free(flext_hdr *o);
#endif
......
......@@ -849,24 +849,6 @@ private:
static void px_method(px_object *c,const t_symbol *s,int argc,t_atom *argv);
};
#elif FLEXT_SYS == FLEXT_SYS_MAX
typedef object px_object;
static void cb_px_float(t_class *c,float f);
static void cb_px_int(t_class *c,int v);
static void cb_px_bang(t_class *c);
static void cb_px_in1(t_class *c,int v);
static void cb_px_in2(t_class *c,int v);
static void cb_px_in3(t_class *c,int v);
static void cb_px_in4(t_class *c,int v);
static void cb_px_in5(t_class *c,int v);
static void cb_px_in6(t_class *c,int v);
static void cb_px_in7(t_class *c,int v);
static void cb_px_in8(t_class *c,int v);
static void cb_px_in9(t_class *c,int v);
#endif
#if FLEXT_SYS == FLEXT_SYS_PD || FLEXT_SYS == FLEXT_SYS_MAX
static void cb_px_anything(t_class *c,const t_symbol *s,int argc,t_atom *argv);
static void cb_px_ft1(t_class *c,float f);
......@@ -879,6 +861,36 @@ private:
static void cb_px_ft8(t_class *c,float f);
static void cb_px_ft9(t_class *c,float f);
#elif FLEXT_SYS == FLEXT_SYS_MAX
typedef object px_object;
static void cb_px_float(t_class *c,double f);
static void cb_px_int(t_class *c,long v);
static void cb_px_bang(t_class *c);
static void cb_px_in1(t_class *c,long v);
static void cb_px_in2(t_class *c,long v);
static void cb_px_in3(t_class *c,long v);
static void cb_px_in4(t_class *c,long v);
static void cb_px_in5(t_class *c,long v);
static void cb_px_in6(t_class *c,long v);
static void cb_px_in7(t_class *c,long v);
static void cb_px_in8(t_class *c,long v);
static void cb_px_in9(t_class *c,long v);
static void cb_px_ft1(t_class *c,double f);
static void cb_px_ft2(t_class *c,double f);
static void cb_px_ft3(t_class *c,double f);
static void cb_px_ft4(t_class *c,double f);
static void cb_px_ft5(t_class *c,double f);
static void cb_px_ft6(t_class *c,double f);
static void cb_px_ft7(t_class *c,double f);
static void cb_px_ft8(t_class *c,double f);
static void cb_px_ft9(t_class *c,double f);
static void cb_px_anything(t_class *c,const t_symbol *s,short argc,t_atom *argv);
#endif
#if FLEXT_SYS == FLEXT_SYS_PD || FLEXT_SYS == FLEXT_SYS_MAX
px_object **inlets;
#elif FLEXT_SYS == FLEXT_SYS_JMAX
static void jmax_proxy(fts_object_t *c, int winlet, fts_symbol_t s, int ac, const fts_atom_t *at);
......
......@@ -122,6 +122,8 @@ t_int *flext_dsp::dspmeth(t_int *w)
#if FLEXT_SYS == FLEXT_SYS_JMAX
void flext_dsp::cb_dsp(fts_object_t *c, int winlet, fts_symbol_t s, int ac, const fts_atom_t *at)
#elif FLEXT_SYS == FLEXT_SYS_MAX
void flext_dsp::cb_dsp(t_class *c,t_signal **sp,short *count)
#else
void flext_dsp::cb_dsp(t_class *c,t_signal **sp)
#endif
......
......@@ -155,6 +155,8 @@ private:
static void cb_dsp(fts_object_t *o, int winlet, fts_symbol_t s, int ac, const fts_atom_t *at);
// static void cb_dsp_init(fts_object_t *o, int winlet, fts_symbol_t *s, int ac, const fts_atom_t *at);
// static void cb_dsp_delete(fts_object_t *o, int winlet, fts_symbol_t *s, int ac, const fts_atom_t *at);
#elif FLEXT_SYS == FLEXT_SYS_MAX
static void cb_dsp(t_class *c,t_signal **s,short *count);
#else
static void cb_dsp(t_class *c,t_signal **s);
#endif
......
......@@ -50,6 +50,13 @@ WARRANTIES, see the file, "license.txt," in this distribution.
#endif
#endif
#if FLEXT_SYS == FLEXT_SYS_MAX && FLEXT_OS == FLEXT_OS_WIN
// for wmax alignment must be 2 bytes!
#pragma pack(2)
#endif
// include all the flext interface definitions
#include "fldefs.h"
......@@ -59,6 +66,9 @@ WARRANTIES, see the file, "license.txt," in this distribution.
// include the flext dsp class
#include "fldsp.h"
/*
#if FLEXT_SYS == FLEXT_SYS_MAX && FLEXT_OS == FLEXT_OS_WIN
#pragma pack(pop)
#endif
*/
#endif // FLEXT_H
......@@ -27,6 +27,8 @@ WARRANTIES, see the file, "license.txt," in this distribution.
#elif FLEXT_OS == FLEXT_OS_WIN
#if FLEXT_SYS == FLEXT_SYS_PD
#define ALIASSLASH '/'
#elif FLEXT_SYS == FLEXT_SYS_MAX
#define ALIASSLASH '/'
#else
#error "Undefined"
#endif
......@@ -332,7 +334,11 @@ void flext_obj::obj_new(fts_object_t *o, int, fts_symbol_t s, int _argc_, const
{
flext_hdr *obj = (flext_hdr *)o;
#else
#if FLEXT_SYS == FLEXT_SYS_MAX
flext_hdr *flext_obj::obj_new(const t_symbol *s,short _argc_,t_atom *argv)
#else
flext_hdr *flext_obj::obj_new(const t_symbol *s,int _argc_,t_atom *argv)
#endif
{
flext_hdr *obj = NULL;
#endif
......
......@@ -43,17 +43,39 @@ add_method1(c,cb_px_ft ## IX,"ft" #IX,A_FLOAT)
#elif FLEXT_SYS == FLEXT_SYS_MAX
void flext_base::cb_px_anything(t_class *c,const t_symbol *s,int argc,t_atom *argv)
void flext_base::cb_px_anything(t_class *c,const t_symbol *s,short argc,t_atom *argv)
{
// check if inlet allows anything (or list)
flext_base *o = thisObject(c);
int ci = ((flext_hdr *)o->x_obj)->curinlet;
o->m_methodmain(ci,s,argc,argv);
}
void flext_base::cb_px_int(t_class *c,int v)
#if 0 //FLEXT_OS == FLEXT_OS_WIN
// could also work for OSX!
void flext_base::cb_px_int(t_class *c,long v)
{
flext_base *o = thisObject(c);
int ci = proxy_getinlet((t_object *)o->x_obj);
// check if inlet allows int type
t_atom atom;
SetInt(atom,v);
o->m_methodmain(ci,sym_int,1,&atom);
}
void flext_base::cb_px_float(t_class *c,double v)
{
flext_base *o = thisObject(c);
int ci = proxy_getinlet((t_object *)o->x_obj);
// check if inlet allows float type
t_atom atom;
SetFloat(atom,v);
o->m_methodmain(ci,sym_float,1,&atom);
}
#else
void flext_base::cb_px_int(t_class *c,long v)
{
// check if inlet allows int type
t_atom atom;
......@@ -61,13 +83,14 @@ void flext_base::cb_px_int(t_class *c,int v)
cb_px_anything(c,sym_int,1,&atom);
}
void flext_base::cb_px_float(t_class *c,float v)
void flext_base::cb_px_float(t_class *c,double v)
{
// check if inlet allows float type
t_atom atom;
SetFloat(atom,v);
cb_px_anything(c,sym_float,1,&atom);
}
#endif
void flext_base::cb_px_bang(t_class *c)
{
......@@ -77,8 +100,8 @@ void flext_base::cb_px_bang(t_class *c)
#define DEF_IN_FT(IX) \
void flext_base::cb_px_in ## IX(t_class *c,int v) { long &ci = ((flext_hdr *)thisObject(c)->x_obj)->curinlet; ci = IX; cb_px_int(c,v); ci = 0; } \
void flext_base::cb_px_ft ## IX(t_class *c,float v) { long &ci = ((flext_hdr *)thisObject(c)->x_obj)->curinlet; ci = IX; cb_px_float(c,v); ci = 0; }
void flext_base::cb_px_in ## IX(t_class *c,long v) { long &ci = ((flext_hdr *)thisObject(c)->x_obj)->curinlet; ci = IX; cb_px_int(c,v); ci = 0; } \
void flext_base::cb_px_ft ## IX(t_class *c,double v) { long &ci = ((flext_hdr *)thisObject(c)->x_obj)->curinlet; ci = IX; cb_px_float(c,v); ci = 0; }
#define ADD_IN_FT(IX) \
add_method1(c,cb_px_in ## IX,"in" #IX,A_INT); \
......@@ -116,6 +139,11 @@ void flext_base::SetProxies(t_class *c)
#error Not implemented!
#endif
#if 0 //FLEXT_SYS == FLEXT_SYS_MAX && FLEXT_OS == FLEXT_OS_WIN
// could also work for OSX!
addint((method)cb_px_int);
addfloat((method)cb_px_float);
#else
// setup non-leftmost ints and floats
ADD_IN_FT(1);
ADD_IN_FT(2);
......@@ -126,6 +154,7 @@ void flext_base::SetProxies(t_class *c)
ADD_IN_FT(7);
ADD_IN_FT(8);
ADD_IN_FT(9);
#endif
}
#elif FLEXT_SYS == FLEXT_SYS_JMAX
......
......@@ -174,6 +174,7 @@ int flext::Int2Bits(unsigned long n)
return b;
}
void flext::post(const char *fmt, ...)
{
#ifdef FLEXT_THREADS
......@@ -182,9 +183,15 @@ void flext::post(const char *fmt, ...)
#endif
va_list ap;
va_start(ap, fmt);
#if FLEXT_SYS == FLEXT_SYS_MAX
char buf[1024]; // \TODO this is quite unsafe.....
vsprintf(buf, fmt, ap);
::post(buf);
#else
vfprintf(stderr, fmt, ap);
::post("");
#endif
va_end(ap);
putc('\n', stderr);
#ifdef FLEXT_THREADS
mutex.Unlock();
#endif
......@@ -198,10 +205,17 @@ void flext::error(const char *fmt,...)
#endif
va_list ap;
va_start(ap, fmt);
#if FLEXT_SYS == FLEXT_SYS_MAX
char buf[1024]; // \TODO this is quite unsafe.....
sprintf(buf,"error: ");
vsprintf(buf+7, fmt, ap);
::post(buf);
#else
fprintf(stderr, "error: ");
vfprintf(stderr, fmt, ap);
::post("");
#endif
va_end(ap);
putc('\n', stderr);
#ifdef FLEXT_THREADS
mutex.Unlock();
#endif
......
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