From af2c8a166c053ea29cf543e0a15054bdd0e39799 Mon Sep 17 00:00:00 2001 From: Hans-Christoph Steiner Date: Thu, 8 Apr 2004 03:09:14 +0000 Subject: made mjLib conform to the CVS build system and 0.37 help patch naming scheme svn path=/trunk/externals/mjlib/; revision=1572 --- about.c | 2 +- about.h | 1 - convolve~.c | 2 +- doc/about-help.pd | 23 +++++ doc/metroplus-help.pd | 37 ++++++++ doc/monorhythm-help.pd | 63 +++++++++++++ doc/morse-help.pd | 111 +++++++++++++++++++++++ doc/n2m-help.pd | 21 +++++ doc/pin~-help.pd | 41 +++++++++ doc/polyexample.pd | 46 ++++++++++ doc/prob-help.pd | 34 +++++++ makefile | 96 ++++++++++++-------- metroplus.c | 2 +- monorhythm.c | 2 +- monorythm.c | 238 ------------------------------------------------- monorythm.h | 33 ------- morse.c | 2 +- n2m.c | 2 +- pin~.c | 2 +- prob.c | 2 +- synapseA~.c | 2 +- 21 files changed, 444 insertions(+), 318 deletions(-) create mode 100755 doc/about-help.pd create mode 100755 doc/metroplus-help.pd create mode 100755 doc/monorhythm-help.pd create mode 100755 doc/morse-help.pd create mode 100755 doc/n2m-help.pd create mode 100755 doc/pin~-help.pd create mode 100755 doc/polyexample.pd create mode 100755 doc/prob-help.pd delete mode 100644 monorythm.c delete mode 100644 monorythm.h diff --git a/about.c b/about.c index 7b07543..fde23fa 100644 --- a/about.c +++ b/about.c @@ -73,6 +73,6 @@ static void about_set_err( t_about *x, t_float f ) (t_method)about_free, sizeof(t_about), 0, A_DEFFLOAT , 0); class_addfloat( about_class, about_float ); class_addmethod(about_class, (t_method)about_set_err, gensym("error" ), A_FLOAT, 0); - class_sethelpsymbol(about_class, gensym("mjLib/about")); + } diff --git a/about.h b/about.h index 389442d..737f13a 100644 --- a/about.h +++ b/about.h @@ -1,4 +1,3 @@ -#include "m_pd.h" typedef struct _about { diff --git a/convolve~.c b/convolve~.c index 58bab5f..7edcb0a 100644 --- a/convolve~.c +++ b/convolve~.c @@ -175,6 +175,6 @@ void convolve_tilde_setup(void) class_addmethod(convolve_tilde_class, (t_method) convolve_tilde_dsp, gensym("dsp"), (t_atomtype)0); class_addmethod(convolve_tilde_class, (t_method) convolve_tilde_ticktime, gensym("tick") , A_DEFFLOAT , (t_atomtype)0 ); class_addmethod(convolve_tilde_class, (t_method) convolve_tilde_prob, gensym("prob") , A_DEFFLOAT , (t_atomtype)0 ); - class_sethelpsymbol(convolve_tilde_class, gensym("mjLib/convolve~")); + } diff --git a/doc/about-help.pd b/doc/about-help.pd new file mode 100755 index 0000000..d44221a --- /dev/null +++ b/doc/about-help.pd @@ -0,0 +1,23 @@ +#N canvas 123 239 657 440 12; +#X floatatom 215 277 5 0 0 0 of_this_number---> - -; +#X floatatom 217 374 5 0 0 0 here---> - -; +#X obj 218 172 bng 35 250 50 0 empty empty empty 20 8 0 8 -262144 -1 +-1; +#X floatatom 325 214 5 0 0 0 - - -; +#X obj 219 323 about 10; +#X text 24 16 about; +#X text 25 34 by mark williamson; +#X text 22 56 (mark@junklight.com); +#X text 26 92 about makes numbers that are + or - a percenage error +from a given value. That is it makes numbers that are "about" the given +value.; +#X text 67 168 click here --->; +#X text 88 194 and get; +#X text 258 192 a number which is within; +#X text 377 215 %; +#X text 319 340 %age as a parameter; +#X text 304 322 note: you can set the default; +#X connect 0 0 4 0; +#X connect 2 0 0 0; +#X connect 3 0 4 1; +#X connect 4 0 1 0; diff --git a/doc/metroplus-help.pd b/doc/metroplus-help.pd new file mode 100755 index 0000000..9d88602 --- /dev/null +++ b/doc/metroplus-help.pd @@ -0,0 +1,37 @@ +#N canvas 155 70 632 505 12; +#X obj 166 441 bng 15 250 50 0 empty empty empty 20 8 0 8 -262144 -1 +-1; +#X msg 170 249 start; +#X msg 123 351 stop; +#X floatatom 460 286 5 0 0 0 - - -; +#X obj 173 393 metroplus 1000 500 1000 200; +#X msg 269 309 500 1000 200; +#X text 28 13 metroplus; +#X text 27 32 by mark williamson (mark@junklight.com); +#X obj 182 279 bng 15 250 50 0 empty empty empty 20 8 0 8 -262144 -1 +-1; +#X text 27 65 metroplus is a variation on the metro object. Instead +of providing a steady pulse however it can provide an irregular beat. +It takes as its control a list of numbers representing intervals in +milliseconds. These are the time between each "pulse". So for example +with the initial setting below (in the metroplus object itself) - the +first pulse comes after 1 second the second after 500ms the third after +1 second and the fourth after 200ms - the next beat comming a second +after that because the sequence starts again.; +#X text 19 243 start with; +#X text 18 257 a start message; +#X text 18 274 or a 'bang'---->; +#X text 12 321 stop with a; +#X text 11 338 stop; +#X text 13 352 message--->; +#X text 245 286 set a new sequence; +#X text 457 322 it still works; +#X text 455 338 like a metro; +#X text 428 355 object if you want; +#X text 518 372 it to; +#X connect 1 0 4 0; +#X connect 2 0 4 0; +#X connect 3 0 4 1; +#X connect 4 0 0 0; +#X connect 5 0 4 1; +#X connect 8 0 4 0; diff --git a/doc/monorhythm-help.pd b/doc/monorhythm-help.pd new file mode 100755 index 0000000..2d8886b --- /dev/null +++ b/doc/monorhythm-help.pd @@ -0,0 +1,63 @@ +#N canvas 153 22 644 746 12; +#X obj 292 684 bng 15 250 50 0 empty empty empty 20 8 0 8 -262144 -1 +-1; +#X msg 115 505 start; +#X obj 219 680 bng 15 250 50 0 empty empty empty 20 8 0 8 -262144 -1 +-1; +#X obj 373 685 bng 15 250 50 0 empty empty empty 20 8 0 8 -262144 -1 +-1; +#X msg 41 494 stop; +#X obj 210 507 bng 15 250 50 0 empty empty empty 20 8 0 8 -262144 -1 +-1; +#X msg 353 526 1 2 1 1; +#X msg 452 538 2000; +#X msg 261 491 1 2 0 1; +#X obj 219 611 monorhythm 2000 2 1 1; +#X text 23 38 by mark williamson; +#X text 25 13 monorhythm; +#X text 23 62 (mark@junklight.com); +#X text 28 97 The monorhythm object is designed to allow simple rythms +to be generated. It is also constructed in such away so as to create +more complex polyrhythms quickly and easily.; +#X text 28 154 The monorhythm object is given a time interval and a +rhythm pattern. It divides the interval into the number of beats in +the pattern and outputs bangs as defined by the pattern. The performance +time of the entire pattern is given by the time interval.; +#X text 30 242 The pattern consists of strings of the symbols 0 \, +1 and 2 0 is a rest \, 1 is a normal beat and 2 is an accented beat. +A rest produces no output. A 1 produces a bang on the leftmost outlet. +A 2 produces a bang on the left most outlet and a bang on the middle +outlet (the accent outlet).; +#X text 30 331 In order to synchronise multiple monorhythms there is +a third outlet - the sync outlet. This does a bang at the start of +every bar - which can be fed to the left most inlet of a second (or +Nth) monorhythm.; +#X text 29 412 for an example of a polyrhythm see:; +#X obj 380 412 polyexample; +#X text 199 701 beat; +#X text 278 702 accent; +#X text 362 704 sync; +#X text 449 568 time interval; +#X text 278 459 pattern; +#X text 37 466 stop; +#X text 104 467 start or bang; +#X text 105 483 sets it going; +#X msg 25 559 exclusive; +#X msg 27 654 nonexclusive; +#X text 22 590 beat and accent; +#X text 21 607 bangs are mutually; +#X text 20 622 exclusive; +#X text 23 682 accent bang; +#X text 23 697 supplements; +#X text 22 715 the beat bang; +#X connect 1 0 9 0; +#X connect 4 0 9 0; +#X connect 5 0 9 0; +#X connect 6 0 9 1; +#X connect 7 0 9 2; +#X connect 8 0 9 1; +#X connect 9 0 2 0; +#X connect 9 1 0 0; +#X connect 9 2 3 0; +#X connect 27 0 9 0; +#X connect 28 0 9 0; diff --git a/doc/morse-help.pd b/doc/morse-help.pd new file mode 100755 index 0000000..af5fc86 --- /dev/null +++ b/doc/morse-help.pd @@ -0,0 +1,111 @@ +#N canvas 68 34 884 712 12; +#X obj 274 213 morse; +#X obj 274 243 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 +-1; +#X obj 296 243 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 +-1; +#X obj 319 243 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 +-1; +#X msg 61 73 1; +#X msg 121 47 stop; +#X msg 303 165 msg this is a test message; +#X obj 87 119 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 +-1; +#X msg 303 139 msg 1 2 3 4 8; +#X obj 106 117 metro 100; +#X obj 129 615 dac~; +#X obj 137 574 *~; +#X obj 165 549 hsl 128 22 0.01 1 1 0 empty empty volume 9 9 1 10 -262144 +-1 -1 10000 0; +#X obj 137 524 *~; +#X obj 62 297 osc~ 440; +#X obj 65 269 hsl 128 22 10 6000 0 0 empty empty frequency 9 9 1 10 +-262144 -1 -1 1900 1; +#X obj 183 484 line~; +#X obj 197 390 delay 50; +#X obj 197 370 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 +-1; +#X floatatom 286 392 5 0 0 0 - - -; +#X floatatom 7 298 5 0 0 0 - - -; +#X msg 62 241 906.1; +#X obj 62 214 loadbang; +#X obj 382 389 delay 50; +#X obj 382 369 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 +-1; +#X floatatom 468 390 5 0 0 0 - - -; +#X obj 355 657 writesf~ 2; +#X msg 358 596 start; +#X msg 421 596 stop; +#X msg 428 627 open mouts.wav; +#X msg 157 430 1 1; +#X msg 197 430 0 1; +#X msg 342 429 1 1; +#X msg 384 429 0 1; +#X obj 683 155 hsl 128 15 10 1000 0 0 empty empty empty -2 -6 0 8 -262144 +-1 -1 513 1; +#X text 714 129 speed; +#X floatatom 681 185 5 0 0 0 - - -; +#X obj 643 276 s dot; +#X obj 735 276 s dash; +#X obj 191 91 r dot; +#X obj 272 364 r dot; +#X obj 457 362 r dash; +#X obj 735 224 * 3; +#X msg 680 93 50; +#X obj 680 64 loadbang; +#X text 230 333 dot; +#X text 387 337 dash; +#X text 188 528 volume - don't forget to set!; +#X msg 61 47 start; +#X text 335 684 you can record to a file.; +#X text 11 4 convert text to Morse Code; +#X text 223 36 On UNIX and MacOS X systems \, its case-sensitive \, +on Windows \, its not.; +#X connect 0 0 1 0; +#X connect 0 1 2 0; +#X connect 0 2 3 0; +#X connect 1 0 18 0; +#X connect 2 0 24 0; +#X connect 4 0 9 0; +#X connect 5 0 9 0; +#X connect 6 0 0 0; +#X connect 8 0 0 0; +#X connect 9 0 0 0; +#X connect 9 0 7 0; +#X connect 11 0 10 0; +#X connect 11 0 10 1; +#X connect 11 0 26 0; +#X connect 11 0 26 1; +#X connect 12 0 11 1; +#X connect 13 0 11 0; +#X connect 14 0 13 0; +#X connect 15 0 14 0; +#X connect 15 0 20 0; +#X connect 16 0 13 1; +#X connect 17 0 31 0; +#X connect 18 0 17 0; +#X connect 18 0 30 0; +#X connect 21 0 15 0; +#X connect 22 0 21 0; +#X connect 23 0 33 0; +#X connect 24 0 23 0; +#X connect 24 0 32 0; +#X connect 27 0 26 0; +#X connect 28 0 26 0; +#X connect 29 0 26 0; +#X connect 30 0 16 0; +#X connect 31 0 16 0; +#X connect 32 0 16 0; +#X connect 33 0 16 0; +#X connect 34 0 36 0; +#X connect 36 0 37 0; +#X connect 36 0 42 0; +#X connect 39 0 9 1; +#X connect 40 0 17 1; +#X connect 40 0 19 0; +#X connect 41 0 23 1; +#X connect 41 0 25 0; +#X connect 42 0 38 0; +#X connect 43 0 34 0; +#X connect 44 0 43 0; +#X connect 48 0 4 0; diff --git a/doc/n2m-help.pd b/doc/n2m-help.pd new file mode 100755 index 0000000..f3960e2 --- /dev/null +++ b/doc/n2m-help.pd @@ -0,0 +1,21 @@ +#N canvas 227 128 645 441 12; +#X obj 104 320 n2m; +#X obj 95 378 print; +#X text 32 13 n2m - note to midi; +#X text 32 36 by mark williamson (http://www.junklight.com); +#X text 33 75 n2m converts note names in the form +to a midi number. It copes with single notes or chords.; +#X msg 109 174 note C5 d#7 c3; +#X msg 67 128 note c6; +#X msg 146 220 note D; +#X msg 182 270 note 7; +#X text 174 129 output note C6; +#X text 271 174 output a chord; +#X text 244 218 Octave defaults to 4; +#X text 266 268 note defaults to C; +#X text 191 343 on Windows \, its not case sensitive; +#X connect 0 0 1 0; +#X connect 5 0 0 0; +#X connect 6 0 0 0; +#X connect 7 0 0 0; +#X connect 8 0 0 0; diff --git a/doc/pin~-help.pd b/doc/pin~-help.pd new file mode 100755 index 0000000..0b8efed --- /dev/null +++ b/doc/pin~-help.pd @@ -0,0 +1,41 @@ +#N canvas 146 80 623 617 12; +#X obj 210 485 dac~; +#X obj 159 395 osc~; +#X msg 159 282 69; +#X obj 159 327 mtof; +#X floatatom 159 304 0 0 0 0 - - -; +#X floatatom 159 349 0 0 0 0 - - -; +#X obj 159 371 sig~; +#X floatatom 238 314 5 0 1 0 - - -; +#X floatatom 312 359 5 0 0 0 - - -; +#X text 19 13 pin~; +#X text 20 55 the pin~ object can be considered to be similar to the +pin in a bagatelle game. The ball upon hitting it has a random probability +of falling to one side or the other. The pin~ object takes a single +signal input and outputs it to the left or right output at random based +on the probability set (right most input). The interval at which the +outlet is choosen can be set by the right most input. Setting this +to 0 or less means a different output is choosen for every call of +the dsp routine. A higher value means that the output is choosen every +so many milliseconds.; +#X obj 159 250 loadbang; +#X text 19 314 test signal; +#X text 19 327 generator---->; +#X text 226 289 probability to choose left; +#X text 304 307 (between 0 and 1); +#X text 325 338 choice interval; +#X obj 181 437 pin~ 0.5 100; +#X text 25 523 note that no panning or envelopes are applied and therefore +low choice intervals will add "switching" noise to the output.; +#X text 19 30 by mark williamson (mark@junklight.com); +#X connect 1 0 17 0; +#X connect 2 0 4 0; +#X connect 3 0 5 0; +#X connect 4 0 3 0; +#X connect 5 0 6 0; +#X connect 6 0 1 0; +#X connect 7 0 17 1; +#X connect 8 0 17 2; +#X connect 11 0 2 0; +#X connect 17 0 0 0; +#X connect 17 1 0 1; diff --git a/doc/polyexample.pd b/doc/polyexample.pd new file mode 100755 index 0000000..878d6a0 --- /dev/null +++ b/doc/polyexample.pd @@ -0,0 +1,46 @@ +#N canvas 488 354 600 357 12; +#X obj 120 193 monorhythm; +#X obj 157 270 bng 15 250 50 0 empty empty empty 20 8 0 8 -262144 -1 +-1; +#X msg 155 91 start; +#X obj 111 274 bng 15 250 50 0 empty empty empty 20 8 0 8 -262144 -1 +-1; +#X obj 200 228 bng 15 250 50 0 empty empty empty 20 8 0 8 -262144 -1 +-1; +#X msg 228 91 stop; +#X msg 220 160 2000; +#X obj 286 194 monorhythm; +#X obj 323 271 bng 15 250 50 0 empty empty empty 20 8 0 8 -262144 -1 +-1; +#X obj 277 275 bng 15 250 50 0 empty empty empty 20 8 0 8 -262144 -1 +-1; +#X obj 358 226 bng 15 250 50 0 empty empty empty 20 8 0 8 -262144 -1 +-1; +#X msg 374 161 2000; +#X text 42 16 An example of a polyrhythm ( 2 against 3) built with +2 monorhythm's; +#X obj 321 121 loadbang; +#X msg 305 160 2 1 1; +#X msg 170 159 2 1; +#X text 89 294 beat; +#X text 148 292 accent; +#X text 250 293 beat; +#X text 313 295 accent; +#X connect 0 0 3 0; +#X connect 0 1 1 0; +#X connect 0 2 4 0; +#X connect 0 2 7 0; +#X connect 2 0 0 0; +#X connect 5 0 7 0; +#X connect 5 0 0 0; +#X connect 6 0 0 2; +#X connect 7 0 9 0; +#X connect 7 1 8 0; +#X connect 7 2 10 0; +#X connect 11 0 7 2; +#X connect 13 0 11 0; +#X connect 13 0 14 0; +#X connect 13 0 15 0; +#X connect 13 0 6 0; +#X connect 14 0 7 1; +#X connect 15 0 0 1; diff --git a/doc/prob-help.pd b/doc/prob-help.pd new file mode 100755 index 0000000..85ea41c --- /dev/null +++ b/doc/prob-help.pd @@ -0,0 +1,34 @@ +#N canvas 144 132 614 505 12; +#X obj 235 384 prob; +#X obj 235 448 bng 15 250 50 0 empty empty empty 20 8 0 8 -262144 -1 +-1; +#X msg 134 317 start; +#X msg 192 304 stop; +#X floatatom 249 276 5 0 0 0 - - -; +#X floatatom 294 348 5 0 1 0 - - -; +#X text 221 254 time interval; +#X text 271 314 probability; +#X text 260 330 between 0 and 1; +#X text 25 15 prob; +#X text 25 36 by mark williamson; +#X text 23 56 (mark@junklight.com); +#X text 26 84 prob is designed to generate a random event with a given +probability at a given interval. Every clock tick (set by time) it +generates a random number and compares it against the probability to +see if an event should occur. If so a bang is output at the outlet. +; +#X text 25 174 The probability is set as a value between 0 and 1 Time +is measured in milliseconds. The messages start and stop - start and +stop events being generated. The prob object can also be started with +a bang.; +#X obj 103 350 bng 15 250 50 0 empty empty empty 20 8 0 8 -262144 -1 +-1; +#X text 64 372 bang has the; +#X text 64 389 same effect; +#X text 64 405 as start; +#X connect 0 0 1 0; +#X connect 2 0 0 0; +#X connect 3 0 0 0; +#X connect 4 0 0 1; +#X connect 5 0 0 2; +#X connect 14 0 0 0; diff --git a/makefile b/makefile index 352dd7d..126e864 100644 --- a/makefile +++ b/makefile @@ -1,37 +1,59 @@ -all: mjLib - -VC = "C:\Program Files\Microsoft Visual Studio .NET\Vc7" -INCLUDE = -I. -I..\src \ --I..\Tcl\include -I$(VC)\include -I"C:\Program Files\Microsoft Visual Studio .NET\Vc7\PlatformSDK\Include" - -LDIR = $(VC)\lib -LDIR2 = "C:\Program Files\Microsoft Visual Studio .NET\Vc7\PlatformSDK\lib" - -LIB = /NODEFAULTLIB:libc /NODEFAULTLIB:oldnames /NODEFAULTLIB:kernel \ - /NODEFAULTLIB:uuid \ - $(LDIR)\libc.lib $(LDIR)\oldnames.lib $(LDIR)\kernel32.lib \ - $(LDIR2)\wsock32.lib $(LDIR2)\winmm.lib \ - ..\bin\pd.lib -GLIB = $(LIB) ..\lib\tcl83.lib ..\lib\tk83.lib -CFLAGS = /nologo /W3 /WX /DNT /DPD /Ox /Zi /DVERSION=\"1\" -LFLAGS = /nologo - -SRC = pin~.c mjLib.c metroplus.c monorythm.c prob.c about.c synapseA~.c convolve~.c n2m.c morse.c - -OBJ = $(SRC:.c=.obj) - -.c.obj: - cl /c $(CFLAGS) $(INCLUDE) $*.c - - -mjLib: ..\mjLib\mjLib.dll - -..\mjLib\mjLib.dll ..\mjLib\mjLib.lib: $(OBJ) - link $(LFLAGS) /debug /dll /export:mjLib_setup \ - /out:..\mjLib\mjLib.dll $(OBJ) $(LIB) - - -# the following should also clean up "bin" but it doesn't because "bin" holds -# precious stuff from elsewhere. -clean: - del *.obj + +EXT = pd_linux +DEFS = -DHAVE_LIBC=1 -DHAVE_LIBM=1 -DHAVE_LIBPTHREAD=1 -DSTDC_HEADERS=1 -DHAVE_FCNTL_H=1 -DHAVE_SYS_TIME_H=1 -DHAVE_UNISTD_H=1 -DTIME_WITH_SYS_TIME=1 -DHAVE_UNISTD_H=1 -DHAVE_GETPAGESIZE=1 -DHAVE_MMAP=1 -DHAVE_SELECT=1 -DHAVE_SOCKET=1 -DHAVE_STRERROR=1 -DPD_VERSION_MINOR=32 +CC = gcc +CXX = c++ +LD = ld +AFLAGS = +LFLAGS = -export_dynamic -shared +WFLAGS = +IFLAGS = -I./include -I../src +INSTALL_PREFIX=/usr/local + +VERSION = \"$(shell cat VERSION)\" + +.SUFFIXES: .$(EXT) + +PDCFLAGS = -g -O2 $(DEFS) $(IFLAGS) $(WFLAGS) $(LFLAGS) $(AFLAGS) -DVERSION=$(VERSION) +CFLAGS = -g -O2 $(DEFS) $(IFLAGS) $(WFLAGS) -DVERSION=$(VERSION) +CXXFLAGS = $(CFLAGS) + +#LIBS = -lc -lm +LIBS = -lpthread -lm -lc +SOURCES = pin~.c mjLib.c metroplus.c monorythm.c prob.c about.c synapseA~.c convolve.c +TARGETS = $(SOURCES:.c=.$(EXT)) + +all: $(TARGETS) + +mjLib: $(TARGETS) + cc -c $(CFLAGS) -DPD mjLib.c + $(LD) -export_dynamic -shared -o mjLib.pd_linux *.o $(LIBS) + strip --strip-unneeded mjLib.pd_linux + +clean:: + -rm *.$(EXT) *.o + +distclean: clean + -rm config.cache config.log config.status makefile + + + +.c.o: + $(CC) -c -o $@ $(CFLAGS) -DPD $*.c + +# cp $@ $*_stat.o + +.o.pd_linux: + $(CC) -o $@ $(PDCFLAGS) -DPD $*.o + + + +install:: + install -d $(INSTALL_PREFIX)/pd/externs + install -m 644 *.$(EXT) $(INSTALL_PREFIX)/pd/externs + -install -m 644 mjLib.pd_linux $(INSTALL_PREFIX)/pd/externs + install -m 644 doc/*.pd $(INSTALL_PREFIX)/pd/doc/5.reference + + +dist: distclean + (cd ..;tar czvf mjLib.tar.gz mjLib) diff --git a/metroplus.c b/metroplus.c index aca86a3..722db23 100644 --- a/metroplus.c +++ b/metroplus.c @@ -172,6 +172,6 @@ static void metroplus_time_float( t_metroplus *x1, t_float f ) class_addmethod(metroplus_class, (t_method)metroplus_bang, gensym("start"), 0); class_addmethod(metroplus_2_class, (t_method)metroplus_time_seq, gensym("list"),A_GIMME,0); class_addmethod(metroplus_2_class, (t_method)metroplus_time_float ,gensym("float"),A_FLOAT,0); - class_sethelpsymbol(metroplus_class, gensym("mjLib/metroplus")); + } diff --git a/monorhythm.c b/monorhythm.c index 2855820..7be8405 100644 --- a/monorhythm.c +++ b/monorhythm.c @@ -233,6 +233,6 @@ static void monorhythm_set_time( t_monorhythm *x, t_float f ) class_addmethod(monorhythm_class, (t_method)monorhythm_set_time, gensym("timeinterval" ), A_FLOAT, 0); class_addmethod(monorhythm_class, (t_method)monorhythm_set_exclusive,gensym("exclusive"),0); class_addmethod(monorhythm_class, (t_method)monorhythm_set_nonexclusive,gensym("nonexclusive"),0); - class_sethelpsymbol(monorhythm_class, gensym("mjLib/monorhythm")); + } diff --git a/monorythm.c b/monorythm.c deleted file mode 100644 index 62bcbac..0000000 --- a/monorythm.c +++ /dev/null @@ -1,238 +0,0 @@ -#ifdef NT -#include "stdafx.h" -#include -#endif -#include "m_pd.h" -#include -#include -#include "monorythm.h" - -/** -* The monorhythm object is designed to help build polyrythms. Given -* a time interval and a pattern it produces the pattern within the time -* interval given. Thus if two where set going with the same time interval -* the two patterns (assuming they where different) would play against -* each other. -* -* this filename is spelt wrong 'cos I can't spell -*/ - -static t_class *monorhythm_class; - -/** -* clock tick - do a bang and wait the next -* time delay in the list -*/ - -static void monorhythm_tick(t_monorhythm *x) -{ - if ( x->t_running ) - { - monorhythm_do_beat( x ); - clock_delay(x->x_clock, x->x_beattime ); - } -} - -static void monorhythm_do_beat( t_monorhythm* x ) -{ - float beat; - if ( x->x_idx == x->x_size ) - { - x->x_idx = 0; - - } - if ( x->x_idx == 0) - { - outlet_bang( x->x_sync ); - } - beat = x->x_pattern[ x->x_idx++ ]; - if ( beat > 1 ) - { - if ( x->t_exclusive == 0 ) - { - outlet_bang( x->x_bang ); - } - outlet_bang( x->x_accent ); - } - else if ( beat == 1 ) - { - outlet_bang( x->x_bang ); - } -} - - -/** -* a bang causes a reset to the start of the bar - used to -* synchronize multiple monorhythm's. If the rhythm is not -* running it is started -*/ - - -static void monorhythm_bang(t_monorhythm *x) -{ - if ( x->x_beattime > 0 ) - { - monorhythm_restart( x ); - } -} - -/** -* reset the rhythm to start at the beginning -*/ - -static void monorhythm_restart(t_monorhythm *x) -{ - if ( x->x_beattime > 0 ) - { - x->t_running = 1; - x->x_idx = 0; - monorhythm_do_beat( x ); - clock_delay(x->x_clock, x->x_beattime ); - } -} - -/** -* a stop message turns us off -*/ - -static void monorhythm_stop(t_monorhythm *x) -{ - x->t_running = 0; -} - -/** -* set exclusive mode -*/ - -static void monorhythm_set_exclusive(t_monorhythm *x) -{ - x->t_exclusive = 1; -} - -/** -* set nonexclusive mode -*/ - -static void monorhythm_set_nonexclusive(t_monorhythm *x) -{ - x->t_exclusive = 0; -} - -/** -* free our clock and our timer array -*/ - -static void monorhythm_free(t_monorhythm *x) -{ - clock_free(x->x_clock); - free( x->x_pattern ); -} - -/* -* make a new monorhythm - we can provide a list of times -* so read these in too -*/ - -static void *monorhythm_new(t_symbol *s, int argc, t_atom *argv) -{ - float f; - t_monorhythm *x = (t_monorhythm *)pd_new(monorhythm_class); - x->x_pattern = NULL; - // parse any settings - if ( argc > 0 ) - { - f = atom_getfloat( &argv[0] ); - monorhythm_set_time( x , f ); - monorhythm_pattern_seq( x, s , argc - 1 , argv + 1 ); - } - x->t_running=0; - x->t_exclusive = 0; - // make us some ins and outs - x->x_clock = clock_new(x, (t_method)monorhythm_tick); - x->x_bang = outlet_new(&x->x_obj, gensym("bang")); - x->x_accent = outlet_new(&x->x_obj, gensym("accent")); - x->x_sync = outlet_new(&x->x_obj, gensym("sync")); - inlet_new(&x->x_obj, &x->x_obj.ob_pd, gensym("list"), gensym("pattern")); - inlet_new(&x->x_obj, &x->x_obj.ob_pd, gensym("float"), gensym("timeinterval")); - return (x); -} - -/** -* set a time sequence and free the old array -*/ - -static void monorhythm_pattern_seq( t_monorhythm *x, t_symbol *s, int ac, t_atom *av ) -{ - int i; - if ( x->x_pattern != NULL ) - { - free( x->x_pattern ); - } - if ( ac > 0 ) - { - x->x_pattern = (float *) malloc( ac * sizeof( float )); - for( i = 0 ; i < ac ; i++ ) - { - float t = atom_getfloat( &av[i] ); - x->x_pattern[i] = t; - } - x->x_size=ac; - monorhythm_calculate_beat_interval( x ); - } - else - { - // if there is no pattern it doens't do anything - x->x_pattern = NULL; - x->x_size=0; - x->t_running = 0; - } - x->x_idx = 0; -} - -/** -* the time interval is divided by the number of beats that are -* going to happen in order to get the beat time. If this would -* be invallid for any reason it is set to 0 and the rhythm is stopped -*/ - -static void monorhythm_calculate_beat_interval( t_monorhythm *x ) -{ - if ( ( x->x_size > 0 ) && ( x->x_time > 0 )) - { - x->x_beattime = x->x_time / x->x_size; - } - else - { - x->x_beattime = 0; - x->t_running = 0; - } -} - -/** -* set the time - recalculate the beat time -*/ - -static void monorhythm_set_time( t_monorhythm *x, t_float f ) -{ - x->x_time = f; - monorhythm_calculate_beat_interval( x ); -} - -/** -* make a new one and setup all of our messages -*/ - - void monorhythm_setup(void) -{ - monorhythm_class = class_new(gensym("monorhythm"), (t_newmethod)monorhythm_new, - (t_method)monorhythm_free, sizeof(t_monorhythm), 0, A_GIMME, 0); - class_addbang(monorhythm_class, monorhythm_bang); - class_addmethod(monorhythm_class, (t_method)monorhythm_stop, gensym("stop"), 0); - class_addmethod(monorhythm_class, (t_method)monorhythm_bang, gensym("start"), 0); - class_addmethod(monorhythm_class, (t_method)monorhythm_pattern_seq, gensym("pattern" ), A_GIMME, 0); - class_addmethod(monorhythm_class, (t_method)monorhythm_set_time, gensym("timeinterval" ), A_FLOAT, 0); - class_addmethod(monorhythm_class, (t_method)monorhythm_set_exclusive,gensym("exclusive"),0); - class_addmethod(monorhythm_class, (t_method)monorhythm_set_nonexclusive,gensym("nonexclusive"),0); - class_sethelpsymbol(monorhythm_class, gensym("mjLib/monorhythm")); -} - diff --git a/monorythm.h b/monorythm.h deleted file mode 100644 index 4a0f503..0000000 --- a/monorythm.h +++ /dev/null @@ -1,33 +0,0 @@ - -typedef struct _monorhythm -{ - t_object x_obj; - t_clock *x_clock; - t_float *x_pattern; - int x_idx; - int x_size; - t_float x_time; - t_float x_beattime; - int t_running; - int t_exclusive; - t_outlet *x_bang; - t_outlet *x_sync; - t_outlet *x_accent; -} t_monorhythm; - -static void monorhythm_tick(t_monorhythm *x); -static void monorhythm_start(t_monorhythm *x); -static void monorhythm_stop(t_monorhythm *x); -static void monorhythm_free(t_monorhythm *x); -static void *monorhythm_new(t_symbol *s, int argc, t_atom *argv); -static void monorhythm_pattern_seq( t_monorhythm *x, t_symbol *s, int ac, t_atom *av ); -static void monorhythm_time_float( t_monorhythm *x1, t_float f ); -static void monorhythm_calculate_beat_interval( t_monorhythm *x ); -static void monorhythm_set_time( t_monorhythm *x, t_float f ); -static void monorhythm_restart(t_monorhythm *x); -static void monorhythm_do_beat( t_monorhythm* x ); -static void monorhythm_set_exclusive(t_monorhythm *x); -static void monorhythm_set_nonexclusive(t_monorhythm *x); - - - diff --git a/morse.c b/morse.c index 6c2eccf..f2babe2 100644 --- a/morse.c +++ b/morse.c @@ -308,6 +308,6 @@ static char *morse_lookup( char c ) //class_addmethod(morse_class, (t_method)morse_set_time, gensym("timeinterval" ), A_FLOAT, 0); class_addmethod(morse_class, (t_method)morse_rewind,gensym("rewind"),0); //class_addmethod(morse_class, (t_method)morse_set_nonexclusive,gensym("nonexclusive"),0); - class_sethelpsymbol(morse_class, gensym("mjLib/morse")); + } diff --git a/n2m.c b/n2m.c index 87c0b74..9379c9f 100644 --- a/n2m.c +++ b/n2m.c @@ -65,7 +65,7 @@ static void n2m_notename( t_n2m *x, t_symbol *s, int ac, t_atom *av ) n2m_class = class_new(gensym("n2m"), (t_newmethod)n2m_new, (t_method)n2m_free, sizeof(t_n2m), 0, 0); class_addmethod(n2m_class, (t_method)n2m_notename, gensym("note" ), A_GIMME, 0); - class_sethelpsymbol(n2m_class, gensym("mjLib/n2m")); + } /** diff --git a/pin~.c b/pin~.c index 2934099..167a0bf 100644 --- a/pin~.c +++ b/pin~.c @@ -200,6 +200,6 @@ void pin_tilde_setup(void) class_addmethod(pin_tilde_class, (t_method) pin_tilde_dsp, gensym("dsp"), (t_atomtype)0); class_addmethod(pin_tilde_class, (t_method) pin_tilde_ticktime, gensym("tick") , A_DEFFLOAT , (t_atomtype)0 ); class_addmethod(pin_tilde_class, (t_method) pin_tilde_prob, gensym("prob") , A_DEFFLOAT , (t_atomtype)0 ); - class_sethelpsymbol(pin_tilde_class, gensym("mjLib/pin~")); + } diff --git a/prob.c b/prob.c index b94719d..1f91f8c 100644 --- a/prob.c +++ b/prob.c @@ -138,6 +138,6 @@ static void prob_set_time( t_prob *x, t_float f ) class_addmethod(prob_class, (t_method)prob_bang, gensym("start"), 0); class_addmethod(prob_class, (t_method)prob_set_probability, gensym("probability" ), A_FLOAT, 0); class_addmethod(prob_class, (t_method)prob_set_time, gensym("time" ), A_FLOAT, 0); - class_sethelpsymbol(prob_class, gensym("mjLib/prob")); + } diff --git a/synapseA~.c b/synapseA~.c index 5498c41..ebd5a6d 100644 --- a/synapseA~.c +++ b/synapseA~.c @@ -113,6 +113,6 @@ static void *synapseA_tilde_new(t_floatarg prob , t_floatarg tick) CLASS_MAINSIGNALIN( synapseA_tilde_class, t_synapseA_tilde, x_f); class_addmethod(synapseA_tilde_class, (t_method) synapseA_tilde_dsp, gensym("dsp"), (t_atomtype)0); class_addmethod(synapseA_tilde_class, (t_method) synapseA_tilde_threshold, gensym("threshold") , A_DEFFLOAT , (t_atomtype)0 ); - class_sethelpsymbol(synapseA_tilde_class, gensym("mjLib/synapseA~")); + } -- cgit v1.2.1