forked from len0rd/rockbox
Accept FS #10244 by Wincent Balin: more pdbox work done for GSoC; also some keyword and line-ending fixes by me
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@21626 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
eabeb928dd
commit
0d4560cb03
113 changed files with 10637 additions and 4420 deletions
|
@ -42,6 +42,10 @@ The OSC webpage is http://cnmat.cnmat.berkeley.edu/OpenSoundControl
|
|||
|
||||
*/
|
||||
|
||||
#ifdef ROCKBOX
|
||||
#include "plugin.h"
|
||||
#include "pdbox.h"
|
||||
#else /* ROCKBOX */
|
||||
#ifdef WIN32
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
@ -52,6 +56,7 @@ The OSC webpage is http://cnmat.cnmat.berkeley.edu/OpenSoundControl
|
|||
#ifdef UNIX
|
||||
#include <stdio.h>
|
||||
#endif
|
||||
#endif /* ROCKBOX */
|
||||
|
||||
/* structure definition of your object */
|
||||
|
||||
|
@ -114,6 +119,9 @@ static void StrCopyUntilSlash(char *target, const char *source);
|
|||
// free
|
||||
static void OSCroute_free(t_OSCroute *x)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
(void) x;
|
||||
#endif
|
||||
// freebytes(x->x_vec, x->x_nelement * sizeof(*x->x_vec));
|
||||
}
|
||||
|
||||
|
@ -154,7 +162,9 @@ void OSCroute_setup(void) {
|
|||
|
||||
void *OSCroute_new(t_symbol *s, int argc, t_atom *argv)
|
||||
{
|
||||
|
||||
#ifdef ROCKBOX
|
||||
(void) s;
|
||||
#endif
|
||||
t_OSCroute *x = (t_OSCroute *)pd_new(OSCroute_class); // get memory for a new object & initialize
|
||||
|
||||
int i; //{{raf}} n not used
|
||||
|
@ -236,6 +246,9 @@ void *OSCroute_new(t_symbol *s, int argc, t_atom *argv)
|
|||
|
||||
|
||||
void OSCroute_version (t_OSCroute *x) {
|
||||
#ifdef ROCKBOX
|
||||
(void) x;
|
||||
#endif
|
||||
// EnterCallback();
|
||||
post("OSCroute Version " OSC_ROUTE_VERSION
|
||||
", by Matt Wright. pd jdl, win32: raf.\nOSCroute Compiled " __TIME__ " " __DATE__);
|
||||
|
@ -248,15 +261,27 @@ void OSCroute_version (t_OSCroute *x) {
|
|||
|
||||
void OSCroute_assist (t_OSCroute *x, void *box, long msg, long arg,
|
||||
char *dstString) {
|
||||
#ifdef ROCKBOX
|
||||
(void) box;
|
||||
#endif
|
||||
// EnterCallback();
|
||||
|
||||
if (msg==ASSIST_INLET) {
|
||||
#ifdef ROCKBOX
|
||||
strcpy(dstString, "Incoming OSC messages");
|
||||
#else
|
||||
sprintf(dstString, "Incoming OSC messages");
|
||||
#endif
|
||||
} else if (msg==ASSIST_OUTLET) {
|
||||
if (arg < 0 || arg >= x->x_num) {
|
||||
post("* OSCroute_assist: No outlet corresponds to arg %ld!", arg);
|
||||
} else {
|
||||
#ifdef ROCKBOX
|
||||
strcpy(dstString, "subaddress + args for prefix ");
|
||||
strcat(dstString, x->x_prefixes[arg]);
|
||||
#else
|
||||
sprintf(dstString, "subaddress + args for prefix %s", x->x_prefixes[arg]);
|
||||
#endif
|
||||
}
|
||||
} else {
|
||||
post("* OSCroute_assist: unrecognized message %ld", msg);
|
||||
|
@ -266,6 +291,9 @@ void OSCroute_assist (t_OSCroute *x, void *box, long msg, long arg,
|
|||
}
|
||||
|
||||
void OSCroute_list(t_OSCroute *x, t_symbol *s, int argc, t_atom *argv) {
|
||||
#ifdef ROCKBOX
|
||||
(void) s;
|
||||
#endif
|
||||
// EnterCallback();
|
||||
if (argc > 0 && argv[0].a_type == A_SYMBOL) {
|
||||
/* Ignore the fact that this is a "list" */
|
||||
|
|
|
@ -11,6 +11,13 @@
|
|||
|
||||
*/
|
||||
|
||||
#ifdef ROCKBOX
|
||||
#include "plugin.h"
|
||||
#include "pdbox.h"
|
||||
#include "m_pd.h"
|
||||
#include "math.h"
|
||||
#include "filters.h"
|
||||
#else /* ROCKBOX */
|
||||
#include "m_pd.h"
|
||||
#ifdef NT
|
||||
#pragma warning( disable : 4244 )
|
||||
|
@ -18,6 +25,7 @@
|
|||
#endif
|
||||
#include <math.h>
|
||||
#include "filters.h"
|
||||
#endif /* ROCKBOX */
|
||||
|
||||
/* ------------------- bandpass ----------------------------*/
|
||||
|
||||
|
|
|
@ -10,6 +10,13 @@
|
|||
|
||||
*/
|
||||
|
||||
#ifdef ROCKBOX
|
||||
#include "plugin.h"
|
||||
#include "pdbox.h"
|
||||
#include "m_pd.h"
|
||||
#include "math.h"
|
||||
#include "filters.h"
|
||||
#else /* ROCKBOX */
|
||||
#include "m_pd.h"
|
||||
#ifdef NT
|
||||
#pragma warning( disable : 4244 )
|
||||
|
@ -17,7 +24,7 @@
|
|||
#endif
|
||||
#include <math.h>
|
||||
#include "filters.h"
|
||||
|
||||
#endif /* ROCKBOX */
|
||||
|
||||
|
||||
/* ------------------- equ ----------------------------*/
|
||||
|
|
|
@ -11,14 +11,16 @@
|
|||
#ifndef __GGEE_FILTERS_H__
|
||||
#define __GGEE_FILTERS_H__
|
||||
|
||||
|
||||
#ifdef ROCKBOX
|
||||
#include "math.h"
|
||||
#else
|
||||
#include <math.h>
|
||||
#endif
|
||||
|
||||
#ifndef M_PI
|
||||
#define M_PI 3.141593f
|
||||
#endif
|
||||
|
||||
|
||||
#include <math.h>
|
||||
#define LN2 0.69314718
|
||||
#define e_A(g) (pow(10,(g/40.)))
|
||||
#define e_omega(f,r) (2.0*M_PI*f/r)
|
||||
|
@ -44,6 +46,11 @@ static int check_stability(t_float fb1,
|
|||
t_float ff2,
|
||||
t_float ff3)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
(void) ff1;
|
||||
(void) ff2;
|
||||
(void) ff3;
|
||||
#endif
|
||||
float discriminant = fb1 * fb1 + 4 * fb2;
|
||||
|
||||
if (discriminant < 0) /* imaginary roots -- resonant filter */
|
||||
|
|
|
@ -29,29 +29,73 @@ typedef struct _gcanvas
|
|||
|
||||
|
||||
static void rectangle(void* cv,void* o,char c,int x, int y,int w,int h,char* color) {
|
||||
#ifdef ROCKBOX
|
||||
(void) cv;
|
||||
(void) o;
|
||||
(void) c;
|
||||
(void) x;
|
||||
(void) y;
|
||||
(void) w;
|
||||
(void) h;
|
||||
(void) color;
|
||||
#else /* ROCKBOX */
|
||||
sys_vgui(".x%x.c create rectangle \
|
||||
%d %d %d %d -tags %x%c -fill %s\n",cv,x,y,x+w,y+h,o,c,color);
|
||||
#endif /* ROCKBOX */
|
||||
}
|
||||
|
||||
static void move_object(void* cv,void* o,char c,int x, int y,int w,int h) {
|
||||
#ifdef ROCKBOX
|
||||
(void) cv;
|
||||
(void) o;
|
||||
(void) c;
|
||||
(void) x;
|
||||
(void) y;
|
||||
(void) w;
|
||||
(void) h;
|
||||
#else /* ROCKBOX */
|
||||
sys_vgui(".x%x.c coords %x%c %d %d %d %d\n",
|
||||
cv,o,c,x,y,x+w,y+h);
|
||||
|
||||
#endif /* ROCKBOX */
|
||||
}
|
||||
|
||||
static void color_object(void* cv,void* o,char c,char* color) {
|
||||
#ifdef ROCKBOX
|
||||
(void) cv;
|
||||
(void) o;
|
||||
(void) c;
|
||||
(void) color;
|
||||
#else /* ROCKBOX */
|
||||
sys_vgui(".x%x.c itemconfigure %x%c -fill %s\n", cv,
|
||||
o, c,color);
|
||||
#endif /* ROCKBOX */
|
||||
}
|
||||
|
||||
static void delete_object(void* cv,void* o,char c) {
|
||||
#ifdef ROCKBOX
|
||||
(void) cv;
|
||||
(void) o;
|
||||
(void) c;
|
||||
#else /* ROCKBOX */
|
||||
sys_vgui(".x%x.c delete %x%c\n",
|
||||
cv, o,c);
|
||||
#endif /* ROCKBOX */
|
||||
}
|
||||
|
||||
static void line(void* cv,void* o,char c,int x,int y,int w,int h,char* color) {
|
||||
#ifdef ROCKBOX
|
||||
(void) cv;
|
||||
(void) o;
|
||||
(void) c;
|
||||
(void) x;
|
||||
(void) y;
|
||||
(void) w;
|
||||
(void) h;
|
||||
(void) color;
|
||||
#else /* ROCKBOX */
|
||||
sys_vgui(".x%x.c create line \
|
||||
%d %d %d %d -tags %x%c -fill %s\n",cv,x,y,x+w,y+h,o,c,color);
|
||||
#endif /* ROCKBOX */
|
||||
}
|
||||
|
||||
|
||||
|
@ -99,6 +143,7 @@ void gcanvas_drawme(t_gcanvas *x, t_glist *glist, int firsttime)
|
|||
nplus = (n == 1 ? 1 : n-1);
|
||||
for (i = 0; i < n; i++)
|
||||
{
|
||||
#ifndef ROCKBOX
|
||||
int onset = x->x_obj.te_xpix + (x->x_width - IOWIDTH) * i / nplus;
|
||||
if (firsttime)
|
||||
sys_vgui(".x%x.c create rectangle %d %d %d %d -tags %xo%d\n",
|
||||
|
@ -111,12 +156,14 @@ void gcanvas_drawme(t_gcanvas *x, t_glist *glist, int firsttime)
|
|||
glist_getcanvas(glist), x, i,
|
||||
onset, x->x_obj.te_ypix + x->x_height - 1,
|
||||
onset + IOWIDTH, x->x_obj.te_ypix + x->x_height);
|
||||
#endif /* ROCKBOX */
|
||||
}
|
||||
/* inlets */
|
||||
n = 0;
|
||||
nplus = (n == 1 ? 1 : n-1);
|
||||
for (i = 0; i < n; i++)
|
||||
{
|
||||
#ifndef ROCKBOX
|
||||
int onset = x->x_obj.te_xpix + (x->x_width - IOWIDTH) * i / nplus;
|
||||
if (firsttime)
|
||||
sys_vgui(".x%x.c create rectangle %d %d %d %d -tags %xi%d\n",
|
||||
|
@ -129,7 +176,7 @@ void gcanvas_drawme(t_gcanvas *x, t_glist *glist, int firsttime)
|
|||
glist_getcanvas(glist), x, i,
|
||||
onset, x->x_obj.te_ypix,
|
||||
onset + IOWIDTH, x->x_obj.te_ypix + 1);
|
||||
|
||||
#endif /* ROCKBOX */
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -149,7 +196,9 @@ void gcanvas_erase(t_gcanvas* x,t_glist* glist)
|
|||
|
||||
n = 2;
|
||||
while (n--) {
|
||||
#ifndef ROCKBOX
|
||||
sys_vgui(".x%x.c delete %xo%d\n",glist_getcanvas(glist),x,n);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -161,6 +210,9 @@ void gcanvas_erase(t_gcanvas* x,t_glist* glist)
|
|||
static void gcanvas_getrect(t_gobj *z, t_glist *owner,
|
||||
int *xp1, int *yp1, int *xp2, int *yp2)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
(void) owner;
|
||||
#endif
|
||||
int width, height;
|
||||
t_gcanvas* s = (t_gcanvas*)z;
|
||||
|
||||
|
@ -192,6 +244,11 @@ static void gcanvas_select(t_gobj *z, t_glist *glist, int state)
|
|||
|
||||
static void gcanvas_activate(t_gobj *z, t_glist *glist, int state)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
(void) z;
|
||||
(void) glist;
|
||||
(void) state;
|
||||
#endif
|
||||
/* t_text *x = (t_text *)z;
|
||||
t_rtext *y = glist_findrtext(glist, x);
|
||||
if (z->g_pd != gatom_class) rtext_activate(y, state);*/
|
||||
|
@ -239,6 +296,10 @@ static void gcanvas_motion(t_gcanvas *x, t_floatarg dx, t_floatarg dy)
|
|||
|
||||
void gcanvas_key(t_gcanvas *x, t_floatarg f)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
(void) x;
|
||||
(void) f;
|
||||
#endif
|
||||
post("key");
|
||||
}
|
||||
|
||||
|
@ -247,6 +308,12 @@ static void gcanvas_click(t_gcanvas *x,
|
|||
t_floatarg xpos, t_floatarg ypos, t_floatarg shift, t_floatarg ctrl,
|
||||
t_floatarg doit,int up)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
(void) shift;
|
||||
(void) ctrl;
|
||||
(void) doit;
|
||||
(void) up;
|
||||
#endif
|
||||
glist_grab(x->x_glist, &x->x_obj.te_g, (t_glistmotionfn) gcanvas_motion,
|
||||
(t_glistkeyfn) NULL, xpos, ypos);
|
||||
|
||||
|
@ -260,6 +327,9 @@ static void gcanvas_click(t_gcanvas *x,
|
|||
static int gcanvas_newclick(t_gobj *z, struct _glist *glist,
|
||||
int xpix, int ypix, int shift, int alt, int dbl, int doit)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
(void) glist;
|
||||
#endif
|
||||
if (doit)
|
||||
gcanvas_click((t_gcanvas *)z, (t_floatarg)xpix, (t_floatarg)ypix,
|
||||
(t_floatarg)shift, 0, (t_floatarg)alt,dbl);
|
||||
|
@ -289,6 +359,9 @@ static void gcanvas_setwidget(void)
|
|||
|
||||
static void *gcanvas_new(t_symbol* s,t_int ac,t_atom* at)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
(void) s;
|
||||
#endif
|
||||
t_gcanvas *x = (t_gcanvas *)pd_new(gcanvas_class);
|
||||
|
||||
x->x_glist = (t_glist*) canvas_getcurrent();
|
||||
|
|
|
@ -10,6 +10,14 @@
|
|||
|
||||
*/
|
||||
|
||||
|
||||
#ifdef ROCKBOX
|
||||
#include "plugin.h"
|
||||
#include "pdbox.h"
|
||||
#include "m_pd.h"
|
||||
#include "math.h"
|
||||
#include "filters.h"
|
||||
#else /* ROCKBOX */
|
||||
#include "m_pd.h"
|
||||
#ifdef NT
|
||||
#pragma warning( disable : 4244 )
|
||||
|
@ -17,6 +25,7 @@
|
|||
#endif
|
||||
#include <math.h>
|
||||
#include "filters.h"
|
||||
#endif /* ROCKBOX */
|
||||
|
||||
|
||||
/* ------------------- highpass ----------------------------*/
|
||||
|
|
|
@ -10,6 +10,13 @@
|
|||
|
||||
*/
|
||||
|
||||
#ifdef ROCKBOX
|
||||
#include "plugin.h"
|
||||
#include "pdbox.h"
|
||||
#include "m_pd.h"
|
||||
#include "math.h"
|
||||
#include "filters.h"
|
||||
#else /* ROCKBOX */
|
||||
#include "m_pd.h"
|
||||
#ifdef NT
|
||||
#pragma warning( disable : 4244 )
|
||||
|
@ -17,6 +24,7 @@
|
|||
#endif
|
||||
#include <math.h>
|
||||
#include "filters.h"
|
||||
#endif /* ROCKBOX */
|
||||
|
||||
|
||||
/* ------------------- highshelf ----------------------------*/
|
||||
|
|
|
@ -1,6 +1,12 @@
|
|||
/* (C) Guenter Geiger <geiger@epy.co.at> */
|
||||
|
||||
|
||||
#ifdef ROCKBOX
|
||||
#include "plugin.h"
|
||||
#include "pdbox.h"
|
||||
#include "m_pd.h"
|
||||
#include "math.h"
|
||||
#else /* ROCKBOX */
|
||||
#include <m_pd.h>
|
||||
#include <math.h>
|
||||
|
||||
|
@ -8,6 +14,7 @@
|
|||
#pragma warning( disable : 4244 )
|
||||
#pragma warning( disable : 4305 )
|
||||
#endif
|
||||
#endif /* ROCKBOX */
|
||||
|
||||
/* ------------------------ hlshelf ----------------------------- */
|
||||
|
||||
|
@ -42,6 +49,11 @@ int hlshelf_check_stability(t_float fb1,
|
|||
t_float ff2,
|
||||
t_float ff3)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
(void) ff1;
|
||||
(void) ff2;
|
||||
(void) ff3;
|
||||
#endif
|
||||
float discriminant = fb1 * fb1 + 4 * fb2;
|
||||
|
||||
if (discriminant < 0) /* imaginary roots -- resonant filter */
|
||||
|
@ -176,6 +188,10 @@ void hlshelf_float(t_hlshelf *x,t_floatarg f)
|
|||
|
||||
static void *hlshelf_new(t_symbol* s,t_int argc, t_atom* at)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
(void) s;
|
||||
(void) argc;
|
||||
#endif
|
||||
t_hlshelf *x = (t_hlshelf *)pd_new(hlshelf_class);
|
||||
t_float k0 = atom_getfloat(at);
|
||||
t_float k1 = atom_getfloat(at+1);
|
||||
|
|
|
@ -23,6 +23,11 @@ typedef struct _image
|
|||
|
||||
void image_drawme(t_image *x, t_glist *glist, int firsttime)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
(void) x;
|
||||
(void) glist;
|
||||
(void) firsttime;
|
||||
#else /* ROCKBOX */
|
||||
if (firsttime) {
|
||||
char fname[MAXPDSTRING];
|
||||
canvas_makefilename(glist_getcanvas(x->x_glist), x->x_fname->s_name,
|
||||
|
@ -42,16 +47,20 @@ void image_drawme(t_image *x, t_glist *glist, int firsttime)
|
|||
glist_getcanvas(glist), x,
|
||||
text_xpix(&x->x_obj, glist), text_ypix(&x->x_obj, glist));
|
||||
}
|
||||
|
||||
#endif /* ROCKBOX */
|
||||
}
|
||||
|
||||
|
||||
void image_erase(t_image* x,t_glist* glist)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
(void) x;
|
||||
(void) glist;
|
||||
#else /* ROCKBOX */
|
||||
int n;
|
||||
sys_vgui(".x%x.c delete %xS\n",
|
||||
glist_getcanvas(glist), x);
|
||||
|
||||
#endif /* ROCKBOX */
|
||||
}
|
||||
|
||||
|
||||
|
@ -80,17 +89,23 @@ static void image_displace(t_gobj *z, t_glist *glist,
|
|||
t_image *x = (t_image *)z;
|
||||
x->x_obj.te_xpix += dx;
|
||||
x->x_obj.te_ypix += dy;
|
||||
#ifndef ROCKBOX
|
||||
sys_vgui(".x%x.c coords %xSEL %d %d %d %d\n",
|
||||
glist_getcanvas(glist), x,
|
||||
text_xpix(&x->x_obj, glist), text_ypix(&x->x_obj, glist),
|
||||
text_xpix(&x->x_obj, glist) + x->x_width, text_ypix(&x->x_obj, glist) + x->x_height);
|
||||
|
||||
#endif
|
||||
image_drawme(x, glist, 0);
|
||||
canvas_fixlinesfor(glist_getcanvas(glist),(t_text*) x);
|
||||
}
|
||||
|
||||
static void image_select(t_gobj *z, t_glist *glist, int state)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
(void) z;
|
||||
(void) glist;
|
||||
(void) state;
|
||||
#else /* ROCKBOX */
|
||||
t_image *x = (t_image *)z;
|
||||
if (state) {
|
||||
sys_vgui(".x%x.c create rectangle \
|
||||
|
@ -104,14 +119,17 @@ static void image_select(t_gobj *z, t_glist *glist, int state)
|
|||
sys_vgui(".x%x.c delete %xSEL\n",
|
||||
glist_getcanvas(glist), x);
|
||||
}
|
||||
|
||||
|
||||
|
||||
#endif /* ROCKBOX */
|
||||
}
|
||||
|
||||
|
||||
static void image_activate(t_gobj *z, t_glist *glist, int state)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
(void) z;
|
||||
(void) glist;
|
||||
(void) state;
|
||||
#endif
|
||||
/* t_text *x = (t_text *)z;
|
||||
t_rtext *y = glist_findrtext(glist, x);
|
||||
if (z->g_pd != gatom_class) rtext_activate(y, state);*/
|
||||
|
@ -154,6 +172,10 @@ void image_size(t_image* x,t_floatarg w,t_floatarg h) {
|
|||
|
||||
void image_color(t_image* x,t_symbol* col)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
(void) x;
|
||||
(void) col;
|
||||
#endif
|
||||
/* outlet_bang(x->x_obj.ob_outlet); only bang if there was a bang ..
|
||||
so color black does the same as bang, but doesn't forward the bang
|
||||
*/
|
||||
|
@ -167,11 +189,11 @@ static void image_setwidget(void)
|
|||
image_widgetbehavior.w_activatefn = image_activate;
|
||||
image_widgetbehavior.w_deletefn = image_delete;
|
||||
image_widgetbehavior.w_visfn = image_vis;
|
||||
#if (PD_VERSION_MINOR > 31)
|
||||
#if defined(PD_VERSION_MINOR) && (PD_VERSION_MINOR > 31)
|
||||
image_widgetbehavior.w_clickfn = NULL;
|
||||
image_widgetbehavior.w_propertiesfn = NULL;
|
||||
#endif
|
||||
#if PD_MINOR_VERSION < 37
|
||||
#if defined(PD_VERSION_MINOR) && PD_MINOR_VERSION < 37
|
||||
image_widgetbehavior.w_savefn = image_save;
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -10,6 +10,13 @@
|
|||
|
||||
*/
|
||||
|
||||
#ifdef ROCKBOX
|
||||
#include "plugin.h"
|
||||
#include "pdbox.h"
|
||||
#include "m_pd.h"
|
||||
#include "math.h"
|
||||
#include "filters.h"
|
||||
#else /* ROCKBOX */
|
||||
#include "m_pd.h"
|
||||
#ifdef NT
|
||||
#pragma warning( disable : 4244 )
|
||||
|
@ -17,7 +24,7 @@
|
|||
#endif
|
||||
#include <math.h>
|
||||
#include "filters.h"
|
||||
|
||||
#endif /* ROCKBOX */
|
||||
|
||||
|
||||
/* ------------------- lowpass ----------------------------*/
|
||||
|
|
|
@ -10,6 +10,13 @@
|
|||
|
||||
*/
|
||||
|
||||
#ifdef ROCKBOX
|
||||
#include "plugin.h"
|
||||
#include "pdbox.h"
|
||||
#include "m_pd.h"
|
||||
#include "math.h"
|
||||
#include "filters.h"
|
||||
#else /* ROCKBOX */
|
||||
#include "m_pd.h"
|
||||
#ifdef NT
|
||||
#pragma warning( disable : 4244 )
|
||||
|
@ -17,7 +24,7 @@
|
|||
#endif
|
||||
#include <math.h>
|
||||
#include "filters.h"
|
||||
|
||||
#endif /* ROCKBOX */
|
||||
|
||||
|
||||
/* ------------------- lowshelf ----------------------------*/
|
||||
|
|
|
@ -2,7 +2,11 @@
|
|||
|
||||
|
||||
#include "math.h"
|
||||
#ifdef ROCKBOX
|
||||
#include "m_pd.h"
|
||||
#else
|
||||
#include <m_pd.h>
|
||||
#endif
|
||||
|
||||
/* ----------------------------- moog ----------------------------- */
|
||||
static t_class *moog_class;
|
||||
|
@ -27,6 +31,10 @@ static void moog_reset(t_moog *x)
|
|||
|
||||
static void *moog_new(t_symbol *s, int argc, t_atom *argv)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
(void) s;
|
||||
(void) argv;
|
||||
#endif
|
||||
if (argc > 1) post("moog~: extra arguments ignored");
|
||||
{
|
||||
t_moog *x = (t_moog *)pd_new(moog_class);
|
||||
|
@ -123,7 +131,9 @@ t_int *moog_perf8(t_int *w)
|
|||
t_sample ys3 = x->y_3;
|
||||
t_sample ys4 = x->y_4;
|
||||
|
||||
#ifndef ROCKBOX
|
||||
t_sample temp,temp2;
|
||||
#endif
|
||||
t_sample pt,pt1;
|
||||
t_sample in;
|
||||
|
||||
|
|
|
@ -10,6 +10,13 @@
|
|||
|
||||
*/
|
||||
|
||||
#ifdef ROCKBOX
|
||||
#include "plugin.h"
|
||||
#include "pdbox.h"
|
||||
#include "m_pd.h"
|
||||
#include "math.h"
|
||||
#include "filters.h"
|
||||
#else /* ROCKBOX */
|
||||
#include "m_pd.h"
|
||||
#ifdef NT
|
||||
#pragma warning( disable : 4244 )
|
||||
|
@ -17,6 +24,7 @@
|
|||
#endif
|
||||
#include <math.h>
|
||||
#include "filters.h"
|
||||
#endif /* ROCKBOX */
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -65,12 +65,17 @@ static t_int *sigbiquad_perform(t_int *w)
|
|||
|
||||
static void sigbiquad_list(t_sigbiquad *x, t_symbol *s, int argc, t_atom *argv)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
(void) s;
|
||||
#endif
|
||||
|
||||
float fb1 = atom_getfloatarg(0, argc, argv);
|
||||
float fb2 = atom_getfloatarg(1, argc, argv);
|
||||
float ff1 = atom_getfloatarg(2, argc, argv);
|
||||
float ff2 = atom_getfloatarg(3, argc, argv);
|
||||
float ff3 = atom_getfloatarg(4, argc, argv);
|
||||
float discriminant = fb1 * fb1 + 4 * fb2;
|
||||
|
||||
t_biquadctl *c = x->x_ctl;
|
||||
if (discriminant < 0) /* imaginary roots -- resonant filter */
|
||||
{
|
||||
|
@ -99,6 +104,9 @@ stable:
|
|||
|
||||
static void sigbiquad_set(t_sigbiquad *x, t_symbol *s, int argc, t_atom *argv)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
(void) s;
|
||||
#endif
|
||||
t_biquadctl *c = x->x_ctl;
|
||||
c->c_x1 = atom_getfloatarg(0, argc, argv);
|
||||
c->c_x2 = atom_getfloatarg(1, argc, argv);
|
||||
|
|
|
@ -81,6 +81,9 @@ static void sigbp_ft2(t_sigbp *x, t_floatarg q)
|
|||
|
||||
static void sigbp_clear(t_sigbp *x, t_floatarg q)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
(void) q;
|
||||
#endif
|
||||
x->x_ctl->c_x1 = x->x_ctl->c_x2 = 0;
|
||||
}
|
||||
|
||||
|
|
2
apps/plugins/pdbox/PDa/intern/cos_table.c
Normal file
2
apps/plugins/pdbox/PDa/intern/cos_table.c
Normal file
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -47,6 +47,9 @@ static t_int *cos_perform(t_int *w)
|
|||
|
||||
static void cos_dsp(t_cos *x, t_signal **sp)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
(void) x;
|
||||
#endif
|
||||
dsp_add(cos_perform, 3, sp[0]->s_vec, sp[1]->s_vec, sp[0]->s_n);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,3 +1,8 @@
|
|||
#ifdef ROCKBOX
|
||||
#include "plugin.h"
|
||||
#include "pdbox.h"
|
||||
#endif
|
||||
|
||||
#include <m_pd.h>
|
||||
#include <m_fixed.h>
|
||||
|
||||
|
@ -39,6 +44,9 @@ static t_int *dbtopow_tilde_perform(t_int *w)
|
|||
|
||||
static void dbtopow_tilde_dsp(t_dbtopow_tilde *x, t_signal **sp)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
(void) x;
|
||||
#endif
|
||||
post("warning: %s not usable yet",__FUNCTION__);
|
||||
dsp_add(dbtopow_tilde_perform, 3, sp[0]->s_vec, sp[1]->s_vec, sp[0]->s_n);
|
||||
}
|
||||
|
|
|
@ -1,3 +1,8 @@
|
|||
#ifdef ROCKBOX
|
||||
#include "plugin.h"
|
||||
#include "pdbox.h"
|
||||
#endif
|
||||
|
||||
#include <m_pd.h>
|
||||
#include <m_fixed.h>
|
||||
|
||||
|
@ -40,6 +45,9 @@ static t_int *dbtorms_tilde_perform(t_int *w)
|
|||
|
||||
static void dbtorms_tilde_dsp(t_dbtorms_tilde *x, t_signal **sp)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
(void) x;
|
||||
#endif
|
||||
post("warning: %s not usable yet",__FUNCTION__);
|
||||
dsp_add(dbtorms_tilde_perform, 3, sp[0]->s_vec, sp[1]->s_vec, sp[0]->s_n);
|
||||
}
|
||||
|
|
|
@ -1,11 +1,19 @@
|
|||
#ifdef ROCKBOX
|
||||
#include "plugin.h"
|
||||
#include "pdbox.h"
|
||||
#endif
|
||||
|
||||
#include <m_pd.h>
|
||||
#include <m_fixed.h>
|
||||
#include "delay.h"
|
||||
|
||||
extern int ugen_getsortno(void);
|
||||
|
||||
#include "delay.h"
|
||||
|
||||
#define DEFDELVS 64 /* LATER get this from canvas at DSP time */
|
||||
#ifndef ROCKBOX
|
||||
static int delread_zero = 0; /* four bytes of zero for delread~, vd~ */
|
||||
#endif
|
||||
|
||||
static t_class *sigdelread_class;
|
||||
|
||||
|
@ -36,13 +44,17 @@ static void *sigdelread_new(t_symbol *s, t_floatarg f)
|
|||
|
||||
static void sigdelread_float(t_sigdelread *x, t_float f)
|
||||
{
|
||||
#ifndef ROCKBOX
|
||||
int samps;
|
||||
#endif
|
||||
t_sigdelwrite *delwriter =
|
||||
(t_sigdelwrite *)pd_findbyclass(x->x_sym, sigdelwrite_class);
|
||||
x->x_deltime = f;
|
||||
if (delwriter)
|
||||
{
|
||||
#ifndef ROCKBOX
|
||||
int delsize = delwriter->x_cspace.c_n;
|
||||
#endif
|
||||
x->x_delsamps = (int)(0.5 + x->x_sr * x->x_deltime)
|
||||
+ x->x_n - x->x_zerodel;
|
||||
if (x->x_delsamps < x->x_n) x->x_delsamps = x->x_n;
|
||||
|
|
|
@ -4,7 +4,9 @@
|
|||
extern int ugen_getsortno(void);
|
||||
|
||||
#define DEFDELVS 64 /* LATER get this from canvas at DSP time */
|
||||
#ifndef ROCKBOX
|
||||
static int delread_zero = 0; /* four bytes of zero for delread~, vd~ */
|
||||
#endif
|
||||
|
||||
#include "delay.h"
|
||||
|
||||
|
|
|
@ -1,5 +1,9 @@
|
|||
|
||||
#ifdef ROCKBOX
|
||||
#include "plugin.h"
|
||||
#include "pdbox.h"
|
||||
#else /* ROCKBOX */
|
||||
#define FIXEDPOINT
|
||||
#endif /* ROCKBOX */
|
||||
#include <m_pd.h>
|
||||
#include <m_fixed.h>
|
||||
|
||||
|
|
|
@ -1,3 +1,8 @@
|
|||
#ifdef ROCKBOX
|
||||
#include "plugin.h"
|
||||
#include "pdbox.h"
|
||||
#endif
|
||||
|
||||
#include <m_pd.h>
|
||||
#include <m_fixed.h>
|
||||
|
||||
|
@ -19,7 +24,11 @@ static void *ftom_tilde_new(void)
|
|||
|
||||
static t_int *ftom_tilde_perform(t_int *w)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
t_sample *in = *(t_sample **)(w+1), *out = (t_sample*)*(t_float **)(w+2);
|
||||
#else
|
||||
t_sample *in = *(t_sample **)(w+1), *out = *(t_float **)(w+2);
|
||||
#endif
|
||||
t_int n = *(t_int *)(w+3);
|
||||
for (; n--; *in++, out++)
|
||||
{
|
||||
|
@ -31,6 +40,9 @@ static t_int *ftom_tilde_perform(t_int *w)
|
|||
|
||||
static void ftom_tilde_dsp(t_ftom_tilde *x, t_signal **sp)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
(void) x;
|
||||
#endif
|
||||
post("warning: %s not usable yet",__FUNCTION__);
|
||||
dsp_add(ftom_tilde_perform, 3, sp[0]->s_vec, sp[1]->s_vec, sp[0]->s_n);
|
||||
}
|
||||
|
|
|
@ -76,6 +76,9 @@ static void sighip_dsp(t_sighip *x, t_signal **sp)
|
|||
|
||||
static void sighip_clear(t_sighip *x, t_floatarg q)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
(void) q;
|
||||
#endif
|
||||
x->x_cspace.c_x = 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +1,57 @@
|
|||
#ifndef ROCKBOX
|
||||
#include <stdio.h>
|
||||
#endif
|
||||
|
||||
void d_intern_setup() {
|
||||
#ifdef ROCKBOX
|
||||
/* Get rid of warnings. */
|
||||
void biquad_tilde_setup(void);
|
||||
void bp_tilde_setup(void);
|
||||
void clip_tilde_setup(void);
|
||||
void cos_tilde_setup(void);
|
||||
void dbtopow_tilde_setup(void);
|
||||
void dbtorms_tilde_setup(void);
|
||||
void delread_tilde_setup(void);
|
||||
void delwrite_tilde_setup(void);
|
||||
void env_tilde_setup(void);
|
||||
void ftom_tilde_setup(void);
|
||||
void hip_tilde_setup(void);
|
||||
void line_tilde_setup(void);
|
||||
void lop_tilde_setup(void);
|
||||
void mtof_tilde_setup(void);
|
||||
void noise_tilde_setup(void);
|
||||
void osc_tilde_setup(void);
|
||||
void phasor_tilde_setup(void);
|
||||
void powtodb_tilde_setup(void);
|
||||
void print_tilde_setup(void);
|
||||
void rmstodb_tilde_setup(void);
|
||||
void rsqrt_tilde_setup(void);
|
||||
void samphold_tilde_setup(void);
|
||||
void sfread_tilde_setup(void);
|
||||
void sfwrite_tilde_setup(void);
|
||||
void sig_tilde_setup(void);
|
||||
void snapshot_tilde_setup(void);
|
||||
void sqrt_tilde_setup(void);
|
||||
void tabosc4_tilde_setup(void);
|
||||
void tabplay_tilde_setup(void);
|
||||
void tabread4_tilde_setup(void);
|
||||
void tabread_tilde_setup(void);
|
||||
void tabread_setup(void);
|
||||
void tabreceive_tilde_setup(void);
|
||||
void tabsend_tilde_setup(void);
|
||||
void tabwrite_tilde_setup(void);
|
||||
void tabwrite_setup(void);
|
||||
void threshold_tilde_setup(void);
|
||||
void vcf_tilde_setup(void);
|
||||
void vd_tilde_setup(void);
|
||||
void vline_tilde_setup(void);
|
||||
void vsnapshot_tilde_setup(void);
|
||||
void wrap_tilde_setup(void);
|
||||
#endif /* ROCKBOX */
|
||||
|
||||
void d_intern_setup(void) {
|
||||
#ifndef ROCKBOX
|
||||
fprintf(stderr,"setup\n");
|
||||
#endif
|
||||
biquad_tilde_setup();
|
||||
bp_tilde_setup();
|
||||
clip_tilde_setup();
|
||||
|
|
|
@ -23,7 +23,9 @@ static t_int *line_perform(t_int *w)
|
|||
t_line *x = (t_line *)(w[1]);
|
||||
t_sample *out = (t_sample *)(w[2]);
|
||||
int n = (int)(w[3]);
|
||||
#ifndef ROCKBOX
|
||||
t_sample f = x->x_value;
|
||||
#endif
|
||||
|
||||
if (x->x_retarget)
|
||||
{
|
||||
|
|
|
@ -46,6 +46,9 @@ static void siglop_ft1(t_siglop *x, t_floatarg f)
|
|||
|
||||
static void siglop_clear(t_siglop *x, t_floatarg q)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
(void) q;
|
||||
#endif
|
||||
x->x_cspace.c_x = 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,3 +1,8 @@
|
|||
#ifdef ROCKBOX
|
||||
#include "plugin.h"
|
||||
#include "pdbox.h"
|
||||
#endif
|
||||
|
||||
#include <m_pd.h>
|
||||
#include <m_fixed.h>
|
||||
|
||||
|
@ -36,6 +41,9 @@ static t_int *mtof_tilde_perform(t_int *w)
|
|||
|
||||
static void mtof_tilde_dsp(t_mtof_tilde *x, t_signal **sp)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
(void) x;
|
||||
#endif
|
||||
post("warning: %s not usable yet",__FUNCTION__);
|
||||
dsp_add(mtof_tilde_perform, 3, sp[0]->s_vec, sp[1]->s_vec, sp[0]->s_n);
|
||||
}
|
||||
|
|
|
@ -6,7 +6,11 @@
|
|||
|
||||
/* ------------------------ osc~ ----------------------------- */
|
||||
|
||||
#ifdef ROCKBOX
|
||||
static t_class *osc_class;
|
||||
#else
|
||||
static t_class *osc_class, *scalarosc_class;
|
||||
#endif
|
||||
|
||||
typedef struct _osc
|
||||
{
|
||||
|
|
|
@ -1,3 +1,8 @@
|
|||
#ifdef ROCKBOX
|
||||
#include "plugin.h"
|
||||
#include "pdbox.h"
|
||||
#endif
|
||||
|
||||
#include <m_pd.h>
|
||||
#include <m_fixed.h>
|
||||
|
||||
|
@ -39,6 +44,9 @@ static t_int *powtodb_tilde_perform(t_int *w)
|
|||
|
||||
static void powtodb_tilde_dsp(t_powtodb_tilde *x, t_signal **sp)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
(void) x;
|
||||
#endif
|
||||
post("warning: %s not usable yet",__FUNCTION__);
|
||||
dsp_add(powtodb_tilde_perform, 3, sp[0]->s_vec, sp[1]->s_vec, sp[0]->s_n);
|
||||
}
|
||||
|
|
|
@ -1,3 +1,8 @@
|
|||
#ifdef ROCKBOX
|
||||
#include "plugin.h"
|
||||
#include "pdbox.h"
|
||||
#endif
|
||||
|
||||
#include <m_pd.h>
|
||||
#include <m_fixed.h>
|
||||
|
||||
|
@ -39,6 +44,9 @@ static t_int *rmstodb_tilde_perform(t_int *w)
|
|||
|
||||
static void rmstodb_tilde_dsp(t_rmstodb_tilde *x, t_signal **sp)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
(void) x;
|
||||
#endif
|
||||
post("warning: %s not usable yet",__FUNCTION__);
|
||||
dsp_add(rmstodb_tilde_perform, 3, sp[0]->s_vec, sp[1]->s_vec, sp[0]->s_n);
|
||||
}
|
||||
|
|
|
@ -1,3 +1,8 @@
|
|||
#ifdef ROCKBOX
|
||||
#include "plugin.h"
|
||||
#include "pdbox.h"
|
||||
#endif
|
||||
|
||||
#include <m_pd.h>
|
||||
#include <m_fixed.h>
|
||||
|
||||
|
@ -89,6 +94,9 @@ static t_int *sigrsqrt_perform(t_int *w)
|
|||
|
||||
static void sigrsqrt_dsp(t_sigrsqrt *x, t_signal **sp)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
(void) x;
|
||||
#endif
|
||||
dsp_add(sigrsqrt_perform, 3, sp[0]->s_vec, sp[1]->s_vec, sp[0]->s_n);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,3 +1,7 @@
|
|||
#ifdef ROCKBOX
|
||||
#include "plugin.h"
|
||||
#include "pdbox.h"
|
||||
#else /* ROCKBOX */
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
#include <errno.h>
|
||||
|
@ -6,6 +10,7 @@
|
|||
#include <unistd.h>
|
||||
#include <sys/mman.h>
|
||||
#include <sys/stat.h>
|
||||
#endif /* ROCKBOX */
|
||||
|
||||
#include <m_pd.h>
|
||||
#include <m_fixed.h>
|
||||
|
@ -40,7 +45,9 @@ typedef struct _sfread
|
|||
|
||||
void sfread_open(t_sfread *x,t_symbol *filename)
|
||||
{
|
||||
#ifndef ROCKBOX
|
||||
struct stat fstate;
|
||||
#endif
|
||||
char fname[MAXPDSTRING];
|
||||
|
||||
if (filename == &s_) {
|
||||
|
@ -54,7 +61,11 @@ void sfread_open(t_sfread *x,t_symbol *filename)
|
|||
|
||||
/* close the old file */
|
||||
|
||||
#ifdef ROCKBOX
|
||||
if (x->x_mapaddr) freebytes(x->x_mapaddr, x->x_size);
|
||||
#else
|
||||
if (x->x_mapaddr) munmap(x->x_mapaddr,x->x_size);
|
||||
#endif
|
||||
if (x->x_fd >= 0) close(x->x_fd);
|
||||
|
||||
if ((x->x_fd = open(fname,O_RDONLY)) < 0)
|
||||
|
@ -66,17 +77,35 @@ void sfread_open(t_sfread *x,t_symbol *filename)
|
|||
}
|
||||
|
||||
/* get the size */
|
||||
|
||||
#ifdef ROCKBOX
|
||||
x->x_size = rb->filesize(x->x_fd);
|
||||
#else
|
||||
fstat(x->x_fd,&fstate);
|
||||
x->x_size = fstate.st_size;
|
||||
#endif
|
||||
|
||||
/* map the file into memory */
|
||||
|
||||
#ifdef ROCKBOX
|
||||
x->x_mapaddr = getbytes(x->x_size);
|
||||
if (!x->x_mapaddr)
|
||||
{
|
||||
error("can't mmap %s",fname);
|
||||
return;
|
||||
}
|
||||
int r = read(x->x_fd, x->x_mapaddr, x->x_size);
|
||||
if (r != x->x_size)
|
||||
{
|
||||
error("can't mmap %s",fname);
|
||||
return;
|
||||
}
|
||||
#else
|
||||
if (!(x->x_mapaddr = mmap(NULL,x->x_size,PROT_READ,MAP_PRIVATE,x->x_fd,0)))
|
||||
{
|
||||
error("can't mmap %s",fname);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
#define MAX_CHANS 4
|
||||
|
@ -236,6 +265,9 @@ static void sfread_offset(t_sfread* x, t_floatarg f)
|
|||
|
||||
static void *sfread_new(t_floatarg chan,t_floatarg skip)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
(void) skip;
|
||||
#endif
|
||||
t_sfread *x = (t_sfread *)pd_new(sfread_class);
|
||||
t_int c = chan;
|
||||
|
||||
|
|
|
@ -1,4 +1,7 @@
|
|||
|
||||
#ifdef ROCKBOX
|
||||
#include "plugin.h"
|
||||
#include "pdbox.h"
|
||||
#else /* ROCKBOX */
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
#include <errno.h>
|
||||
|
@ -7,6 +10,7 @@
|
|||
#include <unistd.h>
|
||||
#include <sys/mman.h>
|
||||
#include <sys/stat.h>
|
||||
#endif /* ROCKBOX */
|
||||
|
||||
#include <m_pd.h>
|
||||
#include <m_fixed.h>
|
||||
|
@ -87,7 +91,11 @@ static void sfwrite_open(t_sfwrite *x,t_symbol *filename)
|
|||
|
||||
sfwrite_close(x);
|
||||
|
||||
#ifdef ROCKBOX
|
||||
if ((x->x_file = open(fname, O_RDWR | O_CREAT)) < 0)
|
||||
#else
|
||||
if ((x->x_file = open(fname,O_RDWR | O_CREAT,0664)) < 0)
|
||||
#endif
|
||||
{
|
||||
error("can't create %s",fname);
|
||||
return;
|
||||
|
|
|
@ -1,6 +1,11 @@
|
|||
#define DUMTAB1SIZE 256
|
||||
#define DUMTAB2SIZE 1024
|
||||
|
||||
#ifdef ROCKBOX
|
||||
#include "plugin.h"
|
||||
#include "pdbox.h"
|
||||
#endif
|
||||
|
||||
#include<m_pd.h>
|
||||
#include<m_fixed.h>
|
||||
|
||||
|
@ -62,6 +67,9 @@ t_int *sigsqrt_perform(t_int *w) /* not static; also used in d_fft.c */
|
|||
|
||||
static void sigsqrt_dsp(t_sigsqrt *x, t_signal **sp)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
(void) x;
|
||||
#endif
|
||||
dsp_add(sigsqrt_perform, 3, sp[0]->s_vec, sp[1]->s_vec, sp[0]->s_n);
|
||||
}
|
||||
|
||||
|
|
|
@ -77,7 +77,11 @@ zero:
|
|||
void tabosc4_tilde_set(t_tabosc4_tilde *x, t_symbol *s)
|
||||
{
|
||||
t_garray *a;
|
||||
#ifdef ROCKBOX
|
||||
int pointsinarray;
|
||||
#else
|
||||
int npoints, pointsinarray;
|
||||
#endif
|
||||
x->x_arrayname = s;
|
||||
|
||||
if (!(a = (t_garray *)pd_findbyclass(x->x_arrayname, garray_class)))
|
||||
|
@ -93,7 +97,9 @@ void tabosc4_tilde_set(t_tabosc4_tilde *x, t_symbol *s)
|
|||
}
|
||||
else
|
||||
{
|
||||
#ifndef ROCKBOX
|
||||
int i;
|
||||
#endif
|
||||
x->x_fnpoints = pointsinarray;
|
||||
x->x_lognpoints = ilog2(pointsinarray);
|
||||
post("tabosc~: using %d (log %d) points of array",x->x_fnpoints,x->x_lognpoints);
|
||||
|
|
|
@ -1,5 +1,8 @@
|
|||
|
||||
#ifndef ROCKBOX
|
||||
#define FIXEDPOINT
|
||||
#endif
|
||||
|
||||
#include <m_pd.h>
|
||||
#include <m_fixed.h>
|
||||
|
||||
|
@ -94,6 +97,11 @@ static void tabplay_tilde_list(t_tabplay_tilde *x, t_symbol *s,
|
|||
{
|
||||
long start = atom_getfloatarg(0, argc, argv);
|
||||
long length = atom_getfloatarg(1, argc, argv);
|
||||
|
||||
#ifdef ROCKBOX
|
||||
(void) s;
|
||||
#endif
|
||||
|
||||
if (start < 0) start = 0;
|
||||
if (length <= 0)
|
||||
x->x_limit = 0x7fffffff;
|
||||
|
|
|
@ -90,6 +90,9 @@ static void tabread4_tilde_dsp(t_tabread4_tilde *x, t_signal **sp)
|
|||
|
||||
static void tabread4_tilde_free(t_tabread4_tilde *x)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
(void) x;
|
||||
#endif
|
||||
}
|
||||
|
||||
void tabread4_tilde_setup(void)
|
||||
|
|
|
@ -1,4 +1,7 @@
|
|||
#ifndef ROCKBOX
|
||||
#define FIXEDPOINT
|
||||
#endif
|
||||
|
||||
#include <m_pd.h>
|
||||
#include <m_fixed.h>
|
||||
|
||||
|
@ -30,7 +33,11 @@ static t_int *tabread_tilde_perform(t_int *w)
|
|||
t_sample *out = (t_sample *)(w[3]);
|
||||
int n = (int)(w[4]);
|
||||
int maxindex;
|
||||
#ifdef ROCKBOX
|
||||
t_sample *buf = x->x_vec;
|
||||
#else
|
||||
t_sample *buf = x->x_vec, *fp;
|
||||
#endif
|
||||
int i;
|
||||
|
||||
maxindex = x->x_npoints - 1;
|
||||
|
@ -82,6 +89,9 @@ static void tabread_tilde_dsp(t_tabread_tilde *x, t_signal **sp)
|
|||
|
||||
static void tabread_tilde_free(t_tabread_tilde *x)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
(void) x;
|
||||
#endif
|
||||
}
|
||||
|
||||
void tabread_tilde_setup(void)
|
||||
|
|
|
@ -54,7 +54,11 @@ bad:
|
|||
|
||||
static void tabsend_dsp(t_tabsend *x, t_signal **sp)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
int vecsize;
|
||||
#else
|
||||
int i, vecsize;
|
||||
#endif
|
||||
t_garray *a;
|
||||
|
||||
if (!(a = (t_garray *)pd_findbyclass(x->x_arrayname, garray_class)))
|
||||
|
|
|
@ -24,7 +24,11 @@ static void tabwrite_tick(t_tabwrite *x)
|
|||
|
||||
static void tabwrite_float(t_tabwrite *x, t_float f)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
int vecsize;
|
||||
#else
|
||||
int i, vecsize;
|
||||
#endif
|
||||
t_garray *a;
|
||||
t_sample *vec;
|
||||
|
||||
|
|
|
@ -1,12 +1,14 @@
|
|||
#include <m_pd.h>
|
||||
#include <m_fixed.h>
|
||||
|
||||
#include "delay.h"
|
||||
|
||||
extern int ugen_getsortno(void);
|
||||
|
||||
#include "delay.h"
|
||||
|
||||
#define DEFDELVS 64 /* LATER get this from canvas at DSP time */
|
||||
#ifndef ROCKBOX
|
||||
static int delread_zero = 0; /* four bytes of zero for delread~, vd~ */
|
||||
#endif
|
||||
|
||||
static t_class *sigvd_class;
|
||||
|
||||
|
@ -37,14 +39,18 @@ static t_int *sigvd_perform(t_int *w)
|
|||
t_sample *in = (t_sample *)(w[1]);
|
||||
t_sample *out = (t_sample *)(w[2]);
|
||||
t_delwritectl *ctl = (t_delwritectl *)(w[3]);
|
||||
#ifndef ROCKBOX
|
||||
t_sigvd *x = (t_sigvd *)(w[4]);
|
||||
#endif
|
||||
int n = (int)(w[5]);
|
||||
|
||||
int nsamps = ctl->c_n;
|
||||
int fn = n;
|
||||
t_sample limit = nsamps - n - 1;
|
||||
t_sample *vp = ctl->c_vec, *bp, *wp = vp + ctl->c_phase;
|
||||
#ifndef ROCKBOX
|
||||
t_sample zerodel = x->x_zerodel;
|
||||
#endif
|
||||
while (n--)
|
||||
{
|
||||
t_time delsamps = ((long long) mult((*in++),ftofix(44.1)));//- itofix(zerodel);
|
||||
|
|
|
@ -1,3 +1,8 @@
|
|||
#ifdef ROCKBOX
|
||||
#include "plugin.h"
|
||||
#include "pdbox.h"
|
||||
#endif
|
||||
|
||||
#include <m_pd.h>
|
||||
#include <m_fixed.h>
|
||||
|
||||
|
@ -36,7 +41,9 @@ static t_int *vline_tilde_perform(t_int *w)
|
|||
t_sample f = x->x_value;
|
||||
t_sample inc = x->x_inc;
|
||||
t_time msecpersamp = x->x_msecpersamp;
|
||||
#ifndef ROCKBOX
|
||||
t_time samppermsec = x->x_samppermsec;
|
||||
#endif
|
||||
t_time timenow = clock_gettimesince(x->x_referencetime) - n * msecpersamp;
|
||||
t_vseg *s = x->x_list;
|
||||
for (i = 0; i < n; i++)
|
||||
|
@ -58,7 +65,7 @@ static t_int *vline_tilde_perform(t_int *w)
|
|||
}
|
||||
else
|
||||
{
|
||||
t_time incpermsec = div((s->s_target - f),
|
||||
t_time incpermsec = idiv((s->s_target - f),
|
||||
(s->s_targettime - s->s_starttime));
|
||||
f = mult(f + incpermsec,(timenext - s->s_starttime));
|
||||
inc = mult(incpermsec,msecpersamp);
|
||||
|
@ -123,7 +130,7 @@ static void vline_tilde_float(t_vline *x, t_float f)
|
|||
}
|
||||
else
|
||||
{
|
||||
for (s1 = x->x_list; s2 = s1->s_next; s1 = s2)
|
||||
for (s1 = x->x_list; (s2 = s1->s_next); s1 = s2)
|
||||
{
|
||||
if (s2->s_starttime > starttime ||
|
||||
(s2->s_starttime == starttime &&
|
||||
|
|
|
@ -40,6 +40,9 @@ static t_int *sigwrap_perform(t_int *w)
|
|||
|
||||
static void sigwrap_dsp(t_sigwrap *x, t_signal **sp)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
(void) x;
|
||||
#endif
|
||||
dsp_add(sigwrap_perform, 3, sp[0]->s_vec, sp[1]->s_vec, sp[0]->s_n);
|
||||
}
|
||||
|
||||
|
|
|
@ -28,6 +28,9 @@ typedef struct _scalarplus
|
|||
|
||||
static void *plus_new(t_symbol *s, int argc, t_atom *argv)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
(void) s;
|
||||
#endif
|
||||
if (argc > 1) post("+~: extra arguments ignored");
|
||||
if (argc)
|
||||
{
|
||||
|
@ -115,6 +118,9 @@ void dsp_add_plus(t_sample *in1, t_sample *in2, t_sample *out, int n)
|
|||
|
||||
static void plus_dsp(t_plus *x, t_signal **sp)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
(void) x;
|
||||
#endif
|
||||
dsp_add_plus(sp[0]->s_vec, sp[1]->s_vec, sp[2]->s_vec, sp[0]->s_n);
|
||||
}
|
||||
|
||||
|
@ -161,6 +167,9 @@ typedef struct _scalarminus
|
|||
|
||||
static void *minus_new(t_symbol *s, int argc, t_atom *argv)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
(void) s;
|
||||
#endif
|
||||
if (argc > 1) post("-~: extra arguments ignored");
|
||||
if (argc)
|
||||
{
|
||||
|
@ -240,6 +249,9 @@ t_int *scalarminus_perf8(t_int *w)
|
|||
|
||||
static void minus_dsp(t_minus *x, t_signal **sp)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
(void) x;
|
||||
#endif
|
||||
if (sp[0]->s_n&7)
|
||||
dsp_add(minus_perform, 4,
|
||||
sp[0]->s_vec, sp[1]->s_vec, sp[2]->s_vec, sp[0]->s_n);
|
||||
|
@ -292,6 +304,9 @@ typedef struct _scalartimes
|
|||
|
||||
static void *times_new(t_symbol *s, int argc, t_atom *argv)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
(void) s;
|
||||
#endif
|
||||
if (argc > 1) post("*~: extra arguments ignored");
|
||||
if (argc)
|
||||
{
|
||||
|
@ -371,6 +386,9 @@ t_int *scalartimes_perf8(t_int *w)
|
|||
|
||||
static void times_dsp(t_times *x, t_signal **sp)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
(void) x;
|
||||
#endif
|
||||
if (sp[0]->s_n&7)
|
||||
dsp_add(times_perform, 4,
|
||||
sp[0]->s_vec, sp[1]->s_vec, sp[2]->s_vec, sp[0]->s_n);
|
||||
|
@ -422,6 +440,9 @@ typedef struct _scalarover
|
|||
|
||||
static void *over_new(t_symbol *s, int argc, t_atom *argv)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
(void) s;
|
||||
#endif
|
||||
if (argc > 1) post("/~: extra arguments ignored");
|
||||
if (argc)
|
||||
{
|
||||
|
@ -512,6 +533,9 @@ t_int *scalarover_perf8(t_int *w)
|
|||
|
||||
static void over_dsp(t_over *x, t_signal **sp)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
(void) x;
|
||||
#endif
|
||||
if (sp[0]->s_n&7)
|
||||
dsp_add(over_perform, 4,
|
||||
sp[0]->s_vec, sp[1]->s_vec, sp[2]->s_vec, sp[0]->s_n);
|
||||
|
@ -563,6 +587,9 @@ typedef struct _scalarmax
|
|||
|
||||
static void *max_new(t_symbol *s, int argc, t_atom *argv)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
(void) s;
|
||||
#endif
|
||||
if (argc > 1) post("max~: extra arguments ignored");
|
||||
if (argc)
|
||||
{
|
||||
|
@ -654,6 +681,9 @@ t_int *scalarmax_perf8(t_int *w)
|
|||
|
||||
static void max_dsp(t_max *x, t_signal **sp)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
(void) x;
|
||||
#endif
|
||||
if (sp[0]->s_n&7)
|
||||
dsp_add(max_perform, 4,
|
||||
sp[0]->s_vec, sp[1]->s_vec, sp[2]->s_vec, sp[0]->s_n);
|
||||
|
@ -705,6 +735,9 @@ typedef struct _scalarmin
|
|||
|
||||
static void *min_new(t_symbol *s, int argc, t_atom *argv)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
(void) s;
|
||||
#endif
|
||||
if (argc > 1) post("min~: extra arguments ignored");
|
||||
if (argc)
|
||||
{
|
||||
|
@ -796,6 +829,9 @@ t_int *scalarmin_perf8(t_int *w)
|
|||
|
||||
static void min_dsp(t_min *x, t_signal **sp)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
(void) x;
|
||||
#endif
|
||||
if (sp[0]->s_n&7)
|
||||
dsp_add(min_perform, 4,
|
||||
sp[0]->s_vec, sp[1]->s_vec, sp[2]->s_vec, sp[0]->s_n);
|
||||
|
|
|
@ -74,7 +74,10 @@ static void *sig_tilde_new(t_floatarg f)
|
|||
return (x);
|
||||
}
|
||||
|
||||
static void sig_tilde_setup(void)
|
||||
#ifndef ROCKBOX
|
||||
static
|
||||
#endif
|
||||
void sig_tilde_setup(void)
|
||||
{
|
||||
sig_tilde_class = class_new(gensym("sig~"), (t_newmethod)sig_tilde_new, 0,
|
||||
sizeof(t_sig), 0, A_DEFFLOAT, 0);
|
||||
|
|
|
@ -22,8 +22,17 @@ typedef struct _dac
|
|||
static void *dac_new(t_symbol *s, int argc, t_atom *argv)
|
||||
{
|
||||
t_dac *x = (t_dac *)pd_new(dac_class);
|
||||
#ifdef ROCKBOX
|
||||
t_atom defarg[2];
|
||||
#else
|
||||
t_atom defarg[2], *ap;
|
||||
#endif
|
||||
int i;
|
||||
|
||||
#ifdef ROCKBOX
|
||||
(void) s;
|
||||
#endif
|
||||
|
||||
if (!argc)
|
||||
{
|
||||
argv = defarg;
|
||||
|
@ -83,8 +92,17 @@ typedef struct _adc
|
|||
static void *adc_new(t_symbol *s, int argc, t_atom *argv)
|
||||
{
|
||||
t_adc *x = (t_adc *)pd_new(adc_class);
|
||||
#ifdef ROCKBOX
|
||||
t_atom defarg[2];
|
||||
#else
|
||||
t_atom defarg[2], *ap;
|
||||
#endif
|
||||
int i;
|
||||
|
||||
#ifdef ROCKBOX
|
||||
(void) s;
|
||||
#endif
|
||||
|
||||
if (!argc)
|
||||
{
|
||||
argv = defarg;
|
||||
|
|
|
@ -67,6 +67,9 @@ static t_int *sigifft_perform(t_int *w)
|
|||
|
||||
static void sigfft_dspx(t_sigfft *x, t_signal **sp, t_int *(*f)(t_int *w))
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
(void) x;
|
||||
#endif
|
||||
int n = sp[0]->s_n;
|
||||
t_sample *in1 = sp[0]->s_vec;
|
||||
t_sample *in2 = sp[1]->s_vec;
|
||||
|
@ -150,6 +153,9 @@ static t_int *sigrfft_perform(t_int *w)
|
|||
|
||||
static void sigrfft_dsp(t_sigrfft *x, t_signal **sp)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
(void) x;
|
||||
#endif
|
||||
int n = sp[0]->s_n, n2 = (n>>1);
|
||||
t_sample *in1 = sp[0]->s_vec;
|
||||
t_sample *out1 = sp[1]->s_vec;
|
||||
|
@ -213,6 +219,9 @@ static t_int *sigrifft_perform(t_int *w)
|
|||
|
||||
static void sigrifft_dsp(t_sigrifft *x, t_signal **sp)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
(void) x;
|
||||
#endif
|
||||
int n = sp[0]->s_n, n2 = (n>>1);
|
||||
t_sample *in1 = sp[0]->s_vec;
|
||||
t_sample *in2 = sp[1]->s_vec;
|
||||
|
|
|
@ -84,9 +84,14 @@
|
|||
/* INCLUDE FILES */
|
||||
/*****************************************************************************/
|
||||
|
||||
#ifdef ROCKBOX
|
||||
#include "plugin.h"
|
||||
#include "pdbox.h"
|
||||
#else /* ROCKBOX */
|
||||
#include <stdio.h>
|
||||
#include <math.h>
|
||||
#include <stdlib.h>
|
||||
#endif /* ROCKBOX */
|
||||
|
||||
/* the following is needed only to declare pd_fft() as exportable in MSW */
|
||||
#include "m_pd.h"
|
||||
|
@ -280,7 +285,7 @@ void fft_clear(void)
|
|||
nextnet = thisnet->next;
|
||||
net_dealloc(thisnet);
|
||||
free((char *)thisnet);
|
||||
} while (thisnet = nextnet);
|
||||
} while ((thisnet = nextnet));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -485,14 +490,21 @@ void load_registers(FFT_NET *fft_net, float *buf, int buf_form,
|
|||
|
||||
{
|
||||
int *load_index = fft_net->load_index;
|
||||
#ifdef ROCKBOX
|
||||
SAMPLE *window = NULL;
|
||||
int index, i = 0;
|
||||
#else
|
||||
SAMPLE *window;
|
||||
int index, i = 0, n = fft_net->n;
|
||||
#endif
|
||||
|
||||
if (trnsfrm_dir==FORWARD) window = fft_net->window;
|
||||
else if (trnsfrm_dir==INVERSE) window = fft_net->inv_window;
|
||||
else {
|
||||
#ifndef ROCKBOX
|
||||
fprintf(stderr, "load_registers:illegal transform direction\n");
|
||||
exit(0);
|
||||
#endif
|
||||
}
|
||||
fft_net->direction = trnsfrm_dir;
|
||||
|
||||
|
@ -539,8 +551,10 @@ void load_registers(FFT_NET *fft_net, float *buf, int buf_form,
|
|||
} break;
|
||||
|
||||
default: {
|
||||
#ifndef ROCKBOX
|
||||
fprintf(stderr, "load_registers:illegal input form\n");
|
||||
exit(0);
|
||||
#endif
|
||||
} break;
|
||||
}
|
||||
} break;
|
||||
|
@ -591,15 +605,19 @@ void load_registers(FFT_NET *fft_net, float *buf, int buf_form,
|
|||
} break;
|
||||
|
||||
default: {
|
||||
#ifndef ROCKBOX
|
||||
fprintf(stderr, "load_registers:illegal input form\n");
|
||||
exit(0);
|
||||
#endif
|
||||
} break;
|
||||
}
|
||||
} break;
|
||||
|
||||
default: {
|
||||
#ifndef ROCKBOX
|
||||
fprintf(stderr, "load_registers:illegal input scale\n");
|
||||
exit(0);
|
||||
#endif
|
||||
} break;
|
||||
}
|
||||
}
|
||||
|
@ -616,8 +634,15 @@ void store_registers(FFT_NET *fft_net, float *buf, int buf_form,
|
|||
*/
|
||||
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
(void) debug;
|
||||
#endif
|
||||
int i;
|
||||
#ifdef ROCKBOX
|
||||
SAMPLE real, imag;
|
||||
#else
|
||||
SAMPLE real, imag, mag, phase;
|
||||
#endif
|
||||
int n;
|
||||
|
||||
i = 0;
|
||||
|
@ -661,12 +686,21 @@ void store_registers(FFT_NET *fft_net, float *buf, int buf_form,
|
|||
if (real > .00001)
|
||||
*buf++ = (float)atan2(imag, real);
|
||||
else { /* deal with bad case */
|
||||
#ifdef ROCKBOX
|
||||
if (imag > 0){ *buf++ = PI / 2.;
|
||||
}
|
||||
else if (imag < 0){ *buf++ = -PI / 2.;
|
||||
}
|
||||
else { *buf++ = 0;
|
||||
}
|
||||
#else
|
||||
if (imag > 0){ *buf++ = PI / 2.;
|
||||
if(debug) fprintf(stderr,"real=0 and imag > 0\n");}
|
||||
else if (imag < 0){ *buf++ = -PI / 2.;
|
||||
if(debug) fprintf(stderr,"real=0 and imag < 0\n");}
|
||||
else { *buf++ = 0;
|
||||
if(debug) fprintf(stderr,"real=0 and imag=0\n");}
|
||||
#endif
|
||||
}
|
||||
} while (++i < n);
|
||||
} break;
|
||||
|
@ -687,8 +721,10 @@ void store_registers(FFT_NET *fft_net, float *buf, int buf_form,
|
|||
} break;
|
||||
|
||||
default: {
|
||||
#ifndef ROCKBOX
|
||||
fprintf(stderr, "store_registers:illegal output form\n");
|
||||
exit(0);
|
||||
#endif
|
||||
} break;
|
||||
}
|
||||
} break;
|
||||
|
@ -753,15 +789,19 @@ void store_registers(FFT_NET *fft_net, float *buf, int buf_form,
|
|||
} break;
|
||||
|
||||
default: {
|
||||
#ifndef ROCKBOX
|
||||
fprintf(stderr, "store_registers:illegal output form\n");
|
||||
exit(0);
|
||||
#endif
|
||||
} break;
|
||||
}
|
||||
} break;
|
||||
|
||||
default: {
|
||||
#ifndef ROCKBOX
|
||||
fprintf(stderr, "store_registers:illegal output scale\n");
|
||||
exit(0);
|
||||
#endif
|
||||
} break;
|
||||
}
|
||||
}
|
||||
|
@ -992,7 +1032,11 @@ void short_to_float(short *short_buf, float *float_buf, int n)
|
|||
void pd_fft(float *buf, int npoints, int inverse)
|
||||
{
|
||||
double renorm;
|
||||
#ifdef ROCKBOX
|
||||
float *fp;
|
||||
#else
|
||||
float *fp, *fp2;
|
||||
#endif
|
||||
int i;
|
||||
renorm = (inverse ? npoints : 1.);
|
||||
cfft((inverse ? INVERSE : FORWARD), npoints, RECTANGULAR,
|
||||
|
|
|
@ -4,8 +4,16 @@
|
|||
|
||||
/* send~, receive~, throw~, catch~ */
|
||||
|
||||
#ifdef ROCKBOX
|
||||
#include "plugin.h"
|
||||
#include "pdbox.h"
|
||||
#endif
|
||||
|
||||
#include "m_pd.h"
|
||||
|
||||
#ifndef ROCKBOX
|
||||
#include <string.h>
|
||||
#endif
|
||||
|
||||
#define DEFSENDVS 64 /* LATER get send to get this from canvas */
|
||||
|
||||
|
|
|
@ -95,7 +95,9 @@ char mtrig_algorithm[] = "Simple";
|
|||
|
||||
#define TRIG_TAB_SIZE 22
|
||||
|
||||
#ifndef ROCKBOX
|
||||
static long long halsec[TRIG_TAB_SIZE]= {1,2,3};
|
||||
#endif
|
||||
|
||||
#define FFTmult(x,y) mult(x,y)
|
||||
|
||||
|
@ -286,7 +288,11 @@ void imayer_ifft(int n, t_fixed *real, t_fixed *imag)
|
|||
|
||||
void imayer_realfft(int n, t_fixed *real)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
t_fixed a,b;
|
||||
#else
|
||||
t_fixed a,b,c,d;
|
||||
#endif
|
||||
int i,j,k;
|
||||
imayer_fht(real,n);
|
||||
for (i=1,j=n-1,k=n/2;i<k;i++,j--) {
|
||||
|
@ -299,7 +305,11 @@ void imayer_realfft(int n, t_fixed *real)
|
|||
|
||||
void imayer_realifft(int n, t_fixed *real)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
t_fixed a,b;
|
||||
#else
|
||||
t_fixed a,b,c,d;
|
||||
#endif
|
||||
int i,j,k;
|
||||
for (i=1,j=n-1,k=n/2;i<k;i++,j--) {
|
||||
a = real[i];
|
||||
|
|
|
@ -394,7 +394,11 @@ void mayer_ifft(int n, REAL *real, REAL *imag)
|
|||
|
||||
void mayer_realfft(int n, REAL *real)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
REAL a,b;
|
||||
#else
|
||||
REAL a,b,c,d;
|
||||
#endif
|
||||
int i,j,k;
|
||||
mayer_fht(real,n);
|
||||
for (i=1,j=n-1,k=n/2;i<k;i++,j--) {
|
||||
|
@ -407,7 +411,11 @@ void mayer_realfft(int n, REAL *real)
|
|||
|
||||
void mayer_realifft(int n, REAL *real)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
REAL a,b;
|
||||
#else
|
||||
REAL a,b,c,d;
|
||||
#endif
|
||||
int i,j,k;
|
||||
for (i=1,j=n-1,k=n/2;i<k;i++,j--) {
|
||||
a = real[i];
|
||||
|
|
|
@ -5,9 +5,17 @@
|
|||
/* miscellaneous: print~; more to come.
|
||||
*/
|
||||
|
||||
#ifdef ROCKBOX
|
||||
#include "plugin.h"
|
||||
#include "pdbox.h"
|
||||
#endif
|
||||
|
||||
#include "m_pd.h"
|
||||
|
||||
#ifndef ROCKBOX
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#endif
|
||||
|
||||
/* ------------------------- print~ -------------------------- */
|
||||
static t_class *print_class;
|
||||
|
@ -69,7 +77,10 @@ static void *print_new(t_symbol *s)
|
|||
return (x);
|
||||
}
|
||||
|
||||
static void print_setup(void)
|
||||
#ifndef ROCKBOX
|
||||
static
|
||||
#endif
|
||||
void print_setup(void)
|
||||
{
|
||||
print_class = class_new(gensym("print~"), (t_newmethod)print_new, 0,
|
||||
sizeof(t_print), 0, A_DEFSYM, 0);
|
||||
|
@ -118,7 +129,11 @@ static void scope_dsp(t_scope *x, t_signal **sp)
|
|||
|
||||
static void scope_erase(t_scope *x)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
(void) x;
|
||||
#else
|
||||
if (x->x_drawn) sys_vgui(".x%x.c delete gumbo\n", x->x_canvas);
|
||||
#endif
|
||||
}
|
||||
|
||||
#define X1 10.
|
||||
|
@ -126,6 +141,7 @@ static void scope_erase(t_scope *x)
|
|||
#define YC 5.
|
||||
static void scope_bang(t_scope *x)
|
||||
{
|
||||
#ifndef ROCKBOX
|
||||
int n, phase;
|
||||
char hugebuf[10000], *s = hugebuf;
|
||||
scope_erase(x);
|
||||
|
@ -142,6 +158,7 @@ static void scope_bang(t_scope *x)
|
|||
}
|
||||
sprintf(s, "-tags gumbo\n");
|
||||
sys_gui(hugebuf);
|
||||
#endif
|
||||
x->x_drawn = 1;
|
||||
}
|
||||
|
||||
|
@ -152,6 +169,9 @@ static void scope_free(t_scope *x)
|
|||
|
||||
static void *scope_new(t_symbol *s)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
(void) s;
|
||||
#endif
|
||||
t_scope *x = (t_scope *)pd_new(scope_class);
|
||||
error("scope: this is now obsolete; use arrays and tabwrite~ instead");
|
||||
x->x_phase = 0;
|
||||
|
@ -188,6 +208,9 @@ static t_int *bang_tilde_perform(t_int *w)
|
|||
|
||||
static void bang_tilde_dsp(t_bang *x, t_signal **sp)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
(void) sp;
|
||||
#endif
|
||||
dsp_add(bang_tilde_perform, 1, x);
|
||||
}
|
||||
|
||||
|
@ -203,6 +226,9 @@ static void bang_tilde_free(t_bang *x)
|
|||
|
||||
static void *bang_tilde_new(t_symbol *s)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
(void) s;
|
||||
#endif
|
||||
t_bang *x = (t_bang *)pd_new(bang_tilde_class);
|
||||
x->x_clock = clock_new(x, (t_method)bang_tilde_tick);
|
||||
outlet_new(&x->x_obj, &s_bang);
|
||||
|
@ -233,6 +259,9 @@ static void samplerate_tilde_bang(t_samplerate *x)
|
|||
|
||||
static void *samplerate_tilde_new(t_symbol *s)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
(void) s;
|
||||
#endif
|
||||
t_samplerate *x = (t_samplerate *)pd_new(samplerate_tilde_class);
|
||||
outlet_new(&x->x_obj, &s_float);
|
||||
return (x);
|
||||
|
|
|
@ -11,6 +11,10 @@ readsf~ and writesf~ are defined which confine disk operations to a separate
|
|||
thread so that they can be used in real time. The readsf~ and writesf~
|
||||
objects use Posix-like threads. */
|
||||
|
||||
#ifdef ROCKBOX
|
||||
#include "plugin.h"
|
||||
#include "pdbox.h"
|
||||
#else /* ROCKBOX */
|
||||
#ifdef UNIX
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
|
@ -22,6 +26,7 @@ objects use Posix-like threads. */
|
|||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
#endif /* ROCKBOX */
|
||||
|
||||
#include "m_pd.h"
|
||||
|
||||
|
@ -198,9 +203,15 @@ int open_soundfile(const char *dirname, const char *filename, int headersize,
|
|||
long skipframes)
|
||||
{
|
||||
char buf[OBUFSIZE], *bufptr;
|
||||
#ifdef ROCKBOX
|
||||
int fd, nchannels, bigendian, bytespersamp, swap, sysrtn;
|
||||
#else
|
||||
int fd, format, nchannels, bigendian, bytespersamp, swap, sysrtn;
|
||||
#endif
|
||||
long bytelimit = 0x7fffffff;
|
||||
#ifndef ROCKBOX
|
||||
errno = 0;
|
||||
#endif
|
||||
fd = open_via_path(dirname, filename,
|
||||
"", buf, &bufptr, MAXPDSTRING, 1);
|
||||
if (fd < 0)
|
||||
|
@ -239,7 +250,9 @@ int open_soundfile(const char *dirname, const char *filename, int headersize,
|
|||
swap = (bigendian != garray_ambigendian());
|
||||
if (format == FORMAT_NEXT) /* nextstep header */
|
||||
{
|
||||
#ifndef ROCKBOX
|
||||
uint32 param;
|
||||
#endif
|
||||
if (bytesread < (int)sizeof(t_nextstep))
|
||||
goto badheader;
|
||||
nchannels = swap4(((t_nextstep *)buf)->ns_nchans, swap);
|
||||
|
@ -381,7 +394,9 @@ int open_soundfile(const char *dirname, const char *filename, int headersize,
|
|||
badheader:
|
||||
/* the header wasn't recognized. We're threadable here so let's not
|
||||
print out the error... */
|
||||
#ifndef ROCKBOX
|
||||
errno = EIO;
|
||||
#endif
|
||||
return (-1);
|
||||
}
|
||||
|
||||
|
@ -705,7 +720,11 @@ static int create_soundfile(t_canvas *canvas, const char *filename,
|
|||
|
||||
canvas_makefilename(canvas, filenamebuf, buf2, MAXPDSTRING);
|
||||
sys_bashfilename(buf2, buf2);
|
||||
#ifdef ROCKBOX
|
||||
if ((fd = open(buf2, BINCREATE)) < 0)
|
||||
#else
|
||||
if ((fd = open(buf2, BINCREATE, 0666)) < 0)
|
||||
#endif
|
||||
return (-1);
|
||||
|
||||
if (write(fd, headerbuf, headersize) < headersize)
|
||||
|
@ -771,7 +790,11 @@ static void soundfile_finishwrite(void *obj, char *filename, int fd,
|
|||
}
|
||||
return;
|
||||
baddonewrite:
|
||||
#ifdef ROCKBOX
|
||||
post("%s: error", filename);
|
||||
#else
|
||||
post("%s: %s", filename, strerror(errno));
|
||||
#endif
|
||||
}
|
||||
|
||||
static void soundfile_xferout(int nchannels, t_sample **vecs,
|
||||
|
@ -920,9 +943,16 @@ static t_soundfiler *soundfiler_new(void)
|
|||
static void soundfiler_read(t_soundfiler *x, t_symbol *s,
|
||||
int argc, t_atom *argv)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
(void) s;
|
||||
#endif
|
||||
int headersize = -1, channels = 0, bytespersamp = 0, bigendian = 0,
|
||||
resize = 0, i, j;
|
||||
#ifdef ROCKBOX
|
||||
long skipframes = 0, nframes = 0, finalsize = 0,
|
||||
#else
|
||||
long skipframes = 0, nframes = 0, finalsize = 0, itemsleft,
|
||||
#endif
|
||||
maxsize = DEFMAXSIZE, itemsread = 0, bytelimit = 0x7fffffff;
|
||||
int fd = -1;
|
||||
char endianness, *filename;
|
||||
|
@ -930,7 +960,11 @@ static void soundfiler_read(t_soundfiler *x, t_symbol *s,
|
|||
t_sample *vecs[MAXSFCHANS];
|
||||
char sampbuf[SAMPBUFSIZE];
|
||||
int bufframes, nitems;
|
||||
#ifdef ROCKBOX
|
||||
int fp;
|
||||
#else
|
||||
FILE *fp;
|
||||
#endif
|
||||
while (argc > 0 && argv->a_type == A_SYMBOL &&
|
||||
*argv->a_w.w_symbol->s_name == '-')
|
||||
{
|
||||
|
@ -1019,8 +1053,14 @@ static void soundfiler_read(t_soundfiler *x, t_symbol *s,
|
|||
|
||||
if (fd < 0)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
pd_error(x, "soundfiler_read: %s: %s",
|
||||
filename,
|
||||
"unknown or bad header format");
|
||||
#else
|
||||
pd_error(x, "soundfiler_read: %s: %s", filename, (errno == EIO ?
|
||||
"unknown or bad header format" : strerror(errno)));
|
||||
#endif
|
||||
goto done;
|
||||
}
|
||||
|
||||
|
@ -1065,14 +1105,22 @@ static void soundfiler_read(t_soundfiler *x, t_symbol *s,
|
|||
if (!finalsize) finalsize = 0x7fffffff;
|
||||
if (finalsize > bytelimit / (channels * bytespersamp))
|
||||
finalsize = bytelimit / (channels * bytespersamp);
|
||||
#ifdef ROCKBOX
|
||||
fp = open(filename, O_RDONLY);
|
||||
#else
|
||||
fp = fdopen(fd, "rb");
|
||||
#endif
|
||||
bufframes = SAMPBUFSIZE / (channels * bytespersamp);
|
||||
|
||||
for (itemsread = 0; itemsread < finalsize; )
|
||||
{
|
||||
int thisread = finalsize - itemsread;
|
||||
thisread = (thisread > bufframes ? bufframes : thisread);
|
||||
#ifdef ROCKBOX
|
||||
nitems = read(fp, sampbuf, thisread * bytespersamp * channels);
|
||||
#else
|
||||
nitems = fread(sampbuf, channels * bytespersamp, thisread, fp);
|
||||
#endif
|
||||
if (nitems <= 0) break;
|
||||
soundfile_xferin(channels, argc, vecs, itemsread,
|
||||
(unsigned char *)sampbuf, nitems, bytespersamp, bigendian);
|
||||
|
@ -1082,7 +1130,11 @@ static void soundfiler_read(t_soundfiler *x, t_symbol *s,
|
|||
|
||||
for (i = 0; i < argc; i++)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
int vecsize;
|
||||
#else
|
||||
int nzero, vecsize;
|
||||
#endif
|
||||
garray_getfloatarray(garrays[i], &vecsize, &vecs[i]);
|
||||
for (j = itemsread; j < vecsize; j++)
|
||||
vecs[i][j] = 0;
|
||||
|
@ -1099,7 +1151,11 @@ static void soundfiler_read(t_soundfiler *x, t_symbol *s,
|
|||
/* do all graphics updates */
|
||||
for (i = 0; i < argc; i++)
|
||||
garray_redraw(garrays[i]);
|
||||
#ifdef ROCKBOX
|
||||
close(fp);
|
||||
#else
|
||||
fclose(fp);
|
||||
#endif
|
||||
fd = -1;
|
||||
goto done;
|
||||
usage:
|
||||
|
@ -1118,14 +1174,25 @@ done:
|
|||
long soundfiler_dowrite(void *obj, t_canvas *canvas,
|
||||
int argc, t_atom *argv)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
int bytespersamp, bigendian,
|
||||
swap, filetype, normalize, i, j, nchannels;
|
||||
long onset, nframes,
|
||||
itemswritten = 0;
|
||||
#else
|
||||
int headersize, bytespersamp, bigendian,
|
||||
endianness, swap, filetype, normalize, i, j, nchannels;
|
||||
long onset, nframes, itemsleft,
|
||||
maxsize = DEFMAXSIZE, itemswritten = 0;
|
||||
#endif
|
||||
t_garray *garrays[MAXSFCHANS];
|
||||
t_sample *vecs[MAXSFCHANS];
|
||||
char sampbuf[SAMPBUFSIZE];
|
||||
#ifdef ROCKBOX
|
||||
int bufframes;
|
||||
#else
|
||||
int bufframes, nitems;
|
||||
#endif
|
||||
int fd = -1;
|
||||
float normfactor, biggest = 0, samplerate;
|
||||
t_symbol *filesym;
|
||||
|
@ -1174,7 +1241,11 @@ long soundfiler_dowrite(void *obj, t_canvas *canvas,
|
|||
nframes, bytespersamp, bigendian, nchannels,
|
||||
swap, samplerate)) < 0)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
post("%s: %s\n", filesym->s_name, "error");
|
||||
#else
|
||||
post("%s: %s\n", filesym->s_name, strerror(errno));
|
||||
#endif
|
||||
goto fail;
|
||||
}
|
||||
if (!normalize)
|
||||
|
@ -1194,14 +1265,22 @@ long soundfiler_dowrite(void *obj, t_canvas *canvas,
|
|||
|
||||
for (itemswritten = 0; itemswritten < nframes; )
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
int thiswrite = nframes - itemswritten, nbytes;
|
||||
#else
|
||||
int thiswrite = nframes - itemswritten, nitems, nbytes;
|
||||
#endif
|
||||
thiswrite = (thiswrite > bufframes ? bufframes : thiswrite);
|
||||
soundfile_xferout(argc, vecs, (unsigned char *)sampbuf, thiswrite,
|
||||
onset, bytespersamp, bigendian, normfactor);
|
||||
nbytes = write(fd, sampbuf, nchannels * bytespersamp * thiswrite);
|
||||
if (nbytes < nchannels * bytespersamp * thiswrite)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
post("%s: %s", filesym->s_name, "error");
|
||||
#else
|
||||
post("%s: %s", filesym->s_name, strerror(errno));
|
||||
#endif
|
||||
if (nbytes > 0)
|
||||
itemswritten += nbytes / (nchannels * bytespersamp);
|
||||
break;
|
||||
|
@ -1230,6 +1309,9 @@ fail:
|
|||
static void soundfiler_write(t_soundfiler *x, t_symbol *s,
|
||||
int argc, t_atom *argv)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
(void) s;
|
||||
#endif
|
||||
long bozo = soundfiler_dowrite(x, x->x_canvas,
|
||||
argc, argv);
|
||||
outlet_float(x->x_obj.ob_outlet, (float)bozo);
|
||||
|
|
|
@ -21,11 +21,17 @@
|
|||
*
|
||||
*/
|
||||
|
||||
|
||||
#ifdef ROCKBOX
|
||||
#include "plugin.h"
|
||||
#include "pdbox.h"
|
||||
#include "m_pd.h"
|
||||
#include "m_imp.h"
|
||||
#else /* ROCKBOX */
|
||||
#include "m_pd.h"
|
||||
#include "m_imp.h"
|
||||
#include <stdlib.h>
|
||||
#include <stdarg.h>
|
||||
#endif /* ROCKBOX */
|
||||
|
||||
extern t_class *vinlet_class, *voutlet_class, *canvas_class;
|
||||
t_sample *obj_findsignalscalar(t_object *x, int m);
|
||||
|
@ -258,6 +264,10 @@ static t_int *block_epilog(t_int *w)
|
|||
|
||||
static void block_dsp(t_block *x, t_signal **sp)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
(void) x;
|
||||
(void) sp;
|
||||
#endif
|
||||
/* do nothing here */
|
||||
}
|
||||
|
||||
|
@ -303,6 +313,7 @@ void dsp_tick(void)
|
|||
t_int *ip;
|
||||
for (ip = dsp_chain; *ip; ) ip = (*(t_perfroutine)(*ip))(ip);
|
||||
dsp_phase++;
|
||||
printf("%d\n", dsp_phase);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -330,9 +341,13 @@ static t_signal *signal_usedlist;
|
|||
/* call this when DSP is stopped to free all the signals */
|
||||
void signal_cleanup(void)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
t_signal *sig;
|
||||
#else
|
||||
t_signal **svec, *sig, *sig2;
|
||||
#endif
|
||||
int i;
|
||||
while (sig = signal_usedlist)
|
||||
while((sig = signal_usedlist))
|
||||
{
|
||||
signal_usedlist = sig->s_nextused;
|
||||
if (!sig->s_isborrowed)
|
||||
|
@ -397,9 +412,15 @@ void signal_makereusable(t_signal *sig)
|
|||
|
||||
t_signal *signal_new(int n, float sr)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
int logn;
|
||||
#else
|
||||
int logn, n2;
|
||||
#endif
|
||||
t_signal *ret, **whichlist;
|
||||
#ifndef ROCKBOX
|
||||
t_sample *fp;
|
||||
#endif
|
||||
logn = ilog2(n);
|
||||
if (n)
|
||||
{
|
||||
|
@ -413,7 +434,7 @@ t_signal *signal_new(int n, float sr)
|
|||
whichlist = &signal_freeborrowed;
|
||||
|
||||
/* first try to reclaim one from the free list */
|
||||
if (ret = *whichlist)
|
||||
if((ret = *whichlist))
|
||||
*whichlist = ret->s_nextfree;
|
||||
else
|
||||
{
|
||||
|
@ -520,8 +541,10 @@ static t_dspcontext *ugen_currentcontext;
|
|||
|
||||
void ugen_stop(void)
|
||||
{
|
||||
#ifndef ROCKBOX
|
||||
t_signal *s;
|
||||
int i;
|
||||
#endif
|
||||
if (dsp_chain)
|
||||
{
|
||||
freebytes(dsp_chain, dsp_chainsize * sizeof (t_int));
|
||||
|
@ -577,8 +600,10 @@ t_dspcontext *ugen_start_graph(int toplevel, t_signal **sp,
|
|||
int ninlets, int noutlets)
|
||||
{
|
||||
t_dspcontext *dc = (t_dspcontext *)getbytes(sizeof(*dc));
|
||||
#ifndef ROCKBOX
|
||||
float parent_srate, srate;
|
||||
int parent_vecsize, vecsize;
|
||||
#endif
|
||||
|
||||
if (ugen_loud) post("ugen_start_graph...");
|
||||
|
||||
|
@ -672,7 +697,11 @@ static void ugen_doit(t_dspcontext *dc, t_ugenbox *u)
|
|||
{
|
||||
t_sigoutlet *uout;
|
||||
t_siginlet *uin;
|
||||
#ifdef ROCKBOX
|
||||
t_sigoutconnect *oc;
|
||||
#else
|
||||
t_sigoutconnect *oc, *oc2;
|
||||
#endif
|
||||
t_class *class = pd_class(&u->u_obj->ob_pd);
|
||||
int i, n;
|
||||
/* suppress creating new signals for the outputs of signal
|
||||
|
@ -681,13 +710,13 @@ static void ugen_doit(t_dspcontext *dc, t_ugenbox *u)
|
|||
we delay new signal creation, which will be handled by calling
|
||||
signal_setborrowed in the ugen_done_graph routine below. */
|
||||
int nonewsigs = (class == canvas_class ||
|
||||
(class == vinlet_class) && !(dc->dc_reblock));
|
||||
((class == vinlet_class) && !(dc->dc_reblock)));
|
||||
/* when we encounter a subcanvas or a signal outlet, suppress freeing
|
||||
the input signals as they may be "borrowed" for the super or sub
|
||||
patch; same exception as above, but also if we're "switched" we
|
||||
have to do a copy rather than a borrow. */
|
||||
int nofreesigs = (class == canvas_class ||
|
||||
(class == voutlet_class) && !(dc->dc_reblock || dc->dc_switched));
|
||||
((class == voutlet_class) && !(dc->dc_reblock || dc->dc_switched)));
|
||||
t_signal **insig, **outsig, **sig, *s1, *s2, *s3;
|
||||
t_ugenbox *u2;
|
||||
|
||||
|
@ -701,7 +730,7 @@ static void ugen_doit(t_dspcontext *dc, t_ugenbox *u)
|
|||
s3 = signal_new(dc->dc_vecsize, dc->dc_srate);
|
||||
/* post("%s: unconnected signal inlet set to zero",
|
||||
class_getname(u->u_obj->ob_pd)); */
|
||||
if (scalar = obj_findsignalscalar(u->u_obj, i))
|
||||
if((scalar = obj_findsignalscalar(u->u_obj, i)))
|
||||
dsp_add_scalarcopy(scalar, s3->s_vec, s3->s_n);
|
||||
else
|
||||
dsp_add_zero(s3->s_vec, s3->s_n);
|
||||
|
@ -781,7 +810,7 @@ static void ugen_doit(t_dspcontext *dc, t_ugenbox *u)
|
|||
u2 = oc->oc_who;
|
||||
uin = &u2->u_in[oc->oc_inno];
|
||||
/* if there's already someone here, sum the two */
|
||||
if (s2 = uin->i_signal)
|
||||
if((s2 = uin->i_signal))
|
||||
{
|
||||
s1->s_refcount--;
|
||||
s2->s_refcount--;
|
||||
|
@ -825,7 +854,11 @@ static void ugen_doit(t_dspcontext *dc, t_ugenbox *u)
|
|||
|
||||
void ugen_done_graph(t_dspcontext *dc)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
t_ugenbox *u;
|
||||
#else
|
||||
t_ugenbox *u, *u2;
|
||||
#endif
|
||||
t_sigoutlet *uout;
|
||||
t_siginlet *uin;
|
||||
t_sigoutconnect *oc, *oc2;
|
||||
|
@ -966,7 +999,11 @@ void ugen_done_graph(t_dspcontext *dc)
|
|||
for (u = dc->dc_ugenlist; u; u = u->u_next)
|
||||
{
|
||||
t_pd *zz = &u->u_obj->ob_pd;
|
||||
#ifdef ROCKBOX
|
||||
t_signal **outsigs = dc->dc_iosigs;
|
||||
#else
|
||||
t_signal **insigs = dc->dc_iosigs, **outsigs = dc->dc_iosigs;
|
||||
#endif
|
||||
if (outsigs) outsigs += dc->dc_ninlets;
|
||||
|
||||
if (pd_class(zz) == vinlet_class)
|
||||
|
|
|
@ -6,6 +6,14 @@
|
|||
/* thanks to Miller Puckette, Guenther Geiger and Krzystof Czaja */
|
||||
|
||||
|
||||
#ifdef ROCKBOX
|
||||
#include "plugin.h"
|
||||
#include "pdbox.h"
|
||||
#include "m_pd.h"
|
||||
#include "g_canvas.h"
|
||||
#include "g_all_guis.h"
|
||||
#define snprintf rb->snprintf
|
||||
#else /* ROCKBOX */
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
|
@ -21,6 +29,7 @@
|
|||
#else
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
#endif /* ROCKBOX */
|
||||
|
||||
/* #define GGEE_HSLIDER_COMPATIBLE */
|
||||
|
||||
|
@ -185,12 +194,20 @@ void iemgui_verify_snd_ne_rcv(t_iemgui *iemgui)
|
|||
|
||||
t_symbol *iemgui_new_dogetname(t_iemgui *iemgui, int indx, t_atom *argv)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
(void) iemgui;
|
||||
#endif
|
||||
if (IS_A_SYMBOL(argv, indx))
|
||||
return (atom_getsymbolarg(indx, 100000, argv));
|
||||
else if (IS_A_FLOAT(argv, indx))
|
||||
{
|
||||
char str[80];
|
||||
#ifdef ROCKBOX
|
||||
snprintf(str, sizeof(str)-1,
|
||||
"%d", (int)atom_getintarg(indx, 100000, argv));
|
||||
#else
|
||||
sprintf(str, "%d", (int)atom_getintarg(indx, 100000, argv));
|
||||
#endif
|
||||
return (gensym(str));
|
||||
}
|
||||
else return (gensym("empty"));
|
||||
|
@ -261,6 +278,10 @@ void iemgui_all_sym2dollararg(t_iemgui *iemgui, t_symbol **srlsym)
|
|||
|
||||
void iemgui_first_dollararg2sym(t_iemgui *iemgui, t_symbol **srlsym)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
(void) iemgui;
|
||||
(void) srlsym;
|
||||
#endif
|
||||
/* delete this function */
|
||||
}
|
||||
|
||||
|
@ -341,8 +362,12 @@ void iemgui_all_raute2dollar(t_symbol **srlsym)
|
|||
void iemgui_send(void *x, t_iemgui *iemgui, t_symbol *s)
|
||||
{
|
||||
t_symbol *snd;
|
||||
#ifdef ROCKBOX
|
||||
int sndable=1, oldsndrcvable=0;
|
||||
#else
|
||||
int pargc, tail_len, nth_arg, sndable=1, oldsndrcvable=0;
|
||||
t_atom *pargv;
|
||||
#endif
|
||||
|
||||
if(iemgui->x_fsf.x_rcv_able)
|
||||
oldsndrcvable += IEM_GUI_OLD_RCV_FLAG;
|
||||
|
@ -364,8 +389,12 @@ void iemgui_send(void *x, t_iemgui *iemgui, t_symbol *s)
|
|||
void iemgui_receive(void *x, t_iemgui *iemgui, t_symbol *s)
|
||||
{
|
||||
t_symbol *rcv;
|
||||
#ifdef ROCKBOX
|
||||
int rcvable=1, oldsndrcvable=0;
|
||||
#else
|
||||
int pargc, tail_len, nth_arg, rcvable=1, oldsndrcvable=0;
|
||||
t_atom *pargv;
|
||||
#endif
|
||||
|
||||
if(iemgui->x_fsf.x_rcv_able)
|
||||
oldsndrcvable += IEM_GUI_OLD_RCV_FLAG;
|
||||
|
@ -399,34 +428,55 @@ void iemgui_receive(void *x, t_iemgui *iemgui, t_symbol *s)
|
|||
void iemgui_label(void *x, t_iemgui *iemgui, t_symbol *s)
|
||||
{
|
||||
t_symbol *lab;
|
||||
#ifndef ROCKBOX
|
||||
int pargc, tail_len, nth_arg;
|
||||
t_atom *pargv;
|
||||
#endif
|
||||
|
||||
#ifdef ROCKBOX
|
||||
(void) x;
|
||||
#endif
|
||||
|
||||
lab = iemgui_raute2dollar(s);
|
||||
iemgui->x_lab_unexpanded = lab;
|
||||
iemgui->x_lab = lab = canvas_realizedollar(iemgui->x_glist, lab);
|
||||
|
||||
#ifndef ROCKBOX
|
||||
if(glist_isvisible(iemgui->x_glist))
|
||||
sys_vgui(".x%x.c itemconfigure %xLABEL -text {%s} \n",
|
||||
glist_getcanvas(iemgui->x_glist), x,
|
||||
strcmp(s->s_name, "empty")?iemgui->x_lab->s_name:"");
|
||||
#endif
|
||||
}
|
||||
|
||||
void iemgui_label_pos(void *x, t_iemgui *iemgui, t_symbol *s, int ac, t_atom *av)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
(void) x;
|
||||
(void) s;
|
||||
#endif
|
||||
|
||||
iemgui->x_ldx = (int)atom_getintarg(0, ac, av);
|
||||
iemgui->x_ldy = (int)atom_getintarg(1, ac, av);
|
||||
|
||||
#ifndef ROCKBOX
|
||||
if(glist_isvisible(iemgui->x_glist))
|
||||
sys_vgui(".x%x.c coords %xLABEL %d %d\n",
|
||||
glist_getcanvas(iemgui->x_glist), x,
|
||||
iemgui->x_obj.te_xpix+iemgui->x_ldx,
|
||||
iemgui->x_obj.te_ypix+iemgui->x_ldy);
|
||||
#endif
|
||||
}
|
||||
|
||||
void iemgui_label_font(void *x, t_iemgui *iemgui, t_symbol *s, int ac, t_atom *av)
|
||||
{
|
||||
int f = (int)atom_getintarg(0, ac, av);
|
||||
|
||||
#ifdef ROCKBOX
|
||||
(void) x;
|
||||
(void) s;
|
||||
#endif
|
||||
|
||||
if(f == 1) strcpy(iemgui->x_font, "helvetica");
|
||||
else if(f == 2) strcpy(iemgui->x_font, "times");
|
||||
else
|
||||
|
@ -439,9 +489,11 @@ void iemgui_label_font(void *x, t_iemgui *iemgui, t_symbol *s, int ac, t_atom *a
|
|||
if(f < 4)
|
||||
f = 4;
|
||||
iemgui->x_fontsize = f;
|
||||
#ifndef ROCKBOX
|
||||
if(glist_isvisible(iemgui->x_glist))
|
||||
sys_vgui(".x%x.c itemconfigure %xLABEL -font {%s %d bold}\n",
|
||||
glist_getcanvas(iemgui->x_glist), x, iemgui->x_font, iemgui->x_fontsize);
|
||||
#endif
|
||||
}
|
||||
|
||||
void iemgui_size(void *x, t_iemgui *iemgui)
|
||||
|
@ -455,6 +507,9 @@ void iemgui_size(void *x, t_iemgui *iemgui)
|
|||
|
||||
void iemgui_delta(void *x, t_iemgui *iemgui, t_symbol *s, int ac, t_atom *av)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
(void) s;
|
||||
#endif
|
||||
iemgui->x_obj.te_xpix += (int)atom_getintarg(0, ac, av);
|
||||
iemgui->x_obj.te_ypix += (int)atom_getintarg(1, ac, av);
|
||||
if(glist_isvisible(iemgui->x_glist))
|
||||
|
@ -466,6 +521,9 @@ void iemgui_delta(void *x, t_iemgui *iemgui, t_symbol *s, int ac, t_atom *av)
|
|||
|
||||
void iemgui_pos(void *x, t_iemgui *iemgui, t_symbol *s, int ac, t_atom *av)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
(void) s;
|
||||
#endif
|
||||
iemgui->x_obj.te_xpix = (int)atom_getintarg(0, ac, av);
|
||||
iemgui->x_obj.te_ypix = (int)atom_getintarg(1, ac, av);
|
||||
if(glist_isvisible(iemgui->x_glist))
|
||||
|
@ -477,6 +535,9 @@ void iemgui_pos(void *x, t_iemgui *iemgui, t_symbol *s, int ac, t_atom *av)
|
|||
|
||||
void iemgui_color(void *x, t_iemgui *iemgui, t_symbol *s, int ac, t_atom *av)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
(void) s;
|
||||
#endif
|
||||
iemgui->x_bcol = iemgui_compatible_col(atom_getintarg(0, ac, av));
|
||||
if(ac > 2)
|
||||
{
|
||||
|
@ -561,21 +622,36 @@ int iemgui_dialog(t_iemgui *iemgui, t_symbol **srl, int argc, t_atom *argv)
|
|||
srl[0] = atom_getsymbolarg(7, argc, argv);
|
||||
else if(IS_A_FLOAT(argv,7))
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
snprintf(str, sizeof(str)-1,
|
||||
"%d", (int)atom_getintarg(7, argc, argv));
|
||||
#else
|
||||
sprintf(str, "%d", (int)atom_getintarg(7, argc, argv));
|
||||
#endif
|
||||
srl[0] = gensym(str);
|
||||
}
|
||||
if(IS_A_SYMBOL(argv,8))
|
||||
srl[1] = atom_getsymbolarg(8, argc, argv);
|
||||
else if(IS_A_FLOAT(argv,8))
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
snprintf(str, sizeof(str)-1,
|
||||
"%d", (int)atom_getintarg(8, argc, argv));
|
||||
#else
|
||||
sprintf(str, "%d", (int)atom_getintarg(8, argc, argv));
|
||||
#endif
|
||||
srl[1] = gensym(str);
|
||||
}
|
||||
if(IS_A_SYMBOL(argv,9))
|
||||
srl[2] = atom_getsymbolarg(9, argc, argv);
|
||||
else if(IS_A_FLOAT(argv,9))
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
snprintf(str, sizeof(str)-1,
|
||||
"%d", (int)atom_getintarg(9, argc, argv));
|
||||
#else
|
||||
sprintf(str, "%d", (int)atom_getintarg(9, argc, argv));
|
||||
#endif
|
||||
srl[2] = gensym(str);
|
||||
}
|
||||
if(init != 0) init = 1;
|
||||
|
|
|
@ -2,12 +2,22 @@
|
|||
* For information on usage and redistribution, and for a DISCLAIMER OF ALL
|
||||
* WARRANTIES, see the file, "LICENSE.txt," in this distribution. */
|
||||
|
||||
#ifdef ROCKBOX
|
||||
#include "plugin.h"
|
||||
#include "pdbox.h"
|
||||
#include "m_pd.h"
|
||||
#include "g_canvas.h"
|
||||
#ifdef SIMULATOR
|
||||
int printf(const char *fmt, ...);
|
||||
#endif /* SIMULATOR */
|
||||
#else /* ROCKBOX */
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h> /* for read/write to files */
|
||||
#include "m_pd.h"
|
||||
#include "g_canvas.h"
|
||||
#include <math.h>
|
||||
#endif /* ROCKBOX */
|
||||
|
||||
/* see also the "plot" object in g_scalar.c which deals with graphing
|
||||
arrays which are fields in scalars. Someday we should unify the
|
||||
|
@ -40,7 +50,9 @@ t_array *array_new(t_symbol *templatesym, t_gpointer *parent)
|
|||
{
|
||||
t_array *x = (t_array *)getbytes(sizeof (*x));
|
||||
t_template *template;
|
||||
#ifndef ROCKBOX
|
||||
t_gpointer *gp;
|
||||
#endif
|
||||
template = template_findbyname(templatesym);
|
||||
x->a_templatesym = templatesym;
|
||||
x->a_n = 1;
|
||||
|
@ -59,7 +71,9 @@ t_array *array_new(t_symbol *templatesym, t_gpointer *parent)
|
|||
void array_resize(t_array *x, t_template *template, int n)
|
||||
{
|
||||
int elemsize, oldn;
|
||||
#ifndef ROCKBOX
|
||||
t_gpointer *gp;
|
||||
#endif
|
||||
|
||||
if (n < 1)
|
||||
n = 1;
|
||||
|
@ -135,7 +149,11 @@ t_garray *graph_array(t_glist *gl, t_symbol *s, t_symbol *templatesym,
|
|||
if (s == &s_)
|
||||
{
|
||||
char buf[40];
|
||||
#ifdef ROCKBOX
|
||||
snprintf(buf, sizeof(buf)-1, "array%d", ++gcount);
|
||||
#else
|
||||
sprintf(buf, "array%d", ++gcount);
|
||||
#endif
|
||||
s = gensym(buf);
|
||||
templatesym = &s_float;
|
||||
n = 100;
|
||||
|
@ -179,7 +197,7 @@ t_garray *graph_array(t_glist *gl, t_symbol *s, t_symbol *templatesym,
|
|||
x->x_glist = gl;
|
||||
x->x_usedindsp = 0;
|
||||
x->x_saveit = (saveit != 0);
|
||||
if (x2 = pd_findbyclass(gensym("#A"), garray_class))
|
||||
if((x2 = pd_findbyclass(gensym("#A"), garray_class)))
|
||||
pd_unbind(x2, gensym("#A"));
|
||||
|
||||
pd_bind(&x->x_gobj.g_pd, gensym("#A"));
|
||||
|
@ -190,16 +208,23 @@ t_garray *graph_array(t_glist *gl, t_symbol *s, t_symbol *templatesym,
|
|||
/* called from array menu item to create a new one */
|
||||
void canvas_menuarray(t_glist *canvas)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
(void) canvas;
|
||||
#else /* ROCKBOX */
|
||||
t_glist *x = (t_glist *)canvas;
|
||||
char cmdbuf[200];
|
||||
sprintf(cmdbuf, "pdtk_array_dialog %%s array%d 100 1 1\n",
|
||||
++gcount);
|
||||
gfxstub_new(&x->gl_pd, x, cmdbuf);
|
||||
#endif /* ROCKBOX */
|
||||
}
|
||||
|
||||
/* called from graph_dialog to set properties */
|
||||
void garray_properties(t_garray *x)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
(void) x;
|
||||
#else /* ROCKBOX */
|
||||
char cmdbuf[200];
|
||||
gfxstub_deleteforkey(x);
|
||||
/* create dialog window. LATER fix this to escape '$'
|
||||
|
@ -211,6 +236,7 @@ void garray_properties(t_garray *x)
|
|||
else sprintf(cmdbuf, "pdtk_array_dialog %%s %s %d %d 0\n",
|
||||
x->x_name->s_name, x->x_n, x->x_saveit);
|
||||
gfxstub_new(&x->x_gobj.g_pd, x, cmdbuf);
|
||||
#endif /* ROCKBOX */
|
||||
}
|
||||
|
||||
/* this is called back from the dialog window to create a garray.
|
||||
|
@ -260,10 +286,12 @@ void garray_arraydialog(t_garray *x, t_symbol *name, t_floatarg fsize,
|
|||
static void garray_free(t_garray *x)
|
||||
{
|
||||
t_pd *x2;
|
||||
#ifndef ROCKBOX
|
||||
gfxstub_deleteforkey(x);
|
||||
#endif
|
||||
pd_unbind(&x->x_gobj.g_pd, x->x_realname);
|
||||
/* LATER find a way to get #A unbound earlier (at end of load?) */
|
||||
while (x2 = pd_findbyclass(gensym("#A"), garray_class))
|
||||
while((x2 = pd_findbyclass(gensym("#A"), garray_class)))
|
||||
pd_unbind(x2, gensym("#A"));
|
||||
freebytes(x->x_vec, x->x_n * x->x_elemsize);
|
||||
}
|
||||
|
@ -308,7 +336,9 @@ static t_word *array_motion_wp;
|
|||
static t_template *array_motion_template;
|
||||
static int array_motion_npoints;
|
||||
static int array_motion_elemsize;
|
||||
#ifndef ROCKBOX
|
||||
static int array_motion_altkey;
|
||||
#endif
|
||||
static float array_motion_initx;
|
||||
static float array_motion_xperpix;
|
||||
static float array_motion_yperpix;
|
||||
|
@ -320,6 +350,9 @@ static int array_motion_fatten;
|
|||
|
||||
static void array_motion(void *z, t_floatarg dx, t_floatarg dy)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
(void) z;
|
||||
#endif
|
||||
array_motion_xcumulative += dx * array_motion_xperpix;
|
||||
array_motion_ycumulative += dy * array_motion_yperpix;
|
||||
if (*array_motion_xfield->s_name)
|
||||
|
@ -402,6 +435,12 @@ int array_doclick(t_array *array, t_glist *glist, t_gobj *gobj,
|
|||
t_template *elemtemplate;
|
||||
int elemsize, yonset, wonset, xonset, i;
|
||||
|
||||
#ifdef ROCKBOX
|
||||
(void) linewidth;
|
||||
(void) shift;
|
||||
(void) dbl;
|
||||
#endif
|
||||
|
||||
if (!array_getfields(elemtemplatesym, &elemtemplatecanvas,
|
||||
&elemtemplate, &elemsize, &xonset, &yonset, &wonset))
|
||||
{
|
||||
|
@ -575,7 +614,11 @@ static void garray_getrect(t_gobj *z, t_glist *glist,
|
|||
else incr = x->x_array.a_n / 300;
|
||||
for (i = 0; i < x->x_array.a_n; i += incr)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
float pxpix, pypix, pwpix;
|
||||
#else /* ROCKBOX */
|
||||
float pxpix, pypix, pwpix, dx, dy;
|
||||
#endif /* ROCKBOX */
|
||||
array_getcoordinate(glist, (char *)(x->x_array.a_vec) +
|
||||
i * elemsize,
|
||||
xonset, yonset, wonset, i, 0, 0, 1,
|
||||
|
@ -600,21 +643,42 @@ static void garray_getrect(t_gobj *z, t_glist *glist,
|
|||
|
||||
static void garray_displace(t_gobj *z, t_glist *glist, int dx, int dy)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
(void) z;
|
||||
(void) glist;
|
||||
(void) dx;
|
||||
(void) dy;
|
||||
#endif
|
||||
/* refuse */
|
||||
}
|
||||
|
||||
static void garray_select(t_gobj *z, t_glist *glist, int state)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
(void) z;
|
||||
(void) glist;
|
||||
(void) state;
|
||||
#else /* ROCKBOX */
|
||||
t_garray *x = (t_garray *)z;
|
||||
#endif /* ROCKBOX */
|
||||
/* fill in later */
|
||||
}
|
||||
|
||||
static void garray_activate(t_gobj *z, t_glist *glist, int state)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
(void) z;
|
||||
(void) glist;
|
||||
(void) state;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void garray_delete(t_gobj *z, t_glist *glist)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
(void) z;
|
||||
(void) glist;
|
||||
#endif
|
||||
/* nothing to do */
|
||||
}
|
||||
|
||||
|
@ -633,9 +697,11 @@ static void garray_vis(t_gobj *z, t_glist *glist, int vis)
|
|||
{
|
||||
error("%s: needs floating-point 'y' field",
|
||||
x->x_templatesym->s_name);
|
||||
#ifndef ROCKBOX
|
||||
sys_vgui(".x%x.c create text 50 50 -text foo\
|
||||
-tags .x%x.a%x\n",
|
||||
glist_getcanvas(glist), glist_getcanvas(glist), x);
|
||||
#endif
|
||||
}
|
||||
else if (!template_find_field(template, gensym("x"), &xonset, &type,
|
||||
&arraytype) || type != DT_FLOAT)
|
||||
|
@ -644,7 +710,9 @@ static void garray_vis(t_gobj *z, t_glist *glist, int vis)
|
|||
int lastpixel = -1, ndrawn = 0;
|
||||
float yval = 0, xpix;
|
||||
int ixpix = 0;
|
||||
#ifndef ROCKBOX
|
||||
sys_vgui(".x%x.c create line \\\n", glist_getcanvas(glist));
|
||||
#endif
|
||||
for (i = 0; i < x->x_n; i++)
|
||||
{
|
||||
yval = fixtof(*(t_sample *)(x->x_vec +
|
||||
|
@ -653,8 +721,10 @@ static void garray_vis(t_gobj *z, t_glist *glist, int vis)
|
|||
ixpix = xpix + 0.5;
|
||||
if (ixpix != lastpixel)
|
||||
{
|
||||
#ifndef ROCKBOX
|
||||
sys_vgui("%d %f \\\n", ixpix,
|
||||
glist_ytopixels(glist, yval));
|
||||
#endif
|
||||
ndrawn++;
|
||||
}
|
||||
lastpixel = ixpix;
|
||||
|
@ -662,11 +732,14 @@ static void garray_vis(t_gobj *z, t_glist *glist, int vis)
|
|||
xcum += x->x_xinc;
|
||||
}
|
||||
/* TK will complain if there aren't at least 2 points... */
|
||||
#ifndef ROCKBOX
|
||||
if (ndrawn == 0) sys_vgui("0 0 0 0 \\\n");
|
||||
else if (ndrawn == 1) sys_vgui("%d %f \\\n", ixpix,
|
||||
glist_ytopixels(glist, yval));
|
||||
sys_vgui("-tags .x%x.a%x\n", glist_getcanvas(glist), x);
|
||||
#endif
|
||||
firsty = fixtof(*(t_sample *)(x->x_vec + yonset));
|
||||
#ifndef ROCKBOX
|
||||
sys_vgui(".x%x.c create text %f %f -text {%s} -anchor e\
|
||||
-font -*-courier-bold--normal--%d-* -tags .x%x.a%x\n",
|
||||
glist_getcanvas(glist),
|
||||
|
@ -674,6 +747,7 @@ static void garray_vis(t_gobj *z, t_glist *glist, int vis)
|
|||
glist_ytopixels(glist, firsty),
|
||||
x->x_name->s_name, glist_getfont(glist),
|
||||
glist_getcanvas(glist), x);
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -682,8 +756,10 @@ static void garray_vis(t_gobj *z, t_glist *glist, int vis)
|
|||
}
|
||||
else
|
||||
{
|
||||
#ifndef ROCKBOX
|
||||
sys_vgui(".x%x.c delete .x%x.a%x\n",
|
||||
glist_getcanvas(glist), glist_getcanvas(glist), x);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -702,7 +778,13 @@ static void garray_save(t_gobj *z, t_binbuf *b)
|
|||
t_garray *x = (t_garray *)z;
|
||||
binbuf_addv(b, "sssisi;", gensym("#X"), gensym("array"),
|
||||
x->x_name, x->x_n, x->x_templatesym, x->x_saveit);
|
||||
#ifdef ROCKBOX
|
||||
#ifdef SIMULATOR
|
||||
printf("array save\n");
|
||||
#endif /* SIMULATOR */
|
||||
#else /* ROCKBOX */
|
||||
fprintf(stderr,"array save\n");
|
||||
#endif /* ROCKBOX */
|
||||
if (x->x_saveit)
|
||||
{
|
||||
int n = x->x_n, n2 = 0;
|
||||
|
@ -877,7 +959,11 @@ static void garray_dofo(t_garray *x, int npoints, float dcval,
|
|||
|
||||
static void garray_sinesum(t_garray *x, t_symbol *s, int argc, t_atom *argv)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
(void) s;
|
||||
#else
|
||||
t_template *template = garray_template(x);
|
||||
#endif
|
||||
|
||||
t_float *svec = (t_float *)t_getbytes(sizeof(t_float) * argc);
|
||||
int npoints, i;
|
||||
|
@ -902,7 +988,11 @@ static void garray_sinesum(t_garray *x, t_symbol *s, int argc, t_atom *argv)
|
|||
|
||||
static void garray_cosinesum(t_garray *x, t_symbol *s, int argc, t_atom *argv)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
(void) s;
|
||||
#else
|
||||
t_template *template = garray_template(x);
|
||||
#endif
|
||||
|
||||
t_float *svec = (t_float *)t_getbytes(sizeof(t_float) * argc);
|
||||
int npoints, i;
|
||||
|
@ -928,7 +1018,11 @@ static void garray_cosinesum(t_garray *x, t_symbol *s, int argc, t_atom *argv)
|
|||
static void garray_normalize(t_garray *x, t_float f)
|
||||
{
|
||||
t_template *template = garray_template(x);
|
||||
#ifdef ROCKBOX
|
||||
int yonset, type, i;
|
||||
#else
|
||||
int yonset, type, npoints, i;
|
||||
#endif
|
||||
double maxv, renormer;
|
||||
t_symbol *arraytype;
|
||||
|
||||
|
@ -968,6 +1062,9 @@ static void garray_list(t_garray *x, t_symbol *s, int argc, t_atom *argv)
|
|||
t_template *template = garray_template(x);
|
||||
int yonset, type, i;
|
||||
t_symbol *arraytype;
|
||||
#ifdef ROCKBOX
|
||||
(void) s;
|
||||
#endif
|
||||
if (!template_find_field(template, gensym("y"), &yonset,
|
||||
&type, &arraytype) || type != DT_FLOAT)
|
||||
error("%s: needs floating-point 'y' field",
|
||||
|
@ -1038,7 +1135,11 @@ static void garray_rename(t_garray *x, t_symbol *s)
|
|||
static void garray_read(t_garray *x, t_symbol *filename)
|
||||
{
|
||||
int nelem = x->x_n, filedesc;
|
||||
#ifdef ROCKBOX
|
||||
int fd = 0;
|
||||
#else
|
||||
FILE *fd;
|
||||
#endif
|
||||
char buf[MAXPDSTRING], *bufptr;
|
||||
t_template *template = garray_template(x);
|
||||
int yonset, type, i;
|
||||
|
@ -1052,15 +1153,23 @@ static void garray_read(t_garray *x, t_symbol *filename)
|
|||
if ((filedesc = open_via_path(
|
||||
canvas_getdir(glist_getcanvas(x->x_glist))->s_name,
|
||||
filename->s_name, "", buf, &bufptr, MAXPDSTRING, 0)) < 0
|
||||
#ifdef ROCKBOX
|
||||
)
|
||||
#else
|
||||
|| !(fd = fdopen(filedesc, "r")))
|
||||
#endif
|
||||
{
|
||||
error("%s: can't open", filename->s_name);
|
||||
return;
|
||||
}
|
||||
for (i = 0; i < nelem; i++)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
if(rb_fscanf_f(fd, (float*)((x->x_vec + sizeof(t_word) * i) + yonset)))
|
||||
#else
|
||||
if (!fscanf(fd, "%f", (float *)((x->x_vec + sizeof(t_word) * i) +
|
||||
yonset)))
|
||||
#endif
|
||||
{
|
||||
post("%s: read %d elements into table of size %d",
|
||||
filename->s_name, i, nelem);
|
||||
|
@ -1069,7 +1178,11 @@ static void garray_read(t_garray *x, t_symbol *filename)
|
|||
}
|
||||
while (i < nelem)
|
||||
*(float *)((x->x_vec + sizeof(t_word) * i) + yonset) = 0, i++;
|
||||
#ifdef ROCKBOX
|
||||
close(fd);
|
||||
#else
|
||||
fclose(fd);
|
||||
#endif
|
||||
garray_redraw(x);
|
||||
}
|
||||
|
||||
|
@ -1090,7 +1203,11 @@ static void garray_read16(t_garray *x, t_symbol *filename,
|
|||
int skip = fskip, filedesc;
|
||||
int i, nelem;
|
||||
t_sample *vec;
|
||||
#ifdef ROCKBOX
|
||||
int fd = 0;
|
||||
#else
|
||||
FILE *fd;
|
||||
#endif
|
||||
char buf[MAXPDSTRING], *bufptr;
|
||||
short s;
|
||||
int cpubig = garray_ambigendian(), swap = 0;
|
||||
|
@ -1116,25 +1233,41 @@ static void garray_read16(t_garray *x, t_symbol *filename,
|
|||
if ((filedesc = open_via_path(
|
||||
canvas_getdir(glist_getcanvas(x->x_glist))->s_name,
|
||||
filename->s_name, "", buf, &bufptr, MAXPDSTRING, 1)) < 0
|
||||
#ifdef ROCKBOX
|
||||
)
|
||||
#else
|
||||
|| !(fd = fdopen(filedesc, BINREADMODE)))
|
||||
#endif
|
||||
{
|
||||
error("%s: can't open", filename->s_name);
|
||||
return;
|
||||
}
|
||||
if (skip)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
long pos = lseek(fd, (long)skip, SEEK_SET);
|
||||
#else
|
||||
long pos = fseek(fd, (long)skip, SEEK_SET);
|
||||
#endif
|
||||
if (pos < 0)
|
||||
{
|
||||
error("%s: can't seek to byte %d", buf, skip);
|
||||
#ifdef ROCKBOX
|
||||
close(fd);
|
||||
#else
|
||||
fclose(fd);
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
for (i = 0; i < nelem; i++)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
if(read(fd, &s, sizeof(s)) < 1)
|
||||
#else
|
||||
if (fread(&s, sizeof(s), 1, fd) < 1)
|
||||
#endif
|
||||
{
|
||||
post("%s: read %d elements into table of size %d",
|
||||
filename->s_name, i, nelem);
|
||||
|
@ -1144,13 +1277,21 @@ static void garray_read16(t_garray *x, t_symbol *filename,
|
|||
vec[i] = s * (1./32768.);
|
||||
}
|
||||
while (i < nelem) vec[i++] = 0;
|
||||
#ifdef ROCKBOX
|
||||
close(fd);
|
||||
#else
|
||||
fclose(fd);
|
||||
#endif
|
||||
garray_redraw(x);
|
||||
}
|
||||
|
||||
static void garray_write(t_garray *x, t_symbol *filename)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
int fd;
|
||||
#else
|
||||
FILE *fd;
|
||||
#endif
|
||||
char buf[MAXPDSTRING];
|
||||
t_template *template = garray_template(x);
|
||||
int yonset, type, i;
|
||||
|
@ -1164,21 +1305,33 @@ static void garray_write(t_garray *x, t_symbol *filename)
|
|||
canvas_makefilename(glist_getcanvas(x->x_glist), filename->s_name,
|
||||
buf, MAXPDSTRING);
|
||||
sys_bashfilename(buf, buf);
|
||||
#ifdef ROCKBOX
|
||||
if(!(fd = open(buf, O_WRONLY|O_CREAT|O_TRUNC)))
|
||||
#else
|
||||
if (!(fd = fopen(buf, "w")))
|
||||
#endif
|
||||
{
|
||||
error("%s: can't create", buf);
|
||||
return;
|
||||
}
|
||||
for (i = 0; i < x->x_n; i++)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
if(rb_fprintf_f(fd,
|
||||
#else /* ROCKBOX */
|
||||
if (fprintf(fd, "%g\n",
|
||||
#endif /* ROCKBOX */
|
||||
*(float *)((x->x_vec + sizeof(t_word) * i) + yonset)) < 1)
|
||||
{
|
||||
post("%s: write error", filename->s_name);
|
||||
break;
|
||||
}
|
||||
}
|
||||
#ifdef ROCKBOX
|
||||
close(fd);
|
||||
#else
|
||||
fclose(fd);
|
||||
#endif
|
||||
}
|
||||
|
||||
static unsigned char waveheader[] = {
|
||||
|
@ -1203,7 +1356,11 @@ static void garray_write16(t_garray *x, t_symbol *filename, t_symbol *format)
|
|||
t_template *template = garray_template(x);
|
||||
int yonset, type, i;
|
||||
t_symbol *arraytype;
|
||||
#ifdef ROCKBOX
|
||||
int fd;
|
||||
#else
|
||||
FILE *fd;
|
||||
#endif
|
||||
int aiff = (format == gensym("aiff"));
|
||||
char filenamebuf[MAXPDSTRING], buf2[MAXPDSTRING];
|
||||
int swap = garray_ambigendian(); /* wave is only little endian */
|
||||
|
@ -1230,7 +1387,11 @@ static void garray_write16(t_garray *x, t_symbol *filename, t_symbol *format)
|
|||
canvas_makefilename(glist_getcanvas(x->x_glist), filenamebuf,
|
||||
buf2, MAXPDSTRING);
|
||||
sys_bashfilename(buf2, buf2);
|
||||
#ifdef ROCKBOX
|
||||
if(!(fd = open(buf2, O_WRONLY|O_CREAT|O_TRUNC)))
|
||||
#else
|
||||
if (!(fd = fopen(buf2, BINWRITEMODE)))
|
||||
#endif
|
||||
{
|
||||
error("%s: can't create", buf2);
|
||||
return;
|
||||
|
@ -1251,7 +1412,11 @@ static void garray_write16(t_garray *x, t_symbol *filename, t_symbol *format)
|
|||
xxx = foo[1]; foo[1] = foo[2]; foo[2] = xxx;
|
||||
}
|
||||
memcpy((void *)(waveheader + 40), (void *)(&intbuf), 4);
|
||||
#ifdef ROCKBOX
|
||||
if(write(fd, waveheader, sizeof(waveheader)) < 1)
|
||||
#else
|
||||
if (fwrite(waveheader, sizeof(waveheader), 1, fd) < 1)
|
||||
#endif
|
||||
{
|
||||
post("%s: write error", buf2);
|
||||
goto closeit;
|
||||
|
@ -1268,21 +1433,31 @@ static void garray_write16(t_garray *x, t_symbol *filename, t_symbol *format)
|
|||
unsigned char *foo = (unsigned char *)&sh, xxx;
|
||||
xxx = foo[0]; foo[0] = foo[1]; foo[1] = xxx;
|
||||
}
|
||||
#ifdef ROCKBOX
|
||||
if(write(fd, &sh, sizeof(sh)) < 1)
|
||||
#else
|
||||
if (fwrite(&sh, sizeof(sh), 1, fd) < 1)
|
||||
#endif
|
||||
{
|
||||
post("%s: write error", buf2);
|
||||
goto closeit;
|
||||
}
|
||||
}
|
||||
closeit:
|
||||
#ifdef ROCKBOX
|
||||
close(fd);
|
||||
#else
|
||||
fclose(fd);
|
||||
#endif
|
||||
}
|
||||
|
||||
void garray_resize(t_garray *x, t_floatarg f)
|
||||
{
|
||||
int was = x->x_n, elemsize;
|
||||
t_glist *gl;
|
||||
#ifndef ROCKBOX
|
||||
int dspwas;
|
||||
#endif
|
||||
int n = f;
|
||||
char *nvec;
|
||||
|
||||
|
@ -1309,7 +1484,9 @@ void garray_resize(t_garray *x, t_floatarg f)
|
|||
vmess(&gl->gl_pd, gensym("bounds"), "ffff",
|
||||
0., gl->gl_y1, (double)(n > 1 ? n-1 : 1), gl->gl_y2);
|
||||
/* close any dialogs that might have the wrong info now... */
|
||||
#ifndef ROCKBOX
|
||||
gfxstub_deleteforkey(gl);
|
||||
#endif
|
||||
}
|
||||
else garray_redraw(x);
|
||||
if (x->x_usedindsp) canvas_update_dsp();
|
||||
|
|
|
@ -5,7 +5,13 @@
|
|||
/* g_7_guis.c written by Thomas Musil (c) IEM KUG Graz Austria 2000-2001 */
|
||||
/* thanks to Miller Puckette, Guenther Geiger and Krzystof Czaja */
|
||||
|
||||
|
||||
#ifdef ROCKBOX
|
||||
#include "plugin.h"
|
||||
#include "pdbox.h"
|
||||
#include "m_pd.h"
|
||||
#include "g_canvas.h"
|
||||
#include "g_all_guis.h"
|
||||
#else /* ROCKBOX */
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
|
@ -21,6 +27,7 @@
|
|||
#else
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
#endif /* ROCKBOX */
|
||||
|
||||
|
||||
/* --------------- bng gui-bang ------------------------- */
|
||||
|
@ -33,15 +40,24 @@ static t_class *bng_class;
|
|||
|
||||
void bng_draw_update(t_bng *x, t_glist *glist)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
(void) x;
|
||||
(void) glist;
|
||||
#else /* ROCKBOX */
|
||||
if(glist_isvisible(glist))
|
||||
{
|
||||
sys_vgui(".x%x.c itemconfigure %xBUT -fill #%6.6x\n", glist_getcanvas(glist), x,
|
||||
x->x_flashed?x->x_gui.x_fcol:x->x_gui.x_bcol);
|
||||
}
|
||||
#endif /* ROCKBOX */
|
||||
}
|
||||
|
||||
void bng_draw_new(t_bng *x, t_glist *glist)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
(void) x;
|
||||
(void) glist;
|
||||
#else /* ROCKBOX */
|
||||
int xpos=text_xpix(&x->x_gui.x_obj, glist);
|
||||
int ypos=text_ypix(&x->x_gui.x_obj, glist);
|
||||
t_canvas *canvas=glist_getcanvas(glist);
|
||||
|
@ -69,10 +85,15 @@ void bng_draw_new(t_bng *x, t_glist *glist)
|
|||
sys_vgui(".x%x.c create rectangle %d %d %d %d -tags %xIN%d\n",
|
||||
canvas, xpos, ypos,
|
||||
xpos + IOWIDTH, ypos+1, x, 0);
|
||||
#endif /* ROCKBOX */
|
||||
}
|
||||
|
||||
void bng_draw_move(t_bng *x, t_glist *glist)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
(void) x;
|
||||
(void) glist;
|
||||
#else /* ROCKBOX */
|
||||
int xpos=text_xpix(&x->x_gui.x_obj, glist);
|
||||
int ypos=text_ypix(&x->x_gui.x_obj, glist);
|
||||
t_canvas *canvas=glist_getcanvas(glist);
|
||||
|
@ -96,10 +117,15 @@ void bng_draw_move(t_bng *x, t_glist *glist)
|
|||
sys_vgui(".x%x.c coords %xIN%d %d %d %d %d\n",
|
||||
canvas, x, 0, xpos, ypos,
|
||||
xpos + IOWIDTH, ypos+1);
|
||||
#endif /* ROCKBOX */
|
||||
}
|
||||
|
||||
void bng_draw_erase(t_bng* x, t_glist* glist)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
(void) x;
|
||||
(void) glist;
|
||||
#else /* ROCKBOX */
|
||||
t_canvas *canvas=glist_getcanvas(glist);
|
||||
|
||||
sys_vgui(".x%x.c delete %xBASE\n", canvas, x);
|
||||
|
@ -109,10 +135,15 @@ void bng_draw_erase(t_bng* x, t_glist* glist)
|
|||
sys_vgui(".x%x.c delete %xOUT%d\n", canvas, x, 0);
|
||||
if(!x->x_gui.x_fsf.x_rcv_able)
|
||||
sys_vgui(".x%x.c delete %xIN%d\n", canvas, x, 0);
|
||||
#endif /* ROCKBOX */
|
||||
}
|
||||
|
||||
void bng_draw_config(t_bng* x, t_glist* glist)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
(void) x;
|
||||
(void) glist;
|
||||
#else /* ROCKBOX */
|
||||
t_canvas *canvas=glist_getcanvas(glist);
|
||||
|
||||
sys_vgui(".x%x.c itemconfigure %xLABEL -font {%s %d bold} -fill #%6.6x -text {%s} \n",
|
||||
|
@ -122,10 +153,16 @@ void bng_draw_config(t_bng* x, t_glist* glist)
|
|||
sys_vgui(".x%x.c itemconfigure %xBASE -fill #%6.6x\n", canvas, x, x->x_gui.x_bcol);
|
||||
sys_vgui(".x%x.c itemconfigure %xBUT -fill #%6.6x\n", canvas, x,
|
||||
x->x_flashed?x->x_gui.x_fcol:x->x_gui.x_bcol);
|
||||
#endif /* ROCKBOX */
|
||||
}
|
||||
|
||||
void bng_draw_io(t_bng* x, t_glist* glist, int old_snd_rcv_flags)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
(void) x;
|
||||
(void) glist;
|
||||
(void) old_snd_rcv_flags;
|
||||
#else /* ROCKBOX */
|
||||
int xpos=text_xpix(&x->x_gui.x_obj, glist);
|
||||
int ypos=text_ypix(&x->x_gui.x_obj, glist);
|
||||
t_canvas *canvas=glist_getcanvas(glist);
|
||||
|
@ -143,10 +180,15 @@ void bng_draw_io(t_bng* x, t_glist* glist, int old_snd_rcv_flags)
|
|||
xpos + IOWIDTH, ypos+1, x, 0);
|
||||
if(!(old_snd_rcv_flags & IEM_GUI_OLD_RCV_FLAG) && x->x_gui.x_fsf.x_rcv_able)
|
||||
sys_vgui(".x%x.c delete %xIN%d\n", canvas, x, 0);
|
||||
#endif /* ROCKBOX */
|
||||
}
|
||||
|
||||
void bng_draw_select(t_bng* x, t_glist* glist)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
(void) x;
|
||||
(void) glist;
|
||||
#else /* ROCKBOX */
|
||||
t_canvas *canvas=glist_getcanvas(glist);
|
||||
|
||||
if(x->x_gui.x_fsf.x_selected)
|
||||
|
@ -161,6 +203,7 @@ void bng_draw_select(t_bng* x, t_glist* glist)
|
|||
sys_vgui(".x%x.c itemconfigure %xBUT -outline #%6.6x\n", canvas, x, IEM_GUI_COLOR_NORMAL);
|
||||
sys_vgui(".x%x.c itemconfigure %xLABEL -fill #%6.6x\n", canvas, x, x->x_gui.x_lcol);
|
||||
}
|
||||
#endif /* ROCKBOX */
|
||||
}
|
||||
|
||||
void bng_draw(t_bng *x, t_glist *glist, int mode)
|
||||
|
@ -232,6 +275,10 @@ void bng_check_minmax(t_bng *x, int ftbreak, int fthold)
|
|||
|
||||
static void bng_properties(t_gobj *z, t_glist *owner)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
(void) z;
|
||||
(void) owner;
|
||||
#else /* ROCKBOX */
|
||||
t_bng *x = (t_bng *)z;
|
||||
char buf[800];
|
||||
t_symbol *srl[3];
|
||||
|
@ -253,6 +300,7 @@ static void bng_properties(t_gobj *z, t_glist *owner)
|
|||
x->x_gui.x_fsf.x_font_style, x->x_gui.x_fontsize,
|
||||
0xffffff & x->x_gui.x_bcol, 0xffffff & x->x_gui.x_fcol, 0xffffff & x->x_gui.x_lcol);
|
||||
gfxstub_new(&x->x_gui.x_obj.ob_pd, x, buf);
|
||||
#endif /* ROCKBOX */
|
||||
}
|
||||
|
||||
static void bng_set(t_bng *x)
|
||||
|
@ -316,6 +364,9 @@ static void bng_bang2(t_bng *x)/*wird immer gesendet, wenn moeglich*/
|
|||
|
||||
static void bng_dialog(t_bng *x, t_symbol *s, int argc, t_atom *argv)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
(void) s;
|
||||
#endif
|
||||
t_symbol *srl[3];
|
||||
int a = (int)atom_getintarg(0, argc, argv);
|
||||
int fthold = (int)atom_getintarg(2, argc, argv);
|
||||
|
@ -333,33 +384,84 @@ static void bng_dialog(t_bng *x, t_symbol *s, int argc, t_atom *argv)
|
|||
|
||||
static void bng_click(t_bng *x, t_floatarg xpos, t_floatarg ypos, t_floatarg shift, t_floatarg ctrl, t_floatarg alt)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
(void) xpos;
|
||||
(void) ypos;
|
||||
(void) shift;
|
||||
(void) ctrl;
|
||||
(void) alt;
|
||||
#endif
|
||||
bng_set(x);
|
||||
bng_bout2(x);
|
||||
}
|
||||
|
||||
static int bng_newclick(t_gobj *z, struct _glist *glist, int xpix, int ypix, int shift, int alt, int dbl, int doit)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
(void) glist;
|
||||
(void) dbl;
|
||||
#endif
|
||||
if(doit)
|
||||
bng_click((t_bng *)z, (t_floatarg)xpix, (t_floatarg)ypix, (t_floatarg)shift, 0, (t_floatarg)alt);
|
||||
return (1);
|
||||
}
|
||||
|
||||
static void bng_float(t_bng *x, t_floatarg f)
|
||||
#ifdef ROCKBOX
|
||||
{
|
||||
(void) f;
|
||||
|
||||
bng_bang2(x);
|
||||
}
|
||||
#else /* ROCKBOX */
|
||||
{bng_bang2(x);}
|
||||
#endif /* ROCKBOX */
|
||||
|
||||
static void bng_symbol(t_bng *x, t_symbol *s)
|
||||
#ifdef ROCKBOX
|
||||
{
|
||||
(void) s;
|
||||
|
||||
bng_bang2(x);
|
||||
}
|
||||
#else /* ROCKBOX */
|
||||
{bng_bang2(x);}
|
||||
#endif /* ROCKBOX */
|
||||
|
||||
static void bng_pointer(t_bng *x, t_gpointer *gp)
|
||||
#ifdef ROCKBOX
|
||||
{
|
||||
(void) gp;
|
||||
|
||||
bng_bang2(x);
|
||||
}
|
||||
#else /* ROCKBOX */
|
||||
{bng_bang2(x);}
|
||||
#endif /* ROCKBOX */
|
||||
|
||||
static void bng_list(t_bng *x, t_symbol *s, int ac, t_atom *av)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
(void) s;
|
||||
(void) ac;
|
||||
(void) av;
|
||||
#endif /* ROCKBOX */
|
||||
|
||||
bng_bang2(x);
|
||||
}
|
||||
|
||||
static void bng_anything(t_bng *x, t_symbol *s, int argc, t_atom *argv)
|
||||
#ifdef ROCKBOX
|
||||
{
|
||||
(void) s;
|
||||
(void) argc;
|
||||
(void) argv;
|
||||
|
||||
bng_bang2(x);
|
||||
}
|
||||
#else /* ROCKBOX */
|
||||
{bng_bang2(x);}
|
||||
#endif /* ROCKBOX */
|
||||
|
||||
static void bng_loadbang(t_bng *x)
|
||||
{
|
||||
|
@ -372,6 +474,9 @@ static void bng_loadbang(t_bng *x)
|
|||
|
||||
static void bng_size(t_bng *x, t_symbol *s, int ac, t_atom *av)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
(void) s;
|
||||
#endif
|
||||
x->x_gui.x_w = iemgui_clip_size((int)atom_getintarg(0, ac, av));
|
||||
x->x_gui.x_h = x->x_gui.x_w;
|
||||
iemgui_size((void *)x, &x->x_gui);
|
||||
|
@ -385,6 +490,9 @@ static void bng_pos(t_bng *x, t_symbol *s, int ac, t_atom *av)
|
|||
|
||||
static void bng_flashtime(t_bng *x, t_symbol *s, int ac, t_atom *av)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
(void) s;
|
||||
#endif
|
||||
bng_check_minmax(x, (int)atom_getintarg(0, ac, av),
|
||||
(int)atom_getintarg(1, ac, av));
|
||||
}
|
||||
|
@ -437,7 +545,11 @@ static void *bng_new(t_symbol *s, int argc, t_atom *argv)
|
|||
int fs=8;
|
||||
int ftbreak=IEM_BNG_DEFAULTBREAKFLASHTIME,
|
||||
fthold=IEM_BNG_DEFAULTHOLDFLASHTIME;
|
||||
#ifdef ROCKBOX
|
||||
(void) s;
|
||||
#else
|
||||
char str[144];
|
||||
#endif
|
||||
|
||||
iem_inttosymargs(&x->x_gui.x_isa, 0);
|
||||
iem_inttofstyle(&x->x_gui.x_fsf, 0);
|
||||
|
@ -511,7 +623,9 @@ static void bng_ff(t_bng *x)
|
|||
clock_free(x->x_clock_lck);
|
||||
clock_free(x->x_clock_brk);
|
||||
clock_free(x->x_clock_hld);
|
||||
#ifndef ROCKBOX
|
||||
gfxstub_deleteforkey(x);
|
||||
#endif
|
||||
}
|
||||
|
||||
void g_bang_setup(void)
|
||||
|
|
|
@ -18,6 +18,15 @@ to be different but are now unified except for some fossilized names.) */
|
|||
* changes marked with IOhannes
|
||||
*/
|
||||
|
||||
#ifdef ROCKBOX
|
||||
#include "plugin.h"
|
||||
#include "pdbox.h"
|
||||
#include "m_pd.h"
|
||||
#include "m_imp.h"
|
||||
#include "s_stuff.h"
|
||||
#include "g_canvas.h"
|
||||
#include "g_all_guis.h"
|
||||
#else /* ROCKBOX */
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include "m_pd.h"
|
||||
|
@ -26,6 +35,7 @@ to be different but are now unified except for some fossilized names.) */
|
|||
#include "g_canvas.h"
|
||||
#include <string.h>
|
||||
#include "g_all_guis.h"
|
||||
#endif /* ROCKBOX */
|
||||
|
||||
struct _canvasenvironment
|
||||
{
|
||||
|
@ -83,7 +93,12 @@ static void glist_doupdatewindowlist(t_glist *gl, char *sbuf)
|
|||
if (strlen(sbuf) + strlen(gl->gl_name->s_name) + 100 <= 1024)
|
||||
{
|
||||
char tbuf[1024];
|
||||
#ifdef ROCKBOX
|
||||
snprintf(tbuf, sizeof(tbuf)-1,
|
||||
"{%s .x%x} ", gl->gl_name->s_name, (t_int)canvas);
|
||||
#else /* ROCKBOX */
|
||||
sprintf(tbuf, "{%s .x%x} ", gl->gl_name->s_name, (t_int)canvas);
|
||||
#endif /* ROCKBOX */
|
||||
strcat(sbuf, tbuf);
|
||||
}
|
||||
}
|
||||
|
@ -107,7 +122,9 @@ void canvas_updatewindowlist( void)
|
|||
glist_doupdatewindowlist(x, sbuf);
|
||||
/* next line updates the window menu state before -postcommand tries it */
|
||||
strcat(sbuf, "}\npdtk_fixwindowmenu\n");
|
||||
#ifndef ROCKBOX
|
||||
sys_gui(sbuf);
|
||||
#endif
|
||||
}
|
||||
|
||||
/* add a glist the list of "root" canvases (toplevels without parents.) */
|
||||
|
@ -144,6 +161,9 @@ void canvas_setargs(int argc, t_atom *argv)
|
|||
|
||||
void glob_setfilename(void *dummy, t_symbol *filesym, t_symbol *dirsym)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
(void) dummy;
|
||||
#endif
|
||||
canvas_newfilename = filesym;
|
||||
canvas_newdirectory = dirsym;
|
||||
}
|
||||
|
@ -286,7 +306,7 @@ t_outconnect *linetraverser_next(t_linetraverser *t)
|
|||
if (!t->tr_ob) y = t->tr_x->gl_list;
|
||||
else y = t->tr_ob->ob_g.g_next;
|
||||
for (; y; y = y->g_next)
|
||||
if (ob = pd_checkobject(&y->g_pd)) break;
|
||||
if((ob = pd_checkobject(&y->g_pd))) break;
|
||||
if (!ob) return (0);
|
||||
t->tr_ob = ob;
|
||||
t->tr_nout = obj_noutlets(ob);
|
||||
|
@ -357,7 +377,13 @@ t_canvas *canvas_new(void *dummy, t_symbol *sel, int argc, t_atom *argv)
|
|||
t_symbol *s = &s_;
|
||||
int vis = 0, width = GLIST_DEFCANVASWIDTH, height = GLIST_DEFCANVASHEIGHT;
|
||||
int xloc = 0, yloc = GLIST_DEFCANVASYLOC;
|
||||
#ifdef ROCKBOX
|
||||
(void) dummy;
|
||||
(void) sel;
|
||||
int font = 10;
|
||||
#else /* ROCKBOX */
|
||||
int font = (owner ? owner->gl_font : sys_defaultfont);
|
||||
#endif /* ROCKBOX */
|
||||
glist_init(x);
|
||||
x->gl_obj.te_type = T_OBJECT;
|
||||
if (!owner)
|
||||
|
@ -415,7 +441,11 @@ t_canvas *canvas_new(void *dummy, t_symbol *sel, int argc, t_atom *argv)
|
|||
x->gl_loading = 1;
|
||||
x->gl_willvis = vis;
|
||||
x->gl_edit = !strncmp(x->gl_name->s_name, "Untitled", 8);
|
||||
#ifdef ROCKBOX
|
||||
x->gl_font = 10;
|
||||
#else /* ROCKBOX */
|
||||
x->gl_font = sys_nearestfontsize(font);
|
||||
#endif /* ROCKBOX */
|
||||
pd_pushsym(&x->gl_pd);
|
||||
return(x);
|
||||
}
|
||||
|
@ -424,6 +454,9 @@ void canvas_setgraph(t_glist *x, int flag);
|
|||
|
||||
static void canvas_coords(t_glist *x, t_symbol *s, int argc, t_atom *argv)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
(void) s;
|
||||
#endif
|
||||
x->gl_x1 = atom_getfloatarg(0, argc, argv);
|
||||
x->gl_y1 = atom_getfloatarg(1, argc, argv);
|
||||
x->gl_x2 = atom_getfloatarg(2, argc, argv);
|
||||
|
@ -449,7 +482,11 @@ t_glist *glist_addglist(t_glist *g, t_symbol *sym,
|
|||
if (!*sym->s_name)
|
||||
{
|
||||
char buf[40];
|
||||
#ifdef ROCKBOX
|
||||
snprintf(buf, sizeof(buf)-1, "graph%d", ++gcount);
|
||||
#else /* ROCKBOX */
|
||||
sprintf(buf, "graph%d", ++gcount);
|
||||
#endif /* ROCKBOX */
|
||||
sym = gensym(buf);
|
||||
menu = 1;
|
||||
}
|
||||
|
@ -484,8 +521,12 @@ t_glist *glist_addglist(t_glist *g, t_symbol *sym,
|
|||
x->gl_obj.te_ypix = py1;
|
||||
x->gl_pixwidth = px2 - px1;
|
||||
x->gl_pixheight = py2 - py1;
|
||||
#ifdef ROCKBOX
|
||||
x->gl_font = 10;
|
||||
#else /* ROCKBOX */
|
||||
x->gl_font = (canvas_getcurrent() ?
|
||||
canvas_getcurrent()->gl_font : sys_defaultfont);
|
||||
#endif /* ROCKBOX */
|
||||
x->gl_screenx1 = x->gl_screeny1 = 0;
|
||||
x->gl_screenx2 = 240;
|
||||
x->gl_screeny2 = 300;
|
||||
|
@ -507,6 +548,9 @@ t_glist *glist_addglist(t_glist *g, t_symbol *sym,
|
|||
/* call glist_addglist from a Pd message */
|
||||
void glist_glist(t_glist *g, t_symbol *s, int argc, t_atom *argv)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
(void) s;
|
||||
#endif
|
||||
t_symbol *sym = atom_getsymbolarg(0, argc, argv);
|
||||
float x1 = atom_getfloatarg(1, argc, argv);
|
||||
float y1 = atom_getfloatarg(2, argc, argv);
|
||||
|
@ -584,9 +628,11 @@ void canvas_reflecttitle(t_canvas *x)
|
|||
strcat(namebuf, ")");
|
||||
}
|
||||
else namebuf[0] = 0;
|
||||
#ifndef ROCKBOX
|
||||
sys_vgui("wm title .x%x {%s%c%s - %s}\n",
|
||||
x, x->gl_name->s_name, (x->gl_dirty? '*' : ' '), namebuf,
|
||||
canvas_getdir(x)->s_name);
|
||||
#endif
|
||||
}
|
||||
|
||||
void canvas_dirty(t_canvas *x, t_int n)
|
||||
|
@ -624,7 +670,9 @@ void canvas_map(t_canvas *x, t_floatarg f)
|
|||
canvas_drawlines(x);
|
||||
/* simulate a mouse up so u_main will calculate scrollbars...
|
||||
ugly! */
|
||||
#ifndef ROCKBOX
|
||||
sys_vgui("pdtk_canvas_mouseup .x%x.c 0 0 0\n", x);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -632,7 +680,9 @@ void canvas_map(t_canvas *x, t_floatarg f)
|
|||
if (glist_isvisible(x))
|
||||
{
|
||||
/* just clear out the whole canvas... */
|
||||
#ifndef ROCKBOX
|
||||
sys_vgui(".x%x.c delete all\n", x);
|
||||
#endif
|
||||
/* alternatively, we could have erased them one by one...
|
||||
for (y = x->gl_list; y; y = y->g_next)
|
||||
gobj_vis(y, x, 0);
|
||||
|
@ -661,7 +711,11 @@ static t_editor *editor_new(t_glist *owner)
|
|||
x->e_connectbuf = binbuf_new();
|
||||
x->e_deleted = binbuf_new();
|
||||
x->e_glist = owner;
|
||||
#ifdef ROCKBOX
|
||||
snprintf(buf, sizeof(buf)-1, ".x%x", (t_int)owner);
|
||||
#else /* ROCKBOX */
|
||||
sprintf(buf, ".x%x", (t_int)owner);
|
||||
#endif /* ROCKBOX */
|
||||
x->e_guiconnect = guiconnect_new(&owner->gl_pd, gensym(buf));
|
||||
return (x);
|
||||
}
|
||||
|
@ -689,7 +743,7 @@ void canvas_create_editor(t_glist *x, int createit)
|
|||
{
|
||||
x->gl_editor = editor_new(x);
|
||||
for (y = x->gl_list; y; y = y->g_next)
|
||||
if (ob = pd_checkobject(&y->g_pd))
|
||||
if((ob = pd_checkobject(&y->g_pd)))
|
||||
rtext_new(x, ob);
|
||||
}
|
||||
}
|
||||
|
@ -700,7 +754,7 @@ void canvas_create_editor(t_glist *x, int createit)
|
|||
else
|
||||
{
|
||||
for (y = x->gl_list; y; y = y->g_next)
|
||||
if (ob = pd_checkobject(&y->g_pd))
|
||||
if((ob = pd_checkobject(&y->g_pd)))
|
||||
rtext_free(glist_findrtext(x, ob));
|
||||
editor_free(x->gl_editor, x);
|
||||
x->gl_editor = 0;
|
||||
|
@ -717,7 +771,9 @@ void canvas_create_editor(t_glist *x, int createit)
|
|||
the window. */
|
||||
void canvas_vis(t_canvas *x, t_floatarg f)
|
||||
{
|
||||
#ifndef ROCKBOX
|
||||
char buf[30];
|
||||
#endif
|
||||
int flag = (f != 0);
|
||||
if (flag)
|
||||
{
|
||||
|
@ -728,19 +784,23 @@ void canvas_vis(t_canvas *x, t_floatarg f)
|
|||
canvas_vis(x, 0);
|
||||
canvas_vis(x, 1);
|
||||
#else
|
||||
#ifndef ROCKBOX
|
||||
sys_vgui("raise .x%x\n", x);
|
||||
sys_vgui("focus .x%x.c\n", x);
|
||||
sys_vgui("wm deiconify .x%x\n", x);
|
||||
#endif /* ROCKBOX */
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
canvas_create_editor(x, 1);
|
||||
#ifndef ROCKBOX
|
||||
sys_vgui("pdtk_canvas_new .x%x %d %d +%d+%d %d\n", x,
|
||||
(int)(x->gl_screenx2 - x->gl_screenx1),
|
||||
(int)(x->gl_screeny2 - x->gl_screeny1),
|
||||
(int)(x->gl_screenx1), (int)(x->gl_screeny1),
|
||||
x->gl_edit);
|
||||
#endif /* ROCKBOX */
|
||||
canvas_reflecttitle(x);
|
||||
x->gl_havewindow = 1;
|
||||
canvas_updatewindowlist();
|
||||
|
@ -765,10 +825,14 @@ void canvas_vis(t_canvas *x, t_floatarg f)
|
|||
if (glist_isvisible(x))
|
||||
canvas_map(x, 0);
|
||||
canvas_create_editor(x, 0);
|
||||
#ifndef ROCKBOX
|
||||
sys_vgui("destroy .x%x\n", x);
|
||||
#endif
|
||||
for (i = 1, x2 = x; x2; x2 = x2->gl_next, i++)
|
||||
;
|
||||
#ifndef ROCKBOX
|
||||
sys_vgui(".mbar.find delete %d\n", i);
|
||||
#endif
|
||||
/* if we're a graph on our parent, and if the parent exists
|
||||
and is visible, show ourselves on parent. */
|
||||
if (glist_isgraph(x) && x->gl_owner)
|
||||
|
@ -837,7 +901,7 @@ void canvas_free(t_canvas *x)
|
|||
if (canvas_whichfind == x)
|
||||
canvas_whichfind = 0;
|
||||
glist_noselect(x);
|
||||
while (y = x->gl_list)
|
||||
while((y = x->gl_list))
|
||||
glist_delete(x, y);
|
||||
canvas_vis(x, 0);
|
||||
|
||||
|
@ -850,7 +914,9 @@ void canvas_free(t_canvas *x)
|
|||
}
|
||||
canvas_resume_dsp(dspstate);
|
||||
glist_cleanup(x);
|
||||
#ifndef ROCKBOX
|
||||
gfxstub_deleteforkey(x); /* probably unnecessary */
|
||||
#endif
|
||||
if (!x->gl_owner)
|
||||
canvas_takeofflist(x);
|
||||
}
|
||||
|
@ -863,12 +929,16 @@ static void canvas_drawlines(t_canvas *x)
|
|||
t_outconnect *oc;
|
||||
{
|
||||
linetraverser_start(&t, x);
|
||||
while (oc = linetraverser_next(&t))
|
||||
while((oc = linetraverser_next(&t)))
|
||||
#ifdef ROCKBOX
|
||||
;
|
||||
#else /* ROCKBOX */
|
||||
sys_vgui(".x%x.c create line %d %d %d %d -width %d -tags l%x\n",
|
||||
glist_getcanvas(x),
|
||||
t.tr_lx1, t.tr_ly1, t.tr_lx2, t.tr_ly2,
|
||||
(outlet_getsymbol(t.tr_outlet) == &s_signal ? 2:1),
|
||||
oc);
|
||||
#endif /* ROCKBOX */
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -878,13 +948,15 @@ void canvas_fixlinesfor(t_canvas *x, t_text *text)
|
|||
t_outconnect *oc;
|
||||
|
||||
linetraverser_start(&t, x);
|
||||
while (oc = linetraverser_next(&t))
|
||||
while((oc = linetraverser_next(&t)))
|
||||
{
|
||||
if (t.tr_ob == text || t.tr_ob2 == text)
|
||||
{
|
||||
#ifndef ROCKBOX
|
||||
sys_vgui(".x%x.c coords l%x %d %d %d %d\n",
|
||||
glist_getcanvas(x), oc,
|
||||
t.tr_lx1, t.tr_ly1, t.tr_lx2, t.tr_ly2);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -895,14 +967,16 @@ void canvas_deletelinesfor(t_canvas *x, t_text *text)
|
|||
t_linetraverser t;
|
||||
t_outconnect *oc;
|
||||
linetraverser_start(&t, x);
|
||||
while (oc = linetraverser_next(&t))
|
||||
while((oc = linetraverser_next(&t)))
|
||||
{
|
||||
if (t.tr_ob == text || t.tr_ob2 == text)
|
||||
{
|
||||
if (x->gl_editor)
|
||||
{
|
||||
#ifndef ROCKBOX
|
||||
sys_vgui(".x%x.c delete l%x\n",
|
||||
glist_getcanvas(x), oc);
|
||||
#endif
|
||||
}
|
||||
obj_disconnect(t.tr_ob, t.tr_outno, t.tr_ob2, t.tr_inno);
|
||||
}
|
||||
|
@ -916,15 +990,17 @@ void canvas_deletelinesforio(t_canvas *x, t_text *text,
|
|||
t_linetraverser t;
|
||||
t_outconnect *oc;
|
||||
linetraverser_start(&t, x);
|
||||
while (oc = linetraverser_next(&t))
|
||||
while((oc = linetraverser_next(&t)))
|
||||
{
|
||||
if ((t.tr_ob == text && t.tr_outlet == outp) ||
|
||||
(t.tr_ob2 == text && t.tr_inlet == inp))
|
||||
{
|
||||
if (x->gl_editor)
|
||||
{
|
||||
#ifndef ROCKBOX
|
||||
sys_vgui(".x%x.c delete l%x\n",
|
||||
glist_getcanvas(x), oc);
|
||||
#endif
|
||||
}
|
||||
obj_disconnect(t.tr_ob, t.tr_outno, t.tr_ob2, t.tr_inno);
|
||||
}
|
||||
|
@ -947,6 +1023,9 @@ void canvas_objfor(t_glist *gl, t_text *x, int argc, t_atom *argv);
|
|||
void canvas_restore(t_canvas *x, t_symbol *s, int argc, t_atom *argv)
|
||||
{ /* IOhannes */
|
||||
t_pd *z;
|
||||
#ifdef ROCKBOX
|
||||
(void) s;
|
||||
#endif
|
||||
/* this should be unnecessary, but sometimes the canvas's name gets
|
||||
out of sync with the owning box's argument; this fixes that */
|
||||
if (argc > 3)
|
||||
|
@ -992,7 +1071,9 @@ void canvas_restore(t_canvas *x, t_symbol *s, int argc, t_atom *argv)
|
|||
static void canvas_loadbangabstractions(t_canvas *x)
|
||||
{
|
||||
t_gobj *y;
|
||||
#ifndef ROCKBOX
|
||||
t_symbol *s = gensym("loadbang");
|
||||
#endif
|
||||
for (y = x->gl_list; y; y = y->g_next)
|
||||
if (pd_class(&y->g_pd) == canvas_class)
|
||||
{
|
||||
|
@ -1021,7 +1102,9 @@ void canvas_loadbangsubpatches(t_canvas *x)
|
|||
|
||||
void canvas_loadbang(t_canvas *x)
|
||||
{
|
||||
#ifndef ROCKBOX
|
||||
t_gobj *y;
|
||||
#endif
|
||||
canvas_loadbangabstractions(x);
|
||||
canvas_loadbangsubpatches(x);
|
||||
}
|
||||
|
@ -1042,6 +1125,11 @@ void canvas_loadbang(t_canvas *x)
|
|||
static void canvas_relocate(t_canvas *x, t_symbol *canvasgeom,
|
||||
t_symbol *topgeom)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
(void) x;
|
||||
(void) canvasgeom;
|
||||
(void) topgeom;
|
||||
#else /* ROCKBOX */
|
||||
int cxpix, cypix, cw, ch, txpix, typix, tw, th;
|
||||
if (sscanf(canvasgeom->s_name, "%dx%d+%d+%d", &cw, &ch, &cxpix, &cypix)
|
||||
< 4 ||
|
||||
|
@ -1052,6 +1140,7 @@ static void canvas_relocate(t_canvas *x, t_symbol *canvasgeom,
|
|||
if (cw > 5 && ch > 5)
|
||||
canvas_setbounds(x, txpix, typix,
|
||||
txpix + cw - HORIZBORDER, typix + ch - VERTBORDER);
|
||||
#endif /* ROCKBOX */
|
||||
}
|
||||
|
||||
void canvas_popabstraction(t_canvas *x)
|
||||
|
@ -1065,6 +1154,9 @@ void canvas_popabstraction(t_canvas *x)
|
|||
|
||||
void canvas_logerror(t_object *y)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
(void) y;
|
||||
#endif
|
||||
#ifdef LATER
|
||||
canvas_vis(x, 1);
|
||||
if (!glist_isselected(x, &y->ob_g))
|
||||
|
@ -1095,6 +1187,13 @@ static void canvas_click(t_canvas *x,
|
|||
t_floatarg xpos, t_floatarg ypos,
|
||||
t_floatarg shift, t_floatarg ctrl, t_floatarg alt)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
(void) xpos;
|
||||
(void) ypos;
|
||||
(void) shift;
|
||||
(void) ctrl;
|
||||
(void) alt;
|
||||
#endif
|
||||
canvas_vis(x, 1);
|
||||
}
|
||||
|
||||
|
@ -1103,13 +1202,22 @@ static void canvas_click(t_canvas *x,
|
|||
void canvas_fattensub(t_canvas *x,
|
||||
int *xp1, int *yp1, int *xp2, int *yp2)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
(void) x;
|
||||
(void) xp1;
|
||||
(void) yp1;
|
||||
#else /* ROCKBOX */
|
||||
t_gobj *y;
|
||||
#endif /* ROCKBOX */
|
||||
*xp2 += 50; /* fake for now */
|
||||
*yp2 += 50;
|
||||
}
|
||||
|
||||
static void canvas_rename_method(t_canvas *x, t_symbol *s, int ac, t_atom *av)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
(void) s;
|
||||
#endif
|
||||
if (ac && av->a_type == A_SYMBOL)
|
||||
canvas_rename(x, av->a_w.w_symbol, 0);
|
||||
else canvas_rename(x, gensym("Pd"), 0);
|
||||
|
@ -1128,7 +1236,11 @@ static void *table_new(t_symbol *s, t_floatarg f)
|
|||
{
|
||||
char tabname[255];
|
||||
t_symbol *t = gensym("table");
|
||||
#ifdef ROCKBOX
|
||||
snprintf(tabname, sizeof(tabname)-1, "%s%d", t->s_name, tabcount++);
|
||||
#else /* ROCKBOX */
|
||||
sprintf(tabname, "%s%d", t->s_name, tabcount++);
|
||||
#endif /* ROCKBOX */
|
||||
s = gensym(tabname);
|
||||
}
|
||||
if (f <= 1)
|
||||
|
@ -1239,7 +1351,7 @@ static void canvas_dodsp(t_canvas *x, int toplevel, t_signal **sp)
|
|||
|
||||
/* ... and all dsp interconnections */
|
||||
linetraverser_start(&t, x);
|
||||
while (oc = linetraverser_next(&t))
|
||||
while((oc = linetraverser_next(&t)))
|
||||
if (obj_issignaloutlet(t.tr_ob, t.tr_outno))
|
||||
ugen_connect(dc, t.tr_ob, t.tr_outno, t.tr_ob2, t.tr_inno);
|
||||
|
||||
|
@ -1252,7 +1364,9 @@ static void canvas_start_dsp(void)
|
|||
{
|
||||
t_canvas *x;
|
||||
if (canvas_dspstate) ugen_stop();
|
||||
#ifndef ROCKBOX
|
||||
else sys_gui("pdtk_pd_dsp ON\n");
|
||||
#endif
|
||||
ugen_start();
|
||||
|
||||
for (x = canvas_list; x; x = x->gl_next)
|
||||
|
@ -1266,7 +1380,9 @@ static void canvas_stop_dsp(void)
|
|||
if (canvas_dspstate)
|
||||
{
|
||||
ugen_stop();
|
||||
#ifndef ROCKBOX
|
||||
sys_gui("pdtk_pd_dsp OFF\n");
|
||||
#endif
|
||||
canvas_dspstate = 0;
|
||||
}
|
||||
}
|
||||
|
@ -1297,6 +1413,10 @@ void canvas_update_dsp(void)
|
|||
void glob_dsp(void *dummy, t_symbol *s, int argc, t_atom *argv)
|
||||
{
|
||||
int newstate;
|
||||
#ifdef ROCKBOX
|
||||
(void) dummy;
|
||||
(void) s;
|
||||
#endif
|
||||
if (argc)
|
||||
{
|
||||
newstate = atom_getintarg(0, argc, argv);
|
||||
|
@ -1333,7 +1453,9 @@ static void glist_redrawall(t_glist *gl)
|
|||
int vis = glist_isvisible(gl);
|
||||
for (g = gl->gl_list; g; g = g->g_next)
|
||||
{
|
||||
#ifndef ROCKBOX
|
||||
t_class *cl;
|
||||
#endif
|
||||
if (vis && g->g_pd == scalar_class)
|
||||
glist_redrawitem(gl, g);
|
||||
else if (g->g_pd == canvas_class)
|
||||
|
@ -1345,6 +1467,9 @@ static void glist_redrawall(t_glist *gl)
|
|||
void canvas_redrawallfortemplate(t_canvas *templatecanvas)
|
||||
{
|
||||
t_canvas *x;
|
||||
#ifdef ROCKBOX
|
||||
(void) templatecanvas;
|
||||
#endif
|
||||
/* find all root canvases */
|
||||
for (x = canvas_list; x; x = x->gl_next)
|
||||
glist_redrawall(x);
|
||||
|
|
|
@ -2,6 +2,14 @@
|
|||
* For information on usage and redistribution, and for a DISCLAIMER OF ALL
|
||||
* WARRANTIES, see the file, "LICENSE.txt," in this distribution. */
|
||||
|
||||
#ifdef ROCKBOX
|
||||
#include "plugin.h"
|
||||
#include "pdbox.h"
|
||||
#include "m_pd.h"
|
||||
#include "m_imp.h"
|
||||
#include "s_stuff.h"
|
||||
#include "g_canvas.h"
|
||||
#else /* ROCKBOX */
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include "m_pd.h"
|
||||
|
@ -9,6 +17,7 @@
|
|||
#include "s_stuff.h"
|
||||
#include "g_canvas.h"
|
||||
#include <string.h>
|
||||
#endif /* ROCKBOX */
|
||||
|
||||
void glist_readfrombinbuf(t_glist *x, t_binbuf *b, char *filename,
|
||||
int selectem);
|
||||
|
@ -88,8 +97,10 @@ void glist_selectline(t_glist *x, t_outconnect *oc, int index1,
|
|||
x->gl_editor->e_selectline_index2 = index2;
|
||||
x->gl_editor->e_selectline_inno = inno;
|
||||
x->gl_editor->e_selectline_tag = oc;
|
||||
#ifndef ROCKBOX
|
||||
sys_vgui(".x%x.c itemconfigure l%x -fill blue\n",
|
||||
x, x->gl_editor->e_selectline_tag);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -98,8 +109,10 @@ void glist_deselectline(t_glist *x)
|
|||
if (x->gl_editor)
|
||||
{
|
||||
x->gl_editor->e_selectedline = 0;
|
||||
#ifndef ROCKBOX
|
||||
sys_vgui(".x%x.c itemconfigure l%x -fill black\n",
|
||||
x, x->gl_editor->e_selectline_tag);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -166,7 +179,7 @@ void glist_deselect(t_glist *x, t_gobj *y)
|
|||
}
|
||||
else
|
||||
{
|
||||
for (sel = x->gl_editor->e_selection; sel2 = sel->sel_next;
|
||||
for(sel = x->gl_editor->e_selection; (sel2 = sel->sel_next);
|
||||
sel = sel2)
|
||||
{
|
||||
if (sel2->sel_what == y)
|
||||
|
@ -217,7 +230,7 @@ void glist_selectall(t_glist *x)
|
|||
x->gl_editor->e_selection = sel;
|
||||
sel->sel_what = y;
|
||||
gobj_select(y, x, 1);
|
||||
while (y = y->g_next)
|
||||
while((y = y->g_next))
|
||||
{
|
||||
t_selection *sel2 = (t_selection *)getbytes(sizeof(*sel2));
|
||||
sel->sel_next = sel2;
|
||||
|
@ -290,11 +303,13 @@ void canvas_setundo(t_canvas *x, t_undofn undofn, void *buf,
|
|||
canvas_undo_buf = buf;
|
||||
canvas_undo_whatnext = UNDO_UNDO;
|
||||
canvas_undo_name = name;
|
||||
#ifndef ROCKBOX
|
||||
if (x && glist_isvisible(x) && glist_istoplevel(x))
|
||||
/* enable undo in menu */
|
||||
sys_vgui("pdtk_undomenu .x%x %s no\n", x, name);
|
||||
else if (hadone)
|
||||
sys_vgui("pdtk_undomenu nobody no no\n");
|
||||
#endif
|
||||
}
|
||||
|
||||
/* clear undo if it happens to be for the canvas x.
|
||||
|
@ -316,8 +331,10 @@ static void canvas_undo(t_canvas *x)
|
|||
/* post("undo"); */
|
||||
(*canvas_undo_fn)(canvas_undo_canvas, canvas_undo_buf, UNDO_UNDO);
|
||||
/* enable redo in menu */
|
||||
#ifndef ROCKBOX
|
||||
if (glist_isvisible(x) && glist_istoplevel(x))
|
||||
sys_vgui("pdtk_undomenu .x%x no %s\n", x, canvas_undo_name);
|
||||
#endif
|
||||
canvas_undo_whatnext = UNDO_REDO;
|
||||
}
|
||||
}
|
||||
|
@ -333,8 +350,10 @@ static void canvas_redo(t_canvas *x)
|
|||
/* post("redo"); */
|
||||
(*canvas_undo_fn)(canvas_undo_canvas, canvas_undo_buf, UNDO_REDO);
|
||||
/* enable undo in menu */
|
||||
#ifndef ROCKBOX
|
||||
if (glist_isvisible(x) && glist_istoplevel(x))
|
||||
sys_vgui("pdtk_undomenu .x%x %s no\n", x, canvas_undo_name);
|
||||
#endif
|
||||
canvas_undo_whatnext = UNDO_UNDO;
|
||||
}
|
||||
}
|
||||
|
@ -352,6 +371,9 @@ typedef struct _undo_connect
|
|||
static void *canvas_undo_set_disconnect(t_canvas *x,
|
||||
int index1, int outno, int index2, int inno)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
(void) x;
|
||||
#endif
|
||||
t_undo_connect *buf = (t_undo_connect *)getbytes(sizeof(*buf));
|
||||
buf->u_index1 = index1;
|
||||
buf->u_outletno = outno;
|
||||
|
@ -366,14 +388,16 @@ void canvas_disconnect(t_canvas *x,
|
|||
t_linetraverser t;
|
||||
t_outconnect *oc;
|
||||
linetraverser_start(&t, x);
|
||||
while (oc = linetraverser_next(&t))
|
||||
while((oc = linetraverser_next(&t)))
|
||||
{
|
||||
int srcno = canvas_getindex(x, &t.tr_ob->ob_g);
|
||||
int sinkno = canvas_getindex(x, &t.tr_ob2->ob_g);
|
||||
if (srcno == index1 && t.tr_outno == outno &&
|
||||
sinkno == index2 && t.tr_inno == inno)
|
||||
{
|
||||
#ifndef ROCKBOX
|
||||
sys_vgui(".x%x.c delete l%x\n", x, oc);
|
||||
#endif
|
||||
obj_disconnect(t.tr_ob, t.tr_outno, t.tr_ob2, t.tr_inno);
|
||||
break;
|
||||
}
|
||||
|
@ -432,7 +456,9 @@ typedef struct _undo_cut
|
|||
static void *canvas_undo_set_cut(t_canvas *x, int mode)
|
||||
{
|
||||
t_undo_cut *buf;
|
||||
#ifndef ROCKBOX
|
||||
t_gobj *y;
|
||||
#endif
|
||||
t_linetraverser t;
|
||||
t_outconnect *oc;
|
||||
int nnotsel= glist_selectionindex(x, 0, 0);
|
||||
|
@ -443,7 +469,7 @@ static void *canvas_undo_set_cut(t_canvas *x, int mode)
|
|||
/* store connections into/out of the selection */
|
||||
buf->u_reconnectbuf = binbuf_new();
|
||||
linetraverser_start(&t, x);
|
||||
while (oc = linetraverser_next(&t))
|
||||
while((oc = linetraverser_next(&t)))
|
||||
{
|
||||
int issel1 = glist_isselected(x, &t.tr_ob->ob_g);
|
||||
int issel2 = glist_isselected(x, &t.tr_ob2->ob_g);
|
||||
|
@ -488,7 +514,7 @@ static void canvas_undo_cut(t_canvas *x, void *z, int action)
|
|||
{
|
||||
t_gobj *y1, *y2;
|
||||
glist_noselect(x);
|
||||
for (y1 = x->gl_list; y2 = y1->g_next; y1 = y2)
|
||||
for(y1 = x->gl_list; (y2 = y1->g_next); y1 = y2)
|
||||
;
|
||||
if (y1)
|
||||
{
|
||||
|
@ -514,7 +540,7 @@ static void canvas_undo_cut(t_canvas *x, void *z, int action)
|
|||
else if (mode == UCUT_TEXT)
|
||||
{
|
||||
t_gobj *y1, *y2;
|
||||
for (y1 = x->gl_list; y2 = y1->g_next; y1 = y2)
|
||||
for(y1 = x->gl_list; (y2 = y1->g_next); y1 = y2)
|
||||
;
|
||||
if (y1)
|
||||
glist_delete(x, y1);
|
||||
|
@ -738,7 +764,9 @@ void canvas_setcursor(t_canvas *x, unsigned int cursornum)
|
|||
}
|
||||
if (xwas != x || cursorwas != cursornum)
|
||||
{
|
||||
#ifndef ROCKBOX
|
||||
sys_vgui(".x%x configure -cursor %s\n", x, cursorlist[cursornum]);
|
||||
#endif
|
||||
xwas = x;
|
||||
cursorwas = cursornum;
|
||||
}
|
||||
|
@ -784,8 +812,14 @@ static void canvas_rightclick(t_canvas *x, int xpos, int ypos, t_gobj *y)
|
|||
int canprop, canopen;
|
||||
canprop = (!y || (y && class_getpropertiesfn(pd_class(&y->g_pd))));
|
||||
canopen = (y && zgetfn(&y->g_pd, gensym("menu-open")));
|
||||
#ifdef ROCKBOX
|
||||
(void) x;
|
||||
(void) xpos;
|
||||
(void) ypos;
|
||||
#else /* ROCKBOX */
|
||||
sys_vgui("pdtk_canvas_popup .x%x %d %d %d %d\n",
|
||||
x, xpos, ypos, canprop, canopen);
|
||||
#endif /* ROCKBOX */
|
||||
}
|
||||
|
||||
/* tell GUI to create a properties dialog on the canvas. We tell
|
||||
|
@ -793,11 +827,15 @@ static void canvas_rightclick(t_canvas *x, int xpos, int ypos, t_gobj *y)
|
|||
naturally upward, whereas pixels grow downward. */
|
||||
static void canvas_properties(t_glist *x)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
(void) x;
|
||||
#else /* ROCKBOX */
|
||||
char graphbuf[200];
|
||||
sprintf(graphbuf, "pdtk_canvas_dialog %%s %g %g %g %g \n",
|
||||
glist_dpixtodx(x, 1), -glist_dpixtody(x, 1),
|
||||
(float)glist_isgraph(x), (float)x->gl_stretch);
|
||||
gfxstub_new(&x->gl_pd, x, graphbuf);
|
||||
#endif /* ROCKBOX */
|
||||
}
|
||||
|
||||
|
||||
|
@ -885,7 +923,11 @@ static void canvas_donecanvasdialog(t_glist *x, t_floatarg xperpix,
|
|||
"open," or "help." */
|
||||
static void canvas_done_popup(t_canvas *x, float which, float xpos, float ypos)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
char namebuf[MAXPDSTRING];
|
||||
#else
|
||||
char pathbuf[MAXPDSTRING], namebuf[MAXPDSTRING];
|
||||
#endif
|
||||
t_gobj *y;
|
||||
for (y = x->gl_list; y; y = y->g_next)
|
||||
{
|
||||
|
@ -936,9 +978,11 @@ static void canvas_done_popup(t_canvas *x, float which, float xpos, float ypos)
|
|||
canvas_properties(x);
|
||||
else if (which == 2)
|
||||
{
|
||||
#ifndef ROCKBOX
|
||||
strcpy(pathbuf, sys_libdir->s_name);
|
||||
strcat(pathbuf, "/doc/5.reference/0.INTRO.txt");
|
||||
sys_vgui("menu_opentext %s\n", pathbuf);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -968,6 +1012,10 @@ void canvas_doclick(t_canvas *x, int xpos, int ypos, int which,
|
|||
int shiftmod, runmode, altmod, rightclick;
|
||||
int x1, y1, x2, y2, clickreturned = 0;
|
||||
|
||||
#ifdef ROCKBOX
|
||||
(void) which;
|
||||
#endif
|
||||
|
||||
if (!x->gl_editor)
|
||||
{
|
||||
bug("editor");
|
||||
|
@ -1027,7 +1075,7 @@ void canvas_doclick(t_canvas *x, int xpos, int ypos, int which,
|
|||
return;
|
||||
}
|
||||
/* if not a runmode left click, fall here. */
|
||||
if (y = canvas_findhitbox(x, xpos, ypos, &x1, &y1, &x2, &y2))
|
||||
if((y = canvas_findhitbox(x, xpos, ypos, &x1, &y1, &x2, &y2)))
|
||||
{
|
||||
t_object *ob = pd_checkobject(&y->g_pd);
|
||||
/* check you're in the rectangle */
|
||||
|
@ -1071,14 +1119,18 @@ void canvas_doclick(t_canvas *x, int xpos, int ypos, int which,
|
|||
{
|
||||
if (doit)
|
||||
{
|
||||
#ifndef ROCKBOX
|
||||
int issignal = obj_issignaloutlet(ob, closest);
|
||||
#endif
|
||||
x->gl_editor->e_onmotion = MA_CONNECT;
|
||||
x->gl_editor->e_xwas = xpos;
|
||||
x->gl_editor->e_ywas = ypos;
|
||||
#ifndef ROCKBOX
|
||||
sys_vgui(
|
||||
".x%x.c create line %d %d %d %d -width %d -tags x\n",
|
||||
x, xpos, ypos, xpos, ypos,
|
||||
(issignal ? 2 : 1));
|
||||
#endif
|
||||
}
|
||||
else canvas_setcursor(x, CURSOR_EDITMODE_CONNECT);
|
||||
}
|
||||
|
@ -1134,7 +1186,7 @@ void canvas_doclick(t_canvas *x, int xpos, int ypos, int which,
|
|||
float fx = xpos, fy = ypos;
|
||||
t_glist *glist2 = glist_getcanvas(x);
|
||||
linetraverser_start(&t, glist2);
|
||||
while (oc = linetraverser_next(&t))
|
||||
while((oc = linetraverser_next(&t)))
|
||||
{
|
||||
float lx1 = t.tr_lx1, ly1 = t.tr_ly1,
|
||||
lx2 = t.tr_lx2, ly2 = t.tr_ly2;
|
||||
|
@ -1158,8 +1210,10 @@ void canvas_doclick(t_canvas *x, int xpos, int ypos, int which,
|
|||
if (doit)
|
||||
{
|
||||
if (!shiftmod) glist_noselect(x);
|
||||
#ifndef ROCKBOX
|
||||
sys_vgui(".x%x.c create rectangle %d %d %d %d -tags x\n",
|
||||
x, xpos, ypos, xpos, ypos);
|
||||
#endif
|
||||
x->gl_editor->e_xwas = xpos;
|
||||
x->gl_editor->e_ywas = ypos;
|
||||
x->gl_editor->e_onmotion = MA_REGION;
|
||||
|
@ -1178,7 +1232,7 @@ int canvas_isconnected (t_canvas *x, t_text *ob1, int n1,
|
|||
t_linetraverser t;
|
||||
t_outconnect *oc;
|
||||
linetraverser_start(&t, x);
|
||||
while (oc = linetraverser_next(&t))
|
||||
while((oc = linetraverser_next(&t)))
|
||||
if (t.tr_ob == ob1 && t.tr_outno == n1 &&
|
||||
t.tr_ob2 == ob2 && t.tr_inno == n2)
|
||||
return (1);
|
||||
|
@ -1193,10 +1247,15 @@ void canvas_doconnect(t_canvas *x, int xpos, int ypos, int which, int doit)
|
|||
t_gobj *y2;
|
||||
int xwas = x->gl_editor->e_xwas,
|
||||
ywas = x->gl_editor->e_ywas;
|
||||
#ifdef ROCKBOX
|
||||
(void) which;
|
||||
#endif /* ROCKBOX */
|
||||
#ifndef ROCKBOX
|
||||
if (doit) sys_vgui(".x%x.c delete x\n", x);
|
||||
else sys_vgui(".x%x.c coords x %d %d %d %d\n",
|
||||
x, x->gl_editor->e_xwas,
|
||||
x->gl_editor->e_ywas, xpos, ypos);
|
||||
#endif /* ROCKBOX */
|
||||
|
||||
if ((y1 = canvas_findhitbox(x, xwas, ywas, &x11, &y11, &x12, &y12))
|
||||
&& (y2 = canvas_findhitbox(x, xpos, ypos, &x21, &y21, &x22, &y22)))
|
||||
|
@ -1258,10 +1317,12 @@ void canvas_doconnect(t_canvas *x, int xpos, int ypos, int which, int doit)
|
|||
((x22-x21-IOWIDTH) * closest2)/(ninlet2-1) : 0)
|
||||
+ IOMIDDLE;
|
||||
ly2 = y21;
|
||||
#ifndef ROCKBOX
|
||||
sys_vgui(".x%x.c create line %d %d %d %d -width %d -tags l%x\n",
|
||||
glist_getcanvas(x),
|
||||
lx1, ly1, lx2, ly2,
|
||||
(obj_issignaloutlet(ob1, closest1) ? 2 : 1), oc);
|
||||
#endif /* ROCKBOX */
|
||||
canvas_setundo(x, canvas_undo_connect,
|
||||
canvas_undo_set_connect(x,
|
||||
canvas_getindex(x, &ob1->ob_g), closest1,
|
||||
|
@ -1300,12 +1361,16 @@ static void canvas_doregion(t_canvas *x, int xpos, int ypos, int doit)
|
|||
loy = x->gl_editor->e_ywas, hiy = ypos;
|
||||
else hiy = x->gl_editor->e_ywas, loy = ypos;
|
||||
canvas_selectinrect(x, lox, loy, hix, hiy);
|
||||
#ifndef ROCKBOX
|
||||
sys_vgui(".x%x.c delete x\n", x);
|
||||
#endif
|
||||
x->gl_editor->e_onmotion = 0;
|
||||
}
|
||||
#ifndef ROCKBOX
|
||||
else sys_vgui(".x%x.c coords x %d %d %d %d\n",
|
||||
x, x->gl_editor->e_xwas,
|
||||
x->gl_editor->e_ywas, xpos, ypos);
|
||||
#endif
|
||||
}
|
||||
|
||||
void canvas_mouseup(t_canvas *x,
|
||||
|
@ -1396,6 +1461,10 @@ void canvas_key(t_canvas *x, t_symbol *s, int ac, t_atom *av)
|
|||
|
||||
int down, shift;
|
||||
|
||||
#ifdef ROCKBOX
|
||||
(void) s;
|
||||
#endif
|
||||
|
||||
if (ac < 3)
|
||||
return;
|
||||
if (!x->gl_editor)
|
||||
|
@ -1411,7 +1480,11 @@ void canvas_key(t_canvas *x, t_symbol *s, int ac, t_atom *av)
|
|||
else if (av[1].a_type == A_FLOAT)
|
||||
{
|
||||
char buf[3];
|
||||
#ifdef ROCKBOX
|
||||
snprintf(buf, sizeof(buf)-1, "%c", (int)(av[1].a_w.w_float));
|
||||
#else /* ROCKBOX */
|
||||
sprintf(buf, "%c", (int)(av[1].a_w.w_float));
|
||||
#endif /* ROCKBOX */
|
||||
gotkeysym = gensym(buf);
|
||||
}
|
||||
else gotkeysym = gensym("?");
|
||||
|
@ -1559,8 +1632,13 @@ void canvas_startmotion(t_canvas *x)
|
|||
|
||||
void canvas_print(t_canvas *x, t_symbol *s)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
(void) x;
|
||||
(void) s;
|
||||
#else /* ROCKBOX */
|
||||
if (*s->s_name) sys_vgui(".x%x.c postscript -file %s\n", x, s->s_name);
|
||||
else sys_vgui(".x%x.c postscript -file x.ps\n", x);
|
||||
#endif /* ROCKBOX */
|
||||
}
|
||||
|
||||
void canvas_menuclose(t_canvas *x, t_floatarg force)
|
||||
|
@ -1569,18 +1647,24 @@ void canvas_menuclose(t_canvas *x, t_floatarg force)
|
|||
canvas_vis(x, 0);
|
||||
else if ((force != 0) || (!x->gl_dirty))
|
||||
pd_free(&x->gl_pd);
|
||||
#ifndef ROCKBOX
|
||||
else sys_vgui("pdtk_check {This window has been modified. Close anyway?}\
|
||||
{.x%x menuclose 1;\n}\n", x);
|
||||
#endif
|
||||
}
|
||||
|
||||
/* put up a dialog which may call canvas_font back to do the work */
|
||||
static void canvas_menufont(t_canvas *x)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
(void) x;
|
||||
#else /* ROCKBOX */
|
||||
char buf[80];
|
||||
t_canvas *x2 = canvas_getrootfor(x);
|
||||
gfxstub_deleteforkey(x2);
|
||||
sprintf(buf, "pdtk_canvas_dofont %%s %d\n", x2->gl_font);
|
||||
gfxstub_new(&x2->gl_pd, &x2->gl_pd, buf);
|
||||
#endif /* ROCKBOX */
|
||||
}
|
||||
|
||||
static int canvas_find_index1, canvas_find_index2;
|
||||
|
@ -1598,13 +1682,13 @@ static int canvas_dofind(t_canvas *x, int *myindex1p)
|
|||
y = y->g_next, myindex2++)
|
||||
{
|
||||
t_object *ob = 0;
|
||||
if (ob = pd_checkobject(&y->g_pd))
|
||||
if((ob = pd_checkobject(&y->g_pd)))
|
||||
{
|
||||
if (binbuf_match(ob->ob_binbuf, canvas_findbuf))
|
||||
{
|
||||
if (myindex1 > canvas_find_index1 ||
|
||||
myindex1 == canvas_find_index1 &&
|
||||
myindex2 > canvas_find_index2)
|
||||
(myindex1 == canvas_find_index1 &&
|
||||
myindex2 > canvas_find_index2))
|
||||
{
|
||||
canvas_find_index1 = myindex1;
|
||||
canvas_find_index2 = myindex2;
|
||||
|
@ -1633,6 +1717,9 @@ static int canvas_dofind(t_canvas *x, int *myindex1p)
|
|||
static void canvas_find(t_canvas *x, t_symbol *s, int ac, t_atom *av)
|
||||
{
|
||||
int myindex1 = 0, i;
|
||||
#ifdef ROCKBOX
|
||||
(void) s;
|
||||
#endif
|
||||
for (i = 0; i < ac; i++)
|
||||
{
|
||||
if (av[i].a_type == A_SYMBOL)
|
||||
|
@ -1660,6 +1747,9 @@ static void canvas_find(t_canvas *x, t_symbol *s, int ac, t_atom *av)
|
|||
static void canvas_find_again(t_canvas *x)
|
||||
{
|
||||
int myindex1 = 0;
|
||||
#ifdef ROCKBOX
|
||||
(void) x;
|
||||
#endif
|
||||
if (!canvas_findbuf || !canvas_whichfind)
|
||||
return;
|
||||
if (!canvas_dofind(canvas_whichfind, &myindex1))
|
||||
|
@ -1756,7 +1846,7 @@ void canvas_stowconnections(t_canvas *x)
|
|||
/* add connections to binbuf */
|
||||
binbuf_clear(x->gl_editor->e_connectbuf);
|
||||
linetraverser_start(&t, x);
|
||||
while (oc = linetraverser_next(&t))
|
||||
while((oc = linetraverser_next(&t)))
|
||||
{
|
||||
int s1 = glist_isselected(x, &t.tr_ob->ob_g);
|
||||
int s2 = glist_isselected(x, &t.tr_ob2->ob_g);
|
||||
|
@ -1787,7 +1877,7 @@ static t_binbuf *canvas_docopy(t_canvas *x)
|
|||
gobj_save(y, b);
|
||||
}
|
||||
linetraverser_start(&t, x);
|
||||
while (oc = linetraverser_next(&t))
|
||||
while((oc = linetraverser_next(&t)))
|
||||
{
|
||||
if (glist_isselected(x, &t.tr_ob->ob_g)
|
||||
&& glist_isselected(x, &t.tr_ob2->ob_g))
|
||||
|
@ -1912,7 +2002,11 @@ static void glist_donewloadbangs(t_glist *x)
|
|||
|
||||
static void canvas_dopaste(t_canvas *x, t_binbuf *b)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
t_gobj *g2;
|
||||
#else /* ROCKBOX */
|
||||
t_gobj *newgobj, *last, *g2;
|
||||
#endif /* ROCKBOX */
|
||||
int dspstate = canvas_suspend_dsp(), nbox, count;
|
||||
|
||||
canvas_editmode(x, 1.);
|
||||
|
@ -1987,9 +2081,11 @@ void canvas_connect(t_canvas *x, t_floatarg fwhoout, t_floatarg foutno,
|
|||
if (!(oc = obj_connect(objsrc, outno, objsink, inno))) goto bad;
|
||||
if (glist_isvisible(x))
|
||||
{
|
||||
#ifndef ROCKBOX
|
||||
sys_vgui(".x%x.c create line %d %d %d %d -width %d -tags l%x\n",
|
||||
glist_getcanvas(x), 0, 0, 0, 0,
|
||||
(obj_issignaloutlet(objsrc, outno) ? 2 : 1),oc);
|
||||
#endif
|
||||
canvas_fixlinesfor(x, objsrc);
|
||||
}
|
||||
return;
|
||||
|
@ -2008,7 +2104,11 @@ bad:
|
|||
/* LATER might have to speed this up */
|
||||
static void canvas_tidy(t_canvas *x)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
t_gobj *y, *y2;
|
||||
#else /* ROCKBOX */
|
||||
t_gobj *y, *y2, *y3;
|
||||
#endif /* ROCKBOX */
|
||||
int ax1, ay1, ax2, ay2, bx1, by1, bx2, by2;
|
||||
int histogram[NHIST], *ip, i, besthist, bestdist;
|
||||
/* if nobody is selected, this means do it to all boxes;
|
||||
|
@ -2114,15 +2214,19 @@ static void canvas_texteditor(t_canvas *x)
|
|||
t_rtext *foo;
|
||||
char *buf;
|
||||
int bufsize;
|
||||
if (foo = x->gl_editor->e_textedfor)
|
||||
if((foo = x->gl_editor->e_textedfor))
|
||||
rtext_gettext(foo, &buf, &bufsize);
|
||||
else buf = "", bufsize = 0;
|
||||
#ifndef ROCKBOX
|
||||
sys_vgui("pdtk_pd_texteditor {%.*s}\n", bufsize, buf);
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
void glob_key(void *dummy, t_symbol *s, int ac, t_atom *av)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
(void) dummy;
|
||||
#endif
|
||||
/* canvas_editing can be zero; canvas_key checks for that */
|
||||
canvas_key(canvas_editing, s, ac, av);
|
||||
}
|
||||
|
@ -2141,8 +2245,10 @@ void canvas_editmode(t_canvas *x, t_floatarg fyesplease)
|
|||
if (glist_isvisible(x) && glist_istoplevel(x))
|
||||
canvas_setcursor(x, CURSOR_RUNMODE_NOTHING);
|
||||
}
|
||||
#ifndef ROCKBOX
|
||||
sys_vgui("pdtk_canvas_editval .x%x %d\n",
|
||||
glist_getcanvas(x), x->gl_edit);
|
||||
#endif
|
||||
}
|
||||
|
||||
/* called by canvas_font below */
|
||||
|
@ -2188,7 +2294,9 @@ static void canvas_font(t_canvas *x, t_floatarg font, t_floatarg resize,
|
|||
if (whichresize != 3) realresx = realresize;
|
||||
if (whichresize != 2) realresy = realresize;
|
||||
canvas_dofont(x2, font, realresx, realresy);
|
||||
#ifndef ROCKBOX
|
||||
sys_defaultfont = font;
|
||||
#endif
|
||||
}
|
||||
|
||||
static t_glist *canvas_last_glist;
|
||||
|
|
|
@ -6,12 +6,21 @@
|
|||
"graphs" inside another glist. LATER move the inlet/outlet code of g_canvas.c
|
||||
to this file... */
|
||||
|
||||
#ifdef ROCKBOX
|
||||
#include "plugin.h"
|
||||
#include "pdbox.h"
|
||||
#include "m_pd.h"
|
||||
#include "g_canvas.h"
|
||||
#define snprintf rb->snprintf
|
||||
#define atof rb_atof
|
||||
#else /* ROCKBOX */
|
||||
#include <stdlib.h>
|
||||
#include "m_pd.h"
|
||||
#include "t_tk.h"
|
||||
#include "g_canvas.h"
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#endif /* ROCKBOX */
|
||||
|
||||
/* ---------------------- forward definitions ----------------- */
|
||||
|
||||
|
@ -80,7 +89,11 @@ void glist_delete(t_glist *x, t_gobj *y)
|
|||
if (gl->gl_isgraph)
|
||||
{
|
||||
char tag[80];
|
||||
#ifdef ROCKBOX
|
||||
snprintf(tag, sizeof(tag)-1, "graph%x", (int)gl);
|
||||
#else /* ROCKBOX */
|
||||
sprintf(tag, "graph%x", (int)gl);
|
||||
#endif /* ROCKBOX */
|
||||
glist_eraseiofor(x, &gl->gl_obj, tag);
|
||||
}
|
||||
else
|
||||
|
@ -112,16 +125,22 @@ void glist_delete(t_glist *x, t_gobj *y)
|
|||
/* remove every object from a glist. Experimental. */
|
||||
void glist_clear(t_glist *x)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
t_gobj *y;
|
||||
#else
|
||||
t_gobj *y, *y2;
|
||||
#endif
|
||||
int dspstate = canvas_suspend_dsp();
|
||||
while (y = x->gl_list)
|
||||
while((y = x->gl_list))
|
||||
glist_delete(x, y);
|
||||
canvas_resume_dsp(dspstate);
|
||||
}
|
||||
|
||||
void glist_retext(t_glist *glist, t_text *y)
|
||||
{
|
||||
#ifndef ROCKBOX
|
||||
t_canvas *c = glist_getcanvas(glist);
|
||||
#endif
|
||||
/* check that we have built rtexts yet. LATER need a better test. */
|
||||
if (glist->gl_editor && glist->gl_editor->e_rtext)
|
||||
{
|
||||
|
@ -167,6 +186,9 @@ static t_gobj *glist_merge(t_glist *x, t_gobj *g1, t_gobj *g2)
|
|||
{
|
||||
t_gobj *g = 0, *g9 = 0;
|
||||
float f1 = 0, f2 = 0;
|
||||
#ifdef ROCKBOX
|
||||
(void) x;
|
||||
#endif
|
||||
if (g1)
|
||||
f1 = gobj_getxforsort(g1);
|
||||
if (g2)
|
||||
|
@ -190,7 +212,7 @@ static t_gobj *glist_merge(t_glist *x, t_gobj *g1, t_gobj *g2)
|
|||
if (g9)
|
||||
g9->g_next = g1, g9 = g1;
|
||||
else g9 = g = g1;
|
||||
if (g1 = g1->g_next)
|
||||
if((g1 = g1->g_next))
|
||||
f1 = gobj_getxforsort(g1);
|
||||
g9->g_next = 0;
|
||||
continue;
|
||||
|
@ -198,7 +220,7 @@ static t_gobj *glist_merge(t_glist *x, t_gobj *g1, t_gobj *g2)
|
|||
if (g9)
|
||||
g9->g_next = g2, g9 = g2;
|
||||
else g9 = g = g2;
|
||||
if (g2 = g2->g_next)
|
||||
if((g2 = g2->g_next))
|
||||
f2 = gobj_getxforsort(g2);
|
||||
g9->g_next = 0;
|
||||
continue;
|
||||
|
@ -333,6 +355,9 @@ void canvas_resortinlets(t_canvas *x)
|
|||
t_outlet *canvas_addoutlet(t_canvas *x, t_pd *who, t_symbol *s)
|
||||
{
|
||||
t_outlet *op = outlet_new(&x->gl_obj, s);
|
||||
#ifdef ROCKBOX
|
||||
(void) who;
|
||||
#endif
|
||||
if (!x->gl_loading && x->gl_owner && glist_isvisible(x->gl_owner))
|
||||
{
|
||||
gobj_vis(&x->gl_gobj, x->gl_owner, 0);
|
||||
|
@ -444,6 +469,9 @@ static void graph_yticks(t_glist *x,
|
|||
static void graph_xlabel(t_glist *x, t_symbol *s, int argc, t_atom *argv)
|
||||
{
|
||||
int i;
|
||||
#ifdef ROCKBOX
|
||||
(void) s;
|
||||
#endif
|
||||
if (argc < 1) error("graph_xlabel: no y value given");
|
||||
else
|
||||
{
|
||||
|
@ -460,6 +488,9 @@ static void graph_xlabel(t_glist *x, t_symbol *s, int argc, t_atom *argv)
|
|||
static void graph_ylabel(t_glist *x, t_symbol *s, int argc, t_atom *argv)
|
||||
{
|
||||
int i;
|
||||
#ifdef ROCKBOX
|
||||
(void) s;
|
||||
#endif
|
||||
if (argc < 1) error("graph_ylabel: no x value given");
|
||||
else
|
||||
{
|
||||
|
@ -613,10 +644,14 @@ void glist_redraw(t_glist *x)
|
|||
}
|
||||
/* redraw all the lines */
|
||||
linetraverser_start(&t, x);
|
||||
while (oc = linetraverser_next(&t))
|
||||
while((oc = linetraverser_next(&t)))
|
||||
#ifdef ROCKBOX
|
||||
;
|
||||
#else /* ROCKBOX */
|
||||
sys_vgui(".x%x.c coords l%x %d %d %d %d\n",
|
||||
glist_getcanvas(x), oc,
|
||||
t.tr_lx1, t.tr_ly1, t.tr_lx2, t.tr_ly2);
|
||||
#endif /* ROCKBOX */
|
||||
}
|
||||
if (x->gl_owner)
|
||||
{
|
||||
|
@ -651,7 +686,11 @@ static void graph_vis(t_gobj *gr, t_glist *parent_glist, int vis)
|
|||
if (!vis)
|
||||
rtext_erase(glist_findrtext(parent_glist, &x->gl_obj));
|
||||
|
||||
#ifdef ROCKBOX
|
||||
snprintf(tag, sizeof(tag)-1, "graph%x", (int) x);
|
||||
#else
|
||||
sprintf(tag, "graph%x", (int)x);
|
||||
#endif
|
||||
if (vis)
|
||||
glist_drawiofor(parent_glist, &x->gl_obj, 1,
|
||||
tag, x1, y1, x2, y2);
|
||||
|
@ -660,6 +699,7 @@ static void graph_vis(t_gobj *gr, t_glist *parent_glist, int vis)
|
|||
just show the bounding rectangle */
|
||||
if (x->gl_havewindow)
|
||||
{
|
||||
#ifndef ROCKBOX
|
||||
if (vis)
|
||||
{
|
||||
sys_vgui(".x%x.c create polygon\
|
||||
|
@ -672,6 +712,7 @@ static void graph_vis(t_gobj *gr, t_glist *parent_glist, int vis)
|
|||
sys_vgui(".x%x.c delete %s\n",
|
||||
glist_getcanvas(x->gl_owner), tag);
|
||||
}
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
/* otherwise draw (or erase) us as a graph inside another glist. */
|
||||
|
@ -681,10 +722,12 @@ static void graph_vis(t_gobj *gr, t_glist *parent_glist, int vis)
|
|||
float f;
|
||||
|
||||
/* draw a rectangle around the graph */
|
||||
#ifndef ROCKBOX
|
||||
sys_vgui(".x%x.c create line\
|
||||
%d %d %d %d %d %d %d %d %d %d -tags %s\n",
|
||||
glist_getcanvas(x->gl_owner),
|
||||
x1, y1, x1, y2, x2, y2, x2, y1, x1, y1, tag);
|
||||
#endif
|
||||
|
||||
/* draw ticks on horizontal borders. If lperb field is
|
||||
zero, this is disabled. */
|
||||
|
@ -698,6 +741,7 @@ static void graph_vis(t_gobj *gr, t_glist *parent_glist, int vis)
|
|||
f < 0.99 * x->gl_x2 + 0.01*x->gl_x1; i++,
|
||||
f += x->gl_xtick.k_inc)
|
||||
{
|
||||
#ifndef ROCKBOX
|
||||
int tickpix = (i % x->gl_xtick.k_lperb ? 2 : 4);
|
||||
sys_vgui(".x%x.c create line %d %d %d %d -tags %s\n",
|
||||
glist_getcanvas(x->gl_owner),
|
||||
|
@ -707,11 +751,13 @@ static void graph_vis(t_gobj *gr, t_glist *parent_glist, int vis)
|
|||
glist_getcanvas(x->gl_owner),
|
||||
(int)glist_xtopixels(x, f), (int)lpix,
|
||||
(int)glist_xtopixels(x, f), (int)lpix + tickpix, tag);
|
||||
#endif
|
||||
}
|
||||
for (i = 1, f = x->gl_xtick.k_point - x->gl_xtick.k_inc;
|
||||
f > 0.99 * x->gl_x1 + 0.01*x->gl_x2;
|
||||
i++, f -= x->gl_xtick.k_inc)
|
||||
{
|
||||
#ifndef ROCKBOX
|
||||
int tickpix = (i % x->gl_xtick.k_lperb ? 2 : 4);
|
||||
sys_vgui(".x%x.c create line %d %d %d %d -tags %s\n",
|
||||
glist_getcanvas(x->gl_owner),
|
||||
|
@ -721,6 +767,7 @@ static void graph_vis(t_gobj *gr, t_glist *parent_glist, int vis)
|
|||
glist_getcanvas(x->gl_owner),
|
||||
(int)glist_xtopixels(x, f), (int)lpix,
|
||||
(int)glist_xtopixels(x, f), (int)lpix + tickpix, tag);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -735,6 +782,7 @@ static void graph_vis(t_gobj *gr, t_glist *parent_glist, int vis)
|
|||
f < 0.99 * ubound + 0.01 * lbound;
|
||||
i++, f += x->gl_ytick.k_inc)
|
||||
{
|
||||
#ifndef ROCKBOX
|
||||
int tickpix = (i % x->gl_ytick.k_lperb ? 2 : 4);
|
||||
sys_vgui(".x%x.c create line %d %d %d %d -tags %s\n",
|
||||
glist_getcanvas(x->gl_owner),
|
||||
|
@ -744,11 +792,13 @@ static void graph_vis(t_gobj *gr, t_glist *parent_glist, int vis)
|
|||
glist_getcanvas(x->gl_owner),
|
||||
x2, (int)glist_ytopixels(x, f),
|
||||
x2 - tickpix, (int)glist_ytopixels(x, f), tag);
|
||||
#endif
|
||||
}
|
||||
for (i = 1, f = x->gl_ytick.k_point - x->gl_ytick.k_inc;
|
||||
f > 0.99 * lbound + 0.01 * ubound;
|
||||
i++, f -= x->gl_ytick.k_inc)
|
||||
{
|
||||
#ifndef ROCKBOX
|
||||
int tickpix = (i % x->gl_ytick.k_lperb ? 2 : 4);
|
||||
sys_vgui(".x%x.c create line %d %d %d %d -tags %s\n",
|
||||
glist_getcanvas(x->gl_owner),
|
||||
|
@ -758,19 +808,27 @@ static void graph_vis(t_gobj *gr, t_glist *parent_glist, int vis)
|
|||
glist_getcanvas(x->gl_owner),
|
||||
x2, (int)glist_ytopixels(x, f),
|
||||
x2 - tickpix, (int)glist_ytopixels(x, f), tag);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
/* draw x labels */
|
||||
for (i = 0; i < x->gl_nxlabels; i++)
|
||||
#ifdef ROCKBOX
|
||||
;
|
||||
#else /* ROCKBOX */
|
||||
sys_vgui(".x%x.c create text\
|
||||
%d %d -text {%s} -font -*-courier-bold--normal--%d-* -tags %s\n",
|
||||
glist_getcanvas(x),
|
||||
(int)glist_xtopixels(x, atof(x->gl_xlabel[i]->s_name)),
|
||||
(int)glist_ytopixels(x, x->gl_xlabely), x->gl_xlabel[i]->s_name,
|
||||
glist_getfont(x), tag);
|
||||
#endif /* ROCKBOX */
|
||||
|
||||
/* draw y labels */
|
||||
for (i = 0; i < x->gl_nylabels; i++)
|
||||
#ifdef ROCKBOX
|
||||
;
|
||||
#else /* ROCKBOX */
|
||||
sys_vgui(".x%x.c create text\
|
||||
%d %d -text {%s} -font -*-courier-bold--normal--%d-* -tags %s\n",
|
||||
glist_getcanvas(x),
|
||||
|
@ -778,6 +836,7 @@ static void graph_vis(t_gobj *gr, t_glist *parent_glist, int vis)
|
|||
(int)glist_ytopixels(x, atof(x->gl_ylabel[i]->s_name)),
|
||||
x->gl_ylabel[i]->s_name,
|
||||
glist_getfont(x), tag);
|
||||
#endif /* ROCKBOX */
|
||||
|
||||
/* draw contents of graph as glist */
|
||||
for (g = x->gl_list; g; g = g->g_next)
|
||||
|
@ -785,8 +844,10 @@ static void graph_vis(t_gobj *gr, t_glist *parent_glist, int vis)
|
|||
}
|
||||
else
|
||||
{
|
||||
#ifndef ROCKBOX
|
||||
sys_vgui(".x%x.c delete %s\n",
|
||||
glist_getcanvas(x->gl_owner), tag);
|
||||
#endif
|
||||
for (g = x->gl_list; g; g = g->g_next)
|
||||
gobj_vis(g, x, 0);
|
||||
}
|
||||
|
@ -904,10 +965,12 @@ static void graph_select(t_gobj *z, t_glist *glist, int state)
|
|||
t_rtext *y = glist_findrtext(glist, &x->gl_obj);
|
||||
if (canvas_showtext(x))
|
||||
rtext_select(y, state);
|
||||
#ifndef ROCKBOX
|
||||
sys_vgui(".x%x.c itemconfigure %sR -fill %s\n", glist,
|
||||
rtext_gettag(y), (state? "blue" : "black"));
|
||||
sys_vgui(".x%x.c itemconfigure graph%x -fill %s\n",
|
||||
glist_getcanvas(glist), z, (state? "blue" : "black"));
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -941,10 +1004,11 @@ static void graph_delete(t_gobj *z, t_glist *glist)
|
|||
t_glist *x = (t_glist *)z;
|
||||
t_gobj *y;
|
||||
text_widgetbehavior.w_deletefn(z, glist);
|
||||
while (y = x->gl_list)
|
||||
while((y = x->gl_list))
|
||||
glist_delete(x, y);
|
||||
}
|
||||
|
||||
#ifndef ROCKBOX
|
||||
static float graph_lastxpix, graph_lastypix;
|
||||
|
||||
static void graph_motion(void *z, t_floatarg dx, t_floatarg dy)
|
||||
|
@ -986,6 +1050,7 @@ static void graph_motion(void *z, t_floatarg dx, t_floatarg dy)
|
|||
else vec[newx] = newy;
|
||||
garray_redraw(a);
|
||||
}
|
||||
#endif
|
||||
|
||||
static int graph_click(t_gobj *z, struct _glist *glist,
|
||||
int xpix, int ypix, int shift, int alt, int dbl, int doit)
|
||||
|
@ -1037,11 +1102,16 @@ void graph_properties(t_gobj *z, t_glist *owner)
|
|||
t_glist *x = (t_glist *)z;
|
||||
{
|
||||
t_gobj *y;
|
||||
#ifdef ROCKBOX
|
||||
(void) owner;
|
||||
#else /* ROCKBOX */
|
||||
char graphbuf[200];
|
||||
|
||||
sprintf(graphbuf, "pdtk_graph_dialog %%s %g %g %g %g %d %d\n",
|
||||
x->gl_x1, x->gl_y1, x->gl_x2, x->gl_y2,
|
||||
x->gl_pixwidth, x->gl_pixheight);
|
||||
gfxstub_new(&x->gl_pd, x, graphbuf);
|
||||
#endif /* ROCKBOX */
|
||||
|
||||
for (y = x->gl_list; y; y = y->g_next)
|
||||
if (pd_class(&y->g_pd) == garray_class)
|
||||
|
@ -1071,6 +1141,9 @@ static void graph_dialog(t_glist *x, t_symbol *s, int argc, t_atom *argv)
|
|||
t_float y2 = atom_getfloatarg(3, argc, argv);
|
||||
t_float xpix = atom_getfloatarg(4, argc, argv);
|
||||
t_float ypix = atom_getfloatarg(5, argc, argv);
|
||||
#ifdef ROCKBOX
|
||||
(void) s;
|
||||
#endif
|
||||
if (x1 != x->gl_x1 || x2 != x->gl_x2 ||
|
||||
y1 != x->gl_y1 || y2 != x->gl_y2)
|
||||
graph_bounds(x, x1, y1, x2, y2);
|
||||
|
|
|
@ -8,6 +8,13 @@
|
|||
/* name change to hradio by MSP and changed to
|
||||
put out a "float" as in sliders, toggles, etc. */
|
||||
|
||||
#ifdef ROCKBOX
|
||||
#include "plugin.h"
|
||||
#include "pdbox.h"
|
||||
#include "m_pd.h"
|
||||
#include "g_canvas.h"
|
||||
#include "g_all_guis.h"
|
||||
#else /* ROCKBOX */
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
|
@ -23,6 +30,7 @@ put out a "float" as in sliders, toggles, etc. */
|
|||
#else
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
#endif /* ROCKBOX */
|
||||
|
||||
/* ------------- hdl gui-horicontal dial ---------------------- */
|
||||
|
||||
|
@ -33,6 +41,10 @@ static t_class *hradio_class, *hradio_old_class;
|
|||
|
||||
void hradio_draw_update(t_hradio *x, t_glist *glist)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
(void) x;
|
||||
(void) glist;
|
||||
#else /* ROCKBOX */
|
||||
if(glist_isvisible(glist))
|
||||
{
|
||||
t_canvas *canvas=glist_getcanvas(glist);
|
||||
|
@ -44,10 +56,15 @@ void hradio_draw_update(t_hradio *x, t_glist *glist)
|
|||
canvas, x, x->x_on,
|
||||
x->x_gui.x_fcol, x->x_gui.x_fcol);
|
||||
}
|
||||
#endif /* ROCKBOX */
|
||||
}
|
||||
|
||||
void hradio_draw_new(t_hradio *x, t_glist *glist)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
(void) x;
|
||||
(void) glist;
|
||||
#else /* ROCKBOX */
|
||||
t_canvas *canvas=glist_getcanvas(glist);
|
||||
int n=x->x_number, i, dx=x->x_gui.x_w, s4=dx/4;
|
||||
int yy11=text_ypix(&x->x_gui.x_obj, glist), yy12=yy11+dx;
|
||||
|
@ -55,7 +72,6 @@ void hradio_draw_new(t_hradio *x, t_glist *glist)
|
|||
int xx11b=text_xpix(&x->x_gui.x_obj, glist), xx11=xx11b, xx21=xx11b+s4;
|
||||
int xx22=xx11b+dx-s4;
|
||||
|
||||
|
||||
for(i=0; i<n; i++)
|
||||
{
|
||||
sys_vgui(".x%x.c create rectangle %d %d %d %d -fill #%6.6x -tags %xBASE%d\n",
|
||||
|
@ -81,11 +97,15 @@ void hradio_draw_new(t_hradio *x, t_glist *glist)
|
|||
if(!x->x_gui.x_fsf.x_rcv_able)
|
||||
sys_vgui(".x%x.c create rectangle %d %d %d %d -tags %xIN%d\n",
|
||||
canvas, xx11b, yy11, xx11b + IOWIDTH, yy11+1, x, 0);
|
||||
|
||||
#endif /* ROCKBOX */
|
||||
}
|
||||
|
||||
void hradio_draw_move(t_hradio *x, t_glist *glist)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
(void) x;
|
||||
(void) glist;
|
||||
#else /* ROCKBOX */
|
||||
t_canvas *canvas=glist_getcanvas(glist);
|
||||
int n=x->x_number, i, dx=x->x_gui.x_w, s4=dx/4;
|
||||
int yy11=text_ypix(&x->x_gui.x_obj, glist), yy12=yy11+dx;
|
||||
|
@ -114,10 +134,15 @@ void hradio_draw_move(t_hradio *x, t_glist *glist)
|
|||
if(!x->x_gui.x_fsf.x_rcv_able)
|
||||
sys_vgui(".x%x.c coords %xIN%d %d %d %d %d\n",
|
||||
canvas, x, 0, xx11b, yy11, xx11b + IOWIDTH, yy11+1);
|
||||
#endif /* ROCKBOX */
|
||||
}
|
||||
|
||||
void hradio_draw_erase(t_hradio* x, t_glist* glist)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
(void) x;
|
||||
(void) glist;
|
||||
#else /* ROCKBOX */
|
||||
t_canvas *canvas=glist_getcanvas(glist);
|
||||
int n=x->x_number, i;
|
||||
|
||||
|
@ -131,10 +156,15 @@ void hradio_draw_erase(t_hradio* x, t_glist* glist)
|
|||
sys_vgui(".x%x.c delete %xOUT%d\n", canvas, x, 0);
|
||||
if(!x->x_gui.x_fsf.x_rcv_able)
|
||||
sys_vgui(".x%x.c delete %xIN%d\n", canvas, x, 0);
|
||||
#endif /* ROCKBOX */
|
||||
}
|
||||
|
||||
void hradio_draw_config(t_hradio* x, t_glist* glist)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
(void) x;
|
||||
(void) glist;
|
||||
#else /* ROCKBOX */
|
||||
t_canvas *canvas=glist_getcanvas(glist);
|
||||
int n=x->x_number, i;
|
||||
|
||||
|
@ -150,10 +180,16 @@ void hradio_draw_config(t_hradio* x, t_glist* glist)
|
|||
(x->x_on==i)?x->x_gui.x_fcol:x->x_gui.x_bcol,
|
||||
(x->x_on==i)?x->x_gui.x_fcol:x->x_gui.x_bcol);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void hradio_draw_io(t_hradio* x, t_glist* glist, int old_snd_rcv_flags)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
(void) x;
|
||||
(void) glist;
|
||||
(void) old_snd_rcv_flags;
|
||||
#else /* ROCKBOX */
|
||||
t_canvas *canvas=glist_getcanvas(glist);
|
||||
int xpos=text_xpix(&x->x_gui.x_obj, glist);
|
||||
int ypos=text_ypix(&x->x_gui.x_obj, glist);
|
||||
|
@ -173,10 +209,15 @@ void hradio_draw_io(t_hradio* x, t_glist* glist, int old_snd_rcv_flags)
|
|||
xpos + IOWIDTH, ypos+1, x, 0);
|
||||
if(!(old_snd_rcv_flags & IEM_GUI_OLD_RCV_FLAG) && x->x_gui.x_fsf.x_rcv_able)
|
||||
sys_vgui(".x%x.c delete %xIN%d\n", canvas, x, 0);
|
||||
#endif /* ROCKBOX */
|
||||
}
|
||||
|
||||
void hradio_draw_select(t_hradio* x, t_glist* glist)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
(void) x;
|
||||
(void) glist;
|
||||
#else /* ROCKBOX */
|
||||
t_canvas *canvas=glist_getcanvas(glist);
|
||||
int n=x->x_number, i;
|
||||
|
||||
|
@ -199,6 +240,7 @@ void hradio_draw_select(t_hradio* x, t_glist* glist)
|
|||
sys_vgui(".x%x.c itemconfigure %xLABEL -fill #%6.6x\n", canvas, x,
|
||||
x->x_gui.x_lcol);
|
||||
}
|
||||
#endif /* ROCKBOX */
|
||||
}
|
||||
|
||||
void hradio_draw(t_hradio *x, t_glist *glist, int mode)
|
||||
|
@ -254,6 +296,10 @@ static void hradio_save(t_gobj *z, t_binbuf *b)
|
|||
|
||||
static void hradio_properties(t_gobj *z, t_glist *owner)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
(void) z;
|
||||
(void) owner;
|
||||
#else /* ROCKBOX */
|
||||
t_hradio *x = (t_hradio *)z;
|
||||
char buf[800];
|
||||
t_symbol *srl[3];
|
||||
|
@ -278,6 +324,7 @@ static void hradio_properties(t_gobj *z, t_glist *owner)
|
|||
x->x_gui.x_fsf.x_font_style, x->x_gui.x_fontsize,
|
||||
0xffffff & x->x_gui.x_bcol, 0xffffff & x->x_gui.x_fcol, 0xffffff & x->x_gui.x_lcol);
|
||||
gfxstub_new(&x->x_gui.x_obj.ob_pd, x, buf);
|
||||
#endif /* ROCKBOX */
|
||||
}
|
||||
|
||||
static void hradio_dialog(t_hradio *x, t_symbol *s, int argc, t_atom *argv)
|
||||
|
@ -288,6 +335,10 @@ static void hradio_dialog(t_hradio *x, t_symbol *s, int argc, t_atom *argv)
|
|||
int num = (int)atom_getintarg(6, argc, argv);
|
||||
int sr_flags;
|
||||
|
||||
#ifdef ROCKBOX
|
||||
(void) s;
|
||||
#endif
|
||||
|
||||
if(chg != 0) chg = 1;
|
||||
x->x_change = chg;
|
||||
sr_flags = iemgui_dialog(&x->x_gui, srl, argc, argv);
|
||||
|
@ -462,11 +513,22 @@ static void hradio_click(t_hradio *x, t_floatarg xpos, t_floatarg ypos, t_floata
|
|||
{
|
||||
int xx = (int)xpos - (int)text_xpix(&x->x_gui.x_obj, x->x_gui.x_glist);
|
||||
|
||||
#ifdef ROCKBOX
|
||||
(void) ypos;
|
||||
(void) shift;
|
||||
(void) ctrl;
|
||||
(void) alt;
|
||||
#endif
|
||||
|
||||
hradio_fout(x, (float)(xx / x->x_gui.x_w));
|
||||
}
|
||||
|
||||
static int hradio_newclick(t_gobj *z, struct _glist *glist, int xpix, int ypix, int shift, int alt, int dbl, int doit)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
(void) glist;
|
||||
(void) dbl;
|
||||
#endif
|
||||
if(doit)
|
||||
hradio_click((t_hradio *)z, (t_floatarg)xpix, (t_floatarg)ypix, (t_floatarg)shift, 0, (t_floatarg)alt);
|
||||
return (1);
|
||||
|
@ -499,6 +561,9 @@ static void hradio_number(t_hradio *x, t_floatarg num)
|
|||
|
||||
static void hradio_size(t_hradio *x, t_symbol *s, int ac, t_atom *av)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
(void) s;
|
||||
#endif
|
||||
x->x_gui.x_w = iemgui_clip_size((int)atom_getintarg(0, ac, av));
|
||||
x->x_gui.x_h = x->x_gui.x_w;
|
||||
iemgui_size((void *)x, &x->x_gui);
|
||||
|
@ -543,11 +608,21 @@ static void *hradio_donew(t_symbol *s, int argc, t_atom *argv, int old)
|
|||
{
|
||||
t_hradio *x = (t_hradio *)pd_new(old? hradio_old_class : hradio_class);
|
||||
int bflcol[]={-262144, -1, -1};
|
||||
#ifdef ROCKBOX
|
||||
int a=IEM_GUI_DEFAULTSIZE, on=0;
|
||||
#else
|
||||
int a=IEM_GUI_DEFAULTSIZE, on=0, f=0;
|
||||
#endif
|
||||
int ldx=0, ldy=-6, chg=1, num=8;
|
||||
int fs=8;
|
||||
#ifndef ROCKBOX
|
||||
int ftbreak=IEM_BNG_DEFAULTBREAKFLASHTIME, fthold=IEM_BNG_DEFAULTHOLDFLASHTIME;
|
||||
char str[144];
|
||||
#endif
|
||||
|
||||
#ifdef ROCKBOX
|
||||
(void) s;
|
||||
#endif
|
||||
|
||||
iem_inttosymargs(&x->x_gui.x_isa, 0);
|
||||
iem_inttofstyle(&x->x_gui.x_fsf, 0);
|
||||
|
@ -632,7 +707,9 @@ static void hradio_ff(t_hradio *x)
|
|||
{
|
||||
if(x->x_gui.x_fsf.x_rcv_able)
|
||||
pd_unbind(&x->x_gui.x_obj.ob_pd, x->x_gui.x_rcv);
|
||||
#ifndef ROCKBOX
|
||||
gfxstub_deleteforkey(x);
|
||||
#endif
|
||||
}
|
||||
|
||||
void g_hradio_setup(void)
|
||||
|
|
|
@ -6,6 +6,13 @@
|
|||
/* thanks to Miller Puckette, Guenther Geiger and Krzystof Czaja */
|
||||
|
||||
|
||||
#ifdef ROCKBOX
|
||||
#include "plugin.h"
|
||||
#include "pdbox.h"
|
||||
#include "m_pd.h"
|
||||
#include "g_canvas.h"
|
||||
#include "g_all_guis.h"
|
||||
#else /* ROCKBOX */
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
|
@ -21,7 +28,7 @@
|
|||
#else
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
#endif /* ROCKBOX */
|
||||
|
||||
/* ------------ hsl gui-horicontal slider ----------------------- */
|
||||
|
||||
|
@ -32,6 +39,10 @@ static t_class *hslider_class;
|
|||
|
||||
static void hslider_draw_update(t_hslider *x, t_glist *glist)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
(void) x;
|
||||
(void) glist;
|
||||
#else /* ROCKBOX */
|
||||
t_canvas *canvas=glist_getcanvas(glist);
|
||||
int ypos=text_ypix(&x->x_gui.x_obj, glist);
|
||||
|
||||
|
@ -58,10 +69,15 @@ static void hslider_draw_update(t_hslider *x, t_glist *glist)
|
|||
}
|
||||
}
|
||||
}
|
||||
#endif /* ROCKBOX */
|
||||
}
|
||||
|
||||
static void hslider_draw_new(t_hslider *x, t_glist *glist)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
(void) x;
|
||||
(void) glist;
|
||||
#else /* ROCKBOX */
|
||||
int xpos=text_xpix(&x->x_gui.x_obj, glist);
|
||||
int ypos=text_ypix(&x->x_gui.x_obj, glist);
|
||||
int r = xpos + (x->x_val + 50)/100;
|
||||
|
@ -88,10 +104,15 @@ static void hslider_draw_new(t_hslider *x, t_glist *glist)
|
|||
sys_vgui(".x%x.c create rectangle %d %d %d %d -tags %xIN%d\n",
|
||||
canvas, xpos-3, ypos,
|
||||
xpos+4, ypos+1, x, 0);
|
||||
#endif /* ROCKBOX */
|
||||
}
|
||||
|
||||
static void hslider_draw_move(t_hslider *x, t_glist *glist)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
(void) x;
|
||||
(void) glist;
|
||||
#else /* ROCKBOX */
|
||||
int xpos=text_xpix(&x->x_gui.x_obj, glist);
|
||||
int ypos=text_ypix(&x->x_gui.x_obj, glist);
|
||||
int r = xpos + (x->x_val + 50)/100;
|
||||
|
@ -116,10 +137,15 @@ static void hslider_draw_move(t_hslider *x, t_glist *glist)
|
|||
canvas, x, 0,
|
||||
xpos-3, ypos,
|
||||
xpos+4, ypos+1);
|
||||
#endif /* ROCKBOX */
|
||||
}
|
||||
|
||||
static void hslider_draw_erase(t_hslider* x,t_glist* glist)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
(void) x;
|
||||
(void) glist;
|
||||
#else /* ROCKBOX */
|
||||
t_canvas *canvas=glist_getcanvas(glist);
|
||||
|
||||
sys_vgui(".x%x.c delete %xBASE\n", canvas, x);
|
||||
|
@ -129,10 +155,15 @@ static void hslider_draw_erase(t_hslider* x,t_glist* glist)
|
|||
sys_vgui(".x%x.c delete %xOUT%d\n", canvas, x, 0);
|
||||
if(!x->x_gui.x_fsf.x_rcv_able)
|
||||
sys_vgui(".x%x.c delete %xIN%d\n", canvas, x, 0);
|
||||
#endif /* ROCKBOX */
|
||||
}
|
||||
|
||||
static void hslider_draw_config(t_hslider* x,t_glist* glist)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
(void) x;
|
||||
(void) glist;
|
||||
#else /* ROCKBOX */
|
||||
t_canvas *canvas=glist_getcanvas(glist);
|
||||
|
||||
sys_vgui(".x%x.c itemconfigure %xLABEL -font {%s %d bold} -fill #%6.6x -text {%s} \n",
|
||||
|
@ -141,10 +172,16 @@ static void hslider_draw_config(t_hslider* x,t_glist* glist)
|
|||
strcmp(x->x_gui.x_lab->s_name, "empty")?x->x_gui.x_lab->s_name:"");
|
||||
sys_vgui(".x%x.c itemconfigure %xKNOB -fill #%6.6x\n", canvas, x, x->x_gui.x_fcol);
|
||||
sys_vgui(".x%x.c itemconfigure %xBASE -fill #%6.6x\n", canvas, x, x->x_gui.x_bcol);
|
||||
#endif /* ROCKBOX */
|
||||
}
|
||||
|
||||
static void hslider_draw_io(t_hslider* x,t_glist* glist, int old_snd_rcv_flags)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
(void) x;
|
||||
(void) glist;
|
||||
(void) old_snd_rcv_flags;
|
||||
#else /* ROCKBOX */
|
||||
int xpos=text_xpix(&x->x_gui.x_obj, glist);
|
||||
int ypos=text_ypix(&x->x_gui.x_obj, glist);
|
||||
t_canvas *canvas=glist_getcanvas(glist);
|
||||
|
@ -161,10 +198,15 @@ static void hslider_draw_io(t_hslider* x,t_glist* glist, int old_snd_rcv_flags)
|
|||
xpos+4, ypos+1, x, 0);
|
||||
if(!(old_snd_rcv_flags & IEM_GUI_OLD_RCV_FLAG) && x->x_gui.x_fsf.x_rcv_able)
|
||||
sys_vgui(".x%x.c delete %xIN%d\n", canvas, x, 0);
|
||||
#endif /* ROCKBOX */
|
||||
}
|
||||
|
||||
static void hslider_draw_select(t_hslider* x,t_glist* glist)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
(void) x;
|
||||
(void) glist;
|
||||
#else /* ROCKBOX */
|
||||
t_canvas *canvas=glist_getcanvas(glist);
|
||||
|
||||
if(x->x_gui.x_fsf.x_selected)
|
||||
|
@ -177,6 +219,7 @@ static void hslider_draw_select(t_hslider* x,t_glist* glist)
|
|||
sys_vgui(".x%x.c itemconfigure %xBASE -outline #%6.6x\n", canvas, x, IEM_GUI_COLOR_NORMAL);
|
||||
sys_vgui(".x%x.c itemconfigure %xLABEL -fill #%6.6x\n", canvas, x, x->x_gui.x_lcol);
|
||||
}
|
||||
#endif /* ROCKBOX */
|
||||
}
|
||||
|
||||
void hslider_draw(t_hslider *x, t_glist *glist, int mode)
|
||||
|
@ -279,6 +322,10 @@ void hslider_check_minmax(t_hslider *x, double min, double max)
|
|||
|
||||
static void hslider_properties(t_gobj *z, t_glist *owner)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
(void) z;
|
||||
(void) owner;
|
||||
#else /* ROCKBOX */
|
||||
t_hslider *x = (t_hslider *)z;
|
||||
char buf[800];
|
||||
t_symbol *srl[3];
|
||||
|
@ -300,6 +347,7 @@ static void hslider_properties(t_gobj *z, t_glist *owner)
|
|||
x->x_gui.x_fsf.x_font_style, x->x_gui.x_fontsize,
|
||||
0xffffff & x->x_gui.x_bcol, 0xffffff & x->x_gui.x_fcol, 0xffffff & x->x_gui.x_lcol);
|
||||
gfxstub_new(&x->x_gui.x_obj.ob_pd, x, buf);
|
||||
#endif /* ROCKBOX */
|
||||
}
|
||||
|
||||
static void hslider_set(t_hslider *x, t_floatarg f) /* bugfix */
|
||||
|
@ -355,6 +403,10 @@ static void hslider_dialog(t_hslider *x, t_symbol *s, int argc, t_atom *argv)
|
|||
int steady = (int)atom_getintarg(17, argc, argv);
|
||||
int sr_flags;
|
||||
|
||||
#ifdef ROCKBOX
|
||||
(void) s;
|
||||
#endif
|
||||
|
||||
if(lilo != 0) lilo = 1;
|
||||
x->x_lin0_log1 = lilo;
|
||||
if(steady)
|
||||
|
@ -375,6 +427,10 @@ static void hslider_motion(t_hslider *x, t_floatarg dx, t_floatarg dy)
|
|||
{
|
||||
int old = x->x_val;
|
||||
|
||||
#ifdef ROCKBOX
|
||||
(void) dy;
|
||||
#endif
|
||||
|
||||
if(x->x_gui.x_fsf.x_finemoved)
|
||||
x->x_pos += (int)dx;
|
||||
else
|
||||
|
@ -402,6 +458,11 @@ static void hslider_motion(t_hslider *x, t_floatarg dx, t_floatarg dy)
|
|||
static void hslider_click(t_hslider *x, t_floatarg xpos, t_floatarg ypos,
|
||||
t_floatarg shift, t_floatarg ctrl, t_floatarg alt)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
(void) shift;
|
||||
(void) ctrl;
|
||||
(void) alt;
|
||||
#endif
|
||||
if(!x->x_steady)
|
||||
x->x_val = (int)(100.0 * (xpos - text_xpix(&x->x_gui.x_obj, x->x_gui.x_glist)));
|
||||
if(x->x_val > (100*x->x_gui.x_w - 100))
|
||||
|
@ -420,6 +481,11 @@ static int hslider_newclick(t_gobj *z, struct _glist *glist,
|
|||
{
|
||||
t_hslider* x = (t_hslider *)z;
|
||||
|
||||
#ifdef ROCKBOX
|
||||
(void) glist;
|
||||
(void) dbl;
|
||||
#endif
|
||||
|
||||
if(doit)
|
||||
{
|
||||
hslider_click( x, (t_floatarg)xpix, (t_floatarg)ypix, (t_floatarg)shift,
|
||||
|
@ -434,6 +500,9 @@ static int hslider_newclick(t_gobj *z, struct _glist *glist,
|
|||
|
||||
static void hslider_size(t_hslider *x, t_symbol *s, int ac, t_atom *av)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
(void) s;
|
||||
#endif
|
||||
hslider_check_width(x, (int)atom_getintarg(0, ac, av));
|
||||
if(ac > 1)
|
||||
x->x_gui.x_h = iemgui_clip_size((int)atom_getintarg(1, ac, av));
|
||||
|
@ -448,6 +517,9 @@ static void hslider_pos(t_hslider *x, t_symbol *s, int ac, t_atom *av)
|
|||
|
||||
static void hslider_range(t_hslider *x, t_symbol *s, int ac, t_atom *av)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
(void) s;
|
||||
#endif
|
||||
hslider_check_minmax(x, (double)atom_getfloatarg(0, ac, av),
|
||||
(double)atom_getfloatarg(1, ac, av));
|
||||
}
|
||||
|
@ -525,10 +597,20 @@ static void *hslider_new(t_symbol *s, int argc, t_atom *argv)
|
|||
t_hslider *x = (t_hslider *)pd_new(hslider_class);
|
||||
int bflcol[]={-262144, -1, -1};
|
||||
int w=IEM_SL_DEFAULTSIZE, h=IEM_GUI_DEFAULTSIZE;
|
||||
#ifdef ROCKBOX
|
||||
int lilo=0, ldx=-2, ldy=-6, v=0, steady=1;
|
||||
#else
|
||||
int lilo=0, ldx=-2, ldy=-6, f=0, v=0, steady=1;
|
||||
#endif
|
||||
int fs=8;
|
||||
double min=0.0, max=(double)(IEM_SL_DEFAULTSIZE-1);
|
||||
#ifndef ROCKBOX
|
||||
char str[144];
|
||||
#endif
|
||||
|
||||
#ifdef ROCKBOX
|
||||
(void) s;
|
||||
#endif
|
||||
|
||||
iem_inttosymargs(&x->x_gui.x_isa, 0);
|
||||
iem_inttofstyle(&x->x_gui.x_fsf, 0);
|
||||
|
@ -607,7 +689,9 @@ static void hslider_free(t_hslider *x)
|
|||
{
|
||||
if(x->x_gui.x_fsf.x_rcv_able)
|
||||
pd_unbind(&x->x_gui.x_obj.ob_pd, x->x_gui.x_rcv);
|
||||
#ifndef ROCKBOX
|
||||
gfxstub_deleteforkey(x);
|
||||
#endif
|
||||
}
|
||||
|
||||
void g_hslider_setup(void)
|
||||
|
|
|
@ -22,9 +22,17 @@ life elsewhere. */
|
|||
*
|
||||
*/
|
||||
|
||||
#ifdef ROCKBOX
|
||||
#include "plugin.h"
|
||||
#include "pdbox.h"
|
||||
#include "m_pd.h"
|
||||
#include "g_canvas.h"
|
||||
#else
|
||||
#include "m_pd.h"
|
||||
#include "g_canvas.h"
|
||||
#include <string.h>
|
||||
#endif
|
||||
|
||||
void signal_setborrowed(t_signal *sig, t_signal *sig2);
|
||||
void signal_makereusable(t_signal *sig);
|
||||
|
||||
|
@ -51,6 +59,9 @@ typedef struct _vinlet
|
|||
|
||||
static void *vinlet_new(t_symbol *s)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
(void) s;
|
||||
#endif
|
||||
t_vinlet *x = (t_vinlet *)pd_new(vinlet_class);
|
||||
x->x_canvas = canvas_getcurrent();
|
||||
x->x_inlet = canvas_addinlet(x->x_canvas, &x->x_obj.ob_pd, 0);
|
||||
|
@ -108,7 +119,9 @@ int vinlet_issignal(t_vinlet *x)
|
|||
return (x->x_buf != 0);
|
||||
}
|
||||
|
||||
#ifndef ROCKBOX
|
||||
static int tot;
|
||||
#endif
|
||||
|
||||
t_int *vinlet_perform(t_int *w)
|
||||
{
|
||||
|
@ -176,7 +189,13 @@ void vinlet_dspprolog(t_vinlet *x, t_signal **parentsigs,
|
|||
int myvecsize, int phase, int period, int frequency, int downsample, int upsample/* IOhannes */, int reblock,
|
||||
int switched)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
t_signal *insig;
|
||||
(void) frequency;
|
||||
(void) switched;
|
||||
#else
|
||||
t_signal *insig, *outsig;
|
||||
#endif
|
||||
x->x_updown.downsample = downsample;
|
||||
x->x_updown.upsample = upsample;
|
||||
|
||||
|
@ -318,6 +337,9 @@ typedef struct _voutlet
|
|||
|
||||
static void *voutlet_new(t_symbol *s)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
(void) s;
|
||||
#endif
|
||||
t_voutlet *x = (t_voutlet *)pd_new(voutlet_class);
|
||||
x->x_canvas = canvas_getcurrent();
|
||||
x->x_parentoutlet = canvas_addoutlet(x->x_canvas, &x->x_obj.ob_pd, 0);
|
||||
|
@ -445,6 +467,12 @@ void voutlet_dspprolog(t_voutlet *x, t_signal **parentsigs,
|
|||
int myvecsize, int phase, int period, int frequency, int downsample, int upsample /* IOhannes */, int reblock,
|
||||
int switched)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
(void) myvecsize;
|
||||
(void) phase;
|
||||
(void) period;
|
||||
(void) frequency;
|
||||
#endif
|
||||
x->x_updown.downsample=downsample; x->x_updown.upsample=upsample; /* IOhannes */
|
||||
x->x_justcopyout = (switched && !reblock);
|
||||
if (reblock)
|
||||
|
@ -488,7 +516,11 @@ void voutlet_dspepilog(t_voutlet *x, t_signal **parentsigs,
|
|||
x->x_updown.downsample=downsample; x->x_updown.upsample=upsample; /* IOhannes */
|
||||
if (reblock)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
t_signal *outsig;
|
||||
#else
|
||||
t_signal *insig, *outsig;
|
||||
#endif
|
||||
int parentvecsize, bufsize, oldbufsize;
|
||||
int re_parentvecsize; /* IOhannes */
|
||||
int bigperiod, epilogphase, blockphase;
|
||||
|
|
|
@ -6,6 +6,13 @@
|
|||
/* thanks to Miller Puckette, Guenther Geiger and Krzystof Czaja */
|
||||
|
||||
|
||||
#ifdef ROCKBOX
|
||||
#include "plugin.h"
|
||||
#include "pdbox.h"
|
||||
#include "m_pd.h"
|
||||
#include "g_canvas.h"
|
||||
#include "g_all_guis.h"
|
||||
#else /* ROCKBOX */
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
|
@ -21,6 +28,7 @@
|
|||
#else
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
#endif /* ROCKBOX */
|
||||
|
||||
/* ---------- cnv my gui-canvas for a window ---------------- */
|
||||
|
||||
|
@ -31,6 +39,10 @@ static t_class *my_canvas_class;
|
|||
|
||||
void my_canvas_draw_new(t_my_canvas *x, t_glist *glist)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
(void) x;
|
||||
(void) glist;
|
||||
#else /* ROCKBOX */
|
||||
int xpos=text_xpix(&x->x_gui.x_obj, glist);
|
||||
int ypos=text_ypix(&x->x_gui.x_obj, glist);
|
||||
t_canvas *canvas=glist_getcanvas(glist);
|
||||
|
@ -48,10 +60,15 @@ void my_canvas_draw_new(t_my_canvas *x, t_glist *glist)
|
|||
canvas, xpos+x->x_gui.x_ldx, ypos+x->x_gui.x_ldy,
|
||||
strcmp(x->x_gui.x_lab->s_name, "empty")?x->x_gui.x_lab->s_name:"",
|
||||
x->x_gui.x_font, x->x_gui.x_fontsize, x->x_gui.x_lcol, x);
|
||||
#endif /* ROCKBOX */
|
||||
}
|
||||
|
||||
void my_canvas_draw_move(t_my_canvas *x, t_glist *glist)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
(void) x;
|
||||
(void) glist;
|
||||
#else /* ROCKBOX */
|
||||
int xpos=text_xpix(&x->x_gui.x_obj, glist);
|
||||
int ypos=text_ypix(&x->x_gui.x_obj, glist);
|
||||
t_canvas *canvas=glist_getcanvas(glist);
|
||||
|
@ -65,19 +82,29 @@ void my_canvas_draw_move(t_my_canvas *x, t_glist *glist)
|
|||
sys_vgui(".x%x.c coords %xLABEL %d %d\n",
|
||||
canvas, x, xpos+x->x_gui.x_ldx,
|
||||
ypos+x->x_gui.x_ldy);
|
||||
#endif /* ROCKBOX */
|
||||
}
|
||||
|
||||
void my_canvas_draw_erase(t_my_canvas* x, t_glist* glist)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
(void) x;
|
||||
(void) glist;
|
||||
#else /* ROCKBOX */
|
||||
t_canvas *canvas=glist_getcanvas(glist);
|
||||
|
||||
sys_vgui(".x%x.c delete %xBASE\n", canvas, x);
|
||||
sys_vgui(".x%x.c delete %xRECT\n", canvas, x);
|
||||
sys_vgui(".x%x.c delete %xLABEL\n", canvas, x);
|
||||
#endif /* ROCKBOX */
|
||||
}
|
||||
|
||||
void my_canvas_draw_config(t_my_canvas* x, t_glist* glist)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
(void) x;
|
||||
(void) glist;
|
||||
#else /* ROCKBOX */
|
||||
t_canvas *canvas=glist_getcanvas(glist);
|
||||
|
||||
sys_vgui(".x%x.c itemconfigure %xRECT -fill #%6.6x -outline #%6.6x\n", canvas, x,
|
||||
|
@ -87,10 +114,15 @@ void my_canvas_draw_config(t_my_canvas* x, t_glist* glist)
|
|||
sys_vgui(".x%x.c itemconfigure %xLABEL -font {%s %d bold} -fill #%6.6x -text {%s} \n",
|
||||
canvas, x, x->x_gui.x_font, x->x_gui.x_fontsize, x->x_gui.x_lcol,
|
||||
strcmp(x->x_gui.x_lab->s_name, "empty")?x->x_gui.x_lab->s_name:"");
|
||||
#endif /* ROCKBOX */
|
||||
}
|
||||
|
||||
void my_canvas_draw_select(t_my_canvas* x, t_glist* glist)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
(void) x;
|
||||
(void) glist;
|
||||
#else /* ROCKBOX */
|
||||
t_canvas *canvas=glist_getcanvas(glist);
|
||||
|
||||
if(x->x_gui.x_fsf.x_selected)
|
||||
|
@ -101,6 +133,7 @@ void my_canvas_draw_select(t_my_canvas* x, t_glist* glist)
|
|||
{
|
||||
sys_vgui(".x%x.c itemconfigure %xBASE -outline #%6.6x\n", canvas, x, x->x_gui.x_bcol);
|
||||
}
|
||||
#endif /* ROCKBOX */
|
||||
}
|
||||
|
||||
void my_canvas_draw(t_my_canvas *x, t_glist *glist, int mode)
|
||||
|
@ -147,6 +180,10 @@ static void my_canvas_save(t_gobj *z, t_binbuf *b)
|
|||
|
||||
static void my_canvas_properties(t_gobj *z, t_glist *owner)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
(void) z;
|
||||
(void) owner;
|
||||
#else /* ROCKBOX */
|
||||
t_my_canvas *x = (t_my_canvas *)z;
|
||||
char buf[800];
|
||||
t_symbol *srl[3];
|
||||
|
@ -168,6 +205,7 @@ static void my_canvas_properties(t_gobj *z, t_glist *owner)
|
|||
x->x_gui.x_fsf.x_font_style, x->x_gui.x_fontsize,
|
||||
0xffffff & x->x_gui.x_bcol, -1/*no frontcolor*/, 0xffffff & x->x_gui.x_lcol);
|
||||
gfxstub_new(&x->x_gui.x_obj.ob_pd, x, buf);
|
||||
#endif /* ROCKBOX */
|
||||
}
|
||||
|
||||
static void my_canvas_get_pos(t_my_canvas *x)
|
||||
|
@ -182,11 +220,19 @@ static void my_canvas_get_pos(t_my_canvas *x)
|
|||
|
||||
static void my_canvas_dialog(t_my_canvas *x, t_symbol *s, int argc, t_atom *argv)
|
||||
{
|
||||
#ifndef ROCKBOX
|
||||
t_symbol *srl[3];
|
||||
#endif
|
||||
int a = (int)atom_getintarg(0, argc, argv);
|
||||
int w = (int)atom_getintarg(2, argc, argv);
|
||||
int h = (int)atom_getintarg(3, argc, argv);
|
||||
#ifndef ROCKBOX
|
||||
int sr_flags = iemgui_dialog(&x->x_gui, srl, argc, argv);
|
||||
#endif
|
||||
|
||||
#ifdef ROCKBOX
|
||||
(void) s;
|
||||
#endif
|
||||
|
||||
x->x_gui.x_isa.x_loadinit = 0;
|
||||
if(a < 1)
|
||||
|
@ -207,6 +253,10 @@ static void my_canvas_size(t_my_canvas *x, t_symbol *s, int ac, t_atom *av)
|
|||
{
|
||||
int i = (int)atom_getintarg(0, ac, av);
|
||||
|
||||
#ifdef ROCKBOX
|
||||
(void) s;
|
||||
#endif
|
||||
|
||||
if(i < 1)
|
||||
i = 1;
|
||||
x->x_gui.x_w = i;
|
||||
|
@ -224,6 +274,10 @@ static void my_canvas_vis_size(t_my_canvas *x, t_symbol *s, int ac, t_atom *av)
|
|||
{
|
||||
int i;
|
||||
|
||||
#ifdef ROCKBOX
|
||||
(void) s;
|
||||
#endif
|
||||
|
||||
i = (int)atom_getintarg(0, ac, av);
|
||||
if(i < 1)
|
||||
i = 1;
|
||||
|
@ -262,9 +316,19 @@ static void *my_canvas_new(t_symbol *s, int argc, t_atom *argv)
|
|||
t_my_canvas *x = (t_my_canvas *)pd_new(my_canvas_class);
|
||||
int bflcol[]={-233017, -1, -66577};
|
||||
int a=IEM_GUI_DEFAULTSIZE, w=100, h=60;
|
||||
#ifdef ROCKBOX
|
||||
int ldx=20, ldy=12, i=0;
|
||||
#else
|
||||
int ldx=20, ldy=12, f=2, i=0;
|
||||
#endif
|
||||
int fs=14;
|
||||
#ifndef ROCKBOX
|
||||
char str[144];
|
||||
#endif
|
||||
|
||||
#ifdef ROCKBOX
|
||||
(void) s;
|
||||
#endif
|
||||
|
||||
iem_inttosymargs(&x->x_gui.x_isa, 0);
|
||||
iem_inttofstyle(&x->x_gui.x_fsf, 0);
|
||||
|
@ -350,7 +414,9 @@ static void my_canvas_ff(t_my_canvas *x)
|
|||
{
|
||||
if(x->x_gui.x_fsf.x_rcv_able)
|
||||
pd_unbind(&x->x_gui.x_obj.ob_pd, x->x_gui.x_rcv);
|
||||
#ifndef ROCKBOX
|
||||
gfxstub_deleteforkey(x);
|
||||
#endif
|
||||
}
|
||||
|
||||
void g_mycanvas_setup(void)
|
||||
|
|
|
@ -4,6 +4,13 @@
|
|||
|
||||
/* my_numbox.c written by Thomas Musil (c) IEM KUG Graz Austria 2000-2001 */
|
||||
|
||||
#ifdef ROCKBOX
|
||||
#include "plugin.h"
|
||||
#include "pdbox.h"
|
||||
#include "m_pd.h"
|
||||
#include "g_canvas.h"
|
||||
#include "g_all_guis.h"
|
||||
#else /* ROCKBOX */
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
|
@ -19,6 +26,7 @@
|
|||
#else
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
#endif /* ROCKBOX */
|
||||
|
||||
/*------------------ global varaibles -------------------------*/
|
||||
|
||||
|
@ -76,7 +84,11 @@ void my_numbox_ftoa(t_my_numbox *x)
|
|||
double f=x->x_val;
|
||||
int bufsize, is_exp=0, i, idecimal;
|
||||
|
||||
#ifdef ROCKBOX
|
||||
ftoan(f, x->x_buf, 10);
|
||||
#else
|
||||
sprintf(x->x_buf, "%g", f);
|
||||
#endif
|
||||
bufsize = strlen(x->x_buf);
|
||||
if(bufsize >= 5)/* if it is in exponential mode */
|
||||
{
|
||||
|
@ -130,6 +142,10 @@ void my_numbox_ftoa(t_my_numbox *x)
|
|||
|
||||
static void my_numbox_draw_update(t_my_numbox *x, t_glist *glist)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
(void) x;
|
||||
(void) glist;
|
||||
#else /* ROCKBOX */
|
||||
if (glist_isvisible(glist))
|
||||
{
|
||||
if(x->x_gui.x_fsf.x_change)
|
||||
|
@ -169,10 +185,15 @@ static void my_numbox_draw_update(t_my_numbox *x, t_glist *glist)
|
|||
x->x_buf[0] = 0;
|
||||
}
|
||||
}
|
||||
#endif /* ROCKBOX */
|
||||
}
|
||||
|
||||
static void my_numbox_draw_new(t_my_numbox *x, t_glist *glist)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
(void) x;
|
||||
(void) glist;
|
||||
#else /* ROCKBOX */
|
||||
int half=x->x_gui.x_h/2, d=1+x->x_gui.x_h/34;
|
||||
int xpos=text_xpix(&x->x_gui.x_obj, glist);
|
||||
int ypos=text_ypix(&x->x_gui.x_obj, glist);
|
||||
|
@ -215,10 +236,15 @@ static void my_numbox_draw_new(t_my_numbox *x, t_glist *glist)
|
|||
xpos, ypos,
|
||||
xpos+IOWIDTH, ypos+1,
|
||||
x, 0);
|
||||
#endif /* ROCKBOX */
|
||||
}
|
||||
|
||||
static void my_numbox_draw_move(t_my_numbox *x, t_glist *glist)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
(void) x;
|
||||
(void) glist;
|
||||
#else /* ROCKBOX */
|
||||
int half = x->x_gui.x_h/2, d=1+x->x_gui.x_h/34;
|
||||
int xpos=text_xpix(&x->x_gui.x_obj, glist);
|
||||
int ypos=text_ypix(&x->x_gui.x_obj, glist);
|
||||
|
@ -248,10 +274,15 @@ static void my_numbox_draw_move(t_my_numbox *x, t_glist *glist)
|
|||
canvas, x, 0,
|
||||
xpos, ypos,
|
||||
xpos+IOWIDTH, ypos+1);
|
||||
#endif /* ROCKBOX */
|
||||
}
|
||||
|
||||
static void my_numbox_draw_erase(t_my_numbox* x,t_glist* glist)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
(void) x;
|
||||
(void) glist;
|
||||
#else /* ROCKBOX */
|
||||
t_canvas *canvas=glist_getcanvas(glist);
|
||||
|
||||
sys_vgui(".x%x.c delete %xBASE1\n", canvas, x);
|
||||
|
@ -262,10 +293,15 @@ static void my_numbox_draw_erase(t_my_numbox* x,t_glist* glist)
|
|||
sys_vgui(".x%x.c delete %xOUT%d\n", canvas, x, 0);
|
||||
if(!x->x_gui.x_fsf.x_rcv_able)
|
||||
sys_vgui(".x%x.c delete %xIN%d\n", canvas, x, 0);
|
||||
#endif /* ROCKBOX */
|
||||
}
|
||||
|
||||
static void my_numbox_draw_config(t_my_numbox* x,t_glist* glist)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
(void) x;
|
||||
(void) glist;
|
||||
#else /* ROCKBOX */
|
||||
t_canvas *canvas=glist_getcanvas(glist);
|
||||
|
||||
sys_vgui(".x%x.c itemconfigure %xLABEL -font {%s %d bold} -fill #%6.6x -text {%s} \n",
|
||||
|
@ -279,10 +315,16 @@ static void my_numbox_draw_config(t_my_numbox* x,t_glist* glist)
|
|||
x, x->x_gui.x_bcol);
|
||||
sys_vgui(".x%x.c itemconfigure %xBASE2 -fill #%6.6x\n", canvas,
|
||||
x, x->x_gui.x_fsf.x_selected?IEM_GUI_COLOR_SELECTED:x->x_gui.x_fcol);
|
||||
#endif /* ROCKBOX */
|
||||
}
|
||||
|
||||
static void my_numbox_draw_io(t_my_numbox* x,t_glist* glist, int old_snd_rcv_flags)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
(void) x;
|
||||
(void) glist;
|
||||
(void) old_snd_rcv_flags;
|
||||
#else /* ROCKBOX */
|
||||
int xpos=text_xpix(&x->x_gui.x_obj, glist);
|
||||
int ypos=text_ypix(&x->x_gui.x_obj, glist);
|
||||
t_canvas *canvas=glist_getcanvas(glist);
|
||||
|
@ -303,10 +345,15 @@ static void my_numbox_draw_io(t_my_numbox* x,t_glist* glist, int old_snd_rcv_fla
|
|||
x, 0);
|
||||
if(!(old_snd_rcv_flags & IEM_GUI_OLD_RCV_FLAG) && x->x_gui.x_fsf.x_rcv_able)
|
||||
sys_vgui(".x%x.c delete %xIN%d\n", canvas, x, 0);
|
||||
#endif /* ROCKBOX */
|
||||
}
|
||||
|
||||
static void my_numbox_draw_select(t_my_numbox *x, t_glist *glist)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
(void) x;
|
||||
(void) glist;
|
||||
#else /* ROCKBOX */
|
||||
t_canvas *canvas=glist_getcanvas(glist);
|
||||
|
||||
if(x->x_gui.x_fsf.x_selected)
|
||||
|
@ -338,6 +385,7 @@ static void my_numbox_draw_select(t_my_numbox *x, t_glist *glist)
|
|||
sys_vgui(".x%x.c itemconfigure %xNUMBER -fill #%6.6x\n",
|
||||
canvas, x, x->x_gui.x_fcol);
|
||||
}
|
||||
#endif /* ROCKBOX */
|
||||
}
|
||||
|
||||
void my_numbox_draw(t_my_numbox *x, t_glist *glist, int mode)
|
||||
|
@ -440,6 +488,10 @@ int my_numbox_check_minmax(t_my_numbox *x, double min, double max)
|
|||
|
||||
static void my_numbox_properties(t_gobj *z, t_glist *owner)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
(void) z;
|
||||
(void) owner;
|
||||
#else /* ROCKBOX */
|
||||
t_my_numbox *x = (t_my_numbox *)z;
|
||||
char buf[800];
|
||||
t_symbol *srl[3];
|
||||
|
@ -471,6 +523,7 @@ static void my_numbox_properties(t_gobj *z, t_glist *owner)
|
|||
0xffffff & x->x_gui.x_bcol, 0xffffff & x->x_gui.x_fcol,
|
||||
0xffffff & x->x_gui.x_lcol);
|
||||
gfxstub_new(&x->x_gui.x_obj.ob_pd, x, buf);
|
||||
#endif /* ROCKBOX */
|
||||
}
|
||||
|
||||
static void my_numbox_bang(t_my_numbox *x)
|
||||
|
@ -492,6 +545,10 @@ static void my_numbox_dialog(t_my_numbox *x, t_symbol *s, int argc,
|
|||
int log_height = (int)atom_getintarg(6, argc, argv);
|
||||
int sr_flags;
|
||||
|
||||
#ifdef ROCKBOX
|
||||
(void) s;
|
||||
#endif
|
||||
|
||||
if(lilo != 0) lilo = 1;
|
||||
x->x_lin0_log1 = lilo;
|
||||
sr_flags = iemgui_dialog(&x->x_gui, srl, argc, argv);
|
||||
|
@ -519,6 +576,10 @@ static void my_numbox_motion(t_my_numbox *x, t_floatarg dx, t_floatarg dy)
|
|||
{
|
||||
double k2=1.0;
|
||||
|
||||
#ifdef ROCKBOX
|
||||
(void) dx;
|
||||
#endif
|
||||
|
||||
if(x->x_gui.x_fsf.x_finemoved)
|
||||
k2 = 0.01;
|
||||
if(x->x_lin0_log1)
|
||||
|
@ -534,6 +595,11 @@ static void my_numbox_motion(t_my_numbox *x, t_floatarg dx, t_floatarg dy)
|
|||
static void my_numbox_click(t_my_numbox *x, t_floatarg xpos, t_floatarg ypos,
|
||||
t_floatarg shift, t_floatarg ctrl, t_floatarg alt)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
(void) shift;
|
||||
(void) ctrl;
|
||||
(void) alt;
|
||||
#endif
|
||||
glist_grab(x->x_gui.x_glist, &x->x_gui.x_obj.te_g,
|
||||
(t_glistmotionfn)my_numbox_motion, my_numbox_key, xpos, ypos);
|
||||
}
|
||||
|
@ -543,6 +609,11 @@ static int my_numbox_newclick(t_gobj *z, struct _glist *glist,
|
|||
{
|
||||
t_my_numbox* x = (t_my_numbox *)z;
|
||||
|
||||
#ifdef ROCKBOX
|
||||
(void) glist;
|
||||
(void) dbl;
|
||||
#endif
|
||||
|
||||
if(doit)
|
||||
{
|
||||
my_numbox_click( x, (t_floatarg)xpix, (t_floatarg)ypix,
|
||||
|
@ -603,6 +674,10 @@ static void my_numbox_size(t_my_numbox *x, t_symbol *s, int ac, t_atom *av)
|
|||
{
|
||||
int h, w;
|
||||
|
||||
#ifdef ROCKBOX
|
||||
(void) s;
|
||||
#endif
|
||||
|
||||
w = (int)atom_getintarg(0, ac, av);
|
||||
if(w < 1)
|
||||
w = 1;
|
||||
|
@ -626,6 +701,9 @@ static void my_numbox_pos(t_my_numbox *x, t_symbol *s, int ac, t_atom *av)
|
|||
|
||||
static void my_numbox_range(t_my_numbox *x, t_symbol *s, int ac, t_atom *av)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
(void) s;
|
||||
#endif
|
||||
if(my_numbox_check_minmax(x, (double)atom_getfloatarg(0, ac, av),
|
||||
(double)atom_getfloatarg(1, ac, av)))
|
||||
{
|
||||
|
@ -742,6 +820,9 @@ static void my_numbox_key(void *z, t_floatarg fkey)
|
|||
|
||||
static void my_numbox_list(t_my_numbox *x, t_symbol *s, int ac, t_atom *av)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
(void) s;
|
||||
#endif
|
||||
if (IS_A_FLOAT(av,0))
|
||||
{
|
||||
my_numbox_set(x, atom_getfloatarg(0, ac, av));
|
||||
|
@ -754,11 +835,21 @@ static void *my_numbox_new(t_symbol *s, int argc, t_atom *argv)
|
|||
t_my_numbox *x = (t_my_numbox *)pd_new(my_numbox_class);
|
||||
int bflcol[]={-262144, -1, -1};
|
||||
int w=5, h=14;
|
||||
#ifdef ROCKBOX
|
||||
int lilo=0, ldx=0, ldy=-6;
|
||||
#else
|
||||
int lilo=0, f=0, ldx=0, ldy=-6;
|
||||
#endif
|
||||
int fs=10;
|
||||
int log_height=256;
|
||||
double min=-1.0e+37, max=1.0e+37,v=0.0;
|
||||
#ifndef ROCKBOX
|
||||
char str[144];
|
||||
#endif
|
||||
|
||||
#ifdef ROCKBOX
|
||||
(void) s;
|
||||
#endif
|
||||
|
||||
if((argc >= 17)&&IS_A_FLOAT(argv,0)&&IS_A_FLOAT(argv,1)
|
||||
&&IS_A_FLOAT(argv,2)&&IS_A_FLOAT(argv,3)
|
||||
|
@ -843,7 +934,9 @@ static void my_numbox_free(t_my_numbox *x)
|
|||
pd_unbind(&x->x_gui.x_obj.ob_pd, x->x_gui.x_rcv);
|
||||
clock_free(x->x_clock_reset);
|
||||
clock_free(x->x_clock_wait);
|
||||
#ifndef ROCKBOX
|
||||
gfxstub_deleteforkey(x);
|
||||
#endif
|
||||
}
|
||||
|
||||
void g_numbox_setup(void)
|
||||
|
|
|
@ -8,18 +8,29 @@ collection of "scalar" objects. Routines here can save collections of
|
|||
scalars into a file and reload them; also, support is included here for
|
||||
*/
|
||||
|
||||
#ifdef ROCKBOX
|
||||
#include "plugin.h"
|
||||
#include "pdbox.h"
|
||||
#include "m_pd.h"
|
||||
#include "g_canvas.h"
|
||||
#else /* ROCKBOX */
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include "m_pd.h"
|
||||
#include "g_canvas.h"
|
||||
#include <string.h>
|
||||
#endif /* ROCKBOX */
|
||||
|
||||
/* the following routines read "scalars" from a file into a canvas. */
|
||||
|
||||
static int canvas_scanbinbuf(int natoms, t_atom *vec, int *p_indexout,
|
||||
int *p_next)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
int i;
|
||||
#else
|
||||
int i, j;
|
||||
#endif
|
||||
int indexwas = *p_next;
|
||||
*p_indexout = indexwas;
|
||||
if (indexwas >= natoms)
|
||||
|
@ -38,6 +49,9 @@ int glist_readscalar(t_glist *x, int natoms, t_atom *vec,
|
|||
static void canvas_readerror(int natoms, t_atom *vec, int message,
|
||||
int nline, char *s)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
(void) natoms;
|
||||
#endif
|
||||
error(s);
|
||||
startpost("line was:");
|
||||
postatom(nline, vec + message);
|
||||
|
@ -49,7 +63,11 @@ static void canvas_readerror(int natoms, t_atom *vec, int message,
|
|||
static void glist_readatoms(t_glist *x, int natoms, t_atom *vec,
|
||||
int *p_nextmsg, t_symbol *templatesym, t_word *w, int argc, t_atom *argv)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
int message, n, i;
|
||||
#else
|
||||
int message, nline, n, i;
|
||||
#endif
|
||||
|
||||
t_template *template = template_findbyname(templatesym);
|
||||
if (!template)
|
||||
|
@ -64,7 +82,9 @@ static void glist_readatoms(t_glist *x, int natoms, t_atom *vec,
|
|||
{
|
||||
if (template->t_vec[i].ds_type == DT_ARRAY)
|
||||
{
|
||||
#ifndef ROCKBOX
|
||||
int j;
|
||||
#endif
|
||||
t_array *a = w[i].w_array;
|
||||
int elemsize = a->a_elemsize, nitems = 0;
|
||||
t_symbol *arraytemplatesym = template->t_vec[i].ds_arraytemplate;
|
||||
|
@ -104,7 +124,11 @@ static void glist_readatoms(t_glist *x, int natoms, t_atom *vec,
|
|||
int glist_readscalar(t_glist *x, int natoms, t_atom *vec,
|
||||
int *p_nextmsg, int selectit)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
int message, nline;
|
||||
#else
|
||||
int message, i, j, nline;
|
||||
#endif
|
||||
t_template *template;
|
||||
t_symbol *templatesym;
|
||||
t_scalar *sc;
|
||||
|
@ -159,10 +183,16 @@ int glist_readscalar(t_glist *x, int natoms, t_atom *vec,
|
|||
|
||||
void glist_readfrombinbuf(t_glist *x, t_binbuf *b, char *filename, int selectem)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
int natoms, nline, message, nextmsg = 0;
|
||||
#else
|
||||
t_canvas *canvas = glist_getcanvas(x);
|
||||
int cr = 0, natoms, nline, message, nextmsg = 0, i, j, nitems;
|
||||
#endif
|
||||
t_atom *vec;
|
||||
#ifndef ROCKBOX
|
||||
t_gobj *gobj;
|
||||
#endif
|
||||
|
||||
natoms = binbuf_getnatom(b);
|
||||
vec = binbuf_getvec(b);
|
||||
|
@ -244,8 +274,12 @@ static void glist_doread(t_glist *x, t_symbol *filename, t_symbol *format,
|
|||
t_binbuf *b = binbuf_new();
|
||||
t_canvas *canvas = glist_getcanvas(x);
|
||||
int wasvis = glist_isvisible(canvas);
|
||||
#ifdef ROCKBOX
|
||||
int cr = 0;
|
||||
#else
|
||||
int cr = 0, natoms, nline, message, nextmsg = 0, i, j;
|
||||
t_atom *vec;
|
||||
#endif
|
||||
|
||||
if (!strcmp(format->s_name, "cr"))
|
||||
cr = 1;
|
||||
|
@ -302,7 +336,7 @@ void canvas_dataproperties(t_canvas *x, t_scalar *sc, t_binbuf *b)
|
|||
/* take the new object off the list */
|
||||
if (ntotal)
|
||||
{
|
||||
for (y = x->gl_list, nnew = 1; y2 = y->g_next;
|
||||
for(y = x->gl_list, nnew = 1; (y2 = y->g_next);
|
||||
y = y2, nnew++)
|
||||
if (nnew == ntotal)
|
||||
{
|
||||
|
@ -360,7 +394,9 @@ static void glist_writelist(t_gobj *y, t_binbuf *b);
|
|||
void canvas_writescalar(t_symbol *templatesym, t_word *w, t_binbuf *b,
|
||||
int amarrayelement)
|
||||
{
|
||||
#ifndef ROCKBOX
|
||||
t_dataslot *ds;
|
||||
#endif
|
||||
t_template *template = template_findbyname(templatesym);
|
||||
t_atom *a = (t_atom *)t_getbytes(0);
|
||||
int i, n = template->t_n, natom = 0;
|
||||
|
@ -532,12 +568,18 @@ t_binbuf *glist_writetobinbuf(t_glist *x, int wholething)
|
|||
|
||||
static void glist_write(t_glist *x, t_symbol *filename, t_symbol *format)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
int cr = 0;
|
||||
#else
|
||||
int cr = 0, i;
|
||||
#endif
|
||||
t_binbuf *b;
|
||||
char buf[MAXPDSTRING];
|
||||
#ifndef ROCKBOX
|
||||
t_symbol **templatevec = getbytes(0);
|
||||
int ntemplates = 0;
|
||||
t_gobj *y;
|
||||
#endif
|
||||
t_canvas *canvas = glist_getcanvas(x);
|
||||
canvas_makefilename(canvas, filename->s_name, buf, MAXPDSTRING);
|
||||
if (!strcmp(format->s_name, "cr"))
|
||||
|
@ -586,7 +628,7 @@ static void canvas_saveto(t_canvas *x, t_binbuf *b)
|
|||
gobj_save(y, b);
|
||||
|
||||
linetraverser_start(&t, x);
|
||||
while (oc = linetraverser_next(&t))
|
||||
while((oc = linetraverser_next(&t)))
|
||||
{
|
||||
int srcno = canvas_getindex(x, &t.tr_ob->ob_g);
|
||||
int sinkno = canvas_getindex(x, &t.tr_ob2->ob_g);
|
||||
|
@ -629,7 +671,9 @@ static void canvas_savetemplatesto(t_canvas *x, t_binbuf *b, int wholething)
|
|||
{
|
||||
t_symbol **templatevec = getbytes(0);
|
||||
int i, ntemplates = 0;
|
||||
#ifndef ROCKBOX
|
||||
t_gobj *y;
|
||||
#endif
|
||||
canvas_collecttemplatesfor(x, &ntemplates, &templatevec, wholething);
|
||||
for (i = 0; i < ntemplates; i++)
|
||||
{
|
||||
|
@ -687,9 +731,13 @@ static void canvas_savetofile(t_canvas *x, t_symbol *filename, t_symbol *dir)
|
|||
|
||||
static void canvas_menusaveas(t_canvas *x)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
(void) x;
|
||||
#else /* ROCKBOX */
|
||||
t_canvas *x2 = canvas_getrootfor(x);
|
||||
sys_vgui("pdtk_canvas_saveas .x%x \"%s\" \"%s\"\n", x2,
|
||||
x2->gl_name->s_name, canvas_getdir(x2)->s_name);
|
||||
#endif /* ROCKBOX */
|
||||
}
|
||||
|
||||
static void canvas_menusave(t_canvas *x)
|
||||
|
|
|
@ -6,6 +6,14 @@
|
|||
/* have to insert gui-objects into editor-list */
|
||||
/* all changes are labeled with iemlib */
|
||||
|
||||
#ifdef ROCKBOX
|
||||
#include "plugin.h"
|
||||
#include "ctype.h"
|
||||
#include "pdbox.h"
|
||||
#include "m_pd.h"
|
||||
#include "g_canvas.h"
|
||||
#define snprintf rb->snprintf
|
||||
#else /* ROCKBOX */
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
|
@ -14,6 +22,7 @@
|
|||
#include "s_stuff.h"
|
||||
#include "g_canvas.h"
|
||||
#include "t_tk.h"
|
||||
#endif /* ROCKBOX */
|
||||
|
||||
#define LMARGIN 1
|
||||
#define RMARGIN 1
|
||||
|
@ -44,7 +53,9 @@ struct _rtext
|
|||
t_rtext *rtext_new(t_glist *glist, t_text *who)
|
||||
{
|
||||
t_rtext *x = (t_rtext *)getbytes(sizeof *x);
|
||||
#ifndef ROCKBOX
|
||||
int w = 0, h = 0, indx;
|
||||
#endif
|
||||
x->x_height = -1;
|
||||
x->x_text = who;
|
||||
x->x_glist = glist;
|
||||
|
@ -53,8 +64,13 @@ t_rtext *rtext_new(t_glist *glist, t_text *who)
|
|||
x->x_drawnwidth = x->x_drawnheight = 0;
|
||||
binbuf_gettext(who->te_binbuf, &x->x_buf, &x->x_bufsize);
|
||||
glist->gl_editor->e_rtext = x;
|
||||
#ifdef ROCKBOX
|
||||
snprintf(x->x_tag, strlen(x->x_tag),
|
||||
".x%x.t%x", (t_int)glist_getcanvas(x->x_glist), (t_int)x);
|
||||
#else /* ROCKBOX */
|
||||
sprintf(x->x_tag, ".x%x.t%x", (t_int)glist_getcanvas(x->x_glist),
|
||||
(t_int)x);
|
||||
#endif /* ROCKBOX */
|
||||
return (x);
|
||||
}
|
||||
|
||||
|
@ -149,12 +165,18 @@ static void rtext_senditup(t_rtext *x, int action, int *widthp, int *heightp,
|
|||
char tempbuf[UPBUFSIZE], *tp = tempbuf, *bp = x->x_buf;
|
||||
int outchars, inchars = x->x_bufsize, nlines = 0, ncolumns = 0,
|
||||
pixwide, pixhigh;
|
||||
#ifdef ROCKBOX
|
||||
int fontwidth = 8, fontheight = 10;
|
||||
#else
|
||||
int font = glist_getfont(x->x_glist);
|
||||
int fontwidth = sys_fontwidth(font), fontheight = sys_fontheight(font);
|
||||
#endif
|
||||
int findx = (*widthp + (fontwidth/2)) / fontwidth,
|
||||
findy = *heightp / fontheight;
|
||||
int reportedindex = 0;
|
||||
#ifndef ROCKBOX
|
||||
t_canvas *canvas = glist_getcanvas(x->x_glist);
|
||||
#endif
|
||||
int widthspec = x->x_text->te_width;
|
||||
int widthlimit = (widthspec ? widthspec : BOXWIDTH);
|
||||
while (inchars)
|
||||
|
@ -214,16 +236,22 @@ static void rtext_senditup(t_rtext *x, int action, int *widthp, int *heightp,
|
|||
pixhigh = nlines * fontheight + (TMARGIN + BMARGIN);
|
||||
|
||||
if (action == SEND_FIRST)
|
||||
#ifdef ROCKBOX
|
||||
;
|
||||
#else /* ROCKBOX */
|
||||
sys_vgui("pdtk_text_new .x%x.c %s %f %f {%.*s} %d %s\n",
|
||||
canvas, x->x_tag,
|
||||
dispx + LMARGIN, dispy + TMARGIN,
|
||||
outchars, tempbuf, sys_hostfontsize(font),
|
||||
(glist_isselected(x->x_glist,
|
||||
&x->x_glist->gl_gobj)? "blue" : "black"));
|
||||
#endif /* ROCKBOX */
|
||||
else if (action == SEND_UPDATE)
|
||||
{
|
||||
#ifndef ROCKBOX
|
||||
sys_vgui("pdtk_text_set .x%x.c %s {%.*s}\n",
|
||||
canvas, x->x_tag, outchars, tempbuf);
|
||||
#endif
|
||||
if (pixwide != x->x_drawnwidth || pixhigh != x->x_drawnheight)
|
||||
text_drawborder(x->x_text, x->x_glist, x->x_tag,
|
||||
pixwide, pixhigh, 0);
|
||||
|
@ -231,18 +259,22 @@ static void rtext_senditup(t_rtext *x, int action, int *widthp, int *heightp,
|
|||
{
|
||||
if (x->x_selend > x->x_selstart)
|
||||
{
|
||||
#ifndef ROCKBOX
|
||||
sys_vgui(".x%x.c select from %s %d\n", canvas,
|
||||
x->x_tag, x->x_selstart);
|
||||
sys_vgui(".x%x.c select to %s %d\n", canvas,
|
||||
x->x_tag, x->x_selend + (sys_oldtclversion ? 0 : -1));
|
||||
sys_vgui(".x%x.c focus \"\"\n", canvas);
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
#ifndef ROCKBOX
|
||||
sys_vgui(".x%x.c select clear\n", canvas);
|
||||
sys_vgui(".x%x.c icursor %s %d\n", canvas, x->x_tag,
|
||||
x->x_selstart);
|
||||
sys_vgui(".x%x.c focus %s\n", canvas, x->x_tag);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -273,7 +305,9 @@ void rtext_retext(t_rtext *x)
|
|||
int wantreduce = bufsize - text->te_width;
|
||||
char *decimal = 0, *nextchar, *ebuf = x->x_buf + bufsize,
|
||||
*s1, *s2;
|
||||
#ifndef ROCKBOX
|
||||
int ndecimals;
|
||||
#endif
|
||||
for (decimal = x->x_buf; decimal < ebuf; decimal++)
|
||||
if (*decimal == '.')
|
||||
break;
|
||||
|
@ -339,21 +373,35 @@ void rtext_draw(t_rtext *x)
|
|||
|
||||
void rtext_erase(t_rtext *x)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
(void) x;
|
||||
#else
|
||||
sys_vgui(".x%x.c delete %s\n", glist_getcanvas(x->x_glist), x->x_tag);
|
||||
#endif
|
||||
}
|
||||
|
||||
void rtext_displace(t_rtext *x, int dx, int dy)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
(void) x;
|
||||
(void) dx;
|
||||
(void) dy;
|
||||
#else /* ROCKBOX */
|
||||
sys_vgui(".x%x.c move %s %d %d\n", glist_getcanvas(x->x_glist),
|
||||
x->x_tag, dx, dy);
|
||||
#endif /* ROCKBOX */
|
||||
}
|
||||
|
||||
void rtext_select(t_rtext *x, int state)
|
||||
{
|
||||
t_glist *glist = x->x_glist;
|
||||
t_canvas *canvas = glist_getcanvas(glist);
|
||||
#ifdef ROCKBOX
|
||||
(void) state;
|
||||
#else /* ROCKBOX */
|
||||
sys_vgui(".x%x.c itemconfigure %s -fill %s\n", canvas,
|
||||
x->x_tag, (state? "blue" : "black"));
|
||||
#endif /* ROCKBOX */
|
||||
canvas_editing = canvas;
|
||||
}
|
||||
|
||||
|
@ -361,10 +409,14 @@ void rtext_activate(t_rtext *x, int state)
|
|||
{
|
||||
int w = 0, h = 0, indx;
|
||||
t_glist *glist = x->x_glist;
|
||||
#ifndef ROCKBOX
|
||||
t_canvas *canvas = glist_getcanvas(glist);
|
||||
#endif
|
||||
if (state)
|
||||
{
|
||||
#ifndef ROCKBOX
|
||||
sys_vgui(".x%x.c focus %s\n", canvas, x->x_tag);
|
||||
#endif
|
||||
glist->gl_editor->e_textedfor = x;
|
||||
glist->gl_editor->e_textdirty = 0;
|
||||
x->x_dragfrom = x->x_selstart = 0;
|
||||
|
@ -373,8 +425,10 @@ void rtext_activate(t_rtext *x, int state)
|
|||
}
|
||||
else
|
||||
{
|
||||
#ifndef ROCKBOX
|
||||
sys_vgui("selection clear .x%x.c\n", canvas);
|
||||
sys_vgui(".x%x.c focus \"\"\n", canvas);
|
||||
#endif
|
||||
if (glist->gl_editor->e_textedfor == x)
|
||||
glist->gl_editor->e_textedfor = 0;
|
||||
x->x_active = 0;
|
||||
|
@ -385,7 +439,9 @@ void rtext_activate(t_rtext *x, int state)
|
|||
void rtext_key(t_rtext *x, int keynum, t_symbol *keysym)
|
||||
{
|
||||
int w = 0, h = 0, indx, i, newsize, ndel;
|
||||
#ifndef ROCKBOX
|
||||
char *s1, *s2;
|
||||
#endif
|
||||
if (keynum)
|
||||
{
|
||||
int n = keynum;
|
||||
|
|
|
@ -19,11 +19,18 @@ control their appearances by adding stuff to draw.
|
|||
* added Krzysztof Czajas fix to avoid crashing...
|
||||
*/
|
||||
|
||||
#ifdef ROCKBOX
|
||||
#include "plugin.h"
|
||||
#include "pdbox.h"
|
||||
#include "m_pd.h"
|
||||
#include "g_canvas.h"
|
||||
#else /* ROCKBOX */
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h> /* for read/write to files */
|
||||
#include "m_pd.h"
|
||||
#include "g_canvas.h"
|
||||
#endif /* ROCKBOX */
|
||||
|
||||
t_class *scalar_class;
|
||||
|
||||
|
@ -139,6 +146,9 @@ void glist_scalar(t_glist *glist,
|
|||
t_binbuf *b;
|
||||
int natoms, nextmsg = 0;
|
||||
t_atom *vec;
|
||||
#ifdef ROCKBOX
|
||||
(void) classname;
|
||||
#endif
|
||||
if (!template_findbyname(templatesym))
|
||||
{
|
||||
pd_error(glist, "%s: no such template",
|
||||
|
@ -167,7 +177,9 @@ static void scalar_getrect(t_gobj *z, t_glist *owner,
|
|||
int *xp1, int *yp1, int *xp2, int *yp2)
|
||||
{
|
||||
t_scalar *x = (t_scalar *)z;
|
||||
#ifndef ROCKBOX
|
||||
int hit = 0;
|
||||
#endif
|
||||
t_template *template = template_findbyname(x->sc_template);
|
||||
t_canvas *templatecanvas = template_findcanvas(template);
|
||||
int x1 = 0x7fffffff, x2 = -0x7fffffff, y1 = 0x7fffffff, y2 = -0x7fffffff;
|
||||
|
@ -213,7 +225,9 @@ static void scalar_getrect(t_gobj *z, t_glist *owner,
|
|||
|
||||
static void scalar_select(t_gobj *z, t_glist *owner, int state)
|
||||
{
|
||||
#ifndef ROCKBOX
|
||||
t_scalar *x = (t_scalar *)z;
|
||||
#endif
|
||||
/* post("scalar_select %d", state); */
|
||||
/* later */
|
||||
if (state)
|
||||
|
@ -221,12 +235,16 @@ static void scalar_select(t_gobj *z, t_glist *owner, int state)
|
|||
int x1, y1, x2, y2;
|
||||
scalar_getrect(z, owner, &x1, &y1, &x2, &y2);
|
||||
x1--; x2++; y1--; y2++;
|
||||
#ifndef ROCKBOX
|
||||
sys_vgui(".x%x.c create line %d %d %d %d %d %d %d %d %d %d \
|
||||
-width 0 -fill blue -tags select%x\n",
|
||||
glist_getcanvas(owner), x1, y1, x1, y2, x2, y2, x2, y1, x1, y1,
|
||||
x);
|
||||
#endif
|
||||
}
|
||||
#ifndef ROCKBOX
|
||||
else sys_vgui(".x%x.c delete select%x\n", glist_getcanvas(owner), x);
|
||||
#endif
|
||||
}
|
||||
|
||||
static void scalar_displace(t_gobj *z, t_glist *glist, int dx, int dy)
|
||||
|
@ -263,12 +281,21 @@ static void scalar_displace(t_gobj *z, t_glist *glist, int dx, int dy)
|
|||
|
||||
static void scalar_activate(t_gobj *z, t_glist *owner, int state)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
(void) z;
|
||||
(void) owner;
|
||||
(void) state;
|
||||
#endif
|
||||
/* post("scalar_activate %d", state); */
|
||||
/* later */
|
||||
}
|
||||
|
||||
static void scalar_delete(t_gobj *z, t_glist *glist)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
(void) z;
|
||||
(void) glist;
|
||||
#endif
|
||||
/* nothing to do */
|
||||
}
|
||||
|
||||
|
@ -285,12 +312,16 @@ static void scalar_vis(t_gobj *z, t_glist *owner, int vis)
|
|||
{
|
||||
if (vis)
|
||||
{
|
||||
#ifndef ROCKBOX
|
||||
int x1 = glist_xtopixels(owner, basex);
|
||||
int y1 = glist_ytopixels(owner, basey);
|
||||
sys_vgui(".x%x.c create rectangle %d %d %d %d -tags scalar%x\n",
|
||||
glist_getcanvas(owner), x1-1, y1-1, x1+1, y1+1, x);
|
||||
#endif
|
||||
}
|
||||
#ifndef ROCKBOX
|
||||
else sys_vgui(".x%x.c delete scalar%x\n", glist_getcanvas(owner), x);
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -316,9 +347,9 @@ static int scalar_click(t_gobj *z, struct _glist *owner,
|
|||
{
|
||||
t_parentwidgetbehavior *wb = pd_getparentwidget(&y->g_pd);
|
||||
if (!wb) continue;
|
||||
if (hit = (*wb->w_parentclickfn)(y, owner,
|
||||
if((hit = (*wb->w_parentclickfn)(y, owner,
|
||||
x, template, basex, basey,
|
||||
xpix, ypix, shift, alt, dbl, doit))
|
||||
xpix, ypix, shift, alt, dbl, doit)))
|
||||
return (hit);
|
||||
}
|
||||
return (0);
|
||||
|
@ -331,8 +362,10 @@ static void scalar_save(t_gobj *z, t_binbuf *b)
|
|||
{
|
||||
t_scalar *x = (t_scalar *)z;
|
||||
t_binbuf *b2 = binbuf_new();
|
||||
#ifndef ROCKBOX
|
||||
t_atom a, *argv;
|
||||
int i, argc;
|
||||
#endif
|
||||
canvas_writescalar(x->sc_template, x->sc_vec, b2, 0);
|
||||
binbuf_addv(b, "ss", &s__X, gensym("scalar"));
|
||||
binbuf_addbinbuf(b, b2);
|
||||
|
@ -342,6 +375,10 @@ static void scalar_save(t_gobj *z, t_binbuf *b)
|
|||
|
||||
static void scalar_properties(t_gobj *z, struct _glist *owner)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
(void) z;
|
||||
(void) owner;
|
||||
#else /* ROCKBOX */
|
||||
t_scalar *x = (t_scalar *)z;
|
||||
char *buf, buf2[80];
|
||||
int bufsize;
|
||||
|
@ -358,6 +395,7 @@ static void scalar_properties(t_gobj *z, struct _glist *owner)
|
|||
sys_gui(buf);
|
||||
sys_gui("}\n");
|
||||
t_freebytes(buf, bufsize+1);
|
||||
#endif /* ROCKBOX */
|
||||
}
|
||||
|
||||
static t_widgetbehavior scalar_widgetbehavior =
|
||||
|
@ -373,8 +411,10 @@ static t_widgetbehavior scalar_widgetbehavior =
|
|||
|
||||
static void scalar_free(t_scalar *x)
|
||||
{
|
||||
#ifndef ROCKBOX
|
||||
int i;
|
||||
t_dataslot *datatypes, *dt;
|
||||
#endif
|
||||
t_symbol *templatesym = x->sc_template;
|
||||
t_template *template = template_findbyname(templatesym);
|
||||
if (!template)
|
||||
|
@ -383,7 +423,9 @@ static void scalar_free(t_scalar *x)
|
|||
return;
|
||||
}
|
||||
word_free(x->sc_vec, template);
|
||||
#ifndef ROCKBOX
|
||||
gfxstub_deleteforkey(x);
|
||||
#endif
|
||||
/* the "size" field in the class is zero, so Pd doesn't try to free
|
||||
us automatically (see pd_free()) */
|
||||
freebytes(x, sizeof(t_scalar) + (template->t_n - 1) * sizeof(*x->sc_vec));
|
||||
|
|
|
@ -2,6 +2,14 @@
|
|||
* For information on usage and redistribution, and for a DISCLAIMER OF ALL
|
||||
* WARRANTIES, see the file, "LICENSE.txt," in this distribution. */
|
||||
|
||||
#ifdef ROCKBOX
|
||||
#include "plugin.h"
|
||||
#include "pdbox.h"
|
||||
#include "m_pd.h"
|
||||
#include "s_stuff.h"
|
||||
#include "g_canvas.h"
|
||||
#define snprintf rb->snprintf
|
||||
#else /* ROCKBOX */
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
|
@ -9,6 +17,7 @@
|
|||
#include "m_pd.h"
|
||||
#include "s_stuff.h" /* for sys_hostfontsize */
|
||||
#include "g_canvas.h"
|
||||
#endif /* ROCKBOX */
|
||||
|
||||
/*
|
||||
This file contains text objects you would put in a canvas to define a
|
||||
|
@ -140,7 +149,9 @@ int template_size(t_template *x)
|
|||
int template_find_field(t_template *x, t_symbol *name, int *p_onset,
|
||||
int *p_type, t_symbol **p_arraytype)
|
||||
{
|
||||
#ifndef ROCKBOX
|
||||
t_template *t;
|
||||
#endif
|
||||
int i, n;
|
||||
if (!x)
|
||||
{
|
||||
|
@ -262,7 +273,13 @@ elements might still be old ones.
|
|||
static void template_conformwords(t_template *tfrom, t_template *tto,
|
||||
int *conformaction, t_word *wfrom, t_word *wto)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
int nto = tto->t_n, i;
|
||||
|
||||
(void) tfrom;
|
||||
#else
|
||||
int nfrom = tfrom->t_n, nto = tto->t_n, i;
|
||||
#endif
|
||||
for (i = 0; i < nto; i++)
|
||||
{
|
||||
if (conformaction[i] >= 0)
|
||||
|
@ -282,7 +299,11 @@ static t_scalar *template_conformscalar(t_template *tfrom, t_template *tto,
|
|||
{
|
||||
t_scalar *x;
|
||||
t_gpointer gp;
|
||||
#ifdef ROCKBOX
|
||||
int i;
|
||||
#else
|
||||
int nto = tto->t_n, nfrom = tfrom->t_n, i;
|
||||
#endif
|
||||
t_template *scalartemplate;
|
||||
/* post("conform scalar"); */
|
||||
/* possibly replace the scalar */
|
||||
|
@ -311,7 +332,7 @@ static t_scalar *template_conformscalar(t_template *tfrom, t_template *tto,
|
|||
else
|
||||
{
|
||||
t_gobj *y, *y2;
|
||||
for (y = glist->gl_list; y2 = y->g_next; y = y2)
|
||||
for (y = glist->gl_list; (y2 = y->g_next); y = y2)
|
||||
if (y2 == &scfrom->sc_gobj)
|
||||
{
|
||||
x->sc_gobj.g_next = y2->g_next;
|
||||
|
@ -447,7 +468,9 @@ void template_conform(t_template *tfrom, t_template *tto)
|
|||
|
||||
t_template *template_findbyname(t_symbol *s)
|
||||
{
|
||||
#ifndef ROCKBOX
|
||||
int i;
|
||||
#endif
|
||||
if (s == &s_float)
|
||||
return (&template_float);
|
||||
else return ((t_template *)pd_findbyclass(s, template_class));
|
||||
|
@ -477,6 +500,10 @@ static void *template_usetemplate(void *dummy, t_symbol *s,
|
|||
t_template *x;
|
||||
t_symbol *templatesym =
|
||||
canvas_makebindsym(atom_getsymbolarg(0, argc, argv));
|
||||
#ifdef ROCKBOX
|
||||
(void) dummy;
|
||||
(void) s;
|
||||
#endif
|
||||
if (!argc)
|
||||
return (0);
|
||||
argc--; argv++;
|
||||
|
@ -540,7 +567,9 @@ static void *gtemplate_donew(t_symbol *sym, int argc, t_atom *argv)
|
|||
t_gtemplate *x = (t_gtemplate *)pd_new(gtemplate_class);
|
||||
t_template *t = template_findbyname(sym);
|
||||
int i;
|
||||
#ifndef ROCKBOX
|
||||
t_symbol *sx = gensym("x");
|
||||
#endif
|
||||
x->x_owner = canvas_getcurrent();
|
||||
x->x_next = 0;
|
||||
x->x_sym = sym;
|
||||
|
@ -559,7 +588,7 @@ static void *gtemplate_donew(t_symbol *sym, int argc, t_atom *argv)
|
|||
if (t->t_list)
|
||||
{
|
||||
t_gtemplate *x2, *x3;
|
||||
for (x2 = x->x_template->t_list; x3 = x2->x_next; x2 = x3)
|
||||
for(x2 = x->x_template->t_list; (x3 = x2->x_next); x2 = x3)
|
||||
;
|
||||
x2->x_next = x;
|
||||
post("template %s: warning: already exists.", sym->s_name);
|
||||
|
@ -593,8 +622,13 @@ static void *gtemplate_donew(t_symbol *sym, int argc, t_atom *argv)
|
|||
|
||||
static void *gtemplate_new(t_symbol *s, int argc, t_atom *argv)
|
||||
{
|
||||
#ifndef ROCKBOX
|
||||
t_gtemplate *x = (t_gtemplate *)pd_new(gtemplate_class);
|
||||
#endif
|
||||
t_symbol *sym = atom_getsymbolarg(0, argc, argv);
|
||||
#ifdef ROCKBOX
|
||||
(void) s;
|
||||
#endif
|
||||
if (argc >= 1)
|
||||
argc--; argv++;
|
||||
return (gtemplate_donew(canvas_makebindsym(sym), argc, argv));
|
||||
|
@ -603,9 +637,14 @@ static void *gtemplate_new(t_symbol *s, int argc, t_atom *argv)
|
|||
/* old version (0.34) -- delete 2003 or so */
|
||||
static void *gtemplate_new_old(t_symbol *s, int argc, t_atom *argv)
|
||||
{
|
||||
#ifndef ROCKBOX
|
||||
t_gtemplate *x = (t_gtemplate *)pd_new(gtemplate_class);
|
||||
#endif
|
||||
t_symbol *sym = canvas_makebindsym(canvas_getcurrent()->gl_name);
|
||||
static int warned;
|
||||
#ifdef ROCKBOX
|
||||
(void) s;
|
||||
#endif
|
||||
if (!warned)
|
||||
{
|
||||
post("warning -- 'template' (%s) is obsolete; replace with 'struct'",
|
||||
|
@ -643,7 +682,7 @@ static void gtemplate_free(t_gtemplate *x)
|
|||
else
|
||||
{
|
||||
t_gtemplate *x2, *x3;
|
||||
for (x2 = t->t_list; x3 = x2->x_next; x2 = x3)
|
||||
for(x2 = t->t_list; (x3 = x2->x_next); x2 = x3)
|
||||
{
|
||||
if (x == x3)
|
||||
{
|
||||
|
@ -829,6 +868,16 @@ static void curve_displace(t_gobj *z, t_glist *glist,
|
|||
t_word *data, t_template *template, float basex, float basey,
|
||||
int dx, int dy)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
(void) z;
|
||||
(void) glist;
|
||||
(void) data;
|
||||
(void) template;
|
||||
(void) basex;
|
||||
(void) basey;
|
||||
(void) dx;
|
||||
(void) dy;
|
||||
#endif
|
||||
/* refuse */
|
||||
}
|
||||
|
||||
|
@ -836,6 +885,15 @@ static void curve_select(t_gobj *z, t_glist *glist,
|
|||
t_word *data, t_template *template, float basex, float basey,
|
||||
int state)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
(void) z;
|
||||
(void) glist;
|
||||
(void) data;
|
||||
(void) template;
|
||||
(void) basex;
|
||||
(void) basey;
|
||||
(void) state;
|
||||
#endif
|
||||
/* fill in later */
|
||||
}
|
||||
|
||||
|
@ -843,6 +901,15 @@ static void curve_activate(t_gobj *z, t_glist *glist,
|
|||
t_word *data, t_template *template, float basex, float basey,
|
||||
int state)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
(void) z;
|
||||
(void) glist;
|
||||
(void) data;
|
||||
(void) template;
|
||||
(void) basex;
|
||||
(void) basey;
|
||||
(void) state;
|
||||
#endif
|
||||
/* fill in later */
|
||||
}
|
||||
|
||||
|
@ -861,8 +928,13 @@ static void numbertocolor(int n, char *s)
|
|||
red = n / 100;
|
||||
blue = ((n / 10) % 10);
|
||||
green = n % 10;
|
||||
#ifdef ROCKBOX
|
||||
snprintf(s, 8, "#%2.2x%2.2x%2.2x",
|
||||
rangecolor(red), rangecolor(blue), rangecolor(green));
|
||||
#else
|
||||
sprintf(s, "#%2.2x%2.2x%2.2x", rangecolor(red), rangecolor(blue),
|
||||
rangecolor(green));
|
||||
#endif
|
||||
}
|
||||
|
||||
static void curve_vis(t_gobj *z, t_glist *glist,
|
||||
|
@ -873,11 +945,21 @@ static void curve_vis(t_gobj *z, t_glist *glist,
|
|||
int i, n = x->x_npoints;
|
||||
t_fielddesc *f = x->x_vec;
|
||||
|
||||
#ifdef ROCKBOX
|
||||
(void) glist;
|
||||
(void) basex;
|
||||
(void) basey;
|
||||
#endif
|
||||
|
||||
if (vis)
|
||||
{
|
||||
if (n > 1)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
int flags = x->x_flags;
|
||||
#else
|
||||
int flags = x->x_flags, closed = (flags & CLOSED);
|
||||
#endif
|
||||
float width = fielddesc_getfloat(&x->x_width, template, data, 1);
|
||||
char outline[20], fill[20];
|
||||
if (width < 1) width = 1;
|
||||
|
@ -889,19 +971,26 @@ static void curve_vis(t_gobj *z, t_glist *glist,
|
|||
numbertocolor(
|
||||
fielddesc_getfloat(&x->x_fillcolor, template, data, 1),
|
||||
fill);
|
||||
#ifndef ROCKBOX
|
||||
sys_vgui(".x%x.c create polygon\\\n",
|
||||
glist_getcanvas(glist));
|
||||
#endif
|
||||
}
|
||||
#ifndef ROCKBOX
|
||||
else sys_vgui(".x%x.c create line\\\n",
|
||||
glist_getcanvas(glist));
|
||||
#endif
|
||||
for (i = 0, f = x->x_vec; i < n; i++, f += 2)
|
||||
{
|
||||
#ifndef ROCKBOX
|
||||
float xloc = glist_xtopixels(glist,
|
||||
basex + fielddesc_getfloat(f, template, data, 1));
|
||||
float yloc = glist_ytopixels(glist,
|
||||
basey + fielddesc_getfloat(f+1, template, data, 1));
|
||||
sys_vgui("%d %d\\\n", (int)xloc, (int)yloc);
|
||||
#endif
|
||||
}
|
||||
#ifndef ROCKBOX
|
||||
sys_vgui("-width %f\\\n",
|
||||
fielddesc_getfloat(&x->x_width, template, data, 1));
|
||||
if (flags & CLOSED) sys_vgui("-fill %s -outline %s\\\n",
|
||||
|
@ -909,13 +998,16 @@ static void curve_vis(t_gobj *z, t_glist *glist,
|
|||
else sys_vgui("-fill %s\\\n", outline);
|
||||
if (flags & BEZ) sys_vgui("-smooth 1\\\n");
|
||||
sys_vgui("-tags curve%x\n", data);
|
||||
#endif
|
||||
}
|
||||
else post("warning: curves need at least two points to be graphed");
|
||||
}
|
||||
else
|
||||
{
|
||||
#ifndef ROCKBOX
|
||||
if (n > 1) sys_vgui(".x%x.c delete curve%x\n",
|
||||
glist_getcanvas(glist), data);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -969,6 +1061,13 @@ static int curve_click(t_gobj *z, t_glist *glist,
|
|||
int besterror = 0x7fffffff;
|
||||
t_fielddesc *f = x->x_vec;
|
||||
t_word *data = sc->sc_vec;
|
||||
|
||||
#ifdef ROCKBOX
|
||||
(void) shift;
|
||||
(void) alt;
|
||||
(void) dbl;
|
||||
#endif
|
||||
|
||||
for (i = 0, f = x->x_vec; i < n; i++, f += 2)
|
||||
{
|
||||
int xloc = glist_xtopixels(glist,
|
||||
|
@ -1060,9 +1159,16 @@ static void *plot_new(t_symbol *classsym, t_int argc, t_atom *argv)
|
|||
{
|
||||
t_plot *x = (t_plot *)pd_new(plot_class);
|
||||
int flags = 0;
|
||||
#ifndef ROCKBOX
|
||||
int nxy, i;
|
||||
t_fielddesc *fd;
|
||||
#endif
|
||||
t_symbol *firstarg = atom_getsymbolarg(0, argc, argv);
|
||||
|
||||
#ifdef ROCKBOX
|
||||
(void) classsym;
|
||||
#endif
|
||||
|
||||
if (!strcmp(firstarg->s_name, "curve"))
|
||||
{
|
||||
flags |= BEZ;
|
||||
|
@ -1132,7 +1238,11 @@ int array_getfields(t_symbol *elemtemplatesym,
|
|||
t_template **elemtemplatep, int *elemsizep,
|
||||
int *xonsetp, int *yonsetp, int *wonsetp)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
int elemsize, yonset, wonset, xonset, type;
|
||||
#else
|
||||
int arrayonset, elemsize, yonset, wonset, xonset, type;
|
||||
#endif
|
||||
t_template *elemtemplate;
|
||||
t_symbol *dummy;
|
||||
t_canvas *elemtemplatecanvas = 0;
|
||||
|
@ -1219,6 +1329,16 @@ static void plot_displace(t_gobj *z, t_glist *glist,
|
|||
t_word *data, t_template *template, float basex, float basey,
|
||||
int dx, int dy)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
(void) z;
|
||||
(void) glist;
|
||||
(void) data;
|
||||
(void) template;
|
||||
(void) basex;
|
||||
(void) basey;
|
||||
(void) dx;
|
||||
(void) dy;
|
||||
#endif
|
||||
/* not yet */
|
||||
}
|
||||
|
||||
|
@ -1226,6 +1346,15 @@ static void plot_select(t_gobj *z, t_glist *glist,
|
|||
t_word *data, t_template *template, float basex, float basey,
|
||||
int state)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
(void) z;
|
||||
(void) glist;
|
||||
(void) data;
|
||||
(void) template;
|
||||
(void) basex;
|
||||
(void) basey;
|
||||
(void) state;
|
||||
#endif
|
||||
/* not yet */
|
||||
}
|
||||
|
||||
|
@ -1233,6 +1362,15 @@ static void plot_activate(t_gobj *z, t_glist *glist,
|
|||
t_word *data, t_template *template, float basex, float basey,
|
||||
int state)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
(void) z;
|
||||
(void) glist;
|
||||
(void) data;
|
||||
(void) template;
|
||||
(void) basex;
|
||||
(void) basey;
|
||||
(void) state;
|
||||
#endif
|
||||
/* not yet */
|
||||
}
|
||||
|
||||
|
@ -1270,8 +1408,10 @@ static void plot_vis(t_gobj *z, t_glist *glist,
|
|||
{
|
||||
/* found "w" field which controls linewidth. The trace is
|
||||
a filled polygon with 2n points. */
|
||||
#ifndef ROCKBOX
|
||||
sys_vgui(".x%x.c create polygon \\\n",
|
||||
glist_getcanvas(glist));
|
||||
#endif
|
||||
|
||||
for (i = 0, xsum = xloc; i < nelem; i++)
|
||||
{
|
||||
|
@ -1287,9 +1427,11 @@ static void plot_vis(t_gobj *z, t_glist *glist,
|
|||
ixpix = xpix + 0.5;
|
||||
if (xonset >= 0 || ixpix != lastpixel)
|
||||
{
|
||||
#ifndef ROCKBOX
|
||||
sys_vgui("%d %f \\\n", ixpix,
|
||||
glist_ytopixels(glist,
|
||||
basey + yloc + yval - wval));
|
||||
#endif
|
||||
ndrawn++;
|
||||
}
|
||||
lastpixel = ixpix;
|
||||
|
@ -1310,8 +1452,10 @@ static void plot_vis(t_gobj *z, t_glist *glist,
|
|||
ixpix = xpix + 0.5;
|
||||
if (xonset >= 0 || ixpix != lastpixel)
|
||||
{
|
||||
#ifndef ROCKBOX
|
||||
sys_vgui("%d %f \\\n", ixpix, glist_ytopixels(glist,
|
||||
basey + yloc + yval + wval));
|
||||
#endif
|
||||
ndrawn++;
|
||||
}
|
||||
lastpixel = ixpix;
|
||||
|
@ -1321,23 +1465,31 @@ static void plot_vis(t_gobj *z, t_glist *glist,
|
|||
should be at least two already. */
|
||||
if (ndrawn < 4)
|
||||
{
|
||||
#ifndef ROCKBOX
|
||||
sys_vgui("%d %f \\\n", ixpix + 10, glist_ytopixels(glist,
|
||||
basey + yloc + yval + wval));
|
||||
sys_vgui("%d %f \\\n", ixpix + 10, glist_ytopixels(glist,
|
||||
basey + yloc + yval - wval));
|
||||
#endif
|
||||
}
|
||||
ouch:
|
||||
#ifdef ROCKBOX
|
||||
;
|
||||
#else /* ROCKBOX */
|
||||
sys_vgui(" -width 1 -fill %s -outline %s\\\n", outline, outline);
|
||||
if (x->x_flags & BEZ) sys_vgui("-smooth 1\\\n");
|
||||
|
||||
sys_vgui("-tags plot%x\n", data);
|
||||
#endif /* ROCKBOX */
|
||||
}
|
||||
else if (linewidth > 0)
|
||||
{
|
||||
/* no "w" field. If the linewidth is positive, draw a
|
||||
segmented line with the requested width; otherwise don't
|
||||
draw the trace at all. */
|
||||
#ifndef ROCKBOX
|
||||
sys_vgui(".x%x.c create line \\\n", glist_getcanvas(glist));
|
||||
#endif
|
||||
|
||||
for (xsum = xloc, i = 0; i < nelem; i++)
|
||||
{
|
||||
|
@ -1352,14 +1504,17 @@ static void plot_vis(t_gobj *z, t_glist *glist,
|
|||
ixpix = xpix + 0.5;
|
||||
if (xonset >= 0 || ixpix != lastpixel)
|
||||
{
|
||||
#ifndef ROCKBOX
|
||||
sys_vgui("%d %f \\\n", ixpix,
|
||||
glist_ytopixels(glist, basey + yloc + yval));
|
||||
#endif
|
||||
ndrawn++;
|
||||
}
|
||||
lastpixel = ixpix;
|
||||
if (ndrawn >= 1000) break;
|
||||
}
|
||||
/* TK will complain if there aren't at least 2 points... */
|
||||
#ifndef ROCKBOX
|
||||
if (ndrawn == 0) sys_vgui("0 0 0 0 \\\n");
|
||||
else if (ndrawn == 1) sys_vgui("%d %f \\\n", ixpix + 10,
|
||||
glist_ytopixels(glist, basey + yloc + yval));
|
||||
|
@ -1369,6 +1524,7 @@ static void plot_vis(t_gobj *z, t_glist *glist,
|
|||
if (x->x_flags & BEZ) sys_vgui("-smooth 1\\\n");
|
||||
|
||||
sys_vgui("-tags plot%x\n", data);
|
||||
#endif
|
||||
}
|
||||
/* We're done with the outline; now draw all the points.
|
||||
This code is inefficient since the template has to be
|
||||
|
@ -1413,8 +1569,10 @@ static void plot_vis(t_gobj *z, t_glist *glist,
|
|||
}
|
||||
}
|
||||
/* and then the trace */
|
||||
#ifndef ROCKBOX
|
||||
sys_vgui(".x%x.c delete plot%x\n",
|
||||
glist_getcanvas(glist), data);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1526,8 +1684,12 @@ static void drawnumber_getrect(t_gobj *z, t_glist *glist,
|
|||
basex + fielddesc_getfloat(&x->x_xloc, template, data, 0));
|
||||
int yloc = glist_ytopixels(glist,
|
||||
basey + fielddesc_getfloat(&x->x_yloc, template, data, 0));
|
||||
#ifdef ROCKBOX
|
||||
int fontwidth = 8, fontheight = 10;
|
||||
#else
|
||||
int font = glist_getfont(glist);
|
||||
int fontwidth = sys_fontwidth(font), fontheight = sys_fontheight(font);
|
||||
#endif
|
||||
char buf[DRAWNUMBER_BUFSIZE];
|
||||
if (x->x_flags & DRAW_SYMBOL)
|
||||
SETSYMBOL(&at, fielddesc_getsymbol(&x->x_value, template, data, 0));
|
||||
|
@ -1543,6 +1705,16 @@ static void drawnumber_displace(t_gobj *z, t_glist *glist,
|
|||
t_word *data, t_template *template, float basex, float basey,
|
||||
int dx, int dy)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
(void) z;
|
||||
(void) glist;
|
||||
(void) data;
|
||||
(void) template;
|
||||
(void) basex;
|
||||
(void) basey;
|
||||
(void) dx;
|
||||
(void) dy;
|
||||
#endif
|
||||
/* refuse */
|
||||
}
|
||||
|
||||
|
@ -1550,6 +1722,14 @@ static void drawnumber_select(t_gobj *z, t_glist *glist,
|
|||
t_word *data, t_template *template, float basex, float basey,
|
||||
int state)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
(void) z;
|
||||
(void) glist;
|
||||
(void) data;
|
||||
(void) template;
|
||||
(void) basex;
|
||||
(void) basey;
|
||||
#endif
|
||||
post("drawnumber_select %d", state);
|
||||
/* fill in later */
|
||||
}
|
||||
|
@ -1558,6 +1738,14 @@ static void drawnumber_activate(t_gobj *z, t_glist *glist,
|
|||
t_word *data, t_template *template, float basex, float basey,
|
||||
int state)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
(void) z;
|
||||
(void) glist;
|
||||
(void) data;
|
||||
(void) template;
|
||||
(void) basex;
|
||||
(void) basey;
|
||||
#endif
|
||||
post("drawnumber_activate %d", state);
|
||||
}
|
||||
|
||||
|
@ -1567,13 +1755,21 @@ static void drawnumber_vis(t_gobj *z, t_glist *glist,
|
|||
{
|
||||
t_drawnumber *x = (t_drawnumber *)z;
|
||||
|
||||
#ifdef ROCKBOX
|
||||
(void) glist;
|
||||
(void) basex;
|
||||
(void) basey;
|
||||
#endif
|
||||
|
||||
if (vis)
|
||||
{
|
||||
t_atom at;
|
||||
#ifndef ROCKBOX
|
||||
int xloc = glist_xtopixels(glist,
|
||||
basex + fielddesc_getfloat(&x->x_xloc, template, data, 0));
|
||||
int yloc = glist_ytopixels(glist,
|
||||
basey + fielddesc_getfloat(&x->x_yloc, template, data, 0));
|
||||
#endif
|
||||
char colorstring[20], buf[DRAWNUMBER_BUFSIZE];
|
||||
numbertocolor(fielddesc_getfloat(&x->x_color, template, data, 1),
|
||||
colorstring);
|
||||
|
@ -1581,13 +1777,17 @@ static void drawnumber_vis(t_gobj *z, t_glist *glist,
|
|||
SETSYMBOL(&at, fielddesc_getsymbol(&x->x_value, template, data, 0));
|
||||
else SETFLOAT(&at, fielddesc_getfloat(&x->x_value, template, data, 0));
|
||||
drawnumber_sprintf(x, buf, &at);
|
||||
#ifndef ROCKBOX
|
||||
sys_vgui(".x%x.c create text %d %d -anchor nw -fill %s -text {%s}",
|
||||
glist_getcanvas(glist), xloc, yloc, colorstring, buf);
|
||||
sys_vgui(" -font -*-courier-bold--normal--%d-*",
|
||||
sys_hostfontsize(glist_getfont(glist)));
|
||||
sys_vgui(" -tags drawnumber%x\n", data);
|
||||
#endif
|
||||
}
|
||||
#ifndef ROCKBOX
|
||||
else sys_vgui(".x%x.c delete drawnumber%x\n", glist_getcanvas(glist), data);
|
||||
#endif
|
||||
}
|
||||
|
||||
static float drawnumber_motion_ycumulative;
|
||||
|
@ -1604,6 +1804,9 @@ static void drawnumber_motion(void *z, t_floatarg dx, t_floatarg dy)
|
|||
t_drawnumber *x = (t_drawnumber *)z;
|
||||
t_fielddesc *f = &x->x_value;
|
||||
drawnumber_motion_ycumulative -= dy;
|
||||
#ifdef ROCKBOX
|
||||
(void) dx;
|
||||
#endif
|
||||
template_setfloat(drawnumber_motion_template,
|
||||
f->fd_un.fd_varsym,
|
||||
drawnumber_motion_wp,
|
||||
|
@ -1619,6 +1822,11 @@ static int drawnumber_click(t_gobj *z, t_glist *glist,
|
|||
t_drawnumber *x = (t_drawnumber *)z;
|
||||
int x1, y1, x2, y2;
|
||||
t_word *data = sc->sc_vec;
|
||||
#ifdef ROCKBOX
|
||||
(void) shift;
|
||||
(void) alt;
|
||||
(void) dbl;
|
||||
#endif
|
||||
drawnumber_getrect(z, glist,
|
||||
sc->sc_vec, template, basex, basey,
|
||||
&x1, &y1, &x2, &y2);
|
||||
|
@ -1652,6 +1860,9 @@ t_parentwidgetbehavior drawnumber_widgetbehavior =
|
|||
|
||||
static void drawnumber_free(t_drawnumber *x)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
(void) x;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void drawnumber_setup(void)
|
||||
|
@ -1678,3 +1889,4 @@ void g_template_setup(void)
|
|||
}
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -6,15 +6,21 @@
|
|||
/* the methods for calling the gui-objects from menu are implemented */
|
||||
/* all changes are labeled with iemlib */
|
||||
|
||||
#include <stdlib.h>
|
||||
#include "m_pd.h"
|
||||
#include "m_imp.h"
|
||||
#include "s_stuff.h"
|
||||
#include "t_tk.h"
|
||||
#include "g_canvas.h"
|
||||
|
||||
#ifdef ROCKBOX
|
||||
#include "plugin.h"
|
||||
#include "pdbox.h"
|
||||
#else /* ROCKBOX */
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <math.h>
|
||||
#endif /* ROCKBOX */
|
||||
|
||||
static t_class *text_class;
|
||||
static t_class *message_class;
|
||||
|
@ -39,6 +45,11 @@ void glist_text(t_glist *gl, t_symbol *s, int argc, t_atom *argv)
|
|||
{
|
||||
t_text *x = (t_text *)pd_new(text_class);
|
||||
t_atom at;
|
||||
|
||||
#ifdef ROCKBOX
|
||||
(void) s;
|
||||
#endif
|
||||
|
||||
x->te_width = 0; /* don't know it yet. */
|
||||
x->te_type = T_TEXT;
|
||||
x->te_binbuf = binbuf_new();
|
||||
|
@ -138,7 +149,12 @@ static void canvas_objtext(t_glist *gl, int xpix, int ypix, int selected,
|
|||
|
||||
void canvas_obj(t_glist *gl, t_symbol *s, int argc, t_atom *argv)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
(void) s;
|
||||
#else
|
||||
t_text *x;
|
||||
#endif
|
||||
|
||||
if (argc >= 2)
|
||||
{
|
||||
t_binbuf *b = binbuf_new();
|
||||
|
@ -178,56 +194,111 @@ void canvas_iemguis(t_glist *gl, t_symbol *guiobjname)
|
|||
|
||||
void canvas_bng(t_glist *gl, t_symbol *s, int argc, t_atom *argv)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
(void) s;
|
||||
(void) argc;
|
||||
(void) argv;
|
||||
#endif
|
||||
canvas_iemguis(gl, gensym("bng"));
|
||||
}
|
||||
|
||||
void canvas_toggle(t_glist *gl, t_symbol *s, int argc, t_atom *argv)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
(void) s;
|
||||
(void) argc;
|
||||
(void) argv;
|
||||
#endif
|
||||
canvas_iemguis(gl, gensym("tgl"));
|
||||
}
|
||||
|
||||
void canvas_vslider(t_glist *gl, t_symbol *s, int argc, t_atom *argv)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
(void) s;
|
||||
(void) argc;
|
||||
(void) argv;
|
||||
#endif
|
||||
canvas_iemguis(gl, gensym("vsl"));
|
||||
}
|
||||
|
||||
void canvas_hslider(t_glist *gl, t_symbol *s, int argc, t_atom *argv)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
(void) s;
|
||||
(void) argc;
|
||||
(void) argv;
|
||||
#endif
|
||||
canvas_iemguis(gl, gensym("hsl"));
|
||||
}
|
||||
|
||||
void canvas_hdial(t_glist *gl, t_symbol *s, int argc, t_atom *argv)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
(void) s;
|
||||
(void) argc;
|
||||
(void) argv;
|
||||
#endif
|
||||
canvas_iemguis(gl, gensym("hdl"));
|
||||
}
|
||||
|
||||
void canvas_vdial(t_glist *gl, t_symbol *s, int argc, t_atom *argv)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
(void) s;
|
||||
(void) argc;
|
||||
(void) argv;
|
||||
#endif
|
||||
canvas_iemguis(gl, gensym("vdl"));
|
||||
}
|
||||
|
||||
void canvas_hradio(t_glist *gl, t_symbol *s, int argc, t_atom *argv)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
(void) s;
|
||||
(void) argc;
|
||||
(void) argv;
|
||||
#endif
|
||||
canvas_iemguis(gl, gensym("hradio"));
|
||||
}
|
||||
|
||||
void canvas_vradio(t_glist *gl, t_symbol *s, int argc, t_atom *argv)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
(void) s;
|
||||
(void) argc;
|
||||
(void) argv;
|
||||
#endif
|
||||
canvas_iemguis(gl, gensym("vradio"));
|
||||
}
|
||||
|
||||
void canvas_vumeter(t_glist *gl, t_symbol *s, int argc, t_atom *argv)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
(void) s;
|
||||
(void) argc;
|
||||
(void) argv;
|
||||
#endif
|
||||
canvas_iemguis(gl, gensym("vu"));
|
||||
}
|
||||
|
||||
void canvas_mycnv(t_glist *gl, t_symbol *s, int argc, t_atom *argv)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
(void) s;
|
||||
(void) argc;
|
||||
(void) argv;
|
||||
#endif
|
||||
canvas_iemguis(gl, gensym("cnv"));
|
||||
}
|
||||
|
||||
void canvas_numbox(t_glist *gl, t_symbol *s, int argc, t_atom *argv)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
(void) s;
|
||||
(void) argc;
|
||||
(void) argv;
|
||||
#endif
|
||||
canvas_iemguis(gl, gensym("nbx"));
|
||||
}
|
||||
|
||||
|
@ -310,11 +381,17 @@ static void message_symbol(t_message *x, t_symbol *s)
|
|||
|
||||
static void message_list(t_message *x, t_symbol *s, int argc, t_atom *argv)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
(void) s;
|
||||
#endif
|
||||
binbuf_eval(x->m_text.te_binbuf, &x->m_messresponder.mr_pd, argc, argv);
|
||||
}
|
||||
|
||||
static void message_set(t_message *x, t_symbol *s, int argc, t_atom *argv)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
(void) s;
|
||||
#endif
|
||||
binbuf_clear(x->m_text.te_binbuf);
|
||||
binbuf_add(x->m_text.te_binbuf, argc, argv);
|
||||
glist_retext(x->m_glist, &x->m_text);
|
||||
|
@ -322,12 +399,18 @@ static void message_set(t_message *x, t_symbol *s, int argc, t_atom *argv)
|
|||
|
||||
static void message_add2(t_message *x, t_symbol *s, int argc, t_atom *argv)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
(void) s;
|
||||
#endif
|
||||
binbuf_add(x->m_text.te_binbuf, argc, argv);
|
||||
glist_retext(x->m_glist, &x->m_text);
|
||||
}
|
||||
|
||||
static void message_add(t_message *x, t_symbol *s, int argc, t_atom *argv)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
(void) s;
|
||||
#endif
|
||||
binbuf_add(x->m_text.te_binbuf, argc, argv);
|
||||
binbuf_addsemi(x->m_text.te_binbuf);
|
||||
glist_retext(x->m_glist, &x->m_text);
|
||||
|
@ -337,12 +420,21 @@ static void message_click(t_message *x,
|
|||
t_floatarg xpos, t_floatarg ypos, t_floatarg shift,
|
||||
t_floatarg ctrl, t_floatarg alt)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
(void) xpos;
|
||||
(void) ypos;
|
||||
(void) shift;
|
||||
(void) ctrl;
|
||||
(void) alt;
|
||||
#endif
|
||||
message_float(x, 0);
|
||||
if (glist_isvisible(x->m_glist))
|
||||
{
|
||||
#ifndef ROCKBOX
|
||||
t_rtext *y = glist_findrtext(x->m_glist, &x->m_text);
|
||||
sys_vgui(".x%x.c itemconfigure %sR -width 5\n",
|
||||
glist_getcanvas(x->m_glist), rtext_gettag(y));
|
||||
#endif
|
||||
clock_delay(x->m_clock, 120);
|
||||
}
|
||||
}
|
||||
|
@ -351,9 +443,11 @@ static void message_tick(t_message *x)
|
|||
{
|
||||
if (glist_isvisible(x->m_glist))
|
||||
{
|
||||
#ifndef ROCKBOX
|
||||
t_rtext *y = glist_findrtext(x->m_glist, &x->m_text);
|
||||
sys_vgui(".x%x.c itemconfigure %sR -width 1\n",
|
||||
glist_getcanvas(x->m_glist), rtext_gettag(y));
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -364,6 +458,9 @@ static void message_free(t_message *x)
|
|||
|
||||
void canvas_msg(t_glist *gl, t_symbol *s, int argc, t_atom *argv)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
(void) s;
|
||||
#endif
|
||||
t_message *x = (t_message *)pd_new(message_class);
|
||||
x->m_messresponder.mr_pd = messresponder_class;
|
||||
x->m_messresponder.mr_outlet = outlet_new(&x->m_text, &s_float);
|
||||
|
@ -467,6 +564,9 @@ static void gatom_set(t_gatom *x, t_symbol *s, int argc, t_atom *argv)
|
|||
{
|
||||
t_atom oldatom = x->a_atom;
|
||||
int senditup = 0;
|
||||
#ifdef ROCKBOX
|
||||
(void) s;
|
||||
#endif
|
||||
if (!argc) return;
|
||||
if (x->a_atom.a_type == A_FLOAT)
|
||||
x->a_atom.a_w.w_float = atom_getfloat(argv),
|
||||
|
@ -538,6 +638,9 @@ static void gatom_symbol(t_gatom *x, t_symbol *s)
|
|||
|
||||
static void gatom_motion(void *z, t_floatarg dx, t_floatarg dy)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
(void) dx;
|
||||
#endif
|
||||
t_gatom *x = (t_gatom *)z;
|
||||
if (dy == 0) return;
|
||||
if (x->a_atom.a_type == A_FLOAT)
|
||||
|
@ -597,7 +700,7 @@ static void gatom_key(void *z, t_floatarg f)
|
|||
{
|
||||
/* for numbers, only let reasonable characters through */
|
||||
if ((x->a_atom.a_type == A_SYMBOL) ||
|
||||
(c >= '0' && c <= '9' || c == '.' || c == '-'
|
||||
((c >= '0' && c <= '9') || c == '.' || c == '-'
|
||||
|| c == 'e' || c == 'E'))
|
||||
{
|
||||
x->a_buf[len] = c;
|
||||
|
@ -608,7 +711,11 @@ static void gatom_key(void *z, t_floatarg f)
|
|||
return;
|
||||
redraw:
|
||||
/* LATER figure out how to avoid creating all these symbols! */
|
||||
#ifdef ROCKBOX
|
||||
snprintf(sbuf, sizeof(sbuf)-1, "%s...", x->a_buf);
|
||||
#else /* ROCKBOX */
|
||||
sprintf(sbuf, "%s...", x->a_buf);
|
||||
#endif
|
||||
SETSYMBOL(&at, gensym(sbuf));
|
||||
binbuf_clear(x->a_text.te_binbuf);
|
||||
binbuf_add(x->a_text.te_binbuf, 1, &at);
|
||||
|
@ -619,6 +726,9 @@ static void gatom_click(t_gatom *x,
|
|||
t_floatarg xpos, t_floatarg ypos, t_floatarg shift, t_floatarg ctrl,
|
||||
t_floatarg alt)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
(void) ctrl;
|
||||
#endif
|
||||
if (x->a_text.te_width == 1)
|
||||
{
|
||||
if (x->a_atom.a_type == A_FLOAT)
|
||||
|
@ -655,6 +765,10 @@ static void gatom_param(t_gatom *x, t_symbol *sel, int argc, t_atom *argv)
|
|||
t_symbol *symfrom = gatom_unescapit(atom_getsymbolarg(5, argc, argv));
|
||||
t_symbol *symto = gatom_unescapit(atom_getsymbolarg(6, argc, argv));
|
||||
|
||||
#ifdef ROCKBOX
|
||||
(void) sel;
|
||||
#endif
|
||||
|
||||
gobj_vis(&x->a_text.te_g, x->a_glist, 0);
|
||||
if (!*symfrom->s_name && *x->a_symfrom->s_name)
|
||||
inlet_new(&x->a_text, &x->a_text.te_pd, 0, 0);
|
||||
|
@ -708,7 +822,11 @@ static void gatom_getwherelabel(t_gatom *x, t_glist *glist, int *xp, int *yp)
|
|||
{
|
||||
*xp = x1 - 3 -
|
||||
strlen(canvas_realizedollar(x->a_glist, x->a_label)->s_name) *
|
||||
#ifdef ROCKBOX
|
||||
8;
|
||||
#else
|
||||
sys_fontwidth(glist_getfont(glist));
|
||||
#endif
|
||||
*yp = y1 + 2;
|
||||
}
|
||||
else if (x->a_wherelabel == ATOM_LABELRIGHT)
|
||||
|
@ -719,7 +837,11 @@ static void gatom_getwherelabel(t_gatom *x, t_glist *glist, int *xp, int *yp)
|
|||
else if (x->a_wherelabel == ATOM_LABELUP)
|
||||
{
|
||||
*xp = x1 - 1;
|
||||
#ifdef ROCKBOX
|
||||
*yp = y1 - 1 - 10;
|
||||
#else
|
||||
*yp = y1 - 1 - sys_fontheight(glist_getfont(glist));;
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -731,10 +853,14 @@ static void gatom_getwherelabel(t_gatom *x, t_glist *glist, int *xp, int *yp)
|
|||
static void gatom_displace(t_gobj *z, t_glist *glist,
|
||||
int dx, int dy)
|
||||
{
|
||||
#ifndef ROCKBOX
|
||||
t_gatom *x = (t_gatom*)z;
|
||||
#endif
|
||||
text_displace(z, glist, dx, dy);
|
||||
#ifndef ROCKBOX
|
||||
sys_vgui(".x%x.c move %x.l %d %d\n", glist_getcanvas(glist),
|
||||
x, dx, dy);
|
||||
#endif
|
||||
}
|
||||
|
||||
static void gatom_vis(t_gobj *z, t_glist *glist, int vis)
|
||||
|
@ -747,14 +873,18 @@ static void gatom_vis(t_gobj *z, t_glist *glist, int vis)
|
|||
{
|
||||
int x1, y1;
|
||||
gatom_getwherelabel(x, glist, &x1, &y1);
|
||||
#ifndef ROCKBOX
|
||||
sys_vgui("pdtk_text_new .x%x.c %x.l %f %f {%s} %d %s\n",
|
||||
glist_getcanvas(glist), x,
|
||||
(double)x1, (double)y1,
|
||||
canvas_realizedollar(x->a_glist, x->a_label)->s_name,
|
||||
sys_hostfontsize(glist_getfont(glist)),
|
||||
"black");
|
||||
#endif
|
||||
}
|
||||
#ifndef ROCKBOX
|
||||
else sys_vgui(".x%x.c delete %x.l\n", glist_getcanvas(glist), x);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -763,6 +893,11 @@ void canvas_atom(t_glist *gl, t_atomtype type,
|
|||
{
|
||||
t_gatom *x = (t_gatom *)pd_new(gatom_class);
|
||||
t_atom at;
|
||||
|
||||
#ifdef ROCKBOX
|
||||
(void) s;
|
||||
#endif
|
||||
|
||||
x->a_text.te_width = 0; /* don't know it yet. */
|
||||
x->a_text.te_type = T_ATOM;
|
||||
x->a_text.te_binbuf = binbuf_new();
|
||||
|
@ -850,11 +985,17 @@ static void gatom_free(t_gatom *x)
|
|||
if (*x->a_symfrom->s_name)
|
||||
pd_unbind(&x->a_text.te_pd,
|
||||
canvas_realizedollar(x->a_glist, x->a_symfrom));
|
||||
#ifndef ROCKBOX
|
||||
gfxstub_deleteforkey(x);
|
||||
#endif
|
||||
}
|
||||
|
||||
static void gatom_properties(t_gobj *z, t_glist *owner)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
(void) z;
|
||||
(void) owner;
|
||||
#else /* ROCKBOX */
|
||||
t_gatom *x = (t_gatom *)z;
|
||||
char buf[200];
|
||||
sprintf(buf, "pdtk_gatom_dialog %%s %d %g %g %d %s %s %s\n",
|
||||
|
@ -863,6 +1004,7 @@ static void gatom_properties(t_gobj *z, t_glist *owner)
|
|||
gatom_escapit(x->a_symfrom)->s_name,
|
||||
gatom_escapit(x->a_symto)->s_name);
|
||||
gfxstub_new(&x->a_text.te_pd, x, buf);
|
||||
#endif /* ROCKBOX */
|
||||
}
|
||||
|
||||
|
||||
|
@ -880,8 +1022,12 @@ static void text_getrect(t_gobj *z, t_glist *glist,
|
|||
|
||||
if (x->te_type == T_ATOM && x->te_width > 0)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
int fontwidth = 8, fontheight = 10;
|
||||
#else
|
||||
int font = glist_getfont(glist);
|
||||
int fontwidth = sys_fontwidth(font), fontheight = sys_fontheight(font);
|
||||
#endif
|
||||
width = (x->te_width > 0 ? x->te_width : 6) * fontwidth + 2;
|
||||
height = fontheight + 1; /* borrowed from TMARGIN, etc, in g_rtext.c */
|
||||
}
|
||||
|
@ -933,8 +1079,13 @@ static void text_select(t_gobj *z, t_glist *glist, int state)
|
|||
t_rtext *y = glist_findrtext(glist, x);
|
||||
rtext_select(y, state);
|
||||
if (glist_isvisible(glist) && text_shouldvis(x, glist))
|
||||
#ifdef ROCKBOX
|
||||
{
|
||||
}
|
||||
#else /* ROCKBOX */
|
||||
sys_vgui(".x%x.c itemconfigure %sR -fill %s\n", glist,
|
||||
rtext_gettag(y), (state? "blue" : "black"));
|
||||
#endif /* ROCKBOX */
|
||||
}
|
||||
|
||||
static void text_activate(t_gobj *z, t_glist *glist, int state)
|
||||
|
@ -988,6 +1139,10 @@ static void text_vis(t_gobj *z, t_glist *glist, int vis)
|
|||
static int text_click(t_gobj *z, struct _glist *glist,
|
||||
int xpix, int ypix, int shift, int alt, int dbl, int doit)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
(void) glist;
|
||||
(void) dbl;
|
||||
#endif
|
||||
t_text *x = (t_text *)z;
|
||||
if (x->te_type == T_OBJECT)
|
||||
{
|
||||
|
@ -1111,9 +1266,20 @@ void glist_drawiofor(t_glist *glist, t_object *ob, int firsttime,
|
|||
char *tag, int x1, int y1, int x2, int y2)
|
||||
{
|
||||
int n = obj_noutlets(ob), nplus = (n == 1 ? 1 : n-1), i;
|
||||
#ifdef ROCKBOX
|
||||
(void) glist;
|
||||
(void) firsttime;
|
||||
(void) tag;
|
||||
(void) x1;
|
||||
(void) y1;
|
||||
(void) x2;
|
||||
(void) y2;
|
||||
#else /* ROCKBOX */
|
||||
int width = x2 - x1;
|
||||
#endif /* ROCKBOX */
|
||||
for (i = 0; i < n; i++)
|
||||
{
|
||||
#ifndef ROCKBOX
|
||||
int onset = x1 + (width - IOWIDTH) * i / nplus;
|
||||
if (firsttime)
|
||||
sys_vgui(".x%x.c create rectangle %d %d %d %d -tags %so%d\n",
|
||||
|
@ -1126,11 +1292,13 @@ void glist_drawiofor(t_glist *glist, t_object *ob, int firsttime,
|
|||
glist_getcanvas(glist), tag, i,
|
||||
onset, y2 - 1,
|
||||
onset + IOWIDTH, y2);
|
||||
#endif /* ROCKBOX */
|
||||
}
|
||||
n = obj_ninlets(ob);
|
||||
nplus = (n == 1 ? 1 : n-1);
|
||||
for (i = 0; i < n; i++)
|
||||
{
|
||||
#ifndef ROCKBOX
|
||||
int onset = x1 + (width - IOWIDTH) * i / nplus;
|
||||
if (firsttime)
|
||||
sys_vgui(".x%x.c create rectangle %d %d %d %d -tags %si%d\n",
|
||||
|
@ -1143,6 +1311,7 @@ void glist_drawiofor(t_glist *glist, t_object *ob, int firsttime,
|
|||
glist_getcanvas(glist), tag, i,
|
||||
onset, y1,
|
||||
onset + IOWIDTH, y1 + EXTRAPIX);
|
||||
#endif /* ROCKBOX */
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1151,11 +1320,18 @@ void text_drawborder(t_text *x, t_glist *glist,
|
|||
{
|
||||
t_object *ob;
|
||||
int x1, y1, x2, y2, width, height;
|
||||
|
||||
#ifdef ROCKBOX
|
||||
(void) width2;
|
||||
(void) height2;
|
||||
#endif
|
||||
|
||||
text_getrect(&x->te_g, glist, &x1, &y1, &x2, &y2);
|
||||
width = x2 - x1;
|
||||
height = y2 - y1;
|
||||
if (x->te_type == T_OBJECT)
|
||||
{
|
||||
#ifndef ROCKBOX
|
||||
if (firsttime)
|
||||
sys_vgui(".x%x.c create line\
|
||||
%d %d %d %d %d %d %d %d %d %d -tags %sR\n",
|
||||
|
@ -1166,9 +1342,11 @@ void text_drawborder(t_text *x, t_glist *glist,
|
|||
%d %d %d %d %d %d %d %d %d %d\n",
|
||||
glist_getcanvas(glist), tag,
|
||||
x1, y1, x2, y1, x2, y2, x1, y2, x1, y1);
|
||||
#endif
|
||||
}
|
||||
else if (x->te_type == T_MESSAGE)
|
||||
{
|
||||
#ifndef ROCKBOX
|
||||
if (firsttime)
|
||||
sys_vgui(".x%x.c create line\
|
||||
%d %d %d %d %d %d %d %d %d %d %d %d %d %d -tags %sR\n",
|
||||
|
@ -1182,9 +1360,11 @@ void text_drawborder(t_text *x, t_glist *glist,
|
|||
glist_getcanvas(glist), tag,
|
||||
x1, y1, x2+4, y1, x2, y1+4, x2, y2-4, x2+4, y2,
|
||||
x1, y2, x1, y1);
|
||||
#endif
|
||||
}
|
||||
else if (x->te_type == T_ATOM)
|
||||
{
|
||||
#ifndef ROCKBOX
|
||||
if (firsttime)
|
||||
sys_vgui(".x%x.c create line\
|
||||
%d %d %d %d %d %d %d %d %d %d %d %d -tags %sR\n",
|
||||
|
@ -1196,31 +1376,46 @@ void text_drawborder(t_text *x, t_glist *glist,
|
|||
%d %d %d %d %d %d %d %d %d %d %d %d\n",
|
||||
glist_getcanvas(glist), tag,
|
||||
x1, y1, x2-4, y1, x2, y1+4, x2, y2, x1, y2, x1, y1);
|
||||
#endif
|
||||
}
|
||||
/* draw inlets/outlets */
|
||||
|
||||
if (ob = pd_checkobject(&x->te_pd))
|
||||
if ((ob = pd_checkobject(&x->te_pd)))
|
||||
glist_drawiofor(glist, ob, firsttime, tag, x1, y1, x2, y2);
|
||||
}
|
||||
|
||||
void glist_eraseiofor(t_glist *glist, t_object *ob, char *tag)
|
||||
{
|
||||
int i, n;
|
||||
#ifdef ROCKBOX
|
||||
(void) glist;
|
||||
(void) tag;
|
||||
#endif
|
||||
n = obj_noutlets(ob);
|
||||
for (i = 0; i < n; i++)
|
||||
#ifdef ROCKBOX
|
||||
;
|
||||
#else /* ROCKBOX */
|
||||
sys_vgui(".x%x.c delete %so%d\n",
|
||||
glist_getcanvas(glist), tag, i);
|
||||
#endif /* ROCKBOX */
|
||||
n = obj_ninlets(ob);
|
||||
for (i = 0; i < n; i++)
|
||||
#ifdef ROCKBOX
|
||||
;
|
||||
#else /* ROCKBOX */
|
||||
sys_vgui(".x%x.c delete %si%d\n",
|
||||
glist_getcanvas(glist), tag, i);
|
||||
#endif /* ROCKBOX */
|
||||
}
|
||||
|
||||
void text_eraseborder(t_text *x, t_glist *glist, char *tag)
|
||||
{
|
||||
if (x->te_type == T_TEXT) return;
|
||||
#ifndef ROCKBOX
|
||||
sys_vgui(".x%x.c delete %sR\n",
|
||||
glist_getcanvas(glist), tag);
|
||||
#endif
|
||||
glist_eraseiofor(glist, x, tag);
|
||||
}
|
||||
|
||||
|
|
|
@ -6,6 +6,13 @@
|
|||
/* thanks to Miller Puckette, Guenther Geiger and Krzystof Czaja */
|
||||
|
||||
|
||||
#ifdef ROCKBOX
|
||||
#include "plugin.h"
|
||||
#include "pdbox.h"
|
||||
#include "m_pd.h"
|
||||
#include "g_canvas.h"
|
||||
#include "g_all_guis.h"
|
||||
#else /* ROCKBOX */
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
|
@ -21,6 +28,7 @@
|
|||
#else
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
#endif /* ROCKBOX */
|
||||
|
||||
/* --------------- tgl gui-toggle ------------------------- */
|
||||
|
||||
|
@ -31,6 +39,10 @@ static t_class *toggle_class;
|
|||
|
||||
void toggle_draw_update(t_toggle *x, t_glist *glist)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
(void) x;
|
||||
(void) glist;
|
||||
#else /* ROCKBOX */
|
||||
if(glist_isvisible(glist))
|
||||
{
|
||||
t_canvas *canvas=glist_getcanvas(glist);
|
||||
|
@ -40,10 +52,15 @@ void toggle_draw_update(t_toggle *x, t_glist *glist)
|
|||
sys_vgui(".x%x.c itemconfigure %xX2 -fill #%6.6x\n", canvas, x,
|
||||
(x->x_on!=0.0)?x->x_gui.x_fcol:x->x_gui.x_bcol);
|
||||
}
|
||||
#endif /* ROCKBOX */
|
||||
}
|
||||
|
||||
void toggle_draw_new(t_toggle *x, t_glist *glist)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
(void) x;
|
||||
(void) glist;
|
||||
#else /* ROCKBOX */
|
||||
t_canvas *canvas=glist_getcanvas(glist);
|
||||
int w=1, xx=text_xpix(&x->x_gui.x_obj, glist), yy=text_ypix(&x->x_gui.x_obj, glist);
|
||||
|
||||
|
@ -72,10 +89,15 @@ void toggle_draw_new(t_toggle *x, t_glist *glist)
|
|||
if(!x->x_gui.x_fsf.x_rcv_able)
|
||||
sys_vgui(".x%x.c create rectangle %d %d %d %d -tags %xIN%d\n",
|
||||
canvas, xx, yy, xx + IOWIDTH, yy+1, x, 0);
|
||||
#endif /* ROCKBOX */
|
||||
}
|
||||
|
||||
void toggle_draw_move(t_toggle *x, t_glist *glist)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
(void) x;
|
||||
(void) glist;
|
||||
#else /* ROCKBOX */
|
||||
t_canvas *canvas=glist_getcanvas(glist);
|
||||
int w=1, xx=text_xpix(&x->x_gui.x_obj, glist), yy=text_ypix(&x->x_gui.x_obj, glist);
|
||||
|
||||
|
@ -100,10 +122,15 @@ void toggle_draw_move(t_toggle *x, t_glist *glist)
|
|||
if(!x->x_gui.x_fsf.x_rcv_able)
|
||||
sys_vgui(".x%x.c coords %xIN%d %d %d %d %d\n",
|
||||
canvas, x, 0, xx, yy, xx + IOWIDTH, yy+1);
|
||||
#endif /* ROCKBOX */
|
||||
}
|
||||
|
||||
void toggle_draw_erase(t_toggle* x, t_glist* glist)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
(void) x;
|
||||
(void) glist;
|
||||
#else /* ROCKBOX */
|
||||
t_canvas *canvas=glist_getcanvas(glist);
|
||||
|
||||
sys_vgui(".x%x.c delete %xBASE\n", canvas, x);
|
||||
|
@ -114,10 +141,15 @@ void toggle_draw_erase(t_toggle* x, t_glist* glist)
|
|||
sys_vgui(".x%x.c delete %xOUT%d\n", canvas, x, 0);
|
||||
if(!x->x_gui.x_fsf.x_rcv_able)
|
||||
sys_vgui(".x%x.c delete %xIN%d\n", canvas, x, 0);
|
||||
#endif /* ROCKBOX */
|
||||
}
|
||||
|
||||
void toggle_draw_config(t_toggle* x, t_glist* glist)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
(void) x;
|
||||
(void) glist;
|
||||
#else /* ROCKBOX */
|
||||
t_canvas *canvas=glist_getcanvas(glist);
|
||||
|
||||
sys_vgui(".x%x.c itemconfigure %xLABEL -font {%s %d bold} -fill #%6.6x -text {%s} \n",
|
||||
|
@ -130,10 +162,16 @@ void toggle_draw_config(t_toggle* x, t_glist* glist)
|
|||
x->x_on?x->x_gui.x_fcol:x->x_gui.x_bcol);
|
||||
sys_vgui(".x%x.c itemconfigure %xX2 -fill #%6.6x\n", canvas, x,
|
||||
x->x_on?x->x_gui.x_fcol:x->x_gui.x_bcol);
|
||||
#endif /* ROCKBOX */
|
||||
}
|
||||
|
||||
void toggle_draw_io(t_toggle* x, t_glist* glist, int old_snd_rcv_flags)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
(void) x;
|
||||
(void) glist;
|
||||
(void) old_snd_rcv_flags;
|
||||
#else /* ROCKBOX */
|
||||
int xpos=text_xpix(&x->x_gui.x_obj, glist);
|
||||
int ypos=text_ypix(&x->x_gui.x_obj, glist);
|
||||
t_canvas *canvas=glist_getcanvas(glist);
|
||||
|
@ -151,10 +189,15 @@ void toggle_draw_io(t_toggle* x, t_glist* glist, int old_snd_rcv_flags)
|
|||
xpos + IOWIDTH, ypos+1, x, 0);
|
||||
if(!(old_snd_rcv_flags & IEM_GUI_OLD_RCV_FLAG) && x->x_gui.x_fsf.x_rcv_able)
|
||||
sys_vgui(".x%x.c delete %xIN%d\n", canvas, x, 0);
|
||||
#endif /* ROCKBOX */
|
||||
}
|
||||
|
||||
void toggle_draw_select(t_toggle* x, t_glist* glist)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
(void) x;
|
||||
(void) glist;
|
||||
#else /* ROCKBOX */
|
||||
t_canvas *canvas=glist_getcanvas(glist);
|
||||
|
||||
if(x->x_gui.x_fsf.x_selected)
|
||||
|
@ -167,6 +210,7 @@ void toggle_draw_select(t_toggle* x, t_glist* glist)
|
|||
sys_vgui(".x%x.c itemconfigure %xBASE -outline #%6.6x\n", canvas, x, IEM_GUI_COLOR_NORMAL);
|
||||
sys_vgui(".x%x.c itemconfigure %xLABEL -fill #%6.6x\n", canvas, x, x->x_gui.x_lcol);
|
||||
}
|
||||
#endif /* ROCKBOX */
|
||||
}
|
||||
|
||||
void toggle_draw(t_toggle *x, t_glist *glist, int mode)
|
||||
|
@ -220,6 +264,10 @@ static void toggle_save(t_gobj *z, t_binbuf *b)
|
|||
|
||||
static void toggle_properties(t_gobj *z, t_glist *owner)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
(void) z;
|
||||
(void) owner;
|
||||
#else /* ROCKBOX */
|
||||
t_toggle *x = (t_toggle *)z;
|
||||
char buf[800];
|
||||
t_symbol *srl[3];
|
||||
|
@ -241,6 +289,7 @@ static void toggle_properties(t_gobj *z, t_glist *owner)
|
|||
x->x_gui.x_fsf.x_font_style, x->x_gui.x_fontsize,
|
||||
0xffffff & x->x_gui.x_bcol, 0xffffff & x->x_gui.x_fcol, 0xffffff & x->x_gui.x_lcol);
|
||||
gfxstub_new(&x->x_gui.x_obj.ob_pd, x, buf);
|
||||
#endif
|
||||
}
|
||||
|
||||
static void toggle_bang(t_toggle *x)
|
||||
|
@ -259,6 +308,10 @@ static void toggle_dialog(t_toggle *x, t_symbol *s, int argc, t_atom *argv)
|
|||
float nonzero = (float)atom_getfloatarg(2, argc, argv);
|
||||
int sr_flags;
|
||||
|
||||
#ifdef ROCKBOX
|
||||
(void) s;
|
||||
#endif
|
||||
|
||||
if(nonzero == 0.0)
|
||||
nonzero = 1.0;
|
||||
x->x_nonzero = nonzero;
|
||||
|
@ -274,10 +327,26 @@ static void toggle_dialog(t_toggle *x, t_symbol *s, int argc, t_atom *argv)
|
|||
}
|
||||
|
||||
static void toggle_click(t_toggle *x, t_floatarg xpos, t_floatarg ypos, t_floatarg shift, t_floatarg ctrl, t_floatarg alt)
|
||||
#ifdef ROCKBOX
|
||||
{
|
||||
(void) xpos;
|
||||
(void) ypos;
|
||||
(void) shift;
|
||||
(void) alt;
|
||||
(void) ctrl;
|
||||
|
||||
toggle_bang(x);
|
||||
}
|
||||
#else /* ROCKBOX */
|
||||
{toggle_bang(x);}
|
||||
#endif /* ROCKBOX */
|
||||
|
||||
static int toggle_newclick(t_gobj *z, struct _glist *glist, int xpix, int ypix, int shift, int alt, int dbl, int doit)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
(void) glist;
|
||||
(void) dbl;
|
||||
#endif
|
||||
if(doit)
|
||||
toggle_click((t_toggle *)z, (t_floatarg)xpix, (t_floatarg)ypix, (t_floatarg)shift, 0, (t_floatarg)alt);
|
||||
return (1);
|
||||
|
@ -318,6 +387,9 @@ static void toggle_loadbang(t_toggle *x)
|
|||
|
||||
static void toggle_size(t_toggle *x, t_symbol *s, int ac, t_atom *av)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
(void) s;
|
||||
#endif
|
||||
x->x_gui.x_w = iemgui_clip_size((int)atom_getintarg(0, ac, av));
|
||||
x->x_gui.x_h = x->x_gui.x_w;
|
||||
iemgui_size((void *)x, &x->x_gui);
|
||||
|
@ -362,11 +434,21 @@ static void *toggle_new(t_symbol *s, int argc, t_atom *argv)
|
|||
{
|
||||
t_toggle *x = (t_toggle *)pd_new(toggle_class);
|
||||
int bflcol[]={-262144, -1, -1};
|
||||
#ifdef ROCKBOX
|
||||
int a=IEM_GUI_DEFAULTSIZE;
|
||||
#else
|
||||
int a=IEM_GUI_DEFAULTSIZE, f=0;
|
||||
#endif
|
||||
int ldx=0, ldy=-6;
|
||||
int fs=8;
|
||||
float on=0.0, nonzero=1.0;
|
||||
#ifndef ROCKBOX
|
||||
char str[144];
|
||||
#endif
|
||||
|
||||
#ifdef ROCKBOX
|
||||
(void) s;
|
||||
#endif
|
||||
|
||||
iem_inttosymargs(&x->x_gui.x_isa, 0);
|
||||
iem_inttofstyle(&x->x_gui.x_fsf, 0);
|
||||
|
@ -433,7 +515,9 @@ static void toggle_ff(t_toggle *x)
|
|||
{
|
||||
if(x->x_gui.x_fsf.x_rcv_able)
|
||||
pd_unbind(&x->x_gui.x_obj.ob_pd, x->x_gui.x_rcv);
|
||||
#ifndef ROCKBOX
|
||||
gfxstub_deleteforkey(x);
|
||||
#endif
|
||||
}
|
||||
|
||||
void g_toggle_setup(void)
|
||||
|
|
|
@ -16,11 +16,18 @@ sublist - get a pointer into a list which is an element of another scalar
|
|||
|
||||
*/
|
||||
|
||||
#ifdef ROCKBOX
|
||||
#include "plugin.h"
|
||||
#include "pdbox.h"
|
||||
#include "m_pd.h"
|
||||
#include "g_canvas.h"
|
||||
#else /* ROCKBOX */
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h> /* for read/write to files */
|
||||
#include "m_pd.h"
|
||||
#include "g_canvas.h"
|
||||
#endif /* ROCKBOX */
|
||||
|
||||
/* ------------- gstubs and gpointers - safe pointing --------------- */
|
||||
|
||||
|
@ -135,7 +142,7 @@ void gpointer_copy(const t_gpointer *gpfrom, t_gpointer *gpto)
|
|||
void gpointer_unset(t_gpointer *gp)
|
||||
{
|
||||
t_gstub *gs;
|
||||
if (gs = gp->gp_stub)
|
||||
if((gs = gp->gp_stub))
|
||||
{
|
||||
gstub_dis(gs);
|
||||
gp->gp_stub = 0;
|
||||
|
@ -145,7 +152,7 @@ void gpointer_unset(t_gpointer *gp)
|
|||
void gpointer_setglist(t_gpointer *gp, t_glist *glist, t_scalar *x)
|
||||
{
|
||||
t_gstub *gs;
|
||||
if (gs = gp->gp_stub) gstub_dis(gs);
|
||||
if((gs = gp->gp_stub)) gstub_dis(gs);
|
||||
gp->gp_stub = gs = glist->gl_stub;
|
||||
gp->gp_valid = glist->gl_valid;
|
||||
gp->gp_un.gp_scalar = x;
|
||||
|
@ -155,7 +162,7 @@ void gpointer_setglist(t_gpointer *gp, t_glist *glist, t_scalar *x)
|
|||
static void gpointer_setarray(t_gpointer *gp, t_array *array, t_word *w)
|
||||
{
|
||||
t_gstub *gs;
|
||||
if (gs = gp->gp_stub) gstub_dis(gs);
|
||||
if((gs = gp->gp_stub)) gstub_dis(gs);
|
||||
gp->gp_stub = gs = array->a_stub;
|
||||
gp->gp_valid = array->a_valid;
|
||||
gp->gp_un.gp_w = w;
|
||||
|
@ -194,6 +201,9 @@ static void *ptrobj_new(t_symbol *classname, int argc, t_atom *argv)
|
|||
t_ptrobj *x = (t_ptrobj *)pd_new(ptrobj_class);
|
||||
t_typedout *to;
|
||||
int n;
|
||||
#ifdef ROCKBOX
|
||||
(void) classname;
|
||||
#endif
|
||||
gpointer_init(&x->x_gp);
|
||||
x->x_typedout = to = (t_typedout *)getbytes(argc * sizeof (*to));
|
||||
x->x_ntypedout = n = argc;
|
||||
|
@ -285,10 +295,14 @@ static void ptrobj_next(t_ptrobj *x)
|
|||
|
||||
static void ptrobj_sendwindow(t_ptrobj *x, t_symbol *s, int argc, t_atom *argv)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
(void) s;
|
||||
#else /* ROCKBOX */
|
||||
t_scalar *sc;
|
||||
t_symbol *templatesym;
|
||||
int n;
|
||||
t_typedout *to;
|
||||
#endif /* ROCKBOX */
|
||||
t_glist *glist;
|
||||
t_pd *canvas;
|
||||
t_gstub *gs;
|
||||
|
@ -388,6 +402,9 @@ static void *get_new(t_symbol *why, int argc, t_atom *argv)
|
|||
int i;
|
||||
t_getvariable *sp;
|
||||
x->x_templatesym = canvas_makebindsym(atom_getsymbolarg(0, argc, argv));
|
||||
#ifdef ROCKBOX
|
||||
(void) why;
|
||||
#endif
|
||||
if (argc) argc--, argv++;
|
||||
x->x_variables
|
||||
= (t_getvariable *)getbytes(argc * sizeof (*x->x_variables));
|
||||
|
@ -468,6 +485,9 @@ static void *set_new(t_symbol *why, int argc, t_atom *argv)
|
|||
int i;
|
||||
t_setvariable *sp;
|
||||
x->x_templatesym = canvas_makebindsym(atom_getsymbolarg(0, argc, argv));
|
||||
#ifdef ROCKBOX
|
||||
(void) why;
|
||||
#endif
|
||||
if (argc) argc--, argv++;
|
||||
x->x_variables
|
||||
= (t_setvariable *)getbytes(argc * sizeof (*x->x_variables));
|
||||
|
@ -634,6 +654,9 @@ static void elem_float(t_elem *x, t_float f)
|
|||
|
||||
static void elem_free(t_elem *x, t_gpointer *gp)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
(void) gp;
|
||||
#endif
|
||||
gpointer_unset(&x->x_gp);
|
||||
gpointer_unset(&x->x_gparent);
|
||||
}
|
||||
|
@ -667,13 +690,19 @@ static void *getsize_new(t_symbol *templatesym, t_symbol *fieldsym)
|
|||
|
||||
static void getsize_pointer(t_getsize *x, t_gpointer *gp)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
int onset, type;
|
||||
#else /* ROCKBOX */
|
||||
int nitems, onset, type;
|
||||
#endif /* ROCKBOX */
|
||||
t_symbol *templatesym = x->x_templatesym, *fieldsym = x->x_fieldsym,
|
||||
*elemtemplatesym;
|
||||
t_template *template = template_findbyname(templatesym);
|
||||
t_word *w;
|
||||
t_array *array;
|
||||
#ifndef ROCKBOX
|
||||
int elemsize;
|
||||
#endif
|
||||
t_gstub *gs = gp->gp_stub;
|
||||
if (!template)
|
||||
{
|
||||
|
@ -731,6 +760,9 @@ typedef struct _setsize
|
|||
static void *setsize_new(t_symbol *templatesym, t_symbol *fieldsym,
|
||||
t_floatarg newsize)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
(void) newsize;
|
||||
#endif
|
||||
t_setsize *x = (t_setsize *)pd_new(setsize_class);
|
||||
x->x_templatesym = canvas_makebindsym(templatesym);
|
||||
x->x_fieldsym = fieldsym;
|
||||
|
@ -748,7 +780,9 @@ static void setsize_float(t_setsize *x, t_float f)
|
|||
t_template *template = template_findbyname(templatesym);
|
||||
t_template *elemtemplate;
|
||||
t_word *w;
|
||||
#ifndef ROCKBOX
|
||||
t_atom at;
|
||||
#endif
|
||||
t_array *array;
|
||||
int elemsize;
|
||||
int newsize = f;
|
||||
|
@ -830,7 +864,11 @@ static void setsize_float(t_setsize *x, t_float f)
|
|||
if (newsize > nitems)
|
||||
{
|
||||
char *newelem = ((char *)array->a_vec) + nitems * elemsize;
|
||||
#ifdef ROCKBOX
|
||||
int nnew = newsize - nitems;
|
||||
#else /* ROCKBOX */
|
||||
int i = 0, nnew = newsize - nitems;
|
||||
#endif /* ROCKBOX */
|
||||
|
||||
while (nnew--)
|
||||
{
|
||||
|
@ -896,6 +934,9 @@ static void *append_new(t_symbol *why, int argc, t_atom *argv)
|
|||
int i;
|
||||
t_appendvariable *sp;
|
||||
x->x_templatesym = canvas_makebindsym(atom_getsymbolarg(0, argc, argv));
|
||||
#ifdef ROCKBOX
|
||||
(void) why;
|
||||
#endif
|
||||
if (argc) argc--, argv++;
|
||||
x->x_variables
|
||||
= (t_appendvariable *)getbytes(argc * sizeof (*x->x_variables));
|
||||
|
@ -1023,8 +1064,10 @@ static void sublist_pointer(t_sublist *x, t_gpointer *gp)
|
|||
t_symbol *templatesym = x->x_templatesym, *dummy;
|
||||
t_template *template = template_findbyname(templatesym);
|
||||
t_gstub *gs = gp->gp_stub;
|
||||
#ifndef ROCKBOX
|
||||
t_word *vec;
|
||||
t_getvariable *vp;
|
||||
#endif
|
||||
int onset, type;
|
||||
t_word *w;
|
||||
|
||||
|
@ -1059,6 +1102,9 @@ static void sublist_pointer(t_sublist *x, t_gpointer *gp)
|
|||
|
||||
static void sublist_free(t_sublist *x, t_gpointer *gp)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
(void) gp;
|
||||
#endif
|
||||
gpointer_unset(&x->x_gp);
|
||||
}
|
||||
|
||||
|
|
|
@ -7,6 +7,13 @@
|
|||
/* name change to vradio by MSP (it's a radio button really) and changed to
|
||||
put out a "float" as in sliders, toggles, etc. */
|
||||
|
||||
#ifdef ROCKBOX
|
||||
#include "plugin.h"
|
||||
#include "pdbox.h"
|
||||
#include "m_pd.h"
|
||||
#include "g_canvas.h"
|
||||
#include "g_all_guis.h"
|
||||
#else /* ROCKBOX */
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
|
@ -16,6 +23,7 @@ put out a "float" as in sliders, toggles, etc. */
|
|||
#include "t_tk.h"
|
||||
#include "g_all_guis.h"
|
||||
#include <math.h>
|
||||
#endif /* ROCKBOX */
|
||||
|
||||
/*------------------ global variables -------------------------*/
|
||||
|
||||
|
@ -34,6 +42,10 @@ static t_class *vradio_class, *vradio_old_class;
|
|||
|
||||
void vradio_draw_update(t_vradio *x, t_glist *glist)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
(void) x;
|
||||
(void) glist;
|
||||
#else /* ROCKBOX */
|
||||
if(glist_isvisible(glist))
|
||||
{
|
||||
t_canvas *canvas=glist_getcanvas(glist);
|
||||
|
@ -45,10 +57,15 @@ void vradio_draw_update(t_vradio *x, t_glist *glist)
|
|||
canvas, x, x->x_on,
|
||||
x->x_gui.x_fcol, x->x_gui.x_fcol);
|
||||
}
|
||||
#endif /* ROCKBOX */
|
||||
}
|
||||
|
||||
void vradio_draw_new(t_vradio *x, t_glist *glist)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
(void) x;
|
||||
(void) glist;
|
||||
#else /* ROCKBOX */
|
||||
t_canvas *canvas=glist_getcanvas(glist);
|
||||
int n=x->x_number, i, dy=x->x_gui.x_h, s4=dy/4;
|
||||
int yy11b=text_ypix(&x->x_gui.x_obj, glist);
|
||||
|
@ -83,10 +100,15 @@ void vradio_draw_new(t_vradio *x, t_glist *glist)
|
|||
if(!x->x_gui.x_fsf.x_rcv_able)
|
||||
sys_vgui(".x%x.c create rectangle %d %d %d %d -tags %xIN%d\n",
|
||||
canvas, xx11, yy11b, xx11 + IOWIDTH, yy11b+1, x, 0);
|
||||
#endif /* ROCKBOX */
|
||||
}
|
||||
|
||||
void vradio_draw_move(t_vradio *x, t_glist *glist)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
(void) x;
|
||||
(void) glist;
|
||||
#else /* ROCKBOX */
|
||||
t_canvas *canvas=glist_getcanvas(glist);
|
||||
int n=x->x_number, i, dy=x->x_gui.x_h, s4=dy/4;
|
||||
int yy11b=text_ypix(&x->x_gui.x_obj, glist);
|
||||
|
@ -114,10 +136,15 @@ void vradio_draw_move(t_vradio *x, t_glist *glist)
|
|||
if(!x->x_gui.x_fsf.x_rcv_able)
|
||||
sys_vgui(".x%x.c coords %xIN%d %d %d %d %d\n",
|
||||
canvas, x, 0, xx11, yy11b, xx11 + IOWIDTH, yy11b+1);
|
||||
#endif /* ROCKBOX */
|
||||
}
|
||||
|
||||
void vradio_draw_erase(t_vradio* x, t_glist* glist)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
(void) x;
|
||||
(void) glist;
|
||||
#else /* ROCKBOX */
|
||||
t_canvas *canvas=glist_getcanvas(glist);
|
||||
int n=x->x_number, i;
|
||||
|
||||
|
@ -131,10 +158,15 @@ void vradio_draw_erase(t_vradio* x, t_glist* glist)
|
|||
sys_vgui(".x%x.c delete %xOUT%d\n", canvas, x, 0);
|
||||
if(!x->x_gui.x_fsf.x_rcv_able)
|
||||
sys_vgui(".x%x.c delete %xIN%d\n", canvas, x, 0);
|
||||
#endif /* ROCKBOX */
|
||||
}
|
||||
|
||||
void vradio_draw_config(t_vradio* x, t_glist* glist)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
(void) x;
|
||||
(void) glist;
|
||||
#else /* ROCKBOX */
|
||||
t_canvas *canvas=glist_getcanvas(glist);
|
||||
int n=x->x_number, i;
|
||||
|
||||
|
@ -150,10 +182,16 @@ void vradio_draw_config(t_vradio* x, t_glist* glist)
|
|||
(x->x_on==i)?x->x_gui.x_fcol:x->x_gui.x_bcol,
|
||||
(x->x_on==i)?x->x_gui.x_fcol:x->x_gui.x_bcol);
|
||||
}
|
||||
#endif /* ROCKBOX */
|
||||
}
|
||||
|
||||
void vradio_draw_io(t_vradio* x, t_glist* glist, int old_snd_rcv_flags)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
(void) x;
|
||||
(void) glist;
|
||||
(void) old_snd_rcv_flags;
|
||||
#else /* ROCKBOX */
|
||||
t_canvas *canvas=glist_getcanvas(glist);
|
||||
int xpos=text_xpix(&x->x_gui.x_obj, glist);
|
||||
int ypos=text_ypix(&x->x_gui.x_obj, glist);
|
||||
|
@ -173,10 +211,15 @@ void vradio_draw_io(t_vradio* x, t_glist* glist, int old_snd_rcv_flags)
|
|||
x, 0);
|
||||
if(!(old_snd_rcv_flags & IEM_GUI_OLD_RCV_FLAG) && x->x_gui.x_fsf.x_rcv_able)
|
||||
sys_vgui(".x%x.c delete %xIN%d\n", canvas, x, 0);
|
||||
#endif /* ROCKBOX */
|
||||
}
|
||||
|
||||
void vradio_draw_select(t_vradio* x, t_glist* glist)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
(void) x;
|
||||
(void) glist;
|
||||
#else /* ROCKBOX */
|
||||
t_canvas *canvas=glist_getcanvas(glist);
|
||||
int n=x->x_number, i;
|
||||
|
||||
|
@ -199,6 +242,7 @@ void vradio_draw_select(t_vradio* x, t_glist* glist)
|
|||
sys_vgui(".x%x.c itemconfigure %xLABEL -fill #%6.6x\n", canvas, x,
|
||||
x->x_gui.x_lcol);
|
||||
}
|
||||
#endif /* ROCKBOX */
|
||||
}
|
||||
|
||||
void vradio_draw(t_vradio *x, t_glist *glist, int mode)
|
||||
|
@ -254,6 +298,10 @@ static void vradio_save(t_gobj *z, t_binbuf *b)
|
|||
|
||||
static void vradio_properties(t_gobj *z, t_glist *owner)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
(void) z;
|
||||
(void) owner;
|
||||
#else /* ROCKBOX */
|
||||
t_vradio *x = (t_vradio *)z;
|
||||
char buf[800];
|
||||
t_symbol *srl[3];
|
||||
|
@ -278,6 +326,7 @@ static void vradio_properties(t_gobj *z, t_glist *owner)
|
|||
x->x_gui.x_fsf.x_font_style, x->x_gui.x_fontsize,
|
||||
0xffffff & x->x_gui.x_bcol, 0xffffff & x->x_gui.x_fcol, 0xffffff & x->x_gui.x_lcol);
|
||||
gfxstub_new(&x->x_gui.x_obj.ob_pd, x, buf);
|
||||
#endif /* ROCKBOX */
|
||||
}
|
||||
|
||||
static void vradio_dialog(t_vradio *x, t_symbol *s, int argc, t_atom *argv)
|
||||
|
@ -288,6 +337,10 @@ static void vradio_dialog(t_vradio *x, t_symbol *s, int argc, t_atom *argv)
|
|||
int num = (int)atom_getintarg(6, argc, argv);
|
||||
int sr_flags;
|
||||
|
||||
#ifdef ROCKBOX
|
||||
(void) s;
|
||||
#endif
|
||||
|
||||
if(chg != 0) chg = 1;
|
||||
x->x_change = chg;
|
||||
sr_flags = iemgui_dialog(&x->x_gui, srl, argc, argv);
|
||||
|
@ -463,12 +516,23 @@ static void vradio_click(t_vradio *x, t_floatarg xpos, t_floatarg ypos,
|
|||
{
|
||||
int yy = (int)ypos - text_ypix(&x->x_gui.x_obj, x->x_gui.x_glist);
|
||||
|
||||
#ifdef ROCKBOX
|
||||
(void) xpos;
|
||||
(void) shift;
|
||||
(void) ctrl;
|
||||
(void) alt;
|
||||
#endif
|
||||
|
||||
vradio_fout(x, (float)(yy / x->x_gui.x_h));
|
||||
}
|
||||
|
||||
static int vradio_newclick(t_gobj *z, struct _glist *glist,
|
||||
int xpix, int ypix, int shift, int alt, int dbl, int doit)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
(void) glist;
|
||||
(void) dbl;
|
||||
#endif
|
||||
if(doit)
|
||||
vradio_click((t_vradio *)z, (t_floatarg)xpix, (t_floatarg)ypix,
|
||||
(t_floatarg)shift, 0, (t_floatarg)alt);
|
||||
|
@ -502,6 +566,9 @@ static void vradio_number(t_vradio *x, t_floatarg num)
|
|||
|
||||
static void vradio_size(t_vradio *x, t_symbol *s, int ac, t_atom *av)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
(void) s;
|
||||
#endif
|
||||
x->x_gui.x_w = iemgui_clip_size((int)atom_getintarg(0, ac, av));
|
||||
x->x_gui.x_h = x->x_gui.x_w;
|
||||
iemgui_size((void *)x, &x->x_gui);
|
||||
|
@ -546,11 +613,21 @@ static void *vradio_donew(t_symbol *s, int argc, t_atom *argv, int old)
|
|||
{
|
||||
t_vradio *x = (t_vradio *)pd_new(old? vradio_old_class : vradio_class);
|
||||
int bflcol[]={-262144, -1, -1};
|
||||
#ifdef ROCKBOX
|
||||
int a=IEM_GUI_DEFAULTSIZE, on=0;
|
||||
#else
|
||||
int a=IEM_GUI_DEFAULTSIZE, on=0, f=0;
|
||||
#endif
|
||||
int ldx=0, ldy=-6, chg=1, num=8;
|
||||
int fs=8;
|
||||
#ifndef ROCKBOX
|
||||
int ftbreak=IEM_BNG_DEFAULTBREAKFLASHTIME, fthold=IEM_BNG_DEFAULTHOLDFLASHTIME;
|
||||
char str[144];
|
||||
#endif
|
||||
|
||||
#ifdef ROCKBOX
|
||||
(void) s;
|
||||
#endif
|
||||
|
||||
if((argc == 15)&&IS_A_FLOAT(argv,0)&&IS_A_FLOAT(argv,1)&&IS_A_FLOAT(argv,2)
|
||||
&&IS_A_FLOAT(argv,3)
|
||||
|
@ -632,7 +709,9 @@ static void vradio_ff(t_vradio *x)
|
|||
{
|
||||
if(x->x_gui.x_fsf.x_rcv_able)
|
||||
pd_unbind(&x->x_gui.x_obj.ob_pd, x->x_gui.x_rcv);
|
||||
#ifndef ROCKBOX
|
||||
gfxstub_deleteforkey(x);
|
||||
#endif
|
||||
}
|
||||
|
||||
void g_vradio_setup(void)
|
||||
|
|
|
@ -6,6 +6,13 @@
|
|||
/* thanks to Miller Puckette, Guenther Geiger and Krzystof Czaja */
|
||||
|
||||
|
||||
#ifdef ROCKBOX
|
||||
#include "plugin.h"
|
||||
#include "pdbox.h"
|
||||
#include "m_pd.h"
|
||||
#include "g_canvas.h"
|
||||
#include "g_all_guis.h"
|
||||
#else /* ROCKBOX */
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
|
@ -21,6 +28,7 @@
|
|||
#else
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
#endif /* ROCKBOX */
|
||||
|
||||
|
||||
/* ------------ vsl gui-vertical slider ----------------------- */
|
||||
|
@ -32,6 +40,10 @@ static t_class *vslider_class;
|
|||
|
||||
static void vslider_draw_update(t_vslider *x, t_glist *glist)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
(void) x;
|
||||
(void) glist;
|
||||
#else /* ROCKBOX */
|
||||
if (glist_isvisible(glist))
|
||||
{
|
||||
int r = text_ypix(&x->x_gui.x_obj, glist) + x->x_gui.x_h - (x->x_val + 50)/100;
|
||||
|
@ -41,10 +53,15 @@ static void vslider_draw_update(t_vslider *x, t_glist *glist)
|
|||
glist_getcanvas(glist), x, xpos+1, r,
|
||||
xpos + x->x_gui.x_w, r);
|
||||
}
|
||||
#endif /* ROCKBOX */
|
||||
}
|
||||
|
||||
static void vslider_draw_new(t_vslider *x, t_glist *glist)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
(void) x;
|
||||
(void) glist;
|
||||
#else /* ROCKBOX */
|
||||
int xpos=text_xpix(&x->x_gui.x_obj, glist);
|
||||
int ypos=text_ypix(&x->x_gui.x_obj, glist);
|
||||
int r = ypos + x->x_gui.x_h - (x->x_val + 50)/100;
|
||||
|
@ -74,10 +91,15 @@ static void vslider_draw_new(t_vslider *x, t_glist *glist)
|
|||
xpos, ypos-2,
|
||||
xpos+7, ypos-1,
|
||||
x, 0);
|
||||
#endif /* ROCKBOX */
|
||||
}
|
||||
|
||||
static void vslider_draw_move(t_vslider *x, t_glist *glist)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
(void) x;
|
||||
(void) glist;
|
||||
#else /* ROCKBOX */
|
||||
int xpos=text_xpix(&x->x_gui.x_obj, glist);
|
||||
int ypos=text_ypix(&x->x_gui.x_obj, glist);
|
||||
int r = ypos + x->x_gui.x_h - (x->x_val + 50)/100;
|
||||
|
@ -102,10 +124,15 @@ static void vslider_draw_move(t_vslider *x, t_glist *glist)
|
|||
canvas, x, 0,
|
||||
xpos, ypos-2,
|
||||
xpos+7, ypos-1);
|
||||
#endif /* ROCKBOX */
|
||||
}
|
||||
|
||||
static void vslider_draw_erase(t_vslider* x,t_glist* glist)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
(void) x;
|
||||
(void) glist;
|
||||
#else /* ROCKBOX */
|
||||
t_canvas *canvas=glist_getcanvas(glist);
|
||||
|
||||
sys_vgui(".x%x.c delete %xBASE\n", canvas, x);
|
||||
|
@ -115,10 +142,15 @@ static void vslider_draw_erase(t_vslider* x,t_glist* glist)
|
|||
sys_vgui(".x%x.c delete %xOUT%d\n", canvas, x, 0);
|
||||
if(!x->x_gui.x_fsf.x_rcv_able)
|
||||
sys_vgui(".x%x.c delete %xIN%d\n", canvas, x, 0);
|
||||
#endif /* ROCKBOX */
|
||||
}
|
||||
|
||||
static void vslider_draw_config(t_vslider* x,t_glist* glist)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
(void) x;
|
||||
(void) glist;
|
||||
#else /* ROCKBOX */
|
||||
t_canvas *canvas=glist_getcanvas(glist);
|
||||
|
||||
sys_vgui(".x%x.c itemconfigure %xLABEL -font {%s %d bold} -fill #%6.6x -text {%s} \n",
|
||||
|
@ -129,10 +161,16 @@ static void vslider_draw_config(t_vslider* x,t_glist* glist)
|
|||
x, x->x_gui.x_fcol);
|
||||
sys_vgui(".x%x.c itemconfigure %xBASE -fill #%6.6x\n", canvas,
|
||||
x, x->x_gui.x_bcol);
|
||||
#endif /* ROCKBOX */
|
||||
}
|
||||
|
||||
static void vslider_draw_io(t_vslider* x,t_glist* glist, int old_snd_rcv_flags)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
(void) x;
|
||||
(void) glist;
|
||||
(void) old_snd_rcv_flags;
|
||||
#else /* ROCKBOX */
|
||||
int xpos=text_xpix(&x->x_gui.x_obj, glist);
|
||||
int ypos=text_ypix(&x->x_gui.x_obj, glist);
|
||||
t_canvas *canvas=glist_getcanvas(glist);
|
||||
|
@ -153,10 +191,15 @@ static void vslider_draw_io(t_vslider* x,t_glist* glist, int old_snd_rcv_flags)
|
|||
x, 0);
|
||||
if(!(old_snd_rcv_flags & IEM_GUI_OLD_RCV_FLAG) && x->x_gui.x_fsf.x_rcv_able)
|
||||
sys_vgui(".x%x.c delete %xIN%d\n", canvas, x, 0);
|
||||
#endif /* ROCKBOX */
|
||||
}
|
||||
|
||||
static void vslider_draw_select(t_vslider *x, t_glist *glist)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
(void) x;
|
||||
(void) glist;
|
||||
#else /* ROCKBOX */
|
||||
t_canvas *canvas=glist_getcanvas(glist);
|
||||
|
||||
if(x->x_gui.x_fsf.x_selected)
|
||||
|
@ -169,6 +212,7 @@ static void vslider_draw_select(t_vslider *x, t_glist *glist)
|
|||
sys_vgui(".x%x.c itemconfigure %xBASE -outline #%6.6x\n", canvas, x, IEM_GUI_COLOR_NORMAL);
|
||||
sys_vgui(".x%x.c itemconfigure %xLABEL -fill #%6.6x\n", canvas, x, x->x_gui.x_lcol);
|
||||
}
|
||||
#endif /* ROCKBOX */
|
||||
}
|
||||
|
||||
void vslider_draw(t_vslider *x, t_glist *glist, int mode)
|
||||
|
@ -270,6 +314,10 @@ void vslider_check_minmax(t_vslider *x, double min, double max)
|
|||
|
||||
static void vslider_properties(t_gobj *z, t_glist *owner)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
(void) z;
|
||||
(void) owner;
|
||||
#else /* ROCKBOX */
|
||||
t_vslider *x = (t_vslider *)z;
|
||||
char buf[800];
|
||||
t_symbol *srl[3];
|
||||
|
@ -292,6 +340,7 @@ static void vslider_properties(t_gobj *z, t_glist *owner)
|
|||
x->x_gui.x_fsf.x_font_style, x->x_gui.x_fontsize,
|
||||
0xffffff & x->x_gui.x_bcol, 0xffffff & x->x_gui.x_fcol, 0xffffff & x->x_gui.x_lcol);
|
||||
gfxstub_new(&x->x_gui.x_obj.ob_pd, x, buf);
|
||||
#endif
|
||||
}
|
||||
|
||||
static void vslider_bang(t_vslider *x)
|
||||
|
@ -321,6 +370,10 @@ static void vslider_dialog(t_vslider *x, t_symbol *s, int argc, t_atom *argv)
|
|||
int steady = (int)atom_getintarg(17, argc, argv);
|
||||
int sr_flags;
|
||||
|
||||
#ifdef ROCKBOX
|
||||
(void) s;
|
||||
#endif
|
||||
|
||||
if(lilo != 0) lilo = 1;
|
||||
x->x_lin0_log1 = lilo;
|
||||
if(steady)
|
||||
|
@ -341,6 +394,10 @@ static void vslider_motion(t_vslider *x, t_floatarg dx, t_floatarg dy)
|
|||
{
|
||||
int old = x->x_val;
|
||||
|
||||
#ifdef ROCKBOX
|
||||
(void) dx;
|
||||
#endif
|
||||
|
||||
if(x->x_gui.x_fsf.x_finemoved)
|
||||
x->x_pos -= (int)dy;
|
||||
else
|
||||
|
@ -368,6 +425,11 @@ static void vslider_motion(t_vslider *x, t_floatarg dx, t_floatarg dy)
|
|||
static void vslider_click(t_vslider *x, t_floatarg xpos, t_floatarg ypos,
|
||||
t_floatarg shift, t_floatarg ctrl, t_floatarg alt)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
(void) shift;
|
||||
(void) ctrl;
|
||||
(void) alt;
|
||||
#endif
|
||||
if(!x->x_steady)
|
||||
x->x_val = (int)(100.0 * (x->x_gui.x_h + text_ypix(&x->x_gui.x_obj, x->x_gui.x_glist) - ypos));
|
||||
if(x->x_val > (100*x->x_gui.x_h - 100))
|
||||
|
@ -386,6 +448,11 @@ static int vslider_newclick(t_gobj *z, struct _glist *glist,
|
|||
{
|
||||
t_vslider* x = (t_vslider *)z;
|
||||
|
||||
#ifdef ROCKBOX
|
||||
(void) glist;
|
||||
(void) dbl;
|
||||
#endif
|
||||
|
||||
if(doit)
|
||||
{
|
||||
vslider_click( x, (t_floatarg)xpix, (t_floatarg)ypix, (t_floatarg)shift,
|
||||
|
@ -434,6 +501,9 @@ static void vslider_float(t_vslider *x, t_floatarg f)
|
|||
|
||||
static void vslider_size(t_vslider *x, t_symbol *s, int ac, t_atom *av)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
(void) s;
|
||||
#endif
|
||||
x->x_gui.x_w = iemgui_clip_size((int)atom_getintarg(0, ac, av));
|
||||
if(ac > 1)
|
||||
vslider_check_height(x, (int)atom_getintarg(1, ac, av));
|
||||
|
@ -448,6 +518,9 @@ static void vslider_pos(t_vslider *x, t_symbol *s, int ac, t_atom *av)
|
|||
|
||||
static void vslider_range(t_vslider *x, t_symbol *s, int ac, t_atom *av)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
(void) s;
|
||||
#endif
|
||||
vslider_check_minmax(x, (double)atom_getfloatarg(0, ac, av),
|
||||
(double)atom_getfloatarg(1, ac, av));
|
||||
}
|
||||
|
@ -506,10 +579,20 @@ static void *vslider_new(t_symbol *s, int argc, t_atom *argv)
|
|||
t_vslider *x = (t_vslider *)pd_new(vslider_class);
|
||||
int bflcol[]={-262144, -1, -1};
|
||||
int w=IEM_GUI_DEFAULTSIZE, h=IEM_SL_DEFAULTSIZE;
|
||||
#ifdef ROCKBOX
|
||||
int lilo=0, ldx=0, ldy=-8;
|
||||
#else
|
||||
int lilo=0, f=0, ldx=0, ldy=-8;
|
||||
#endif
|
||||
int fs=8, v=0, steady=1;
|
||||
double min=0.0, max=(double)(IEM_SL_DEFAULTSIZE-1);
|
||||
#ifndef ROCKBOX
|
||||
char str[144];
|
||||
#endif
|
||||
|
||||
#ifdef ROCKBOX
|
||||
(void) s;
|
||||
#endif
|
||||
|
||||
iem_inttosymargs(&x->x_gui.x_isa, 0);
|
||||
iem_inttofstyle(&x->x_gui.x_fsf, 0);
|
||||
|
@ -581,7 +664,9 @@ static void vslider_free(t_vslider *x)
|
|||
{
|
||||
if(x->x_gui.x_fsf.x_rcv_able)
|
||||
pd_unbind(&x->x_gui.x_obj.ob_pd, x->x_gui.x_rcv);
|
||||
#ifndef ROCKBOX
|
||||
gfxstub_deleteforkey(x);
|
||||
#endif
|
||||
}
|
||||
|
||||
void g_vslider_setup(void)
|
||||
|
|
|
@ -5,7 +5,13 @@
|
|||
/* g_7_guis.c written by Thomas Musil (c) IEM KUG Graz Austria 2000-2001 */
|
||||
/* thanks to Miller Puckette, Guenther Geiger and Krzystof Czaja */
|
||||
|
||||
|
||||
#ifdef ROCKBOX
|
||||
#include "plugin.h"
|
||||
#include "pdbox.h"
|
||||
#include "m_pd.h"
|
||||
#include "g_canvas.h"
|
||||
#include "g_all_guis.h"
|
||||
#else /* ROCKBOX */
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
|
@ -21,6 +27,7 @@
|
|||
#else
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
#endif /* ROCKBOX */
|
||||
|
||||
/* ----- vu gui-peak- & rms- vu-meter-display ---------- */
|
||||
|
||||
|
@ -31,6 +38,10 @@ static t_class *vu_class;
|
|||
|
||||
static void vu_update_rms(t_vu *x, t_glist *glist)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
(void) x;
|
||||
(void) glist;
|
||||
#else /* ROCKBOX */
|
||||
if(glist_isvisible(glist))
|
||||
{
|
||||
int w4=x->x_gui.x_w/4, off=text_ypix(&x->x_gui.x_obj, glist)-1;
|
||||
|
@ -40,10 +51,15 @@ static void vu_update_rms(t_vu *x, t_glist *glist)
|
|||
glist_getcanvas(glist), x, quad1, off, quad3,
|
||||
off + (x->x_led_size+1)*(IEM_VU_STEPS-x->x_rms));
|
||||
}
|
||||
#endif /* ROCKBOX */
|
||||
}
|
||||
|
||||
static void vu_update_peak(t_vu *x, t_glist *glist)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
(void) x;
|
||||
(void) glist;
|
||||
#else /* ROCKBOX */
|
||||
t_canvas *canvas=glist_getcanvas(glist);
|
||||
|
||||
if(glist_isvisible(glist))
|
||||
|
@ -74,10 +90,15 @@ static void vu_update_peak(t_vu *x, t_glist *glist)
|
|||
mid, ypos+20);
|
||||
}
|
||||
}
|
||||
#endif /* ROCKBOX */
|
||||
}
|
||||
|
||||
static void vu_draw_new(t_vu *x, t_glist *glist)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
(void) x;
|
||||
(void) glist;
|
||||
#else /* ROCKBOX */
|
||||
t_canvas *canvas=glist_getcanvas(glist);
|
||||
|
||||
int xpos=text_xpix(&x->x_gui.x_obj, glist);
|
||||
|
@ -151,11 +172,16 @@ static void vu_draw_new(t_vu *x, t_glist *glist)
|
|||
xpos+x->x_gui.x_w+1, ypos-1,
|
||||
x, 1);
|
||||
}
|
||||
#endif /* ROCKBOX */
|
||||
}
|
||||
|
||||
|
||||
static void vu_draw_move(t_vu *x, t_glist *glist)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
(void) x;
|
||||
(void) glist;
|
||||
#else /* ROCKBOX */
|
||||
t_canvas *canvas=glist_getcanvas(glist);
|
||||
|
||||
int xpos=text_xpix(&x->x_gui.x_obj, glist);
|
||||
|
@ -212,10 +238,15 @@ static void vu_draw_move(t_vu *x, t_glist *glist)
|
|||
xpos+x->x_gui.x_w+1-IOWIDTH, ypos-2,
|
||||
xpos+x->x_gui.x_w+1, ypos-1);
|
||||
}
|
||||
#endif /* ROCKBOX */
|
||||
}
|
||||
|
||||
static void vu_draw_erase(t_vu* x,t_glist* glist)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
(void) x;
|
||||
(void) glist;
|
||||
#else /* ROCKBOX */
|
||||
int i;
|
||||
t_canvas *canvas=glist_getcanvas(glist);
|
||||
|
||||
|
@ -244,10 +275,15 @@ static void vu_draw_erase(t_vu* x,t_glist* glist)
|
|||
sys_vgui(".x%x.c delete %xIN%d\n", canvas, x, 0);
|
||||
sys_vgui(".x%x.c delete %xIN%d\n", canvas, x, 1);
|
||||
}
|
||||
#endif /* ROCKBOX */
|
||||
}
|
||||
|
||||
static void vu_draw_config(t_vu* x, t_glist* glist)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
(void) x;
|
||||
(void) glist;
|
||||
#else /* ROCKBOX */
|
||||
int i;
|
||||
t_canvas *canvas=glist_getcanvas(glist);
|
||||
|
||||
|
@ -277,10 +313,16 @@ static void vu_draw_config(t_vu* x, t_glist* glist)
|
|||
x, x->x_gui.x_bcol, x->x_gui.x_bcol);
|
||||
sys_vgui(".x%x.c itemconfigure %xPLED -width %d\n", canvas, x,
|
||||
x->x_led_size);
|
||||
#endif /* ROCKBOX */
|
||||
}
|
||||
|
||||
static void vu_draw_io(t_vu* x, t_glist* glist, int old_snd_rcv_flags)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
(void) x;
|
||||
(void) glist;
|
||||
(void) old_snd_rcv_flags;
|
||||
#else /* ROCKBOX */
|
||||
int xpos=text_xpix(&x->x_gui.x_obj, glist);
|
||||
int ypos=text_ypix(&x->x_gui.x_obj, glist);
|
||||
t_canvas *canvas=glist_getcanvas(glist);
|
||||
|
@ -321,10 +363,15 @@ static void vu_draw_io(t_vu* x, t_glist* glist, int old_snd_rcv_flags)
|
|||
sys_vgui(".x%x.c delete %xIN%d\n", canvas, x, 0);
|
||||
sys_vgui(".x%x.c delete %xIN%d\n", canvas, x, 1);
|
||||
}
|
||||
#endif /* ROCKBOX */
|
||||
}
|
||||
|
||||
static void vu_draw_select(t_vu* x,t_glist* glist)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
(void) x;
|
||||
(void) glist;
|
||||
#else /* ROCKBOX */
|
||||
int i;
|
||||
t_canvas *canvas=glist_getcanvas(glist);
|
||||
|
||||
|
@ -362,6 +409,7 @@ static void vu_draw_select(t_vu* x,t_glist* glist)
|
|||
}
|
||||
sys_vgui(".x%x.c itemconfigure %xLABEL -fill #%6.6x\n", canvas, x, x->x_gui.x_lcol);
|
||||
}
|
||||
#endif /* ROCKBOX */
|
||||
}
|
||||
|
||||
void vu_draw(t_vu *x, t_glist *glist, int mode)
|
||||
|
@ -425,6 +473,10 @@ void vu_check_height(t_vu *x, int h)
|
|||
|
||||
static void vu_scale(t_vu *x, t_floatarg fscale)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
(void) x;
|
||||
(void) fscale;
|
||||
#else /* ROCKBOX */
|
||||
int i, scale = (int)fscale;
|
||||
|
||||
if(scale != 0) scale = 1;
|
||||
|
@ -446,7 +498,11 @@ static void vu_scale(t_vu *x, t_floatarg fscale)
|
|||
}
|
||||
if(!x->x_scale && scale)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
int end=text_xpix(&x->x_gui.x_obj, x->x_gui.x_glist)+x->x_gui.x_w+4;
|
||||
#else /* ROCKBOX */
|
||||
int w4=x->x_gui.x_w/4, end=text_xpix(&x->x_gui.x_obj, x->x_gui.x_glist)+x->x_gui.x_w+4;
|
||||
#endif /* ROCKBOX */
|
||||
int k1=x->x_led_size+1, k2=IEM_VU_STEPS+1, k3=k1/2;
|
||||
int yyy, k4=text_ypix(&x->x_gui.x_obj, x->x_gui.x_glist)-k3;
|
||||
t_canvas *canvas=glist_getcanvas(x->x_gui.x_glist);
|
||||
|
@ -471,10 +527,15 @@ static void vu_scale(t_vu *x, t_floatarg fscale)
|
|||
x->x_gui.x_lcol, x, i);
|
||||
}
|
||||
}
|
||||
#endif /* ROCKBOX */
|
||||
}
|
||||
|
||||
static void vu_properties(t_gobj *z, t_glist *owner)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
(void) z;
|
||||
(void) owner;
|
||||
#else /* ROCKBOX */
|
||||
t_vu *x = (t_vu *)z;
|
||||
char buf[800];
|
||||
t_symbol *srl[3];
|
||||
|
@ -496,6 +557,7 @@ static void vu_properties(t_gobj *z, t_glist *owner)
|
|||
x->x_gui.x_fsf.x_font_style, x->x_gui.x_fontsize,
|
||||
0xffffff & x->x_gui.x_bcol, -1/*no front-color*/, 0xffffff & x->x_gui.x_lcol);
|
||||
gfxstub_new(&x->x_gui.x_obj.ob_pd, x, buf);
|
||||
#endif /* ROCKBOX */
|
||||
}
|
||||
|
||||
static void vu_dialog(t_vu *x, t_symbol *s, int argc, t_atom *argv)
|
||||
|
@ -506,6 +568,10 @@ static void vu_dialog(t_vu *x, t_symbol *s, int argc, t_atom *argv)
|
|||
int scale = (int)atom_getintarg(4, argc, argv);
|
||||
int sr_flags;
|
||||
|
||||
#ifdef ROCKBOX
|
||||
(void) s;
|
||||
#endif
|
||||
|
||||
srl[0] = gensym("empty");
|
||||
sr_flags = iemgui_dialog(&x->x_gui, srl, argc, argv);
|
||||
x->x_gui.x_fsf.x_snd_able = 0;
|
||||
|
@ -523,6 +589,9 @@ static void vu_dialog(t_vu *x, t_symbol *s, int argc, t_atom *argv)
|
|||
|
||||
static void vu_size(t_vu *x, t_symbol *s, int ac, t_atom *av)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
(void) s;
|
||||
#endif
|
||||
x->x_gui.x_w = iemgui_clip_size((int)atom_getintarg(0, ac, av));
|
||||
if(ac > 1)
|
||||
vu_check_height(x, (int)atom_getintarg(1, ac, av));
|
||||
|
@ -608,9 +677,14 @@ static void *vu_new(t_symbol *s, int argc, t_atom *argv)
|
|||
t_vu *x = (t_vu *)pd_new(vu_class);
|
||||
int bflcol[]={-66577, -1, -1};
|
||||
int w=IEM_GUI_DEFAULTSIZE, h=IEM_VU_STEPS*IEM_VU_DEFAULTSIZE;
|
||||
#ifdef ROCKBOX
|
||||
int ldx=-1, ldy=-8, fs=8, scale=1;
|
||||
(void) s;
|
||||
#else /* ROCKBOX */
|
||||
int ldx=-1, ldy=-8, f=0, fs=8, scale=1;
|
||||
int ftbreak=IEM_BNG_DEFAULTBREAKFLASHTIME, fthold=IEM_BNG_DEFAULTHOLDFLASHTIME;
|
||||
char str[144];
|
||||
#endif /* ROCKBOX */
|
||||
|
||||
iem_inttosymargs(&x->x_gui.x_isa, 0);
|
||||
iem_inttofstyle(&x->x_gui.x_fsf, 0);
|
||||
|
@ -678,7 +752,9 @@ static void vu_free(t_vu *x)
|
|||
{
|
||||
if(x->x_gui.x_fsf.x_rcv_able)
|
||||
pd_unbind(&x->x_gui.x_obj.ob_pd, x->x_gui.x_rcv);
|
||||
#ifndef ROCKBOX
|
||||
gfxstub_deleteforkey(x);
|
||||
#endif
|
||||
}
|
||||
|
||||
void g_vumeter_setup(void)
|
||||
|
|
|
@ -3,8 +3,14 @@
|
|||
* WARRANTIES, see the file, "LICENSE.txt," in this distribution. */
|
||||
|
||||
#include "m_pd.h"
|
||||
|
||||
#ifdef ROCKBOX
|
||||
#include "plugin.h"
|
||||
#include "pdbox.h"
|
||||
#else /* ROCKBOX */
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#endif /* ROCKBOX */
|
||||
|
||||
/* convenience routines for checking and getting values of
|
||||
atoms. There's no "pointer" version since there's nothing
|
||||
|
@ -23,7 +29,9 @@ t_int atom_getint(t_atom *a)
|
|||
|
||||
t_symbol *atom_getsymbol(t_atom *a) /* LATER think about this more carefully */
|
||||
{
|
||||
#ifndef ROCKBOX
|
||||
char buf[30];
|
||||
#endif
|
||||
if (a->a_type == A_SYMBOL) return (a->a_w.w_symbol);
|
||||
else return (&s_float);
|
||||
}
|
||||
|
@ -33,7 +41,11 @@ t_symbol *atom_gensym(t_atom *a) /* this works better for graph labels */
|
|||
char buf[30];
|
||||
if (a->a_type == A_SYMBOL) return (a->a_w.w_symbol);
|
||||
else if (a->a_type == A_FLOAT)
|
||||
#ifdef ROCKBOX
|
||||
ftoan(a->a_w.w_float, buf, sizeof(buf)-1);
|
||||
#else
|
||||
sprintf(buf, "%g", a->a_w.w_float);
|
||||
#endif
|
||||
else strcpy(buf, "???");
|
||||
return (gensym(buf));
|
||||
}
|
||||
|
@ -76,7 +88,11 @@ void atom_string(t_atom *a, char *buf, unsigned int bufsize)
|
|||
strcpy(buf, "(pointer)");
|
||||
break;
|
||||
case A_FLOAT:
|
||||
#ifdef ROCKBOX
|
||||
ftoan(a->a_w.w_float, tbuf, sizeof(tbuf)-1);
|
||||
#else
|
||||
sprintf(tbuf, "%g", a->a_w.w_float);
|
||||
#endif
|
||||
if (strlen(tbuf) < bufsize-1) strcpy(buf, tbuf);
|
||||
else if (a->a_w.w_float < 0) strcpy(buf, "-");
|
||||
else strcat(buf, "+");
|
||||
|
@ -118,10 +134,10 @@ void atom_string(t_atom *a, char *buf, unsigned int bufsize)
|
|||
}
|
||||
break;
|
||||
case A_DOLLAR:
|
||||
sprintf(buf, "$%d", a->a_w.w_index);
|
||||
snprintf(buf, bufsize-1, "$%d", a->a_w.w_index);
|
||||
break;
|
||||
case A_DOLLSYM:
|
||||
sprintf(buf, "$%s", a->a_w.w_symbol->s_name);
|
||||
snprintf(buf, bufsize-1, "$%s", a->a_w.w_symbol->s_name);
|
||||
break;
|
||||
default:
|
||||
bug("atom_string");
|
||||
|
|
|
@ -10,9 +10,15 @@
|
|||
* change marked with IOhannes
|
||||
*/
|
||||
|
||||
#ifdef ROCKBOX
|
||||
#include "plugin.h"
|
||||
#include "pdbox.h"
|
||||
#ifdef SIMULATOR
|
||||
int printf(const char *fmt, ...);
|
||||
void perror(const char*);
|
||||
#endif
|
||||
#else /* ROCKBOX */
|
||||
#include <stdlib.h>
|
||||
#include "m_pd.h"
|
||||
#include "s_stuff.h"
|
||||
#include <stdio.h>
|
||||
#ifdef UNIX
|
||||
#include <unistd.h>
|
||||
|
@ -21,8 +27,13 @@
|
|||
#include <io.h>
|
||||
#endif
|
||||
#include <fcntl.h>
|
||||
|
||||
#include <string.h>
|
||||
#include <stdarg.h>
|
||||
#endif /* ROCKBOX */
|
||||
|
||||
#include "m_pd.h"
|
||||
#include "s_stuff.h"
|
||||
|
||||
struct _binbuf
|
||||
{
|
||||
|
@ -72,7 +83,9 @@ void binbuf_text(t_binbuf *x, char *text, size_t size)
|
|||
x->b_n = 0;
|
||||
while (1)
|
||||
{
|
||||
#ifndef ROCKBOX
|
||||
int type;
|
||||
#endif
|
||||
/* skip leading space */
|
||||
while ((textp != etext) && (*textp == ' ' || *textp == '\n'
|
||||
|| *textp == '\r' || *textp == '\t')) textp++;
|
||||
|
@ -158,6 +171,7 @@ void binbuf_text(t_binbuf *x, char *text, size_t size)
|
|||
#if 0
|
||||
post("buf %s", buf);
|
||||
#endif
|
||||
|
||||
if (*buf == '$' && buf[1] >= '0' && buf[1] <= '9' && !firstslash)
|
||||
{
|
||||
for (bufp = buf+2; *bufp; bufp++)
|
||||
|
@ -219,7 +233,7 @@ void binbuf_gettext(t_binbuf *x, char **bufp, int *lengthp)
|
|||
}
|
||||
if (length && buf[length-1] == ' ')
|
||||
{
|
||||
if (newbuf = t_resizebytes(buf, length, length-1))
|
||||
if((newbuf = t_resizebytes(buf, length, length-1)))
|
||||
{
|
||||
buf = newbuf;
|
||||
length--;
|
||||
|
@ -236,8 +250,8 @@ void binbuf_add(t_binbuf *x, int argc, t_atom *argv)
|
|||
{
|
||||
int newsize = x->b_n + argc, i;
|
||||
t_atom *ap;
|
||||
if (ap = t_resizebytes(x->b_vec, x->b_n * sizeof(*x->b_vec),
|
||||
newsize * sizeof(*x->b_vec)))
|
||||
if((ap = t_resizebytes(x->b_vec, x->b_n * sizeof(*x->b_vec),
|
||||
newsize * sizeof(*x->b_vec))))
|
||||
x->b_vec = ap;
|
||||
else
|
||||
{
|
||||
|
@ -310,11 +324,19 @@ void binbuf_addbinbuf(t_binbuf *x, t_binbuf *y)
|
|||
SETSYMBOL(ap, gensym(","));
|
||||
break;
|
||||
case A_DOLLAR:
|
||||
#ifdef ROCKBOX
|
||||
snprintf(tbuf, sizeof(tbuf)-1, "$%d", ap->a_w.w_index);
|
||||
#else /* ROCKBOX */
|
||||
sprintf(tbuf, "$%d", ap->a_w.w_index);
|
||||
#endif /* ROCKBOX */
|
||||
SETSYMBOL(ap, gensym(tbuf));
|
||||
break;
|
||||
case A_DOLLSYM:
|
||||
#ifdef ROCKBOX
|
||||
snprintf(tbuf, sizeof(tbuf)-1, "$%s", ap->a_w.w_symbol->s_name);
|
||||
#else /* ROCKBOX */
|
||||
sprintf(tbuf, "$%s", ap->a_w.w_symbol->s_name);
|
||||
#endif /* ROCKBOX */
|
||||
SETSYMBOL(ap, gensym(tbuf));
|
||||
break;
|
||||
case A_SYMBOL:
|
||||
|
@ -346,8 +368,8 @@ void binbuf_restore(t_binbuf *x, int argc, t_atom *argv)
|
|||
{
|
||||
int newsize = x->b_n + argc, i;
|
||||
t_atom *ap;
|
||||
if (ap = t_resizebytes(x->b_vec, x->b_n * sizeof(*x->b_vec),
|
||||
newsize * sizeof(*x->b_vec)))
|
||||
if((ap = t_resizebytes(x->b_vec, x->b_n * sizeof(*x->b_vec),
|
||||
newsize * sizeof(*x->b_vec))))
|
||||
x->b_vec = ap;
|
||||
else
|
||||
{
|
||||
|
@ -374,7 +396,11 @@ void binbuf_restore(t_binbuf *x, int argc, t_atom *argv)
|
|||
else
|
||||
{
|
||||
int dollar = 0;
|
||||
#ifdef ROCKBOX
|
||||
dollar = atoi(argv->a_w.w_symbol->s_name + 1);
|
||||
#else
|
||||
sscanf(argv->a_w.w_symbol->s_name + 1, "%d", &dollar);
|
||||
#endif
|
||||
SETDOLLAR(ap, dollar);
|
||||
}
|
||||
}
|
||||
|
@ -430,10 +456,18 @@ t_symbol *binbuf_realizedollsym(t_symbol *s, int ac, t_atom *av, int tonew)
|
|||
{
|
||||
if (!tonew)
|
||||
return (0);
|
||||
#ifdef ROCKBOX
|
||||
else snprintf(buf, sizeof(buf)-1, "$%d", argno);
|
||||
#else /* ROCKBOX */
|
||||
else sprintf(buf, "$%d", argno);
|
||||
#endif /* ROCKBOX */
|
||||
}
|
||||
else if (argno == 0)
|
||||
#ifdef ROCKBOX
|
||||
snprintf(buf, sizeof(buf)-1, "%d", canvas_getdollarzero());
|
||||
#else /* ROCKBOX */
|
||||
sprintf(buf, "%d", canvas_getdollarzero());
|
||||
#endif /* ROCKBOX */
|
||||
else
|
||||
atom_string(av+(argno-1), buf, MAXPDSTRING/2-1);
|
||||
strncat(buf, sp, MAXPDSTRING/2-1);
|
||||
|
@ -582,6 +616,10 @@ void binbuf_eval(t_binbuf *x, t_pd *target, int argc, t_atom *argv)
|
|||
if (nargs == 1) pd_float(target, stackwas->a_w.w_float);
|
||||
else pd_list(target, 0, nargs, stackwas);
|
||||
break;
|
||||
#ifdef ROCKBOX
|
||||
default:
|
||||
break;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
msp = stackwas;
|
||||
|
@ -606,12 +644,14 @@ static int binbuf_doopen(char *s, int mode)
|
|||
return (open(namebuf, mode));
|
||||
}
|
||||
|
||||
#ifndef ROCKBOX
|
||||
static FILE *binbuf_dofopen(char *s, char *mode)
|
||||
{
|
||||
char namebuf[MAXPDSTRING];
|
||||
sys_bashfilename(s, namebuf);
|
||||
return (fopen(namebuf, mode));
|
||||
}
|
||||
#endif
|
||||
|
||||
int binbuf_read(t_binbuf *b, char *filename, char *dirname, int crflag)
|
||||
{
|
||||
|
@ -628,22 +668,43 @@ int binbuf_read(t_binbuf *b, char *filename, char *dirname, int crflag)
|
|||
|
||||
if ((fd = binbuf_doopen(namebuf, 0)) < 0)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
#ifdef SIMULATOR
|
||||
printf("open: ");
|
||||
perror(namebuf);
|
||||
#endif /* SIMULATOR */
|
||||
#else /* ROCKBOX */
|
||||
fprintf(stderr, "open: ");
|
||||
perror(namebuf);
|
||||
#endif /* ROCKBOX */
|
||||
return (1);
|
||||
}
|
||||
if ((length = lseek(fd, 0, SEEK_END)) < 0 || lseek(fd, 0, SEEK_SET) < 0
|
||||
|| !(buf = t_getbytes(length)))
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
#ifdef SIMULATOR
|
||||
printf("lseek: ");
|
||||
perror(namebuf);
|
||||
#endif /* SIMULATOR */
|
||||
#else /* ROCKBOX */
|
||||
fprintf(stderr, "lseek: ");
|
||||
perror(namebuf);
|
||||
#endif /* ROCKBOX */
|
||||
close(fd);
|
||||
return(1);
|
||||
}
|
||||
if ((readret = read(fd, buf, length)) < length)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
#ifdef SIMULATOR
|
||||
printf("read (%d %ld) -> %d\n", fd, length, readret);
|
||||
perror(namebuf);
|
||||
#endif /* SIMULATOR */
|
||||
#else /* ROCKBOX */
|
||||
fprintf(stderr, "read (%d %ld) -> %d\n", fd, length, readret);
|
||||
perror(namebuf);
|
||||
#endif /* ROCKBOX */
|
||||
close(fd);
|
||||
t_freebytes(buf, length);
|
||||
return(1);
|
||||
|
@ -691,7 +752,11 @@ static t_binbuf *binbuf_convert(t_binbuf *oldb, int maxtopd);
|
|||
semicolons. */
|
||||
int binbuf_write(t_binbuf *x, char *filename, char *dir, int crflag)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
int f = 0;
|
||||
#else /* ROCKBOX */
|
||||
FILE *f = 0;
|
||||
#endif /* ROCKBOX */
|
||||
char sbuf[WBUFSIZE], fbuf[MAXPDSTRING], *bp = sbuf, *ep = sbuf + WBUFSIZE;
|
||||
t_atom *ap;
|
||||
int indx, deleteit = 0;
|
||||
|
@ -707,9 +772,19 @@ int binbuf_write(t_binbuf *x, char *filename, char *dir, int crflag)
|
|||
deleteit = 1;
|
||||
}
|
||||
|
||||
#ifdef ROCKBOX
|
||||
if(!(f = binbuf_doopen(fbuf, O_WRONLY|O_CREAT|O_TRUNC)))
|
||||
#else /* ROCKBOX */
|
||||
if (!(f = binbuf_dofopen(fbuf, "w")))
|
||||
#endif /* ROCKBOX */
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
#ifdef SIMULATOR
|
||||
printf("open: ");
|
||||
#endif /* SIMULATOR */
|
||||
#else /* ROCKBOX */
|
||||
fprintf(stderr, "open: ");
|
||||
#endif /* ROCKBOX */
|
||||
sys_unixerror(fbuf);
|
||||
goto fail;
|
||||
}
|
||||
|
@ -723,7 +798,11 @@ int binbuf_write(t_binbuf *x, char *filename, char *dir, int crflag)
|
|||
else length = 40;
|
||||
if (ep - bp < length)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
if(write(f, sbuf, bp-sbuf) < 1)
|
||||
#else /* ROCKBOX */
|
||||
if (fwrite(sbuf, bp-sbuf, 1, f) < 1)
|
||||
#endif /* ROCKBOX */
|
||||
{
|
||||
sys_unixerror(fbuf);
|
||||
goto fail;
|
||||
|
@ -750,20 +829,32 @@ int binbuf_write(t_binbuf *x, char *filename, char *dir, int crflag)
|
|||
ncolumn++;
|
||||
}
|
||||
}
|
||||
#ifdef ROCKBOX
|
||||
if(write(f, sbuf, bp-sbuf) < 1)
|
||||
#else /* ROCKBOX */
|
||||
if (fwrite(sbuf, bp-sbuf, 1, f) < 1)
|
||||
#endif /* ROCKBOX */
|
||||
{
|
||||
sys_unixerror(fbuf);
|
||||
goto fail;
|
||||
}
|
||||
if (deleteit)
|
||||
binbuf_free(x);
|
||||
#ifdef ROCKBOX
|
||||
close(f);
|
||||
#else /* ROCKBOX */
|
||||
fclose(f);
|
||||
#endif /* ROCKBOX */
|
||||
return (0);
|
||||
fail:
|
||||
if (deleteit)
|
||||
binbuf_free(x);
|
||||
if (f)
|
||||
#ifdef ROCKBOX
|
||||
close(f);
|
||||
#else /* ROCKBOX */
|
||||
fclose(f);
|
||||
#endif /* ROCKBOX */
|
||||
return (1);
|
||||
}
|
||||
|
||||
|
@ -816,13 +907,21 @@ static t_binbuf *binbuf_convert(t_binbuf *oldb, int maxtopd)
|
|||
if (nextmess[i].a_type == A_DOLLAR)
|
||||
{
|
||||
char buf[100];
|
||||
#ifdef ROCKBOX
|
||||
snprintf(buf, sizeof(buf)-1, "$%d", nextmess[i].a_w.w_index);
|
||||
#else /* ROCKBOX */
|
||||
sprintf(buf, "$%d", nextmess[i].a_w.w_index);
|
||||
#endif /* ROCKBOX */
|
||||
SETSYMBOL(nextmess+i, gensym(buf));
|
||||
}
|
||||
else if (nextmess[i].a_type == A_DOLLSYM)
|
||||
{
|
||||
char buf[100];
|
||||
#ifdef ROCKBOX
|
||||
snprintf(buf, sizeof(buf)-1, "$%s", nextmess[i].a_w.w_symbol->s_name);
|
||||
#else /* ROCKBOX */
|
||||
sprintf(buf, "$%s", nextmess[i].a_w.w_symbol->s_name);
|
||||
#endif /* ROCKBOX */
|
||||
SETSYMBOL(nextmess+i, gensym(buf));
|
||||
}
|
||||
}
|
||||
|
@ -846,7 +945,11 @@ static t_binbuf *binbuf_convert(t_binbuf *oldb, int maxtopd)
|
|||
atom_getfloatarg(2, natom, nextmess),
|
||||
atom_getfloatarg(5, natom, nextmess) -
|
||||
atom_getfloatarg(3, natom, nextmess),
|
||||
#ifdef ROCKBOX
|
||||
10.0);
|
||||
#else
|
||||
(float)sys_defaultfont);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
if (!strcmp(first, "#P"))
|
||||
|
@ -1157,13 +1260,13 @@ int binbuf_match(t_binbuf *inbuf, t_binbuf *searchbuf)
|
|||
t_atom *a1 = &inbuf->b_vec[indexin + nmatched],
|
||||
*a2 = &searchbuf->b_vec[nmatched];
|
||||
if (a1->a_type != a2->a_type ||
|
||||
a1->a_type == A_SYMBOL && a1->a_w.w_symbol != a2->a_w.w_symbol
|
||||
(a1->a_type == A_SYMBOL && a1->a_w.w_symbol != a2->a_w.w_symbol)
|
||||
||
|
||||
a1->a_type == A_FLOAT && a1->a_w.w_float != a2->a_w.w_float
|
||||
(a1->a_type == A_FLOAT && a1->a_w.w_float != a2->a_w.w_float)
|
||||
||
|
||||
a1->a_type == A_DOLLAR && a1->a_w.w_index != a2->a_w.w_index
|
||||
(a1->a_type == A_DOLLAR && a1->a_w.w_index != a2->a_w.w_index)
|
||||
||
|
||||
a1->a_type == A_DOLLSYM && a1->a_w.w_symbol != a2->a_w.w_symbol)
|
||||
(a1->a_type == A_DOLLSYM && a1->a_w.w_symbol != a2->a_w.w_symbol))
|
||||
goto nomatch;
|
||||
}
|
||||
return (1);
|
||||
|
@ -1183,9 +1286,12 @@ void binbuf_evalfile(t_symbol *name, t_symbol *dir)
|
|||
/* set filename so that new canvases can pick them up */
|
||||
int dspstate = canvas_suspend_dsp();
|
||||
glob_setfilename(0, name, dir);
|
||||
|
||||
if (binbuf_read(b, name->s_name, dir->s_name, 0))
|
||||
{
|
||||
#if !defined(ROCKBOX) || (defined(ROCKBOX) && defined(SIMULATOR))
|
||||
perror(name->s_name);
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1205,6 +1311,10 @@ void binbuf_evalfile(t_symbol *name, t_symbol *dir)
|
|||
void glob_evalfile(t_pd *ignore, t_symbol *name, t_symbol *dir)
|
||||
{
|
||||
t_pd *x = 0;
|
||||
|
||||
#ifdef ROCKBOX
|
||||
(void) ignore;
|
||||
#endif
|
||||
/* even though binbuf_evalfile appears to take care of dspstate,
|
||||
we have to do it again here, because canvas_startdsp() assumes
|
||||
that all toplevel canvases are visible. LATER check if this
|
||||
|
|
|
@ -2,10 +2,23 @@
|
|||
* For information on usage and redistribution, and for a DISCLAIMER OF ALL
|
||||
* WARRANTIES, see the file, "LICENSE.txt," in this distribution. */
|
||||
|
||||
#if 0
|
||||
//#ifdef ROCKBOX
|
||||
#include "plugin.h"
|
||||
#include "pdbox.h"
|
||||
#endif
|
||||
|
||||
#define PD_CLASS_DEF
|
||||
#include "m_pd.h"
|
||||
#include "m_imp.h"
|
||||
#include "s_stuff.h"
|
||||
|
||||
#ifdef ROCKBOX
|
||||
|
||||
#include "plugin.h"
|
||||
#include "pdbox.h"
|
||||
|
||||
#else /* ROCKBOX */
|
||||
#include <stdlib.h>
|
||||
#ifdef UNIX
|
||||
#include <unistd.h>
|
||||
|
@ -16,6 +29,7 @@
|
|||
|
||||
#include <stdarg.h>
|
||||
#include <string.h>
|
||||
#endif /* ROCKBOX */
|
||||
|
||||
static t_symbol *class_loadsym; /* name under which an extern is invoked */
|
||||
static void pd_defaultfloat(t_pd *x, t_float f);
|
||||
|
@ -27,6 +41,10 @@ static t_symbol *class_extern_dir = &s_;
|
|||
|
||||
static void pd_defaultanything(t_pd *x, t_symbol *s, int argc, t_atom *argv)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
(void) argc;
|
||||
(void) argv;
|
||||
#endif
|
||||
pd_error(x, "%s: no method for '%s'", (*x)->c_name->s_name, s->s_name);
|
||||
}
|
||||
|
||||
|
@ -422,6 +440,10 @@ char *class_gethelpdir(t_class *c)
|
|||
|
||||
static void class_nosavefn(t_gobj *z, t_binbuf *b)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
(void) z;
|
||||
(void) b;
|
||||
#endif
|
||||
bug("save function called but not defined");
|
||||
}
|
||||
|
||||
|
@ -465,7 +487,7 @@ t_symbol *dogensym(char *s, t_symbol *oldsym)
|
|||
s2++;
|
||||
}
|
||||
sym1 = symhash + (hash2 & (HASHSIZE-1));
|
||||
while (sym2 = *sym1)
|
||||
while ((sym2 = *sym1))
|
||||
{
|
||||
if (!strcmp(sym2->s_name, s)) return(sym2);
|
||||
sym1 = &sym2->s_next;
|
||||
|
@ -485,10 +507,14 @@ t_symbol *dogensym(char *s, t_symbol *oldsym)
|
|||
|
||||
t_symbol *gensym(char *s)
|
||||
{
|
||||
printf("gensym: %s\n", s);
|
||||
return(dogensym(s, 0));
|
||||
}
|
||||
|
||||
static t_symbol *addfileextent(t_symbol *s)
|
||||
#ifndef ROCKBOX
|
||||
static
|
||||
#endif
|
||||
t_symbol *addfileextent(t_symbol *s)
|
||||
{
|
||||
char namebuf[MAXPDSTRING], *str = s->s_name;
|
||||
int ln = strlen(str);
|
||||
|
@ -608,7 +634,9 @@ typedef t_pd *(*t_fun6)(t_int i1, t_int i2, t_int i3, t_int i4, t_int i5, t_int
|
|||
|
||||
void pd_typedmess(t_pd *x, t_symbol *s, int argc, t_atom *argv)
|
||||
{
|
||||
#ifndef ROCKBOX
|
||||
t_method *f;
|
||||
#endif
|
||||
t_class *c = *x;
|
||||
t_methodentry *m;
|
||||
t_atomtype *wp, wanttype;
|
||||
|
@ -658,9 +686,10 @@ void pd_typedmess(t_pd *x, t_symbol *s, int argc, t_atom *argv)
|
|||
else (*((t_messgimme)(m->me_fun)))(x, s, argc, argv);
|
||||
return;
|
||||
}
|
||||
|
||||
if (argc > MAXPDARG) argc = MAXPDARG;
|
||||
if (x != &pd_objectmaker) *(ap++) = (t_int)x, narg++;
|
||||
while (wanttype = *wp++)
|
||||
while((wanttype = *wp++))
|
||||
{
|
||||
switch (wanttype)
|
||||
{
|
||||
|
@ -712,6 +741,11 @@ void pd_typedmess(t_pd *x, t_symbol *s, int argc, t_atom *argv)
|
|||
}
|
||||
narg++;
|
||||
ap++;
|
||||
#ifdef ROCKBOX
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
switch (narg)
|
||||
|
|
|
@ -51,6 +51,9 @@ void d_osc_setup(void);
|
|||
void d_soundfile_setup(void);
|
||||
void d_ugen_setup(void);
|
||||
|
||||
/* PD anywhere specific. -- W.B. */
|
||||
void d_intern_setup(void);
|
||||
|
||||
void conf_init(void)
|
||||
{
|
||||
g_array_setup();
|
||||
|
@ -81,11 +84,15 @@ void conf_init(void)
|
|||
x_time_setup();
|
||||
x_arithmetic_setup();
|
||||
|
||||
#ifndef ROCKBOX
|
||||
x_midi_setup();
|
||||
#endif
|
||||
x_misc_setup();
|
||||
x_net_setup();
|
||||
x_qlist_setup();
|
||||
#ifndef ROCKBOX
|
||||
x_gui_setup();
|
||||
#endif
|
||||
d_arithmetic_setup();
|
||||
d_dac_setup();
|
||||
d_fft_setup();
|
||||
|
|
|
@ -1,9 +1,14 @@
|
|||
|
||||
#ifdef ROCKBOX
|
||||
#include "plugin.h"
|
||||
#include "pdbox.h"
|
||||
#else /* ROCKBOX */
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>
|
||||
#include <netinet/tcp.h>
|
||||
#include <netdb.h>
|
||||
#include <stdio.h>
|
||||
#endif /* ROCKBOX */
|
||||
|
||||
#include "m_pd.h"
|
||||
#include "m_imp.h"
|
||||
|
@ -21,8 +26,19 @@ static t_int x_fd = -1;
|
|||
|
||||
|
||||
|
||||
static void ipod_connect()
|
||||
static void ipod_connect(void)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
if (x_fd >= 0)
|
||||
{
|
||||
error("ipod_connect: already connected");
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
x_fd++;
|
||||
}
|
||||
#else /* ROCKBOX */
|
||||
struct sockaddr_in server;
|
||||
struct hostent *hp;
|
||||
int sockfd;
|
||||
|
@ -65,6 +81,7 @@ static void ipod_connect()
|
|||
}
|
||||
post("connected %s %d",hostname,portno);
|
||||
x_fd = sockfd;
|
||||
#endif /* ROCKBOX */
|
||||
}
|
||||
|
||||
|
||||
|
@ -72,8 +89,13 @@ static void ipod_connect()
|
|||
static void ipod_bang(t_ipod *x)
|
||||
{
|
||||
static char sendme[200];
|
||||
#ifdef ROCKBOX
|
||||
snprintf(sendme, sizeof(sendme)-1, "%s bang;\n", x->x_what->s_name);
|
||||
SEND_FROM_CORE(sendme);
|
||||
#else /* ROCKBOX */
|
||||
sprintf(sendme,"%s bang;\n",x->x_what->s_name);
|
||||
send(x_fd,sendme,strlen(sendme),0);
|
||||
#endif /*ROCKBOX */
|
||||
|
||||
// if (x->x_sym->s_thing) pd_bang(x->x_sym->s_thing);
|
||||
}
|
||||
|
@ -81,9 +103,19 @@ static void ipod_bang(t_ipod *x)
|
|||
static void ipod_float(t_ipod *x, t_float f)
|
||||
{
|
||||
static char sendme[200];
|
||||
#ifdef ROCKBOX
|
||||
char f_buf[32];
|
||||
|
||||
ftoan(f, f_buf, sizeof(f_buf)-1);
|
||||
strcpy(sendme, x->x_what->s_name);
|
||||
strcat(sendme, " ");
|
||||
strcat(sendme, f_buf);
|
||||
|
||||
SEND_FROM_CORE(sendme);
|
||||
#else /* ROCKBOX */
|
||||
sprintf(sendme,"%s %f;\n",x->x_what->s_name,f);
|
||||
send(x_fd,sendme,strlen(sendme),0);
|
||||
#endif /* ROCKBOX */
|
||||
|
||||
// post("forwarding float %s",x->x_what->s_name);
|
||||
// if (x->x_sym->s_thing) pd_float(x->x_sym->s_thing, f);
|
||||
|
|
|
@ -83,6 +83,7 @@ void glob_init(void)
|
|||
gensym("audiostatus"), 0);
|
||||
class_addmethod(glob_pdobject, (t_method)glob_finderror,
|
||||
gensym("finderror"), 0);
|
||||
#ifndef ROCKBOX
|
||||
class_addmethod(glob_pdobject, (t_method)glob_audio_properties,
|
||||
gensym("audio-properties"), A_DEFFLOAT, 0);
|
||||
class_addmethod(glob_pdobject, (t_method)glob_audio_dialog,
|
||||
|
@ -93,6 +94,7 @@ void glob_init(void)
|
|||
gensym("midi-properties"), A_DEFFLOAT, 0);
|
||||
class_addmethod(glob_pdobject, (t_method)glob_midi_dialog,
|
||||
gensym("midi-dialog"), A_GIMME, 0);
|
||||
#endif /* ROCKBOX */
|
||||
class_addmethod(glob_pdobject, (t_method)glob_start_path_dialog,
|
||||
gensym("start-path-dialog"), A_DEFFLOAT, 0);
|
||||
class_addmethod(glob_pdobject, (t_method)glob_path_dialog,
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
#ifdef ROCKBOX
|
||||
#include "plugin.h"
|
||||
#define memset rb->memset
|
||||
#include "pdbox.h"
|
||||
#else /* ROCKBOX */
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
|
|
@ -53,9 +53,9 @@ t_inlet *inlet_new(t_object *owner, t_pd *dest, t_symbol *s1, t_symbol *s2)
|
|||
else x->i_symto = s2;
|
||||
x->i_symfrom = s1;
|
||||
x->i_next = 0;
|
||||
if (y = owner->ob_inlet)
|
||||
if((y = owner->ob_inlet))
|
||||
{
|
||||
while (y2 = y->i_next) y = y2;
|
||||
while((y2 = y->i_next)) y = y2;
|
||||
y->i_next = x;
|
||||
}
|
||||
else owner->ob_inlet = x;
|
||||
|
@ -106,7 +106,9 @@ static void inlet_symbol(t_inlet *x, t_symbol *s)
|
|||
|
||||
static void inlet_list(t_inlet *x, t_symbol *s, int argc, t_atom *argv)
|
||||
{
|
||||
#ifndef ROCKBOX
|
||||
t_atom at;
|
||||
#endif
|
||||
if (x->i_symfrom == &s_list || x->i_symfrom == &s_float
|
||||
|| x->i_symfrom == &s_symbol || x->i_symfrom == &s_pointer)
|
||||
typedmess(x->i_dest, x->i_symto, argc, argv);
|
||||
|
@ -154,9 +156,9 @@ t_inlet *pointerinlet_new(t_object *owner, t_gpointer *gp)
|
|||
x->i_symfrom = &s_pointer;
|
||||
x->i_pointerslot = gp;
|
||||
x->i_next = 0;
|
||||
if (y = owner->ob_inlet)
|
||||
if((y = owner->ob_inlet))
|
||||
{
|
||||
while (y2 = y->i_next) y = y2;
|
||||
while((y2 = y->i_next)) y = y2;
|
||||
y->i_next = x;
|
||||
}
|
||||
else owner->ob_inlet = x;
|
||||
|
@ -176,9 +178,9 @@ t_inlet *floatinlet_new(t_object *owner, t_float *fp)
|
|||
x->i_symfrom = &s_float;
|
||||
x->i_floatslot = fp;
|
||||
x->i_next = 0;
|
||||
if (y = owner->ob_inlet)
|
||||
if((y = owner->ob_inlet))
|
||||
{
|
||||
while (y2 = y->i_next) y = y2;
|
||||
while((y2 = y->i_next)) y = y2;
|
||||
y->i_next = x;
|
||||
}
|
||||
else owner->ob_inlet = x;
|
||||
|
@ -198,9 +200,9 @@ t_inlet *symbolinlet_new(t_object *owner, t_symbol **sp)
|
|||
x->i_symfrom = &s_symbol;
|
||||
x->i_symslot = sp;
|
||||
x->i_next = 0;
|
||||
if (y = owner->ob_inlet)
|
||||
if((y = owner->ob_inlet))
|
||||
{
|
||||
while (y2 = y->i_next) y = y2;
|
||||
while((y2 = y->i_next)) y = y2;
|
||||
y->i_next = x;
|
||||
}
|
||||
else owner->ob_inlet = x;
|
||||
|
@ -217,6 +219,11 @@ void obj_list(t_object *x, t_symbol *s, int argc, t_atom *argv)
|
|||
t_atom *ap;
|
||||
int count;
|
||||
t_inlet *ip = ((t_object *)x)->ob_inlet;
|
||||
|
||||
#ifdef ROCKBOX
|
||||
(void) s;
|
||||
#endif
|
||||
|
||||
if (!argc) return;
|
||||
for (count = argc-1, ap = argv+1; ip && count--; ap++, ip = ip->i_next)
|
||||
{
|
||||
|
@ -296,9 +303,9 @@ t_outlet *outlet_new(t_object *owner, t_symbol *s)
|
|||
t_outlet *x = (t_outlet *)getbytes(sizeof(*x)), *y, *y2;
|
||||
x->o_owner = owner;
|
||||
x->o_next = 0;
|
||||
if (y = owner->ob_outlet)
|
||||
if((y = owner->ob_outlet))
|
||||
{
|
||||
while (y2 = y->o_next) y = y2;
|
||||
while((y2 = y->o_next)) y = y2;
|
||||
y->o_next = x;
|
||||
}
|
||||
else owner->ob_outlet = x;
|
||||
|
@ -474,7 +481,7 @@ doit:
|
|||
freebytes(oc, sizeof(*oc));
|
||||
goto done;
|
||||
}
|
||||
while (oc2 = oc->oc_next)
|
||||
while((oc2 = oc->oc_next))
|
||||
{
|
||||
if (oc2->oc_to == to)
|
||||
{
|
||||
|
|
|
@ -2,10 +2,15 @@
|
|||
* For information on usage and redistribution, and for a DISCLAIMER OF ALL
|
||||
* WARRANTIES, see the file, "LICENSE.txt," in this distribution. */
|
||||
|
||||
#include <stdlib.h>
|
||||
#include "m_pd.h"
|
||||
#include "m_imp.h"
|
||||
|
||||
#ifdef ROCKBOX
|
||||
void pd_checkgui(t_pd *x, t_symbol *s);
|
||||
#else /* ROCKBOX */
|
||||
#include <stdlib.h>
|
||||
#endif /* ROCKBOX */
|
||||
|
||||
/* FIXME no out-of-memory testing yet! */
|
||||
|
||||
t_pd *pd_new(t_class *c)
|
||||
|
@ -166,7 +171,7 @@ void pd_unbind(t_pd *x, t_symbol *s)
|
|||
b->b_list = e->e_next;
|
||||
freebytes(e, sizeof(t_bindelem));
|
||||
}
|
||||
else for (e = b->b_list; e2 = e->e_next; e = e2)
|
||||
else for (e = b->b_list; (e2 = e->e_next); e = e2)
|
||||
if (e2->e_who == x)
|
||||
{
|
||||
e->e_next = e2->e_next;
|
||||
|
@ -194,8 +199,13 @@ t_pd *pd_findbyclass(t_symbol *s, t_class *c)
|
|||
if (*s->s_thing == bindlist_class)
|
||||
{
|
||||
t_bindlist *b = (t_bindlist *)s->s_thing;
|
||||
#ifdef ROCKBOX
|
||||
t_bindelem *e;
|
||||
#else /* ROCKBOX */
|
||||
t_bindelem *e, *e2;
|
||||
#endif /* ROCKBOX */
|
||||
int warned = 0;
|
||||
|
||||
for (e = b->b_list; e; e = e->e_next)
|
||||
if (*e->e_who == c)
|
||||
{
|
||||
|
@ -288,6 +298,9 @@ void pd_symbol(t_pd *x, t_symbol *s)
|
|||
|
||||
void pd_list(t_pd *x, t_symbol *s, int argc, t_atom *argv)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
(void) s;
|
||||
#endif
|
||||
(*(*x)->c_listmethod)(x, &s_list, argc, argv);
|
||||
}
|
||||
|
||||
|
|
|
@ -2,6 +2,11 @@
|
|||
* For information on usage and redistribution, and for a DISCLAIMER OF ALL
|
||||
* WARRANTIES, see the file, "LICENSE.txt," in this distribution. */
|
||||
|
||||
#ifdef ROCKBOX
|
||||
#include "plugin.h"
|
||||
#include "pdbox.h"
|
||||
#endif
|
||||
|
||||
/* scheduling stuff */
|
||||
|
||||
#include "m_pd.h"
|
||||
|
@ -14,13 +19,21 @@
|
|||
|
||||
|
||||
/* T.Grill - enable PD global thread locking - sys_lock, sys_unlock, sys_trylock functions */
|
||||
#ifndef ROCKBOX
|
||||
#define THREAD_LOCKING
|
||||
#include "pthread.h"
|
||||
#endif
|
||||
|
||||
|
||||
static int sys_quit;
|
||||
static t_time sys_time;
|
||||
static t_time sys_time_per_msec = TIMEUNITPERSEC / 1000.;
|
||||
#ifndef ROCKBOX
|
||||
static
|
||||
#endif
|
||||
t_time sys_time;
|
||||
#ifndef ROCKBOX
|
||||
static
|
||||
#endif
|
||||
t_time sys_time_per_msec = TIMEUNITPERSEC / 1000.;
|
||||
|
||||
int sys_schedblocksize = DEFDACBLKSIZE;
|
||||
int sys_usecsincelastsleep(void);
|
||||
|
@ -133,9 +146,12 @@ static int sys_bin[] = {0, 2, 5, 10, 20, 30, 50, 100, 1000};
|
|||
#define NBIN (sizeof(sys_bin)/sizeof(*sys_bin))
|
||||
#define NHIST 10
|
||||
static int sys_histogram[NHIST][NBIN];
|
||||
#ifndef ROCKBOX
|
||||
static t_time sys_histtime;
|
||||
#endif
|
||||
static int sched_diddsp, sched_didpoll, sched_didnothing;
|
||||
|
||||
#ifndef ROCKBOX
|
||||
static void sys_clearhist( void)
|
||||
{
|
||||
unsigned int i, j;
|
||||
|
@ -144,6 +160,7 @@ static void sys_clearhist( void)
|
|||
sys_histtime = sys_getrealtime();
|
||||
sched_diddsp = sched_didpoll = sched_didnothing = 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
void sys_printhist( void)
|
||||
{
|
||||
|
@ -169,10 +186,15 @@ void sys_printhist( void)
|
|||
sched_diddsp, sched_didpoll, sched_didnothing);
|
||||
}
|
||||
|
||||
#ifndef ROCKBOX
|
||||
static int sys_histphase;
|
||||
#endif
|
||||
|
||||
int sys_addhist(int phase)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
(void) phase;
|
||||
#endif
|
||||
#ifndef FIXEDPOINT
|
||||
int i, j, phasewas = sys_histphase;
|
||||
t_time newtime = sys_getrealtime();
|
||||
|
@ -216,7 +238,11 @@ static char *(oss_errornames[]) = {
|
|||
|
||||
void glob_audiostatus(void)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
int nresync, nresyncphase, i;
|
||||
#else
|
||||
int dev, nresync, nresyncphase, i;
|
||||
#endif
|
||||
nresync = (oss_nresync >= NRESYNC ? NRESYNC : oss_nresync);
|
||||
nresyncphase = oss_resyncphase - 1;
|
||||
post("audio I/O error history:");
|
||||
|
@ -251,7 +277,9 @@ void sys_log_error(int type)
|
|||
if (type != ERR_NOTHING && !sched_diored &&
|
||||
(sched_diddsp >= sched_dioredtime))
|
||||
{
|
||||
#ifndef ROCKBOX
|
||||
sys_vgui("pdtk_pd_dio 1\n");
|
||||
#endif
|
||||
sched_diored = 1;
|
||||
}
|
||||
sched_dioredtime =
|
||||
|
@ -263,6 +291,7 @@ static int sched_lastinclip, sched_lastoutclip,
|
|||
|
||||
void glob_ping(t_pd *dummy);
|
||||
|
||||
#ifndef ROCKBOX
|
||||
static void sched_pollformeters( void)
|
||||
{
|
||||
int inclip, outclip, indb, outdb;
|
||||
|
@ -313,9 +342,13 @@ static void sched_pollformeters( void)
|
|||
sched_nextmeterpolltime =
|
||||
sched_diddsp + (int)(sys_dacsr /(double)sys_schedblocksize);
|
||||
}
|
||||
#endif /* ROCKBOX */
|
||||
|
||||
void glob_meters(void *dummy, float f)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
(void) dummy;
|
||||
#endif
|
||||
if (f == 0)
|
||||
sys_getmeters(0, 0);
|
||||
sched_meterson = (f != 0);
|
||||
|
@ -335,7 +368,10 @@ void dsp_tick(void);
|
|||
|
||||
static int sched_usedacs = 1;
|
||||
static t_time sched_referencerealtime, sched_referencelogicaltime;
|
||||
static t_time sys_time_per_dsp_tick;
|
||||
#ifndef ROCKBOX
|
||||
static
|
||||
#endif
|
||||
t_time sys_time_per_dsp_tick;
|
||||
|
||||
void sched_set_using_dacs(int flag)
|
||||
{
|
||||
|
@ -344,14 +380,24 @@ void sched_set_using_dacs(int flag)
|
|||
{
|
||||
sched_referencerealtime = sys_getrealtime();
|
||||
sched_referencelogicaltime = clock_getlogicaltime();
|
||||
#ifndef ROCKBOX
|
||||
post("schedsetuding");
|
||||
#endif
|
||||
}
|
||||
sys_time_per_dsp_tick = (TIMEUNITPERSEC) *
|
||||
((double)sys_schedblocksize) / sys_dacsr;
|
||||
/*
|
||||
#ifdef SIMULATOR
|
||||
printf("%f\n%f\n%f\n%f\n", (double)sys_time_per_dsp_tick, (double)TIMEUNITPERSEC, (double) sys_schedblocksize, (double)sys_dacsr);
|
||||
#endif
|
||||
*/
|
||||
}
|
||||
|
||||
/* take the scheduler forward one DSP tick, also handling clock timeouts */
|
||||
static void sched_tick(t_time next_sys_time)
|
||||
#ifndef ROCKBOX
|
||||
static
|
||||
#endif
|
||||
void sched_tick(t_time next_sys_time)
|
||||
{
|
||||
int countdown = 5000;
|
||||
while (clock_setlist && clock_setlist->c_settime < next_sys_time)
|
||||
|
@ -364,7 +410,9 @@ static void sched_tick(t_time next_sys_time)
|
|||
if (!countdown--)
|
||||
{
|
||||
countdown = 5000;
|
||||
#ifndef ROCKBOX
|
||||
sys_pollgui();
|
||||
#endif
|
||||
}
|
||||
if (sys_quit)
|
||||
return;
|
||||
|
@ -388,9 +436,11 @@ the audio I/O system is still busy with previous transfers.
|
|||
void sys_pollmidiqueue( void);
|
||||
void sys_initmidiqueue( void);
|
||||
|
||||
#ifndef ROCKBOX
|
||||
int m_scheduler_pda( void)
|
||||
{
|
||||
int idlecount = 0;
|
||||
|
||||
sys_time_per_dsp_tick = (TIMEUNITPERSEC) *
|
||||
((double)sys_schedblocksize) / sys_dacsr;
|
||||
|
||||
|
@ -402,13 +452,18 @@ int m_scheduler_pda( void)
|
|||
sys_sleepgrain = 100;
|
||||
else if (sys_sleepgrain > 5000)
|
||||
sys_sleepgrain = 5000;
|
||||
|
||||
sys_initmidiqueue();
|
||||
|
||||
while (!sys_quit)
|
||||
{
|
||||
|
||||
int didsomething = 0;
|
||||
|
||||
int timeforward;
|
||||
|
||||
sys_addhist(0);
|
||||
|
||||
waitfortick:
|
||||
if (sched_usedacs)
|
||||
{
|
||||
|
@ -564,7 +619,7 @@ int sys_trylock(void)
|
|||
|
||||
void sys_lock(void) {}
|
||||
void sys_unlock(void) {}
|
||||
int sys_trylock(void) {}
|
||||
int sys_trylock(void) { return 0; }
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -580,3 +635,4 @@ void sys_exit(void)
|
|||
sys_quit = 1;
|
||||
}
|
||||
|
||||
#endif /* ROCKBOX */
|
||||
|
|
|
@ -6,6 +6,13 @@
|
|||
audio settings from argparse routine and from dialog window.
|
||||
*/
|
||||
|
||||
#ifdef ROCKBOX
|
||||
#include "plugin.h"
|
||||
#include "pdbox.h"
|
||||
#include "m_pd.h"
|
||||
#include "s_stuff.h"
|
||||
#define snprintf rb->snprintf
|
||||
#else /* ROCKBOX */
|
||||
#include "m_pd.h"
|
||||
#include "s_stuff.h"
|
||||
#include <stdio.h>
|
||||
|
@ -17,6 +24,7 @@
|
|||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
#endif /* ROCKBOX */
|
||||
|
||||
#define SYS_DEFAULTCH 2
|
||||
#define SYS_MAXCH 100
|
||||
|
@ -116,7 +124,11 @@ static void sys_save_audio_params(
|
|||
void oss_init(void);
|
||||
#endif
|
||||
|
||||
#ifdef ROCKBOX
|
||||
static void pd_audio_init(void)
|
||||
#else
|
||||
static void audio_init( void)
|
||||
#endif
|
||||
{
|
||||
static int initted = 0;
|
||||
if (initted)
|
||||
|
@ -131,7 +143,9 @@ static void audio_init( void)
|
|||
|
||||
static void sys_setchsr(int chin, int chout, int sr)
|
||||
{
|
||||
#ifndef ROCKBOX
|
||||
int nblk;
|
||||
#endif
|
||||
int inbytes = (chin ? chin : 2) * (DEFDACBLKSIZE*sizeof(float));
|
||||
int outbytes = (chout ? chout : 2) * (DEFDACBLKSIZE*sizeof(float));
|
||||
|
||||
|
@ -144,12 +158,20 @@ static void sys_setchsr(int chin, int chout, int sr)
|
|||
|
||||
if (sys_soundin)
|
||||
free(sys_soundin);
|
||||
#ifdef ROCKBOX
|
||||
sys_soundin = (t_sample*) malloc(inbytes);
|
||||
#else
|
||||
sys_soundin = (t_float *)malloc(inbytes);
|
||||
#endif
|
||||
memset(sys_soundin, 0, inbytes);
|
||||
|
||||
if (sys_soundout)
|
||||
free(sys_soundout);
|
||||
#ifdef ROCKBOX
|
||||
sys_soundout = (t_sample*) malloc(outbytes);
|
||||
#else
|
||||
sys_soundout = (t_float *)malloc(outbytes);
|
||||
#endif
|
||||
memset(sys_soundout, 0, outbytes);
|
||||
|
||||
if (sys_verbose)
|
||||
|
@ -169,12 +191,20 @@ void sys_open_audio(int naudioindev, int *audioindev, int nchindev,
|
|||
int *chindev, int naudiooutdev, int *audiooutdev, int nchoutdev,
|
||||
int *choutdev, int rate, int advance, int enable)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
int i;
|
||||
#else
|
||||
int i, *ip;
|
||||
#endif
|
||||
int defaultchannels = SYS_DEFAULTCH;
|
||||
int inchans, outchans;
|
||||
if (rate < 1)
|
||||
rate = SYS_DEFAULTSRATE;
|
||||
#ifdef ROCKBOX
|
||||
pd_audio_init();
|
||||
#else
|
||||
audio_init();
|
||||
#endif
|
||||
/* Since the channel vector might be longer than the
|
||||
audio device vector, or vice versa, we fill the shorter one
|
||||
in to match the longer one. Also, if both are empty, we fill in
|
||||
|
@ -329,6 +359,11 @@ else
|
|||
mmio_open_audio(naudioindev, audioindev, nchindev, chindev,
|
||||
naudiooutdev, audiooutdev, nchoutdev, choutdev, rate);
|
||||
else
|
||||
#endif
|
||||
#ifdef USEAPI_ROCKBOX
|
||||
if (sys_audioapi == API_ROCKBOX)
|
||||
rockbox_open_audio(rate);
|
||||
else
|
||||
#endif
|
||||
post("unknown audio API specified");
|
||||
}
|
||||
|
@ -337,7 +372,9 @@ else
|
|||
if (sys_inchannels == 0 && sys_outchannels == 0)
|
||||
enable = 0;
|
||||
audio_state = enable;
|
||||
#ifndef ROCKBOX
|
||||
sys_vgui("set pd_whichapi %d\n", (audio_isopen() ? sys_audioapi : 0));
|
||||
#endif
|
||||
sched_set_using_dacs(enable);
|
||||
}
|
||||
|
||||
|
@ -369,6 +406,11 @@ void sys_close_audio(void)
|
|||
if (sys_audioapi == API_MMIO)
|
||||
mmio_close_audio();
|
||||
else
|
||||
#endif
|
||||
#ifdef USEAPI_ROCKBOX
|
||||
if (sys_audioapi == API_ROCKBOX)
|
||||
rockbox_close_audio();
|
||||
else
|
||||
#endif
|
||||
post("sys_close_audio: unknown API %d", sys_audioapi);
|
||||
sys_inchannels = sys_outchannels = 0;
|
||||
|
@ -434,6 +476,11 @@ int sys_send_dacs(void)
|
|||
if (sys_audioapi == API_MMIO)
|
||||
return (mmio_send_dacs());
|
||||
else
|
||||
#endif
|
||||
#ifdef USEAPI_ROCKBOX
|
||||
if (sys_audioapi == API_ROCKBOX)
|
||||
return (rockbox_send_dacs());
|
||||
else
|
||||
#endif
|
||||
post("unknown API");
|
||||
return (0);
|
||||
|
@ -482,11 +529,17 @@ void sys_reportidle(void)
|
|||
#define MAXNDEV 20
|
||||
#define DEVDESCSIZE 80
|
||||
|
||||
#ifndef ROCKBOX
|
||||
static void audio_getdevs(char *indevlist, int *nindevs,
|
||||
char *outdevlist, int *noutdevs, int *canmulti,
|
||||
int maxndev, int devdescsize)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
(void) maxndev;
|
||||
pd_audio_init();
|
||||
#else
|
||||
audio_init();
|
||||
#endif /* ROCKBOX */
|
||||
#ifdef USEAPI_OSS
|
||||
if (sys_audioapi == API_OSS)
|
||||
{
|
||||
|
@ -518,6 +571,13 @@ static void audio_getdevs(char *indevlist, int *nindevs,
|
|||
maxndev, devdescsize);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
#ifdef USEAPI_ROCKBOX
|
||||
if (sys_audioapi == API_ROCKBOX)
|
||||
{
|
||||
/* Rockbox devices are known in advance. (?) */
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
/* this shouldn't happen once all the above get filled in. */
|
||||
|
@ -531,6 +591,7 @@ static void audio_getdevs(char *indevlist, int *nindevs,
|
|||
*canmulti = 0;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef MSW
|
||||
#define DEVONSET 0 /* microsoft device list starts at 0 (the "mapper"). */
|
||||
|
@ -538,6 +599,7 @@ static void audio_getdevs(char *indevlist, int *nindevs,
|
|||
#define DEVONSET 1 /* To agree with command line flags, normally start at 1 */
|
||||
#endif
|
||||
|
||||
#ifndef ROCKBOX
|
||||
static void sys_listaudiodevs(void )
|
||||
{
|
||||
char indevlist[MAXNDEV*DEVDESCSIZE], outdevlist[MAXNDEV*DEVDESCSIZE];
|
||||
|
@ -564,8 +626,10 @@ static void sys_listaudiodevs(void )
|
|||
}
|
||||
post("API number %d\n", sys_audioapi);
|
||||
}
|
||||
#endif
|
||||
|
||||
/* start an audio settings dialog window */
|
||||
#ifndef ROCKBOX
|
||||
void glob_audio_properties(t_pd *dummy, t_floatarg flongform)
|
||||
{
|
||||
char buf[1024 + 2 * MAXNDEV*(DEVDESCSIZE+4)];
|
||||
|
@ -645,8 +709,10 @@ void glob_audio_properties(t_pd *dummy, t_floatarg flongform)
|
|||
gfxstub_deleteforkey(0);
|
||||
gfxstub_new(&glob_pdobject, glob_audio_properties, buf);
|
||||
}
|
||||
#endif
|
||||
|
||||
/* new values from dialog window */
|
||||
#ifndef ROCKBOX
|
||||
void glob_audio_dialog(t_pd *dummy, t_symbol *s, int argc, t_atom *argv)
|
||||
{
|
||||
int naudioindev, audioindev[MAXAUDIOINDEV], chindev[MAXAUDIOINDEV];
|
||||
|
@ -696,6 +762,7 @@ void glob_audio_dialog(t_pd *dummy, t_symbol *s, int argc, t_atom *argv)
|
|||
noutdev, newaudiooutdev, noutdev, newaudiooutchan,
|
||||
newrate, newadvance, 1);
|
||||
}
|
||||
#endif
|
||||
|
||||
void sys_listdevs(void )
|
||||
{
|
||||
|
@ -723,6 +790,13 @@ void sys_listdevs(void )
|
|||
if (sys_audioapi == API_ALSA)
|
||||
sys_listaudiodevs();
|
||||
else
|
||||
#endif
|
||||
#ifdef USEAPI_ROCKBOX
|
||||
if (sys_audioapi == API_ROCKBOX)
|
||||
{
|
||||
/* Nothing to list, IMO. */
|
||||
}
|
||||
else
|
||||
#endif
|
||||
post("unknown API");
|
||||
|
||||
|
@ -746,9 +820,11 @@ void sys_set_audio_api(int which)
|
|||
post("sys_audioapi %d", sys_audioapi);
|
||||
}
|
||||
|
||||
#ifndef ROCKBOX
|
||||
void glob_audio_setapi(void *dummy, t_floatarg f)
|
||||
{
|
||||
int newapi = f;
|
||||
|
||||
if (newapi)
|
||||
{
|
||||
if (newapi == sys_audioapi)
|
||||
|
@ -775,6 +851,7 @@ void glob_audio_setapi(void *dummy, t_floatarg f)
|
|||
sched_set_using_dacs(0);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
/* start or stop the audio hardware */
|
||||
void sys_set_audio_state(int onoff)
|
||||
|
@ -842,6 +919,10 @@ void alsa_printstate( void);
|
|||
void glob_foo(void *dummy, t_symbol *s, int argc, t_atom *argv)
|
||||
{
|
||||
t_symbol *arg = atom_getsymbolarg(0, argc, argv);
|
||||
#ifdef ROCKBOX
|
||||
(void) dummy;
|
||||
(void) s;
|
||||
#endif
|
||||
if (arg == gensym("restart"))
|
||||
{
|
||||
int naudioindev, audioindev[MAXAUDIOINDEV], chindev[MAXAUDIOINDEV];
|
||||
|
|
144
apps/plugins/pdbox/PDa/src/s_audio_rockbox.c
Normal file
144
apps/plugins/pdbox/PDa/src/s_audio_rockbox.c
Normal file
|
@ -0,0 +1,144 @@
|
|||
/***************************************************************************
|
||||
* __________ __ ___.
|
||||
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
||||
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
||||
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
||||
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
||||
* \/ \/ \/ \/ \/
|
||||
* $Id$
|
||||
*
|
||||
* Copyright (C) 2009 Wincent Balin
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
* KIND, either express or implied.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#include "plugin.h"
|
||||
#include "pdbox.h"
|
||||
|
||||
#include "m_pd.h"
|
||||
#include "s_stuff.h"
|
||||
|
||||
/* Sound output buffer. */
|
||||
#define AUDIO_OUTPUT_BLOCKS 3
|
||||
static struct pdbox_audio_block audio_output[AUDIO_OUTPUT_BLOCKS];
|
||||
static unsigned int output_head;
|
||||
static unsigned int output_tail;
|
||||
static unsigned int output_fill;
|
||||
|
||||
/* Open audio. */
|
||||
void rockbox_open_audio(int rate)
|
||||
{
|
||||
unsigned int i;
|
||||
|
||||
/* Initialize output buffer. */
|
||||
for(i = 0; i < AUDIO_OUTPUT_BLOCKS; i++)
|
||||
audio_output[i].fill = 0;
|
||||
|
||||
output_head = 0;
|
||||
output_tail = 0;
|
||||
output_fill = 0;
|
||||
|
||||
#if INPUT_SRC_CAPS != 0
|
||||
/* Select playback */
|
||||
rb->audio_set_input_source(AUDIO_SRC_PLAYBACK, SRCF_PLAYBACK);
|
||||
rb->audio_set_output_source(AUDIO_SRC_PLAYBACK);
|
||||
#endif
|
||||
|
||||
/* Set sample rate of the audio buffer. */
|
||||
rb->pcm_set_frequency(rate);
|
||||
}
|
||||
|
||||
/* Close audio. */
|
||||
void rockbox_close_audio(void)
|
||||
{
|
||||
/* Stop playback. */
|
||||
rb->pcm_play_stop();
|
||||
|
||||
/* Restore default sampling rate. */
|
||||
rb->pcm_set_frequency(HW_SAMPR_DEFAULT);
|
||||
}
|
||||
|
||||
/* Rockbox audio callback. */
|
||||
void pdbox_get_more(unsigned char** start, size_t* size)
|
||||
{
|
||||
if(output_fill > 0)
|
||||
{
|
||||
/* Store output data address and size. */
|
||||
*start = (unsigned char*) audio_output[output_tail].data;
|
||||
*size = audio_output[output_tail].fill;
|
||||
|
||||
/* Advance tail index. */
|
||||
audio_output[output_tail].fill = 0;
|
||||
output_fill--;
|
||||
if(output_tail == AUDIO_OUTPUT_BLOCKS-1)
|
||||
output_tail = 0;
|
||||
else
|
||||
output_tail++;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Nothing to play. */
|
||||
*start = NULL;
|
||||
*size = 0;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
/* Audio I/O. */
|
||||
int rockbox_send_dacs(void)
|
||||
{
|
||||
|
||||
|
||||
/* Start playback if needed and possible. */
|
||||
if(output_fill > 1 &&
|
||||
audio_output[output_tail].fill == PD_AUDIO_BLOCK_SIZE)
|
||||
{
|
||||
/* Start playback. */
|
||||
rb->pcm_play_data(pdbox_get_more,
|
||||
(unsigned char*) audio_output[output_tail].data,
|
||||
PD_AUDIO_BLOCK_SIZE);
|
||||
|
||||
/* Advance tail index. */
|
||||
audio_output[output_tail].fill = PD_AUDIO_BLOCK_SIZE;
|
||||
output_fill--;
|
||||
if(output_tail == AUDIO_OUTPUT_BLOCKS-1)
|
||||
output_tail = 0;
|
||||
else
|
||||
output_tail++;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
#if 0
|
||||
if (sys_getrealtime() > timebefore + 0.002)
|
||||
{
|
||||
/* post("slept"); */
|
||||
return (SENDDACS_SLEPT);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
return (SENDDACS_YES);
|
||||
}
|
||||
|
||||
/* Placeholder. */
|
||||
void rockbox_listdevs(void)
|
||||
{
|
||||
}
|
||||
|
||||
#if 0
|
||||
/* Scanning for devices */
|
||||
void rockbox_getdevs(char *indevlist, int *nindevs,
|
||||
char *outdevlist, int *noutdevs, int *canmulti,
|
||||
int maxndev, int devdescsize)
|
||||
{
|
||||
}
|
||||
#endif
|
||||
|
|
@ -6,14 +6,32 @@
|
|||
* this file contains file-handling routines.
|
||||
*/
|
||||
|
||||
#ifdef ROCKBOX
|
||||
#include "plugin.h"
|
||||
#include "pdbox.h"
|
||||
#include "m_pd.h"
|
||||
#include "s_stuff.h"
|
||||
#else /* ROCKBOX */
|
||||
#include "m_pd.h"
|
||||
#include "s_stuff.h"
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#endif /* ROCKBOX */
|
||||
|
||||
/* LATER delete this? -- replaced by find_via_path() in s_path.c */
|
||||
int sys_isreadablefile(const char *s)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
int fd;
|
||||
|
||||
if((fd = open(s, O_RDONLY)))
|
||||
{
|
||||
close(fd);
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
return 0;
|
||||
#else /* ROCKBOX */
|
||||
struct stat statbuf;
|
||||
int mode;
|
||||
if (stat(s, &statbuf) < 0) return (0);
|
||||
|
@ -22,13 +40,14 @@ int sys_isreadablefile(const char *s)
|
|||
if (S_ISDIR(mode)) return (0);
|
||||
#endif
|
||||
return (1);
|
||||
#endif /* ROCKBOX */
|
||||
}
|
||||
|
||||
/* change '/' characters to the system's native file separator */
|
||||
void sys_bashfilename(const char *from, char *to)
|
||||
{
|
||||
char c;
|
||||
while (c = *from++)
|
||||
while((c = *from++))
|
||||
{
|
||||
#ifdef MSW
|
||||
if (c == '/') c = '\\';
|
||||
|
@ -43,7 +62,7 @@ void sys_bashfilename(const char *from, char *to)
|
|||
void sys_unbashfilename(const char *from, char *to)
|
||||
{
|
||||
char c;
|
||||
while (c = *from++)
|
||||
while((c = *from++))
|
||||
{
|
||||
#ifdef MSW
|
||||
if (c == '\\') c = '/';
|
||||
|
|
|
@ -2,6 +2,10 @@
|
|||
* For information on usage and redistribution, and for a DISCLAIMER OF ALL
|
||||
* WARRANTIES, see the file, "LICENSE.txt," in this distribution. */
|
||||
|
||||
#ifdef ROCKBOX
|
||||
#include "plugin.h"
|
||||
#include "pdbox.h"
|
||||
#else /* ROCKBOX */
|
||||
#ifdef DL_OPEN
|
||||
#include <dlfcn.h>
|
||||
#endif
|
||||
|
@ -17,12 +21,14 @@
|
|||
#include <mach-o/dyld.h>
|
||||
#endif
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#endif /* ROCKBOX */
|
||||
#include "m_pd.h"
|
||||
#include "s_stuff.h"
|
||||
#include <stdio.h>
|
||||
|
||||
typedef void (*t_xxx)(void);
|
||||
|
||||
#ifndef ROCKBOX
|
||||
static char sys_dllextent[] =
|
||||
#ifdef __FreeBSD__
|
||||
".pd_freebsd";
|
||||
|
@ -43,12 +49,22 @@ static char sys_dllextent[] =
|
|||
#ifdef MSW
|
||||
".dll";
|
||||
#endif
|
||||
#endif /* ROCKBOX */
|
||||
|
||||
void class_set_extern_dir(t_symbol *s);
|
||||
|
||||
#ifdef STATIC
|
||||
int sys_load_lib(char *dirname, char *classname)
|
||||
#ifdef ROCKBOX
|
||||
{
|
||||
(void) dirname;
|
||||
(void) classname;
|
||||
|
||||
return 0;
|
||||
}
|
||||
#else /* ROCKBOX */
|
||||
{ return 0;}
|
||||
#endif /* ROCKBOX */
|
||||
#else
|
||||
int sys_load_lib(char *dirname, char *classname)
|
||||
{
|
||||
|
|
|
@ -14,6 +14,26 @@
|
|||
#define DEBUG(x)
|
||||
void readsf_banana( void); /* debugging */
|
||||
|
||||
#ifdef ROCKBOX
|
||||
|
||||
#include "plugin.h"
|
||||
#include "pdbox.h"
|
||||
|
||||
#include "m_pd.h"
|
||||
#include "m_imp.h"
|
||||
#include "s_stuff.h"
|
||||
|
||||
#define open rb->open
|
||||
#define close rb->close
|
||||
#define strcpy rb->strcpy
|
||||
#define strcat rb->strcat
|
||||
#define strlen rb->strlen
|
||||
#define strcmp rb->strcmp
|
||||
#define strncpy rb->strncpy
|
||||
#define strrchr rb->strrchr
|
||||
#define strncat rb_strncat
|
||||
|
||||
#else /* ROCKBOX */
|
||||
#include <stdlib.h>
|
||||
#ifdef UNIX
|
||||
#include <unistd.h>
|
||||
|
@ -29,6 +49,7 @@ void readsf_banana( void); /* debugging */
|
|||
#include "s_stuff.h"
|
||||
#include <stdio.h>
|
||||
#include <fcntl.h>
|
||||
#endif /* ROCKBOX */
|
||||
|
||||
static t_namelist *pd_path, *pd_helppath;
|
||||
|
||||
|
@ -85,6 +106,10 @@ t_namelist *namelist_append(t_namelist *listwas, const char *s)
|
|||
char temp[MAXPDSTRING];
|
||||
t_namelist *nl = listwas, *rtn = listwas;
|
||||
|
||||
#ifdef ROCKBOX
|
||||
(void) rtn;
|
||||
#endif
|
||||
|
||||
npos = s;
|
||||
do
|
||||
{
|
||||
|
@ -138,6 +163,10 @@ int open_via_path(const char *dir, const char *name, const char* ext,
|
|||
int fd = -1;
|
||||
char listbuf[MAXPDSTRING];
|
||||
|
||||
#ifdef ROCKBOX
|
||||
(void) bin;
|
||||
#endif
|
||||
|
||||
if (name[0] == '/'
|
||||
#ifdef MSW
|
||||
|| (name[1] == ':' && name[2] == '/')
|
||||
|
@ -191,6 +220,7 @@ int open_via_path(const char *dir, const char *name, const char* ext,
|
|||
char *slash;
|
||||
if (sys_verbose) post("tried %s and succeeded", dirresult);
|
||||
sys_unbashfilename(dirresult, dirresult);
|
||||
|
||||
slash = strrchr(dirresult, '/');
|
||||
if (slash)
|
||||
{
|
||||
|
@ -245,7 +275,9 @@ static int do_open_via_helppath(const char *realname, t_namelist *listp)
|
|||
else
|
||||
#endif
|
||||
{
|
||||
#ifndef ROCKBOX
|
||||
char *slash;
|
||||
#endif
|
||||
if (sys_verbose) post("tried %s and succeeded", dirresult);
|
||||
sys_unbashfilename(dirresult, dirresult);
|
||||
close (fd);
|
||||
|
@ -266,8 +298,12 @@ static int do_open_via_helppath(const char *realname, t_namelist *listp)
|
|||
search attempts. */
|
||||
void open_via_helppath(const char *name, const char *dir)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
t_namelist thislist, *listp;
|
||||
#else /*ROCKBOX */
|
||||
t_namelist *nl, thislist, *listp;
|
||||
int fd = -1;
|
||||
#endif /* ROCKBOX */
|
||||
char dirbuf2[MAXPDSTRING], realname[MAXPDSTRING];
|
||||
|
||||
/* if directory is supplied, put it at head of search list. */
|
||||
|
@ -380,6 +416,10 @@ int sys_rcfile(void)
|
|||
/* start an audio settings dialog window */
|
||||
void glob_start_path_dialog(t_pd *dummy, t_floatarg flongform)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
(void) dummy;
|
||||
(void) flongform;
|
||||
#else /* ROCKBOX */
|
||||
char buf[MAXPDSTRING];
|
||||
int i;
|
||||
t_namelist *nl;
|
||||
|
@ -391,12 +431,19 @@ void glob_start_path_dialog(t_pd *dummy, t_floatarg flongform)
|
|||
|
||||
sprintf(buf, "pdtk_path_dialog %%s\n");
|
||||
gfxstub_new(&glob_pdobject, glob_start_path_dialog, buf);
|
||||
#endif /* ROCKBOX */
|
||||
}
|
||||
|
||||
/* new values from dialog window */
|
||||
void glob_path_dialog(t_pd *dummy, t_symbol *s, int argc, t_atom *argv)
|
||||
{
|
||||
int i;
|
||||
|
||||
#ifdef ROCKBOX
|
||||
(void) dummy;
|
||||
(void) s;
|
||||
#endif /* ROCKBOX */
|
||||
|
||||
namelist_free(pd_path);
|
||||
pd_path = 0;
|
||||
for (i = 0; i < argc; i++)
|
||||
|
|
|
@ -79,7 +79,7 @@ void poststring(char *s)
|
|||
#ifdef SIMULATOR
|
||||
printf(" %s", s);
|
||||
#else /* SIMULATOR */
|
||||
(void)s;
|
||||
(void) s;
|
||||
#endif /* SIMULATOR */
|
||||
#else /* ROCKBOX */
|
||||
fprintf(stderr, " %s", s);
|
||||
|
@ -167,7 +167,7 @@ void pd_error(void *object, char *fmt, ...)
|
|||
saidit = 1;
|
||||
}
|
||||
#else /* SIMULATOR */
|
||||
(void)object;
|
||||
(void) object;
|
||||
(void) fmt;
|
||||
#endif /* SIMULATOR */
|
||||
#else /* ROCKBOX */
|
||||
|
@ -191,7 +191,7 @@ void pd_error(void *object, char *fmt, ...)
|
|||
void glob_finderror(t_pd *dummy)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
(void)dummy;
|
||||
(void) dummy;
|
||||
#endif /* ROCKBOX */
|
||||
if (!error_object)
|
||||
post("no findable error yet.");
|
||||
|
@ -250,8 +250,12 @@ void sys_logerror(char *object, char *s)
|
|||
|
||||
void sys_unixerror(char *object)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
(void) object;
|
||||
#else
|
||||
errobject = object;
|
||||
errstring = strerror(errno);
|
||||
#endif /* ROCKBOX */
|
||||
}
|
||||
|
||||
void sys_ouch(void)
|
||||
|
|
|
@ -130,8 +130,9 @@ void sys_setvirtualalarm( void);
|
|||
#define API_MMIO 3
|
||||
#define API_PORTAUDIO 4
|
||||
#define API_JACK 5
|
||||
#define API_ROCKBOX 6
|
||||
|
||||
#ifdef __linux__
|
||||
#if defined(__linux__) && !defined(ROCKBOX)
|
||||
#define API_DEFAULT API_OSS
|
||||
#define API_DEFSTRING "OSS"
|
||||
#endif
|
||||
|
@ -143,6 +144,10 @@ void sys_setvirtualalarm( void);
|
|||
#define API_DEFAULT API_PORTAUDIO
|
||||
#define API_DEFSTRING "portaudio"
|
||||
#endif
|
||||
#ifdef ROCKBOX
|
||||
#define API_DEFAULT API_ROCKBOX
|
||||
#define API_DEFSTRING "Rockbox"
|
||||
#endif
|
||||
#define DEFAULTAUDIODEV 0
|
||||
|
||||
#define MAXAUDIOINDEV 4
|
||||
|
@ -204,6 +209,11 @@ void mmio_getdevs(char *indevlist, int *nindevs,
|
|||
char *outdevlist, int *noutdevs, int *canmulti,
|
||||
int maxndev, int devdescsize);
|
||||
|
||||
void rockbox_open_audio(int rate);
|
||||
void rockbox_close_audio(void);
|
||||
int rockbox_send_dacs(void);
|
||||
void rockbox_getdevs(void);
|
||||
|
||||
void sys_listmididevs(void);
|
||||
void sys_set_audio_api(int whichapi);
|
||||
void sys_get_audio_apis(char *buf);
|
||||
|
|
|
@ -5,6 +5,11 @@
|
|||
/* utility functions for signals
|
||||
*/
|
||||
|
||||
#ifdef ROCKBOX
|
||||
#include "plugin.h"
|
||||
#include "pdbox.h"
|
||||
#endif
|
||||
|
||||
#include "m_pd.h"
|
||||
#include <math.h>
|
||||
#define LOGTEN 2.302585092994
|
||||
|
|
|
@ -6,6 +6,11 @@
|
|||
done on floats; the logical and bitwise binops convert their
|
||||
inputs to int and their outputs back to float. */
|
||||
|
||||
#ifdef ROCKBOX
|
||||
#include "plugin.h"
|
||||
#include "pdbox.h"
|
||||
#endif
|
||||
|
||||
#include "m_pd.h"
|
||||
#include <math.h>
|
||||
|
||||
|
|
|
@ -4,10 +4,18 @@
|
|||
|
||||
/* connective objects */
|
||||
|
||||
#ifdef ROCKBOX
|
||||
#include "plugin.h"
|
||||
#include "pdbox.h"
|
||||
#endif
|
||||
|
||||
#include "m_pd.h"
|
||||
|
||||
#ifndef ROCKBOX
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#endif
|
||||
|
||||
extern t_pd *newest;
|
||||
|
||||
/* -------------------------- int ------------------------------ */
|
||||
|
@ -62,6 +70,9 @@ typedef struct _pdfloat
|
|||
|
||||
static void *pdfloat_new(t_pd *dummy, t_float f)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
(void) dummy;
|
||||
#endif
|
||||
t_pdfloat *x = (t_pdfloat *)pd_new(pdfloat_class);
|
||||
x->x_f = f;
|
||||
outlet_new(&x->x_obj, &s_float);
|
||||
|
@ -105,6 +116,9 @@ typedef struct _pdsymbol
|
|||
|
||||
static void *pdsymbol_new(t_pd *dummy, t_symbol *s)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
(void) dummy;
|
||||
#endif
|
||||
t_pdsymbol *x = (t_pdsymbol *)pd_new(pdsymbol_class);
|
||||
x->x_s = s;
|
||||
outlet_new(&x->x_obj, &s_symbol);
|
||||
|
@ -125,6 +139,10 @@ static void pdsymbol_symbol(t_pdsymbol *x, t_symbol *s)
|
|||
|
||||
static void pdsymbol_anything(t_pdsymbol *x, t_symbol *s, int ac, t_atom *av)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
(void) ac;
|
||||
(void) av;
|
||||
#endif
|
||||
outlet_symbol(x->x_obj.ob_outlet, x->x_s = s);
|
||||
}
|
||||
|
||||
|
@ -147,6 +165,9 @@ typedef struct _bang
|
|||
|
||||
static void *bang_new(t_pd *dummy)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
(void) dummy;
|
||||
#endif
|
||||
t_bang *x = (t_bang *)pd_new(bang_class);
|
||||
outlet_new(&x->x_obj, &s_bang);
|
||||
newest = &x->x_obj.ob_pd;
|
||||
|
@ -155,6 +176,9 @@ static void *bang_new(t_pd *dummy)
|
|||
|
||||
static void *bang_new2(t_bang f)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
(void) f;
|
||||
#endif
|
||||
return (bang_new(0));
|
||||
}
|
||||
|
||||
|
@ -383,6 +407,9 @@ static void sel2_free(t_sel2 *x)
|
|||
|
||||
static void *select_new(t_symbol *s, int argc, t_atom *argv)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
(void) s;
|
||||
#endif
|
||||
t_atom a;
|
||||
if (argc == 0)
|
||||
{
|
||||
|
@ -484,6 +511,9 @@ static void route_anything(t_route *x, t_symbol *sel, int argc, t_atom *argv)
|
|||
|
||||
static void route_list(t_route *x, t_symbol *sel, int argc, t_atom *argv)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
(void) sel;
|
||||
#endif
|
||||
t_routeelement *e;
|
||||
int nelement;
|
||||
if (x->x_type == A_FLOAT)
|
||||
|
@ -562,6 +592,9 @@ static void route_free(t_route *x)
|
|||
|
||||
static void *route_new(t_symbol *s, int argc, t_atom *argv)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
(void) s;
|
||||
#endif
|
||||
int n;
|
||||
t_routeelement *e;
|
||||
t_route *x = (t_route *)pd_new(route_class);
|
||||
|
@ -610,6 +643,9 @@ typedef struct _pack
|
|||
|
||||
static void *pack_new(t_symbol *s, int argc, t_atom *argv)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
(void) s;
|
||||
#endif
|
||||
t_pack *x = (t_pack *)pd_new(pack_class);
|
||||
t_atom defarg[2], *ap, *vec, *vp;
|
||||
t_gpointer *gp;
|
||||
|
@ -737,6 +773,9 @@ static void pack_symbol(t_pack *x, t_symbol *s)
|
|||
|
||||
static void pack_list(t_pack *x, t_symbol *s, int ac, t_atom *av)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
(void) s;
|
||||
#endif
|
||||
obj_list(&x->x_obj, 0, ac, av);
|
||||
}
|
||||
|
||||
|
@ -793,6 +832,9 @@ typedef struct _unpack
|
|||
|
||||
static void *unpack_new(t_symbol *s, int argc, t_atom *argv)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
(void) s;
|
||||
#endif
|
||||
t_unpack *x = (t_unpack *)pd_new(unpack_class);
|
||||
t_atom defarg[2], *ap;
|
||||
t_unpackout *u;
|
||||
|
@ -841,6 +883,9 @@ static void *unpack_new(t_symbol *s, int argc, t_atom *argv)
|
|||
|
||||
static void unpack_list(t_unpack *x, t_symbol *s, int argc, t_atom *argv)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
(void) s;
|
||||
#endif
|
||||
t_atom *ap;
|
||||
t_unpackout *u;
|
||||
int i;
|
||||
|
@ -907,6 +952,9 @@ typedef struct _trigger
|
|||
|
||||
static void *trigger_new(t_symbol *s, int argc, t_atom *argv)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
(void) s;
|
||||
#endif
|
||||
t_trigger *x = (t_trigger *)pd_new(trigger_class);
|
||||
t_atom defarg[2], *ap;
|
||||
t_triggerout *u;
|
||||
|
@ -953,6 +1001,9 @@ static void *trigger_new(t_symbol *s, int argc, t_atom *argv)
|
|||
|
||||
static void trigger_list(t_trigger *x, t_symbol *s, int argc, t_atom *argv)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
(void) s;
|
||||
#endif
|
||||
t_triggerout *u;
|
||||
int i;
|
||||
t_atom at;
|
||||
|
@ -1204,14 +1255,22 @@ static void *makefilename_new(t_symbol *s)
|
|||
static void makefilename_float(t_makefilename *x, t_floatarg f)
|
||||
{
|
||||
char buf[MAXPDSTRING];
|
||||
#ifdef ROCKBOX
|
||||
snprintf(buf, sizeof(buf), x->x_format->s_name, (int)f);
|
||||
#else
|
||||
sprintf(buf, x->x_format->s_name, (int)f);
|
||||
#endif
|
||||
outlet_symbol(x->x_obj.ob_outlet, gensym(buf));
|
||||
}
|
||||
|
||||
static void makefilename_symbol(t_makefilename *x, t_symbol *s)
|
||||
{
|
||||
char buf[MAXPDSTRING];
|
||||
#ifdef ROCKBOX
|
||||
snprintf(buf, sizeof(buf), x->x_format->s_name, s->s_name);
|
||||
#else
|
||||
sprintf(buf, x->x_format->s_name, s->s_name);
|
||||
#endif
|
||||
outlet_symbol(x->x_obj.ob_outlet, gensym(buf));
|
||||
}
|
||||
|
||||
|
|
|
@ -30,6 +30,9 @@ static void print_bang(t_print *x)
|
|||
|
||||
static void print_pointer(t_print *x, t_gpointer *gp)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
(void) gp;
|
||||
#endif
|
||||
post("%s(gpointer)", x->x_sym->s_name);
|
||||
}
|
||||
|
||||
|
@ -40,8 +43,12 @@ static void print_float(t_print *x, t_float f)
|
|||
|
||||
static void print_list(t_print *x, t_symbol *s, int argc, t_atom *argv)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
(void) s;
|
||||
#else
|
||||
int i;
|
||||
char buf[80];
|
||||
#endif
|
||||
if (argc && argv->a_type != A_SYMBOL) startpost("%s:", x->x_sym->s_name);
|
||||
else startpost("%s%s", x->x_sym->s_name,
|
||||
(argc > 1 ? s_list.s_name : (argc == 1 ? s_symbol.s_name :
|
||||
|
@ -52,8 +59,10 @@ static void print_list(t_print *x, t_symbol *s, int argc, t_atom *argv)
|
|||
|
||||
static void print_anything(t_print *x, t_symbol *s, int argc, t_atom *argv)
|
||||
{
|
||||
#ifndef ROCKBOX
|
||||
int i;
|
||||
char buf[80];
|
||||
#endif
|
||||
startpost("%s%s", x->x_sym->s_name, s->s_name);
|
||||
postatom(argc, argv);
|
||||
endpost();
|
||||
|
|
|
@ -4,6 +4,13 @@
|
|||
|
||||
/* misc. */
|
||||
|
||||
#ifdef ROCKBOX
|
||||
#include "plugin.h"
|
||||
#include "pdbox.h"
|
||||
#include "m_pd.h"
|
||||
#include "s_stuff.h"
|
||||
extern uint64_t runningtime;
|
||||
#else /* ROCKBOX */
|
||||
#include "m_pd.h"
|
||||
#include "s_stuff.h"
|
||||
#include <math.h>
|
||||
|
@ -19,6 +26,7 @@
|
|||
#include <wtypes.h>
|
||||
#include <time.h>
|
||||
#endif
|
||||
#endif /* ROCKBOX */
|
||||
|
||||
#if defined (MACOSX) || defined (__FreeBSD__)
|
||||
#define HZ CLK_TCK
|
||||
|
@ -68,6 +76,9 @@ static void random_bang(t_random *x)
|
|||
|
||||
static void random_seed(t_random *x, float f, float glob)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
(void) glob;
|
||||
#endif
|
||||
x->x_state = f;
|
||||
}
|
||||
|
||||
|
@ -155,6 +166,10 @@ typedef struct _serial
|
|||
|
||||
static void serial_float(t_serial *x, t_float f)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
(void) x;
|
||||
(void) f;
|
||||
#else /* ROCKBOX */
|
||||
int n = f;
|
||||
char message[MAXSERIAL * 4 + 100];
|
||||
if (!x->x_open)
|
||||
|
@ -164,6 +179,7 @@ static void serial_float(t_serial *x, t_float f)
|
|||
}
|
||||
sprintf(message, "com%d_send \"\\%3.3o\"\n", x->x_portno, n);
|
||||
sys_gui(message);
|
||||
#endif /* ROCKBOX */
|
||||
}
|
||||
|
||||
static void *serial_new(t_floatarg fportno)
|
||||
|
@ -190,6 +206,9 @@ static t_class *cputime_class;
|
|||
typedef struct _cputime
|
||||
{
|
||||
t_object x_obj;
|
||||
#ifdef ROCKBOX
|
||||
uint64_t x_runningtime;
|
||||
#endif
|
||||
#ifdef UNIX
|
||||
struct tms x_setcputime;
|
||||
#endif
|
||||
|
@ -202,6 +221,9 @@ typedef struct _cputime
|
|||
|
||||
static void cputime_bang(t_cputime *x)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
x->x_runningtime = runningtime;
|
||||
#endif
|
||||
#ifdef UNIX
|
||||
times(&x->x_setcputime);
|
||||
#endif
|
||||
|
@ -221,9 +243,16 @@ static void cputime_bang(t_cputime *x)
|
|||
#endif
|
||||
}
|
||||
|
||||
#ifndef ROCKBOX
|
||||
#define HZ 100
|
||||
#endif
|
||||
static void cputime_bang2(t_cputime *x)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
float elapsedcpu = 1000 *
|
||||
(runningtime - x->x_runningtime) / HZ;
|
||||
outlet_float(x->x_obj.ob_outlet, elapsedcpu);
|
||||
#endif
|
||||
#ifdef UNIX
|
||||
float elapsedcpu;
|
||||
struct tms newcputime;
|
||||
|
|
|
@ -2,11 +2,17 @@
|
|||
* For information on usage and redistribution, and for a DISCLAIMER OF ALL
|
||||
* WARRANTIES, see the file, "LICENSE.txt," in this distribution. */
|
||||
|
||||
#ifdef ROCKBOX
|
||||
#include "plugin.h"
|
||||
#include "pdbox.h"
|
||||
#endif
|
||||
|
||||
/* network */
|
||||
|
||||
#include "m_pd.h"
|
||||
#include "s_stuff.h"
|
||||
|
||||
#ifndef ROCKBOX
|
||||
#include <sys/types.h>
|
||||
#include <string.h>
|
||||
#ifdef UNIX
|
||||
|
@ -19,6 +25,7 @@
|
|||
#else
|
||||
#include <winsock.h>
|
||||
#endif
|
||||
#endif /* ROCKBOX */
|
||||
|
||||
static t_class *netsend_class;
|
||||
|
||||
|
@ -31,16 +38,27 @@ typedef struct _netsend
|
|||
|
||||
static void *netsend_new(t_floatarg udpflag)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
(void) udpflag;
|
||||
#endif
|
||||
|
||||
t_netsend *x = (t_netsend *)pd_new(netsend_class);
|
||||
outlet_new(&x->x_obj, &s_float);
|
||||
x->x_fd = -1;
|
||||
#ifndef ROCKBOX
|
||||
x->x_protocol = (udpflag != 0 ? SOCK_DGRAM : SOCK_STREAM);
|
||||
#endif
|
||||
return (x);
|
||||
}
|
||||
|
||||
static void netsend_connect(t_netsend *x, t_symbol *hostname,
|
||||
t_floatarg fportno)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
(void) x;
|
||||
(void) hostname;
|
||||
(void) fportno;
|
||||
#else /* ROCKBOX */
|
||||
struct sockaddr_in server;
|
||||
struct hostent *hp;
|
||||
int sockfd;
|
||||
|
@ -100,13 +118,16 @@ static void netsend_connect(t_netsend *x, t_symbol *hostname,
|
|||
}
|
||||
x->x_fd = sockfd;
|
||||
outlet_float(x->x_obj.ob_outlet, 1);
|
||||
#endif /* ROCKBOX */
|
||||
}
|
||||
|
||||
static void netsend_disconnect(t_netsend *x)
|
||||
{
|
||||
if (x->x_fd >= 0)
|
||||
{
|
||||
#ifndef ROCKBOX
|
||||
sys_closesocket(x->x_fd);
|
||||
#endif
|
||||
x->x_fd = -1;
|
||||
outlet_float(x->x_obj.ob_outlet, 0);
|
||||
}
|
||||
|
@ -114,6 +135,12 @@ static void netsend_disconnect(t_netsend *x)
|
|||
|
||||
static void netsend_send(t_netsend *x, t_symbol *s, int argc, t_atom *argv)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
(void) x;
|
||||
(void) s;
|
||||
(void) argc;
|
||||
(void) argv;
|
||||
#else /* ROCKBOX */
|
||||
if (x->x_fd >= 0)
|
||||
{
|
||||
t_binbuf *b = binbuf_new();
|
||||
|
@ -159,11 +186,16 @@ static void netsend_send(t_netsend *x, t_symbol *s, int argc, t_atom *argv)
|
|||
binbuf_free(b);
|
||||
}
|
||||
else error("netsend: not connected");
|
||||
#endif /* ROCKBOX */
|
||||
}
|
||||
|
||||
static void netsend_free(t_netsend *x)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
(void) x;
|
||||
#else
|
||||
netsend_disconnect(x);
|
||||
#endif
|
||||
}
|
||||
|
||||
static void netsend_setup(void)
|
||||
|
@ -193,14 +225,23 @@ typedef struct _netreceive
|
|||
int x_udp;
|
||||
} t_netreceive;
|
||||
|
||||
#ifdef ROCKBOX
|
||||
static t_netreceive* receiver;
|
||||
static int receiver_port;
|
||||
#endif /* ROCKBOX */
|
||||
|
||||
#ifndef ROCKBOX
|
||||
static void netreceive_notify(t_netreceive *x)
|
||||
{
|
||||
outlet_float(x->x_connectout, --x->x_nconnections);
|
||||
}
|
||||
#endif /* ROCKBOX */
|
||||
|
||||
static void netreceive_doit(void *z, t_binbuf *b)
|
||||
{
|
||||
#ifndef ROCKBOX
|
||||
t_atom messbuf[1024];
|
||||
#endif
|
||||
t_netreceive *x = (t_netreceive *)z;
|
||||
int msg, natom = binbuf_getnatom(b);
|
||||
t_atom *at = binbuf_getvec(b);
|
||||
|
@ -234,6 +275,7 @@ static void netreceive_doit(void *z, t_binbuf *b)
|
|||
}
|
||||
}
|
||||
|
||||
#ifndef ROCKBOX
|
||||
static void netreceive_connectpoll(t_netreceive *x)
|
||||
{
|
||||
int fd = accept(x->x_connectsocket, 0, 0);
|
||||
|
@ -247,11 +289,41 @@ static void netreceive_connectpoll(t_netreceive *x)
|
|||
outlet_float(x->x_connectout, ++x->x_nconnections);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
static void *netreceive_new(t_symbol *compatflag,
|
||||
t_floatarg fportno, t_floatarg udpflag)
|
||||
{
|
||||
t_netreceive *x;
|
||||
|
||||
#ifdef ROCKBOX
|
||||
int portno = fportno, udp = (udpflag != 0);
|
||||
|
||||
(void) compatflag;
|
||||
|
||||
/* Look whether callback is already taken. */
|
||||
if(receiver)
|
||||
{
|
||||
post("Receiver callback already taken!\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Look whether TCP sockets are thought to exist. */
|
||||
if(!udp)
|
||||
{
|
||||
post("Trying to create TCP socket!\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
x = (t_netreceive *) pd_new(netreceive_class);
|
||||
x->x_msgout = outlet_new(&x->x_obj, &s_anything);
|
||||
x->x_nconnections = 0;
|
||||
x->x_udp = udp;
|
||||
|
||||
receiver = x;
|
||||
receiver_port = portno;
|
||||
|
||||
#else /* ROCKBOX */
|
||||
struct sockaddr_in server;
|
||||
int sockfd, portno = fportno, udp = (udpflag != 0);
|
||||
int old = !strcmp(compatflag->s_name , "old");
|
||||
|
@ -333,20 +405,62 @@ static void *netreceive_new(t_symbol *compatflag,
|
|||
x->x_connectsocket = sockfd;
|
||||
x->x_nconnections = 0;
|
||||
x->x_udp = udp;
|
||||
#endif /* ROCKBOX */
|
||||
|
||||
return (x);
|
||||
}
|
||||
|
||||
static void netreceive_free(t_netreceive *x)
|
||||
{
|
||||
#ifdef ROCKBOX
|
||||
if(receiver && receiver == x)
|
||||
receiver = NULL;
|
||||
#else /* ROCKBOX */
|
||||
/* LATER make me clean up open connections */
|
||||
if (x->x_connectsocket >= 0)
|
||||
{
|
||||
sys_rmpollfn(x->x_connectsocket);
|
||||
sys_closesocket(x->x_connectsocket);
|
||||
}
|
||||
#endif /* ROCKBOX */
|
||||
}
|
||||
|
||||
#ifdef ROCKBOX
|
||||
/* Basically a reimplementation of socketreceiver_getudp()
|
||||
from s_inter.c */
|
||||
t_binbuf* inbinbuf;
|
||||
void outlet_setstacklim(void);
|
||||
|
||||
void rockbox_receive_callback(struct datagram* dg)
|
||||
{
|
||||
/* Check whether there is a receiver. */
|
||||
if(!receiver)
|
||||
return;
|
||||
|
||||
/* Limit string. */
|
||||
dg->data[dg->size] = '\0';
|
||||
|
||||
/* If complete line... */
|
||||
if(dg->data[dg->size-1] == '\n')
|
||||
{
|
||||
char* semi = strchr(dg->data, ';');
|
||||
|
||||
/* Limit message. */
|
||||
if(semi)
|
||||
*semi = '\0';
|
||||
|
||||
/* Create binary buffer. */
|
||||
binbuf_text(inbinbuf, dg->data, strlen(dg->data));
|
||||
|
||||
/* Limit outlet stack. */
|
||||
outlet_setstacklim();
|
||||
|
||||
/* Execute receive function. */
|
||||
netreceive_doit(receiver, inbinbuf);
|
||||
}
|
||||
}
|
||||
#endif /* ROCKBOX */
|
||||
|
||||
static void netreceive_setup(void)
|
||||
{
|
||||
netreceive_class = class_new(gensym("netreceive"),
|
||||
|
@ -360,5 +474,3 @@ void x_net_setup(void)
|
|||
netsend_setup();
|
||||
netreceive_setup();
|
||||
}
|
||||
|
||||
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue