aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGuenter Geiger <ggeiger@users.sourceforge.net>2005-07-01 07:51:03 +0000
committerGuenter Geiger <ggeiger@users.sourceforge.net>2005-07-01 07:51:03 +0000
commite1a199f0267439fe0ac118a5c903bd3e7c72ec00 (patch)
tree05987843da83cbe49056232f36f4f5fce26bb9dc
parent9e5b1dbdc05765ffba00e61bb5a0518c3cda9336 (diff)
who knows what
svn path=/trunk/externals/ggee/; revision=3274
-rwxr-xr-xgui/envgen.c22
-rwxr-xr-xgui/slider.c45
-rw-r--r--gui/sliderh.c10
3 files changed, 44 insertions, 33 deletions
diff --git a/gui/envgen.c b/gui/envgen.c
index 3886572..bc33708 100755
--- a/gui/envgen.c
+++ b/gui/envgen.c
@@ -7,7 +7,7 @@
#define NONE 0
#define ATTACK 1
-#define SUSTAIN 3
+#define SUSTAIN -1
#define STATES 100
#include "envgen.h"
@@ -187,6 +187,17 @@ void envgen_bang(t_envgen *x)
clock_delay(x->x_clock,x->duration[x->x_state]);
}
+void envgen_release(t_envgen* x) {
+ t_atom a[2];
+ float del = x->duration[x->x_state] - x->duration[x->x_state-1];
+ if (x->x_state <= x->sustain_state) {
+ x->x_state = x->sustain_state+1; /* skip sustain state */
+ clock_delay(x->x_clock,del);
+ SETFLOAT(a,x->finalvalues[x->x_state]*(x->max-x->min));
+ SETFLOAT(a+1,del);
+ OUT_LIST(x,2,a);
+ }
+}
static void envgen_sustain(t_envgen *x, t_floatarg f)
{
@@ -199,15 +210,15 @@ static void envgen_tick(t_envgen* x)
{
t_atom a[2];
x->x_state++;
- if (x->x_state <= x->last_state) {
+ if (x->x_state <= x->last_state && x->x_state != x->sustain_state) {
float del = x->duration[x->x_state] - x->duration[x->x_state-1];
clock_delay(x->x_clock,del);
SETFLOAT(a,x->finalvalues[x->x_state]*(x->max-x->min));
SETFLOAT(a+1,del);
OUT_LIST(x,2,a);
}
- else
- clock_unset(x->x_clock);
+// else
+// clock_unset(x->x_clock);
}
static void envgen_freeze(t_envgen* x, t_floatarg f)
@@ -321,7 +332,8 @@ void envgen_setup(void)
class_addmethod(envgen_class,(t_method)envgen_freeze,gensym("freeze"),A_FLOAT,NULL);
class_addmethod(envgen_class,(t_method)envgen_setresize,gensym("resize"),A_FLOAT,A_NULL);
- envgen_widgetbehavior.w_getrectfn = envgen_getrect;
+ class_addmethod(envgen_class,(t_method)envgen_release,gensym("release"),A_NULL);
+ envgen_widgetbehavior.w_getrectfn = envgen_getrect;
envgen_widgetbehavior.w_displacefn = envgen_displace;
envgen_widgetbehavior.w_selectfn = envgen_select;
envgen_widgetbehavior.w_activatefn = envgen_activate;
diff --git a/gui/slider.c b/gui/slider.c
index a2bb293..8e74a8e 100755
--- a/gui/slider.c
+++ b/gui/slider.c
@@ -9,45 +9,44 @@ static void slider_save(t_gobj *z, t_binbuf *b)
{
t_fatom *x = (t_fatom *)z;
- binbuf_addv(b, "ssiisiiisss", gensym("#X"),gensym("obj"),
+ binbuf_addv(b, "ssiisiii", gensym("#X"),gensym("obj"),
x->x_obj.te_xpix, x->x_obj.te_ypix ,
- gensym("slider"),x->x_max,x->x_min,x->x_width,x->x_send,x->x_color,x->x_bgcolor);
+ gensym("slider"),x->x_max,x->x_min,x->x_width);
binbuf_addv(b, ";");
}
-static void *slider_new(t_symbol* s,t_int argc, t_atom* argv)
+static void *slider_new(t_floatarg max, t_floatarg min, t_floatarg h)
{
t_fatom *x = (t_fatom *)pd_new(slider_class);
x->x_type = gensym("vslider");
- return fatom_new(x,argc,argv);
+ return fatom_new(x,max,min,h,&s_);
}
t_widgetbehavior slider_widgetbehavior;
-void slider_setup(void) {
+void slider_setup() {
slider_class = class_new(gensym("slider"), (t_newmethod)slider_new, 0,
- sizeof(t_fatom),0,A_GIMME,0);
-
- slider_widgetbehavior.w_getrectfn = fatom_getrect;
- slider_widgetbehavior.w_displacefn = fatom_displace;
- slider_widgetbehavior.w_selectfn = fatom_select;
- slider_widgetbehavior.w_activatefn = fatom_activate;
- slider_widgetbehavior.w_deletefn = fatom_delete;
- slider_widgetbehavior.w_visfn= fatom_vis;
- slider_widgetbehavior.w_clickfn = NULL;
-
- fatom_setup_common(slider_class);
- class_setwidget(slider_class,&slider_widgetbehavior);
-
+ sizeof(t_fatom),0,A_DEFFLOAT,A_DEFFLOAT,A_DEFFLOAT,0);
+
+ slider_widgetbehavior.w_getrectfn = fatom_getrect,
+ slider_widgetbehavior.w_displacefn = fatom_displace,
+ slider_widgetbehavior.w_selectfn = fatom_select,
+ slider_widgetbehavior.w_activatefn = fatom_activate,
+ slider_widgetbehavior.w_deletefn = fatom_delete,
+ slider_widgetbehavior.w_visfn= fatom_vis,
#if PD_MINOR_VERSION < 37
- slider_widgetbehavior.w_savefn = slider_save;
- slider_widgetbehavior.w_propertiesfn = NULL;
-#else
+ slider_widgetbehavior.w_savefn = slider_save,
+ slider_widgetbehavior.w_propertiesfn = NULL,
+#endif
+ slider_widgetbehavior.w_clickfn = NULL,
+
+ fatom_setup_common(slider_class);
+ class_setwidget(slider_class,&slider_widgetbehavior);
+#if PD_MINOR_VERSION >= 37
class_setsavefn(slider_class,&slider_save);
- class_setpropertiesfn(slider_class,&fatom_properties);
#endif
-
+ class_setpropertiesfn(slider_class,&fatom_properties);
}
diff --git a/gui/sliderh.c b/gui/sliderh.c
index 5d86e5d..d89b6de 100644
--- a/gui/sliderh.c
+++ b/gui/sliderh.c
@@ -18,18 +18,18 @@ static void sliderh_save(t_gobj *z, t_binbuf *b)
t_fatom *x = (t_fatom *)z;
- binbuf_addv(b, "ssiisiiisss", gensym("#X"),gensym("obj"),
+ binbuf_addv(b, "ssiisiii", gensym("#X"),gensym("obj"),
x->x_obj.te_xpix, x->x_obj.te_ypix ,
- gensym("sliderh"),x->x_max,x->x_min,x->x_width,x->x_send,x->x_color,x->x_bgcolor);
+ gensym("sliderh"),x->x_max,x->x_min,x->x_width);
binbuf_addv(b, ";");
}
-static void *sliderh_new(t_symbol* s, int argc, t_atom* argv)
+static void *sliderh_new(t_floatarg max, t_floatarg min,t_floatarg h)
{
t_fatom *x = (t_fatom *)pd_new(sliderh_class);
x->x_type = gensym("hslider");
- return fatom_new(x,argc,argv);
+ return fatom_new(x,max,min,h,&s_);
}
@@ -38,7 +38,7 @@ t_widgetbehavior sliderh_widgetbehavior;
-void sliderh_setup(void) {
+void sliderh_setup() {
sliderh_class = class_new(gensym("sliderh"), (t_newmethod)sliderh_new, 0,
sizeof(t_fatom),0,A_DEFFLOAT,A_DEFFLOAT,A_DEFFLOAT,0);