Commit 87bf5aed authored by Jonathan Wilkes's avatar Jonathan Wilkes
Browse files

port from pd-l2ork git: 7082af6786b7748e6034b368ec68f4ae11d298a8

 *merged improvements in Fred Jan's new branch of cyclone with pd-l2ork's improvements
parent 72dbd16a
......@@ -354,3 +354,8 @@ void Append_setup(void)
fitter_setup(append_class, append_fitter);
}
void append_setup(void)
{
Append_setup();
}
......@@ -166,6 +166,8 @@ void Borax_setup(void)
Borax_class = class_new(gensym("Borax"),
(t_newmethod)Borax_new, 0,
sizeof(t_Borax), 0, 0);
class_addcreator((t_newmethod)Borax_new, gensym("borax"), 0, 0);
class_addcreator((t_newmethod)Borax_new, gensym("cyclone/borax"), 0, 0);
class_addfloat(Borax_class, Borax_float);
/* CHECKME list unfolding */
class_addmethod(Borax_class, (t_method)Borax_ft1,
......@@ -175,3 +177,8 @@ void Borax_setup(void)
class_addmethod(Borax_class, (t_method)Borax_delta,
gensym("delta"), 0);
}
void borax_setup(void)
{
Borax_setup();
}
......@@ -6,6 +6,7 @@
The most important changes are listed in "pd-lib-notes.txt" file. */
#include "m_pd.h"
#include "shared.h"
typedef struct _Bucket
{
......@@ -15,6 +16,8 @@ typedef struct _Bucket
t_outlet **x_outs;
short int x_frozen; /* 0 for thawed, 1 for frozen */
short int x_dir; /* 0 for L2R, 1 for R2L */
short int x_max5mode; /* 0 for classic Max 4.6 mode,
1 for Max 5 mode (with 2nd !0 argument) */
} t_Bucket;
static t_class *Bucket_class;
......@@ -44,6 +47,8 @@ static void Bucket_float(t_Bucket *x, t_float val)
x->x_bucks[i] = x->x_bucks[i + 1];
x->x_bucks[x->x_numbucks - 1] = val;
}
if (x->x_max5mode && !x->x_frozen)
Bucket_bang(x);
}
static void Bucket_freeze(t_Bucket *x)
......@@ -90,10 +95,10 @@ static void Bucket_free(t_Bucket *x)
freebytes(x->x_outs, x->x_numbucks * sizeof(*x->x_outs));
}
static void *Bucket_new(t_floatarg val)
static void *Bucket_new(t_floatarg val, t_floatarg max5mode)
{
t_Bucket *x;
int i, nbucks = (int)val;
int nbucks = (int)val;
t_float *bucks;
t_outlet **outs;
if (nbucks < 1)
......@@ -111,6 +116,7 @@ static void *Bucket_new(t_floatarg val)
x->x_outs = outs;
x->x_frozen = 0;
x->x_dir = 0;
x->x_max5mode = ((int)max5mode != 0);
while (nbucks--) *outs++ = outlet_new((t_object *)x, &s_float);
return (x);
}
......@@ -120,7 +126,9 @@ void Bucket_setup(void)
Bucket_class = class_new(gensym("Bucket"),
(t_newmethod)Bucket_new,
(t_method)Bucket_free,
sizeof(t_Bucket), 0, A_DEFFLOAT, 0);
sizeof(t_Bucket), 0, A_DEFFLOAT, A_DEFFLOAT, 0);
class_addcreator((t_newmethod)Bucket_new, gensym("bucket"), A_DEFFLOAT, 0);
class_addcreator((t_newmethod)Bucket_new, gensym("cyclone/bucket"), A_DEFFLOAT, 0);
class_addbang(Bucket_class, Bucket_bang);
class_addfloat(Bucket_class, Bucket_float);
class_addmethod(Bucket_class, (t_method)Bucket_freeze, gensym("freeze"), 0);
......@@ -134,4 +142,11 @@ void Bucket_setup(void)
gensym("set"), A_FLOAT, 0);
class_addmethod(Bucket_class, (t_method)Bucket_ltor, gensym("l2r"), 0);
class_addmethod(Bucket_class, (t_method)Bucket_rtol, gensym("r2l"), 0);
// logpost(NULL, 4, "this is cyclone/Bucket %s, %dth %s build",
// CYCLONE_VERSION, CYCLONE_BUILD, CYCLONE_RELEASE);
}
void bucket_setup(void)
{
Bucket_setup();
}
......@@ -142,8 +142,15 @@ void Clip_setup(void)
(t_method)clip_free,
sizeof(t_clip), 0,
A_GIMME, 0);
class_addcreator((t_newmethod)clip_new, gensym("clip"), A_GIMME, 0);
class_addcreator((t_newmethod)clip_new, gensym("cyclone/clip"), A_GIMME, 0);
class_addfloat(clip_class, clip_float);
class_addlist(clip_class, clip_list);
class_addmethod(clip_class, (t_method)clip_set,
gensym("set"), A_GIMME, 0);
}
void clip_setup(void)
{
Clip_setup();
}
......@@ -103,6 +103,8 @@ void Decode_setup(void)
(t_newmethod)Decode_new,
(t_method)Decode_free,
sizeof(t_Decode), 0, A_DEFFLOAT, 0);
class_addcreator((t_newmethod)Decode_new, gensym("decode"), A_DEFFLOAT, 0);
class_addcreator((t_newmethod)Decode_new, gensym("cyclone/decode"), A_DEFFLOAT, 0);
class_addfloat(Decode_class, Decode_float);
class_addmethod(Decode_class, (t_method)Decode_allon,
gensym("ft1"), A_FLOAT, 0);
......@@ -110,3 +112,8 @@ void Decode_setup(void)
gensym("ft2"), A_FLOAT, 0);
fitter_setup(Decode_class, 0);
}
void decode_setup(void)
{
Decode_setup();
}
......@@ -94,6 +94,8 @@ void Histo_setup(void)
(t_newmethod)Histo_new,
(t_method)Histo_free,
sizeof(t_Histo), 0, A_DEFFLOAT, 0);
class_addcreator((t_newmethod)Histo_new, gensym("histo"), A_DEFFLOAT, 0);
class_addcreator((t_newmethod)Histo_new, gensym("cyclone/histo"), A_DEFFLOAT, 0);
class_addbang(Histo_class, Histo_bang);
class_addfloat(Histo_class, Histo_float);
class_addmethod(Histo_class, (t_method)Histo_ft1,
......@@ -101,3 +103,8 @@ void Histo_setup(void)
class_addmethod(Histo_class, (t_method)Histo_clear,
gensym("clear"), 0);
}
void histo_setup(void)
{
Histo_setup();
}
......@@ -132,6 +132,8 @@ void MouseState_setup(void)
(t_newmethod)MouseState_new,
(t_method)MouseState_free,
sizeof(t_MouseState), 0, 0);
class_addcreator((t_newmethod)MouseState_new, gensym("mousestate"), 0, 0);
class_addcreator((t_newmethod)MouseState_new, gensym("cyclone/mousestate"), 0, 0);
class_addanything(MouseState_class, MouseState_anything);
class_addmethod(MouseState_class, (t_method)MouseState_doup,
gensym("_up"), A_FLOAT, 0);
......@@ -151,3 +153,8 @@ void MouseState_setup(void)
class_addmethod(MouseState_class, (t_method)MouseState_reset,
gensym("reset"), 0);
}
void mousestate_setup(void)
{
MouseState_setup();
}
......@@ -56,8 +56,15 @@ void Peak_setup(void)
Peak_class = class_new(gensym("Peak"),
(t_newmethod)Peak_new, 0,
sizeof(t_Peak), 0, 0);
class_addcreator((t_newmethod)Peak_new, gensym("peak"), 0, 0);
class_addcreator((t_newmethod)Peak_new, gensym("cyclone/peak"), 0, 0);
class_addbang(Peak_class, Peak_bang);
class_addfloat(Peak_class, Peak_float);
class_addmethod(Peak_class, (t_method)Peak_ft1,
gensym("ft1"), A_FLOAT, 0);
}
void peak_setup(void)
{
Peak_setup();
}
......@@ -66,6 +66,13 @@ void TogEdge_setup(void)
TogEdge_class = class_new(gensym("TogEdge"),
(t_newmethod)TogEdge_new, 0,
sizeof(t_TogEdge), 0, 0);
class_addcreator((t_newmethod)TogEdge_new, gensym("togedge"), 0, 0);
class_addcreator((t_newmethod)TogEdge_new, gensym("cyclone/togedge"), 0, 0);
class_addbang(TogEdge_class, TogEdge_bang);
class_addfloat(TogEdge_class, TogEdge_float);
}
void togedge_setup(void)
{
TogEdge_setup();
}
......@@ -56,8 +56,15 @@ void Trough_setup(void)
Trough_class = class_new(gensym("Trough"),
(t_newmethod)Trough_new, 0,
sizeof(t_Trough), 0, 0);
class_addcreator((t_newmethod)Trough_new, gensym("trough"), 0, 0);
class_addcreator((t_newmethod)Trough_new, gensym("cyclone/trough"), 0, 0);
class_addbang(Trough_class, Trough_bang);
class_addfloat(Trough_class, Trough_float);
class_addmethod(Trough_class, (t_method)Trough_ft1,
gensym("ft1"), A_FLOAT, 0);
}
void trough_setup(void)
{
Trough_setup();
}
......@@ -99,6 +99,8 @@ void Uzi_setup(void)
Uzi_class = class_new(gensym("Uzi"),
(t_newmethod)Uzi_new, 0,
sizeof(t_Uzi), 0, A_DEFFLOAT, 0);
class_addcreator((t_newmethod)Uzi_new, gensym("uzi"), A_DEFFLOAT, 0);
class_addcreator((t_newmethod)Uzi_new, gensym("cyclone/uzi"), A_DEFFLOAT, 0);
class_addbang(Uzi_class, Uzi_bang);
class_addfloat(Uzi_class, Uzi_float);
class_addmethod(Uzi_class, (t_method)Uzi_pause, gensym("pause"), 0);
......@@ -106,3 +108,8 @@ void Uzi_setup(void)
class_addmethod(Uzi_class, (t_method)Uzi_resume, gensym("resume"), 0);
class_addmethod(Uzi_class, (t_method)Uzi_resume, gensym("continue"), 0);
}
void uzi_setup(void)
{
Uzi_setup();
}
......@@ -5,7 +5,7 @@
#include <math.h>
#include "m_pd.h"
#if defined(NT) || defined(MACOSX)
#if defined(_WIN32) || defined(__APPLE__)
/* cf pd/src/x_arithmetic.c */
#define acosf acos
#endif
......
......@@ -36,7 +36,7 @@ static void *active_new(void)
{
t_active *x = (t_active *)pd_new(active_class);
char buf[32];
sprintf(buf, ".x%x.c", (int)canvas_getcurrent());
sprintf(buf, ".x%lx.c", (unsigned long)canvas_getcurrent());
x->x_cvname = gensym(buf);
x->x_on = 0;
outlet_new((t_object *)x, &s_float);
......
......@@ -5,7 +5,7 @@
#include <math.h>
#include "m_pd.h"
#if defined(NT) || defined(MACOSX)
#if defined(_WIN32) || defined(__APPLE__)
/* cf pd/src/x_arithmetic.c */
#define asinf asin
#endif
......
......@@ -137,7 +137,7 @@ static void capture_dowrite(t_capture *x, t_symbol *fn)
int count = x->x_count;
char buf[MAXPDSTRING];
canvas_makefilename(x->x_canvas, fn->s_name, buf, MAXPDSTRING);
if (fp = fopen(buf, "w")) /* LATER ask if overwriting, CHECKED */
if (fp = sys_fopen(buf, "w")) /* LATER ask if overwriting, CHECKED */
{
int col = 0;
if (count < x->x_bufsize)
......
......@@ -5,7 +5,7 @@
#include <math.h>
#include "m_pd.h"
#if defined(NT) || defined(MACOSX)
#if defined(_WIN32) || defined(__APPLE__)
/* cf pd/src/x_arithmetic.c */
#define atan2f atan2
#define hypotf hypot
......
......@@ -5,7 +5,7 @@
#include <math.h>
#include "m_pd.h"
#if defined(NT) || defined(MACOSX)
#if defined(_WIN32) || defined(__APPLE__)
/* cf pd/src/x_arithmetic.c */
#define coshf cosh
#endif
......
......@@ -5,6 +5,7 @@
#include "m_pd.h"
#include "common/loud.h"
#include "shared.h"
#include <stdlib.h>
typedef struct _decide
{
......@@ -77,6 +78,6 @@ void decide_setup(void)
gensym("ft1"), A_FLOAT, 0);
/* CHECKED list is auto-unfolded */
/* CHECKED doesn't understand "seed" */
//logpost(NULL, 4, "this is cyclone/decide %s, %dth %s build",
//CYCLONE_VERSION, CYCLONE_BUILD, CYCLONE_RELEASE);
// logpost(NULL, 4, "this is cyclone/decide %s, %dth %s build",
// CYCLONE_VERSION, CYCLONE_BUILD, CYCLONE_RELEASE);
}
......@@ -2,6 +2,7 @@
* For information on usage and redistribution, and for a DISCLAIMER OF ALL
* WARRANTIES, see the file, "LICENSE.txt," in this distribution. */
#include <libgen.h>
#include "m_pd.h"
#include "common/loud.h"
#include "common/vefl.h"
......@@ -227,10 +228,16 @@ static void funbuff_dowrite(t_funbuff *x, t_symbol *fn)
t_binbuf *bb = binbuf_new();
char buf[MAXPDSTRING];
t_hammernode *np;
binbuf_addv(bb, "s", atom_getsymbol(binbuf_getvec(x->x_ob.te_binbuf)));
/* specifying the object as cyclone/funbuff breaks the file writing/
* reading as the it doesn't start with 'funbuff'. A call to
* libgen/basename fixes this. fjk, 2015-01-24 */
t_symbol *objName = atom_getsymbol(binbuf_getvec(x->x_ob.te_binbuf));
objName->s_name = basename(objName->s_name);
binbuf_addv(bb, "s", objName);
for (np = x->x_tree.t_first; np; np = np->n_next)
binbuf_addv(bb, "if", np->n_key, HAMMERNODE_GETFLOAT(np));
canvas_makefilename(x->x_canvas, fn->s_name, buf, MAXPDSTRING);
binbuf_write(bb, buf, "", 0);
binbuf_free(bb);
}
......@@ -270,7 +277,7 @@ static void funbuff_read(t_funbuff *x, t_symbol *s)
a bug? but CHECKME other classes (cf seq's filetype dilemma) */
static void funbuff_write(t_funbuff *x, t_symbol *s)
{
if (s && s != &s_)
if (s && s != &s_)
funbuff_dowrite(x, s);
else /* CHECKME default name */
hammerpanel_save(x->x_filehandle,
......@@ -332,7 +339,7 @@ static void funbuff_dump(t_funbuff *x)
}
/* CHECKME if pointer is updated */
static void funbuff_dointerp(t_funbuff *x, t_floatarg f, int vsz, t_float *vec)
static void funbuff_dointerp(t_funbuff *x, t_floatarg f, int vsz, t_word *vec)
{
t_hammernode *np1;
int trunc = (int)f;
......@@ -365,7 +372,7 @@ static void funbuff_dointerp(t_funbuff *x, t_floatarg f, int vsz, t_float *vec)
return;
}
vec += vndx;
frac = *vec + (vec[1] - *vec) * vfrac;
frac = vec[0].w_float + (vec[1].w_float - vec[0].w_float) * vfrac;
}
value +=
(HAMMERNODE_GETFLOAT(np2) - HAMMERNODE_GETFLOAT(np1)) * frac;
......@@ -385,7 +392,7 @@ static void funbuff_interp(t_funbuff *x, t_floatarg f)
static void funbuff_interptab(t_funbuff *x, t_symbol *s, t_floatarg f)
{
int vsz;
t_float *vec;
t_word *vec;
if (vec = vefl_get(s, &vsz, 0, (t_pd *)x))
{
if (vsz > 2)
......@@ -523,4 +530,6 @@ void funbuff_setup(void)
gensym("debug"), A_DEFFLOAT, 0);
#endif
hammerfile_setup(funbuff_class, 1);
// logpost(NULL, 4, "this is cyclone/funbuff %s, %dth %s build",
// CYCLONE_VERSION, CYCLONE_BUILD, CYCLONE_RELEASE);
}
......@@ -488,8 +488,7 @@ static void mtr_doread(t_mtr *x, t_mtrack *target, t_symbol *fname)
path[MAXPDSTRING-1] = 0;
}
/* CHECKED no global message */
sys_bashfilename(path, path);
if (fp = fopen(path, "r"))
if (fp = sys_fopen(path, "r"))
{
t_mtrack *tp = 0;
char linebuf[MTR_FILEBUFSIZE];
......@@ -637,8 +636,7 @@ static void mtr_dowrite(t_mtr *x, t_mtrack *source, t_symbol *fname)
path[MAXPDSTRING-1] = 0;
}
/* CHECKED no global message */
sys_bashfilename(path, path);
if (fp = fopen(path, "w"))
if (fp = sys_fopen(path, "w"))
{
/* CHECKED single-track writing does not seem to work (a bug?) */
if (source) failed = mtr_writetrack(x, source, fp);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment