aboutsummaryrefslogtreecommitdiff
path: root/src/drip.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/drip.c')
-rw-r--r--src/drip.c50
1 files changed, 30 insertions, 20 deletions
diff --git a/src/drip.c b/src/drip.c
index 855f9d8..59e504c 100644
--- a/src/drip.c
+++ b/src/drip.c
@@ -1,4 +1,4 @@
-/*
+/*
* drip: unfold a parallel data-structure (*pack*age) into a sequence
*
* (c) 1999-2011 IOhannes m zmölnig, forum::für::umläute, institute of electronic music and acoustics (iem)
@@ -7,12 +7,12 @@
* 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 program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
@@ -30,8 +30,7 @@ you can adjust the drop-speed in [ms]
static t_class *drip_class;
-typedef struct _drip
-{
+typedef struct _drip {
t_object x_obj;
t_atom *buffer, *current;
@@ -58,7 +57,9 @@ static void drip_makebuffer(t_drip *x, int n, t_atom *list)
}
static void drip_bang(t_drip *x)
-{ outlet_bang(x->x_obj.ob_outlet);}
+{
+ outlet_bang(x->x_obj.ob_outlet);
+}
static void drip_all(t_drip *x, int argc, t_atom *argv)
@@ -66,16 +67,16 @@ static void drip_all(t_drip *x, int argc, t_atom *argv)
while (argc--) {
switch (argv->a_type) {
case A_FLOAT:
- outlet_float(x->x_obj.ob_outlet, atom_getfloat(argv));
+ outlet_float(x->x_obj.ob_outlet, atom_getfloat(argv));
break;
case A_SYMBOL:
- outlet_symbol(x->x_obj.ob_outlet, atom_getsymbol(argv));
+ outlet_symbol(x->x_obj.ob_outlet, atom_getsymbol(argv));
break;
case A_POINTER:
- outlet_pointer(x->x_obj.ob_outlet, argv->a_w.w_gpointer);
+ outlet_pointer(x->x_obj.ob_outlet, argv->a_w.w_gpointer);
break;
default:
- outlet_bang(x->x_obj.ob_outlet);
+ outlet_bang(x->x_obj.ob_outlet);
}
argv++;
}
@@ -98,7 +99,7 @@ static void drip_tick(t_drip *x)
default:
break;
}
-
+
if (x->current + 1 >= x->buffer + x->bufsize) { /* ok, we're done */
clock_unset(x->x_clock);
x->current = 0;
@@ -108,7 +109,8 @@ static void drip_tick(t_drip *x)
}
}
-static void drip_list(t_drip *x, t_symbol* UNUSED(s), int argc, t_atom *argv)
+static void drip_list(t_drip *x, t_symbol* UNUSED(s), int argc,
+ t_atom *argv)
{
if (x->flush && x->current) { /* do we want to flush */
drip_all(x, x->bufsize - (x->current - x->buffer), x->current);
@@ -173,12 +175,20 @@ static void *drip_new(t_symbol* UNUSED(s), int argc, t_atom *argv)
{
t_drip *x = (t_drip *)pd_new(drip_class);
- if (argc>1) x->flush = 1;
- else x->flush = 0;
+ if (argc>1) {
+ x->flush = 1;
+ } else {
+ x->flush = 0;
+ }
- if (argc) x->deltime = atom_getfloat(argv);
- else x->deltime = -1.f;
- if (x->deltime < 0.f) x->deltime = -1.0;
+ if (argc) {
+ x->deltime = atom_getfloat(argv);
+ } else {
+ x->deltime = -1.f;
+ }
+ if (x->deltime < 0.f) {
+ x->deltime = -1.0;
+ }
x->x_clock = clock_new(x, (t_method)drip_tick);
floatinlet_new(&x->x_obj, &x->deltime);
@@ -189,12 +199,12 @@ static void *drip_new(t_symbol* UNUSED(s), int argc, t_atom *argv)
void drip_setup(void)
{
- drip_class = class_new(gensym("drip"), (t_newmethod)drip_new,
- (t_method)drip_free, sizeof(t_drip), 0 ,A_GIMME, 0);
+ drip_class = class_new(gensym("drip"), (t_newmethod)drip_new,
+ (t_method)drip_free, sizeof(t_drip), 0 ,A_GIMME, 0);
class_addcreator((t_newmethod)drip_new, gensym("unfold"), A_GIMME, 0);
/* for historical reasons */
-
+
class_addbang (drip_class, drip_bang);
class_addlist (drip_class, drip_list);
class_addanything(drip_class, drip_anything);