diff options
author | Miller Puckette <millerpuckette@users.sourceforge.net> | 2007-12-28 03:43:06 +0000 |
---|---|---|
committer | Miller Puckette <millerpuckette@users.sourceforge.net> | 2007-12-28 03:43:06 +0000 |
commit | 019c0e56579fe7f94982434d8efcd7b00d8df0aa (patch) | |
tree | b221f8e00973d9a501ed7085e9f2b95fabb0009a | |
parent | 44e68e4348f7ca86f4209f3f86ac7b6cb49acd52 (diff) |
... and again trying to check in 0.41-0 test 10
svn path=/trunk/; revision=9108
117 files changed, 2268 insertions, 2742 deletions
diff --git a/pd/doc/1.manual/x2.htm b/pd/doc/1.manual/x2.htm index dd33b149..9879078e 100644 --- a/pd/doc/1.manual/x2.htm +++ b/pd/doc/1.manual/x2.htm @@ -25,7 +25,7 @@ are described in the next chapter. To learn digital audio processing basics such as how to generate time-varying sounds that don't click or fold over, try the on-line book, <A HREF="http://www.crca.ucsd.edu/~msp/techniques.htm" -<I> Theory and Techniques of Electronic Music </I>. +<I> Theory and Techniques of Electronic Music </I></A>. <H3> <A name=s1> 2.1 overview </A> </H3> diff --git a/pd/doc/3.audio.examples/I07.phase.vocoder.pd b/pd/doc/3.audio.examples/I07.phase.vocoder.pd index d0d913b3..5baceef6 100644 --- a/pd/doc/3.audio.examples/I07.phase.vocoder.pd +++ b/pd/doc/3.audio.examples/I07.phase.vocoder.pd @@ -1,8 +1,8 @@ -#N canvas 425 33 744 599 12; +#N canvas 164 25 744 599 12; #X floatatom 494 315 5 0 0 0 - transpo-set -; #X floatatom 167 383 3 0 0 0 - speed-set -; #X floatatom 55 385 7 0 0 0 - location-set -; -#N canvas 90 42 821 693 fft-analysis 0; +#N canvas 90 42 821 693 fft-analysis 1; #X obj 51 477 *~; #X obj 18 477 *~; #X obj 18 499 -~; @@ -37,9 +37,9 @@ bang; #X msg 426 619 set \$1 4; #X obj 97 425 q8_rsqrt~; -#N canvas 139 105 1006 799 read-windows 0; +#N canvas 139 105 1006 799 read-windows 1; #X obj 18 693 *~; -#X obj 340 448 r window-size; +#X obj 364 448 r window-size; #X obj 156 300 f; #X obj 102 91 r window-size; #X obj 102 139 /; @@ -60,14 +60,14 @@ bang; #X text 188 394 reading location (samples); #X obj 51 597 / 4; #X obj 288 245 * 0.01; -#X floatatom 340 498 7 0 0 0 - - -; -#X obj 340 474 *; -#X obj 499 365 r transpo; -#X obj 499 387 * 0.01; -#X obj 501 408 + 69; -#X obj 502 429 mtof; -#X obj 502 451 / 440; -#X obj 375 474 t b f; +#X floatatom 364 498 7 0 0 0 - - -; +#X obj 364 474 *; +#X obj 502 347 r transpo; +#X obj 502 369 * 0.01; +#X obj 504 390 + 69; +#X obj 505 411 mtof; +#X obj 505 433 / 440; +#X obj 399 474 t b f; #X obj 19 719 outlet~; #X obj 195 720 outlet~; #X obj 218 664 tabreceive~ \$0-hann; @@ -77,7 +77,7 @@ bang; #X obj 768 508 r speed; #X msg 768 532 set \$1; #X obj 768 557 s speed-set; -#X text 411 498 stretched window size (samples); +#X text 432 498 stretched window size (samples); #X obj 877 507 r transpo; #X msg 877 533 set \$1; #X obj 877 558 s transpo-set; @@ -123,8 +123,8 @@ by "location". If "speed" is nonzero \, "location" automatically precesses. #X obj 845 684 r auto; #X obj 730 685 r no-detune; #X msg 730 707 \; detune 0; -#X text 326 275 loop to precess the location according; -#X text 325 291 to the "speed" parameter.; +#X text 321 280 loop to precess the location according; +#X text 320 296 to the "speed" parameter.; #X text 611 31 if location changes \, update number box; #X text 610 50 in main window via "location-set" \, but; #X text 613 69 taking care to limit frequency of updates.; @@ -136,6 +136,14 @@ by "location". If "speed" is nonzero \, "location" automatically precesses. #X text 496 527 "rewind" control takes us; #X text 499 545 to a location depending on; #X text 499 564 stretched window size.; +#X obj 593 457 t b f; +#X obj 617 395 samplerate~; +#X obj 593 348 r \$0-insamprate; +#X obj 593 418 /; +#X obj 505 455 * 1; +#X text 494 312 desired transposition and sample; +#X text 494 329 rate correction for soundfile; +#X obj 593 370 t f b; #X connect 0 0 30 0; #X connect 1 0 23 0; #X connect 2 0 11 0; @@ -171,7 +179,7 @@ by "location". If "speed" is nonzero \, "location" automatically precesses. #X connect 25 0 26 0; #X connect 26 0 27 0; #X connect 27 0 28 0; -#X connect 28 0 29 0; +#X connect 28 0 99 0; #X connect 29 0 23 0; #X connect 29 1 23 1; #X connect 32 0 5 1; @@ -216,6 +224,14 @@ by "location". If "speed" is nonzero \, "location" automatically precesses. #X connect 77 0 75 0; #X connect 79 0 78 0; #X connect 80 0 81 0; +#X connect 95 0 99 0; +#X connect 95 1 99 1; +#X connect 96 0 98 1; +#X connect 97 0 102 0; +#X connect 98 0 95 0; +#X connect 99 0 29 0; +#X connect 102 0 98 0; +#X connect 102 1 96 0; #X restore 109 133 pd read-windows; #X obj 137 543 tabsend~ prev-imag; #X obj 136 567 tabsend~ prev-real; @@ -363,8 +379,8 @@ shifts the signal to the left or right depending on its argument.) #X obj 56 517 output~; #N canvas 0 110 565 454 hann-window 0; #N canvas 0 0 450 300 (subpatch) 0; -#X array \$0-hann 2048 float 0; -#X coords 0 1 2047 0 300 100 1; +#X array \$0-hann 1024 float 0; +#X coords 0 1 1023 0 300 100 1; #X restore 82 311 graph; #X obj 378 165 osc~; #X obj 378 190 *~ -0.5; @@ -413,8 +429,8 @@ and window-msec (analysis window size in seconds and msec).; #X restore 440 528 pd hann-window; #N canvas 388 86 694 447 insample 0; #N canvas 0 0 450 300 (subpatch) 0; -#X array \$0-sample 62079 float 0; -#X coords 0 1 62078 -1 400 150 1; +#X array \$0-sample 155948 float 0; +#X coords 0 1 155947 -1 400 150 1; #X restore 281 135 graph; #X obj 28 133 r read-sample; #X obj 28 184 unpack s f; diff --git a/pd/doc/4.data.structures/14.sinedecomposer.pd b/pd/doc/4.data.structures/14.sinedecomposer.pd deleted file mode 100644 index 1d240ce7..00000000 --- a/pd/doc/4.data.structures/14.sinedecomposer.pd +++ /dev/null @@ -1,250 +0,0 @@ -#N struct peak-template float x float y float amp float ampreal float -ampimag; -#N canvas 303 216 854 536 12; -#X msg 501 258 bang; -#X obj 30 360 pack 0 100; -#X obj 30 384 line~; -#X obj 30 336 dbtorms; -#N canvas 95 102 724 400 fft 0; -#X obj 64 67 inlet~; -#X obj 134 107 print~; -#X msg 137 71 bang; -#X obj 64 104 rfft~; -#N canvas 0 0 450 300 graph3 0; -#X array array3 4096 float 0; -#X coords 0 100 4096 -100 400 150 1; -#X restore 254 14 graph; -#N canvas 0 0 450 300 graph4 0; -#X array array4 4096 float 0; -#X coords 0 100 4096 -100 400 150 1; -#X restore 256 165 graph; -#X obj 9 185 tabsend~ array3; -#X obj 50 158 tabsend~ array4; -#X msg 37 246 \; array3 resize 4096 \; array4 resize 4096; -#X obj 62 38 block~ 4096 1; -#X connect 0 0 1 0; -#X connect 0 0 3 0; -#X connect 2 0 1 0; -#X connect 3 0 6 0; -#X connect 3 1 7 0; -#X restore 135 412 pd fft; -#X obj 30 408 *~; -#X obj 476 231 adc~; -#N canvas 204 36 521 368 analysis 0; -#X obj 206 37 inlet; -#X msg 207 68 bang; -#X obj 275 52 r snapshot; -#X msg 220 169 4096 array3 array4 50; -#X obj 127 252 print; -#X obj 206 103 t b b b; -#X obj 122 140 s done-analysis; -#X obj 248 133 s start-analysis; -#X obj 220 219 s found-peak; -#X obj 154 194 r loud; -#X obj 128 226 spigot; -#X obj 220 193 pique; -#X connect 0 0 1 0; -#X connect 1 0 5 0; -#X connect 2 0 1 0; -#X connect 3 0 11 0; -#X connect 5 0 6 0; -#X connect 5 1 3 0; -#X connect 5 2 7 0; -#X connect 9 0 10 1; -#X connect 10 0 4 0; -#X connect 11 0 8 0; -#X connect 11 0 10 0; -#X restore 613 295 pd analysis; -#X obj 30 313 r loop-amp; -#X msg 613 271 snapshot; -#X text 23 167 click here first; -#X text 613 247 analysis; -#N canvas 36 255 884 389 peak-saver 0; -#X floatatom 710 310 0 0 0 0 - - -; -#X floatatom 633 309 0 0 0 0 - - -; -#X floatatom 560 305 0 0 0 0 - - -; -#X floatatom 484 303 0 0 0 0 - - -; -#X obj 406 251 pointer; -#X obj 354 150 pointer; -#X msg 374 60 bang; -#X obj 142 243 rmstodb; -#X obj 10 244 * 0.1; -#X obj 141 268 * -3; -#X floatatom 416 300 0 0 0 0 - - -; -#X obj 353 36 r start-analysis; -#X obj 354 89 t b b; -#X msg 29 89 50 60 70; -#X obj 28 120 append peak-template x y amp; -#X msg 426 225 next; -#X obj 402 276 get peak-template x y amp ampreal ampimag; -#X obj 9 293 append peak-template x y amp ampreal ampimag; -#X obj 116 167 r found-peak; -#X obj 117 196 unpack 0 0 0 0 0; -#X msg 76 244 330; -#X msg 400 87 \; pd-peak-list clear; -#X msg 354 125 traverse pd-peak-list \, bang; -#X msg 408 201 traverse pd-peak-list \, next; -#X connect 4 0 16 0; -#X connect 5 0 14 3; -#X connect 5 0 17 5; -#X connect 6 0 12 0; -#X connect 7 0 9 0; -#X connect 8 0 17 0; -#X connect 9 0 17 2; -#X connect 11 0 12 0; -#X connect 12 0 22 0; -#X connect 12 1 21 0; -#X connect 13 0 14 0; -#X connect 15 0 4 0; -#X connect 16 0 10 0; -#X connect 16 1 3 0; -#X connect 16 2 2 0; -#X connect 16 3 1 0; -#X connect 16 4 0 0; -#X connect 18 0 19 0; -#X connect 19 1 8 0; -#X connect 19 2 20 0; -#X connect 19 2 7 0; -#X connect 19 3 17 3; -#X connect 19 4 17 4; -#X connect 20 0 17 1; -#X connect 22 0 5 0; -#X connect 23 0 4 0; -#X restore 339 378 pd peak-saver; -#N canvas 231 169 656 237 peak-template 0; -#X obj 45 90 filledpolygon 3 3 3 0 0 0 amp 0 0; -#X obj 37 16 struct peak-template float x float y float amp float ampreal -float ampimag; -#X restore 339 402 pd peak-template; -#N canvas 0 0 600 382 peak-list 1; -#X scalar peak-template 6.52298 330 -195.561 0.0125191 -0.0131689 \; -; -#X scalar peak-template 13.0656 330 -262.841 0.222392 0.0909196 \; -; -#X scalar peak-template 26.2816 330 -188.229 0.0133818 0.00299871 \; -; -#X scalar peak-template 34.1579 330 -182.784 -0.0111106 0.000616574 -\;; -#X scalar peak-template 39.2398 330 -192.587 0.00649353 -0.0148522 -\;; -#X scalar peak-template 54.2567 330 -169.462 -0.00637704 0.00196744 -\;; -#X scalar peak-template 64.6374 330 -153.343 -0.00231745 -0.00274854 -\;; -#X scalar peak-template 70.731 330 -228.984 -0.0391646 -0.0525299 \; -; -#X scalar peak-template 83.4018 330 -157.354 0.00213705 0.00360794 -\;; -#X scalar peak-template 89.0428 330 -164.547 0.00509053 0.00215158 -\;; -#X scalar peak-template 96.8527 330 -127.029 0.00018868 -0.00129597 -\;; -#X scalar peak-template 108.145 330 -206.524 -0.0244265 0.0130057 \; -; -#X scalar peak-template 119.672 330 -139.871 0.000310867 0.00212115 -\;; -#X scalar peak-template 129.195 330 -154.988 0.00101519 -0.00369247 -\;; -#X scalar peak-template 148.144 330 -131.59 -0.000488336 0.00148172 -\;; -#X scalar peak-template 156.394 330 -157.846 0.00107442 -0.00413614 -\;; -#X scalar peak-template 168.637 330 -126.924 0.0001938 -0.00128991 -\;; -#X scalar peak-template 189.884 330 -119.499 0.000252664 -0.000947853 -\;; -#X scalar peak-template 211.047 330 -130.949 0.000525129 0.0014288 -\;; -#X restore 339 426 pd peak-list; -#X msg 38 192 \; pd dsp 1; -#X obj 720 296 s loud; -#X text 539 189 live sample; -#X text 719 234 print out; -#X text 720 249 peak list; -#X text 168 7 SPECTRAL SNAPSHOTS.; -#X text 15 18 This patch reads a soundfile or records a live sound. -When you click on "snapshot" the peak-list window shows a list of the -sinusoidal peaks that were found at that instant in the sound. You -can also ask for the peak lists to be printed out.; -#N canvas 132 255 634 331 insample 0; -#N canvas 0 0 450 300 graph1 0; -#X array sample 155948 float 0; -#X coords 0 1 155947 -1 400 150 1; -#X restore 199 18 graph; -#X obj 19 70 r read-sample; -#X obj 19 95 unpack s f; -#X obj 53 121 s insamprate; -#X obj 19 171 soundfiler; -#X msg 19 147 read -resize \$1 sample; -#X obj 19 201 s insamplength; -#X msg 357 197 \; sample resize 220500 \; insamplength 220500; -#X connect 1 0 2 0; -#X connect 2 0 5 0; -#X connect 2 1 3 0; -#X connect 4 0 6 0; -#X connect 5 0 4 0; -#X restore 336 350 pd insample; -#N canvas 186 103 405 461 test-signal 0; -#X obj 135 296 tabread4~ sample; -#X obj 135 271 line~; -#X obj 95 146 f; -#X obj 254 46 r insamprate; -#X obj 135 415 outlet~; -#X obj 146 33 r insamplength; -#X msg 134 247 0 \, \$1 \$2; -#X obj 134 221 pack 0 0; -#X obj 209 190 /; -#X obj 299 99 * 0.001; -#X obj 135 388 hip~ 5; -#X obj 33 5 loadbang; -#X text 242 13 sample playback; -#X msg 33 25 1; -#X obj 33 69 metro 1000; -#X floatatom 33 48 0 0 0 0 - - -; -#X obj 255 75 t b b f; -#X obj 161 84 t b f; -#X connect 0 0 10 0; -#X connect 1 0 0 0; -#X connect 2 0 7 0; -#X connect 3 0 16 0; -#X connect 5 0 17 0; -#X connect 6 0 1 0; -#X connect 7 0 6 0; -#X connect 8 0 7 1; -#X connect 8 0 14 1; -#X connect 9 0 8 1; -#X connect 10 0 4 0; -#X connect 11 0 13 0; -#X connect 13 0 15 0; -#X connect 14 0 2 0; -#X connect 15 0 14 0; -#X connect 16 0 13 0; -#X connect 16 1 8 0; -#X connect 16 2 9 0; -#X connect 17 0 13 0; -#X connect 17 1 8 0; -#X connect 17 1 2 1; -#X restore 135 389 pd test-signal; -#X text 136 317 amplitude; -#X text 212 174 read a sample; -#X msg 136 193 \; read-sample ../sound/bell.aiff 44100; -#X text 12 97 The active ingredient is "pique" in the "analysis" subwindow -\, which is in the "extras" directory in the Pd release.; -#X msg 136 230 \; read-sample ../sound/voice.wav 32000; -#X obj 458 295 tabwrite~ sample; -#X obj 720 274 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 -1; -#X msg 136 268 \; read-sample ../sound/voice2.wav; -#X obj 29 435 output~; -#X connect 0 0 29 0; -#X connect 1 0 2 0; -#X connect 2 0 5 0; -#X connect 3 0 1 0; -#X connect 5 0 32 0; -#X connect 5 0 32 1; -#X connect 6 0 29 0; -#X connect 8 0 3 0; -#X connect 9 0 7 0; -#X connect 23 0 4 0; -#X connect 23 0 5 1; -#X connect 30 0 16 0; diff --git a/pd/doc/4.data.structures/15.partialtracer.pd b/pd/doc/4.data.structures/15.partialtracer.pd deleted file mode 100644 index 5fb1323f..00000000 --- a/pd/doc/4.data.structures/15.partialtracer.pd +++ /dev/null @@ -1,839 +0,0 @@ -#N struct peak-template float x float y float amp float ampreal float -ampimag float used; -#N struct trace-template float x float y float voiceno array bazoo -point-template; -#N struct point-template float y float amp; -#N canvas 163 180 926 633 12; -#X floatatom 777 72 0 0 0 0 - - -; -#N canvas 516 98 663 557 boo 0; -#X obj 103 108 outlet; -#X msg 101 80 set \$1; -#X obj 103 57 r osc-amp; -#X connect 1 0 0 0; -#X connect 2 0 1 0; -#X restore 777 52 pd; -#X obj 781 99 s osc-amp; -#X obj 121 513 pack 0 100; -#X obj 122 533 line~; -#X obj 121 493 dbtorms; -#X obj 122 573 *~; -#X floatatom 811 225 0 0 0 0 - - -; -#X msg 668 269 0; -#X floatatom 737 225 0 0 0 0 - - -; -#X floatatom 838 290 0 0 0 0 - - -; -#X floatatom 647 71 0 0 0 0 - - -; -#N canvas 516 98 663 555 boo 0; -#X obj 103 108 outlet; -#X msg 101 80 set \$1; -#X obj 103 57 r grain-amp; -#X connect 1 0 0 0; -#X connect 2 0 1 0; -#X restore 647 51 pd; -#N canvas 201 90 556 354 analysis 0; -#X obj 286 45 r snapshot; -#X obj 81 283 print; -#X obj 138 154 t b b b; -#X obj 26 189 s done-analysis; -#X obj 272 149 s start-analysis; -#X obj 209 261 s found-peak; -#X obj 139 263 r loud; -#X obj 82 262 spigot; -#X msg 179 101 1; -#X obj 40 99 r fft-done; -#X obj 40 129 spigot; -#X msg 143 101 0; -#X obj 289 84 del 0.01; -#X msg 287 66 bang; -#X text 238 103 Wait for the next FFT to come by before doing the peak -search.; -#X obj 443 176 r errthresh; -#X msg 446 219 errthresh \$1; -#X floatatom 443 199 0 0 0 0 - - -; -#X obj 276 173 r window-size; -#X obj 220 190 f; -#X msg 211 211 \$1 fft-real fft-imag 10; -#X obj 211 231 pique; -#X connect 0 0 13 0; -#X connect 2 0 3 0; -#X connect 2 1 19 0; -#X connect 2 2 4 0; -#X connect 2 2 11 0; -#X connect 6 0 7 1; -#X connect 7 0 1 0; -#X connect 8 0 10 1; -#X connect 9 0 10 0; -#X connect 10 0 2 0; -#X connect 11 0 10 1; -#X connect 12 0 8 0; -#X connect 13 0 12 0; -#X connect 15 0 17 0; -#X connect 16 0 21 0; -#X connect 17 0 16 0; -#X connect 18 0 19 1; -#X connect 19 0 20 0; -#X connect 20 0 21 0; -#X connect 21 0 5 0; -#X connect 21 0 7 0; -#X restore 351 411 pd analysis; -#N canvas 168 244 589 236 peak-template 0; -#X obj 81 52 filledpolygon 3 3 3 0 0 0 amp 0 0; -#X obj 74 10 struct peak-template float x float y float amp float ampreal -float ampimag float used; -#X restore 351 516 pd peak-template; -#N canvas 0 0 600 386 peak-list 0; -#X scalar peak-template 14.6015 330 -247.288 0.111508 -0.0711486 0 -\;; -#X scalar peak-template 27.1653 330 -217.279 0.0258328 0.0328795 0 -\;; -#X scalar peak-template 38.6569 330 -224.35 -0.0509761 0.0202439 0 -\;; -#X scalar peak-template 59.9432 330 -204.752 0.0256193 0.00348008 0 -\;; -#X scalar peak-template 70.7537 330 -220.483 -0.0080783 0.0465889 0 -\;; -#X scalar peak-template 82.8075 330 -172.145 -0.007237 -0.00153184 -0 \;; -#X scalar peak-template 94.3779 330 -170.655 0.00668927 -0.00201552 -0 \;; -#X scalar peak-template 109.018 330 -196.083 0.015492 -0.0101804 0 -\;; -#X scalar peak-template 118.207 330 -151.073 -0.00325508 -0.000512459 -0 \;; -#X scalar peak-template 131.204 330 -166.747 -0.00591408 0.00108779 -0 \;; -#X restore 351 454 pd peak-list; -#N canvas 20 23 472 426 trace-list 1; -#X scalar trace-template 0 0 10 \; -199.613 82.4286 \; \;; -#X scalar trace-template 0 0 9 \; -242.604 72.4257 \; \;; -#X scalar trace-template 0 0 8 \; -267.035 74.7826 \; \;; -#X scalar trace-template 0 0 7 \; -297.412 68.2501 \; \;; -#X scalar trace-template 0 0 6 \; -308.895 73.4936 \; \;; -#X scalar trace-template 0 0 5 \; -319.788 57.3809 \; \;; -#X scalar trace-template 0 0 4 \; -328.845 56.8844 \; \;; -#X scalar trace-template 0 0 3 \; -338.831 65.3604 \; \;; -#X scalar trace-template 0 0 2 \; -344.435 50.3571 \; \;; -#X scalar trace-template 0 0 1 \; -351.66 55.5817 \; \;; -#X restore 351 494 pd trace-list; -#N canvas 56 84 527 179 trace-template 0; -#X obj 121 72 plot bazoo 0 1 0 500 5; -#X text 121 93 This template describes a pitch/amplitude trace. The -array "bazoo" holds the actual points. In this template \, y is always -0 and x is the starting location in pixels. There are 5 pixels per -point.; -#X obj 125 36 struct trace-template float x float y float voiceno array -bazoo point-template; -#X restore 351 537 pd trace-template; -#N canvas 96 258 494 158 point-template 0; -#X text 127 56 This template describes a single point on a pitch trace -(cf. trace-template w describes the trace itself.); -#X text 127 89 "y" is the field that is shown on the graph \; it's -- 4 * pitch. You also get an "amp" field in dB \, which you can't see -as a plot (yet).; -#X obj 212 14 struct point-template float y float amp; -#X restore 351 557 pd point-template; -#X msg 746 506 bang; -#X obj 8 425 pack 0 100; -#X obj 8 449 line~; -#X obj 8 405 dbtorms; -#X floatatom 545 70 0 0 0 0 - - -; -#N canvas 194 37 730 722 output 0; -#X obj 295 76 t b f; -#X obj 286 100 +; -#X obj 515 207 f; -#X obj 532 165 f; -#X obj 359 210 f; -#X obj 83 179 t b; -#X obj 82 127 f; -#X obj 71 58 inlet; -#X text 78 37 mute; -#X obj 83 201 f; -#X msg 235 153 0; -#X msg 74 84 bang; -#X obj 83 155 moses 1; -#X obj 231 69 t b f; -#X obj 222 93 +; -#X obj 181 27 r loop-amp; -#X obj 395 26 r osc-amp; -#X obj 83 236 s loop-amp; -#X obj 359 235 s osc-amp; -#X obj 591 125 print; -#X obj 186 148 f; -#X obj 374 168 f; -#X obj 225 120 t b b; -#X obj 552 23 r grain-amp; -#X obj 516 232 s grain-amp; -#X connect 0 0 1 0; -#X connect 0 1 1 1; -#X connect 1 0 6 1; -#X connect 2 0 24 0; -#X connect 3 0 2 1; -#X connect 4 0 18 0; -#X connect 5 0 9 0; -#X connect 5 0 4 0; -#X connect 5 0 2 0; -#X connect 6 0 12 0; -#X connect 7 0 11 0; -#X connect 9 0 17 0; -#X connect 10 0 17 0; -#X connect 10 0 18 0; -#X connect 10 0 24 0; -#X connect 11 0 6 0; -#X connect 12 0 5 0; -#X connect 12 1 22 0; -#X connect 13 0 14 0; -#X connect 13 1 14 1; -#X connect 14 0 1 0; -#X connect 15 0 14 0; -#X connect 15 0 20 1; -#X connect 16 0 13 0; -#X connect 16 0 21 1; -#X connect 20 0 9 1; -#X connect 21 0 4 1; -#X connect 22 0 10 0; -#X connect 22 1 20 0; -#X connect 22 1 21 0; -#X connect 22 1 3 0; -#X connect 23 0 3 1; -#X connect 23 0 0 0; -#X restore 820 69 pd output; -#N canvas 516 98 663 559 /SUBPATCH/ 0; -#X obj 103 108 outlet; -#X msg 101 80 set \$1; -#X obj 103 57 r loop-amp; -#X connect 1 0 0 0; -#X connect 2 0 1 0; -#X restore 545 50 pd; -#N canvas 209 96 518 375 fft 0; -#X floatatom 305 194 0 0 0 0 - - -; -#X obj 454 160 r sample-rate; -#X obj 454 180 t b f; -#X obj 304 169 r window-size; -#X obj 264 38 r sample-rate; -#X obj 238 16 r window-size; -#X obj 264 58 t b f; -#X obj 238 83 /; -#X obj 170 103 bang~; -#X obj 169 175 line~; -#X obj 238 104 * 1000; -#X text 298 104 window size (msec); -#X obj 168 281 rfft~; -#X obj 170 337 tabsend~ fft-real; -#X obj 207 307 tabsend~ fft-imag; -#X obj 429 140 r location; -#X obj 429 205 *; -#X obj 429 228 * 0.001; -#X text 498 228 location (samples); -#X obj 169 129 f; -#X msg 169 152 0 \, 1 \$1; -#X obj 113 201 *~; -#X obj 113 224 -~; -#X obj 81 301 *~; -#X obj 81 324 outlet~; -#X floatatom 429 252 0 0 0 0 - - -; -#X obj 53 127 s fft-done; -#X obj 66 31 block~ 2048 1; -#X obj 168 255 tabread4~ sample; -#X obj 169 211 *~ 0; -#X obj 168 232 +~ 0; -#X connect 1 0 2 0; -#X connect 2 0 16 0; -#X connect 2 1 16 1; -#X connect 3 0 0 0; -#X connect 3 0 29 1; -#X connect 4 0 6 0; -#X connect 5 0 7 0; -#X connect 6 0 7 0; -#X connect 6 1 7 1; -#X connect 7 0 10 0; -#X connect 8 0 19 0; -#X connect 8 0 26 0; -#X connect 9 0 21 0; -#X connect 9 0 21 1; -#X connect 9 0 22 1; -#X connect 9 0 29 0; -#X connect 10 0 19 1; -#X connect 12 0 13 0; -#X connect 12 1 14 0; -#X connect 15 0 16 0; -#X connect 16 0 17 0; -#X connect 17 0 25 0; -#X connect 17 0 30 1; -#X connect 19 0 20 0; -#X connect 20 0 9 0; -#X connect 21 0 22 0; -#X connect 22 0 23 0; -#X connect 23 0 24 0; -#X connect 28 0 12 0; -#X connect 28 0 23 1; -#X connect 29 0 30 0; -#X connect 30 0 28 0; -#X restore 22 470 pd fft; -#X obj 8 493 *~; -#X obj 9 544 hip~ 5; -#X obj 9 571 dac~; -#X obj 754 529 adc~; -#X obj 545 91 s loop-amp; -#X msg 820 48 mute; -#X text 18 97 click here first; -#X text 741 489 live sample; -#X text 677 25 AMPLITUDES; -#N canvas 5 1 864 622 make-trace 0; -#X obj 186 220 * -0.33333; -#X obj 91 216 * 10; -#X obj 118 136 pointer; -#X msg 118 115 next; -#X obj 118 97 until; -#X obj 387 134 pointer; -#X msg 389 108 next; -#X obj 200 330 unpack; -#X obj 255 332 s amp; -#X obj 283 378 s frequency; -#X obj 300 361 s pitch; -#X obj 251 375 f 0; -#X obj 200 348 t b b b b f; -#X obj 781 133 pointer; -#X obj 744 602 setsize trace-template bazoo; -#X obj 744 514 random 200; -#X obj 744 532 + 100; -#X obj 857 526 pointer; -#X obj 218 532 pointer; -#X floatatom 356 524 0 0 0 0 - - -; -#X floatatom 296 550 0 0 0 0 - - -; -#X msg 205 509 bang; -#X floatatom 108 461 0 0 0 0 - - -; -#X floatatom 40 509 0 0 0 0 - - -; -#X floatatom 153 590 0 0 0 0 - - -; -#X floatatom 516 556 0 0 0 0 - - -; -#X floatatom 356 489 0 0 0 0 - - -; -#X floatatom 667 511 0 0 0 0 - - -; -#X obj 481 464 pointer; -#X msg 508 447 next; -#X floatatom 532 512 0 0 0 0 - - -; -#X obj 516 539 getsize trace-template bazoo; -#X obj 127 563 get point-template y; -#X obj 40 533 set point-template y; -#X obj 101 486 element trace-template bazoo; -#X obj 296 580 setsize trace-template bazoo; -#X obj 356 507 set trace-template x; -#X obj 356 542 set trace-template y; -#X msg 744 497 bang; -#X obj 744 549 append trace-template x; -#X obj 519 489 get trace-template x y; -#X obj 744 567 t b p; -#X msg 744 584 5; -#X obj 816 93 s clear-traces; -#X obj 783 155 s last-in-list; -#X msg 780 43 bang; -#X obj 780 60 t b b; -#X obj 745 156 f 0; -#X obj 744 176 s nframe; -#X obj 445 337 r nframe; -#X obj 429 356 f; -#X obj 429 373 + 1; -#X obj 429 391 s nframe; -#X obj 429 296 r done-frame; -#X obj 437 315 s done-adding-traces; -#X obj 19 309 r component; -#X obj 19 326 unpack; -#X obj 73 331 s amp; -#X obj 104 370 s frequency; -#X obj 120 354 s pitch; -#X obj 70 388 s added-to-trace; -#X obj 70 370 f 0; -#X obj 62 408 s add-to-trace; -#X obj 19 344 t b b b b f; -#X obj 780 25 r clear-all; -#X obj 200 311 r component2; -#X obj 251 393 s started-new-trace; -#X obj 240 414 s start-new-trace; -#X obj 355 41 r done-analysis; -#X obj 355 62 t b b b b; -#X obj 292 176 r added-to-trace; -#X obj 389 89 until; -#X obj 456 172 get peak-template x amp; -#X obj 552 195 * -0.33333; -#X obj 456 190 * 10; -#X obj 456 210 pack; -#X obj 456 226 s component; -#X obj 120 337 ftom; -#X obj 387 155 t b p p; -#X obj 256 196 set peak-template used; -#X obj 259 176 f; -#X obj 302 344 ftom; -#X msg 175 31 \; done-frame bang; -#X obj 21 178 get peak-template used x amp; -#X obj 35 236 pack 0 0 0; -#X obj 35 255 route 0; -#X obj 35 272 s component2; -#X obj 549 260 print x1; -#X obj 226 276 print x2; -#X obj 727 255 add-trace 1; -#X obj 728 274 add-trace 2; -#X obj 728 291 add-trace 3; -#X obj 727 309 add-trace 4; -#X obj 728 328 add-trace 5; -#X obj 728 345 add-trace 6; -#X obj 728 363 add-trace 7; -#X obj 729 381 add-trace 8; -#X obj 729 399 add-trace 9; -#X obj 729 417 add-trace 10; -#X msg 484 111 traverse pd-peak-list; -#X msg 781 115 traverse pd-trace-list \, bang; -#X msg 833 59 \; pd-trace-list clear; -#X msg 481 430 traverse pd-trace-list \, next; -#X msg 857 509 traverse pd-trace-list \, bang; -#X connect 0 0 84 2; -#X connect 1 0 84 1; -#X connect 2 0 83 0; -#X connect 2 1 4 1; -#X connect 3 0 2 0; -#X connect 4 0 3 0; -#X connect 5 0 78 0; -#X connect 5 1 71 1; -#X connect 6 0 5 0; -#X connect 7 0 12 0; -#X connect 7 1 8 0; -#X connect 11 0 66 0; -#X connect 12 2 67 0; -#X connect 12 3 11 0; -#X connect 12 4 81 0; -#X connect 12 4 9 0; -#X connect 13 0 44 0; -#X connect 15 0 16 0; -#X connect 16 0 39 0; -#X connect 17 0 39 1; -#X connect 18 0 32 0; -#X connect 19 0 37 0; -#X connect 20 0 35 0; -#X connect 21 0 18 0; -#X connect 22 0 34 0; -#X connect 23 0 33 0; -#X connect 26 0 36 0; -#X connect 28 0 35 1; -#X connect 28 0 36 1; -#X connect 28 0 37 1; -#X connect 28 0 34 1; -#X connect 28 0 40 0; -#X connect 28 0 31 0; -#X connect 29 0 28 0; -#X connect 31 0 25 0; -#X connect 32 0 24 0; -#X connect 34 0 18 0; -#X connect 34 0 33 1; -#X connect 38 0 15 0; -#X connect 39 0 41 0; -#X connect 40 0 30 0; -#X connect 40 1 27 0; -#X connect 41 0 42 0; -#X connect 41 1 14 1; -#X connect 42 0 14 0; -#X connect 45 0 46 0; -#X connect 46 0 100 0; -#X connect 46 0 47 0; -#X connect 46 1 101 0; -#X connect 46 1 43 0; -#X connect 47 0 48 0; -#X connect 49 0 50 1; -#X connect 50 0 51 0; -#X connect 51 0 52 0; -#X connect 53 0 50 0; -#X connect 53 0 54 0; -#X connect 55 0 56 0; -#X connect 56 0 63 0; -#X connect 56 1 57 0; -#X connect 61 0 60 0; -#X connect 63 2 62 0; -#X connect 63 3 61 0; -#X connect 63 4 77 0; -#X connect 63 4 58 0; -#X connect 64 0 45 0; -#X connect 65 0 7 0; -#X connect 68 0 69 0; -#X connect 69 0 82 0; -#X connect 69 1 4 0; -#X connect 69 2 71 0; -#X connect 69 3 99 0; -#X connect 70 0 80 1; -#X connect 71 0 6 0; -#X connect 72 0 74 0; -#X connect 72 1 73 0; -#X connect 73 0 75 1; -#X connect 74 0 75 0; -#X connect 75 0 76 0; -#X connect 77 0 59 0; -#X connect 78 0 80 0; -#X connect 78 1 79 1; -#X connect 78 2 72 0; -#X connect 80 0 79 0; -#X connect 81 0 10 0; -#X connect 83 0 84 0; -#X connect 83 1 1 0; -#X connect 83 2 0 0; -#X connect 84 0 85 0; -#X connect 85 0 86 0; -#X connect 99 0 5 0; -#X connect 99 0 2 0; -#X connect 100 0 13 0; -#X connect 102 0 28 0; -#X connect 103 0 17 0; -#X restore 351 474 pd make-trace; -#X floatatom 5 289 0 0 0 0 - - -; -#N canvas 0 0 955 721 arrays 0; -#X msg 39 202 \; fft-real resize 4096 \; fft-imag resize 4096; -#N canvas 0 0 450 300 graph1 0; -#X array fft-real 4096 float 0; -#X coords 0 1 4096 -1 400 300 1; -#X restore 432 41 graph; -#N canvas 0 0 450 300 graph2 0; -#X array fft-imag 4096 float 0; -#X coords 0 1 4096 -1 400 300 1; -#X restore 419 265 graph; -#X restore 571 515 pd arrays; -#X obj 5 309 s location; -#X obj 123 412 r loop-amp; -#X obj 737 288 f; -#X obj 5 248 r location; -#X msg 5 268 set \$1; -#X obj 777 288 +; -#X obj 737 309 moses 900; -#X msg 695 329 0; -#X msg 694 247 1; -#X msg 736 335 \; location \$1 \; snapshot bang; -#X msg 655 170 bang \; location 0 \; clear-all bang; -#X floatatom 655 305 0 0 0 0 - - -; -#X obj 655 225 t b b; -#X obj 838 270 r incr; -#X obj 8 385 r grain-amp; -#X obj 121 473 r osc-amp; -#X obj 143 553 catch~ osc-sum; -#N canvas 102 67 751 619 osc-bank 0; -#X obj 311 433 osc-voice; -#X obj 290 451 osc-voice; -#X obj 269 471 osc-voice; -#X obj 248 490 osc-voice; -#X obj 227 510 osc-voice; -#X obj 207 528 osc-voice; -#X obj 186 547 osc-voice; -#X obj 165 566 osc-voice; -#X obj 144 586 osc-voice; -#X obj 123 410 route 1 2 3 4 5 6 7 8 9 10; -#X msg 377 269 0; -#X obj 728 489 pointer; -#X floatatom 848 417 0 0 0 0 - - -; -#X obj 623 351 pointer; -#X msg 549 491 next; -#X floatatom 623 419 0 0 0 0 - - -; -#X obj 231 111 pointer; -#X floatatom 368 104 0 0 0 0 - - -; -#X floatatom 309 129 0 0 0 0 - - -; -#X msg 218 88 bang; -#X floatatom 120 40 0 0 0 0 - - -; -#X floatatom 53 88 0 0 0 0 - - -; -#X floatatom 165 169 0 0 0 0 - - -; -#X floatatom 546 137 0 0 0 0 - - -; -#X floatatom 368 69 0 0 0 0 - - -; -#X floatatom 680 90 0 0 0 0 - - -; -#X obj 552 43 pointer; -#X msg 581 27 next; -#X floatatom 545 92 0 0 0 0 - - -; -#X obj 546 120 getsize trace-template bazoo; -#X obj 140 142 get point-template y; -#X obj 53 113 set point-template y; -#X obj 113 66 element trace-template bazoo; -#X obj 309 159 setsize trace-template bazoo; -#X obj 368 86 set trace-template x; -#X obj 368 121 set trace-template y; -#X obj 532 68 get trace-template x y; -#X floatatom 524 312 0 0 0 0 - - -; -#X msg 524 288 1; -#X msg 564 288 0; -#X obj 623 451 <; -#X obj 623 398 get trace-template x voiceno; -#X obj 623 374 t p p; -#X obj 393 337 until; -#X obj 620 233 r start-resynth; -#X obj 625 255 t b b; -#X obj 504 353 f; -#X obj 504 372 sel 0 1; -#X obj 668 436 r synth-index; -#X obj 621 555 pack f p; -#X obj 623 470 sel 0 1; -#X obj 305 230 r step-resynth; -#X obj 378 288 f; -#X obj 378 308 s synth-index; -#X obj 636 523 f; -#X obj 419 289 + 5; -#X obj 621 490 t b b b; -#X obj 305 252 t b b b; -#X obj 281 301 s osc-tick; -#X obj 123 604 osc-voice; -#X msg 552 10 traverse pd-trace-list \, next; -#X msg 621 288 traverse pd-trace-list \, next; -#X connect 9 0 59 0; -#X connect 9 1 8 0; -#X connect 9 2 7 0; -#X connect 9 3 6 0; -#X connect 9 4 5 0; -#X connect 9 5 4 0; -#X connect 9 6 3 0; -#X connect 9 7 2 0; -#X connect 9 8 1 0; -#X connect 9 9 0 0; -#X connect 10 0 52 0; -#X connect 11 0 49 1; -#X connect 13 0 42 0; -#X connect 13 1 39 0; -#X connect 13 1 43 1; -#X connect 14 0 13 0; -#X connect 15 0 40 0; -#X connect 16 0 30 0; -#X connect 17 0 35 0; -#X connect 18 0 33 0; -#X connect 19 0 16 0; -#X connect 20 0 32 0; -#X connect 21 0 31 0; -#X connect 24 0 34 0; -#X connect 26 0 33 1; -#X connect 26 0 34 1; -#X connect 26 0 35 1; -#X connect 26 0 32 1; -#X connect 26 0 36 0; -#X connect 26 0 29 0; -#X connect 27 0 26 0; -#X connect 29 0 23 0; -#X connect 30 0 22 0; -#X connect 32 0 16 0; -#X connect 32 0 31 1; -#X connect 36 0 28 0; -#X connect 36 1 25 0; -#X connect 37 0 46 1; -#X connect 38 0 37 0; -#X connect 39 0 37 0; -#X connect 40 0 50 0; -#X connect 41 0 15 0; -#X connect 41 1 54 1; -#X connect 42 0 41 0; -#X connect 42 1 11 1; -#X connect 43 0 46 0; -#X connect 44 0 45 0; -#X connect 45 0 61 0; -#X connect 45 1 38 0; -#X connect 45 1 10 0; -#X connect 46 0 47 0; -#X connect 47 0 43 1; -#X connect 47 1 15 0; -#X connect 48 0 40 1; -#X connect 49 0 9 0; -#X connect 50 0 43 1; -#X connect 50 1 56 0; -#X connect 51 0 57 0; -#X connect 52 0 53 0; -#X connect 52 0 55 0; -#X connect 54 0 49 0; -#X connect 55 0 52 1; -#X connect 56 0 14 0; -#X connect 56 1 54 0; -#X connect 56 2 11 0; -#X connect 57 0 58 0; -#X connect 57 1 43 0; -#X connect 57 2 52 0; -#X connect 60 0 26 0; -#X connect 61 0 13 0; -#X restore 571 494 pd osc-bank; -#X obj 646 95 s grain-amp; -#N canvas 31 70 662 326 save-list 0; -#X floatatom 759 255 0 0 0 0 - - -; -#X floatatom 677 254 0 0 0 0 - - -; -#X floatatom 599 251 0 0 0 0 - - -; -#X floatatom 517 250 0 0 0 0 - - -; -#X obj 435 206 pointer; -#X obj 307 121 pointer; -#X msg 328 47 bang; -#X obj 152 200 rmstodb; -#X obj 10 201 * 0.1; -#X obj 151 220 * -3; -#X floatatom 445 247 0 0 0 0 - - -; -#X obj 304 27 r start-analysis; -#X obj 305 71 t b b; -#X msg 456 185 next; -#X obj 430 227 get peak-template x y amp ampreal ampimag; -#X obj 9 241 append peak-template x y amp ampreal ampimag; -#X obj 125 138 r found-peak; -#X obj 126 161 unpack 0 0 0 0 0; -#X msg 81 201 330; -#X msg 356 69 \; pd-peak-list clear; -#X msg 305 100 traverse pd-peak-list \, bang; -#X msg 437 166 traverse pd-peak-list \, next; -#X connect 4 0 14 0; -#X connect 5 0 15 5; -#X connect 6 0 12 0; -#X connect 7 0 9 0; -#X connect 8 0 15 0; -#X connect 9 0 15 2; -#X connect 11 0 12 0; -#X connect 12 0 20 0; -#X connect 12 1 19 0; -#X connect 13 0 4 0; -#X connect 14 0 10 0; -#X connect 14 1 3 0; -#X connect 14 2 2 0; -#X connect 14 3 1 0; -#X connect 14 4 0 0; -#X connect 16 0 17 0; -#X connect 17 1 8 0; -#X connect 17 2 18 0; -#X connect 17 2 7 0; -#X connect 17 3 15 3; -#X connect 17 4 15 4; -#X connect 18 0 15 1; -#X connect 20 0 5 0; -#X connect 21 0 4 0; -#X restore 351 431 pd save-list; -#X msg 9 114 \; pd dsp 1 \; window-size 2048 \; sample-rate 44100 \; -f-threshold 40 \; incr 10 \; clear-all bang; -#X obj 737 245 metro 150; -#X floatatom 315 309 0 0 0 0 - - -; -#X floatatom 377 309 0 0 0 0 - - -; -#X msg 139 349 \; start-resynth bang; -#X msg 315 350 \; step-resynth bang; -#X obj 315 329 metro 100; -#X msg 478 350 \; osc-stop bang; -#X text 790 113 resynth; -#X text 642 112 analyzed grains; -#X text 554 112 original; -#X text 653 151 ... and here third to analyze; -#N canvas 0 0 276 216 test 0; -#X floatatom 56 120 0 0 0 0 - - -; -#X obj 56 141 s loud; -#X msg 49 84 \; clear-all bang; -#X msg 51 52 \; snapshot bang; -#X connect 0 0 1 0; -#X restore 569 538 pd test; -#X text 317 140 read a sample; -#X msg 214 163 \; read-sample ../sound/bell.aiff 44100; -#N canvas 190 43 405 461 test-signal 0; -#X obj 174 293 tabread4~ sample; -#X obj 174 268 line~; -#X obj 123 146 f; -#X obj 330 46 r insamprate; -#X obj 177 350 *~; -#X obj 213 351 dbtorms; -#X obj 213 328 inlet; -#X obj 175 415 outlet~; -#X obj 190 33 r insamplength; -#X msg 174 247 0 \, \$1 \$2; -#X obj 174 221 pack 0 0; -#X obj 272 190 /; -#X obj 389 99 * 0.001; -#X obj 175 388 hip~ 5; -#X obj 43 5 loadbang; -#X text 315 13 sample playback; -#X msg 43 25 1; -#X obj 43 69 metro 1000; -#X floatatom 43 48 0 0 0 0 - - -; -#X obj 331 75 t b b f; -#X obj 209 84 t b f; -#X connect 0 0 4 0; -#X connect 1 0 0 0; -#X connect 2 0 10 0; -#X connect 3 0 19 0; -#X connect 4 0 13 0; -#X connect 5 0 4 1; -#X connect 6 0 5 0; -#X connect 8 0 20 0; -#X connect 9 0 1 0; -#X connect 10 0 9 0; -#X connect 11 0 10 1; -#X connect 11 0 17 1; -#X connect 12 0 11 1; -#X connect 13 0 7 0; -#X connect 14 0 16 0; -#X connect 16 0 18 0; -#X connect 17 0 2 0; -#X connect 18 0 17 0; -#X connect 19 0 16 0; -#X connect 19 1 11 0; -#X connect 19 2 12 0; -#X connect 20 0 16 0; -#X connect 20 1 11 0; -#X connect 20 1 2 1; -#X restore 125 436 pd test-signal; -#N canvas 132 255 634 331 insample 0; -#N canvas 0 0 450 300 graph1 0; -#X array sample 155948 float 0; -#X coords 0 1 155947 -1 400 150 1; -#X restore 259 18 graph; -#X obj 25 70 r read-sample; -#X obj 25 95 unpack s f; -#X obj 69 121 s insamprate; -#X obj 25 171 soundfiler; -#X msg 25 147 read -resize \$1 sample; -#X obj 25 201 s insamplength; -#X msg 464 197 \; sample resize 220500 \; insamplength 220500; -#X connect 1 0 2 0; -#X connect 2 0 5 0; -#X connect 2 1 3 0; -#X connect 4 0 6 0; -#X connect 5 0 4 0; -#X restore 569 559 pd insample; -#X obj 744 553 tabwrite~ sample; -#X text 152 0 SINUSOID TRACKING; -#X text 129 259 to resynthesize \, "start" once and "step" ad lib. -To stop \, stop stepping and hit osc-stop. Note resynth ampliture control -above.; -#X text 4 17 This patch tries to reconstruct sinusoidal "tracks" from -a sampled sound using pique~ and the data structure facilities. It -turns out to be quite hard \, not least because pique~ 0.1 puts out -all sorts of spurious peaks.; -#X msg 213 200 \; read-sample ../sound/voice.wav 44100; -#X obj 847 194 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 --1; -#X connect 0 0 2 0; -#X connect 1 0 0 0; -#X connect 3 0 4 0; -#X connect 4 0 6 0; -#X connect 5 0 3 0; -#X connect 6 0 28 0; -#X connect 7 0 60 1; -#X connect 8 0 41 1; -#X connect 9 0 60 0; -#X connect 10 0 44 1; -#X connect 11 0 57 0; -#X connect 12 0 11 0; -#X connect 19 0 76 0; -#X connect 20 0 21 0; -#X connect 21 0 27 0; -#X connect 22 0 20 0; -#X connect 23 0 31 0; -#X connect 25 0 23 0; -#X connect 26 0 27 1; -#X connect 27 0 28 0; -#X connect 28 0 29 0; -#X connect 28 0 29 1; -#X connect 30 0 76 0; -#X connect 32 0 24 0; -#X connect 37 0 39 0; -#X connect 40 0 74 0; -#X connect 41 0 44 0; -#X connect 41 0 45 0; -#X connect 41 0 50 0; -#X connect 42 0 43 0; -#X connect 43 0 37 0; -#X connect 44 0 41 1; -#X connect 45 0 48 0; -#X connect 45 1 46 0; -#X connect 46 0 9 0; -#X connect 47 0 9 0; -#X connect 49 0 51 0; -#X connect 51 0 47 0; -#X connect 51 1 8 0; -#X connect 52 0 10 0; -#X connect 53 0 22 0; -#X connect 54 0 5 0; -#X connect 55 0 6 1; -#X connect 60 0 41 0; -#X connect 61 0 65 0; -#X connect 62 0 65 1; -#X connect 65 0 64 0; -#X connect 74 0 28 0; -#X connect 81 0 41 0; diff --git a/pd/doc/5.reference/help-intro.pd b/pd/doc/5.reference/help-intro.pd index 23952ba8..10ae3502 100644 --- a/pd/doc/5.reference/help-intro.pd +++ b/pd/doc/5.reference/help-intro.pd @@ -243,8 +243,7 @@ to a note-on; #X obj 18 3558 rzero~; #X text 118 3558 - raw real-valued one-zero filter; #X obj 18 3588 rzero_rev~; -#X obj 113 3588 rzero~; -#X text 166 3588 - time-reversed; +#X text 121 3588 - time-reversed; #X obj 18 3618 cpole~; #X obj 77 3618 czero~; #X text 214 3618 - corresponding complex-valued filters; diff --git a/pd/doc/5.reference/my_canvas-help.pd b/pd/doc/5.reference/my_canvas-help.pd index decda628..65f9976f 100644 --- a/pd/doc/5.reference/my_canvas-help.pd +++ b/pd/doc/5.reference/my_canvas-help.pd @@ -1,25 +1,25 @@ -#N canvas 482 81 568 339 10; -#X obj 1 1 cnv 15 300 60 foo10_snd foo10_rcv my_canvas=cnv 63 37 192 +#N canvas 0 22 500 292 10; +#X obj 1 1 cnv 15 300 60 foo10_snd foo10_rcv my_canvas=cnv 63 37 0 17 -257472 -355 0; #X text 4 232 (c) musil@iem.kug.ac.at; #X text 46 245 IEM KUG; #N canvas 219 100 699 530 edit 0; #X obj 39 226 f; #X msg 17 205 bang; -#X floatatom 55 204 3 63 88; -#X floatatom 90 226 3 0 37; +#X floatatom 55 204 3 63 88 0 - - -; +#X floatatom 90 226 3 0 37 0 - - -; #X obj 39 249 pack 0 0; #X text 117 226 y-label; #X text 83 204 x-label; #X obj 297 281 f; #X msg 275 260 bang; -#X floatatom 313 259 3 -10 10; -#X floatatom 348 281 3 -10 10; +#X floatatom 313 259 3 -10 10 0 - - -; +#X floatatom 348 281 3 -10 10 0 - - -; #X obj 297 304 pack 0 0; #X obj 309 396 f; #X msg 287 375 bang; -#X floatatom 325 374 3 20 60; -#X floatatom 360 396 3 150 200; +#X floatatom 325 374 3 20 60 0 - - -; +#X floatatom 360 396 3 150 200 0 - - -; #X obj 309 419 pack 0 0; #X text 341 259 x-delta; #X text 375 281 y-delta; @@ -27,12 +27,12 @@ #X text 387 396 y-position; #X obj 59 341 f; #X msg 37 320 bang; -#X floatatom 75 319 3 0 2; -#X floatatom 110 341 3 4 36; +#X floatatom 75 319 3 0 2 0 - - -; +#X floatatom 110 341 3 4 36 0 - - -; #X obj 59 364 pack 0 0; #X text 103 319 font; #X text 139 341 height; -#X floatatom 275 183 3 2 20; +#X floatatom 275 183 3 2 20 0 - - -; #X msg 52 137 \; foo10_rcv color \$1 \$2; #X msg 39 274 \; foo10_rcv label_pos \$1 \$2; #X msg 59 390 \; foo10_rcv label_font \$1 \$2; @@ -42,8 +42,8 @@ #X msg 297 329 \; foo10_rcv delta \$1 \$2; #X obj 505 234 f; #X msg 483 213 bang; -#X floatatom 521 212 5 100 1000; -#X floatatom 556 234 4 50 500; +#X floatatom 521 212 5 100 1000 0 - - -; +#X floatatom 556 234 4 50 500 0 - - -; #X obj 505 257 pack 0 0; #X text 566 212 width; #X text 594 236 height; @@ -57,14 +57,14 @@ #X msg 509 372 \; foo10_rcv get_pos; #X obj 510 407 r foo10_snd; #X obj 510 428 unpack 0 0; -#X floatatom 510 453 4 0 0; -#X floatatom 575 452 4 0 0; +#X floatatom 510 453 4 0 0 0 - - -; +#X floatatom 575 452 4 0 0 0 - - -; #X text 490 452 x=; #X text 557 452 y=; #X obj 52 79 f; #X msg 29 31 bang; -#X floatatom 68 29 3 0 29; -#X floatatom 103 47 3 0 29; +#X floatatom 68 29 3 0 29 0 - - -; +#X floatatom 103 47 3 0 29 0 - - -; #X text 96 29 background; #X text 131 48 label-color; #X msg 290 25 back; @@ -137,9 +137,9 @@ #X connect 30 1 23 0; #X connect 30 2 28 0; #X restore 290 86 pd RGB_____________; -#X floatatom 332 55 3 0 255; -#X floatatom 375 55 3 0 255; -#X floatatom 418 56 3 0 255; +#X floatatom 332 55 3 0 255 0 - - -; +#X floatatom 375 55 3 0 255 0 - - -; +#X floatatom 418 56 3 0 255 0 - - -; #X text 39 3 preset-colors; #X text 301 0 RGB-colors; #X text 332 37 red; @@ -188,22 +188,22 @@ #X connect 68 0 66 2; #X connect 69 0 66 3; #X connect 75 0 29 0; -#X restore 305 20 pd edit; -#X floatatom 110 193 4 0 0; -#X floatatom 147 193 4 0 0; +#X restore 315 20 pd edit; +#X floatatom 110 193 4 0 0 0 - - -; +#X floatatom 147 193 4 0 0 0 - - -; #X text 121 209 x; #X text 158 209 y; #X obj 7 161 metro 100; #X obj 33 141 tgl 15 1 empty empty empty 20 8 0 10 -262144 -1 -1 1 1; #X obj 110 145 r from_K1; -#X floatatom 188 194 4 0 0; -#X floatatom 225 194 4 0 0; +#X floatatom 188 194 4 0 0 0 - - -; +#X floatatom 225 194 4 0 0 0 - - -; #X text 198 210 x; #X text 236 210 y; #X obj 188 146 r from_K2; #X msg 7 185 \; to_K get_pos; -#N canvas 0 296 395 395 room 1; +#N canvas 0 296 395 395 room 0; #X obj 1 1 cnv 1 400 400 empty empty type...ctrl+e 150 140 2 17 -33289 -24198 0; #X obj 15 16 cnv 1 1 360 empty empty move_K1_and_K2 115 160 2 17 -166441 @@ -214,9 +214,9 @@ 0; #X obj 17 375 cnv 1 358 1 empty empty empty 20 12 2 20 -99865 -66577 0; -#X obj 23 22 cnv 25 25 25 from_K1 to_K K1 1 13 194 14 -261681 -123526 +#X obj 23 22 cnv 25 25 25 from_K1 to_K K1 1 13 2 14 -261681 -123526 0; -#X obj 342 342 cnv 25 25 25 from_K2 to_K K2 1 13 194 14 -225280 -1109 +#X obj 342 342 cnv 25 25 25 from_K2 to_K K2 1 13 2 14 -225280 -1109 0; #X restore 307 147 pd room; #X obj 110 169 unpack; @@ -229,9 +229,26 @@ #X text 5 64 click the properties-dialog on the top-left corner; #X obj 361 195 r foo10_rcv; #X obj 403 215 s ggg; -#X text 172 257 updated for Pd version 0.35; #X text 21 257 graz \, austria 2002; #X obj 187 236 x_all_guis aaa bbb ccc ddd eee fff ggg hhh iii; +#X text 313 46 For cnv's creation arguments:; +#N canvas 881 440 467 369 canvas-creation-arguments 0; +#X msg 7 12 canvas: cnv selectableSize xSize ySize sendName recieveName +Label labelXOff labelYOff Font# fontSize bgColor lblColor 0; +#X text 9 169 For example \, a canvas called thusly:; +#X obj 9 248 cnv 15 200 100 myCanvas myCanvasR Canvas_Demo 20 12 2 +14 -62784 -195568 0; +#X text 9 226 will result in this:; +#X text 8 59 Canvas can be called with 13 creation arguments. These +are not "optional" - all parameters must be filled or the canvas will +not instantiate correctly.; +#X text 10 114 The function of the final "0" is unknown to me (it is +found in the textual entry for a canvas object in a .pd file) but can +be safely left off without ill effects.; +#X msg 9 191 cnv 15 200 100 myCanvas myCanvasR Canvas_Demo 20 12 2 +14 18 20; +#X restore 314 63 pd canvas-creation-arguments; +#X text 172 257 updated for Pd version 0.35; #X connect 8 0 16 0; #X connect 9 0 8 0; #X connect 10 0 18 0; diff --git a/pd/extra/expr~/makefile b/pd/extra/expr~/makefile index 4889afe5..2d74ba36 100644 --- a/pd/extra/expr~/makefile +++ b/pd/extra/expr~/makefile @@ -14,16 +14,17 @@ pd_nt: expr.dll NTOBJ = vexp.obj vexp_fun.obj vexp_if.obj -PDNTCFLAGS = /W3 /WX /DNT /DPD /nologo -VC="C:\Program Files\Microsoft Visual Studio\Vc98" +PDNTCFLAGS = /W3 /DNT /DPD /nologo +VC = "C:\Program Files\Microsoft Visual Studio 9.0\VC" +VSTK = "C:\Program Files\Microsoft SDKs\Windows\v6.0A" PDNTINCLUDE = /I. /I..\..\src /I$(VC)\include PDNTLDIR = $(VC)\lib -PDNTLIB = $(PDNTLDIR)\libc.lib \ - $(PDNTLDIR)\oldnames.lib \ - $(PDNTLDIR)\kernel32.lib \ - ..\..\bin\pd.lib +PDNTLIB = /NODEFAULTLIB:libcmt /NODEFAULTLIB:oldnames /NODEFAULTLIB:kernel32 \ + $(PDNTLDIR)\libcmt.lib $(PDNTLDIR)\oldnames.lib \ + $(VSTK)\lib\kernel32.lib \ + ..\..\bin\pd.lib .c.obj: cl $(PDNTCFLAGS) $(PDNTINCLUDE) /c $*.c diff --git a/pd/extra/makefile b/pd/extra/makefile index 56e59bed..944475a1 100644 --- a/pd/extra/makefile +++ b/pd/extra/makefile @@ -7,19 +7,21 @@ pd_nt: $(NAME).dll .SUFFIXES: .dll PDNTCFLAGS = /W3 /WX /DNT /DPD /nologo -VC="C:\Program Files\Microsoft Visual Studio\Vc98" +# VC="C:\Program Files\Microsoft Visual Studio\Vc98" +VC = "C:\Program Files\Microsoft Visual Studio 9.0\VC" +VSTK = "C:\Program Files\Microsoft SDKs\Windows\v6.0A" PDNTINCLUDE = /I. /I..\..\src /I$(VC)\include PDNTLDIR = $(VC)\lib -PDNTLIB = $(PDNTLDIR)\libc.lib \ - $(PDNTLDIR)\oldnames.lib \ - $(PDNTLDIR)\kernel32.lib \ - ..\..\bin\pd.lib +PDNTLIB = /NODEFAULTLIB:libcmt /NODEFAULTLIB:oldnames /NODEFAULTLIB:kernel32 \ + $(PDNTLDIR)\libcmt.lib $(PDNTLDIR)\oldnames.lib \ + $(VSTK)\lib\kernel32.lib \ + ..\..\bin\pd.lib .c.dll: cl $(PDNTCFLAGS) $(PDNTINCLUDE) /c $*.c - link /dll /export:$(CSYM)_setup $*.obj $(PDNTLIB) + link /nologo /dll /export:$(CSYM)_setup $*.obj $(PDNTLIB) # ----------------------- IRIX 5.x ----------------------- diff --git a/pd/extra/sigmund~/sigmund~-help.pd b/pd/extra/sigmund~/sigmund~-help.pd index c60ca9a8..9b3e1caa 100644 --- a/pd/extra/sigmund~/sigmund~-help.pd +++ b/pd/extra/sigmund~/sigmund~-help.pd @@ -48,7 +48,6 @@ outputs are meaningful.; #X text 13 28 Sigmund~ analyzes an incoming sound into sinusoidal components \, which may be reported individually or combined to form a pitch estimate. Possible outputs are specified as creation arguments:; -#X text 55 129 env - output pitches at the beginning of notes; #X text 56 95 pitch - output pitch continuously; #N canvas 518 74 588 728 setting-parameters 0; #X msg 182 66 print; @@ -91,7 +90,7 @@ of a note at or near the previously output pitch.; #X connect 1 0 2 0; #X connect 2 0 3 0; #X restore 330 531 pd setting-parameters; -#N canvas 149 65 641 815 sinusoid-tracking 1; +#N canvas 149 65 641 815 sinusoid-tracking 0; #X obj 124 267 sigmund~ -npeak 10 peaks; #X obj 124 214 phasor~; #X obj 124 144 loadbang; @@ -127,7 +126,7 @@ claw them apart). The other four are as shown:; #X floatatom 245 760 5 0 0 0 - - -; #X floatatom 285 737 5 0 0 0 - - -; #X floatatom 326 713 5 0 0 0 - - -; -#X obj 246 638 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 1 +#X obj 246 638 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 0 1; #X text 43 535 If you ask for "tracks" \, the output is four numbers: index \, frequency \, and amplitude as before \, and finally a flag @@ -178,17 +177,18 @@ for an empty track.; #X text 62 335 growth - growth (dB) to report a new note (7); #X text 54 147 peaks - output all sinusoidal peaks in order of amplitude ; -#X text 380 596 updated for Pd v0.40; #X text 11 356 The npts and hop parameters are in samples \, and are powers of two. The example below specifies a huge hop of 4096 (to slow the output down) and to output "pitch" and "env". (Those are the default outputs.); #X text 61 260 maxfreq - maximum sinusoid frequency in Hz. (1000000) ; -#X connect 2 0 25 0; +#X text 55 128 env - output amplitude continuously; +#X text 380 596 updated for Pd v0.41; +#X connect 2 0 24 0; #X connect 3 0 8 0; #X connect 4 0 7 0; #X connect 7 0 2 0; #X connect 8 0 4 0; -#X connect 25 0 5 0; -#X connect 25 1 6 0; +#X connect 24 0 5 0; +#X connect 24 1 6 0; diff --git a/pd/portaudio/include/pa_asio.h b/pd/portaudio/include/pa_asio.h index 211922a6..ca808727 100644 --- a/pd/portaudio/include/pa_asio.h +++ b/pd/portaudio/include/pa_asio.h @@ -1,7 +1,7 @@ #ifndef PA_ASIO_H #define PA_ASIO_H /* - * $Id: pa_asio.h,v 1.2 2007-12-28 03:28:29 millerpuckette Exp $ + * $Id: pa_asio.h,v 1.3 2007-12-28 03:43:01 millerpuckette Exp $ * PortAudio Portable Real-Time Audio Library * ASIO specific extensions * diff --git a/pd/portaudio/include/pa_linux_alsa.h b/pd/portaudio/include/pa_linux_alsa.h index 1789d915..90488a3c 100644 --- a/pd/portaudio/include/pa_linux_alsa.h +++ b/pd/portaudio/include/pa_linux_alsa.h @@ -2,7 +2,7 @@ #define PA_LINUX_ALSA_H /* - * $Id: pa_linux_alsa.h,v 1.2 2007-12-28 03:28:29 millerpuckette Exp $ + * $Id: pa_linux_alsa.h,v 1.3 2007-12-28 03:43:01 millerpuckette Exp $ * PortAudio Portable Real-Time Audio Library * ALSA-specific extensions * diff --git a/pd/portaudio/include/pa_win_wmme.h b/pd/portaudio/include/pa_win_wmme.h index a343afc9..0153391a 100644 --- a/pd/portaudio/include/pa_win_wmme.h +++ b/pd/portaudio/include/pa_win_wmme.h @@ -1,7 +1,7 @@ #ifndef PA_WIN_WMME_H #define PA_WIN_WMME_H /* - * $Id: pa_win_wmme.h,v 1.2 2007-12-28 03:28:29 millerpuckette Exp $ + * $Id: pa_win_wmme.h,v 1.3 2007-12-28 03:43:01 millerpuckette Exp $ * PortAudio Portable Real-Time Audio Library * MME specific extensions * diff --git a/pd/portaudio/include/portaudio.h b/pd/portaudio/include/portaudio.h index 80d2f6aa..02ed79d5 100644 --- a/pd/portaudio/include/portaudio.h +++ b/pd/portaudio/include/portaudio.h @@ -2,7 +2,7 @@ #ifndef PORTAUDIO_H #define PORTAUDIO_H /* - * $Id: portaudio.h,v 1.2 2007-12-28 03:28:29 millerpuckette Exp $ + * $Id: portaudio.h,v 1.3 2007-12-28 03:43:01 millerpuckette Exp $ * PortAudio Portable Real-Time Audio Library * PortAudio API Header File * Latest version available at: http://www.portaudio.com/ diff --git a/pd/portaudio/src/common/pa_allocation.c b/pd/portaudio/src/common/pa_allocation.c index c7551af0..7f5dfff6 100644 --- a/pd/portaudio/src/common/pa_allocation.c +++ b/pd/portaudio/src/common/pa_allocation.c @@ -1,5 +1,5 @@ /* - * $Id: pa_allocation.c,v 1.2 2007-12-28 03:28:30 millerpuckette Exp $ + * $Id: pa_allocation.c,v 1.3 2007-12-28 03:43:01 millerpuckette Exp $ * Portable Audio I/O Library allocation group implementation * memory allocation group for tracking allocation groups * diff --git a/pd/portaudio/src/common/pa_allocation.h b/pd/portaudio/src/common/pa_allocation.h index bf851531..dc99f71f 100644 --- a/pd/portaudio/src/common/pa_allocation.h +++ b/pd/portaudio/src/common/pa_allocation.h @@ -1,7 +1,7 @@ #ifndef PA_ALLOCATION_H #define PA_ALLOCATION_H /* - * $Id: pa_allocation.h,v 1.2 2007-12-28 03:28:30 millerpuckette Exp $ + * $Id: pa_allocation.h,v 1.3 2007-12-28 03:43:01 millerpuckette Exp $ * Portable Audio I/O Library allocation context header * memory allocation context for tracking allocation groups * diff --git a/pd/portaudio/src/common/pa_converters.c b/pd/portaudio/src/common/pa_converters.c index 02908eb9..5ca75c40 100644 --- a/pd/portaudio/src/common/pa_converters.c +++ b/pd/portaudio/src/common/pa_converters.c @@ -1,5 +1,5 @@ /* - * $Id: pa_converters.c,v 1.2 2007-12-28 03:28:30 millerpuckette Exp $ + * $Id: pa_converters.c,v 1.3 2007-12-28 03:43:01 millerpuckette Exp $ * Portable Audio I/O Library sample conversion mechanism * * Based on the Open Source API proposed by Ross Bencina diff --git a/pd/portaudio/src/common/pa_converters.h b/pd/portaudio/src/common/pa_converters.h index c2119fc5..7227f54b 100644 --- a/pd/portaudio/src/common/pa_converters.h +++ b/pd/portaudio/src/common/pa_converters.h @@ -1,7 +1,7 @@ #ifndef PA_CONVERTERS_H #define PA_CONVERTERS_H /* - * $Id: pa_converters.h,v 1.2 2007-12-28 03:28:30 millerpuckette Exp $ + * $Id: pa_converters.h,v 1.3 2007-12-28 03:43:01 millerpuckette Exp $ * Portable Audio I/O Library sample conversion mechanism * * Based on the Open Source API proposed by Ross Bencina diff --git a/pd/portaudio/src/common/pa_cpuload.c b/pd/portaudio/src/common/pa_cpuload.c index 0801754a..96e329db 100644 --- a/pd/portaudio/src/common/pa_cpuload.c +++ b/pd/portaudio/src/common/pa_cpuload.c @@ -1,5 +1,5 @@ /* - * $Id: pa_cpuload.c,v 1.2 2007-12-28 03:28:30 millerpuckette Exp $ + * $Id: pa_cpuload.c,v 1.3 2007-12-28 03:43:01 millerpuckette Exp $ * Portable Audio I/O Library CPU Load measurement functions * Portable CPU load measurement facility. * diff --git a/pd/portaudio/src/common/pa_cpuload.h b/pd/portaudio/src/common/pa_cpuload.h index 8e0ecb66..d9ef8ee5 100644 --- a/pd/portaudio/src/common/pa_cpuload.h +++ b/pd/portaudio/src/common/pa_cpuload.h @@ -1,7 +1,7 @@ #ifndef PA_CPULOAD_H #define PA_CPULOAD_H /* - * $Id: pa_cpuload.h,v 1.2 2007-12-28 03:28:30 millerpuckette Exp $ + * $Id: pa_cpuload.h,v 1.3 2007-12-28 03:43:01 millerpuckette Exp $ * Portable Audio I/O Library CPU Load measurement functions * Portable CPU load measurement facility. * diff --git a/pd/portaudio/src/common/pa_debugprint.c b/pd/portaudio/src/common/pa_debugprint.c index 2b36030b..7a12cd39 100644 --- a/pd/portaudio/src/common/pa_debugprint.c +++ b/pd/portaudio/src/common/pa_debugprint.c @@ -1,5 +1,5 @@ /*
- * $Id: pa_debugprint.c,v 1.2 2007-12-28 03:28:30 millerpuckette Exp $
+ * $Id: pa_debugprint.c,v 1.3 2007-12-28 03:43:01 millerpuckette Exp $
* Portable Audio I/O Library Multi-Host API front end
* Validate function parameters and manage multiple host APIs.
*
diff --git a/pd/portaudio/src/common/pa_dither.c b/pd/portaudio/src/common/pa_dither.c index a9b4ea3d..0f71b3c9 100644 --- a/pd/portaudio/src/common/pa_dither.c +++ b/pd/portaudio/src/common/pa_dither.c @@ -1,5 +1,5 @@ /* - * $Id: pa_dither.c,v 1.2 2007-12-28 03:28:30 millerpuckette Exp $ + * $Id: pa_dither.c,v 1.3 2007-12-28 03:43:01 millerpuckette Exp $ * Portable Audio I/O Library triangular dither generator * * Based on the Open Source API proposed by Ross Bencina diff --git a/pd/portaudio/src/common/pa_dither.h b/pd/portaudio/src/common/pa_dither.h index 5244f15e..b2884476 100644 --- a/pd/portaudio/src/common/pa_dither.h +++ b/pd/portaudio/src/common/pa_dither.h @@ -1,7 +1,7 @@ #ifndef PA_DITHER_H #define PA_DITHER_H /* - * $Id: pa_dither.h,v 1.2 2007-12-28 03:28:30 millerpuckette Exp $ + * $Id: pa_dither.h,v 1.3 2007-12-28 03:43:01 millerpuckette Exp $ * Portable Audio I/O Library triangular dither generator * * Based on the Open Source API proposed by Ross Bencina diff --git a/pd/portaudio/src/common/pa_endianness.h b/pd/portaudio/src/common/pa_endianness.h index 1ab1a2f3..e5d3f11f 100644 --- a/pd/portaudio/src/common/pa_endianness.h +++ b/pd/portaudio/src/common/pa_endianness.h @@ -1,7 +1,7 @@ #ifndef PA_ENDIANNESS_H #define PA_ENDIANNESS_H /* - * $Id: pa_endianness.h,v 1.2 2007-12-28 03:28:30 millerpuckette Exp $ + * $Id: pa_endianness.h,v 1.3 2007-12-28 03:43:01 millerpuckette Exp $ * Portable Audio I/O Library current platform endianness macros * * Based on the Open Source API proposed by Ross Bencina diff --git a/pd/portaudio/src/common/pa_front.c b/pd/portaudio/src/common/pa_front.c index e1566a80..5f732abc 100644 --- a/pd/portaudio/src/common/pa_front.c +++ b/pd/portaudio/src/common/pa_front.c @@ -1,5 +1,5 @@ /* - * $Id: pa_front.c,v 1.2 2007-12-28 03:28:30 millerpuckette Exp $ + * $Id: pa_front.c,v 1.3 2007-12-28 03:43:01 millerpuckette Exp $ * Portable Audio I/O Library Multi-Host API front end * Validate function parameters and manage multiple host APIs. * diff --git a/pd/portaudio/src/common/pa_hostapi.h b/pd/portaudio/src/common/pa_hostapi.h index 738a516f..cff09b84 100644 --- a/pd/portaudio/src/common/pa_hostapi.h +++ b/pd/portaudio/src/common/pa_hostapi.h @@ -1,7 +1,7 @@ #ifndef PA_HOSTAPI_H #define PA_HOSTAPI_H /* - * $Id: pa_hostapi.h,v 1.2 2007-12-28 03:28:30 millerpuckette Exp $ + * $Id: pa_hostapi.h,v 1.3 2007-12-28 03:43:01 millerpuckette Exp $ * Portable Audio I/O Library * host api representation * diff --git a/pd/portaudio/src/common/pa_process.c b/pd/portaudio/src/common/pa_process.c index df0b405e..6c7a658a 100644 --- a/pd/portaudio/src/common/pa_process.c +++ b/pd/portaudio/src/common/pa_process.c @@ -1,5 +1,5 @@ /* - * $Id: pa_process.c,v 1.2 2007-12-28 03:28:30 millerpuckette Exp $ + * $Id: pa_process.c,v 1.3 2007-12-28 03:43:01 millerpuckette Exp $ * Portable Audio I/O Library * streamCallback <-> host buffer processing adapter * diff --git a/pd/portaudio/src/common/pa_process.h b/pd/portaudio/src/common/pa_process.h index c31f1817..3dadd3db 100644 --- a/pd/portaudio/src/common/pa_process.h +++ b/pd/portaudio/src/common/pa_process.h @@ -1,7 +1,7 @@ #ifndef PA_PROCESS_H #define PA_PROCESS_H /* - * $Id: pa_process.h,v 1.2 2007-12-28 03:28:30 millerpuckette Exp $ + * $Id: pa_process.h,v 1.3 2007-12-28 03:43:01 millerpuckette Exp $ * Portable Audio I/O Library callback buffer processing adapters * * Based on the Open Source API proposed by Ross Bencina diff --git a/pd/portaudio/src/common/pa_ringbuffer.c b/pd/portaudio/src/common/pa_ringbuffer.c index dd9b7ce6..e91e46da 100644 --- a/pd/portaudio/src/common/pa_ringbuffer.c +++ b/pd/portaudio/src/common/pa_ringbuffer.c @@ -1,5 +1,5 @@ /* - * $Id: pa_ringbuffer.c,v 1.2 2007-12-28 03:28:30 millerpuckette Exp $ + * $Id: pa_ringbuffer.c,v 1.3 2007-12-28 03:43:01 millerpuckette Exp $ * Portable Audio I/O Library * Ring Buffer utility. * diff --git a/pd/portaudio/src/common/pa_ringbuffer.h b/pd/portaudio/src/common/pa_ringbuffer.h index fc2f3f6e..854030b2 100644 --- a/pd/portaudio/src/common/pa_ringbuffer.h +++ b/pd/portaudio/src/common/pa_ringbuffer.h @@ -1,7 +1,7 @@ #ifndef PA_RINGBUFFER_H #define PA_RINGBUFFER_H /* - * $Id: pa_ringbuffer.h,v 1.2 2007-12-28 03:28:30 millerpuckette Exp $ + * $Id: pa_ringbuffer.h,v 1.3 2007-12-28 03:43:01 millerpuckette Exp $ * Portable Audio I/O Library * Ring Buffer utility. * diff --git a/pd/portaudio/src/common/pa_skeleton.c b/pd/portaudio/src/common/pa_skeleton.c index 275a2e9a..50757431 100644 --- a/pd/portaudio/src/common/pa_skeleton.c +++ b/pd/portaudio/src/common/pa_skeleton.c @@ -1,5 +1,5 @@ /* - * $Id: pa_skeleton.c,v 1.2 2007-12-28 03:28:30 millerpuckette Exp $ + * $Id: pa_skeleton.c,v 1.3 2007-12-28 03:43:01 millerpuckette Exp $ * Portable Audio I/O Library skeleton implementation * demonstrates how to use the common functions to implement support * for a host API diff --git a/pd/portaudio/src/common/pa_stream.c b/pd/portaudio/src/common/pa_stream.c index 763d8e2c..698b14cf 100644 --- a/pd/portaudio/src/common/pa_stream.c +++ b/pd/portaudio/src/common/pa_stream.c @@ -1,5 +1,5 @@ /* - * $Id: pa_stream.c,v 1.2 2007-12-28 03:28:30 millerpuckette Exp $ + * $Id: pa_stream.c,v 1.3 2007-12-28 03:43:01 millerpuckette Exp $ * Portable Audio I/O Library * * diff --git a/pd/portaudio/src/common/pa_stream.h b/pd/portaudio/src/common/pa_stream.h index d342726b..2c589a3e 100644 --- a/pd/portaudio/src/common/pa_stream.h +++ b/pd/portaudio/src/common/pa_stream.h @@ -1,7 +1,7 @@ #ifndef PA_STREAM_H #define PA_STREAM_H /* - * $Id: pa_stream.h,v 1.2 2007-12-28 03:28:30 millerpuckette Exp $ + * $Id: pa_stream.h,v 1.3 2007-12-28 03:43:01 millerpuckette Exp $ * Portable Audio I/O Library * stream interface * diff --git a/pd/portaudio/src/common/pa_trace.c b/pd/portaudio/src/common/pa_trace.c index c39406eb..0454c48f 100644 --- a/pd/portaudio/src/common/pa_trace.c +++ b/pd/portaudio/src/common/pa_trace.c @@ -1,5 +1,5 @@ /* - * $Id: pa_trace.c,v 1.2 2007-12-28 03:28:30 millerpuckette Exp $ + * $Id: pa_trace.c,v 1.3 2007-12-28 03:43:01 millerpuckette Exp $ * Portable Audio I/O Library Trace Facility * Store trace information in real-time for later printing. * diff --git a/pd/portaudio/src/common/pa_trace.h b/pd/portaudio/src/common/pa_trace.h index ac20eee2..4f656455 100644 --- a/pd/portaudio/src/common/pa_trace.h +++ b/pd/portaudio/src/common/pa_trace.h @@ -1,7 +1,7 @@ #ifndef PA_TRACE_H #define PA_TRACE_H /* - * $Id: pa_trace.h,v 1.2 2007-12-28 03:28:30 millerpuckette Exp $ + * $Id: pa_trace.h,v 1.3 2007-12-28 03:43:01 millerpuckette Exp $ * Portable Audio I/O Library Trace Facility * Store trace information in real-time for later printing. * diff --git a/pd/portaudio/src/common/pa_util.h b/pd/portaudio/src/common/pa_util.h index f2f6d901..fe8effa4 100644 --- a/pd/portaudio/src/common/pa_util.h +++ b/pd/portaudio/src/common/pa_util.h @@ -1,7 +1,7 @@ #ifndef PA_UTIL_H #define PA_UTIL_H /* - * $Id: pa_util.h,v 1.2 2007-12-28 03:28:30 millerpuckette Exp $ + * $Id: pa_util.h,v 1.3 2007-12-28 03:43:01 millerpuckette Exp $ * Portable Audio I/O Library implementation utilities header * common implementation utilities and interfaces * diff --git a/pd/portaudio/src/hostapi/alsa/pa_linux_alsa.c b/pd/portaudio/src/hostapi/alsa/pa_linux_alsa.c index 6c2b2ca3..fc9e957c 100644 --- a/pd/portaudio/src/hostapi/alsa/pa_linux_alsa.c +++ b/pd/portaudio/src/hostapi/alsa/pa_linux_alsa.c @@ -1,5 +1,5 @@ /* - * $Id: pa_linux_alsa.c,v 1.2 2007-12-28 03:28:30 millerpuckette Exp $ + * $Id: pa_linux_alsa.c,v 1.3 2007-12-28 03:43:01 millerpuckette Exp $ * PortAudio Portable Real-Time Audio Library * Latest Version at: http://www.portaudio.com * ALSA implementation by Joshua Haberman and Arve Knudsen diff --git a/pd/portaudio/src/hostapi/asio/pa_asio.cpp b/pd/portaudio/src/hostapi/asio/pa_asio.cpp index e0f22c2d..a3c3888b 100644 --- a/pd/portaudio/src/hostapi/asio/pa_asio.cpp +++ b/pd/portaudio/src/hostapi/asio/pa_asio.cpp @@ -1,5 +1,5 @@ /* - * $Id: pa_asio.cpp,v 1.2 2007-12-28 03:28:30 millerpuckette Exp $ + * $Id: pa_asio.cpp,v 1.3 2007-12-28 03:43:01 millerpuckette Exp $ * Portable Audio I/O Library for ASIO Drivers * * Author: Stephane Letz diff --git a/pd/portaudio/src/hostapi/coreaudio/pa_mac_core_old.c b/pd/portaudio/src/hostapi/coreaudio/pa_mac_core_old.c index f2d85bc2..7967e5ea 100644 --- a/pd/portaudio/src/hostapi/coreaudio/pa_mac_core_old.c +++ b/pd/portaudio/src/hostapi/coreaudio/pa_mac_core_old.c @@ -1,5 +1,5 @@ /* - * $Id: pa_mac_core_old.c,v 1.2 2007-12-28 03:28:30 millerpuckette Exp $ + * $Id: pa_mac_core_old.c,v 1.3 2007-12-28 03:43:01 millerpuckette Exp $ * pa_mac_core.c * Implementation of PortAudio for Mac OS X CoreAudio * diff --git a/pd/portaudio/src/hostapi/jack/pa_jack.c b/pd/portaudio/src/hostapi/jack/pa_jack.c index 05640daa..cd2af072 100644 --- a/pd/portaudio/src/hostapi/jack/pa_jack.c +++ b/pd/portaudio/src/hostapi/jack/pa_jack.c @@ -1,5 +1,5 @@ /* - * $Id: pa_jack.c,v 1.2 2007-12-28 03:28:30 millerpuckette Exp $ + * $Id: pa_jack.c,v 1.3 2007-12-28 03:43:02 millerpuckette Exp $ * PortAudio Portable Real-Time Audio Library * Latest Version at: http://www.portaudio.com * JACK Implementation by Joshua Haberman diff --git a/pd/portaudio/src/hostapi/oss/pa_unix_oss.c b/pd/portaudio/src/hostapi/oss/pa_unix_oss.c index 07bc4987..644506a7 100644 --- a/pd/portaudio/src/hostapi/oss/pa_unix_oss.c +++ b/pd/portaudio/src/hostapi/oss/pa_unix_oss.c @@ -1,5 +1,5 @@ /* - * $Id: pa_unix_oss.c,v 1.2 2007-12-28 03:28:30 millerpuckette Exp $ + * $Id: pa_unix_oss.c,v 1.3 2007-12-28 03:43:02 millerpuckette Exp $ * PortAudio Portable Real-Time Audio Library * Latest Version at: http://www.portaudio.com * OSS implementation by: diff --git a/pd/portaudio/src/hostapi/wmme/pa_win_wmme.c b/pd/portaudio/src/hostapi/wmme/pa_win_wmme.c index 7f4bd6d2..eaec0ea2 100644 --- a/pd/portaudio/src/hostapi/wmme/pa_win_wmme.c +++ b/pd/portaudio/src/hostapi/wmme/pa_win_wmme.c @@ -1,5 +1,5 @@ /* - * $Id: pa_win_wmme.c,v 1.2 2007-12-28 03:28:30 millerpuckette Exp $ + * $Id: pa_win_wmme.c,v 1.3 2007-12-28 03:43:02 millerpuckette Exp $ * pa_win_wmme.c * Implementation of PortAudio for Windows MultiMedia Extensions (WMME) * diff --git a/pd/portaudio/src/os/mac_osx/pa_mac_hostapis.c b/pd/portaudio/src/os/mac_osx/pa_mac_hostapis.c index ca737c25..a75dcc92 100644 --- a/pd/portaudio/src/os/mac_osx/pa_mac_hostapis.c +++ b/pd/portaudio/src/os/mac_osx/pa_mac_hostapis.c @@ -1,5 +1,5 @@ /* - * $Id: pa_mac_hostapis.c,v 1.2 2007-12-28 03:28:30 millerpuckette Exp $ + * $Id: pa_mac_hostapis.c,v 1.3 2007-12-28 03:43:02 millerpuckette Exp $ * Portable Audio I/O Library Macintosh initialization table * * Based on the Open Source API proposed by Ross Bencina diff --git a/pd/portaudio/src/os/unix/pa_unix_hostapis.c b/pd/portaudio/src/os/unix/pa_unix_hostapis.c index bfb028ea..7fe38139 100644 --- a/pd/portaudio/src/os/unix/pa_unix_hostapis.c +++ b/pd/portaudio/src/os/unix/pa_unix_hostapis.c @@ -1,5 +1,5 @@ /* - * $Id: pa_unix_hostapis.c,v 1.2 2007-12-28 03:28:30 millerpuckette Exp $ + * $Id: pa_unix_hostapis.c,v 1.3 2007-12-28 03:43:02 millerpuckette Exp $ * Portable Audio I/O Library UNIX initialization table * * Based on the Open Source API proposed by Ross Bencina diff --git a/pd/portaudio/src/os/unix/pa_unix_util.c b/pd/portaudio/src/os/unix/pa_unix_util.c index cc141465..3f17dbe0 100644 --- a/pd/portaudio/src/os/unix/pa_unix_util.c +++ b/pd/portaudio/src/os/unix/pa_unix_util.c @@ -1,5 +1,5 @@ /* - * $Id: pa_unix_util.c,v 1.2 2007-12-28 03:28:30 millerpuckette Exp $ + * $Id: pa_unix_util.c,v 1.3 2007-12-28 03:43:02 millerpuckette Exp $ * Portable Audio I/O Library * UNIX platform-specific support functions * diff --git a/pd/portaudio/src/os/unix/pa_unix_util.h b/pd/portaudio/src/os/unix/pa_unix_util.h index 52239c3e..86f14a32 100644 --- a/pd/portaudio/src/os/unix/pa_unix_util.h +++ b/pd/portaudio/src/os/unix/pa_unix_util.h @@ -1,5 +1,5 @@ /* - * $Id: pa_unix_util.h,v 1.2 2007-12-28 03:28:30 millerpuckette Exp $ + * $Id: pa_unix_util.h,v 1.3 2007-12-28 03:43:02 millerpuckette Exp $ * Portable Audio I/O Library * UNIX platform-specific support functions * diff --git a/pd/portaudio/src/os/win/pa_win_hostapis.c b/pd/portaudio/src/os/win/pa_win_hostapis.c index 122f309a..2aa02b89 100644 --- a/pd/portaudio/src/os/win/pa_win_hostapis.c +++ b/pd/portaudio/src/os/win/pa_win_hostapis.c @@ -1,5 +1,5 @@ /* - * $Id: pa_win_hostapis.c,v 1.2 2007-12-28 03:28:30 millerpuckette Exp $ + * $Id: pa_win_hostapis.c,v 1.3 2007-12-28 03:43:02 millerpuckette Exp $ * Portable Audio I/O Library Windows initialization table * * Based on the Open Source API proposed by Ross Bencina diff --git a/pd/portaudio/src/os/win/pa_win_util.c b/pd/portaudio/src/os/win/pa_win_util.c index 890fdb41..039eb731 100644 --- a/pd/portaudio/src/os/win/pa_win_util.c +++ b/pd/portaudio/src/os/win/pa_win_util.c @@ -1,5 +1,5 @@ /* - * $Id: pa_win_util.c,v 1.2 2007-12-28 03:28:30 millerpuckette Exp $ + * $Id: pa_win_util.c,v 1.3 2007-12-28 03:43:02 millerpuckette Exp $ * Portable Audio I/O Library * Win32 platform-specific support functions * diff --git a/pd/src/CHANGELOG.txt b/pd/src/CHANGELOG.txt index 6c0dc1e3..9620a7fa 100644 --- a/pd/src/CHANGELOG.txt +++ b/pd/src/CHANGELOG.txt @@ -4,7 +4,10 @@ for original notes on source stype and organization. 0.41.0 -add support for callback-based audio I/O; changes in +add support for callback-based audio I/O +headers & code changed to use t_float or t_sample instead of float (patches +by zmoelnig). + 0.40.0 diff --git a/pd/src/configure.in b/pd/src/configure.in index e328f6aa..bc5d5f7b 100644 --- a/pd/src/configure.in +++ b/pd/src/configure.in @@ -7,6 +7,7 @@ AC_SUBST(portaudio, no) AC_SUBST(portmidi, no) AC_SUBST(binarymode, -m755) AC_SUBST(fftw, no) +AC_SUBST(tk, yes) AC_SUBST(PDLIB) AC_SUBST(CPPFLAGS) AC_SUBST(MORECFLAGS) @@ -21,6 +22,7 @@ AC_SUBST(GUIFLAGS) AC_SUBST(OSNUMBER) AC_SUBST(EXTERNTARGET) AC_SUBST(ASIOSRC) +AC_SUBST(GUISRC) dnl other defaults @@ -42,6 +44,10 @@ AC_ARG_ENABLE(setuid, [ --enable-setuid install as setuid (linux)], setuid=$enableval) AC_ARG_ENABLE(fftw, [ --enable-fftw use FFTW package], fftw=$enableval) +AC_ARG_ENABLE(fat, [ --disable-fat build fat binary on Mac OS X], + fat=$enableval, fat="yes") +AC_ARG_ENABLE(tk, [ --disable-tk build without tcl/tk-GUI], + tk=$enableval) dnl Checks for programs. AC_PROG_CC @@ -77,7 +83,7 @@ AC_CHECK_LIB(ffm, sin,PDLIB="$PDLIB -lffm") dnl Checking for `sin' function in -lm: AC_CHECK_LIB(m, sin,PDLIB="$PDLIB -lm", - echo "math library required" || exit 1) + echo "math library required" || exit 1) dnl Checking for `pthread_create' function in -pthread AC_CHECK_LIB(pthread, pthread_create,PDLIB="$PDLIB -lpthread", @@ -87,7 +93,7 @@ AC_CHECK_LIB(pthread, pthread_create,PDLIB="$PDLIB -lpthread", echo "pthreads required"; exit 1)))) dnl Check for fftw package -if test x$fftw == "xyes"; +if test x$fftw = "xyes"; then AC_CHECK_LIB(fftw, fftw_one,PDLIB="$PDLIB -lfftw", echo "fftw package not found - using built-in FFT"; fftw=no) @@ -96,83 +102,89 @@ fi dnl look for tcl 8.x... do I really have to go through all this!? foundit=no -if test $foundit == "no"; +if test $foundit = "no"; then AC_CHECK_HEADER(tcl.h,foundit=yes,) fi -if test $foundit == "no"; +if test $foundit = "no"; then AC_CHECK_HEADER(tcl8.7/tcl.h, - GUIFLAGS="$GUIFLAGS -I/usr/include/tcl8.7";foundit=yes,) + GUIFLAGS="$GUIFLAGS -I/usr/include/tcl8.7";foundit=yes,) fi -if test $foundit == "no"; +if test $foundit = "no"; then AC_CHECK_HEADER(tcl8.6/tcl.h, - GUIFLAGS="$GUIFLAGS -I/usr/include/tcl8.6";foundit=yes,) + GUIFLAGS="$GUIFLAGS -I/usr/include/tcl8.6";foundit=yes,) fi -if test $foundit == "no"; +if test $foundit = "no"; then AC_CHECK_HEADER(tcl8.5/tcl.h, - GUIFLAGS="$GUIFLAGS -I/usr/include/tcl8.5";foundit=yes,) + GUIFLAGS="$GUIFLAGS -I/usr/include/tcl8.5";foundit=yes,) fi -if test $foundit == "no"; +if test $foundit = "no"; then AC_CHECK_HEADER(tcl8.4/tcl.h, - GUIFLAGS="$GUIFLAGS -I/usr/include/tcl8.4";foundit=yes,) + GUIFLAGS="$GUIFLAGS -I/usr/include/tcl8.4";foundit=yes,) fi -if test $foundit == "no"; +if test $foundit = "no"; then AC_CHECK_HEADER(tcl8.4/tcl.h, - GUIFLAGS="$GUIFLAGS -I/usr/local/include/tcl8.4";foundit=yes,) + GUIFLAGS="$GUIFLAGS -I/usr/local/include/tcl8.4";foundit=yes,) fi -if test $foundit == "no"; +if test $foundit = "no"; then AC_CHECK_HEADER(tcl8.3/tcl.h, - GUIFLAGS="$GUIFLAGS -I/usr/include/tcl8.3";foundit=yes,) + GUIFLAGS="$GUIFLAGS -I/usr/include/tcl8.3";foundit=yes,) fi -if test $foundit == "no"; +if test $foundit = "no"; then AC_CHECK_HEADER(tcl8.2/tcl.h, - GUIFLAGS="$GUIFLAGS -I/usr/include/tcl8.2";foundit=yes,) + GUIFLAGS="$GUIFLAGS -I/usr/include/tcl8.2";foundit=yes,) fi -if test $foundit == "no"; +if test $foundit = "no"; then echo no tcl header found - echo bolding trying without... + echo bolding trying without... # exit -1 fi AC_CHECK_LIB(tcl85, main,, - AC_CHECK_LIB(tcl8.5, main,, + AC_CHECK_LIB(tcl8.5, main,, AC_CHECK_LIB(tcl84, main,, - AC_CHECK_LIB(tcl8.4, main,, - AC_CHECK_LIB(tcl8.3, main,, - AC_CHECK_LIB(tcl8.2, main,, - AC_CHECK_LIB(tcl8.0, main,, + AC_CHECK_LIB(tcl8.4, main,, + AC_CHECK_LIB(tcl8.3, main,, + AC_CHECK_LIB(tcl8.2, main,, + AC_CHECK_LIB(tcl8.0, main,, echo no tcl library found; exit 1))))))) AC_CHECK_LIB(tk85, main,, - AC_CHECK_LIB(tk8.5, main,, + AC_CHECK_LIB(tk8.5, main,, AC_CHECK_LIB(tk84, main,, - AC_CHECK_LIB(tk8.4, main,, - AC_CHECK_LIB(tk8.3, main,, - AC_CHECK_LIB(tk8.2, main,, - AC_CHECK_LIB(tk8.0, main,, + AC_CHECK_LIB(tk8.4, main,, + AC_CHECK_LIB(tk8.3, main,, + AC_CHECK_LIB(tk8.2, main,, + AC_CHECK_LIB(tk8.0, main,, echo no tk library found; exit 1))))))) -if test `uname -s` == Linux; +if test x$tk != "xno"; then +GUISRC="t_main.c t_tkcmd.c" +else +GUISRC= +fi + +if test `uname -s` = Linux; then dnl Ckecking for ALSA echo .................... alsa= $alsa dnl This should be fixed so Pd can use ALSA shared libraries where appropriate. - if test x$alsa == xyes; then - AC_CHECK_LIB(asound,snd_pcm_info,PDLIB="$PDLIB -lasound" ; alsa="yes",alsa="no") + if test x$alsa = xyes; then + AC_CHECK_LIB(asound,snd_pcm_info,PDLIB="$PDLIB -lasound" ; alsa="yes",alsa="no") fi dnl Checking for JACK - if test x$jack == xyes; then + if test x$jack = xyes; then AC_CHECK_LIB(rt,shm_open,LIBS="$LIBS -lrt") AC_CHECK_LIB(jack,jack_set_xrun_callback,LIBS="$LIBS -ljack";jack=xrun,jack=no) AC_CHECK_LIB(jack,jack_set_error_function,LIBS="$LIBS -ljack";jack=yes,jack=no) @@ -184,119 +196,123 @@ dnl This should be fixed so Pd can use ALSA shared libraries where appropriate. fi EXT=pd_linux CPPFLAGS="-DDL_OPEN -DPA_USE_OSS -DUNIX -DUNISTD\ - -DUSEAPI_OSS \ - -fno-strict-aliasing" + -DUSEAPI_OSS \ + -fno-strict-aliasing" SYSSRC="s_midi_oss.c s_audio_oss.c" - if test x$alsa == "xyes"; + if test x$alsa = "xyes"; then - SYSSRC=$SYSSRC" s_audio_alsa.c s_audio_alsamm.c s_midi_alsa.c" - CPPFLAGS=$CPPFLAGS" -DPA_USE_ALSA -DUSEAPI_ALSA" - LDFLAGS=$LDFLAGS" -lasound" + SYSSRC=$SYSSRC" s_audio_alsa.c s_audio_alsamm.c s_midi_alsa.c" + CPPFLAGS=$CPPFLAGS" -DPA_USE_ALSA -DUSEAPI_ALSA" + LDFLAGS=$LDFLAGS" -lasound" fi - if test x$portaudio == "xyes"; + if test x$portaudio = "xyes"; then - CPPFLAGS=$CPPFLAGS" -DUSEAPI_PORTAUDIO -DHAVE_SYS_SOUNDCARD_H \ - -Wno-error \ + CPPFLAGS=$CPPFLAGS" -DUSEAPI_PORTAUDIO -DHAVE_SYS_SOUNDCARD_H \ + -Wno-error \ -I../portaudio/include -I../portaudio/src/common \ - -I../portaudio/src/os/unix/ \ + -I../portaudio/src/os/unix/ \ -I../portmidi/pm_common \ -I../portmidi/pm_linux" - SYSSRC="s_audio_pa.c \ - s_audio_pablio.c \ - s_audio_paring.c \ - ../portaudio/src/common/pa_allocation.c \ - ../portaudio/src/common/pa_converters.c \ - ../portaudio/src/common/pa_cpuload.c \ - ../portaudio/src/common/pa_dither.c \ - ../portaudio/src/common/pa_front.c \ - ../portaudio/src/common/pa_process.c \ - ../portaudio/src/common/pa_skeleton.c \ - ../portaudio/src/common/pa_stream.c \ - ../portaudio/src/common/pa_trace.c \ - ../portaudio/src/common/pa_debugprint.c \ - ../portaudio/src/common/pa_ringbuffer.c \ - ../portaudio/src/os/unix/pa_unix_hostapis.c \ - ../portaudio/src/os/unix/pa_unix_util.c \ - ../portaudio/src/hostapi/oss/pa_unix_oss.c "$SYSSRC - if test x$alsa == "xyes"; - then - SYSSRC="../portaudio/src/hostapi/alsa/pa_linux_alsa.c "$SYSSRC - CPPFLAGS=$CPPFLAGS" -DPA_USE_ALSA" - fi - if test x$jack == "xyes"; - then - SYSSRC="../portaudio/src/hostapi/jack/pa_jack.c "$SYSSRC - CPPFLAGS=$CPPFLAGS" -DPA_USE_JACK" - fi + SYSSRC="s_audio_pa.c \ + s_audio_pablio.c \ + s_audio_paring.c \ + ../portaudio/src/common/pa_allocation.c \ + ../portaudio/src/common/pa_converters.c \ + ../portaudio/src/common/pa_cpuload.c \ + ../portaudio/src/common/pa_dither.c \ + ../portaudio/src/common/pa_front.c \ + ../portaudio/src/common/pa_process.c \ + ../portaudio/src/common/pa_skeleton.c \ + ../portaudio/src/common/pa_stream.c \ + ../portaudio/src/common/pa_trace.c \ + ../portaudio/src/common/pa_debugprint.c \ + ../portaudio/src/common/pa_ringbuffer.c \ + ../portaudio/src/os/unix/pa_unix_hostapis.c \ + ../portaudio/src/os/unix/pa_unix_util.c \ + ../portaudio/src/hostapi/oss/pa_unix_oss.c "$SYSSRC + if test x$alsa = "xyes"; + then + SYSSRC="../portaudio/src/hostapi/alsa/pa_linux_alsa.c "$SYSSRC + CPPFLAGS=$CPPFLAGS" -DPA_USE_ALSA" + fi + if test x$jack = "xyes"; + then + SYSSRC="../portaudio/src/hostapi/jack/pa_jack.c "$SYSSRC + CPPFLAGS=$CPPFLAGS" -DPA_USE_JACK" + fi fi - if test x$setuid == "xyes"; + if test x$setuid = "xyes"; then - binarymode="-m4755" + binarymode="-m4755" fi STRIPFLAG=-s GUINAME="pd-gui" - if test x$USE_DEBUG_CFLAGS == "xyes"; + if test x$USE_DEBUG_CFLAGS = "xyes"; then - MORECFLAGS=$MORECFLAGS" -g" + MORECFLAGS=$MORECFLAGS" -g" else - MORECFLAGS=$MORECFLAGS" -O6 -funroll-loops -fomit-frame-pointer" + MORECFLAGS=$MORECFLAGS" -O6 -funroll-loops -fomit-frame-pointer" fi - if test x$jack == "xyes"; + if test x$jack = "xyes"; then LDFLAGS=$LDFLAGS" -lrt -ljack" fi - if test x$jack == "xrun"; + if test x$jack = "xrun"; then LDFLAGS=$LDFLAGS" -lrt -ljack" fi - echo MORECFLAGS --------------- $MORECFLAGS OSNUMBER=0 fi -if test `uname -s` == Darwin; +if test `uname -s` = Darwin; then LDFLAGS="-Wl -framework CoreAudio \ -framework AudioUnit -framework AudioToolbox \ -framework Carbon -framework CoreMIDI" EXT=pd_darwin CPPFLAGS="-DDL_OPEN -DMACOSX -DUNISTD -I/usr/X11R6/include \ - -I../portaudio/include -I../portaudio/src/common \ - -I../portaudio/src/os/mac_osx/ \ - -I../portmidi/pm_common -I../portmidi/pm_mac \ - -I../portmidi/porttime \ - -DUSEAPI_PORTAUDIO -DPA19 -DPA_USE_COREAUDIO -DNEWBUFFER" + -I../portaudio/include -I../portaudio/src/common \ + -I../portaudio/src/os/mac_osx/ \ + -I../portmidi/pm_common -I../portmidi/pm_mac \ + -I../portmidi/porttime \ + -DUSEAPI_PORTAUDIO -DPA19 -DPA_USE_COREAUDIO -DNEWBUFFER" + dnl for Mac OS X 10.3 (i.e. < 10.4) if test `uname -r` = 7.9.0; then - MORECFLAGS="-DMACOSX3 -DPA_BIG_ENDIAN -Wno-error" - EXTERNTARGET=d_ppc - else + fat="no" + fi + if test "x$fat" == "xyes"; + then MORECFLAGS="-isysroot /Developer/SDKs/MacOSX10.4u.sdk \ -arch i386 -arch ppc -Wno-error" - EXTERNTARGET=d_fat + EXTERNTARGET=d_fat LDFLAGS=$LDFLAGS" -arch i386 -arch ppc" + else + MORECFLAGS="-DMACOSX3 -DPA_BIG_ENDIAN -Wno-error" + EXTERNTARGET=d_ppc fi SYSSRC="s_midi_pm.c s_audio_pa.c \ - s_audio_pablio.c \ - s_audio_paring.c \ - ../portaudio/src/common/pa_allocation.c \ - ../portaudio/src/common/pa_converters.c \ - ../portaudio/src/common/pa_cpuload.c \ - ../portaudio/src/common/pa_dither.c \ - ../portaudio/src/common/pa_front.c \ - ../portaudio/src/common/pa_process.c \ - ../portaudio/src/common/pa_skeleton.c \ - ../portaudio/src/common/pa_stream.c \ - ../portaudio/src/common/pa_trace.c \ - ../portaudio/src/common/pa_debugprint.c \ - ../portaudio/src/common/pa_ringbuffer.c \ - ../portaudio/src/os/unix/pa_unix_util.c \ - ../portaudio/src/os/mac_osx/pa_mac_hostapis.c \ - ../portaudio/src/hostapi/coreaudio/pa_mac_core.c \ - ../portaudio/src/hostapi/coreaudio/pa_mac_core_blocking.c \ - ../portaudio/src/hostapi/coreaudio/pa_mac_core_utilities.c \ + s_audio_pablio.c \ + s_audio_paring.c \ + ../portaudio/src/common/pa_allocation.c \ + ../portaudio/src/common/pa_converters.c \ + ../portaudio/src/common/pa_cpuload.c \ + ../portaudio/src/common/pa_dither.c \ + ../portaudio/src/common/pa_front.c \ + ../portaudio/src/common/pa_process.c \ + ../portaudio/src/common/pa_skeleton.c \ + ../portaudio/src/common/pa_stream.c \ + ../portaudio/src/common/pa_trace.c \ + ../portaudio/src/common/pa_debugprint.c \ + ../portaudio/src/common/pa_ringbuffer.c \ + ../portaudio/src/os/unix/pa_unix_util.c \ + ../portaudio/src/os/mac_osx/pa_mac_hostapis.c \ + ../portaudio/src/hostapi/coreaudio/pa_mac_core.c \ + ../portaudio/src/hostapi/coreaudio/pa_mac_core_blocking.c \ + ../portaudio/src/hostapi/coreaudio/pa_mac_core_utilities.c \ ../portmidi/pm_mac/pmmac.c \ ../portmidi/pm_mac/pmmacosxcm.c \ ../portmidi/pm_common/pmutil.c \ @@ -306,34 +322,34 @@ then GUINAME="libPdTcl.dylib" # find the Tcl/Tk Frameworks - if test -d "../../Frameworks"; + if test -d "../../Frameworks"; then # Miller's location TCLTK_FRAMEWORKS_PATH="../../Frameworks" - elif test -d "/Library/Frameworks"; - then + elif test -d "/Library/Frameworks"; + then # get it from the default install location TCLTK_FRAMEWORKS_PATH="/Library/Frameworks" else # Panther has Tcl here; Tiger has Tcl and Tk here TCLTK_FRAMEWORKS_PATH="/System/Library/Frameworks" - fi + fi GUIFLAGS="-F$TCLTK_FRAMEWORKS_PATH -framework Tcl -framework Tk \ -I$TCLTK_FRAMEWORKS_PATH/Tk.framework/Versions/Current/Headers \ -I$TCLTK_FRAMEWORKS_PATH/Tcl.framework/Versions/Current/Headers \ -I$TCLTK_FRAMEWORKS_PATH/Tcl.framework/Versions/8.4/PrivateHeaders" - if test x$USE_DEBUG_CFLAGS == "xyes"; + if test x$USE_DEBUG_CFLAGS = "xyes"; then - MORECFLAGS=$MORECFLAGS" -g" + MORECFLAGS=$MORECFLAGS" -g" else - MORECFLAGS=$MORECFLAGS" -O2" + MORECFLAGS=$MORECFLAGS" -O2" fi OSNUMBER=2 - if test x$jack == "xyes"; + if test x$jack = "xyes"; then - LDFLAGS=$LDFLAGS" -weak_framework Jack" + LDFLAGS=$LDFLAGS" -weak_framework Jack" fi - if test x$jack == "xrun"; + if test x$jack = "xrun"; then LDFLAGS=$LDFLAGS" -weak_framework Jack" fi @@ -342,35 +358,35 @@ fi # only Windows uses ASIO, for the rest, set to blank ASIOSRC= -if test `uname -s` == MINGW32_NT-5.0; +if test `uname -s` = MINGW32_NT-5.0; then EXT=dll MORECFLAGS="-DUSEAPI_PORTAUDIO -DPA19 -DMSW -DPA_NO_DS -DPD_INTERNAL \ -I../portaudio/include -I../portaudio/src/common \ - -I../portaudio/src/os/win/ \ + -I../portaudio/src/os/win/ \ -mwindows -mms-bitfields "$MORECFLAGS PDLIB=$PDLIB" -lwsock32 -lwinmm -lole32 -lstdc++" SYSSRC="s_audio_pa.c s_audio_pablio.c s_audio_paring.c \ s_audio_mmio.c s_midi_mmio.c \ - ../portaudio/src/common/pa_allocation.c \ - ../portaudio/src/common/pa_converters.c \ - ../portaudio/src/common/pa_cpuload.c \ - ../portaudio/src/common/pa_dither.c \ - ../portaudio/src/common/pa_front.c \ - ../portaudio/src/common/pa_process.c \ - ../portaudio/src/common/pa_skeleton.c \ - ../portaudio/src/common/pa_stream.c \ - ../portaudio/src/common/pa_trace.c \ - ../portaudio/src/common/pa_debugprint.c \ - ../portaudio/src/common/pa_ringbuffer.c \ + ../portaudio/src/common/pa_allocation.c \ + ../portaudio/src/common/pa_converters.c \ + ../portaudio/src/common/pa_cpuload.c \ + ../portaudio/src/common/pa_dither.c \ + ../portaudio/src/common/pa_front.c \ + ../portaudio/src/common/pa_process.c \ + ../portaudio/src/common/pa_skeleton.c \ + ../portaudio/src/common/pa_stream.c \ + ../portaudio/src/common/pa_trace.c \ + ../portaudio/src/common/pa_debugprint.c \ + ../portaudio/src/common/pa_ringbuffer.c \ ../portaudio/src/os/win/pa_win_util.c \ ../portaudio/src/os/win/pa_win_hostapis.c \ ../portaudio/src/os/win/pa_x86_plain_converters.c \ ../portaudio/src/hostapi/wmme/pa_win_wmme.c" - ASIOSRC="../portaudio/src/hostapi/asio/iasiothiscallresolver.cpp \ - ../portaudio/src/hostapi/pa_asio/asio.cpp ../asio/asio.cpp \ - ../asio/asiodrivers.cpp ../asio/asiolist.cpp" + ASIOSRC="../portaudio/src/hostapi/asio/iasiothiscallresolver.cpp \ + ../portaudio/src/hostapi/pa_asio/asio.cpp ../asio/asio.cpp \ + ../asio/asiodrivers.cpp ../asio/asiolist.cpp" STRIPFLAG="--strip-unneeded" GUINAME="pdtcl.dll" GUIFLAGS= @@ -378,18 +394,18 @@ fi # support for jack, on either linux or darwin: -if test x$jack == "xyes"; +if test x$jack = "xyes"; then MORECFLAGS=$MORECFLAGS" -DUSEAPI_JACK" SYSSRC=$SYSSRC" s_audio_jack.c" fi -if test x$jack == "xrun"; +if test x$jack = "xrun"; then MORECFLAGS=$MORECFLAGS" -DUSEAPI_JACK -DJACK_XRUN" SYSSRC=$SYSSRC" s_audio_jack.c" fi -if test x$fftw == "xyes"; +if test x$fftw = "xyes"; then SYSSRC=$SYSSRC" d_fft_fftw.c d_fftroutine.c" LDFLAGS=$LDFLAGS" -lfftw" diff --git a/pd/src/d_arithmetic.c b/pd/src/d_arithmetic.c index adbcfb15..02671e36 100644 --- a/pd/src/d_arithmetic.c +++ b/pd/src/d_arithmetic.c @@ -16,13 +16,13 @@ static t_class *plus_class, *scalarplus_class; typedef struct _plus { t_object x_obj; - float x_f; + t_float x_f; } t_plus; typedef struct _scalarplus { t_object x_obj; - float x_f; + t_float x_f; t_float x_g; /* inlet value */ } t_scalarplus; @@ -50,9 +50,9 @@ static void *plus_new(t_symbol *s, int argc, t_atom *argv) t_int *plus_perform(t_int *w) { - t_float *in1 = (t_float *)(w[1]); - t_float *in2 = (t_float *)(w[2]); - t_float *out = (t_float *)(w[3]); + t_sample *in1 = (t_sample *)(w[1]); + t_sample *in2 = (t_sample *)(w[2]); + t_sample *out = (t_sample *)(w[3]); int n = (int)(w[4]); while (n--) *out++ = *in1++ + *in2++; return (w+5); @@ -60,17 +60,17 @@ t_int *plus_perform(t_int *w) t_int *plus_perf8(t_int *w) { - t_float *in1 = (t_float *)(w[1]); - t_float *in2 = (t_float *)(w[2]); - t_float *out = (t_float *)(w[3]); + t_sample *in1 = (t_sample *)(w[1]); + t_sample *in2 = (t_sample *)(w[2]); + t_sample *out = (t_sample *)(w[3]); int n = (int)(w[4]); for (; n; n -= 8, in1 += 8, in2 += 8, out += 8) { - float f0 = in1[0], f1 = in1[1], f2 = in1[2], f3 = in1[3]; - float f4 = in1[4], f5 = in1[5], f6 = in1[6], f7 = in1[7]; + t_sample f0 = in1[0], f1 = in1[1], f2 = in1[2], f3 = in1[3]; + t_sample f4 = in1[4], f5 = in1[5], f6 = in1[6], f7 = in1[7]; - float g0 = in2[0], g1 = in2[1], g2 = in2[2], g3 = in2[3]; - float g4 = in2[4], g5 = in2[5], g6 = in2[6], g7 = in2[7]; + t_sample g0 = in2[0], g1 = in2[1], g2 = in2[2], g3 = in2[3]; + t_sample g4 = in2[4], g5 = in2[5], g6 = in2[6], g7 = in2[7]; out[0] = f0 + g0; out[1] = f1 + g1; out[2] = f2 + g2; out[3] = f3 + g3; out[4] = f4 + g4; out[5] = f5 + g5; out[6] = f6 + g6; out[7] = f7 + g7; @@ -80,9 +80,9 @@ t_int *plus_perf8(t_int *w) t_int *scalarplus_perform(t_int *w) { - t_float *in = (t_float *)(w[1]); + t_sample *in = (t_sample *)(w[1]); t_float f = *(t_float *)(w[2]); - t_float *out = (t_float *)(w[3]); + t_sample *out = (t_sample *)(w[3]); int n = (int)(w[4]); while (n--) *out++ = *in++ + f; return (w+5); @@ -90,14 +90,14 @@ t_int *scalarplus_perform(t_int *w) t_int *scalarplus_perf8(t_int *w) { - t_float *in = (t_float *)(w[1]); + t_sample *in = (t_sample *)(w[1]); t_float g = *(t_float *)(w[2]); - t_float *out = (t_float *)(w[3]); + t_sample *out = (t_sample *)(w[3]); int n = (int)(w[4]); for (; n; n -= 8, in += 8, out += 8) { - float f0 = in[0], f1 = in[1], f2 = in[2], f3 = in[3]; - float f4 = in[4], f5 = in[5], f6 = in[6], f7 = in[7]; + t_sample f0 = in[0], f1 = in[1], f2 = in[2], f3 = in[3]; + t_sample f4 = in[4], f5 = in[5], f6 = in[6], f7 = in[7]; out[0] = f0 + g; out[1] = f1 + g; out[2] = f2 + g; out[3] = f3 + g; out[4] = f4 + g; out[5] = f5 + g; out[6] = f6 + g; out[7] = f7 + g; @@ -149,13 +149,13 @@ static t_class *minus_class, *scalarminus_class; typedef struct _minus { t_object x_obj; - float x_f; + t_float x_f; } t_minus; typedef struct _scalarminus { t_object x_obj; - float x_f; + t_float x_f; t_float x_g; } t_scalarminus; @@ -183,9 +183,9 @@ static void *minus_new(t_symbol *s, int argc, t_atom *argv) t_int *minus_perform(t_int *w) { - t_float *in1 = (t_float *)(w[1]); - t_float *in2 = (t_float *)(w[2]); - t_float *out = (t_float *)(w[3]); + t_sample *in1 = (t_sample *)(w[1]); + t_sample *in2 = (t_sample *)(w[2]); + t_sample *out = (t_sample *)(w[3]); int n = (int)(w[4]); while (n--) *out++ = *in1++ - *in2++; return (w+5); @@ -193,17 +193,17 @@ t_int *minus_perform(t_int *w) t_int *minus_perf8(t_int *w) { - t_float *in1 = (t_float *)(w[1]); - t_float *in2 = (t_float *)(w[2]); - t_float *out = (t_float *)(w[3]); + t_sample *in1 = (t_sample *)(w[1]); + t_sample *in2 = (t_sample *)(w[2]); + t_sample *out = (t_sample *)(w[3]); int n = (int)(w[4]); for (; n; n -= 8, in1 += 8, in2 += 8, out += 8) { - float f0 = in1[0], f1 = in1[1], f2 = in1[2], f3 = in1[3]; - float f4 = in1[4], f5 = in1[5], f6 = in1[6], f7 = in1[7]; + t_sample f0 = in1[0], f1 = in1[1], f2 = in1[2], f3 = in1[3]; + t_sample f4 = in1[4], f5 = in1[5], f6 = in1[6], f7 = in1[7]; - float g0 = in2[0], g1 = in2[1], g2 = in2[2], g3 = in2[3]; - float g4 = in2[4], g5 = in2[5], g6 = in2[6], g7 = in2[7]; + t_sample g0 = in2[0], g1 = in2[1], g2 = in2[2], g3 = in2[3]; + t_sample g4 = in2[4], g5 = in2[5], g6 = in2[6], g7 = in2[7]; out[0] = f0 - g0; out[1] = f1 - g1; out[2] = f2 - g2; out[3] = f3 - g3; out[4] = f4 - g4; out[5] = f5 - g5; out[6] = f6 - g6; out[7] = f7 - g7; @@ -213,9 +213,9 @@ t_int *minus_perf8(t_int *w) t_int *scalarminus_perform(t_int *w) { - t_float *in = (t_float *)(w[1]); + t_sample *in = (t_sample *)(w[1]); t_float f = *(t_float *)(w[2]); - t_float *out = (t_float *)(w[3]); + t_sample *out = (t_sample *)(w[3]); int n = (int)(w[4]); while (n--) *out++ = *in++ - f; return (w+5); @@ -223,14 +223,14 @@ t_int *scalarminus_perform(t_int *w) t_int *scalarminus_perf8(t_int *w) { - t_float *in = (t_float *)(w[1]); + t_sample *in = (t_sample *)(w[1]); t_float g = *(t_float *)(w[2]); - t_float *out = (t_float *)(w[3]); + t_sample *out = (t_sample *)(w[3]); int n = (int)(w[4]); for (; n; n -= 8, in += 8, out += 8) { - float f0 = in[0], f1 = in[1], f2 = in[2], f3 = in[3]; - float f4 = in[4], f5 = in[5], f6 = in[6], f7 = in[7]; + t_sample f0 = in[0], f1 = in[1], f2 = in[2], f3 = in[3]; + t_sample f4 = in[4], f5 = in[5], f6 = in[6], f7 = in[7]; out[0] = f0 - g; out[1] = f1 - g; out[2] = f2 - g; out[3] = f3 - g; out[4] = f4 - g; out[5] = f5 - g; out[6] = f6 - g; out[7] = f7 - g; @@ -280,13 +280,13 @@ static t_class *times_class, *scalartimes_class; typedef struct _times { t_object x_obj; - float x_f; + t_float x_f; } t_times; typedef struct _scalartimes { t_object x_obj; - float x_f; + t_float x_f; t_float x_g; } t_scalartimes; @@ -314,9 +314,9 @@ static void *times_new(t_symbol *s, int argc, t_atom *argv) t_int *times_perform(t_int *w) { - t_float *in1 = (t_float *)(w[1]); - t_float *in2 = (t_float *)(w[2]); - t_float *out = (t_float *)(w[3]); + t_sample *in1 = (t_sample *)(w[1]); + t_sample *in2 = (t_sample *)(w[2]); + t_sample *out = (t_sample *)(w[3]); int n = (int)(w[4]); while (n--) *out++ = *in1++ * *in2++; return (w+5); @@ -324,17 +324,17 @@ t_int *times_perform(t_int *w) t_int *times_perf8(t_int *w) { - t_float *in1 = (t_float *)(w[1]); - t_float *in2 = (t_float *)(w[2]); - t_float *out = (t_float *)(w[3]); + t_sample *in1 = (t_sample *)(w[1]); + t_sample *in2 = (t_sample *)(w[2]); + t_sample *out = (t_sample *)(w[3]); int n = (int)(w[4]); for (; n; n -= 8, in1 += 8, in2 += 8, out += 8) { - float f0 = in1[0], f1 = in1[1], f2 = in1[2], f3 = in1[3]; - float f4 = in1[4], f5 = in1[5], f6 = in1[6], f7 = in1[7]; + t_sample f0 = in1[0], f1 = in1[1], f2 = in1[2], f3 = in1[3]; + t_sample f4 = in1[4], f5 = in1[5], f6 = in1[6], f7 = in1[7]; - float g0 = in2[0], g1 = in2[1], g2 = in2[2], g3 = in2[3]; - float g4 = in2[4], g5 = in2[5], g6 = in2[6], g7 = in2[7]; + t_sample g0 = in2[0], g1 = in2[1], g2 = in2[2], g3 = in2[3]; + t_sample g4 = in2[4], g5 = in2[5], g6 = in2[6], g7 = in2[7]; out[0] = f0 * g0; out[1] = f1 * g1; out[2] = f2 * g2; out[3] = f3 * g3; out[4] = f4 * g4; out[5] = f5 * g5; out[6] = f6 * g6; out[7] = f7 * g7; @@ -344,9 +344,9 @@ t_int *times_perf8(t_int *w) t_int *scalartimes_perform(t_int *w) { - t_float *in = (t_float *)(w[1]); + t_sample *in = (t_sample *)(w[1]); t_float f = *(t_float *)(w[2]); - t_float *out = (t_float *)(w[3]); + t_sample *out = (t_sample *)(w[3]); int n = (int)(w[4]); while (n--) *out++ = *in++ * f; return (w+5); @@ -354,14 +354,14 @@ t_int *scalartimes_perform(t_int *w) t_int *scalartimes_perf8(t_int *w) { - t_float *in = (t_float *)(w[1]); + t_sample *in = (t_sample *)(w[1]); t_float g = *(t_float *)(w[2]); - t_float *out = (t_float *)(w[3]); + t_sample *out = (t_sample *)(w[3]); int n = (int)(w[4]); for (; n; n -= 8, in += 8, out += 8) { - float f0 = in[0], f1 = in[1], f2 = in[2], f3 = in[3]; - float f4 = in[4], f5 = in[5], f6 = in[6], f7 = in[7]; + t_sample f0 = in[0], f1 = in[1], f2 = in[2], f3 = in[3]; + t_sample f4 = in[4], f5 = in[5], f6 = in[6], f7 = in[7]; out[0] = f0 * g; out[1] = f1 * g; out[2] = f2 * g; out[3] = f3 * g; out[4] = f4 * g; out[5] = f5 * g; out[6] = f6 * g; out[7] = f7 * g; @@ -410,13 +410,13 @@ static t_class *over_class, *scalarover_class; typedef struct _over { t_object x_obj; - float x_f; + t_float x_f; } t_over; typedef struct _scalarover { t_object x_obj; - float x_f; + t_float x_f; t_float x_g; } t_scalarover; @@ -444,13 +444,13 @@ static void *over_new(t_symbol *s, int argc, t_atom *argv) t_int *over_perform(t_int *w) { - t_float *in1 = (t_float *)(w[1]); - t_float *in2 = (t_float *)(w[2]); - t_float *out = (t_float *)(w[3]); + t_sample *in1 = (t_sample *)(w[1]); + t_sample *in2 = (t_sample *)(w[2]); + t_sample *out = (t_sample *)(w[3]); int n = (int)(w[4]); while (n--) { - float g = *in2++; + t_sample g = *in2++; *out++ = (g ? *in1++ / g : 0); } return (w+5); @@ -458,17 +458,17 @@ t_int *over_perform(t_int *w) t_int *over_perf8(t_int *w) { - t_float *in1 = (t_float *)(w[1]); - t_float *in2 = (t_float *)(w[2]); - t_float *out = (t_float *)(w[3]); + t_sample *in1 = (t_sample *)(w[1]); + t_sample *in2 = (t_sample *)(w[2]); + t_sample *out = (t_sample *)(w[3]); int n = (int)(w[4]); for (; n; n -= 8, in1 += 8, in2 += 8, out += 8) { - float f0 = in1[0], f1 = in1[1], f2 = in1[2], f3 = in1[3]; - float f4 = in1[4], f5 = in1[5], f6 = in1[6], f7 = in1[7]; + t_sample f0 = in1[0], f1 = in1[1], f2 = in1[2], f3 = in1[3]; + t_sample f4 = in1[4], f5 = in1[5], f6 = in1[6], f7 = in1[7]; - float g0 = in2[0], g1 = in2[1], g2 = in2[2], g3 = in2[3]; - float g4 = in2[4], g5 = in2[5], g6 = in2[6], g7 = in2[7]; + t_sample g0 = in2[0], g1 = in2[1], g2 = in2[2], g3 = in2[3]; + t_sample g4 = in2[4], g5 = in2[5], g6 = in2[6], g7 = in2[7]; out[0] = (g0? f0 / g0 : 0); out[1] = (g1? f1 / g1 : 0); @@ -484,9 +484,9 @@ t_int *over_perf8(t_int *w) t_int *scalarover_perform(t_int *w) { - t_float *in = (t_float *)(w[1]); + t_sample *in = (t_sample *)(w[1]); t_float f = *(t_float *)(w[2]); - t_float *out = (t_float *)(w[3]); + t_sample *out = (t_sample *)(w[3]); int n = (int)(w[4]); if(f) f = 1./f; while (n--) *out++ = *in++ * f; @@ -495,15 +495,15 @@ t_int *scalarover_perform(t_int *w) t_int *scalarover_perf8(t_int *w) { - t_float *in = (t_float *)(w[1]); + t_sample *in = (t_sample *)(w[1]); t_float g = *(t_float *)(w[2]); - t_float *out = (t_float *)(w[3]); + t_sample *out = (t_sample *)(w[3]); int n = (int)(w[4]); if (g) g = 1.f / g; for (; n; n -= 8, in += 8, out += 8) { - float f0 = in[0], f1 = in[1], f2 = in[2], f3 = in[3]; - float f4 = in[4], f5 = in[5], f6 = in[6], f7 = in[7]; + t_sample f0 = in[0], f1 = in[1], f2 = in[2], f3 = in[3]; + t_sample f4 = in[4], f5 = in[5], f6 = in[6], f7 = in[7]; out[0] = f0 * g; out[1] = f1 * g; out[2] = f2 * g; out[3] = f3 * g; out[4] = f4 * g; out[5] = f5 * g; out[6] = f6 * g; out[7] = f7 * g; @@ -552,13 +552,13 @@ static t_class *max_class, *scalarmax_class; typedef struct _max { t_object x_obj; - float x_f; + t_float x_f; } t_max; typedef struct _scalarmax { t_object x_obj; - float x_f; + t_float x_f; t_float x_g; } t_scalarmax; @@ -586,13 +586,13 @@ static void *max_new(t_symbol *s, int argc, t_atom *argv) t_int *max_perform(t_int *w) { - t_float *in1 = (t_float *)(w[1]); - t_float *in2 = (t_float *)(w[2]); - t_float *out = (t_float *)(w[3]); + t_sample *in1 = (t_sample *)(w[1]); + t_sample *in2 = (t_sample *)(w[2]); + t_sample *out = (t_sample *)(w[3]); int n = (int)(w[4]); while (n--) { - float f = *in1++, g = *in2++; + t_sample f = *in1++, g = *in2++; *out++ = (f > g ? f : g); } return (w+5); @@ -600,17 +600,17 @@ t_int *max_perform(t_int *w) t_int *max_perf8(t_int *w) { - t_float *in1 = (t_float *)(w[1]); - t_float *in2 = (t_float *)(w[2]); - t_float *out = (t_float *)(w[3]); + t_sample *in1 = (t_sample *)(w[1]); + t_sample *in2 = (t_sample *)(w[2]); + t_sample *out = (t_sample *)(w[3]); int n = (int)(w[4]); for (; n; n -= 8, in1 += 8, in2 += 8, out += 8) { - float f0 = in1[0], f1 = in1[1], f2 = in1[2], f3 = in1[3]; - float f4 = in1[4], f5 = in1[5], f6 = in1[6], f7 = in1[7]; + t_sample f0 = in1[0], f1 = in1[1], f2 = in1[2], f3 = in1[3]; + t_sample f4 = in1[4], f5 = in1[5], f6 = in1[6], f7 = in1[7]; - float g0 = in2[0], g1 = in2[1], g2 = in2[2], g3 = in2[3]; - float g4 = in2[4], g5 = in2[5], g6 = in2[6], g7 = in2[7]; + t_sample g0 = in2[0], g1 = in2[1], g2 = in2[2], g3 = in2[3]; + t_sample g4 = in2[4], g5 = in2[5], g6 = in2[6], g7 = in2[7]; out[0] = (f0 > g0 ? f0 : g0); out[1] = (f1 > g1 ? f1 : g1); out[2] = (f2 > g2 ? f2 : g2); out[3] = (f3 > g3 ? f3 : g3); @@ -622,13 +622,13 @@ t_int *max_perf8(t_int *w) t_int *scalarmax_perform(t_int *w) { - t_float *in = (t_float *)(w[1]); + t_sample *in = (t_sample *)(w[1]); t_float f = *(t_float *)(w[2]); - t_float *out = (t_float *)(w[3]); + t_sample *out = (t_sample *)(w[3]); int n = (int)(w[4]); while (n--) { - t_float g = *in++; + t_sample g = *in++; *out++ = (f > g ? f : g); } return (w+5); @@ -636,14 +636,14 @@ t_int *scalarmax_perform(t_int *w) t_int *scalarmax_perf8(t_int *w) { - t_float *in = (t_float *)(w[1]); + t_sample *in = (t_sample *)(w[1]); t_float g = *(t_float *)(w[2]); - t_float *out = (t_float *)(w[3]); + t_sample *out = (t_sample *)(w[3]); int n = (int)(w[4]); for (; n; n -= 8, in += 8, out += 8) { - float f0 = in[0], f1 = in[1], f2 = in[2], f3 = in[3]; - float f4 = in[4], f5 = in[5], f6 = in[6], f7 = in[7]; + t_sample f0 = in[0], f1 = in[1], f2 = in[2], f3 = in[3]; + t_sample f4 = in[4], f5 = in[5], f6 = in[6], f7 = in[7]; out[0] = (f0 > g ? f0 : g); out[1] = (f1 > g ? f1 : g); out[2] = (f2 > g ? f2 : g); out[3] = (f3 > g ? f3 : g); @@ -694,14 +694,14 @@ static t_class *min_class, *scalarmin_class; typedef struct _min { t_object x_obj; - float x_f; + t_float x_f; } t_min; typedef struct _scalarmin { t_object x_obj; t_float x_g; - float x_f; + t_float x_f; } t_scalarmin; static void *min_new(t_symbol *s, int argc, t_atom *argv) @@ -728,13 +728,13 @@ static void *min_new(t_symbol *s, int argc, t_atom *argv) t_int *min_perform(t_int *w) { - t_float *in1 = (t_float *)(w[1]); - t_float *in2 = (t_float *)(w[2]); - t_float *out = (t_float *)(w[3]); + t_sample *in1 = (t_sample *)(w[1]); + t_sample *in2 = (t_sample *)(w[2]); + t_sample *out = (t_sample *)(w[3]); int n = (int)(w[4]); while (n--) { - float f = *in1++, g = *in2++; + t_sample f = *in1++, g = *in2++; *out++ = (f < g ? f : g); } return (w+5); @@ -742,17 +742,17 @@ t_int *min_perform(t_int *w) t_int *min_perf8(t_int *w) { - t_float *in1 = (t_float *)(w[1]); - t_float *in2 = (t_float *)(w[2]); - t_float *out = (t_float *)(w[3]); + t_sample *in1 = (t_sample *)(w[1]); + t_sample *in2 = (t_sample *)(w[2]); + t_sample *out = (t_sample *)(w[3]); int n = (int)(w[4]); for (; n; n -= 8, in1 += 8, in2 += 8, out += 8) { - float f0 = in1[0], f1 = in1[1], f2 = in1[2], f3 = in1[3]; - float f4 = in1[4], f5 = in1[5], f6 = in1[6], f7 = in1[7]; + t_sample f0 = in1[0], f1 = in1[1], f2 = in1[2], f3 = in1[3]; + t_sample f4 = in1[4], f5 = in1[5], f6 = in1[6], f7 = in1[7]; - float g0 = in2[0], g1 = in2[1], g2 = in2[2], g3 = in2[3]; - float g4 = in2[4], g5 = in2[5], g6 = in2[6], g7 = in2[7]; + t_sample g0 = in2[0], g1 = in2[1], g2 = in2[2], g3 = in2[3]; + t_sample g4 = in2[4], g5 = in2[5], g6 = in2[6], g7 = in2[7]; out[0] = (f0 < g0 ? f0 : g0); out[1] = (f1 < g1 ? f1 : g1); out[2] = (f2 < g2 ? f2 : g2); out[3] = (f3 < g3 ? f3 : g3); @@ -764,13 +764,13 @@ t_int *min_perf8(t_int *w) t_int *scalarmin_perform(t_int *w) { - t_float *in = (t_float *)(w[1]); + t_sample *in = (t_sample *)(w[1]); t_float f = *(t_float *)(w[2]); - t_float *out = (t_float *)(w[3]); + t_sample *out = (t_sample *)(w[3]); int n = (int)(w[4]); while (n--) { - t_float g = *in++; + t_sample g = *in++; *out++ = (f < g ? f : g); } return (w+5); @@ -778,14 +778,14 @@ t_int *scalarmin_perform(t_int *w) t_int *scalarmin_perf8(t_int *w) { - t_float *in = (t_float *)(w[1]); + t_sample *in = (t_sample *)(w[1]); t_float g = *(t_float *)(w[2]); t_float *out = (t_float *)(w[3]); int n = (int)(w[4]); for (; n; n -= 8, in += 8, out += 8) { - float f0 = in[0], f1 = in[1], f2 = in[2], f3 = in[3]; - float f4 = in[4], f5 = in[5], f6 = in[6], f7 = in[7]; + t_sample f0 = in[0], f1 = in[1], f2 = in[2], f3 = in[3]; + t_sample f4 = in[4], f5 = in[5], f6 = in[6], f7 = in[7]; out[0] = (f0 < g ? f0 : g); out[1] = (f1 < g ? f1 : g); out[2] = (f2 < g ? f2 : g); out[3] = (f3 < g ? f3 : g); diff --git a/pd/src/d_array.c b/pd/src/d_array.c index d78c26ae..73a18418 100644 --- a/pd/src/d_array.c +++ b/pd/src/d_array.c @@ -20,7 +20,7 @@ typedef struct _tabwrite_tilde int x_nsampsintab; t_word *x_vec; t_symbol *x_arrayname; - float x_f; + t_float x_f; } t_tabwrite_tilde; static void tabwrite_tilde_tick(t_tabwrite_tilde *x); @@ -45,7 +45,7 @@ static void tabwrite_tilde_redraw(t_tabwrite_tilde *x) static t_int *tabwrite_tilde_perform(t_int *w) { t_tabwrite_tilde *x = (t_tabwrite_tilde *)(w[1]); - t_float *in = (t_float *)(w[2]); + t_sample *in = (t_sample *)(w[2]); int n = (int)(w[3]), phase = x->x_phase, endphase = x->x_nsampsintab; if (!x->x_vec) goto bad; @@ -57,7 +57,7 @@ static t_int *tabwrite_tilde_perform(t_int *w) phase += nxfer; while (nxfer--) { - float f = *in++; + t_sample f = *in++; if (PD_BIGORSMALL(f)) f = 0; (wp++)->w_float = f; @@ -168,7 +168,7 @@ static void *tabplay_tilde_new(t_symbol *s) static t_int *tabplay_tilde_perform(t_int *w) { t_tabplay_tilde *x = (t_tabplay_tilde *)(w[1]); - t_float *out = (t_float *)(w[2]); + t_sample *out = (t_sample *)(w[2]); t_word *wp; int n = (int)(w[3]), phase = x->x_phase, endphase = (x->x_nsampsintab < x->x_limit ? @@ -276,7 +276,7 @@ typedef struct _tabread_tilde int x_npoints; t_word *x_vec; t_symbol *x_arrayname; - float x_f; + t_float x_f; } t_tabread_tilde; static void *tabread_tilde_new(t_symbol *s) @@ -292,8 +292,8 @@ static void *tabread_tilde_new(t_symbol *s) static t_int *tabread_tilde_perform(t_int *w) { t_tabread_tilde *x = (t_tabread_tilde *)(w[1]); - t_float *in = (t_float *)(w[2]); - t_float *out = (t_float *)(w[3]); + t_sample *in = (t_sample *)(w[2]); + t_sample *out = (t_sample *)(w[3]); int n = (int)(w[4]); int maxindex; t_word *buf = x->x_vec; @@ -372,7 +372,7 @@ typedef struct _tabread4_tilde int x_npoints; t_word *x_vec; t_symbol *x_arrayname; - float x_f; + t_float x_f; } t_tabread4_tilde; static void *tabread4_tilde_new(t_symbol *s) @@ -388,8 +388,8 @@ static void *tabread4_tilde_new(t_symbol *s) static t_int *tabread4_tilde_perform(t_int *w) { t_tabread4_tilde *x = (t_tabread4_tilde *)(w[1]); - t_float *in = (t_float *)(w[2]); - t_float *out = (t_float *)(w[3]); + t_sample *in = (t_sample *)(w[2]); + t_sample *out = (t_sample *)(w[3]); int n = (int)(w[4]); int maxindex; t_word *buf = x->x_vec, *wp; @@ -402,7 +402,7 @@ static t_int *tabread4_tilde_perform(t_int *w) #if 0 /* test for spam -- I'm not ready to deal with this */ for (i = 0, xmax = 0, xmin = maxindex, fp = in1; i < n; i++, fp++) { - float f = *in1; + t_sample f = *in1; if (f < xmin) xmin = f; else if (f > xmax) xmax = f; } @@ -410,16 +410,16 @@ static t_int *tabread4_tilde_perform(t_int *w) for (i = 0, splitlo = xmin+ x->c_maxextent, splithi = xmax - x->c_maxextent, fp = in1; i < n; i++, fp++) { - float f = *in1; + t_sample f = *in1; if (f > splitlo && f < splithi) goto zero; } #endif for (i = 0; i < n; i++) { - float findex = *in++; + t_sample findex = *in++; int index = findex; - float frac, a, b, c, d, cminusb; + t_sample frac, a, b, c, d, cminusb; static int count; if (index < 1) index = 1, frac = 0; @@ -547,13 +547,13 @@ static t_class *tabosc4_tilde_class; typedef struct _tabosc4_tilde { t_object x_obj; - float x_fnpoints; - float x_finvnpoints; + t_float x_fnpoints; + t_float x_finvnpoints; t_word *x_vec; t_symbol *x_arrayname; - float x_f; + t_float x_f; double x_phase; - float x_conv; + t_float x_conv; } t_tabosc4_tilde; static void *tabosc4_tilde_new(t_symbol *s) @@ -572,14 +572,14 @@ static void *tabosc4_tilde_new(t_symbol *s) static t_int *tabosc4_tilde_perform(t_int *w) { t_tabosc4_tilde *x = (t_tabosc4_tilde *)(w[1]); - t_float *in = (t_float *)(w[2]); - t_float *out = (t_float *)(w[3]); + t_sample *in = (t_sample *)(w[2]); + t_sample *out = (t_sample *)(w[3]); int n = (int)(w[4]); int normhipart; union tabfudge tf; - float fnpoints = x->x_fnpoints; + t_float fnpoints = x->x_fnpoints; int mask = fnpoints - 1; - float conv = fnpoints * x->x_conv; + t_float conv = fnpoints * x->x_conv; int maxindex; t_word *tab = x->x_vec, *addr; int i; @@ -592,7 +592,7 @@ static t_int *tabosc4_tilde_perform(t_int *w) #if 1 while (n--) { - float frac, a, b, c, d, cminusb; + t_sample frac, a, b, c, d, cminusb; tf.tf_d = dphase; dphase += *in++ * conv; addr = tab + (tf.tf_i[HIOFFSET] & mask); @@ -694,7 +694,7 @@ typedef struct _tabsend int x_graphperiod; int x_graphcount; t_symbol *x_arrayname; - float x_f; + t_float x_f; } t_tabsend; static void tabsend_tick(t_tabsend *x); @@ -711,7 +711,7 @@ static void *tabsend_new(t_symbol *s) static t_int *tabsend_perform(t_int *w) { t_tabsend *x = (t_tabsend *)(w[1]); - t_float *in = (t_float *)(w[2]); + t_sample *in = (t_sample *)(w[2]); int n = w[3]; t_word *dest = x->x_vec; int i = x->x_graphcount; @@ -719,7 +719,7 @@ static t_int *tabsend_perform(t_int *w) while (n--) { - float f = *in++; + t_sample f = *in++; if (PD_BIGORSMALL(f)) f = 0; (dest++)->w_float = f; @@ -785,7 +785,7 @@ typedef struct _tabreceive static t_int *tabreceive_perform(t_int *w) { t_tabreceive *x = (t_tabreceive *)(w[1]); - t_float *out = (t_float *)(w[2]); + t_sample *out = (t_sample *)(w[2]); int n = w[3]; t_word *from = x->x_vec; if (from) @@ -964,7 +964,7 @@ typedef struct _tabwrite { t_object x_obj; t_symbol *x_arrayname; - float x_ft1; + t_float x_ft1; } t_tabwrite; static void tabwrite_float(t_tabwrite *x, t_float f) diff --git a/pd/src/d_ctl.c b/pd/src/d_ctl.c index a33647ce..92467abe 100644 --- a/pd/src/d_ctl.c +++ b/pd/src/d_ctl.c @@ -15,13 +15,13 @@ static t_class *sig_tilde_class; typedef struct _sig { t_object x_obj; - float x_f; + t_float x_f; } t_sig; static t_int *sig_tilde_perform(t_int *w) { t_float f = *(t_float *)(w[1]); - t_float *out = (t_float *)(w[2]); + t_sample *out = (t_sample *)(w[2]); int n = (int)(w[3]); while (n--) *out++ = f; @@ -31,7 +31,7 @@ static t_int *sig_tilde_perform(t_int *w) static t_int *sig_tilde_perf8(t_int *w) { t_float f = *(t_float *)(w[1]); - t_float *out = (t_float *)(w[2]); + t_sample *out = (t_sample *)(w[2]); int n = (int)(w[3]); for (; n; n -= 8, out += 8) @@ -48,7 +48,7 @@ static t_int *sig_tilde_perf8(t_int *w) return (w+4); } -void dsp_add_scalarcopy(t_sample *in, t_sample *out, int n) +void dsp_add_scalarcopy(t_float *in, t_sample *out, int n) { if (n&7) dsp_add(sig_tilde_perform, 3, in, out, n); @@ -88,14 +88,14 @@ static t_class *line_tilde_class; typedef struct _line { t_object x_obj; - float x_target; - float x_value; - float x_biginc; - float x_inc; - float x_1overn; - float x_dspticktomsec; - float x_inletvalue; - float x_inletwas; + t_sample x_target; /* target value of ramp */ + t_sample x_value; /* current value of ramp at block-borders */ + t_sample x_biginc; + t_sample x_inc; + t_float x_1overn; + t_float x_dspticktomsec; + t_float x_inletvalue; + t_float x_inletwas; int x_ticksleft; int x_retarget; } t_line; @@ -103,9 +103,9 @@ typedef struct _line static t_int *line_tilde_perform(t_int *w) { t_line *x = (t_line *)(w[1]); - t_float *out = (t_float *)(w[2]); + t_sample *out = (t_sample *)(w[2]); int n = (int)(w[3]); - float f = x->x_value; + t_sample f = x->x_value; if (PD_BIGORSMALL(f)) x->x_value = f = 0; @@ -114,20 +114,20 @@ static t_int *line_tilde_perform(t_int *w) int nticks = x->x_inletwas * x->x_dspticktomsec; if (!nticks) nticks = 1; x->x_ticksleft = nticks; - x->x_biginc = (x->x_target - x->x_value)/(float)nticks; + x->x_biginc = (x->x_target - x->x_value)/(t_float)nticks; x->x_inc = x->x_1overn * x->x_biginc; x->x_retarget = 0; } if (x->x_ticksleft) { - float f = x->x_value; + t_sample f = x->x_value; while (n--) *out++ = f, f += x->x_inc; x->x_value += x->x_biginc; x->x_ticksleft--; } else { - float g = x->x_value = x->x_target; + t_sample g = x->x_value = x->x_target; while (n--) *out++ = g; } @@ -138,9 +138,9 @@ static t_int *line_tilde_perform(t_int *w) static t_int *line_tilde_perf8(t_int *w) { t_line *x = (t_line *)(w[1]); - t_float *out = (t_float *)(w[2]); + t_sample *out = (t_sample *)(w[2]); int n = (int)(w[3]); - float f = x->x_value; + t_sample f = x->x_value; if (PD_BIGORSMALL(f)) x->x_value = f = 0; @@ -149,20 +149,20 @@ static t_int *line_tilde_perf8(t_int *w) int nticks = x->x_inletwas * x->x_dspticktomsec; if (!nticks) nticks = 1; x->x_ticksleft = nticks; - x->x_biginc = (x->x_target - x->x_value)/(float)nticks; + x->x_biginc = (x->x_target - x->x_value)/(t_sample)nticks; x->x_inc = x->x_1overn * x->x_biginc; x->x_retarget = 0; } if (x->x_ticksleft) { - float f = x->x_value; + t_sample f = x->x_value; while (n--) *out++ = f, f += x->x_inc; x->x_value += x->x_biginc; x->x_ticksleft--; } else { - float f = x->x_value = x->x_target; + t_sample f = x->x_value = x->x_target; for (; n; n -= 8, out += 8) { out[0] = f; out[1] = f; out[2] = f; out[3] = f; @@ -232,7 +232,7 @@ typedef struct _vseg { double s_targettime; double s_starttime; - float s_target; + t_sample s_target; struct _vseg *s_next; } t_vseg; @@ -245,9 +245,9 @@ typedef struct _vline double x_samppermsec; double x_msecpersamp; double x_targettime; - float x_target; - float x_inlet1; - float x_inlet2; + t_sample x_target; + t_float x_inlet1; + t_float x_inlet2; t_vseg *x_list; } t_vline; @@ -320,8 +320,8 @@ static void vline_tilde_stop(t_vline *x) static void vline_tilde_float(t_vline *x, t_float f) { double timenow = clock_gettimesince(x->x_referencetime); - float inlet1 = (x->x_inlet1 < 0 ? 0 : x->x_inlet1); - float inlet2 = x->x_inlet2; + t_float inlet1 = (x->x_inlet1 < 0 ? 0 : x->x_inlet1); + t_float inlet2 = x->x_inlet2; double starttime = timenow + inlet2; t_vseg *s1, *s2, *deletefrom = 0, *snew; if (PD_BIGORSMALL(f)) @@ -416,7 +416,7 @@ typedef struct _snapshot { t_object x_obj; t_sample x_value; - float x_f; + t_float x_f; } t_snapshot; static void *snapshot_tilde_new(void) @@ -430,8 +430,8 @@ static void *snapshot_tilde_new(void) static t_int *snapshot_tilde_perform(t_int *w) { - t_float *in = (t_float *)(w[1]); - t_float *out = (t_float *)(w[2]); + t_sample *in = (t_sample *)(w[1]); + t_sample *out = (t_sample *)(w[2]); *out = *in; return (w+3); } @@ -473,8 +473,8 @@ typedef struct _vsnapshot int x_n; int x_gotone; t_sample *x_vec; - float x_f; - float x_sampspermsec; + t_float x_f; + t_float x_sampspermsec; double x_time; } t_vsnapshot; @@ -491,9 +491,9 @@ static void *vsnapshot_tilde_new(void) static t_int *vsnapshot_tilde_perform(t_int *w) { - t_float *in = (t_float *)(w[1]); + t_sample *in = (t_sample *)(w[1]); t_vsnapshot *x = (t_vsnapshot *)(w[2]); - t_float *out = x->x_vec; + t_sample *out = x->x_vec; int n = x->x_n, i; for (i = 0; i < n; i++) out[i] = in[i]; @@ -519,7 +519,7 @@ static void vsnapshot_tilde_dsp(t_vsnapshot *x, t_signal **sp) static void vsnapshot_tilde_bang(t_vsnapshot *x) { - float val; + t_sample val; if (x->x_gotone) { int indx = clock_gettimesince(x->x_time) * x->x_sampspermsec; @@ -560,14 +560,14 @@ typedef struct sigenv t_object x_obj; /* header */ void *x_outlet; /* a "float" outlet */ void *x_clock; /* a "clock" object */ - float *x_buf; /* a Hanning window */ + t_sample *x_buf; /* a Hanning window */ int x_phase; /* number of points since last output */ int x_period; /* requested period of output */ int x_realperiod; /* period rounded up to vecsize multiple */ int x_npoints; /* analysis window size in samples */ - float x_result; /* result to output */ - float x_sumbuf[MAXOVERLAP]; /* summing buffer */ - float x_f; + t_float x_result; /* result to output */ + t_sample x_sumbuf[MAXOVERLAP]; /* summing buffer */ + t_float x_f; int x_allocforvs; /* extra buffer for DSP vector size */ } t_sigenv; @@ -579,14 +579,14 @@ static void *env_tilde_new(t_floatarg fnpoints, t_floatarg fperiod) int npoints = fnpoints; int period = fperiod; t_sigenv *x; - float *buf; + t_sample *buf; int i; if (npoints < 1) npoints = 1024; if (period < 1) period = npoints/2; if (period < npoints / MAXOVERLAP + 1) period = npoints / MAXOVERLAP + 1; - if (!(buf = getbytes(sizeof(float) * (npoints + INITVSTAKEN)))) + if (!(buf = getbytes(sizeof(t_sample) * (npoints + INITVSTAKEN)))) { error("env: couldn't allocate buffer"); return (0); @@ -610,17 +610,17 @@ static void *env_tilde_new(t_floatarg fnpoints, t_floatarg fperiod) static t_int *env_tilde_perform(t_int *w) { t_sigenv *x = (t_sigenv *)(w[1]); - t_float *in = (t_float *)(w[2]); + t_sample *in = (t_sample *)(w[2]); int n = (int)(w[3]); int count; - float *sump; + t_sample *sump; in += n; for (count = x->x_phase, sump = x->x_sumbuf; count < x->x_npoints; count += x->x_realperiod, sump++) { - float *hp = x->x_buf + count; - float *fp = in; - float sum = *sump; + t_sample *hp = x->x_buf + count; + t_sample *fp = in; + t_sample sum = *sump; int i; for (i = 0; i < n; i++) @@ -653,14 +653,14 @@ static void env_tilde_dsp(t_sigenv *x, t_signal **sp) if (sp[0]->s_n > x->x_allocforvs) { void *xx = resizebytes(x->x_buf, - (x->x_npoints + x->x_allocforvs) * sizeof(float), - (x->x_npoints + sp[0]->s_n) * sizeof(float)); + (x->x_npoints + x->x_allocforvs) * sizeof(t_sample), + (x->x_npoints + sp[0]->s_n) * sizeof(t_sample)); if (!xx) { post("env~: out of memory"); return; } - x->x_buf = (t_float *)xx; + x->x_buf = (t_sample *)xx; x->x_allocforvs = sp[0]->s_n; } dsp_add(env_tilde_perform, 3, x, sp[0]->s_vec, sp[0]->s_n); @@ -674,7 +674,7 @@ static void env_tilde_tick(t_sigenv *x) /* callback function for the clock */ static void env_tilde_ff(t_sigenv *x) /* cleanup on free */ { clock_free(x->x_clock); - freebytes(x->x_buf, (x->x_npoints + x->x_allocforvs) * sizeof(float)); + freebytes(x->x_buf, (x->x_npoints + x->x_allocforvs) * sizeof(*x->x_buf)); } @@ -696,14 +696,14 @@ typedef struct _threshold_tilde t_outlet *x_outlet1; /* bang out for high thresh */ t_outlet *x_outlet2; /* bang out for low thresh */ t_clock *x_clock; /* wakeup for message output */ - float x_f; /* scalar inlet */ + t_float x_f; /* scalar inlet */ int x_state; /* 1 = high, 0 = low */ - float x_hithresh; /* value of high threshold */ - float x_lothresh; /* value of low threshold */ - float x_deadwait; /* msec remaining in dead period */ - float x_msecpertick; /* msec per DSP tick */ - float x_hideadtime; /* hi dead time in msec */ - float x_lodeadtime; /* lo dead time in msec */ + t_float x_hithresh; /* value of high threshold */ + t_float x_lothresh; /* value of low threshold */ + t_float x_deadwait; /* msec remaining in dead period */ + t_float x_msecpertick; /* msec per DSP tick */ + t_float x_hideadtime; /* hi dead time in msec */ + t_float x_lodeadtime; /* lo dead time in msec */ } t_threshold_tilde; static void threshold_tilde_tick(t_threshold_tilde *x); @@ -758,7 +758,7 @@ static void threshold_tilde_tick(t_threshold_tilde *x) static t_int *threshold_tilde_perform(t_int *w) { - float *in1 = (float *)(w[1]); + t_sample *in1 = (t_sample *)(w[1]); t_threshold_tilde *x = (t_threshold_tilde *)(w[2]); int n = (t_int)(w[3]); if (x->x_deadwait > 0) diff --git a/pd/src/d_dac.c b/pd/src/d_dac.c index 77643844..9d206c75 100644 --- a/pd/src/d_dac.c +++ b/pd/src/d_dac.c @@ -16,7 +16,7 @@ typedef struct _dac t_object x_obj; t_int x_n; t_int *x_vec; - float x_f; + t_float x_f; } t_dac; static void *dac_new(t_symbol *s, int argc, t_atom *argv) @@ -103,8 +103,8 @@ static void *adc_new(t_symbol *s, int argc, t_atom *argv) t_int *copy_perform(t_int *w) { - t_float *in1 = (t_float *)(w[1]); - t_float *out = (t_float *)(w[2]); + t_sample *in1 = (t_sample *)(w[1]); + t_sample *out = (t_sample *)(w[2]); int n = (int)(w[3]); while (n--) *out++ = *in1++; return (w+4); @@ -112,20 +112,20 @@ t_int *copy_perform(t_int *w) t_int *copy_perf8(t_int *w) { - t_float *in1 = (t_float *)(w[1]); - t_float *out = (t_float *)(w[2]); + t_sample *in1 = (t_sample *)(w[1]); + t_sample *out = (t_sample *)(w[2]); int n = (int)(w[3]); for (; n; n -= 8, in1 += 8, out += 8) { - float f0 = in1[0]; - float f1 = in1[1]; - float f2 = in1[2]; - float f3 = in1[3]; - float f4 = in1[4]; - float f5 = in1[5]; - float f6 = in1[6]; - float f7 = in1[7]; + t_sample f0 = in1[0]; + t_sample f1 = in1[1]; + t_sample f2 = in1[2]; + t_sample f3 = in1[3]; + t_sample f4 = in1[4]; + t_sample f5 = in1[5]; + t_sample f6 = in1[6]; + t_sample f7 = in1[7]; out[0] = f0; out[1] = f1; diff --git a/pd/src/d_delay.c b/pd/src/d_delay.c index 8ba5a0a5..98cc1149 100644 --- a/pd/src/d_delay.c +++ b/pd/src/d_delay.c @@ -16,7 +16,7 @@ static t_class *sigdelwrite_class; typedef struct delwritectl { int c_n; - float *c_vec; + t_sample *c_vec; int c_phase; } t_delwritectl; @@ -28,7 +28,7 @@ typedef struct _sigdelwrite int x_sortno; /* DSP sort number at which this was last put on chain */ int x_rsortno; /* DSP sort # for first delread or write in chain */ int x_vecsize; /* vector size for delread~ to use */ - float x_f; + t_float x_f; } t_sigdelwrite; #define XTRASAMPS 4 @@ -59,13 +59,13 @@ static void *sigdelwrite_new(t_symbol *s, t_floatarg msec) if (!*s->s_name) s = gensym("delwrite~"); pd_bind(&x->x_obj.ob_pd, s); x->x_sym = s; - nsamps = msec * sys_getsr() * (float)(0.001f); + nsamps = msec * sys_getsr() * (t_float)(0.001f); if (nsamps < 1) nsamps = 1; nsamps += ((- nsamps) & (SAMPBLK - 1)); nsamps += DEFDELVS; x->x_cspace.c_n = nsamps; x->x_cspace.c_vec = - (float *)getbytes((nsamps + XTRASAMPS) * sizeof(float)); + (t_sample *)getbytes((nsamps + XTRASAMPS) * sizeof(t_sample)); x->x_cspace.c_phase = XTRASAMPS; x->x_sortno = 0; x->x_vecsize = 0; @@ -75,15 +75,16 @@ static void *sigdelwrite_new(t_symbol *s, t_floatarg msec) static t_int *sigdelwrite_perform(t_int *w) { - t_float *in = (t_float *)(w[1]); + t_sample *in = (t_sample *)(w[1]); t_delwritectl *c = (t_delwritectl *)(w[2]); int n = (int)(w[3]); int phase = c->c_phase, nsamps = c->c_n; - float *vp = c->c_vec, *bp = vp + phase, *ep = vp + (c->c_n + XTRASAMPS); + t_sample *vp = c->c_vec, *bp = vp + phase, *ep = vp + (c->c_n + XTRASAMPS); phase += n; + while (n--) { - float f = *in++; + t_sample f = *in++; if (PD_BIGORSMALL(f)) f = 0; *bp++ = f; @@ -97,6 +98,8 @@ static t_int *sigdelwrite_perform(t_int *w) phase -= nsamps; } } + bp = vp + c->c_phase; + c->c_phase = phase; return (w+4); } @@ -112,7 +115,7 @@ static void sigdelwrite_free(t_sigdelwrite *x) { pd_unbind(&x->x_obj.ob_pd, x->x_sym); freebytes(x->x_cspace.c_vec, - (x->x_cspace.c_n + XTRASAMPS) * sizeof(float)); + (x->x_cspace.c_n + XTRASAMPS) * sizeof(t_sample)); } static void sigdelwrite_setup(void) @@ -172,15 +175,15 @@ static void sigdelread_float(t_sigdelread *x, t_float f) static t_int *sigdelread_perform(t_int *w) { - t_float *out = (t_float *)(w[1]); + t_sample *out = (t_sample *)(w[1]); t_delwritectl *c = (t_delwritectl *)(w[2]); int delsamps = *(int *)(w[3]); int n = (int)(w[4]); int phase = c->c_phase - delsamps, nsamps = c->c_n; - float *vp = c->c_vec, *bp, *ep = vp + (c->c_n + XTRASAMPS); - + t_sample *vp = c->c_vec, *bp, *ep = vp + (c->c_n + XTRASAMPS); if (phase < 0) phase += nsamps; bp = vp + phase; + while (n--) { *out++ = *bp++; @@ -228,7 +231,7 @@ typedef struct _sigvd t_symbol *x_sym; t_float x_sr; /* samples per msec */ int x_zerodel; /* 0 or vecsize depending on read/write order */ - float x_f; + t_float x_f; } t_sigvd; static void *sigvd_new(t_symbol *s) @@ -245,28 +248,28 @@ static void *sigvd_new(t_symbol *s) static t_int *sigvd_perform(t_int *w) { - t_float *in = (t_float *)(w[1]); - t_float *out = (t_float *)(w[2]); + t_sample *in = (t_sample *)(w[1]); + t_sample *out = (t_sample *)(w[2]); t_delwritectl *ctl = (t_delwritectl *)(w[3]); t_sigvd *x = (t_sigvd *)(w[4]); int n = (int)(w[5]); int nsamps = ctl->c_n; - float limit = nsamps - n - 1; - float fn = n-1; - float *vp = ctl->c_vec, *bp, *wp = vp + ctl->c_phase; - float zerodel = x->x_zerodel; + t_sample limit = nsamps - n - 1; + t_sample fn = n-1; + t_sample *vp = ctl->c_vec, *bp, *wp = vp + ctl->c_phase; + t_sample zerodel = x->x_zerodel; while (n--) { - float delsamps = x->x_sr * *in++ - zerodel, frac; + t_sample delsamps = x->x_sr * *in++ - zerodel, frac; int idelsamps; - float a, b, c, d, cminusb; + t_sample a, b, c, d, cminusb; if (delsamps < 1.00001f) delsamps = 1.00001f; if (delsamps > limit) delsamps = limit; delsamps += fn; fn = fn - 1.0f; idelsamps = delsamps; - frac = delsamps - (float)idelsamps; + frac = delsamps - (t_sample)idelsamps; bp = wp - idelsamps; if (bp < vp + 4) bp += nsamps; d = bp[-3]; diff --git a/pd/src/d_fft.c b/pd/src/d_fft.c index 006a985a..464f48d1 100644 --- a/pd/src/d_fft.c +++ b/pd/src/d_fft.c @@ -16,12 +16,12 @@ linked in. The configure script can be used to select which one. /* swap two arrays */ static t_int *sigfft_swap(t_int *w) { - float *in1 = (t_float *)(w[1]); - float *in2 = (t_float *)(w[2]); + t_sample *in1 = (t_sample *)(w[1]); + t_sample *in2 = (t_sample *)(w[2]); int n = w[3]; for (;n--; in1++, in2++) { - float f = *in1; + t_sample f = *in1; *in1 = *in2; *in2 = f; } @@ -34,8 +34,8 @@ static t_int *sigfft_swap(t_int *w) static t_int *sigrfft_flip(t_int *w) { - float *in = (t_float *)(w[1]); - float *out = (t_float *)(w[2]); + t_sample *in = (t_sample *)(w[1]); + t_sample *out = (t_sample *)(w[2]); int n = w[3]; while (n--) *(--out) = - *in++; @@ -48,7 +48,7 @@ static t_class *sigfft_class, *sigifft_class; typedef struct fft { t_object x_obj; - float x_f; + t_float x_f; } t_sigfft; static void *sigfft_new(void) @@ -73,8 +73,8 @@ static void *sigifft_new(void) static t_int *sigfft_perform(t_int *w) { - float *in1 = (t_float *)(w[1]); - float *in2 = (t_float *)(w[2]); + t_sample *in1 = (t_sample *)(w[1]); + t_sample *in2 = (t_sample *)(w[2]); int n = w[3]; mayer_fft(n, in1, in2); return (w+4); @@ -82,8 +82,8 @@ static t_int *sigfft_perform(t_int *w) static t_int *sigifft_perform(t_int *w) { - float *in1 = (t_float *)(w[1]); - float *in2 = (t_float *)(w[2]); + t_sample *in1 = (t_sample *)(w[1]); + t_sample *in2 = (t_sample *)(w[2]); int n = w[3]; mayer_ifft(n, in1, in2); return (w+4); @@ -92,10 +92,10 @@ static t_int *sigifft_perform(t_int *w) static void sigfft_dspx(t_sigfft *x, t_signal **sp, t_int *(*f)(t_int *w)) { int n = sp[0]->s_n; - float *in1 = sp[0]->s_vec; - float *in2 = sp[1]->s_vec; - float *out1 = sp[2]->s_vec; - float *out2 = sp[3]->s_vec; + t_sample *in1 = sp[0]->s_vec; + t_sample *in2 = sp[1]->s_vec; + t_sample *out1 = sp[2]->s_vec; + t_sample *out2 = sp[3]->s_vec; if (out1 == in2 && out2 == in1) dsp_add(sigfft_swap, 3, out1, out2, n); else if (out1 == in2) @@ -142,7 +142,7 @@ static t_class *sigrfft_class; typedef struct rfft { t_object x_obj; - float x_f; + t_float x_f; } t_sigrfft; static void *sigrfft_new(void) @@ -156,7 +156,7 @@ static void *sigrfft_new(void) static t_int *sigrfft_perform(t_int *w) { - float *in = (t_float *)(w[1]); + t_sample *in = (t_sample *)(w[1]); int n = w[2]; mayer_realfft(n, in); return (w+3); @@ -165,9 +165,9 @@ static t_int *sigrfft_perform(t_int *w) static void sigrfft_dsp(t_sigrfft *x, t_signal **sp) { int n = sp[0]->s_n, n2 = (n>>1); - float *in1 = sp[0]->s_vec; - float *out1 = sp[1]->s_vec; - float *out2 = sp[2]->s_vec; + t_sample *in1 = sp[0]->s_vec; + t_sample *out1 = sp[1]->s_vec; + t_sample *out2 = sp[2]->s_vec; if (n < 4) { error("fft: minimum 4 points"); @@ -199,7 +199,7 @@ static t_class *sigrifft_class; typedef struct rifft { t_object x_obj; - float x_f; + t_float x_f; } t_sigrifft; static void *sigrifft_new(void) @@ -213,7 +213,7 @@ static void *sigrifft_new(void) static t_int *sigrifft_perform(t_int *w) { - float *in = (t_float *)(w[1]); + t_sample *in = (t_sample *)(w[1]); int n = w[2]; mayer_realifft(n, in); return (w+3); @@ -222,9 +222,9 @@ static t_int *sigrifft_perform(t_int *w) static void sigrifft_dsp(t_sigrifft *x, t_signal **sp) { int n = sp[0]->s_n, n2 = (n>>1); - float *in1 = sp[0]->s_vec; - float *in2 = sp[1]->s_vec; - float *out1 = sp[2]->s_vec; + t_sample *in1 = sp[0]->s_vec; + t_sample *in2 = sp[1]->s_vec; + t_sample *out1 = sp[2]->s_vec; if (n < 4) { error("fft: minimum 4 points"); @@ -259,7 +259,7 @@ static t_class *sigframp_class; typedef struct framp { t_object x_obj; - float x_f; + t_float x_f; } t_sigframp; static void *sigframp_new(void) @@ -274,15 +274,15 @@ static void *sigframp_new(void) static t_int *sigframp_perform(t_int *w) { - float *inreal = (t_float *)(w[1]); - float *inimag = (t_float *)(w[2]); - float *outfreq = (t_float *)(w[3]); - float *outamp = (t_float *)(w[4]); - float lastreal = 0, currentreal = inreal[0], nextreal = inreal[1]; - float lastimag = 0, currentimag = inimag[0], nextimag = inimag[1]; + t_sample *inreal = (t_sample *)(w[1]); + t_sample *inimag = (t_sample *)(w[2]); + t_sample *outfreq = (t_sample *)(w[3]); + t_sample *outamp = (t_sample *)(w[4]); + t_sample lastreal = 0, currentreal = inreal[0], nextreal = inreal[1]; + t_sample lastimag = 0, currentimag = inimag[0], nextimag = inimag[1]; int n = w[5]; int m = n + 1; - float fbin = 1, oneovern2 = 1.f/((float)n * (float)n); + t_sample fbin = 1, oneovern2 = 1.f/((t_sample)n * (t_sample)n); inreal += 2; inimag += 2; @@ -290,7 +290,7 @@ static t_int *sigframp_perform(t_int *w) n -= 2; while (n--) { - float re, im, pow, freq; + t_sample re, im, pow, freq; lastreal = currentreal; currentreal = nextreal; nextreal = *inreal++; @@ -302,7 +302,7 @@ static t_int *sigframp_perform(t_int *w) pow = re * re + im * im; if (pow > 1e-19) { - float detune = ((lastreal - nextreal) * re + + t_sample detune = ((lastreal - nextreal) * re + (lastimag - nextimag) * im) / (2.0f * pow); if (detune > 2 || detune < -2) freq = pow = 0; else freq = fbin + detune; diff --git a/pd/src/d_fft_fftsg.c b/pd/src/d_fft_fftsg.c index 4d89ef7b..1fed1e6e 100644 --- a/pd/src/d_fft_fftsg.c +++ b/pd/src/d_fft_fftsg.c @@ -71,16 +71,16 @@ static int ooura_init( int n) return (1); } -EXTERN void mayer_fht(float *fz, int n) +EXTERN void mayer_fht(t_sample *fz, int n) { post("FHT: not yet implemented"); } -EXTERN void mayer_dofft(float *fz1, float *fz2, int n, int sgn) +EXTERN void mayer_dofft(t_sample *fz1, t_sample *fz2, int n, int sgn) { FFTFLT *buf, *fp3; int i; - float *fp1, *fp2; + t_sample *fp1, *fp2; buf = alloca(n * (2 * sizeof(FFTFLT))); if (!ooura_init(n)) return; @@ -99,21 +99,21 @@ EXTERN void mayer_dofft(float *fz1, float *fz2, int n, int sgn) } } -EXTERN void mayer_fft(int n, float *fz1, float *fz2) +EXTERN void mayer_fft(int n, t_sample *fz1, t_sample *fz2) { mayer_dofft(fz1, fz2, n, -1); } -EXTERN void mayer_ifft(int n, float *fz1, float *fz2) +EXTERN void mayer_ifft(int n, t_sample *fz1, t_sample *fz2) { mayer_dofft(fz1, fz2, n, 1); } -EXTERN void mayer_realfft(int n, float *fz) +EXTERN void mayer_realfft(int n, t_sample *fz) { FFTFLT *buf, *fp3; int i, nover2 = n/2; - float *fp1, *fp2; + t_sample *fp1, *fp2; buf = alloca(n * sizeof(FFTFLT)); if (!ooura_init(n)) return; @@ -127,11 +127,11 @@ EXTERN void mayer_realfft(int n, float *fz) *fp1 = fp3[0], *fp2 = fp3[1]; } -EXTERN void mayer_realifft(int n, float *fz) +EXTERN void mayer_realifft(int n, t_sample *fz) { FFTFLT *buf, *fp3; int i, nover2 = n/2; - float *fp1, *fp2; + t_sample *fp1, *fp2; buf = alloca(n * sizeof(FFTFLT)); if (!ooura_init(n)) return; diff --git a/pd/src/d_fft_mayer.c b/pd/src/d_fft_mayer.c index 860b3120..8df7fb3f 100644 --- a/pd/src/d_fft_mayer.c +++ b/pd/src/d_fft_mayer.c @@ -58,7 +58,7 @@ /* the following is needed only to declare pd_fft() as exportable in MSW */ #include "m_pd.h" -#define REAL float +#define REAL t_sample #define GOOD_TRIG #ifdef GOOD_TRIG diff --git a/pd/src/d_filter.c b/pd/src/d_filter.c index 93aeac4c..18b3b145 100644 --- a/pd/src/d_filter.c +++ b/pd/src/d_filter.c @@ -11,18 +11,18 @@ typedef struct hipctl { - float c_x; - float c_coef; + t_sample c_x; + t_sample c_coef; } t_hipctl; typedef struct sighip { t_object x_obj; - float x_sr; - float x_hz; + t_float x_sr; + t_float x_hz; t_hipctl x_cspace; t_hipctl *x_ctl; - float x_f; + t_float x_f; } t_sighip; t_class *sighip_class; @@ -54,18 +54,18 @@ static void sighip_ft1(t_sighip *x, t_floatarg f) static t_int *sighip_perform(t_int *w) { - float *in = (float *)(w[1]); - float *out = (float *)(w[2]); + t_sample *in = (t_sample *)(w[1]); + t_sample *out = (t_sample *)(w[2]); t_hipctl *c = (t_hipctl *)(w[3]); int n = (t_int)(w[4]); int i; - float last = c->c_x; - float coef = c->c_coef; + t_sample last = c->c_x; + t_sample coef = c->c_coef; if (coef < 1) { for (i = 0; i < n; i++) { - float new = *in++ + coef * last; + t_sample new = *in++ + coef * last; *out++ = new - last; last = new; } @@ -112,18 +112,18 @@ void sighip_setup(void) typedef struct lopctl { - float c_x; - float c_coef; + t_sample c_x; + t_sample c_coef; } t_lopctl; typedef struct siglop { t_object x_obj; - float x_sr; - float x_hz; + t_float x_sr; + t_float x_hz; t_lopctl x_cspace; t_lopctl *x_ctl; - float x_f; + t_float x_f; } t_siglop; t_class *siglop_class; @@ -161,14 +161,14 @@ static void siglop_clear(t_siglop *x, t_floatarg q) static t_int *siglop_perform(t_int *w) { - float *in = (float *)(w[1]); - float *out = (float *)(w[2]); + t_sample *in = (t_sample *)(w[1]); + t_sample *out = (t_sample *)(w[2]); t_lopctl *c = (t_lopctl *)(w[3]); int n = (t_int)(w[4]); int i; - float last = c->c_x; - float coef = c->c_coef; - float feedback = 1 - coef; + t_sample last = c->c_x; + t_sample coef = c->c_coef; + t_sample feedback = 1 - coef; for (i = 0; i < n; i++) last = *out++ = coef * *in++ + feedback * last; if (PD_BIGORSMALL(last)) @@ -202,22 +202,22 @@ void siglop_setup(void) typedef struct bpctl { - float c_x1; - float c_x2; - float c_coef1; - float c_coef2; - float c_gain; + t_sample c_x1; + t_sample c_x2; + t_sample c_coef1; + t_sample c_coef2; + t_sample c_gain; } t_bpctl; typedef struct sigbp { t_object x_obj; - float x_sr; - float x_freq; - float x_q; + t_float x_sr; + t_float x_freq; + t_float x_q; t_bpctl x_cspace; t_bpctl *x_ctl; - float x_f; + t_float x_f; } t_sigbp; t_class *sigbp_class; @@ -239,11 +239,11 @@ static void *sigbp_new(t_floatarg f, t_floatarg q) return (x); } -static float sigbp_qcos(float f) +static t_float sigbp_qcos(t_float f) { if (f >= -(0.5f*3.14159f) && f <= 0.5f*3.14159f) { - float g = f*f; + t_float g = f*f; return (((g*g*g * (-1.0f/720.0f) + g*g*(1.0f/24.0f)) - g*0.5) + 1); } else return (0); @@ -251,7 +251,7 @@ static float sigbp_qcos(float f) static void sigbp_docoef(t_sigbp *x, t_floatarg f, t_floatarg q) { - float r, oneminusr, omega; + t_float r, oneminusr, omega; if (f < 0.001) f = 10; if (q < 0) q = 0; x->x_freq = f; @@ -285,19 +285,19 @@ static void sigbp_clear(t_sigbp *x, t_floatarg q) static t_int *sigbp_perform(t_int *w) { - float *in = (float *)(w[1]); - float *out = (float *)(w[2]); + t_sample *in = (t_sample *)(w[1]); + t_sample *out = (t_sample *)(w[2]); t_bpctl *c = (t_bpctl *)(w[3]); int n = (t_int)(w[4]); int i; - float last = c->c_x1; - float prev = c->c_x2; - float coef1 = c->c_coef1; - float coef2 = c->c_coef2; - float gain = c->c_gain; + t_sample last = c->c_x1; + t_sample prev = c->c_x2; + t_sample coef1 = c->c_coef1; + t_sample coef2 = c->c_coef2; + t_sample gain = c->c_gain; for (i = 0; i < n; i++) { - float output = *in++ + coef1 * last + coef2 * prev; + t_sample output = *in++ + coef1 * last + coef2 * prev; *out++ = gain * output; prev = last; last = output; @@ -338,19 +338,19 @@ void sigbp_setup(void) typedef struct biquadctl { - float c_x1; - float c_x2; - float c_fb1; - float c_fb2; - float c_ff1; - float c_ff2; - float c_ff3; + t_sample c_x1; + t_sample c_x2; + t_sample c_fb1; + t_sample c_fb2; + t_sample c_ff1; + t_sample c_ff2; + t_sample c_ff3; } t_biquadctl; typedef struct sigbiquad { t_object x_obj; - float x_f; + t_float x_f; t_biquadctl x_cspace; t_biquadctl *x_ctl; } t_sigbiquad; @@ -372,21 +372,21 @@ static void *sigbiquad_new(t_symbol *s, int argc, t_atom *argv) static t_int *sigbiquad_perform(t_int *w) { - float *in = (float *)(w[1]); - float *out = (float *)(w[2]); + t_sample *in = (t_sample *)(w[1]); + t_sample *out = (t_sample *)(w[2]); t_biquadctl *c = (t_biquadctl *)(w[3]); int n = (t_int)(w[4]); int i; - float last = c->c_x1; - float prev = c->c_x2; - float fb1 = c->c_fb1; - float fb2 = c->c_fb2; - float ff1 = c->c_ff1; - float ff2 = c->c_ff2; - float ff3 = c->c_ff3; + t_sample last = c->c_x1; + t_sample prev = c->c_x2; + t_sample fb1 = c->c_fb1; + t_sample fb2 = c->c_fb2; + t_sample ff1 = c->c_ff1; + t_sample ff2 = c->c_ff2; + t_sample ff3 = c->c_ff3; for (i = 0; i < n; i++) { - float output = *in++ + fb1 * last + fb2 * prev; + t_sample output = *in++ + fb1 * last + fb2 * prev; if (PD_BIGORSMALL(output)) output = 0; *out++ = ff1 * output + ff2 * last + ff3 * prev; @@ -400,12 +400,12 @@ static t_int *sigbiquad_perform(t_int *w) static void sigbiquad_list(t_sigbiquad *x, t_symbol *s, int argc, t_atom *argv) { - 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_float fb1 = atom_getfloatarg(0, argc, argv); + t_float fb2 = atom_getfloatarg(1, argc, argv); + t_float ff1 = atom_getfloatarg(2, argc, argv); + t_float ff2 = atom_getfloatarg(3, argc, argv); + t_float ff3 = atom_getfloatarg(4, argc, argv); + t_float discriminant = fb1 * fb1 + 4 * fb2; t_biquadctl *c = x->x_ctl; if (discriminant < 0) /* imaginary roots -- resonant filter */ { @@ -465,9 +465,9 @@ void sigbiquad_setup(void) typedef struct sigsamphold { t_object x_obj; - float x_f; - float x_lastin; - float x_lastout; + t_float x_f; + t_sample x_lastin; + t_sample x_lastout; } t_sigsamphold; t_class *sigsamphold_class; @@ -485,17 +485,17 @@ static void *sigsamphold_new(void) static t_int *sigsamphold_perform(t_int *w) { - float *in1 = (float *)(w[1]); - float *in2 = (float *)(w[2]); - float *out = (float *)(w[3]); + t_sample *in1 = (t_sample *)(w[1]); + t_sample *in2 = (t_sample *)(w[2]); + t_sample *out = (t_sample *)(w[3]); t_sigsamphold *x = (t_sigsamphold *)(w[4]); int n = (t_int)(w[5]); int i; - float lastin = x->x_lastin; - float lastout = x->x_lastout; + t_sample lastin = x->x_lastin; + t_sample lastout = x->x_lastout; for (i = 0; i < n; i++, *in1++) { - float next = *in2++; + t_sample next = *in2++; if (next < lastin) lastout = *in1; *out++ = lastout; lastin = next; @@ -542,8 +542,8 @@ void sigsamphold_setup(void) typedef struct sigrpole { t_object x_obj; - float x_f; - float x_last; + t_float x_f; + t_sample x_last; } t_sigrpole; t_class *sigrpole_class; @@ -561,17 +561,17 @@ static void *sigrpole_new(t_float f) static t_int *sigrpole_perform(t_int *w) { - float *in1 = (float *)(w[1]); - float *in2 = (float *)(w[2]); - float *out = (float *)(w[3]); + t_sample *in1 = (t_sample *)(w[1]); + t_sample *in2 = (t_sample *)(w[2]); + t_sample *out = (t_sample *)(w[3]); t_sigrpole *x = (t_sigrpole *)(w[4]); int n = (t_int)(w[5]); int i; - float last = x->x_last; + t_sample last = x->x_last; for (i = 0; i < n; i++) { - float next = *in1++; - float coef = *in2++; + t_sample next = *in1++; + t_sample coef = *in2++; *out++ = last = coef * last + next; } if (PD_BIGORSMALL(last)) @@ -615,8 +615,8 @@ void sigrpole_setup(void) typedef struct sigrzero { t_object x_obj; - float x_f; - float x_last; + t_float x_f; + t_sample x_last; } t_sigrzero; t_class *sigrzero_class; @@ -634,17 +634,17 @@ static void *sigrzero_new(t_float f) static t_int *sigrzero_perform(t_int *w) { - float *in1 = (float *)(w[1]); - float *in2 = (float *)(w[2]); - float *out = (float *)(w[3]); + t_sample *in1 = (t_sample *)(w[1]); + t_sample *in2 = (t_sample *)(w[2]); + t_sample *out = (t_sample *)(w[3]); t_sigrzero *x = (t_sigrzero *)(w[4]); int n = (t_int)(w[5]); int i; - float last = x->x_last; + t_sample last = x->x_last; for (i = 0; i < n; i++) { - float next = *in1++; - float coef = *in2++; + t_sample next = *in1++; + t_sample coef = *in2++; *out++ = next - coef * last; last = next; } @@ -687,8 +687,8 @@ void sigrzero_setup(void) typedef struct sigrzero_rev { t_object x_obj; - float x_f; - float x_last; + t_float x_f; + t_sample x_last; } t_sigrzero_rev; t_class *sigrzero_rev_class; @@ -706,17 +706,17 @@ static void *sigrzero_rev_new(t_float f) static t_int *sigrzero_rev_perform(t_int *w) { - float *in1 = (float *)(w[1]); - float *in2 = (float *)(w[2]); - float *out = (float *)(w[3]); + t_sample *in1 = (t_sample *)(w[1]); + t_sample *in2 = (t_sample *)(w[2]); + t_sample *out = (t_sample *)(w[3]); t_sigrzero_rev *x = (t_sigrzero_rev *)(w[4]); int n = (t_int)(w[5]); int i; - float last = x->x_last; + t_sample last = x->x_last; for (i = 0; i < n; i++) { - float next = *in1++; - float coef = *in2++; + t_sample next = *in1++; + t_sample coef = *in2++; *out++ = last - coef * next; last = next; } @@ -760,9 +760,9 @@ void sigrzero_rev_setup(void) typedef struct sigcpole { t_object x_obj; - float x_f; - float x_lastre; - float x_lastim; + t_float x_f; + t_sample x_lastre; + t_sample x_lastim; } t_sigcpole; t_class *sigcpole_class; @@ -786,24 +786,24 @@ static void *sigcpole_new(t_float re, t_float im) static t_int *sigcpole_perform(t_int *w) { - float *inre1 = (float *)(w[1]); - float *inim1 = (float *)(w[2]); - float *inre2 = (float *)(w[3]); - float *inim2 = (float *)(w[4]); - float *outre = (float *)(w[5]); - float *outim = (float *)(w[6]); + t_sample *inre1 = (t_sample *)(w[1]); + t_sample *inim1 = (t_sample *)(w[2]); + t_sample *inre2 = (t_sample *)(w[3]); + t_sample *inim2 = (t_sample *)(w[4]); + t_sample *outre = (t_sample *)(w[5]); + t_sample *outim = (t_sample *)(w[6]); t_sigcpole *x = (t_sigcpole *)(w[7]); int n = (t_int)(w[8]); int i; - float lastre = x->x_lastre; - float lastim = x->x_lastim; + t_sample lastre = x->x_lastre; + t_sample lastim = x->x_lastim; for (i = 0; i < n; i++) { - float nextre = *inre1++; - float nextim = *inim1++; - float coefre = *inre2++; - float coefim = *inim2++; - float tempre = *outre++ = nextre + lastre * coefre - lastim * coefim; + t_sample nextre = *inre1++; + t_sample nextim = *inim1++; + t_sample coefre = *inre2++; + t_sample coefim = *inim2++; + t_sample tempre = *outre++ = nextre + lastre * coefre - lastim * coefim; lastim = *outim++ = nextim + lastre * coefim + lastim * coefre; lastre = tempre; } @@ -853,9 +853,9 @@ void sigcpole_setup(void) typedef struct sigczero { t_object x_obj; - float x_f; - float x_lastre; - float x_lastim; + t_float x_f; + t_sample x_lastre; + t_sample x_lastim; } t_sigczero; t_class *sigczero_class; @@ -879,23 +879,23 @@ static void *sigczero_new(t_float re, t_float im) static t_int *sigczero_perform(t_int *w) { - float *inre1 = (float *)(w[1]); - float *inim1 = (float *)(w[2]); - float *inre2 = (float *)(w[3]); - float *inim2 = (float *)(w[4]); - float *outre = (float *)(w[5]); - float *outim = (float *)(w[6]); + t_sample *inre1 = (t_sample *)(w[1]); + t_sample *inim1 = (t_sample *)(w[2]); + t_sample *inre2 = (t_sample *)(w[3]); + t_sample *inim2 = (t_sample *)(w[4]); + t_sample *outre = (t_sample *)(w[5]); + t_sample *outim = (t_sample *)(w[6]); t_sigczero *x = (t_sigczero *)(w[7]); int n = (t_int)(w[8]); int i; - float lastre = x->x_lastre; - float lastim = x->x_lastim; + t_sample lastre = x->x_lastre; + t_sample lastim = x->x_lastim; for (i = 0; i < n; i++) { - float nextre = *inre1++; - float nextim = *inim1++; - float coefre = *inre2++; - float coefim = *inim2++; + t_sample nextre = *inre1++; + t_sample nextim = *inim1++; + t_sample coefre = *inre2++; + t_sample coefim = *inim2++; *outre++ = nextre - lastre * coefre + lastim * coefim; *outim++ = nextim - lastre * coefim - lastim * coefre; lastre = nextre; @@ -943,9 +943,9 @@ void sigczero_setup(void) typedef struct sigczero_rev { t_object x_obj; - float x_f; - float x_lastre; - float x_lastim; + t_float x_f; + t_sample x_lastre; + t_sample x_lastim; } t_sigczero_rev; t_class *sigczero_rev_class; @@ -969,23 +969,23 @@ static void *sigczero_rev_new(t_float re, t_float im) static t_int *sigczero_rev_perform(t_int *w) { - float *inre1 = (float *)(w[1]); - float *inim1 = (float *)(w[2]); - float *inre2 = (float *)(w[3]); - float *inim2 = (float *)(w[4]); - float *outre = (float *)(w[5]); - float *outim = (float *)(w[6]); + t_sample *inre1 = (t_sample *)(w[1]); + t_sample *inim1 = (t_sample *)(w[2]); + t_sample *inre2 = (t_sample *)(w[3]); + t_sample *inim2 = (t_sample *)(w[4]); + t_sample *outre = (t_sample *)(w[5]); + t_sample *outim = (t_sample *)(w[6]); t_sigczero_rev *x = (t_sigczero_rev *)(w[7]); int n = (t_int)(w[8]); int i; - float lastre = x->x_lastre; - float lastim = x->x_lastim; + t_sample lastre = x->x_lastre; + t_sample lastim = x->x_lastim; for (i = 0; i < n; i++) { - float nextre = *inre1++; - float nextim = *inim1++; - float coefre = *inre2++; - float coefim = *inim2++; + t_sample nextre = *inre1++; + t_sample nextim = *inim1++; + t_sample coefre = *inre2++; + t_sample coefim = *inim2++; /* transfer function is (A bar) - Z^-1, for the same frequency response as 1 - AZ^-1 from czero_tilde. */ *outre++ = lastre - nextre * coefre - nextim * coefim; diff --git a/pd/src/d_global.c b/pd/src/d_global.c index ea6615be..b9a7cae1 100644 --- a/pd/src/d_global.c +++ b/pd/src/d_global.c @@ -17,8 +17,8 @@ typedef struct _sigsend t_object x_obj; t_symbol *x_sym; int x_n; - float *x_vec; - float x_f; + t_sample *x_vec; + t_float x_f; } t_sigsend; static void *sigsend_new(t_symbol *s) @@ -27,16 +27,16 @@ static void *sigsend_new(t_symbol *s) pd_bind(&x->x_obj.ob_pd, s); x->x_sym = s; x->x_n = DEFSENDVS; - x->x_vec = (float *)getbytes(DEFSENDVS * sizeof(float)); - memset((char *)(x->x_vec), 0, DEFSENDVS * sizeof(float)); + x->x_vec = (t_sample *)getbytes(DEFSENDVS * sizeof(t_sample)); + memset((char *)(x->x_vec), 0, DEFSENDVS * sizeof(t_sample)); x->x_f = 0; return (x); } static t_int *sigsend_perform(t_int *w) { - t_float *in = (t_float *)(w[1]); - t_float *out = (t_float *)(w[2]); + t_sample *in = (t_sample *)(w[1]); + t_sample *out = (t_sample *)(w[2]); int n = (int)(w[3]); while (n--) { @@ -57,7 +57,7 @@ static void sigsend_dsp(t_sigsend *x, t_signal **sp) static void sigsend_free(t_sigsend *x) { pd_unbind(&x->x_obj.ob_pd, x->x_sym); - freebytes(x->x_vec, x->x_n * sizeof(float)); + freebytes(x->x_vec, x->x_n * sizeof(t_sample)); } static void sigsend_setup(void) @@ -76,7 +76,7 @@ typedef struct _sigreceive { t_object x_obj; t_symbol *x_sym; - t_float *x_wherefrom; + t_sample *x_wherefrom; int x_n; } t_sigreceive; @@ -93,9 +93,9 @@ static void *sigreceive_new(t_symbol *s) static t_int *sigreceive_perform(t_int *w) { t_sigreceive *x = (t_sigreceive *)(w[1]); - t_float *out = (t_float *)(w[2]); + t_sample *out = (t_sample *)(w[2]); int n = (int)(w[3]); - t_float *in = x->x_wherefrom; + t_sample *in = x->x_wherefrom; if (in) { while (n--) @@ -113,9 +113,9 @@ static t_int *sigreceive_perform(t_int *w) static t_int *sigreceive_perf8(t_int *w) { t_sigreceive *x = (t_sigreceive *)(w[1]); - t_float *out = (t_float *)(w[2]); + t_sample *out = (t_sample *)(w[2]); int n = (int)(w[3]); - t_float *in = x->x_wherefrom; + t_sample *in = x->x_wherefrom; if (in) { for (; n; n -= 8, in += 8, out += 8) @@ -194,7 +194,7 @@ typedef struct _sigcatch t_object x_obj; t_symbol *x_sym; int x_n; - float *x_vec; + t_sample *x_vec; } t_sigcatch; static void *sigcatch_new(t_symbol *s) @@ -203,16 +203,16 @@ static void *sigcatch_new(t_symbol *s) pd_bind(&x->x_obj.ob_pd, s); x->x_sym = s; x->x_n = DEFSENDVS; - x->x_vec = (float *)getbytes(DEFSENDVS * sizeof(float)); - memset((char *)(x->x_vec), 0, DEFSENDVS * sizeof(float)); + x->x_vec = (t_sample *)getbytes(DEFSENDVS * sizeof(t_sample)); + memset((char *)(x->x_vec), 0, DEFSENDVS * sizeof(t_sample)); outlet_new(&x->x_obj, &s_signal); return (x); } static t_int *sigcatch_perform(t_int *w) { - t_float *in = (t_float *)(w[1]); - t_float *out = (t_float *)(w[2]); + t_sample *in = (t_sample *)(w[1]); + t_sample *out = (t_sample *)(w[2]); int n = (int)(w[3]); while (n--) *out++ = *in, *in++ = 0; return (w+4); @@ -221,8 +221,8 @@ static t_int *sigcatch_perform(t_int *w) /* tb: vectorized catch function */ static t_int *sigcatch_perf8(t_int *w) { - t_float *in = (t_float *)(w[1]); - t_float *out = (t_float *)(w[2]); + t_sample *in = (t_sample *)(w[1]); + t_sample *out = (t_sample *)(w[2]); int n = (int)(w[3]); for (; n; n -= 8, in += 8, out += 8) { @@ -250,7 +250,7 @@ static void sigcatch_dsp(t_sigcatch *x, t_signal **sp) static void sigcatch_free(t_sigcatch *x) { pd_unbind(&x->x_obj.ob_pd, x->x_sym); - freebytes(x->x_vec, x->x_n * sizeof(float)); + freebytes(x->x_vec, x->x_n * sizeof(t_sample)); } static void sigcatch_setup(void) @@ -268,7 +268,7 @@ typedef struct _sigthrow { t_object x_obj; t_symbol *x_sym; - t_float *x_whereto; + t_sample *x_whereto; int x_n; t_float x_f; } t_sigthrow; @@ -286,9 +286,9 @@ static void *sigthrow_new(t_symbol *s) static t_int *sigthrow_perform(t_int *w) { t_sigthrow *x = (t_sigthrow *)(w[1]); - t_float *in = (t_float *)(w[2]); + t_sample *in = (t_sample *)(w[2]); int n = (int)(w[3]); - t_float *out = x->x_whereto; + t_sample *out = x->x_whereto; if (out) { while (n--) diff --git a/pd/src/d_math.c b/pd/src/d_math.c index 44f23e3d..213b866e 100644 --- a/pd/src/d_math.c +++ b/pd/src/d_math.c @@ -16,9 +16,9 @@ static t_class *clip_class; typedef struct _clip { t_object x_obj; - float x_f; - t_sample x_lo; - t_sample x_hi; + t_float x_f; + t_float x_lo; + t_float x_hi; } t_clip; static void *clip_new(t_floatarg lo, t_floatarg hi) @@ -36,12 +36,12 @@ static void *clip_new(t_floatarg lo, t_floatarg hi) static t_int *clip_perform(t_int *w) { t_clip *x = (t_clip *)(w[1]); - t_float *in = (t_float *)(w[2]); - t_float *out = (t_float *)(w[3]); + t_sample *in = (t_sample *)(w[2]); + t_sample *out = (t_sample *)(w[3]); int n = (int)(w[4]); while (n--) { - float f = *in++; + t_sample f = *in++; if (f < x->x_lo) f = x->x_lo; if (f > x->x_hi) f = x->x_hi; *out++ = f; @@ -125,7 +125,7 @@ float qrsqrt(float f) {return (q8_rsqrt(f)); } typedef struct sigrsqrt { t_object x_obj; - float x_f; + t_float x_f; } t_sigrsqrt; static t_class *sigrsqrt_class; @@ -140,16 +140,16 @@ static void *sigrsqrt_new(void) static t_int *sigrsqrt_perform(t_int *w) { - float *in = *(t_float **)(w+1), *out = *(t_float **)(w+2); + t_sample *in = *(t_sample **)(w+1), *out = *(t_sample **)(w+2); t_int n = *(t_int *)(w+3); while (n--) { - float f = *in; + t_sample f = *in; long l = *(long *)(in++); if (f < 0) *out++ = 0; else { - float g = rsqrt_exptab[(l >> 23) & 0xff] * + t_sample g = rsqrt_exptab[(l >> 23) & 0xff] * rsqrt_mantissatab[(l >> 13) & 0x3ff]; *out++ = 1.5 * g - 0.5 * g * g * g * f; } @@ -179,7 +179,7 @@ void sigrsqrt_setup(void) typedef struct sigsqrt { t_object x_obj; - float x_f; + t_float x_f; } t_sigsqrt; static t_class *sigsqrt_class; @@ -194,16 +194,16 @@ static void *sigsqrt_new(void) t_int *sigsqrt_perform(t_int *w) /* not static; also used in d_fft.c */ { - float *in = *(t_float **)(w+1), *out = *(t_float **)(w+2); + t_sample *in = *(t_sample **)(w+1), *out = *(t_sample **)(w+2); t_int n = *(t_int *)(w+3); while (n--) { - float f = *in; + t_sample f = *in; long l = *(long *)(in++); if (f < 0) *out++ = 0; else { - float g = rsqrt_exptab[(l >> 23) & 0xff] * + t_sample g = rsqrt_exptab[(l >> 23) & 0xff] * rsqrt_mantissatab[(l >> 13) & 0x3ff]; *out++ = f * (1.5 * g - 0.5 * g * g * g * f); } @@ -230,7 +230,7 @@ void sigsqrt_setup(void) typedef struct wrap { t_object x_obj; - float x_f; + t_float x_f; } t_sigwrap; t_class *sigwrap_class; @@ -245,11 +245,11 @@ static void *sigwrap_new(void) static t_int *sigwrap_perform(t_int *w) { - float *in = *(t_float **)(w+1), *out = *(t_float **)(w+2); + t_sample *in = *(t_sample **)(w+1), *out = *(t_sample **)(w+2); t_int n = *(t_int *)(w+3); while (n--) { - float f = *in++; + t_sample f = *in++; int k = f; if (f > 0) *out++ = f-k; else *out++ = f - (k-1); @@ -275,7 +275,7 @@ void sigwrap_setup(void) typedef struct mtof_tilde { t_object x_obj; - float x_f; + t_float x_f; } t_mtof_tilde; t_class *mtof_tilde_class; @@ -290,11 +290,11 @@ static void *mtof_tilde_new(void) static t_int *mtof_tilde_perform(t_int *w) { - float *in = *(t_float **)(w+1), *out = *(t_float **)(w+2); + t_sample *in = *(t_sample **)(w+1), *out = *(t_sample **)(w+2); t_int n = *(t_int *)(w+3); for (; n--; in++, out++) { - float f = *in; + t_sample f = *in; if (f <= -1500) *out = 0; else { @@ -323,7 +323,7 @@ void mtof_tilde_setup(void) typedef struct ftom_tilde { t_object x_obj; - float x_f; + t_float x_f; } t_ftom_tilde; t_class *ftom_tilde_class; @@ -338,11 +338,11 @@ static void *ftom_tilde_new(void) static t_int *ftom_tilde_perform(t_int *w) { - float *in = *(t_float **)(w+1), *out = *(t_float **)(w+2); + t_sample *in = *(t_sample **)(w+1), *out = *(t_sample **)(w+2); t_int n = *(t_int *)(w+3); for (; n--; *in++, out++) { - float f = *in; + t_sample f = *in; *out = (f > 0 ? 17.3123405046 * log(.12231220585 * f) : -1500); } return (w + 4); @@ -366,7 +366,7 @@ void ftom_tilde_setup(void) typedef struct dbtorms_tilde { t_object x_obj; - float x_f; + t_float x_f; } t_dbtorms_tilde; t_class *dbtorms_tilde_class; @@ -381,11 +381,11 @@ static void *dbtorms_tilde_new(void) static t_int *dbtorms_tilde_perform(t_int *w) { - float *in = *(t_float **)(w+1), *out = *(t_float **)(w+2); + t_sample *in = *(t_sample **)(w+1), *out = *(t_sample **)(w+2); t_int n = *(t_int *)(w+3); for (; n--; in++, out++) { - float f = *in; + t_sample f = *in; if (f <= 0) *out = 0; else { @@ -415,7 +415,7 @@ void dbtorms_tilde_setup(void) typedef struct rmstodb_tilde { t_object x_obj; - float x_f; + t_float x_f; } t_rmstodb_tilde; t_class *rmstodb_tilde_class; @@ -430,15 +430,15 @@ static void *rmstodb_tilde_new(void) static t_int *rmstodb_tilde_perform(t_int *w) { - float *in = *(t_float **)(w+1), *out = *(t_float **)(w+2); + t_sample *in = *(t_sample **)(w+1), *out = *(t_sample **)(w+2); t_int n = *(t_int *)(w+3); for (; n--; in++, out++) { - float f = *in; + t_sample f = *in; if (f <= 0) *out = 0; else { - float g = 100 + 20./LOGTEN * log(f); + t_sample g = 100 + 20./LOGTEN * log(f); *out = (g < 0 ? 0 : g); } } @@ -463,7 +463,7 @@ void rmstodb_tilde_setup(void) typedef struct dbtopow_tilde { t_object x_obj; - float x_f; + t_float x_f; } t_dbtopow_tilde; t_class *dbtopow_tilde_class; @@ -478,11 +478,11 @@ static void *dbtopow_tilde_new(void) static t_int *dbtopow_tilde_perform(t_int *w) { - float *in = *(t_float **)(w+1), *out = *(t_float **)(w+2); + t_sample *in = *(t_sample **)(w+1), *out = *(t_sample **)(w+2); t_int n = *(t_int *)(w+3); for (; n--; in++, out++) { - float f = *in; + t_sample f = *in; if (f <= 0) *out = 0; else { @@ -512,7 +512,7 @@ void dbtopow_tilde_setup(void) typedef struct powtodb_tilde { t_object x_obj; - float x_f; + t_float x_f; } t_powtodb_tilde; t_class *powtodb_tilde_class; @@ -527,15 +527,15 @@ static void *powtodb_tilde_new(void) static t_int *powtodb_tilde_perform(t_int *w) { - float *in = *(t_float **)(w+1), *out = *(t_float **)(w+2); + t_sample *in = *(t_sample **)(w+1), *out = *(t_sample **)(w+2); t_int n = *(t_int *)(w+3); for (; n--; in++, out++) { - float f = *in; + t_sample f = *in; if (f <= 0) *out = 0; else { - float g = 100 + 10./LOGTEN * log(f); + t_sample g = 100 + 10./LOGTEN * log(f); *out = (g < 0 ? 0 : g); } } diff --git a/pd/src/d_misc.c b/pd/src/d_misc.c index 3a327dc5..444986ea 100644 --- a/pd/src/d_misc.c +++ b/pd/src/d_misc.c @@ -15,7 +15,7 @@ static t_class *print_class; typedef struct _print { t_object x_obj; - float x_f; + t_float x_f; t_symbol *x_sym; int x_count; } t_print; @@ -23,22 +23,17 @@ typedef struct _print static t_int *print_perform(t_int *w) { t_print *x = (t_print *)(w[1]); - t_float *in = (t_float *)(w[2]); + t_sample *in = (t_sample *)(w[2]); int n = (int)(w[3]); if (x->x_count) { - post("%s:", x->x_sym->s_name); - if (n == 1) post("%8g", in[0]); - else if (n == 2) post("%8g %8g", in[0], in[1]); - else if (n == 4) post("%8g %8g %8g %8g", - in[0], in[1], in[2], in[3]); - else while (n > 0) - { - post("%-8.5g %-8.5g %-8.5g %-8.5g %-8.5g %-8.5g %-8.5g %-8.5g", - in[0], in[1], in[2], in[3], in[4], in[5], in[6], in[7]); - n -= 8; - in += 8; + int i=0; + startpost("%s:", x->x_sym->s_name); + for(i=0; i<n; i++) { + if(i%8==0)endpost(); + startpost("%-8.5g", in[i]); } + endpost(); x->x_count--; } return (w+4); diff --git a/pd/src/d_osc.c b/pd/src/d_osc.c index b0becdba..93b1a89e 100644 --- a/pd/src/d_osc.c +++ b/pd/src/d_osc.c @@ -479,7 +479,7 @@ static void *noise_new(void) static t_int *noise_perform(t_int *w) { - t_float *out = (t_float *)(w[1]); + t_sample *out = (t_sample *)(w[1]); int *vp = (int *)(w[2]); int n = (int)(w[3]); int val = *vp; diff --git a/pd/src/d_resample.c b/pd/src/d_resample.c index 97ba1743..255af71d 100644 --- a/pd/src/d_resample.c +++ b/pd/src/d_resample.c @@ -8,8 +8,8 @@ /* --------------------- up/down-sampling --------------------- */ t_int *downsampling_perform_0(t_int *w) { - t_float *in = (t_float *)(w[1]); /* original signal */ - t_float *out = (t_float *)(w[2]); /* downsampled signal */ + t_sample *in = (t_sample *)(w[1]); /* original signal */ + t_sample *out = (t_sample *)(w[2]); /* downsampled signal */ int down = (int)(w[3]); /* downsampling factor */ int parent = (int)(w[4]); /* original vectorsize */ @@ -25,13 +25,13 @@ t_int *downsampling_perform_0(t_int *w) t_int *upsampling_perform_0(t_int *w) { - t_float *in = (t_float *)(w[1]); /* original signal */ - t_float *out = (t_float *)(w[2]); /* upsampled signal */ + t_sample *in = (t_sample *)(w[1]); /* original signal */ + t_sample *out = (t_sample *)(w[2]); /* upsampled signal */ int up = (int)(w[3]); /* upsampling factor */ int parent = (int)(w[4]); /* original vectorsize */ int n=parent*up; - t_float *dummy = out; + t_sample *dummy = out; while(n--)*out++=0; @@ -47,15 +47,15 @@ t_int *upsampling_perform_0(t_int *w) t_int *upsampling_perform_hold(t_int *w) { - t_float *in = (t_float *)(w[1]); /* original signal */ - t_float *out = (t_float *)(w[2]); /* upsampled signal */ + t_sample *in = (t_sample *)(w[1]); /* original signal */ + t_sample *out = (t_sample *)(w[2]); /* upsampled signal */ int up = (int)(w[3]); /* upsampling factor */ int parent = (int)(w[4]); /* original vectorsize */ int i=up; int n=parent; - t_float *dum_out = out; - t_float *dum_in = in; + t_sample *dum_out = out; + t_sample *dum_in = in; while (i--) { n = parent; @@ -72,20 +72,20 @@ t_int *upsampling_perform_hold(t_int *w) t_int *upsampling_perform_linear(t_int *w) { t_resample *x= (t_resample *)(w[1]); - t_float *in = (t_float *)(w[2]); /* original signal */ - t_float *out = (t_float *)(w[3]); /* upsampled signal */ + t_sample *in = (t_sample *)(w[2]); /* original signal */ + t_sample *out = (t_sample *)(w[3]); /* upsampled signal */ int up = (int)(w[4]); /* upsampling factor */ int parent = (int)(w[5]); /* original vectorsize */ int length = parent*up; int n; - t_float *fp; - t_float a=*x->buffer, b=*in; + t_sample *fp; + t_sample a=*x->buffer, b=*in; for (n=0; n<length; n++) { - t_float findex = (t_float)(n+1)/up; + t_sample findex = (t_sample)(n+1)/up; int index = findex; - t_float frac=findex - index; + t_sample frac=findex - index; if (frac==0.)frac=1.; *out++ = frac * b + (1.-frac) * a; fp = in+index; @@ -180,9 +180,9 @@ void resamplefrom_dsp(t_resample *x, } if (x->s_n != outsize) { - t_float *buf=x->s_vec; + t_sample *buf=x->s_vec; t_freebytes(buf, x->s_n * sizeof(*buf)); - buf = (t_float *)t_getbytes(outsize * sizeof(*buf)); + buf = (t_sample *)t_getbytes(outsize * sizeof(*buf)); x->s_vec = buf; x->s_n = outsize; } @@ -203,9 +203,9 @@ void resampleto_dsp(t_resample *x, } if (x->s_n != insize) { - t_float *buf=x->s_vec; + t_sample *buf=x->s_vec; t_freebytes(buf, x->s_n * sizeof(*buf)); - buf = (t_float *)t_getbytes(insize * sizeof(*buf)); + buf = (t_sample *)t_getbytes(insize * sizeof(*buf)); x->s_vec = buf; x->s_n = insize; } diff --git a/pd/src/d_soundfile.c b/pd/src/d_soundfile.c index 93578e65..8768fa55 100644 --- a/pd/src/d_soundfile.c +++ b/pd/src/d_soundfile.c @@ -425,13 +425,81 @@ int open_soundfile_via_canvas(t_canvas *canvas, const char *filename, int header p_bigendian, p_nchannels, p_bytelimit, skipframes)); } -static void soundfile_xferin(int sfchannels, int nvecs, float **vecs, +static void soundfile_xferin_sample(int sfchannels, int nvecs, t_sample **vecs, long itemsread, unsigned char *buf, int nitems, int bytespersamp, int bigendian, int spread) { int i, j; unsigned char *sp, *sp2; - float *fp; + t_sample *fp; + int nchannels = (sfchannels < nvecs ? sfchannels : nvecs); + int bytesperframe = bytespersamp * sfchannels; + for (i = 0, sp = buf; i < nchannels; i++, sp += bytespersamp) + { + if (bytespersamp == 2) + { + if (bigendian) + { + for (j = 0, sp2 = sp, fp=vecs[i] + spread * itemsread; + j < nitems; j++, sp2 += bytesperframe, fp += spread) + *fp = SCALE * ((sp2[0] << 24) | (sp2[1] << 16)); + } + else + { + for (j = 0, sp2 = sp, fp=vecs[i] + spread * itemsread; + j < nitems; j++, sp2 += bytesperframe, fp += spread) + *fp = SCALE * ((sp2[1] << 24) | (sp2[0] << 16)); + } + } + else if (bytespersamp == 3) + { + if (bigendian) + { + for (j = 0, sp2 = sp, fp=vecs[i] + spread * itemsread; + j < nitems; j++, sp2 += bytesperframe, fp += spread) + *fp = SCALE * ((sp2[0] << 24) | (sp2[1] << 16) + | (sp2[2] << 8)); + } + else + { + for (j = 0, sp2 = sp, fp=vecs[i] + spread * itemsread; + j < nitems; j++, sp2 += bytesperframe, fp += spread) + *fp = SCALE * ((sp2[2] << 24) | (sp2[1] << 16) + | (sp2[0] << 8)); + } + } + else if (bytespersamp == 4) + { + if (bigendian) + { + for (j = 0, sp2 = sp, fp=vecs[i] + spread * itemsread; + j < nitems; j++, sp2 += bytesperframe, fp += spread) + *(long *)fp = ((sp2[0] << 24) | (sp2[1] << 16) + | (sp2[2] << 8) | sp2[3]); + } + else + { + for (j = 0, sp2 = sp, fp=vecs[i] + spread * itemsread; + j < nitems; j++, sp2 += bytesperframe, fp += spread) + *(long *)fp = ((sp2[3] << 24) | (sp2[2] << 16) + | (sp2[1] << 8) | sp2[0]); + } + } + } + /* zero out other outputs */ + for (i = sfchannels; i < nvecs; i++) + for (j = nitems, fp = vecs[i]; j--; ) + *fp++ = 0; + +} + +static void soundfile_xferin_float(int sfchannels, int nvecs, t_float **vecs, + long itemsread, unsigned char *buf, int nitems, int bytespersamp, + int bigendian, int spread) +{ + int i, j; + unsigned char *sp, *sp2; + t_float *fp; int nchannels = (sfchannels < nvecs ? sfchannels : nvecs); int bytesperframe = bytespersamp * sfchannels; for (i = 0, sp = buf; i < nchannels; i++, sp += bytespersamp) @@ -518,7 +586,7 @@ static void soundfile_xferin(int sfchannels, int nvecs, float **vecs, static int soundfiler_writeargparse(void *obj, int *p_argc, t_atom **p_argv, t_symbol **p_filesym, int *p_filetype, int *p_bytespersamp, int *p_swap, int *p_bigendian, - int *p_normalize, long *p_onset, long *p_nframes, float *p_rate) + int *p_normalize, long *p_onset, long *p_nframes, t_float *p_rate) { int argc = *p_argc; t_atom *argv = *p_argv; @@ -526,7 +594,7 @@ static int soundfiler_writeargparse(void *obj, int *p_argc, t_atom **p_argv, endianness = -1, swap, filetype = -1, normalize = 0; long onset = 0, nframes = 0x7fffffff; t_symbol *filesym; - float rate = -1; + t_float rate = -1; while (argc > 0 && argv->a_type == A_SYMBOL && *argv->a_w.w_symbol->s_name == '-') @@ -668,7 +736,7 @@ usage: static int create_soundfile(t_canvas *canvas, const char *filename, int filetype, int nframes, int bytespersamp, - int bigendian, int nchannels, int swap, float samplerate) + int bigendian, int nchannels, int swap, t_float samplerate) { char filenamebuf[MAXPDSTRING], buf2[MAXPDSTRING]; char headerbuf[WRITEHDRSIZE]; @@ -827,20 +895,20 @@ baddonewrite: post("%s: %s", filename, strerror(errno)); } -static void soundfile_xferout(int nchannels, float **vecs, +static void soundfile_xferout_sample(int nchannels, t_sample **vecs, unsigned char *buf, int nitems, long onset, int bytespersamp, - int bigendian, float normalfactor, int spread) + int bigendian, t_sample normalfactor, int spread) { int i, j; unsigned char *sp, *sp2; - float *fp; + t_sample *fp; int bytesperframe = bytespersamp * nchannels; long xx; for (i = 0, sp = buf; i < nchannels; i++, sp += bytespersamp) { if (bytespersamp == 2) { - float ff = normalfactor * 32768.; + t_sample ff = normalfactor * 32768.; if (bigendian) { for (j = 0, sp2 = sp, fp = vecs[i] + onset; @@ -874,7 +942,7 @@ static void soundfile_xferout(int nchannels, float **vecs, } else if (bytespersamp == 3) { - float ff = normalfactor * 8388608.; + t_sample ff = normalfactor * 8388608.; if (bigendian) { for (j = 0, sp2 = sp, fp=vecs[i] + onset; @@ -915,7 +983,7 @@ static void soundfile_xferout(int nchannels, float **vecs, for (j = 0, sp2 = sp, fp=vecs[i] + onset; j < nitems; j++, sp2 += bytesperframe, fp += spread) { - float f2 = *fp * normalfactor; + t_sample f2 = *fp * normalfactor; xx = *(long *)&f2; sp2[0] = (xx >> 24); sp2[1] = (xx >> 16); sp2[2] = (xx >> 8); sp2[3] = xx; @@ -926,7 +994,115 @@ static void soundfile_xferout(int nchannels, float **vecs, for (j = 0, sp2 = sp, fp=vecs[i] + onset; j < nitems; j++, sp2 += bytesperframe, fp += spread) { - float f2 = *fp * normalfactor; + t_sample f2 = *fp * normalfactor; + xx = *(long *)&f2; + sp2[3] = (xx >> 24); sp2[2] = (xx >> 16); + sp2[1] = (xx >> 8); sp2[0] = xx; + } + } + } + } +} +static void soundfile_xferout_float(int nchannels, t_float **vecs, + unsigned char *buf, int nitems, long onset, int bytespersamp, + int bigendian, t_sample normalfactor, int spread) +{ + int i, j; + unsigned char *sp, *sp2; + t_float *fp; + int bytesperframe = bytespersamp * nchannels; + long xx; + for (i = 0, sp = buf; i < nchannels; i++, sp += bytespersamp) + { + if (bytespersamp == 2) + { + t_sample ff = normalfactor * 32768.; + if (bigendian) + { + for (j = 0, sp2 = sp, fp = vecs[i] + onset; + j < nitems; j++, sp2 += bytesperframe, fp += spread) + { + int xx = 32768. + (*fp * ff); + xx -= 32768; + if (xx < -32767) + xx = -32767; + if (xx > 32767) + xx = 32767; + sp2[0] = (xx >> 8); + sp2[1] = xx; + } + } + else + { + for (j = 0, sp2 = sp, fp=vecs[i] + onset; + j < nitems; j++, sp2 += bytesperframe, fp += spread) + { + int xx = 32768. + (*fp * ff); + xx -= 32768; + if (xx < -32767) + xx = -32767; + if (xx > 32767) + xx = 32767; + sp2[1] = (xx >> 8); + sp2[0] = xx; + } + } + } + else if (bytespersamp == 3) + { + t_sample ff = normalfactor * 8388608.; + if (bigendian) + { + for (j = 0, sp2 = sp, fp=vecs[i] + onset; + j < nitems; j++, sp2 += bytesperframe, fp += spread) + { + int xx = 8388608. + (*fp * ff); + xx -= 8388608; + if (xx < -8388607) + xx = -8388607; + if (xx > 8388607) + xx = 8388607; + sp2[0] = (xx >> 16); + sp2[1] = (xx >> 8); + sp2[2] = xx; + } + } + else + { + for (j = 0, sp2 = sp, fp=vecs[i] + onset; + j < nitems; j++, sp2 += bytesperframe, fp += spread) + { + int xx = 8388608. + (*fp * ff); + xx -= 8388608; + if (xx < -8388607) + xx = -8388607; + if (xx > 8388607) + xx = 8388607; + sp2[2] = (xx >> 16); + sp2[1] = (xx >> 8); + sp2[0] = xx; + } + } + } + else if (bytespersamp == 4) + { + if (bigendian) + { + for (j = 0, sp2 = sp, fp=vecs[i] + onset; + j < nitems; j++, sp2 += bytesperframe, fp += spread) + { + t_sample f2 = *fp * normalfactor; + xx = *(long *)&f2; + sp2[0] = (xx >> 24); sp2[1] = (xx >> 16); + sp2[2] = (xx >> 8); sp2[3] = xx; + } + } + else + { + for (j = 0, sp2 = sp, fp=vecs[i] + onset; + j < nitems; j++, sp2 += bytesperframe, fp += spread) + { + t_sample f2 = *fp * normalfactor; xx = *(long *)&f2; sp2[3] = (xx >> 24); sp2[2] = (xx >> 16); sp2[1] = (xx >> 8); sp2[0] = xx; @@ -935,7 +1111,6 @@ static void soundfile_xferout(int nchannels, float **vecs, } } } - /* ------- soundfiler - reads and writes soundfiles to/from "garrays" ---- */ #define DEFMAXSIZE 4000000 /* default maximum 16 MB per channel */ @@ -1121,9 +1296,9 @@ static void soundfiler_read(t_soundfiler *x, t_symbol *s, thisread = (thisread > bufframes ? bufframes : thisread); nitems = fread(sampbuf, channels * bytespersamp, thisread, fp); if (nitems <= 0) break; - soundfile_xferin(channels, argc, (float **)vecs, itemsread, + soundfile_xferin_float(channels, argc, (t_float **)vecs, itemsread, (unsigned char *)sampbuf, nitems, bytespersamp, bigendian, - sizeof(t_word)/sizeof(float)); + sizeof(t_word)/sizeof(t_sample)); itemsread += nitems; } /* zero out remaining elements of vectors */ @@ -1157,7 +1332,7 @@ usage: done: if (fd >= 0) close (fd); - outlet_float(x->x_obj.ob_outlet, (float)itemsread); + outlet_float(x->x_obj.ob_outlet, (t_float)itemsread); } /* this is broken out from soundfiler_write below so garray_write can @@ -1175,7 +1350,8 @@ long soundfiler_dowrite(void *obj, t_canvas *canvas, char sampbuf[SAMPBUFSIZE]; int bufframes, nitems; int fd = -1; - float normfactor, biggest = 0, samplerate; + t_sample normfactor, biggest = 0; + t_float samplerate; t_symbol *filesym; if (soundfiler_writeargparse(obj, &argc, &argv, &filesym, &filetype, @@ -1244,9 +1420,9 @@ long soundfiler_dowrite(void *obj, t_canvas *canvas, { int thiswrite = nframes - itemswritten, nitems, nbytes; thiswrite = (thiswrite > bufframes ? bufframes : thiswrite); - soundfile_xferout(argc, (t_float **)vecs, (unsigned char *)sampbuf, + soundfile_xferout_float(argc, (t_float **)vecs, (unsigned char *)sampbuf, thiswrite, onset, bytespersamp, bigendian, normfactor, - sizeof(t_word)/sizeof(float)); + sizeof(t_word)/sizeof(t_sample)); nbytes = write(fd, sampbuf, nchannels * bytespersamp * thiswrite); if (nbytes < nchannels * bytespersamp * thiswrite) { @@ -1256,7 +1432,7 @@ long soundfiler_dowrite(void *obj, t_canvas *canvas, break; } itemswritten += thiswrite; - onset += thiswrite; + onset += thiswrite * (sizeof(t_word)/sizeof(float)); } if (fd >= 0) { @@ -1281,7 +1457,7 @@ static void soundfiler_write(t_soundfiler *x, t_symbol *s, { long bozo = soundfiler_dowrite(x, x->x_canvas, argc, argv); - outlet_float(x->x_obj.ob_outlet, (float)bozo); + outlet_float(x->x_obj.ob_outlet, (t_float)bozo); } static void soundfiler_setup(void) @@ -1343,7 +1519,7 @@ typedef struct _readsf int x_vecsize; /* vector size for transfers */ t_outlet *x_bangout; /* bang-on-done outlet */ int x_state; /* opened, running, or idle */ - float x_insamplerate; /* sample rate of input signal if known */ + t_float x_insamplerate; /* sample rate of input signal if known */ /* parameters to communicate with subthread */ int x_requestcode; /* pending request from parent to I/O thread */ char *x_filename; /* file to open (string is permanently allocated) */ @@ -1352,7 +1528,7 @@ typedef struct _readsf int x_bytespersample; /* bytes per sample (2 or 3) */ int x_bigendian; /* true if file is big-endian */ int x_sfchannels; /* number of channels in soundfile */ - float x_samplerate; /* sample rate of soundfile */ + t_float x_samplerate; /* sample rate of soundfile */ long x_onsetframes; /* number of sample frames to skip */ long x_bytelimit; /* max number of data bytes to read */ int x_fd; /* filedesc */ @@ -1365,7 +1541,7 @@ typedef struct _readsf int x_filetype; /* writesf~ only; type of file to create */ int x_itemswritten; /* writesf~ only; items writen */ int x_swap; /* writesf~ only; true if byte swapping */ - float x_f; /* writesf~ only; scalar for signal inlet */ + t_float x_f; /* writesf~ only; scalar for signal inlet */ pthread_mutex_t x_mutex; pthread_cond_t x_requestcondition; pthread_cond_t x_answercondition; @@ -1744,7 +1920,7 @@ static t_int *readsf_perform(t_int *w) int vecsize = x->x_vecsize, noutlets = x->x_noutlets, i, j, bytespersample = x->x_bytespersample, bigendian = x->x_bigendian; - float *fp; + t_sample *fp; if (x->x_state == STATE_STREAM) { int wantbytes, nchannels, sfchannels = x->x_sfchannels; @@ -1788,7 +1964,7 @@ static t_int *readsf_perform(t_int *w) (sfchannels * bytespersample); if (xfersize) { - soundfile_xferin(sfchannels, noutlets, x->x_outvec, 0, + soundfile_xferin_sample(sfchannels, noutlets, x->x_outvec, 0, (unsigned char *)(x->x_buf + x->x_fifotail), xfersize, bytespersample, bigendian, 1); vecsize -= xfersize; @@ -1803,7 +1979,7 @@ static t_int *readsf_perform(t_int *w) return (w+2); } - soundfile_xferin(sfchannels, noutlets, x->x_outvec, 0, + soundfile_xferin_sample(sfchannels, noutlets, x->x_outvec, 0, (unsigned char *)(x->x_buf + x->x_fifotail), vecsize, bytespersample, bigendian, 1); @@ -1999,7 +2175,7 @@ static void *writesf_child_main(void *zz) int filetype = x->x_filetype; char *filename = x->x_filename; t_canvas *canvas = x->x_canvas; - float samplerate = x->x_samplerate; + t_float samplerate = x->x_samplerate; /* alter the request code so that an ensuing "open" will get noticed. */ @@ -2244,7 +2420,7 @@ static t_int *writesf_perform(t_int *w) int vecsize = x->x_vecsize, sfchannels = x->x_sfchannels, i, j, bytespersample = x->x_bytespersample, bigendian = x->x_bigendian; - float *fp; + t_sample *fp; if (x->x_state == STATE_STREAM) { int wantbytes; @@ -2263,7 +2439,7 @@ static t_int *writesf_perform(t_int *w) #endif } - soundfile_xferout(sfchannels, x->x_outvec, + soundfile_xferout_sample(sfchannels, x->x_outvec, (unsigned char *)(x->x_buf + x->x_fifohead), vecsize, 0, bytespersample, bigendian, 1., 1); @@ -2316,7 +2492,7 @@ static void writesf_open(t_writesf *x, t_symbol *s, int argc, t_atom *argv) t_symbol *filesym; int filetype, bytespersamp, swap, bigendian, normalize; long onset, nframes; - float samplerate; + t_float samplerate; if (x->x_state != STATE_IDLE) { writesf_stop(x); diff --git a/pd/src/d_ugen.c b/pd/src/d_ugen.c index f7f27aa7..fe49b7de 100644 --- a/pd/src/d_ugen.c +++ b/pd/src/d_ugen.c @@ -18,7 +18,7 @@ #include <stdarg.h> extern t_class *vinlet_class, *voutlet_class, *canvas_class; -t_sample *obj_findsignalscalar(t_object *x, int m); +t_float *obj_findsignalscalar(t_object *x, int m); static int ugen_loud; static t_int *dsp_chain; static int dsp_chainsize; @@ -38,7 +38,7 @@ void voutlet_dspepilog(struct _voutlet *x, t_signal **parentsigs, t_int *zero_perform(t_int *w) /* zero out a vector */ { - t_float *out = (t_float *)(w[1]); + t_sample *out = (t_sample *)(w[1]); int n = (int)(w[2]); while (n--) *out++ = 0; return (w+3); @@ -46,7 +46,7 @@ t_int *zero_perform(t_int *w) /* zero out a vector */ t_int *zero_perf8(t_int *w) { - t_float *out = (t_float *)(w[1]); + t_sample *out = (t_sample *)(w[1]); int n = (int)(w[2]); for (; n; n -= 8, out += 8) @@ -427,7 +427,7 @@ void signal_makereusable(t_signal *sig) signal whose buffer and size will be obtained later via signal_setborrowed(). */ -t_signal *signal_new(int n, float sr) +t_signal *signal_new(int n, t_float sr) { int logn, n2, vecsize = 0; t_signal *ret, **whichlist; @@ -539,7 +539,7 @@ struct _dspcontext int dc_ninlets; int dc_noutlets; t_signal **dc_iosigs; - float dc_srate; + t_float dc_srate; int dc_vecsize; /* vector size, power of two */ int dc_calcsize; /* number of elements to calculate */ char dc_toplevel; /* true if "iosigs" is invalid. */ @@ -612,7 +612,7 @@ t_dspcontext *ugen_start_graph(int toplevel, t_signal **sp, int ninlets, int noutlets) { t_dspcontext *dc = (t_dspcontext *)getbytes(sizeof(*dc)); - float parent_srate, srate; + t_float parent_srate, srate; int parent_vecsize, vecsize; if (ugen_loud) post("ugen_start_graph..."); @@ -732,7 +732,7 @@ static void ugen_doit(t_dspcontext *dc, t_ugenbox *u) { if (!uin->i_nconnect) { - t_sample *scalar; + t_float *scalar; s3 = signal_new(dc->dc_vecsize, dc->dc_srate); /* post("%s: unconnected signal inlet set to zero", class_getname(u->u_obj->ob_pd)); */ @@ -867,10 +867,10 @@ void ugen_done_graph(t_dspcontext *dc) int i, n; t_block *blk; t_dspcontext *parent_context = dc->dc_parentcontext; - float parent_srate; + t_float parent_srate; int parent_vecsize; int period, frequency, phase, vecsize, calcsize; - float srate; + t_float srate; int chainblockbegin; /* DSP chain onset before block prolog code */ int chainblockend; /* and after block epilog code */ int chainafterall; /* and after signal outlet epilog */ @@ -1153,7 +1153,7 @@ static t_class *samplerate_tilde_class; typedef struct _samplerate { t_object x_obj; - float x_sr; + t_float x_sr; t_canvas *x_canvas; } t_samplerate; @@ -1161,13 +1161,13 @@ void *canvas_getblock(t_class *blockclass, t_canvas **canvasp); static void samplerate_tilde_bang(t_samplerate *x) { - float srate = sys_getsr(); + t_float srate = sys_getsr(); t_canvas *canvas = x->x_canvas; while (canvas) { t_block *b = (t_block *)canvas_getblock(block_class, &canvas); if (b) - srate *= (float)(b->x_upsample) / (float)(b->x_downsample); + srate *= (t_float)(b->x_upsample) / (t_float)(b->x_downsample); } outlet_float(x->x_obj.ob_outlet, srate); } diff --git a/pd/src/g_all_guis.c b/pd/src/g_all_guis.c index 2d18f480..6f196e34 100644 --- a/pd/src/g_all_guis.c +++ b/pd/src/g_all_guis.c @@ -438,7 +438,7 @@ void iemgui_label_font(void *x, t_iemgui *iemgui, t_symbol *s, int ac, t_atom *a else { f = 0; - strcpy(iemgui->x_font, "courier"); + strcpy(iemgui->x_font, sys_font); } iemgui->x_fsf.x_font_style = f; f = (int)atom_getintarg(1, ac, av); @@ -446,8 +446,9 @@ void iemgui_label_font(void *x, t_iemgui *iemgui, t_symbol *s, int ac, t_atom *a f = 4; iemgui->x_fontsize = f; if(glist_isvisible(iemgui->x_glist)) - sys_vgui(".x%lx.c itemconfigure %lxLABEL -font {%s %d bold}\n", - glist_getcanvas(iemgui->x_glist), x, iemgui->x_font, iemgui->x_fontsize); + sys_vgui(".x%lx.c itemconfigure %lxLABEL -font {{%s} -%d %s}\n", + glist_getcanvas(iemgui->x_glist), x, iemgui->x_font, + iemgui->x_fontsize, sys_fontweight); } void iemgui_size(void *x, t_iemgui *iemgui) @@ -622,7 +623,7 @@ int iemgui_dialog(t_iemgui *iemgui, t_symbol **srl, int argc, t_atom *argv) else { f = 0; - strcpy(iemgui->x_font, "courier"); + strcpy(iemgui->x_font, sys_font); } iemgui->x_fsf.x_font_style = f; if(fs < 4) diff --git a/pd/src/g_all_guis.h b/pd/src/g_all_guis.h index 2d7d7dd6..b352fb9c 100644 --- a/pd/src/g_all_guis.h +++ b/pd/src/g_all_guis.h @@ -144,7 +144,7 @@ typedef struct _iemgui int x_w; int x_ldx; int x_ldy; - char x_font[16]; + char x_font[MAXPDSTRING]; /* font names can be long! */ t_iem_fstyle_flags x_fsf; int x_fontsize; t_iem_init_symargs x_isa; @@ -208,8 +208,8 @@ typedef struct _hdial typedef struct _toggle { t_iemgui x_gui; - float x_on; - float x_nonzero; + t_float x_on; + t_float x_nonzero; } t_toggle; typedef struct _my_canvas @@ -238,8 +238,8 @@ typedef struct _vu int x_led_size; int x_peak; int x_rms; - float x_fp; - float x_fr; + t_float x_fp; + t_float x_fr; int x_scale; void *x_out_rms; void *x_out_peak; diff --git a/pd/src/g_array.c b/pd/src/g_array.c index 543823f6..0ebc99fb 100644 --- a/pd/src/g_array.c +++ b/pd/src/g_array.c @@ -394,7 +394,7 @@ void garray_arraydialog(t_garray *x, t_symbol *name, t_floatarg fsize, int flags = fflags; int saveit = ((flags & 1) != 0); int style = ((flags & 6) >> 1); - float stylewas = template_getfloat( + t_float stylewas = template_getfloat( template_findbyname(x->x_scalar->sc_template), gensym("style"), x->x_scalar->sc_vec, 1); if (deleteit != 0) @@ -449,7 +449,7 @@ void garray_arraydialog(t_garray *x, t_symbol *name, t_floatarg fsize, else if (style != stylewas) garray_fittograph(x, size, style); template_setfloat(scalartemplate, gensym("style"), - x->x_scalar->sc_vec, (float)style, 0); + x->x_scalar->sc_vec, (t_float)style, 0); garray_setsaveit(x, (saveit != 0)); garray_redraw(x); @@ -460,7 +460,7 @@ void garray_arraydialog(t_garray *x, t_symbol *name, t_floatarg fsize, void garray_arrayviewlist_new(t_garray *x) { int i, xonset=0, yonset=0, type=0, elemsize=0; - float yval; + t_float yval; char cmdbuf[200]; t_symbol *arraytype; t_array *a = garray_getarray_floatonly(x, &yonset, &elemsize); @@ -478,7 +478,7 @@ void garray_arrayviewlist_new(t_garray *x) gfxstub_new(&x->x_gobj.g_pd, x, cmdbuf); for (i = 0; i < ARRAYPAGESIZE && i < a->a_n; i++) { - yval = *(float *)(a->a_vec + + yval = *(t_float *)(a->a_vec + elemsize * i + yonset); sys_vgui(".%sArrayWindow.lb insert %d {%d) %g}\n", x->x_realname->s_name, @@ -493,7 +493,7 @@ void garray_arrayviewlist_fillpage(t_garray *x, t_float fTopItem) { int i, xonset=0, yonset=0, type=0, elemsize=0, topItem; - float yval; + t_float yval; char cmdbuf[200]; t_symbol *arraytype; t_array *a = garray_getarray_floatonly(x, &yonset, &elemsize); @@ -524,7 +524,7 @@ void garray_arrayviewlist_fillpage(t_garray *x, (i < (page + 1) * ARRAYPAGESIZE && i < a->a_n); i++) { - yval = *(float *)(a->a_vec + \ + yval = *(t_float *)(a->a_vec + \ elemsize * i + yonset); sys_vgui(".%sArrayWindow.lb insert %d {%d) %g}\n", x->x_realname->s_name, @@ -575,23 +575,23 @@ void array_redraw(t_array *a, t_glist *glist) /* routine to get screen coordinates of a point in an array */ void array_getcoordinate(t_glist *glist, char *elem, int xonset, int yonset, int wonset, int indx, - float basex, float basey, float xinc, + t_float basex, t_float basey, t_float xinc, t_fielddesc *xfielddesc, t_fielddesc *yfielddesc, t_fielddesc *wfielddesc, - float *xp, float *yp, float *wp) + t_float *xp, t_float *yp, t_float *wp) { - float xval, yval, ypix, wpix; + t_float xval, yval, ypix, wpix; if (xonset >= 0) - xval = *(float *)(elem + xonset); + xval = *(t_float *)(elem + xonset); else xval = indx * xinc; if (yonset >= 0) - yval = *(float *)(elem + yonset); + yval = *(t_float *)(elem + yonset); else yval = 0; ypix = glist_ytopixels(glist, basey + fielddesc_cvttocoord(yfielddesc, yval)); if (wonset >= 0) { /* found "w" field which controls linewidth. */ - float wval = *(float *)(elem + wonset); + t_float wval = *(t_float *)(elem + wonset); wpix = glist_ytopixels(glist, basey + fielddesc_cvttocoord(yfielddesc, yval) + fielddesc_cvttocoord(wfielddesc, wval)) - ypix; @@ -605,8 +605,8 @@ void array_getcoordinate(t_glist *glist, *wp = wpix; } -static float array_motion_xcumulative; -static float array_motion_ycumulative; +static t_float array_motion_xcumulative; +static t_float array_motion_ycumulative; static t_fielddesc *array_motion_xfield; static t_fielddesc *array_motion_yfield; static t_glist *array_motion_glist; @@ -617,9 +617,9 @@ static t_template *array_motion_template; static int array_motion_npoints; static int array_motion_elemsize; static int array_motion_altkey; -static float array_motion_initx; -static float array_motion_xperpix; -static float array_motion_yperpix; +static t_float array_motion_initx; +static t_float array_motion_xperpix; +static t_float array_motion_yperpix; static int array_motion_lastx; static int array_motion_fatten; @@ -638,9 +638,9 @@ static void array_motion(void *z, t_floatarg dx, t_floatarg dy) { t_word *thisword = (t_word *)(((char *)array_motion_wp) + i * array_motion_elemsize); - float xwas = fielddesc_getcoord(array_motion_xfield, + t_float xwas = fielddesc_getcoord(array_motion_xfield, array_motion_template, thisword, 1); - float ywas = (array_motion_yfield ? + t_float ywas = (array_motion_yfield ? fielddesc_getcoord(array_motion_yfield, array_motion_template, thisword, 1) : 0); fielddesc_setcoord(array_motion_xfield, @@ -651,7 +651,7 @@ static void array_motion(void *z, t_floatarg dx, t_floatarg dy) { if (i == 0) { - float newy = ywas + dy * array_motion_yperpix; + t_float newy = ywas + dy * array_motion_yperpix; if (newy < 0) newy = 0; fielddesc_setcoord(array_motion_yfield, @@ -672,13 +672,13 @@ static void array_motion(void *z, t_floatarg dx, t_floatarg dy) /* a y-only plot. */ int thisx = array_motion_initx + array_motion_xcumulative + 0.5, x2; int increment, i, nchange; - float newy = array_motion_ycumulative, + t_float newy = array_motion_ycumulative, oldy = fielddesc_getcoord(array_motion_yfield, array_motion_template, (t_word *)(((char *)array_motion_wp) + array_motion_elemsize * array_motion_lastx), 1); - float ydiff = newy - oldy; + t_float ydiff = newy - oldy; if (thisx < 0) thisx = 0; else if (thisx >= array_motion_npoints) thisx = array_motion_npoints - 1; @@ -704,7 +704,7 @@ static void array_motion(void *z, t_floatarg dx, t_floatarg dy) int scalar_doclick(t_word *data, t_template *template, t_scalar *sc, t_array *ap, struct _glist *owner, - float xloc, float yloc, int xpix, int ypix, + t_float xloc, t_float yloc, int xpix, int ypix, int shift, int alt, int dbl, int doit); /* try clicking on an element of the array as a scalar (if clicking @@ -712,14 +712,14 @@ int scalar_doclick(t_word *data, t_template *template, t_scalar *sc, static int array_doclick_element(t_array *array, t_glist *glist, t_scalar *sc, t_array *ap, t_symbol *elemtemplatesym, - float linewidth, float xloc, float xinc, float yloc, + t_float linewidth, t_float xloc, t_float xinc, t_float yloc, t_fielddesc *xfield, t_fielddesc *yfield, t_fielddesc *wfield, int xpix, int ypix, int shift, int alt, int dbl, int doit) { t_canvas *elemtemplatecanvas; t_template *elemtemplate; int elemsize, yonset, wonset, xonset, i, incr, hit; - float xsum; + t_float xsum; if (elemtemplatesym == &s_float) return (0); @@ -733,13 +733,13 @@ static int array_doclick_element(t_array *array, t_glist *glist, else incr = array->a_n / 300; for (i = 0, xsum = 0; i < array->a_n; i += incr) { - float usexloc, useyloc; + t_float usexloc, useyloc; if (xonset >= 0) usexloc = xloc + fielddesc_cvttocoord(xfield, - *(float *)(((char *)(array->a_vec) + elemsize * i) + xonset)); + *(t_float *)(((char *)(array->a_vec) + elemsize * i) + xonset)); else usexloc = xloc + xsum, xsum += xinc; useyloc = yloc + (yonset >= 0 ? fielddesc_cvttocoord(yfield, - *(float *)(((char *)(array->a_vec) + elemsize * i) + yonset)) : 0); + *(t_float *)(((char *)(array->a_vec) + elemsize * i) + yonset)) : 0); if (hit = scalar_doclick( (t_word *)((char *)(array->a_vec) + i * elemsize), @@ -755,7 +755,7 @@ static int array_doclick_element(t_array *array, t_glist *glist, they can be static (look in g_canvas.h for candidates). */ int array_doclick(t_array *array, t_glist *glist, t_scalar *sc, t_array *ap, t_symbol *elemtemplatesym, - float linewidth, float xloc, float xinc, float yloc, float scalarvis, + t_float linewidth, t_float xloc, t_float xinc, t_float yloc, t_float scalarvis, t_fielddesc *xfield, t_fielddesc *yfield, t_fielddesc *wfield, int xpix, int ypix, int shift, int alt, int dbl, int doit) { @@ -767,12 +767,12 @@ int array_doclick(t_array *array, t_glist *glist, t_scalar *sc, t_array *ap, &elemtemplate, &elemsize, xfield, yfield, wfield, &xonset, &yonset, &wonset)) { - float best = 100; + t_float best = 100; /* if it has more than 2000 points, just check 1000 of them. */ int incr = (array->a_n <= 2000 ? 1 : array->a_n / 1000); for (i = 0; i < array->a_n; i += incr) { - float pxpix, pypix, pwpix, dx, dy; + t_float pxpix, pypix, pwpix, dx, dy; array_getcoordinate(glist, (char *)(array->a_vec) + i * elemsize, xonset, yonset, wonset, i, xloc, yloc, xinc, xfield, yfield, wfield, &pxpix, &pypix, &pwpix); @@ -810,7 +810,7 @@ int array_doclick(t_array *array, t_glist *glist, t_scalar *sc, t_array *ap, best += 0.001; /* add truncation error margin */ for (i = 0; i < array->a_n; i += incr) { - float pxpix, pypix, pwpix, dx, dy, dy2, dy3; + t_float pxpix, pypix, pwpix, dx, dy, dy2, dy3; array_getcoordinate(glist, (char *)(array->a_vec) + i * elemsize, xonset, yonset, wonset, i, xloc, yloc, xinc, xfield, yfield, wfield, &pxpix, &pypix, &pwpix); @@ -903,7 +903,7 @@ int array_doclick(t_array *array, t_glist *glist, t_scalar *sc, t_array *ap, array_motion_ycumulative = fielddesc_getcoord(yfield, array_motion_template, (t_word *)(elem + i * elemsize), 1); - /* *(float *)((elem + elemsize * i) + yonset); */ + /* *(t_float *)((elem + elemsize * i) + yonset); */ } else { @@ -929,7 +929,7 @@ int array_doclick(t_array *array, t_glist *glist, t_scalar *sc, t_array *ap, static void array_getrect(t_array *array, t_glist *glist, int *xp1, int *yp1, int *xp2, int *yp2) { - float x1 = 0x7fffffff, y1 = 0x7fffffff, x2 = -0x7fffffff, y2 = -0x7fffffff; + t_float x1 = 0x7fffffff, y1 = 0x7fffffff, x2 = -0x7fffffff, y2 = -0x7fffffff; t_canvas *elemtemplatecanvas; t_template *elemtemplate; int elemsize, yonset, wonset, xonset, i; @@ -944,7 +944,7 @@ static void array_getrect(t_array *array, t_glist *glist, else incr = array->a_n / 300; for (i = 0; i < array->a_n; i += incr) { - float pxpix, pypix, pwpix, dx, dy; + t_float pxpix, pypix, pwpix, dx, dy; array_getcoordinate(glist, (char *)(array->a_vec) + i * elemsize, xonset, yonset, wonset, i, 0, 0, 1, @@ -1152,7 +1152,7 @@ int garray_getfloatwords(t_garray *x, int *size, t_word **vec) int garray_getfloatarray(t_garray *x, int *size, t_float **vec) { - if (sizeof(t_word) != sizeof(float)) + if (sizeof(t_word) != sizeof(t_float)) { static int warned; if (!warned) @@ -1180,13 +1180,13 @@ static void garray_const(t_garray *x, t_floatarg g) if (!array) error("%s: needs floating-point 'y' field", x->x_realname); else for (i = 0; i < array->a_n; i++) - *((float *)((char *)array->a_vec + *((t_float *)((char *)array->a_vec + elemsize * i) + yonset) = g; garray_redraw(x); } /* sum of Fourier components; called from routines below */ -static void garray_dofo(t_garray *x, int npoints, float dcval, +static void garray_dofo(t_garray *x, int npoints, t_float dcval, int nsin, t_float *vsin, int sineflag) { double phase, phaseincr, fj; @@ -1213,7 +1213,7 @@ static void garray_dofo(t_garray *x, int npoints, float dcval, else for (j = 0, fj = 0; j < nsin; j++, fj += phase) sum += vsin[j] * cos(fj); - *((float *)((array->a_vec + elemsize * i)) + yonset) + *((t_float *)((array->a_vec + elemsize * i)) + yonset) = sum; } garray_redraw(x); @@ -1282,7 +1282,7 @@ static void garray_normalize(t_garray *x, t_float f) for (i = 0, maxv = 0; i < array->a_n; i++) { - double v = *((float *)(array->a_vec + elemsize * i) + double v = *((t_float *)(array->a_vec + elemsize * i) + yonset); if (v > maxv) maxv = v; @@ -1293,7 +1293,7 @@ static void garray_normalize(t_garray *x, t_float f) { renormer = f / maxv; for (i = 0; i < array->a_n; i++) - *((float *)(array->a_vec + elemsize * i) + yonset) + *((t_float *)(array->a_vec + elemsize * i) + yonset) *= renormer; } garray_redraw(x); @@ -1331,7 +1331,7 @@ static void garray_list(t_garray *x, t_symbol *s, int argc, t_atom *argv) if (argc <= 0) return; } for (i = 0; i < argc; i++) - *((float *)(array->a_vec + elemsize * (i + firstindex)) + yonset) + *((t_float *)(array->a_vec + elemsize * (i + firstindex)) + yonset) = atom_getfloat(argv + i); } garray_redraw(x); @@ -1402,7 +1402,7 @@ static void garray_read(t_garray *x, t_symbol *filename) } for (i = 0; i < nelem; i++) { - if (!fscanf(fd, "%f", ((float *)(array->a_vec + + if (!fscanf(fd, "%f", ((t_float *)(array->a_vec + elemsize * i) + yonset))) { post("%s: read %d elements into table of size %d", @@ -1411,7 +1411,7 @@ static void garray_read(t_garray *x, t_symbol *filename) } } while (i < nelem) - *((float *)(array->a_vec + + *((t_float *)(array->a_vec + elemsize * i) + yonset) = 0, i++; fclose(fd); garray_redraw(x); @@ -1439,7 +1439,7 @@ static void garray_write(t_garray *x, t_symbol *filename) for (i = 0; i < array->a_n; i++) { if (fprintf(fd, "%g\n", - *(float *)(((array->a_vec + sizeof(t_word) * i)) + yonset)) < 1) + *(t_float *)(((array->a_vec + sizeof(t_word) * i)) + yonset)) < 1) { post("%s: write error", filename->s_name); break; diff --git a/pd/src/g_bang.c b/pd/src/g_bang.c index 3a5ef4d3..1e5d6604 100644 --- a/pd/src/g_bang.c +++ b/pd/src/g_bang.c @@ -55,11 +55,12 @@ void bng_draw_new(t_bng *x, t_glist *glist) xpos + x->x_gui.x_w-1, ypos + x->x_gui.x_h-1, x->x_flashed?x->x_gui.x_fcol:x->x_gui.x_bcol, x); sys_vgui(".x%lx.c create text %d %d -text {%s} -anchor w \ - -font {%s %d bold} -fill #%6.6x -tags %lxLABEL\n", + -font {{%s} -%d %s} -fill #%6.6x -tags %lxLABEL\n", 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); + x->x_gui.x_font, x->x_gui.x_fontsize, sys_fontweight, + x->x_gui.x_lcol, x); if(!x->x_gui.x_fsf.x_snd_able) sys_vgui(".x%lx.c create rectangle %d %d %d %d -tags %lxOUT%d\n", canvas, xpos, @@ -115,8 +116,8 @@ void bng_draw_config(t_bng* x, t_glist* glist) { t_canvas *canvas=glist_getcanvas(glist); - sys_vgui(".x%lx.c itemconfigure %lxLABEL -font {%s %d bold} -fill #%6.6x -text {%s} \n", - canvas, x, x->x_gui.x_font, x->x_gui.x_fontsize, + sys_vgui(".x%lx.c itemconfigure %lxLABEL -font {{%s} -%d %s} -fill #%6.6x -text {%s} \n", + canvas, x, x->x_gui.x_font, x->x_gui.x_fontsize, sys_fontweight, x->x_gui.x_fsf.x_selected?IEM_GUI_COLOR_SELECTED:x->x_gui.x_lcol, strcmp(x->x_gui.x_lab->s_name, "empty")?x->x_gui.x_lab->s_name:""); sys_vgui(".x%lx.c itemconfigure %lxBASE -fill #%6.6x\n", canvas, x, x->x_gui.x_bcol); @@ -237,7 +238,7 @@ static void bng_properties(t_gobj *z, t_glist *owner) t_symbol *srl[3]; iemgui_properties(&x->x_gui, srl); - sprintf(buf, "pdtk_iemgui_dialog %%s BANG \ + sprintf(buf, "pdtk_iemgui_dialog %%s |bang| \ ----------dimensions(pix):----------- %d %d size: 0 0 empty \ --------flash-time(ms)(ms):--------- %d intrrpt: %d hold: %d \ %d empty empty %d %d empty %d \ @@ -481,7 +482,7 @@ static void *bng_new(t_symbol *s, int argc, t_atom *argv) if(x->x_gui.x_fsf.x_font_style == 1) strcpy(x->x_gui.x_font, "helvetica"); else if(x->x_gui.x_fsf.x_font_style == 2) strcpy(x->x_gui.x_font, "times"); else { x->x_gui.x_fsf.x_font_style = 0; - strcpy(x->x_gui.x_font, "courier"); } + strcpy(x->x_gui.x_font, sys_font); } if (x->x_gui.x_fsf.x_rcv_able) pd_bind(&x->x_gui.x_obj.ob_pd, x->x_gui.x_rcv); diff --git a/pd/src/g_canvas.c b/pd/src/g_canvas.c index 10f897c1..36d3d3d6 100644 --- a/pd/src/g_canvas.c +++ b/pd/src/g_canvas.c @@ -448,8 +448,8 @@ static void canvas_coords(t_glist *x, t_symbol *s, int argc, t_atom *argv) /* make a new glist and add it to this glist. It will appear as a "graph", not a text object. */ t_glist *glist_addglist(t_glist *g, t_symbol *sym, - float x1, float y1, float x2, float y2, - float px1, float py1, float px2, float py2) + t_float x1, t_float y1, t_float x2, t_float y2, + t_float px1, t_float py1, t_float px2, t_float py2) { static int gcount = 0; int zz; @@ -474,7 +474,7 @@ t_glist *glist_addglist(t_glist *g, t_symbol *sym, that is higher on the screen. */ if (py2 < py1) { - float zz; + t_float zz; zz = y2; y2 = y1; y1 = zz; @@ -520,14 +520,14 @@ t_glist *glist_addglist(t_glist *g, t_symbol *sym, void glist_glist(t_glist *g, t_symbol *s, int argc, t_atom *argv) { t_symbol *sym = atom_getsymbolarg(0, argc, argv); - float x1 = atom_getfloatarg(1, argc, argv); - float y1 = atom_getfloatarg(2, argc, argv); - float x2 = atom_getfloatarg(3, argc, argv); - float y2 = atom_getfloatarg(4, argc, argv); - float px1 = atom_getfloatarg(5, argc, argv); - float py1 = atom_getfloatarg(6, argc, argv); - float px2 = atom_getfloatarg(7, argc, argv); - float py2 = atom_getfloatarg(8, argc, argv); + t_float x1 = atom_getfloatarg(1, argc, argv); + t_float y1 = atom_getfloatarg(2, argc, argv); + t_float x2 = atom_getfloatarg(3, argc, argv); + t_float y2 = atom_getfloatarg(4, argc, argv); + t_float px1 = atom_getfloatarg(5, argc, argv); + t_float py1 = atom_getfloatarg(6, argc, argv); + t_float px2 = atom_getfloatarg(7, argc, argv); + t_float py2 = atom_getfloatarg(8, argc, argv); glist_addglist(g, sym, x1, y1, x2, y2, px1, py1, px2, py2); } @@ -557,7 +557,7 @@ static void canvas_setbounds(t_canvas *x, int x1, int y1, int x2, int y2) fix so that zero is bottom edge and redraw. This is only appropriate if we're a regular "text" object on the parent. */ - float diff = x->gl_y1 - x->gl_y2; + t_float diff = x->gl_y1 - x->gl_y2; t_gobj *y; x->gl_y1 = heightwas * diff; x->gl_y2 = x->gl_y1 - diff; @@ -738,7 +738,7 @@ void canvas_create_editor(t_glist *x, int createit) } for (y = x->gl_list; y; y = y->g_next) if (pd_class(&y->g_pd) == canvas_class && - ((t_canvas *)y)->gl_isgraph) + ((t_canvas *)y)->gl_isgraph && !((t_canvas *)y)->gl_havewindow) canvas_create_editor((t_canvas *)y, createit); } @@ -808,7 +808,8 @@ void canvas_vis(t_canvas *x, t_floatarg f) if (glist_isgraph(x) && x->gl_owner) { t_glist *gl2 = x->gl_owner; - canvas_create_editor(x, 1); + if (!x->gl_owner->gl_isdeleting) + canvas_create_editor(x, 1); if (glist_isvisible(gl2)) gobj_vis(&x->gl_gobj, gl2, 0); x->gl_havewindow = 0; @@ -1043,18 +1044,21 @@ void canvas_loadbang(t_canvas *x) canvas_loadbangsubpatches(x); } - /* When you ask a canvas its size the result is 2 pixels more than what - you gave it to open it; perhaps there's a 1-pixel border all around it - or something. Anyway, we just add the 2 pixels back here; seems we - have to do this for linux but not MSW; not sure about MacOS. */ + /* When you ask a canvas its size the result is more than what + you gave it to open it; how much bigger apparently depends on the OS. */ #ifdef __unix__ #define HORIZBORDER 2 #define VERTBORDER 2 #else +#ifdef MACOSX +#define HORIZBORDER 6 +#define VERTBORDER 6 +#else #define HORIZBORDER 4 #define VERTBORDER 4 #endif +#endif static void canvas_relocate(t_canvas *x, t_symbol *canvasgeom, t_symbol *topgeom) diff --git a/pd/src/g_canvas.h b/pd/src/g_canvas.h index d3dee3d3..e2b6626a 100644 --- a/pd/src/g_canvas.h +++ b/pd/src/g_canvas.h @@ -131,8 +131,8 @@ typedef struct _arrayvis typedef struct _tick /* where to put ticks on x or y axes */ { - float k_point; /* one point to draw a big tick at */ - float k_inc; /* x or y increment per little tick */ + t_float k_point; /* one point to draw a big tick at */ + t_float k_inc; /* x or y increment per little tick */ int k_lperb; /* little ticks per big; 0 if no ticks to draw */ } t_tick; @@ -150,10 +150,10 @@ struct _glist struct _glist *gl_owner; /* parent glist, supercanvas, or 0 if none */ int gl_pixwidth; /* width in pixels (on parent, if a graph) */ int gl_pixheight; - float gl_x1; /* bounding rectangle in our own coordinates */ - float gl_y1; - float gl_x2; - float gl_y2; + t_float gl_x1; /* bounding rectangle in our own coordinates */ + t_float gl_y1; + t_float gl_x2; + t_float gl_y2; int gl_screenx1; /* screen coordinates when toplevel */ int gl_screeny1; int gl_screenx2; @@ -163,11 +163,11 @@ struct _glist t_tick gl_xtick; /* ticks marking X values */ int gl_nxlabels; /* number of X coordinate labels */ t_symbol **gl_xlabel; /* ... an array to hold them */ - float gl_xlabely; /* ... and their Y coordinates */ + t_float gl_xlabely; /* ... and their Y coordinates */ t_tick gl_ytick; /* same as above for Y ticks and labels */ int gl_nylabels; t_symbol **gl_ylabel; - float gl_ylabelx; + t_float gl_ylabelx; t_editor *gl_editor; /* editor structure when visible */ t_symbol *gl_name; /* symbol bound here */ int gl_font; /* nominal font size in points, e.g., 10 */ @@ -286,28 +286,28 @@ doesn't work on array elements... LATER reconsider this */ /* bounding rectangle: */ typedef void (*t_parentgetrectfn)(t_gobj *x, struct _glist *glist, - t_word *data, t_template *tmpl, float basex, float basey, + t_word *data, t_template *tmpl, t_float basex, t_float basey, int *x1, int *y1, int *x2, int *y2); /* displace it */ typedef void (*t_parentdisplacefn)(t_gobj *x, struct _glist *glist, - t_word *data, t_template *tmpl, float basex, float basey, + t_word *data, t_template *tmpl, t_float basex, t_float basey, int dx, int dy); /* change color to show selection */ typedef void (*t_parentselectfn)(t_gobj *x, struct _glist *glist, - t_word *data, t_template *tmpl, float basex, float basey, + t_word *data, t_template *tmpl, t_float basex, t_float basey, int state); /* change appearance to show activation/deactivation: */ typedef void (*t_parentactivatefn)(t_gobj *x, struct _glist *glist, - t_word *data, t_template *tmpl, float basex, float basey, + t_word *data, t_template *tmpl, t_float basex, t_float basey, int state); /* making visible or invisible */ typedef void (*t_parentvisfn)(t_gobj *x, struct _glist *glist, - t_word *data, t_template *tmpl, float basex, float basey, + t_word *data, t_template *tmpl, t_float basex, t_float basey, int flag); /* field a mouse click */ typedef int (*t_parentclickfn)(t_gobj *x, struct _glist *glist, t_word *data, t_template *tmpl, t_scalar *sc, t_array *ap, - float basex, float basey, + t_float basex, t_float basey, int xpix, int ypix, int shift, int alt, int dbl, int doit); struct _parentwidgetbehavior @@ -380,18 +380,18 @@ EXTERN void glist_sort(t_glist *canvas); EXTERN void glist_read(t_glist *x, t_symbol *filename, t_symbol *format); EXTERN void glist_mergefile(t_glist *x, t_symbol *filename, t_symbol *format); -EXTERN float glist_pixelstox(t_glist *x, float xpix); -EXTERN float glist_pixelstoy(t_glist *x, float ypix); -EXTERN float glist_xtopixels(t_glist *x, float xval); -EXTERN float glist_ytopixels(t_glist *x, float yval); -EXTERN float glist_dpixtodx(t_glist *x, float dxpix); -EXTERN float glist_dpixtody(t_glist *x, float dypix); +EXTERN t_float glist_pixelstox(t_glist *x, t_float xpix); +EXTERN t_float glist_pixelstoy(t_glist *x, t_float ypix); +EXTERN t_float glist_xtopixels(t_glist *x, t_float xval); +EXTERN t_float glist_ytopixels(t_glist *x, t_float yval); +EXTERN t_float glist_dpixtodx(t_glist *x, t_float dxpix); +EXTERN t_float glist_dpixtody(t_glist *x, t_float dypix); EXTERN void glist_getnextxy(t_glist *gl, int *xval, int *yval); EXTERN void glist_glist(t_glist *g, t_symbol *s, int argc, t_atom *argv); EXTERN t_glist *glist_addglist(t_glist *g, t_symbol *sym, - float x1, float y1, float x2, float y2, - float px1, float py1, float px2, float py2); + t_float x1, t_float y1, t_float x2, t_float y2, + t_float px1, t_float py1, t_float px2, t_float py2); EXTERN void glist_arraydialog(t_glist *parent, t_symbol *name, t_floatarg size, t_floatarg saveit, t_floatarg newgraph); EXTERN t_binbuf *glist_writetobinbuf(t_glist *x, int wholething); @@ -502,7 +502,7 @@ EXTERN int canvas_getindex(t_canvas *x, t_gobj *y); EXTERN void canvas_connect(t_canvas *x, t_floatarg fwhoout, t_floatarg foutno,t_floatarg fwhoin, t_floatarg finno); EXTERN void canvas_disconnect(t_canvas *x, - float index1, float outno, float index2, float inno); + t_float index1, t_float outno, t_float index2, t_float inno); EXTERN int canvas_isconnected (t_canvas *x, t_text *ob1, int n1, t_text *ob2, int n2); EXTERN void canvas_selectinrect(t_canvas *x, int lox, int loy, int hix, int hiy); @@ -545,21 +545,21 @@ EXTERN void word_restore(t_word *wp, t_template *tmpl, EXTERN t_scalar *scalar_new(t_glist *owner, t_symbol *templatesym); EXTERN void word_free(t_word *wp, t_template *tmpl); -EXTERN void scalar_getbasexy(t_scalar *x, float *basex, float *basey); +EXTERN void scalar_getbasexy(t_scalar *x, t_float *basex, t_float *basey); EXTERN void scalar_redraw(t_scalar *x, t_glist *glist); /* ------helper routines for "garrays" and "plots" -------------- */ EXTERN int array_doclick(t_array *array, t_glist *glist, t_scalar *sc, t_array *ap, t_symbol *elemtemplatesym, - float linewidth, float xloc, float xinc, float yloc, float scalarvis, + t_float linewidth, t_float xloc, t_float xinc, t_float yloc, t_float scalarvis, t_fielddesc *xfield, t_fielddesc *yfield, t_fielddesc *wfield, int xpix, int ypix, int shift, int alt, int dbl, int doit); EXTERN void array_getcoordinate(t_glist *glist, char *elem, int xonset, int yonset, int wonset, int indx, - float basex, float basey, float xinc, + t_float basex, t_float basey, t_float xinc, t_fielddesc *xfielddesc, t_fielddesc *yfielddesc, t_fielddesc *wfielddesc, - float *xp, float *yp, float *wp); + t_float *xp, t_float *yp, t_float *wp); EXTERN int array_getfields(t_symbol *elemtemplatesym, t_canvas **elemtemplatecanvasp, @@ -599,9 +599,9 @@ EXTERN void template_setsymbol(t_template *x, t_symbol *fieldname, EXTERN t_float fielddesc_getcoord(t_fielddesc *f, t_template *tmpl, t_word *wp, int loud); EXTERN void fielddesc_setcoord(t_fielddesc *f, t_template *tmpl, - t_word *wp, float pix, int loud); -EXTERN t_float fielddesc_cvttocoord(t_fielddesc *f, float val); -EXTERN float fielddesc_cvtfromcoord(t_fielddesc *f, float coord); + t_word *wp, t_float pix, int loud); +EXTERN t_float fielddesc_cvttocoord(t_fielddesc *f, t_float val); +EXTERN t_float fielddesc_cvtfromcoord(t_fielddesc *f, t_float coord); /* ----------------------- guiconnects, g_guiconnect.c --------- */ diff --git a/pd/src/g_editor.c b/pd/src/g_editor.c index aa8b35c0..9f3097de 100644 --- a/pd/src/g_editor.c +++ b/pd/src/g_editor.c @@ -381,7 +381,7 @@ static void *canvas_undo_set_disconnect(t_canvas *x, } void canvas_disconnect(t_canvas *x, - float index1, float outno, float index2, float inno) + t_float index1, t_float outno, t_float index2, t_float inno) { t_linetraverser t; t_outconnect *oc; @@ -793,6 +793,17 @@ static t_gobj *canvas_findhitbox(t_canvas *x, int xpos, int ypos, && (x1 > *x1p)) *x1p = x1, *y1p = y1, *x2p = x2, *y2p = y2, rval = y; } + /* if there are at least two selected objects, we'd prefer + to find a selected one (never mind which) to the one we got. */ + if (x->gl_editor && x->gl_editor->e_selection && + x->gl_editor->e_selection->sel_next && !glist_isselected(x, y)) + { + t_selection *sel; + for (sel = x->gl_editor->e_selection; sel; sel = sel->sel_next) + if (canvas_hitbox(x, sel->sel_what, xpos, ypos, &x1, &y1, &x2, &y2)) + *x1p = x1, *y1p = y1, *x2p = x2, *y2p = y2, + rval = sel->sel_what; + } return (rval); } @@ -893,7 +904,7 @@ static void canvas_donecanvasdialog(t_glist *x, { - float xperpix, yperpix, x1, y1, x2, y2, xpix, ypix, xmargin, ymargin; + t_float xperpix, yperpix, x1, y1, x2, y2, xpix, ypix, xmargin, ymargin; int graphme, redraw = 0; xperpix = atom_getfloatarg(0, argc, argv); @@ -966,7 +977,7 @@ static void canvas_donecanvasdialog(t_glist *x, /* called from the gui when a popup menu comes back with "properties," "open," or "help." */ -static void canvas_done_popup(t_canvas *x, float which, float xpos, float ypos) +static void canvas_done_popup(t_canvas *x, t_float which, t_float xpos, t_float ypos) { char pathbuf[MAXPDSTRING], namebuf[MAXPDSTRING]; t_gobj *y; @@ -1201,16 +1212,16 @@ void canvas_doclick(t_canvas *x, int xpos, int ypos, int which, { t_linetraverser t; t_outconnect *oc; - float fx = xpos, fy = ypos; + t_float fx = xpos, fy = ypos; t_glist *glist2 = glist_getcanvas(x); linetraverser_start(&t, glist2); while (oc = linetraverser_next(&t)) { - float lx1 = t.tr_lx1, ly1 = t.tr_ly1, + t_float lx1 = t.tr_lx1, ly1 = t.tr_ly1, lx2 = t.tr_lx2, ly2 = t.tr_ly2; - float area = (lx2 - lx1) * (fy - ly1) - + t_float area = (lx2 - lx1) * (fy - ly1) - (ly2 - ly1) * (fx - lx1); - float dsquare = (lx2-lx1) * (lx2-lx1) + (ly2-ly1) * (ly2-ly1); + t_float dsquare = (lx2-lx1) * (lx2-lx1) + (ly2-ly1) * (ly2-ly1); if (area * area >= 50 * dsquare) continue; if ((lx2-lx1) * (fx-lx1) + (ly2-ly1) * (fy-ly1) < 0) continue; if ((lx2-lx1) * (lx2-fx) + (ly2-ly1) * (ly2-fy) < 0) continue; @@ -1493,9 +1504,9 @@ void canvas_key(t_canvas *x, t_symbol *s, int ac, t_atom *av) keynum = 0, gotkeysym = gensym("Right"); #endif if (keynumsym->s_thing && down) - pd_float(keynumsym->s_thing, (float)keynum); + pd_float(keynumsym->s_thing, (t_float)keynum); if (keyupsym->s_thing && !down) - pd_float(keyupsym->s_thing, (float)keynum); + pd_float(keyupsym->s_thing, (t_float)keynum); if (keynamesym->s_thing) { t_atom at[2]; @@ -1512,7 +1523,7 @@ void canvas_key(t_canvas *x, t_symbol *s, int ac, t_atom *av) if (x->gl_editor->e_grab && x->gl_editor->e_keyfn && keynum) (* x->gl_editor->e_keyfn) - (x->gl_editor->e_grab, (float)keynum); + (x->gl_editor->e_grab, (t_float)keynum); /* if a text editor is open send the key on, as long as it is either "real" (has a key number) or else is an arrow key. */ else if (x->gl_editor->e_textedfor && (keynum @@ -2382,7 +2393,7 @@ static void canvas_dofont(t_canvas *x, t_floatarg font, t_floatarg xresize, static void canvas_font(t_canvas *x, t_floatarg font, t_floatarg resize, t_floatarg whichresize) { - float realresize, realresx = 1, realresy = 1; + t_float realresize, realresx = 1, realresy = 1; t_canvas *x2 = canvas_getrootfor(x); if (!resize) realresize = 1; else diff --git a/pd/src/g_graph.c b/pd/src/g_graph.c index 1f449a63..f4196def 100644 --- a/pd/src/g_graph.c +++ b/pd/src/g_graph.c @@ -181,11 +181,11 @@ t_canvas *glist_getcanvas(t_glist *x) return((t_canvas *)x); } -static float gobj_getxforsort(t_gobj *g) +static t_float gobj_getxforsort(t_gobj *g) { if (pd_class(&g->g_pd) == scalar_class) { - float x1, y1; + t_float x1, y1; scalar_getbasexy((t_scalar *)g, &x1, &y1); return(x1); } @@ -195,7 +195,7 @@ static float gobj_getxforsort(t_gobj *g) 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; + t_float f1 = 0, f2 = 0; if (g1) f1 = gobj_getxforsort(g1); if (g2) @@ -257,11 +257,11 @@ static t_gobj *glist_dosort(t_glist *x, void glist_sort(t_glist *x) { int nitems = 0, foo = 0; - float lastx = -1e37; + t_float lastx = -1e37; t_gobj *g; for (g = x->gl_list; g; g = g->g_next) { - float x1 = gobj_getxforsort(g); + t_float x1 = gobj_getxforsort(g); if (x1 < lastx) foo = 1; lastx = x1; @@ -505,7 +505,7 @@ static void graph_ylabel(t_glist *x, t_symbol *s, int argc, t_atom *argv) /****** routines to convert pixels to X or Y value and vice versa ******/ /* convert an x pixel value to an x coordinate value */ -float glist_pixelstox(t_glist *x, float xpix) +t_float glist_pixelstox(t_glist *x, t_float xpix) { /* if we appear as a text box on parent, our range in our coordinates (x1, etc.) specifies the coordinate range @@ -533,7 +533,7 @@ float glist_pixelstox(t_glist *x, float xpix) } } -float glist_pixelstoy(t_glist *x, float ypix) +t_float glist_pixelstoy(t_glist *x, t_float ypix) { if (!x->gl_isgraph) return (x->gl_y1 + (x->gl_y2 - x->gl_y1) * ypix); @@ -552,7 +552,7 @@ float glist_pixelstoy(t_glist *x, float ypix) } /* convert an x coordinate value to an x pixel location in window */ -float glist_xtopixels(t_glist *x, float xval) +t_float glist_xtopixels(t_glist *x, t_float xval) { if (!x->gl_isgraph) return ((xval - x->gl_x1) / (x->gl_x2 - x->gl_x1)); @@ -569,7 +569,7 @@ float glist_xtopixels(t_glist *x, float xval) } } -float glist_ytopixels(t_glist *x, float yval) +t_float glist_ytopixels(t_glist *x, t_float yval) { if (!x->gl_isgraph) return ((yval - x->gl_y1) / (x->gl_y2 - x->gl_y1)); @@ -589,12 +589,12 @@ float glist_ytopixels(t_glist *x, float yval) /* convert an X screen distance to an X coordinate increment. This is terribly inefficient; but probably not a big enough CPU hog to warrant optimizing. */ -float glist_dpixtodx(t_glist *x, float dxpix) +t_float glist_dpixtodx(t_glist *x, t_float dxpix) { return (dxpix * (glist_pixelstox(x, 1) - glist_pixelstox(x, 0))); } -float glist_dpixtody(t_glist *x, float dypix) +t_float glist_dpixtody(t_glist *x, t_float dypix) { return (dypix * (glist_pixelstoy(x, 1) - glist_pixelstoy(x, 0))); } @@ -723,7 +723,7 @@ static void graph_vis(t_gobj *gr, t_glist *parent_glist, int vis) if (vis) { int i; - float f; + t_float f; t_gobj *g; t_symbol *arrayname; t_garray *ga; @@ -741,16 +741,16 @@ static void graph_vis(t_gobj *gr, t_glist *parent_glist, int vis) { i -= sys_fontheight(glist_getfont(x)); sys_vgui(".x%lx.c create text %d %d -text {%s} -anchor nw\ - -font -*-courier-bold--normal--%d-* -tags %s\n", - (long)glist_getcanvas(x), x1, i, arrayname->s_name, - sys_hostfontsize(glist_getfont(x)), tag); + -font {{%s} -%d %s} -tags %s\n", + (long)glist_getcanvas(x), x1, i, arrayname->s_name, sys_font, + sys_hostfontsize(glist_getfont(x)), sys_fontweight, tag); } /* draw ticks on horizontal borders. If lperb field is zero, this is disabled. */ if (x->gl_xtick.k_lperb) { - float upix, lpix; + t_float upix, lpix; if (y2 < y1) upix = y1, lpix = y2; else upix = y2, lpix = y1; @@ -787,7 +787,7 @@ static void graph_vis(t_gobj *gr, t_glist *parent_glist, int vis) /* draw ticks in vertical borders*/ if (x->gl_ytick.k_lperb) { - float ubound, lbound; + t_float ubound, lbound; if (x->gl_y2 < x->gl_y1) ubound = x->gl_y1, lbound = x->gl_y2; else ubound = x->gl_y2, lbound = x->gl_y1; @@ -823,21 +823,22 @@ static void graph_vis(t_gobj *gr, t_glist *parent_glist, int vis) /* draw x labels */ for (i = 0; i < x->gl_nxlabels; i++) sys_vgui(".x%lx.c create text\ - %d %d -text {%s} -font -*-courier-bold--normal--%d-* -tags %s\n", + %d %d -text {%s} -font {{%s} -%d %s} -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); + (int)glist_ytopixels(x, x->gl_xlabely), + x->gl_xlabel[i]->s_name, sys_font, + glist_getfont(x), sys_fontweight, tag); /* draw y labels */ for (i = 0; i < x->gl_nylabels; i++) sys_vgui(".x%lx.c create text\ - %d %d -text {%s} -font -*-courier-bold--normal--%d-* -tags %s\n", + %d %d -text {%s} -font {{%s} -%d %s} -tags %s\n", glist_getcanvas(x), (int)glist_xtopixels(x, x->gl_ylabelx), (int)glist_ytopixels(x, atof(x->gl_ylabel[i]->s_name)), - x->gl_ylabel[i]->s_name, - glist_getfont(x), tag); + x->gl_ylabel[i]->s_name, sys_font, + glist_getfont(x), sys_fontweight, tag); /* draw contents of graph as glist */ for (g = x->gl_list; g; g = g->g_next) @@ -990,19 +991,19 @@ static void graph_delete(t_gobj *z, t_glist *glist) glist_delete(x, y); } -static float graph_lastxpix, graph_lastypix; +static t_float graph_lastxpix, graph_lastypix; static void graph_motion(void *z, t_floatarg dx, t_floatarg dy) { t_glist *x = (t_glist *)z; - float newxpix = graph_lastxpix + dx, newypix = graph_lastypix + dy; + t_float newxpix = graph_lastxpix + dx, newypix = graph_lastypix + dy; t_garray *a = (t_garray *)(x->gl_list); int oldx = 0.5 + glist_pixelstox(x, graph_lastxpix); int newx = 0.5 + glist_pixelstox(x, newxpix); t_word *vec; int nelem, i; - float oldy = glist_pixelstoy(x, graph_lastypix); - float newy = glist_pixelstoy(x, newypix); + t_float oldy = glist_pixelstoy(x, graph_lastypix); + t_float newy = glist_pixelstoy(x, newypix); graph_lastxpix = newxpix; graph_lastypix = newypix; /* verify that the array is OK */ @@ -1020,13 +1021,13 @@ static void graph_motion(void *z, t_floatarg dx, t_floatarg dy) { for (i = oldx + 1; i <= newx; i++) vec[i].w_float = newy + (oldy - newy) * - ((float)(newx - i))/(float)(newx - oldx); + ((t_float)(newx - i))/(t_float)(newx - oldx); } else if (oldx > newx + 1) { for (i = oldx - 1; i >= newx; i--) vec[i].w_float = newy + (oldy - newy) * - ((float)(newx - i))/(float)(newx - oldx); + ((t_float)(newx - i))/(t_float)(newx - oldx); } else vec[newx].w_float = newy; garray_redraw(a); diff --git a/pd/src/g_hdial.c b/pd/src/g_hdial.c index df595126..ace2ce66 100644 --- a/pd/src/g_hdial.c +++ b/pd/src/g_hdial.c @@ -73,10 +73,10 @@ void hradio_draw_new(t_hradio *x, t_glist *glist) x->x_drawn = x->x_on; } sys_vgui(".x%lx.c create text %d %d -text {%s} -anchor w \ - -font {%s %d bold} -fill #%6.6x -tags %lxLABEL\n", + -font {{%s} -%d %s} -fill #%6.6x -tags %lxLABEL\n", canvas, xx11b+x->x_gui.x_ldx, yy11+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_font, x->x_gui.x_fontsize, sys_fontweight, x->x_gui.x_lcol, x); if(!x->x_gui.x_fsf.x_snd_able) sys_vgui(".x%lx.c create rectangle %d %d %d %d -tags %lxOUT%d\n", @@ -141,8 +141,8 @@ void hradio_draw_config(t_hradio* x, t_glist* glist) t_canvas *canvas=glist_getcanvas(glist); int n=x->x_number, i; - sys_vgui(".x%lx.c itemconfigure %lxLABEL -font {%s %d bold} -fill #%6.6x -text {%s} \n", - canvas, x, x->x_gui.x_font, x->x_gui.x_fontsize, + sys_vgui(".x%lx.c itemconfigure %lxLABEL -font {{%s} -%d %s} -fill #%6.6x -text {%s} \n", + canvas, x, x->x_gui.x_font, x->x_gui.x_fontsize, sys_fontweight, x->x_gui.x_fsf.x_selected?IEM_GUI_COLOR_SELECTED:x->x_gui.x_lcol, strcmp(x->x_gui.x_lab->s_name, "empty")?x->x_gui.x_lab->s_name:""); for(i=0; i<n; i++) @@ -264,7 +264,7 @@ static void hradio_properties(t_gobj *z, t_glist *owner) iemgui_properties(&x->x_gui, srl); if (pd_class(&x->x_gui.x_obj.ob_pd) == hradio_old_class) hchange = x->x_change; - sprintf(buf, "pdtk_iemgui_dialog %%s hradio \ + sprintf(buf, "pdtk_iemgui_dialog %%s |hradio| \ ----------dimensions(pix):----------- %d %d size: 0 0 empty \ empty 0.0 empty 0.0 empty %d \ %d new-only new&old %d %d number: %d \ @@ -347,14 +347,14 @@ static void hradio_bang(t_hradio *x) { if((x->x_change)&&(x->x_on != x->x_on_old)) { - SETFLOAT(x->x_at, (float)x->x_on_old); + SETFLOAT(x->x_at, (t_float)x->x_on_old); SETFLOAT(x->x_at+1, 0.0); outlet_list(x->x_gui.x_obj.ob_outlet, &s_list, 2, x->x_at); if(x->x_gui.x_fsf.x_snd_able && x->x_gui.x_snd->s_thing) pd_list(x->x_gui.x_snd->s_thing, &s_list, 2, x->x_at); } x->x_on_old = x->x_on; - SETFLOAT(x->x_at, (float)x->x_on); + SETFLOAT(x->x_at, (t_float)x->x_on); SETFLOAT(x->x_at+1, 1.0); outlet_list(x->x_gui.x_obj.ob_outlet, &s_list, 2, x->x_at); if(x->x_gui.x_fsf.x_snd_able && x->x_gui.x_snd->s_thing) @@ -381,7 +381,7 @@ static void hradio_fout(t_hradio *x, t_floatarg f) { if((x->x_change)&&(i != x->x_on_old)) { - SETFLOAT(x->x_at, (float)x->x_on_old); + SETFLOAT(x->x_at, (t_float)x->x_on_old); SETFLOAT(x->x_at+1, 0.0); outlet_list(x->x_gui.x_obj.ob_outlet, &s_list, 2, x->x_at); if(x->x_gui.x_fsf.x_snd_able && x->x_gui.x_snd->s_thing) @@ -392,7 +392,7 @@ static void hradio_fout(t_hradio *x, t_floatarg f) x->x_on = i; (*x->x_gui.x_draw)(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_UPDATE); x->x_on_old = x->x_on; - SETFLOAT(x->x_at, (float)x->x_on); + SETFLOAT(x->x_at, (t_float)x->x_on); SETFLOAT(x->x_at+1, 1.0); outlet_list(x->x_gui.x_obj.ob_outlet, &s_list, 2, x->x_at); if(x->x_gui.x_fsf.x_snd_able && x->x_gui.x_snd->s_thing) @@ -425,7 +425,7 @@ static void hradio_float(t_hradio *x, t_floatarg f) { if(x->x_gui.x_fsf.x_put_in2out) { - SETFLOAT(x->x_at, (float)x->x_on_old); + SETFLOAT(x->x_at, (t_float)x->x_on_old); SETFLOAT(x->x_at+1, 0.0); outlet_list(x->x_gui.x_obj.ob_outlet, &s_list, 2, x->x_at); if(x->x_gui.x_fsf.x_snd_able && x->x_gui.x_snd->s_thing) @@ -439,7 +439,7 @@ static void hradio_float(t_hradio *x, t_floatarg f) x->x_on_old = x->x_on; if(x->x_gui.x_fsf.x_put_in2out) { - SETFLOAT(x->x_at, (float)x->x_on); + SETFLOAT(x->x_at, (t_float)x->x_on); SETFLOAT(x->x_at+1, 1.0); outlet_list(x->x_gui.x_obj.ob_outlet, &s_list, 2, x->x_at); if(x->x_gui.x_fsf.x_snd_able && x->x_gui.x_snd->s_thing) @@ -464,7 +464,7 @@ 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); - hradio_fout(x, (float)(xx / x->x_gui.x_w)); + hradio_fout(x, (t_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) @@ -589,7 +589,7 @@ static void *hradio_donew(t_symbol *s, int argc, t_atom *argv, int old) if(x->x_gui.x_fsf.x_font_style == 1) strcpy(x->x_gui.x_font, "helvetica"); else if(x->x_gui.x_fsf.x_font_style == 2) strcpy(x->x_gui.x_font, "times"); else { x->x_gui.x_fsf.x_font_style = 0; - strcpy(x->x_gui.x_font, "courier"); } + strcpy(x->x_gui.x_font, sys_font); } if(num < 1) num = 1; if(num > IEM_RADIO_MAX) diff --git a/pd/src/g_hslider.c b/pd/src/g_hslider.c index 4958639a..8dc3d0e6 100644 --- a/pd/src/g_hslider.c +++ b/pd/src/g_hslider.c @@ -76,11 +76,12 @@ static void hslider_draw_new(t_hslider *x, t_glist *glist) canvas, r, ypos+1, r, ypos + x->x_gui.x_h, x->x_gui.x_fcol, x); sys_vgui(".x%lx.c create text %d %d -text {%s} -anchor w \ - -font {%s %d bold} -fill #%6.6x -tags %lxLABEL\n", + -font {{%s} -%d %s} -fill #%6.6x -tags %lxLABEL\n", 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); + x->x_gui.x_font, x->x_gui.x_fontsize, sys_fontweight, + x->x_gui.x_lcol, x); if(!x->x_gui.x_fsf.x_snd_able) sys_vgui(".x%lx.c create rectangle %d %d %d %d -tags %lxOUT%d\n", canvas, xpos-3, ypos + x->x_gui.x_h-1, @@ -136,8 +137,8 @@ static void hslider_draw_config(t_hslider* x,t_glist* glist) { t_canvas *canvas=glist_getcanvas(glist); - sys_vgui(".x%lx.c itemconfigure %lxLABEL -font {%s %d bold} -fill #%6.6x -text {%s} \n", - canvas, x, x->x_gui.x_font, x->x_gui.x_fontsize, + sys_vgui(".x%lx.c itemconfigure %lxLABEL -font {{%s} -%d %s} -fill #%6.6x -text {%s} \n", + canvas, x, x->x_gui.x_font, x->x_gui.x_fontsize, sys_fontweight, x->x_gui.x_fsf.x_selected?IEM_GUI_COLOR_SELECTED:x->x_gui.x_lcol, strcmp(x->x_gui.x_lab->s_name, "empty")?x->x_gui.x_lab->s_name:""); sys_vgui(".x%lx.c itemconfigure %lxKNOB -fill #%6.6x\n", canvas, x, x->x_gui.x_fcol); @@ -222,7 +223,7 @@ static void hslider_save(t_gobj *z, t_binbuf *b) binbuf_addv(b, "ssiisiiffiisssiiiiiiiii", gensym("#X"),gensym("obj"), (int)x->x_gui.x_obj.te_xpix, (int)x->x_gui.x_obj.te_ypix, gensym("hsl"), x->x_gui.x_w, x->x_gui.x_h, - (float)x->x_min, (float)x->x_max, + (t_float)x->x_min, (t_float)x->x_max, x->x_lin0_log1, iem_symargstoint(&x->x_gui.x_isa), srl[0], srl[1], srl[2], x->x_gui.x_ldx, x->x_gui.x_ldy, @@ -285,7 +286,7 @@ static void hslider_properties(t_gobj *z, t_glist *owner) t_symbol *srl[3]; iemgui_properties(&x->x_gui, srl); - sprintf(buf, "pdtk_iemgui_dialog %%s HSLIDER \ + sprintf(buf, "pdtk_iemgui_dialog %%s |hsl| \ --------dimensions(pix)(pix):-------- %d %d width: %d %d height: \ -----------output-range:----------- %g left: %g right: %g \ %d lin log %d %d empty %d \ @@ -586,7 +587,7 @@ static void *hslider_new(t_symbol *s, int argc, t_atom *argv) if(x->x_gui.x_fsf.x_font_style == 1) strcpy(x->x_gui.x_font, "helvetica"); else if(x->x_gui.x_fsf.x_font_style == 2) strcpy(x->x_gui.x_font, "times"); else { x->x_gui.x_fsf.x_font_style = 0; - strcpy(x->x_gui.x_font, "courier"); } + strcpy(x->x_gui.x_font, sys_font); } if(x->x_gui.x_fsf.x_rcv_able) pd_bind(&x->x_gui.x_obj.ob_pd, x->x_gui.x_rcv); x->x_gui.x_ldx = ldx; diff --git a/pd/src/g_io.c b/pd/src/g_io.c index 6c173c27..2ee89c1c 100644 --- a/pd/src/g_io.c +++ b/pd/src/g_io.c @@ -292,10 +292,10 @@ typedef struct _voutlet t_canvas *x_canvas; t_outlet *x_parentoutlet; int x_bufsize; - t_float *x_buf; /* signal buffer; zero if not a signal */ - t_float *x_endbuf; - t_float *x_empty; /* next to read out of buffer in epilog code */ - t_float *x_write; /* next to write in to buffer */ + t_sample *x_buf; /* signal buffer; zero if not a signal */ + t_sample *x_endbuf; + t_sample *x_empty; /* next to read out of buffer in epilog code */ + t_sample *x_write; /* next to write in to buffer */ int x_hop; /* hopsize */ /* vice versa from the inlet, if we don't block, this holds the parent's outlet signal, valid between the prolog and the dsp setup @@ -373,7 +373,7 @@ t_int *voutlet_perform(t_int *w) t_voutlet *x = (t_voutlet *)(w[1]); t_float *in = (t_float *)(w[2]); int n = (int)(w[3]); - t_float *out = x->x_write, *outwas = out; + t_sample *out = x->x_write, *outwas = out; #if 0 if (tot < 5) post("-in %lx out %lx n %d", in, out, n); if (tot < 5) post("-buf %lx endbuf %lx", x->x_buf, x->x_endbuf); @@ -393,10 +393,10 @@ t_int *voutlet_perform(t_int *w) static t_int *voutlet_doepilog(t_int *w) { t_voutlet *x = (t_voutlet *)(w[1]); - t_float *out = (t_float *)(w[2]); + t_sample *out = (t_sample *)(w[2]); int n = (int)(w[3]); - t_float *in = x->x_empty; + t_sample *in = x->x_empty; if (x->x_updown.downsample != x->x_updown.upsample) out = x->x_updown.s_vec; @@ -413,8 +413,8 @@ static t_int *voutlet_doepilog_resampling(t_int *w) { t_voutlet *x = (t_voutlet *)(w[1]); int n = (int)(w[2]); - t_float *in = x->x_empty; - t_float *out = x->x_updown.s_vec; + t_sample *in = x->x_empty; + t_sample *out = x->x_updown.s_vec; #if 0 if (tot < 5) post("outlet in %lx out %lx n %lx", in, out, n), tot++; @@ -504,9 +504,9 @@ void voutlet_dspepilog(struct _voutlet *x, t_signal **parentsigs, if (bufsize < myvecsize) bufsize = myvecsize; if (bufsize != (oldbufsize = x->x_bufsize)) { - t_float *buf = x->x_buf; + t_sample *buf = x->x_buf; t_freebytes(buf, oldbufsize * sizeof(*buf)); - buf = (t_float *)t_getbytes(bufsize * sizeof(*buf)); + buf = (t_sample *)t_getbytes(bufsize * sizeof(*buf)); memset((char *)buf, 0, bufsize * sizeof(*buf)); x->x_bufsize = bufsize; x->x_endbuf = buf + bufsize; @@ -556,7 +556,7 @@ static void *voutlet_newsig(t_symbol *s) x->x_parentoutlet = canvas_addoutlet(x->x_canvas, &x->x_obj.ob_pd, &s_signal); inlet_new(&x->x_obj, &x->x_obj.ob_pd, &s_signal, &s_signal); - x->x_endbuf = x->x_buf = (t_float *)getbytes(0); + x->x_endbuf = x->x_buf = (t_sample *)getbytes(0); x->x_bufsize = 0; resample_init(&x->x_updown); diff --git a/pd/src/g_mycanvas.c b/pd/src/g_mycanvas.c index 93f96ff5..1040c11f 100644 --- a/pd/src/g_mycanvas.c +++ b/pd/src/g_mycanvas.c @@ -44,10 +44,11 @@ void my_canvas_draw_new(t_my_canvas *x, t_glist *glist) xpos + x->x_gui.x_w, ypos + x->x_gui.x_h, x->x_gui.x_bcol, x); sys_vgui(".x%lx.c create text %d %d -text {%s} -anchor w \ - -font {%s %d bold} -fill #%6.6x -tags %lxLABEL\n", + -font {{%s} -%d %s} -fill #%6.6x -tags %lxLABEL\n", 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); + x->x_gui.x_font, x->x_gui.x_fontsize, sys_fontweight, + x->x_gui.x_lcol, x); } void my_canvas_draw_move(t_my_canvas *x, t_glist *glist) @@ -84,8 +85,9 @@ void my_canvas_draw_config(t_my_canvas* x, t_glist* glist) x->x_gui.x_bcol, x->x_gui.x_bcol); sys_vgui(".x%lx.c itemconfigure %lxBASE -outline #%6.6x\n", canvas, x, x->x_gui.x_fsf.x_selected?IEM_GUI_COLOR_SELECTED:x->x_gui.x_bcol); - sys_vgui(".x%lx.c itemconfigure %lxLABEL -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, + sys_vgui(".x%lx.c itemconfigure %lxLABEL -font {{%s} -%d %s} -fill #%6.6x -text {%s} \n", + canvas, x, x->x_gui.x_font, x->x_gui.x_fontsize, sys_fontweight, + x->x_gui.x_lcol, strcmp(x->x_gui.x_lab->s_name, "empty")?x->x_gui.x_lab->s_name:""); } @@ -152,7 +154,7 @@ static void my_canvas_properties(t_gobj *z, t_glist *owner) t_symbol *srl[3]; iemgui_properties(&x->x_gui, srl); - sprintf(buf, "pdtk_iemgui_dialog %%s MY_CANVAS \ + sprintf(buf, "pdtk_iemgui_dialog %%s |cnv| \ ------selectable_dimensions(pix):------ %d %d size: 0.0 0.0 empty \ ------visible_rectangle(pix)(pix):------ %d width: %d height: %d \ %d empty empty %d %d empty %d \ @@ -331,7 +333,7 @@ static void *my_canvas_new(t_symbol *s, int argc, t_atom *argv) if(x->x_gui.x_fsf.x_font_style == 1) strcpy(x->x_gui.x_font, "helvetica"); else if(x->x_gui.x_fsf.x_font_style == 2) strcpy(x->x_gui.x_font, "times"); else { x->x_gui.x_fsf.x_font_style = 0; - strcpy(x->x_gui.x_font, "courier"); } + strcpy(x->x_gui.x_font, sys_font); } if (x->x_gui.x_fsf.x_rcv_able) pd_bind(&x->x_gui.x_obj.ob_pd, x->x_gui.x_rcv); x->x_gui.x_ldx = ldx; diff --git a/pd/src/g_numbox.c b/pd/src/g_numbox.c index 04c9c1bb..db25e918 100644 --- a/pd/src/g_numbox.c +++ b/pd/src/g_numbox.c @@ -195,15 +195,17 @@ static void my_numbox_draw_new(t_my_numbox *x, t_glist *glist) xpos, ypos + x->x_gui.x_h, x->x_gui.x_fcol, x); sys_vgui(".x%lx.c create text %d %d -text {%s} -anchor w \ - -font {%s %d bold} -fill #%6.6x -tags %lxLABEL\n", + -font {{%s} -%d %s} -fill #%6.6x -tags %lxLABEL\n", 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); + x->x_gui.x_font, x->x_gui.x_fontsize, sys_fontweight, + x->x_gui.x_lcol, x); my_numbox_ftoa(x); sys_vgui(".x%lx.c create text %d %d -text {%s} -anchor w \ - -font {%s %d bold} -fill #%6.6x -tags %lxNUMBER\n", + -font {{%s} -%d %s} -fill #%6.6x -tags %lxNUMBER\n", canvas, xpos+half+2, ypos+half+d, - x->x_buf, x->x_gui.x_font, x->x_gui.x_fontsize, x->x_gui.x_fcol, x); + x->x_buf, x->x_gui.x_font, x->x_gui.x_fontsize, sys_fontweight, + x->x_gui.x_fcol, x); if(!x->x_gui.x_fsf.x_snd_able) sys_vgui(".x%lx.c create rectangle %d %d %d %d -tags %lxOUT%d\n", canvas, @@ -269,12 +271,12 @@ static void my_numbox_draw_config(t_my_numbox* x,t_glist* glist) { t_canvas *canvas=glist_getcanvas(glist); - sys_vgui(".x%lx.c itemconfigure %lxLABEL -font {%s %d bold} -fill #%6.6x -text {%s} \n", - canvas, x, x->x_gui.x_font, x->x_gui.x_fontsize, + sys_vgui(".x%lx.c itemconfigure %lxLABEL -font {{%s} -%d %s} -fill #%6.6x -text {%s} \n", + canvas, x, x->x_gui.x_font, x->x_gui.x_fontsize, sys_fontweight, x->x_gui.x_fsf.x_selected?IEM_GUI_COLOR_SELECTED:x->x_gui.x_lcol, strcmp(x->x_gui.x_lab->s_name, "empty")?x->x_gui.x_lab->s_name:""); - sys_vgui(".x%lx.c itemconfigure %lxNUMBER -font {%s %d bold} -fill #%6.6x \n", - canvas, x, x->x_gui.x_font, x->x_gui.x_fontsize, + sys_vgui(".x%lx.c itemconfigure %lxNUMBER -font {{%s} -%d %s} -fill #%6.6x \n", + canvas, x, x->x_gui.x_font, x->x_gui.x_fontsize, sys_fontweight, x->x_gui.x_fsf.x_selected?IEM_GUI_COLOR_SELECTED:x->x_gui.x_fcol); sys_vgui(".x%lx.c itemconfigure %lxBASE1 -fill #%6.6x\n", canvas, x, x->x_gui.x_bcol); @@ -389,7 +391,7 @@ static void my_numbox_save(t_gobj *z, t_binbuf *b) binbuf_addv(b, "ssiisiiffiisssiiiiiiifi", gensym("#X"),gensym("obj"), (int)x->x_gui.x_obj.te_xpix, (int)x->x_gui.x_obj.te_ypix, gensym("nbx"), x->x_gui.x_w, x->x_gui.x_h, - (float)x->x_min, (float)x->x_max, + (t_float)x->x_min, (t_float)x->x_max, x->x_lin0_log1, iem_symargstoint(&x->x_gui.x_isa), srl[0], srl[1], srl[2], x->x_gui.x_ldx, x->x_gui.x_ldy, @@ -451,7 +453,7 @@ static void my_numbox_properties(t_gobj *z, t_glist *owner) sys_queuegui(x, x->x_gui.x_glist, my_numbox_draw_update); } - sprintf(buf, "pdtk_iemgui_dialog %%s NUMBERBOX \ + sprintf(buf, "pdtk_iemgui_dialog %%s |nbx| \ -------dimensions(digits)(pix):------- %d %d width: %d %d height: \ -----------output-range:----------- %g min: %g max: %d \ %d lin log %d %d log-height: %d \ @@ -806,7 +808,7 @@ static void *my_numbox_new(t_symbol *s, int argc, t_atom *argv) if(x->x_gui.x_fsf.x_font_style == 1) strcpy(x->x_gui.x_font, "helvetica"); else if(x->x_gui.x_fsf.x_font_style == 2) strcpy(x->x_gui.x_font, "times"); else { x->x_gui.x_fsf.x_font_style = 0; - strcpy(x->x_gui.x_font, "courier"); } + strcpy(x->x_gui.x_font, sys_font); } if (x->x_gui.x_fsf.x_rcv_able) pd_bind(&x->x_gui.x_obj.ob_pd, x->x_gui.x_rcv); x->x_gui.x_ldx = ldx; diff --git a/pd/src/g_readwrite.c b/pd/src/g_readwrite.c index ff93a4dd..97b56c02 100644 --- a/pd/src/g_readwrite.c +++ b/pd/src/g_readwrite.c @@ -619,15 +619,15 @@ static void canvas_saveto(t_canvas *x, t_binbuf *b) binbuf_addv(b, "ssfffffffff;", gensym("#X"), gensym("coords"), x->gl_x1, x->gl_y1, x->gl_x2, x->gl_y2, - (float)x->gl_pixwidth, (float)x->gl_pixheight, - (float)((x->gl_hidetext)?2.:1.), - (float)x->gl_xmargin, (float)x->gl_ymargin); + (t_float)x->gl_pixwidth, (t_float)x->gl_pixheight, + (t_float)((x->gl_hidetext)?2.:1.), + (t_float)x->gl_xmargin, (t_float)x->gl_ymargin); /* otherwise write in 0.38-compatible form */ else binbuf_addv(b, "ssfffffff;", gensym("#X"), gensym("coords"), x->gl_x1, x->gl_y1, x->gl_x2, x->gl_y2, - (float)x->gl_pixwidth, (float)x->gl_pixheight, - (float)x->gl_isgraph); + (t_float)x->gl_pixwidth, (t_float)x->gl_pixheight, + (t_float)x->gl_isgraph); } } diff --git a/pd/src/g_rtext.c b/pd/src/g_rtext.c index cbb0ba88..948ebcb4 100644 --- a/pd/src/g_rtext.c +++ b/pd/src/g_rtext.c @@ -15,10 +15,16 @@ #include "g_canvas.h" #include "t_tk.h" -#define LMARGIN 1 -#define RMARGIN 1 +#define LMARGIN 2 +#define RMARGIN 2 +/* for some reason, it draws text 1 pixel lower on Mac OS X (& linux too?) */ +#ifndef MSW #define TMARGIN 2 #define BMARGIN 2 +#else +#define TMARGIN 3 +#define BMARGIN 1 +#endif #define SEND_FIRST 1 #define SEND_UPDATE 2 @@ -150,7 +156,7 @@ extern int sys_oldtclversion; static void rtext_senditup(t_rtext *x, int action, int *widthp, int *heightp, int *indexp) { - float dispx, dispy; + t_float dispx, dispy; char smallbuf[200], *tempbuf; int outchars = 0, nlines = 0, ncolumns = 0, pixwide, pixhigh, font, fontwidth, fontheight, findx, findy; diff --git a/pd/src/g_scalar.c b/pd/src/g_scalar.c index 76d54007..675df500 100644 --- a/pd/src/g_scalar.c +++ b/pd/src/g_scalar.c @@ -49,7 +49,7 @@ void word_restore(t_word *wp, t_template *template, int type = datatypes->ds_type; if (type == DT_FLOAT) { - float f; + t_float f; if (argc) { f = atom_getfloat(argv); @@ -145,7 +145,7 @@ void glist_scalar(t_glist *glist, } /* -------------------- widget behavior for scalar ------------ */ -void scalar_getbasexy(t_scalar *x, float *basex, float *basey) +void scalar_getbasexy(t_scalar *x, t_float *basex, t_float *basey) { t_template *template = template_findbyname(x->sc_template); *basex = template_getfloat(template, gensym("x"), x->sc_vec, 0); @@ -160,7 +160,7 @@ static void scalar_getrect(t_gobj *z, t_glist *owner, t_canvas *templatecanvas = template_findcanvas(template); int x1 = 0x7fffffff, x2 = -0x7fffffff, y1 = 0x7fffffff, y2 = -0x7fffffff; t_gobj *y; - float basex, basey; + t_float basex, basey; scalar_getbasexy(x, &basex, &basey); /* if someone deleted the template canvas, we're just a point */ if (!templatecanvas) @@ -260,8 +260,8 @@ static void scalar_displace(t_gobj *z, t_glist *glist, int dx, int dy) gpointer_init(&gp); gpointer_setglist(&gp, glist, x); SETPOINTER(&at[0], &gp); - SETFLOAT(&at[1], (float)dx); - SETFLOAT(&at[2], (float)dy); + SETFLOAT(&at[1], (t_float)dx); + SETFLOAT(&at[2], (t_float)dy); template_notify(template, gensym("displace"), 2, at); scalar_redraw(x, glist); } @@ -283,7 +283,7 @@ static void scalar_vis(t_gobj *z, t_glist *owner, int vis) t_template *template = template_findbyname(x->sc_template); t_canvas *templatecanvas = template_findcanvas(template); t_gobj *y; - float basex, basey; + t_float basex, basey; scalar_getbasexy(x, &basex, &basey); /* if we don't know how to draw it, make a small rectangle */ if (!templatecanvas) @@ -327,14 +327,14 @@ void scalar_redraw(t_scalar *x, t_glist *glist) int scalar_doclick(t_word *data, t_template *template, t_scalar *sc, t_array *ap, struct _glist *owner, - float xloc, float yloc, int xpix, int ypix, + t_float xloc, t_float yloc, int xpix, int ypix, int shift, int alt, int dbl, int doit) { int hit = 0; t_canvas *templatecanvas = template_findcanvas(template); t_gobj *y; - float basex = template_getfloat(template, gensym("x"), data, 0); - float basey = template_getfloat(template, gensym("y"), data, 0); + t_float basex = template_getfloat(template, gensym("x"), data, 0); + t_float basey = template_getfloat(template, gensym("y"), data, 0); for (y = templatecanvas->gl_list; y; y = y->g_next) { t_parentwidgetbehavior *wb = pd_getparentwidget(&y->g_pd); diff --git a/pd/src/g_template.c b/pd/src/g_template.c index f5519e65..4d66bbed 100644 --- a/pd/src/g_template.c +++ b/pd/src/g_template.c @@ -147,7 +147,7 @@ t_float template_getfloat(t_template *x, t_symbol *fieldname, t_word *wp, { int onset, type; t_symbol *arraytype; - float val = 0; + t_float val = 0; if (template_find_field(x, fieldname, &onset, &type, &arraytype)) { if (type == DT_FLOAT) @@ -721,14 +721,14 @@ struct _fielddesc t_symbol *fd_symbol; /* the field is a constant symbol */ t_symbol *fd_varsym; /* the field is variable and this is the name */ } fd_un; - float fd_v1; /* min and max values */ - float fd_v2; - float fd_screen1; /* min and max screen values */ - float fd_screen2; - float fd_quantum; /* quantization in value */ + t_float fd_v1; /* min and max values */ + t_float fd_v2; + t_float fd_screen1; /* min and max screen values */ + t_float fd_screen2; + t_float fd_quantum; /* quantization in value */ }; -static void fielddesc_setfloat_const(t_fielddesc *fd, float f) +static void fielddesc_setfloat_const(t_fielddesc *fd, t_float f) { fd->fd_type = A_FLOAT; fd->fd_var = 0; @@ -851,9 +851,9 @@ static t_float fielddesc_getfloat(t_fielddesc *f, t_template *template, } /* convert a variable's value to a screen coordinate via its fielddesc */ -t_float fielddesc_cvttocoord(t_fielddesc *f, float val) +t_float fielddesc_cvttocoord(t_fielddesc *f, t_float val) { - float coord, pix, extreme, div; + t_float coord, pix, extreme, div; if (f->fd_v2 == f->fd_v1) return (val); div = (f->fd_screen2 - f->fd_screen1)/(f->fd_v2 - f->fd_v1); @@ -877,7 +877,7 @@ t_float fielddesc_getcoord(t_fielddesc *f, t_template *template, { if (f->fd_var) { - float val = template_getfloat(template, + t_float val = template_getfloat(template, f->fd_un.fd_varsym, wp, loud); return (fielddesc_cvttocoord(f, val)); } @@ -909,15 +909,15 @@ static t_symbol *fielddesc_getsymbol(t_fielddesc *f, t_template *template, } /* convert from a screen coordinate to a variable value */ -float fielddesc_cvtfromcoord(t_fielddesc *f, float coord) +t_float fielddesc_cvtfromcoord(t_fielddesc *f, t_float coord) { - float val; + t_float val; if (f->fd_screen2 == f->fd_screen1) val = coord; else { - float div = (f->fd_v2 - f->fd_v1)/(f->fd_screen2 - f->fd_screen1); - float extreme; + t_float div = (f->fd_v2 - f->fd_v1)/(f->fd_screen2 - f->fd_screen1); + t_float extreme; val = f->fd_v1 + (coord - f->fd_screen1) * div; if (f->fd_quantum != 0) val = ((int)((val/f->fd_quantum) + 0.5)) * f->fd_quantum; @@ -932,11 +932,11 @@ float fielddesc_cvtfromcoord(t_fielddesc *f, float coord) } void fielddesc_setcoord(t_fielddesc *f, t_template *template, - t_word *wp, float coord, int loud) + t_word *wp, t_float coord, int loud) { if (f->fd_type == A_FLOAT && f->fd_var) { - float val = fielddesc_cvtfromcoord(f, coord); + t_float val = fielddesc_cvtfromcoord(f, coord); template_setfloat(template, f->fd_un.fd_varsym, wp, val, loud); } @@ -1040,7 +1040,7 @@ void curve_float(t_curve *x, t_floatarg f) /* -------------------- widget behavior for curve ------------ */ static void curve_getrect(t_gobj *z, t_glist *glist, - t_word *data, t_template *template, float basex, float basey, + t_word *data, t_template *template, t_float basex, t_float basey, int *xp1, int *yp1, int *xp2, int *yp2) { t_curve *x = (t_curve *)z; @@ -1072,21 +1072,21 @@ static void curve_getrect(t_gobj *z, t_glist *glist, } static void curve_displace(t_gobj *z, t_glist *glist, - t_word *data, t_template *template, float basex, float basey, + t_word *data, t_template *template, t_float basex, t_float basey, int dx, int dy) { /* refuse */ } static void curve_select(t_gobj *z, t_glist *glist, - t_word *data, t_template *template, float basex, float basey, + t_word *data, t_template *template, t_float basex, t_float basey, int state) { /* fill in later */ } static void curve_activate(t_gobj *z, t_glist *glist, - t_word *data, t_template *template, float basex, float basey, + t_word *data, t_template *template, t_float basex, t_float basey, int state) { /* fill in later */ @@ -1122,7 +1122,7 @@ static void numbertocolor(int n, char *s) } static void curve_vis(t_gobj *z, t_glist *glist, - t_word *data, t_template *template, float basex, float basey, + t_word *data, t_template *template, t_float basex, t_float basey, int vis) { t_curve *x = (t_curve *)z; @@ -1137,7 +1137,7 @@ static void curve_vis(t_gobj *z, t_glist *glist, if (n > 1) { int flags = x->x_flags, closed = (flags & CLOSED); - float width = fielddesc_getfloat(&x->x_width, template, data, 1); + t_float width = fielddesc_getfloat(&x->x_width, template, data, 1); char outline[20], fill[20]; int pix[200]; if (n > 100) @@ -1185,12 +1185,12 @@ static void curve_vis(t_gobj *z, t_glist *glist, } static int curve_motion_field; -static float curve_motion_xcumulative; -static float curve_motion_xbase; -static float curve_motion_xper; -static float curve_motion_ycumulative; -static float curve_motion_ybase; -static float curve_motion_yper; +static t_float curve_motion_xcumulative; +static t_float curve_motion_xbase; +static t_float curve_motion_xper; +static t_float curve_motion_ycumulative; +static t_float curve_motion_ybase; +static t_float curve_motion_yper; static t_glist *curve_motion_glist; static t_scalar *curve_motion_scalar; static t_array *curve_motion_array; @@ -1237,7 +1237,7 @@ static void curve_motion(void *z, t_floatarg dx, t_floatarg dy) static int curve_click(t_gobj *z, t_glist *glist, t_word *data, t_template *template, t_scalar *sc, t_array *ap, - float basex, float basey, + t_float basex, t_float basey, int xpix, int ypix, int shift, int alt, int dbl, int doit) { t_curve *x = (t_curve *)z; @@ -1438,8 +1438,8 @@ void plot_float(t_plot *x, t_floatarg f) static int plot_readownertemplate(t_plot *x, t_word *data, t_template *ownertemplate, t_symbol **elemtemplatesymp, t_array **arrayp, - float *linewidthp, float *xlocp, float *xincp, float *ylocp, float *stylep, - float *visp, float *scalarvisp, + t_float *linewidthp, t_float *xlocp, t_float *xincp, t_float *ylocp, t_float *stylep, + t_float *visp, t_float *scalarvisp, t_fielddesc **xfield, t_fielddesc **yfield, t_fielddesc **wfield) { int arrayonset, type; @@ -1538,7 +1538,7 @@ int array_getfields(t_symbol *elemtemplatesym, } static void plot_getrect(t_gobj *z, t_glist *glist, - t_word *data, t_template *template, float basex, float basey, + t_word *data, t_template *template, t_float basex, t_float basey, int *xp1, int *yp1, int *xp2, int *yp2) { t_plot *x = (t_plot *)z; @@ -1546,11 +1546,11 @@ static void plot_getrect(t_gobj *z, t_glist *glist, t_canvas *elemtemplatecanvas; t_template *elemtemplate; t_symbol *elemtemplatesym; - float linewidth, xloc, xinc, yloc, style, xsum, yval, vis, scalarvis; + t_float linewidth, xloc, xinc, yloc, style, xsum, yval, vis, scalarvis; t_array *array; int x1 = 0x7fffffff, y1 = 0x7fffffff, x2 = -0x7fffffff, y2 = -0x7fffffff; int i; - float xpix, ypix, wpix; + t_float xpix, ypix, wpix; t_fielddesc *xfielddesc, *yfielddesc, *wfielddesc; if (!plot_readownertemplate(x, data, template, &elemtemplatesym, &array, &linewidth, &xloc, &xinc, &yloc, &style, @@ -1565,7 +1565,7 @@ static void plot_getrect(t_gobj *z, t_glist *glist, int incr = (array->a_n <= 2000 ? 1 : array->a_n / 1000); for (i = 0, xsum = 0; i < array->a_n; i += incr) { - float usexloc, useyloc; + t_float usexloc, useyloc; t_gobj *y; /* get the coords of the point proper */ array_getcoordinate(glist, (char *)(array->a_vec) + i * elemsize, @@ -1585,11 +1585,11 @@ static void plot_getrect(t_gobj *z, t_glist *glist, /* check also the drawing instructions for the scalar */ if (xonset >= 0) usexloc = basex + xloc + fielddesc_cvttocoord(xfielddesc, - *(float *)(((char *)(array->a_vec) + elemsize * i) + *(t_float *)(((char *)(array->a_vec) + elemsize * i) + xonset)); else usexloc = basex + xsum, xsum += xinc; if (yonset >= 0) - yval = *(float *)(((char *)(array->a_vec) + elemsize * i) + yval = *(t_float *)(((char *)(array->a_vec) + elemsize * i) + yonset); else yval = 0; useyloc = basey + yloc + fielddesc_cvttocoord(yfielddesc, yval); @@ -1622,28 +1622,28 @@ static void plot_getrect(t_gobj *z, t_glist *glist, } static void plot_displace(t_gobj *z, t_glist *glist, - t_word *data, t_template *template, float basex, float basey, + t_word *data, t_template *template, t_float basex, t_float basey, int dx, int dy) { /* not yet */ } static void plot_select(t_gobj *z, t_glist *glist, - t_word *data, t_template *template, float basex, float basey, + t_word *data, t_template *template, t_float basex, t_float basey, int state) { /* not yet */ } static void plot_activate(t_gobj *z, t_glist *glist, - t_word *data, t_template *template, float basex, float basey, + t_word *data, t_template *template, t_float basex, t_float basey, int state) { /* not yet */ } static void plot_vis(t_gobj *z, t_glist *glist, - t_word *data, t_template *template, float basex, float basey, + t_word *data, t_template *template, t_float basex, t_float basey, int tovis) { t_plot *x = (t_plot *)z; @@ -1651,7 +1651,7 @@ static void plot_vis(t_gobj *z, t_glist *glist, t_canvas *elemtemplatecanvas; t_template *elemtemplate; t_symbol *elemtemplatesym; - float linewidth, xloc, xinc, yloc, style, usexloc, xsum, yval, vis, + t_float linewidth, xloc, xinc, yloc, style, usexloc, xsum, yval, vis, scalarvis; t_array *array; int nelem; @@ -1681,17 +1681,17 @@ static void plot_vis(t_gobj *z, t_glist *glist, { if (style == PLOTSTYLE_POINTS) { - float minyval = 1e20, maxyval = -1e20; + t_float minyval = 1e20, maxyval = -1e20; int ndrawn = 0; for (xsum = basex + xloc, i = 0; i < nelem; i++) { - float yval, xpix, ypix, nextxloc; + t_float yval, xpix, ypix, nextxloc; int ixpix, inextx; if (xonset >= 0) { usexloc = basex + xloc + - *(float *)((elem + elemsize * i) + xonset); + *(t_float *)((elem + elemsize * i) + xonset); ixpix = glist_xtopixels(glist, fielddesc_cvttocoord(xfielddesc, usexloc)); inextx = ixpix + 2; @@ -1707,7 +1707,7 @@ static void plot_vis(t_gobj *z, t_glist *glist, } if (yonset >= 0) - yval = yloc + *(float *)((elem + elemsize * i) + yonset); + yval = yloc + *(t_float *)((elem + elemsize * i) + yonset); else yval = 0; if (yval > maxyval) maxyval = yval; @@ -1734,7 +1734,7 @@ static void plot_vis(t_gobj *z, t_glist *glist, { char outline[20]; int lastpixel = -1, ndrawn = 0; - float yval = 0, wval = 0, xpix; + t_float yval = 0, wval = 0, xpix; int ixpix = 0; /* draw the trace */ numbertocolor(fielddesc_getfloat(&x->x_outlinecolor, template, @@ -1749,13 +1749,13 @@ static void plot_vis(t_gobj *z, t_glist *glist, for (i = 0, xsum = xloc; i < nelem; i++) { if (xonset >= 0) - usexloc = xloc + *(float *)((elem + elemsize * i) + usexloc = xloc + *(t_float *)((elem + elemsize * i) + xonset); else usexloc = xsum, xsum += xinc; if (yonset >= 0) - yval = *(float *)((elem + elemsize * i) + yonset); + yval = *(t_float *)((elem + elemsize * i) + yonset); else yval = 0; - wval = *(float *)((elem + elemsize * i) + wonset); + wval = *(t_float *)((elem + elemsize * i) + wonset); xpix = glist_xtopixels(glist, basex + fielddesc_cvttocoord(xfielddesc, usexloc)); ixpix = xpix + 0.5; @@ -1774,15 +1774,15 @@ static void plot_vis(t_gobj *z, t_glist *glist, lastpixel = -1; for (i = nelem-1; i >= 0; i--) { - float usexloc; + t_float usexloc; if (xonset >= 0) - usexloc = xloc + *(float *)((elem + elemsize * i) + usexloc = xloc + *(t_float *)((elem + elemsize * i) + xonset); else xsum -= xinc, usexloc = xsum; if (yonset >= 0) - yval = *(float *)((elem + elemsize * i) + yonset); + yval = *(t_float *)((elem + elemsize * i) + yonset); else yval = 0; - wval = *(float *)((elem + elemsize * i) + wonset); + wval = *(t_float *)((elem + elemsize * i) + wonset); xpix = glist_xtopixels(glist, basex + fielddesc_cvttocoord(xfielddesc, usexloc)); ixpix = xpix + 0.5; @@ -1826,13 +1826,13 @@ static void plot_vis(t_gobj *z, t_glist *glist, for (xsum = xloc, i = 0; i < nelem; i++) { - float usexloc; + t_float usexloc; if (xonset >= 0) - usexloc = xloc + *(float *)((elem + elemsize * i) + + usexloc = xloc + *(t_float *)((elem + elemsize * i) + xonset); else usexloc = xsum, xsum += xinc; if (yonset >= 0) - yval = *(float *)((elem + elemsize * i) + yonset); + yval = *(t_float *)((elem + elemsize * i) + yonset); else yval = 0; xpix = glist_xtopixels(glist, basex + fielddesc_cvttocoord(xfielddesc, usexloc)); @@ -1868,14 +1868,14 @@ static void plot_vis(t_gobj *z, t_glist *glist, { for (xsum = xloc, i = 0; i < nelem; i++) { - float usexloc, useyloc; + t_float usexloc, useyloc; t_gobj *y; if (xonset >= 0) usexloc = basex + xloc + - *(float *)((elem + elemsize * i) + xonset); + *(t_float *)((elem + elemsize * i) + xonset); else usexloc = basex + xsum, xsum += xinc; if (yonset >= 0) - yval = *(float *)((elem + elemsize * i) + yonset); + yval = *(t_float *)((elem + elemsize * i) + yonset); else yval = 0; useyloc = basey + yloc + fielddesc_cvttocoord(yfielddesc, yval); @@ -1917,12 +1917,12 @@ static void plot_vis(t_gobj *z, t_glist *glist, static int plot_click(t_gobj *z, t_glist *glist, t_word *data, t_template *template, t_scalar *sc, t_array *ap, - float basex, float basey, + t_float basex, t_float basey, int xpix, int ypix, int shift, int alt, int dbl, int doit) { t_plot *x = (t_plot *)z; t_symbol *elemtemplatesym; - float linewidth, xloc, xinc, yloc, style, vis, scalarvis; + t_float linewidth, xloc, xinc, yloc, style, vis, scalarvis; t_array *array; t_fielddesc *xfielddesc, *yfielddesc, *wfielddesc; @@ -2058,7 +2058,7 @@ static void drawnumber_sprintf(t_drawnumber *x, char *buf, t_atom *ap) } static void drawnumber_getrect(t_gobj *z, t_glist *glist, - t_word *data, t_template *template, float basex, float basey, + t_word *data, t_template *template, t_float basex, t_float basey, int *xp1, int *yp1, int *xp2, int *yp2) { t_drawnumber *x = (t_drawnumber *)z; @@ -2090,14 +2090,14 @@ static void drawnumber_getrect(t_gobj *z, t_glist *glist, } static void drawnumber_displace(t_gobj *z, t_glist *glist, - t_word *data, t_template *template, float basex, float basey, + t_word *data, t_template *template, t_float basex, t_float basey, int dx, int dy) { /* refuse */ } static void drawnumber_select(t_gobj *z, t_glist *glist, - t_word *data, t_template *template, float basex, float basey, + t_word *data, t_template *template, t_float basex, t_float basey, int state) { post("drawnumber_select %d", state); @@ -2105,14 +2105,14 @@ static void drawnumber_select(t_gobj *z, t_glist *glist, } static void drawnumber_activate(t_gobj *z, t_glist *glist, - t_word *data, t_template *template, float basex, float basey, + t_word *data, t_template *template, t_float basex, t_float basey, int state) { post("drawnumber_activate %d", state); } static void drawnumber_vis(t_gobj *z, t_glist *glist, - t_word *data, t_template *template, float basex, float basey, + t_word *data, t_template *template, t_float basex, t_float basey, int vis) { t_drawnumber *x = (t_drawnumber *)z; @@ -2136,14 +2136,14 @@ static void drawnumber_vis(t_gobj *z, t_glist *glist, drawnumber_sprintf(x, buf, &at); sys_vgui(".x%lx.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(" -font {{%s} -%d %s}", sys_font, + sys_hostfontsize(glist_getfont(glist)), sys_fontweight); sys_vgui(" -tags drawnumber%lx\n", data); } else sys_vgui(".x%lx.c delete drawnumber%lx\n", glist_getcanvas(glist), data); } -static float drawnumber_motion_ycumulative; +static t_float drawnumber_motion_ycumulative; static t_glist *drawnumber_motion_glist; static t_scalar *drawnumber_motion_scalar; static t_array *drawnumber_motion_array; @@ -2225,7 +2225,7 @@ static void drawnumber_key(void *z, t_floatarg fkey) else { /* key entry for a numeric field. This is just a stopgap. */ - float newf; + t_float newf; if (drawnumber_motion_firstkey) sbuf[0] = 0; else sprintf(sbuf, "%g", template_getfloat(drawnumber_motion_template, @@ -2258,7 +2258,7 @@ static void drawnumber_key(void *z, t_floatarg fkey) static int drawnumber_click(t_gobj *z, t_glist *glist, t_word *data, t_template *template, t_scalar *sc, t_array *ap, - float basex, float basey, + t_float basex, t_float basey, int xpix, int ypix, int shift, int alt, int dbl, int doit) { t_drawnumber *x = (t_drawnumber *)z; diff --git a/pd/src/g_text.c b/pd/src/g_text.c index fa28f70e..bbdb7729 100644 --- a/pd/src/g_text.c +++ b/pd/src/g_text.c @@ -145,8 +145,11 @@ void canvas_obj(t_glist *gl, t_symbol *s, int argc, t_atom *argv) canvas_objtext(gl, atom_getintarg(0, argc, argv), atom_getintarg(1, argc, argv), 0, b); } - else - { + else if(!glist_isvisible(gl)){ + /* JMZ: not a good idea to go into interactive mode in a closed canvas... */ + post("unable to create stub object in closed canvas!"); + return; + } else { t_binbuf *b = binbuf_new(); int xpix, ypix; pd_vmess(&gl->gl_pd, gensym("editmode"), "i", 1); @@ -417,6 +420,11 @@ void canvas_msg(t_glist *gl, t_symbol *s, int argc, t_atom *argv) else { int xpix, ypix; + /* JMZ: not a good idea to go into interactive mode in a closed canvas... */ + if(!glist_isvisible(gl)){ + post("unable to create stub message in closed canvas!"); + return; + } pd_vmess(&gl->gl_pd, gensym("editmode"), "i", 1); glist_noselect(gl); glist_getnextxy(gl, &xpix, &ypix); @@ -922,7 +930,7 @@ static void text_getrect(t_gobj *z, t_glist *glist, { t_text *x = (t_text *)z; int width, height, iscomment = (x->te_type == T_TEXT); - float x1, y1, x2, y2; + t_float x1, y1, x2, y2; /* for number boxes, we know width and height a priori, and should report them here so that graphs can get swelled to fit. */ diff --git a/pd/src/g_toggle.c b/pd/src/g_toggle.c index e36be5fa..830e99cb 100644 --- a/pd/src/g_toggle.c +++ b/pd/src/g_toggle.c @@ -61,11 +61,12 @@ void toggle_draw_new(t_toggle *x, t_glist *glist) canvas, xx+w+1, yy + x->x_gui.x_h-w-1, xx + x->x_gui.x_w-w, yy+w, w, (x->x_on!=0.0)?x->x_gui.x_fcol:x->x_gui.x_bcol, x); sys_vgui(".x%lx.c create text %d %d -text {%s} -anchor w \ - -font {%s %d bold} -fill #%6.6x -tags %lxLABEL\n", + -font {{%s} -%d %s} -fill #%6.6x -tags %lxLABEL\n", canvas, xx+x->x_gui.x_ldx, yy+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); + x->x_gui.x_font, x->x_gui.x_fontsize, sys_fontweight, + x->x_gui.x_lcol, x); if(!x->x_gui.x_fsf.x_snd_able) sys_vgui(".x%lx.c create rectangle %d %d %d %d -tags %lxOUT%d\n", canvas, xx, yy + x->x_gui.x_h-1, xx + IOWIDTH, yy + x->x_gui.x_h, x, 0); @@ -120,8 +121,8 @@ void toggle_draw_config(t_toggle* x, t_glist* glist) { t_canvas *canvas=glist_getcanvas(glist); - sys_vgui(".x%lx.c itemconfigure %lxLABEL -font {%s %d bold} -fill #%6.6x -text {%s} \n", - canvas, x, x->x_gui.x_font, x->x_gui.x_fontsize, + sys_vgui(".x%lx.c itemconfigure %lxLABEL -font {{%s} -%d %s} -fill #%6.6x -text {%s} \n", + canvas, x, x->x_gui.x_font, x->x_gui.x_fontsize, sys_fontweight, x->x_gui.x_fsf.x_selected?IEM_GUI_COLOR_SELECTED:x->x_gui.x_lcol, strcmp(x->x_gui.x_lab->s_name, "empty")?x->x_gui.x_lab->s_name:""); sys_vgui(".x%lx.c itemconfigure %lxBASE -fill #%6.6x\n", canvas, x, @@ -225,7 +226,7 @@ static void toggle_properties(t_gobj *z, t_glist *owner) t_symbol *srl[3]; iemgui_properties(&x->x_gui, srl); - sprintf(buf, "pdtk_iemgui_dialog %%s TOGGLE \ + sprintf(buf, "pdtk_iemgui_dialog %%s |tgl| \ ----------dimensions(pix):----------- %d %d size: 0 0 empty \ -----------non-zero-value:----------- %g value: 0.0 empty %g \ -1 lin log %d %d empty %d \ @@ -256,7 +257,7 @@ static void toggle_dialog(t_toggle *x, t_symbol *s, int argc, t_atom *argv) { t_symbol *srl[3]; int a = (int)atom_getintarg(0, argc, argv); - float nonzero = (float)atom_getfloatarg(2, argc, argv); + t_float nonzero = (t_float)atom_getfloatarg(2, argc, argv); int sr_flags; if(nonzero == 0.0) @@ -313,7 +314,7 @@ static void toggle_fout(t_toggle *x, t_floatarg f) static void toggle_loadbang(t_toggle *x) { if(!sys_noloadbang && x->x_gui.x_isa.x_loadinit) - toggle_fout(x, (float)x->x_on); + toggle_fout(x, (t_float)x->x_on); } static void toggle_size(t_toggle *x, t_symbol *s, int ac, t_atom *av) @@ -365,7 +366,7 @@ static void *toggle_new(t_symbol *s, int argc, t_atom *argv) int a=IEM_GUI_DEFAULTSIZE, f=0; int ldx=17, ldy=7; int fs=10; - float on=0.0, nonzero=1.0; + t_float on=0.0, nonzero=1.0; char str[144]; iem_inttosymargs(&x->x_gui.x_isa, 0); @@ -390,11 +391,11 @@ static void *toggle_new(t_symbol *s, int argc, t_atom *argv) bflcol[0] = (int)atom_getintarg(9, argc, argv); bflcol[1] = (int)atom_getintarg(10, argc, argv); bflcol[2] = (int)atom_getintarg(11, argc, argv); - on = (float)atom_getfloatarg(12, argc, argv); + on = (t_float)atom_getfloatarg(12, argc, argv); } else iemgui_new_getnames(&x->x_gui, 2, 0); if((argc == 14)&&IS_A_FLOAT(argv,13)) - nonzero = (float)atom_getfloatarg(13, argc, argv); + nonzero = (t_float)atom_getfloatarg(13, argc, argv); x->x_gui.x_draw = (t_iemfunptr)toggle_draw; x->x_gui.x_fsf.x_snd_able = 1; @@ -407,7 +408,7 @@ static void *toggle_new(t_symbol *s, int argc, t_atom *argv) if(x->x_gui.x_fsf.x_font_style == 1) strcpy(x->x_gui.x_font, "helvetica"); else if(x->x_gui.x_fsf.x_font_style == 2) strcpy(x->x_gui.x_font, "times"); else { x->x_gui.x_fsf.x_font_style = 0; - strcpy(x->x_gui.x_font, "courier"); } + strcpy(x->x_gui.x_font, sys_font); } x->x_nonzero = (nonzero!=0.0)?nonzero:1.0; if(x->x_gui.x_isa.x_loadinit) x->x_on = (on!=0.0)?nonzero:0.0; diff --git a/pd/src/g_traversal.c b/pd/src/g_traversal.c index 7de67848..de8f23c8 100644 --- a/pd/src/g_traversal.c +++ b/pd/src/g_traversal.c @@ -206,7 +206,7 @@ static void ptrobj_traverse(t_ptrobj *x, t_symbol *s) else pd_error(x, "pointer: list '%s' not found", s->s_name); } -static void ptrobj_vnext(t_ptrobj *x, float f) +static void ptrobj_vnext(t_ptrobj *x, t_float f) { t_gobj *gobj; t_gpointer *gp = &x->x_gp; @@ -774,7 +774,7 @@ static void getsize_pointer(t_getsize *x, t_gpointer *gp) else w = gp->gp_un.gp_scalar->sc_vec; array = *(t_array **)(((char *)w) + onset); - outlet_float(x->x_obj.ob_outlet, (float)(array->a_n)); + outlet_float(x->x_obj.ob_outlet, (t_float)(array->a_n)); } static void getsize_setup(void) diff --git a/pd/src/g_vdial.c b/pd/src/g_vdial.c index 3d352b35..9f7732f5 100644 --- a/pd/src/g_vdial.c +++ b/pd/src/g_vdial.c @@ -75,10 +75,10 @@ void vradio_draw_new(t_vradio *x, t_glist *glist) x->x_drawn = x->x_on; } sys_vgui(".x%lx.c create text %d %d -text {%s} -anchor w \ - -font {%s %d bold} -fill #%6.6x -tags %lxLABEL\n", + -font {{%s} -%d %s} -fill #%6.6x -tags %lxLABEL\n", canvas, xx11+x->x_gui.x_ldx, yy11b+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_font, x->x_gui.x_fontsize, sys_fontweight, x->x_gui.x_lcol, x); if(!x->x_gui.x_fsf.x_snd_able) sys_vgui(".x%lx.c create rectangle %d %d %d %d -tags %lxOUT%d\n", @@ -141,8 +141,8 @@ void vradio_draw_config(t_vradio* x, t_glist* glist) t_canvas *canvas=glist_getcanvas(glist); int n=x->x_number, i; - sys_vgui(".x%lx.c itemconfigure %lxLABEL -font {%s %d bold} -fill #%6.6x -text {%s} \n", - canvas, x, x->x_gui.x_font, x->x_gui.x_fontsize, + sys_vgui(".x%lx.c itemconfigure %lxLABEL -font {{%s} -%d %s} -fill #%6.6x -text {%s} \n", + canvas, x, x->x_gui.x_font, x->x_gui.x_fontsize, sys_fontweight, x->x_gui.x_fsf.x_selected?IEM_GUI_COLOR_SELECTED:x->x_gui.x_lcol, strcmp(x->x_gui.x_lab->s_name, "empty")?x->x_gui.x_lab->s_name:""); for(i=0; i<n; i++) @@ -265,7 +265,7 @@ static void vradio_properties(t_gobj *z, t_glist *owner) iemgui_properties(&x->x_gui, srl); if(pd_class(&x->x_gui.x_obj.ob_pd) == vradio_old_class) hchange = x->x_change; - sprintf(buf, "pdtk_iemgui_dialog %%s vradio \ + sprintf(buf, "pdtk_iemgui_dialog %%s |vradio| \ ----------dimensions(pix):----------- %d %d size: 0 0 empty \ empty 0.0 empty 0.0 empty %d \ %d new-only new&old %d %d number: %d \ @@ -347,14 +347,14 @@ static void vradio_bang(t_vradio *x) { if((x->x_change)&&(x->x_on != x->x_on_old)) { - SETFLOAT(x->x_at, (float)x->x_on_old); + SETFLOAT(x->x_at, (t_float)x->x_on_old); SETFLOAT(x->x_at+1, 0.0); outlet_list(x->x_gui.x_obj.ob_outlet, &s_list, 2, x->x_at); if(x->x_gui.x_fsf.x_snd_able && x->x_gui.x_snd->s_thing) pd_list(x->x_gui.x_snd->s_thing, &s_list, 2, x->x_at); } x->x_on_old = x->x_on; - SETFLOAT(x->x_at, (float)x->x_on); + SETFLOAT(x->x_at, (t_float)x->x_on); SETFLOAT(x->x_at+1, 1.0); outlet_list(x->x_gui.x_obj.ob_outlet, &s_list, 2, x->x_at); if(x->x_gui.x_fsf.x_snd_able && x->x_gui.x_snd->s_thing) @@ -382,7 +382,7 @@ static void vradio_fout(t_vradio *x, t_floatarg f) /* compatibility with earlier "vdial" behavior */ if((x->x_change)&&(i != x->x_on_old)) { - SETFLOAT(x->x_at, (float)x->x_on_old); + SETFLOAT(x->x_at, (t_float)x->x_on_old); SETFLOAT(x->x_at+1, 0.0); outlet_list(x->x_gui.x_obj.ob_outlet, &s_list, 2, x->x_at); if(x->x_gui.x_fsf.x_snd_able && x->x_gui.x_snd->s_thing) @@ -393,7 +393,7 @@ static void vradio_fout(t_vradio *x, t_floatarg f) x->x_on = i; (*x->x_gui.x_draw)(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_UPDATE); x->x_on_old = x->x_on; - SETFLOAT(x->x_at, (float)x->x_on); + SETFLOAT(x->x_at, (t_float)x->x_on); SETFLOAT(x->x_at+1, 1.0); outlet_list(x->x_gui.x_obj.ob_outlet, &s_list, 2, x->x_at); if(x->x_gui.x_fsf.x_snd_able && x->x_gui.x_snd->s_thing) @@ -426,7 +426,7 @@ static void vradio_float(t_vradio *x, t_floatarg f) { if(x->x_gui.x_fsf.x_put_in2out) { - SETFLOAT(x->x_at, (float)x->x_on_old); + SETFLOAT(x->x_at, (t_float)x->x_on_old); SETFLOAT(x->x_at+1, 0.0); outlet_list(x->x_gui.x_obj.ob_outlet, &s_list, 2, x->x_at); if(x->x_gui.x_fsf.x_snd_able && x->x_gui.x_snd->s_thing) @@ -440,7 +440,7 @@ static void vradio_float(t_vradio *x, t_floatarg f) x->x_on_old = x->x_on; if(x->x_gui.x_fsf.x_put_in2out) { - SETFLOAT(x->x_at, (float)x->x_on); + SETFLOAT(x->x_at, (t_float)x->x_on); SETFLOAT(x->x_at+1, 1.0); outlet_list(x->x_gui.x_obj.ob_outlet, &s_list, 2, x->x_at); if(x->x_gui.x_fsf.x_snd_able && x->x_gui.x_snd->s_thing) @@ -466,7 +466,7 @@ 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); - vradio_fout(x, (float)(yy / x->x_gui.x_h)); + vradio_fout(x, (t_float)(yy / x->x_gui.x_h)); } static int vradio_newclick(t_gobj *z, struct _glist *glist, @@ -590,7 +590,7 @@ static void *vradio_donew(t_symbol *s, int argc, t_atom *argv, int old) if(x->x_gui.x_fsf.x_font_style == 1) strcpy(x->x_gui.x_font, "helvetica"); else if(x->x_gui.x_fsf.x_font_style == 2) strcpy(x->x_gui.x_font, "times"); else { x->x_gui.x_fsf.x_font_style = 0; - strcpy(x->x_gui.x_font, "courier"); } + strcpy(x->x_gui.x_font, sys_font); } if(num < 1) num = 1; if(num > IEM_RADIO_MAX) diff --git a/pd/src/g_vslider.c b/pd/src/g_vslider.c index 1b575dac..87309029 100644 --- a/pd/src/g_vslider.c +++ b/pd/src/g_vslider.c @@ -59,10 +59,11 @@ static void vslider_draw_new(t_vslider *x, t_glist *glist) canvas, xpos+1, r, xpos + x->x_gui.x_w, r, x->x_gui.x_fcol, x); sys_vgui(".x%lx.c create text %d %d -text {%s} -anchor w \ - -font {%s %d bold} -fill #%6.6x -tags %lxLABEL\n", + -font {{%s} -%d %s} -fill #%6.6x -tags %lxLABEL\n", 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); + x->x_gui.x_font, x->x_gui.x_fontsize, sys_fontweight, + x->x_gui.x_lcol, x); if(!x->x_gui.x_fsf.x_snd_able) sys_vgui(".x%lx.c create rectangle %d %d %d %d -tags %lxOUT%d\n", canvas, @@ -122,8 +123,8 @@ static void vslider_draw_config(t_vslider* x,t_glist* glist) { t_canvas *canvas=glist_getcanvas(glist); - sys_vgui(".x%lx.c itemconfigure %lxLABEL -font {%s %d bold} -fill #%6.6x -text {%s} \n", - canvas, x, x->x_gui.x_font, x->x_gui.x_fontsize, + sys_vgui(".x%lx.c itemconfigure %lxLABEL -font {{%s} -%d %s} -fill #%6.6x -text {%s} \n", + canvas, x, x->x_gui.x_font, x->x_gui.x_fontsize, sys_fontweight, x->x_gui.x_fsf.x_selected?IEM_GUI_COLOR_SELECTED:x->x_gui.x_lcol, strcmp(x->x_gui.x_lab->s_name, "empty")?x->x_gui.x_lab->s_name:""); sys_vgui(".x%lx.c itemconfigure %lxKNOB -fill #%6.6x\n", canvas, @@ -214,7 +215,7 @@ static void vslider_save(t_gobj *z, t_binbuf *b) binbuf_addv(b, "ssiisiiffiisssiiiiiiiii", gensym("#X"),gensym("obj"), (int)x->x_gui.x_obj.te_xpix, (int)x->x_gui.x_obj.te_ypix, gensym("vsl"), x->x_gui.x_w, x->x_gui.x_h, - (float)x->x_min, (float)x->x_max, + (t_float)x->x_min, (t_float)x->x_max, x->x_lin0_log1, iem_symargstoint(&x->x_gui.x_isa), srl[0], srl[1], srl[2], x->x_gui.x_ldx, x->x_gui.x_ldy, @@ -277,7 +278,7 @@ static void vslider_properties(t_gobj *z, t_glist *owner) iemgui_properties(&x->x_gui, srl); - sprintf(buf, "pdtk_iemgui_dialog %%s VSLIDER \ + sprintf(buf, "pdtk_iemgui_dialog %%s |vsl| \ --------dimensions(pix)(pix):-------- %d %d width: %d %d height: \ -----------output-range:----------- %g bottom: %g top: %d \ %d lin log %d %d empty %d \ @@ -562,7 +563,7 @@ static void *vslider_new(t_symbol *s, int argc, t_atom *argv) if(x->x_gui.x_fsf.x_font_style == 1) strcpy(x->x_gui.x_font, "helvetica"); else if(x->x_gui.x_fsf.x_font_style == 2) strcpy(x->x_gui.x_font, "times"); else { x->x_gui.x_fsf.x_font_style = 0; - strcpy(x->x_gui.x_font, "courier"); } + strcpy(x->x_gui.x_font, sys_font); } if(x->x_gui.x_fsf.x_rcv_able) pd_bind(&x->x_gui.x_obj.ob_pd, x->x_gui.x_rcv); x->x_gui.x_ldx = ldx; x->x_gui.x_ldy = ldy; diff --git a/pd/src/g_vumeter.c b/pd/src/g_vumeter.c index ac6ee0ae..f0ec30aa 100644 --- a/pd/src/g_vumeter.c +++ b/pd/src/g_vumeter.c @@ -116,17 +116,19 @@ static void vu_draw_new(t_vu *x, t_glist *glist) canvas, quad1, yyy, quad3, yyy, x->x_led_size, iemgui_color_hex[led_col], x, i); if(((i+2)&3) && (x->x_scale)) sys_vgui(".x%lx.c create text %d %d -text {%s} -anchor w \ - -font {%s %d bold} -fill #%6.6x -tags %lxSCALE%d\n", - canvas, end, yyy+k3, iemgui_vu_scale_str[i], x->x_gui.x_font, x->x_gui.x_fontsize, - x->x_gui.x_lcol, x, i); + -font {{%s} -%d %s} -fill #%6.6x -tags %lxSCALE%d\n", + canvas, end, yyy+k3, iemgui_vu_scale_str[i], + x->x_gui.x_font, x->x_gui.x_fontsize, + sys_fontweight, x->x_gui.x_lcol, x, i); } if(x->x_scale) { i=IEM_VU_STEPS+1; yyy = k4 + k1*(k2-i); sys_vgui(".x%lx.c create text %d %d -text {%s} -anchor w \ - -font {%s %d bold} -fill #%6.6x -tags %lxSCALE%d\n", - canvas, end, yyy+k3, iemgui_vu_scale_str[i], x->x_gui.x_font, x->x_gui.x_fontsize, + -font {{%s} -%d %s} -fill #%6.6x -tags %lxSCALE%d\n", + canvas, end, yyy+k3, iemgui_vu_scale_str[i], x->x_gui.x_font, + x->x_gui.x_fontsize, sys_fontweight, x->x_gui.x_lcol, x, i); } sys_vgui(".x%lx.c create rectangle %d %d %d %d -fill #%6.6x -outline #%6.6x -tags %lxRCOVER\n", @@ -136,10 +138,11 @@ static void vu_draw_new(t_vu *x, t_glist *glist) canvas, mid, ypos+10, mid, ypos+10, x->x_led_size, x->x_gui.x_bcol, x); sys_vgui(".x%lx.c create text %d %d -text {%s} -anchor w \ - -font {%s %d bold} -fill #%6.6x -tags %lxLABEL\n", + -font {{%s} -%d %s} -fill #%6.6x -tags %lxLABEL\n", 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); + x->x_gui.x_font, x->x_gui.x_fontsize, sys_fontweight, + x->x_gui.x_lcol, x); if(!x->x_gui.x_fsf.x_snd_able) { sys_vgui(".x%lx.c create rectangle %d %d %d %d -tags %lxOUT%d\n", @@ -274,19 +277,21 @@ static void vu_draw_config(t_vu* x, t_glist* glist) sys_vgui(".x%lx.c itemconfigure %lxRLED%d -width %d\n", canvas, x, i, x->x_led_size); if(((i+2)&3) && (x->x_scale)) - sys_vgui(".x%lx.c itemconfigure %lxSCALE%d -text {%s} -font {%s %d bold} -fill #%6.6x\n", - canvas, x, i, iemgui_vu_scale_str[i], x->x_gui.x_font, x->x_gui.x_fontsize, + sys_vgui(".x%lx.c itemconfigure %lxSCALE%d -text {%s} -font {{%s} -%d %s} -fill #%6.6x\n", + canvas, x, i, iemgui_vu_scale_str[i], x->x_gui.x_font, + x->x_gui.x_fontsize, sys_fontweight, x->x_gui.x_fsf.x_selected?IEM_GUI_COLOR_SELECTED:x->x_gui.x_lcol); } if(x->x_scale) { i=IEM_VU_STEPS+1; - sys_vgui(".x%lx.c itemconfigure %lxSCALE%d -text {%s} -font {%s %d bold} -fill #%6.6x\n", - canvas, x, i, iemgui_vu_scale_str[i], x->x_gui.x_font, x->x_gui.x_fontsize, + sys_vgui(".x%lx.c itemconfigure %lxSCALE%d -text {%s} -font {{%s} -%d %s} -fill #%6.6x\n", + canvas, x, i, iemgui_vu_scale_str[i], x->x_gui.x_font, + x->x_gui.x_fontsize, sys_fontweight, x->x_gui.x_fsf.x_selected?IEM_GUI_COLOR_SELECTED:x->x_gui.x_lcol); } - sys_vgui(".x%lx.c itemconfigure %lxLABEL -font {%s %d bold} -fill #%6.6x -text {%s} \n", - canvas, x, x->x_gui.x_font, x->x_gui.x_fontsize, + sys_vgui(".x%lx.c itemconfigure %lxLABEL -font {{%s} -%d %s} -fill #%6.6x -text {%s} \n", + canvas, x, x->x_gui.x_font, x->x_gui.x_fontsize, sys_fontweight, x->x_gui.x_fsf.x_selected?IEM_GUI_COLOR_SELECTED:x->x_gui.x_lcol, strcmp(x->x_gui.x_lab->s_name, "empty")?x->x_gui.x_lab->s_name:""); @@ -476,16 +481,18 @@ static void vu_scale(t_vu *x, t_floatarg fscale) yyy = k4 + k1*(k2-i); if((i+2)&3) sys_vgui(".x%lx.c create text %d %d -text {%s} -anchor w \ - -font {%s %d bold} -fill #%6.6x -tags %lxSCALE%d\n", - canvas, end, yyy+k3, iemgui_vu_scale_str[i], x->x_gui.x_font, x->x_gui.x_fontsize, - x->x_gui.x_lcol, x, i); + -font {{%s} -%d %s} -fill #%6.6x -tags %lxSCALE%d\n", + canvas, end, yyy+k3, iemgui_vu_scale_str[i], + x->x_gui.x_font, x->x_gui.x_fontsize, + sys_fontweight, x->x_gui.x_lcol, x, i); } i=IEM_VU_STEPS+1; yyy = k4 + k1*(k2-i); sys_vgui(".x%lx.c create text %d %d -text {%s} -anchor w \ - -font {%s %d bold} -fill #%6.6x -tags %lxSCALE%d\n", - canvas, end, yyy+k3, iemgui_vu_scale_str[i], x->x_gui.x_font, x->x_gui.x_fontsize, - x->x_gui.x_lcol, x, i); + -font {{%s} -%d %s} -fill #%6.6x -tags %lxSCALE%d\n", + canvas, end, yyy+k3, iemgui_vu_scale_str[i], + x->x_gui.x_font, x->x_gui.x_fontsize, sys_fontweight, + sys_fontweight, x->x_gui.x_lcol, x, i); } } } @@ -497,7 +504,7 @@ static void vu_properties(t_gobj *z, t_glist *owner) t_symbol *srl[3]; iemgui_properties(&x->x_gui, srl); - sprintf(buf, "pdtk_iemgui_dialog %%s VU-METER \ + sprintf(buf, "pdtk_iemgui_dialog %%s |vu| \ --------dimensions(pix)(pix):-------- %d %d width: %d %d height: \ empty 0.0 empty 0.0 empty %d \ %d no_scale scale %d %d empty %d \ @@ -531,7 +538,7 @@ static void vu_dialog(t_vu *x, t_symbol *s, int argc, t_atom *argv) vu_check_height(x, h); if(scale != 0) scale = 1; - vu_scale(x, (float)scale); + vu_scale(x, (t_float)scale); (*x->x_gui.x_draw)(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_CONFIG); (*x->x_gui.x_draw)(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_IO + sr_flags); (*x->x_gui.x_draw)(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_MOVE); @@ -586,7 +593,7 @@ static void vu_float(t_vu *x, t_floatarg rms) x->x_rms = iemgui_vu_db2i[i]; } i = (int)(100.0*rms + 10000.5); - rms = 0.01*(float)(i - 10000); + rms = 0.01*(t_float)(i - 10000); x->x_fr = rms; outlet_float(x->x_out_rms, rms); x->x_updaterms = 1; @@ -607,7 +614,7 @@ static void vu_ft1(t_vu *x, t_floatarg peak) x->x_peak = iemgui_vu_db2i[i]; } i = (int)(100.0*peak + 10000.5); - peak = 0.01*(float)(i - 10000); + peak = 0.01*(t_float)(i - 10000); x->x_fp = peak; x->x_updatepeak = 1; sys_queuegui(x, x->x_gui.x_glist, vu_draw_update); @@ -627,7 +634,7 @@ 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; - int ldx=-1, ldy=-8, f=0, fs=8, scale=1; + int ldx=-1, ldy=-8, f=0, fs=10, scale=1; int ftbreak=IEM_BNG_DEFAULTBREAKFLASHTIME, fthold=IEM_BNG_DEFAULTHOLDFLASHTIME; char str[144]; @@ -667,7 +674,7 @@ static void *vu_new(t_symbol *s, int argc, t_atom *argv) else if(x->x_gui.x_fsf.x_font_style == 2) strcpy(x->x_gui.x_font, "times"); else { x->x_gui.x_fsf.x_font_style = 0; - strcpy(x->x_gui.x_font, "courier"); } + strcpy(x->x_gui.x_font, sys_font); } if(x->x_gui.x_fsf.x_rcv_able) pd_bind(&x->x_gui.x_obj.ob_pd, x->x_gui.x_rcv); x->x_gui.x_ldx = ldx; diff --git a/pd/src/m_binbuf.c b/pd/src/m_binbuf.c index 69580741..c2ebd2ca 100644 --- a/pd/src/m_binbuf.c +++ b/pd/src/m_binbuf.c @@ -387,9 +387,6 @@ void binbuf_restore(t_binbuf *x, int argc, t_atom *argv) x->b_n = newsize; } - -#define MSTACKSIZE 10000 /* FIXME -- make this grow as needed */ - void binbuf_print(t_binbuf *x) { int i, startedpost = 0, newline = 1; @@ -531,13 +528,70 @@ done: return (gensym(buf2)); } +#define SMALLMSG 5 +#define HUGEMSG 1000 +#ifdef MSW +#include <malloc.h> +#else +#include <alloca.h> +#endif +#if HAVE_ALLOCA +#define ATOMS_ALLOCA(x, n) ((x) = (t_atom *)((n) < HUGEMSG ? \ + alloca((n) * sizeof(t_atom)) : getbytes((n) * sizeof(t_atom)))) +#define ATOMS_FREEA(x, n) ( \ + ((n) < HUGEMSG || (freebytes((x), (n) * sizeof(t_atom)), 0))) +#else +#define ATOMS_ALLOCA(x, n) ((x) = (t_atom *)getbytes((n) * sizeof(t_atom))) +#define ATOMS_FREEA(x, n) (freebytes((x), (n) * sizeof(t_atom))) +#endif + void binbuf_eval(t_binbuf *x, t_pd *target, int argc, t_atom *argv) { - static t_atom mstack[MSTACKSIZE], *msp = mstack, *ems = mstack+MSTACKSIZE; - t_atom *stackwas = msp; + t_atom smallstack[SMALLMSG], *mstack, *msp; t_atom *at = x->b_vec; int ac = x->b_n; - int nargs; + int nargs, maxnargs = 0; + if (ac <= SMALLMSG) + mstack = smallstack; + else + { +#if 1 + /* count number of args in biggest message. The wierd + treatment of "pd_objectmaker" is because when the message + goes out to objectmaker, commas and semis are passed + on as regular args (see below). We're tacitly assuming here + that the pd_objectmaker target can't come up via a named + destination in the message, only because the original "target" + points there. */ + if (target == &pd_objectmaker) + maxnargs = ac; + else + { + int i, j = (target ? 0 : -1); + for (i = 0; i < ac; i++) + { + if (at[i].a_type == A_SEMI) + j = -1; + else if (at[i].a_type == A_COMMA) + j = 0; + else if (++j > maxnargs) + maxnargs = j; + } + } + if (maxnargs <= SMALLMSG) + mstack = smallstack; + else ATOMS_ALLOCA(mstack, maxnargs); +#else + /* just pessimistically allocate enough to hold everything + at once. This turned out to run slower in a simple benchmark + I tried, perhaps because the extra memory allocation + hurt the cache hit rate. */ + maxnargs = ac; + ATOMS_ALLOCA(mstack, maxnargs); +#endif + + } + msp = mstack; while (1) { t_pd *nexttarget; @@ -597,11 +651,6 @@ void binbuf_eval(t_binbuf *x, t_pd *target, int argc, t_atom *argv) { t_symbol *s9; if (!ac) goto gotmess; - if (msp >= ems) - { - error("message stack overflow"); - goto broken; - } switch (at->a_type) { case A_SEMI: @@ -667,27 +716,26 @@ void binbuf_eval(t_binbuf *x, t_pd *target, int argc, t_atom *argv) gotmess: if (nargs) { - switch (stackwas->a_type) + switch (mstack->a_type) { case A_SYMBOL: - typedmess(target, stackwas->a_w.w_symbol, nargs-1, stackwas+1); + typedmess(target, mstack->a_w.w_symbol, nargs-1, mstack+1); break; case A_FLOAT: - if (nargs == 1) pd_float(target, stackwas->a_w.w_float); - else pd_list(target, 0, nargs, stackwas); + if (nargs == 1) pd_float(target, mstack->a_w.w_float); + else pd_list(target, 0, nargs, mstack); break; } } - msp = stackwas; + msp = mstack; if (!ac) break; target = nexttarget; at++; ac--; } - - return; -broken: - msp = stackwas; +broken: + if (maxnargs > SMALLMSG) + ATOMS_FREEA(mstack, maxnargs); } static int binbuf_doopen(char *s, int mode) @@ -959,7 +1007,7 @@ 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), - (float)sys_defaultfont); + (t_float)sys_defaultfont); } } if (!strcmp(first, "#P")) @@ -1042,7 +1090,7 @@ static t_binbuf *binbuf_convert(t_binbuf *oldb, int maxtopd) } else if (!strcmp(second, "slider")) { - float inc = atom_getfloatarg(7, natom, nextmess); + t_float inc = atom_getfloatarg(7, natom, nextmess); if (inc <= 0) inc = 1; binbuf_addv(newb, "ssffsffffffsssfffffffff;", diff --git a/pd/src/m_class.c b/pd/src/m_class.c index 0737a660..622fbd2d 100644 --- a/pd/src/m_class.c +++ b/pd/src/m_class.c @@ -400,7 +400,7 @@ static void pd_floatforsignal(t_pd *x, t_float f) { int offset = (*x)->c_floatsignalin; if (offset > 0) - *(t_sample *)(((char *)x) + offset) = f; + *(t_float *)(((char *)x) + offset) = f; else pd_error(x, "%s: float unexpected for signal input", (*x)->c_name->s_name); diff --git a/pd/src/m_glob.c b/pd/src/m_glob.c index aca3bf24..c3a70e53 100644 --- a/pd/src/m_glob.c +++ b/pd/src/m_glob.c @@ -49,6 +49,12 @@ void glob_foo(void *dummy, t_symbol *s, int argc, t_atom *argv) } #endif +static void glob_version(t_pd *dummy, float f) +{ + if (f > 0) + error("file format newer than this version of Pd (trying anyway...)"); +} + void max_default(t_pd *x, t_symbol *s, int argc, t_atom *argv) { int i; @@ -113,6 +119,8 @@ void glob_init(void) class_addmethod(glob_pdobject, (t_method)glob_ping, gensym("ping"), 0); class_addmethod(glob_pdobject, (t_method)glob_savepreferences, gensym("save-preferences"), 0); + class_addmethod(glob_pdobject, (t_method)glob_version, + gensym("version"), A_FLOAT, 0); #ifdef UNIX class_addmethod(glob_pdobject, (t_method)glob_watchdog, gensym("watchdog"), 0); diff --git a/pd/src/m_obj.c b/pd/src/m_obj.c index f5c91cdf..3f8bcda4 100644 --- a/pd/src/m_obj.c +++ b/pd/src/m_obj.c @@ -15,7 +15,7 @@ union inletunion t_gpointer *iu_pointerslot; t_float *iu_floatslot; t_symbol **iu_symslot; - t_sample iu_floatsignalvalue; + t_float iu_floatsignalvalue; }; struct _inlet @@ -660,7 +660,7 @@ int obj_issignaloutlet(t_object *x, int m) return (o2 && (o2->o_sym == &s_signal)); } -t_sample *obj_findsignalscalar(t_object *x, int m) +t_float *obj_findsignalscalar(t_object *x, int m) { int n = 0; t_inlet *i; @@ -668,7 +668,7 @@ t_sample *obj_findsignalscalar(t_object *x, int m) { if (!m--) return (x->ob_pd->c_floatsignalin > 0 ? - (t_sample *)(((char *)x) + x->ob_pd->c_floatsignalin) : 0); + (t_float *)(((char *)x) + x->ob_pd->c_floatsignalin) : 0); n++; } for (i = x->ob_inlet; i; i = i->i_next, m--) diff --git a/pd/src/m_pd.h b/pd/src/m_pd.h index 5460c517..c92ba837 100644 --- a/pd/src/m_pd.h +++ b/pd/src/m_pd.h @@ -11,7 +11,7 @@ extern "C" { #define PD_MAJOR_VERSION 0 #define PD_MINOR_VERSION 41 #define PD_BUGFIX_VERSION 0 -#define PD_TEST_VERSION "test06" +#define PD_TEST_VERSION "test10" /* old name for "MSW" flag -- we have to take it for the sake of many old "nmakefiles" for externs, which will define NT and not MSW */ @@ -368,6 +368,8 @@ EXTERN t_glist *canvas_getcurrent(void); EXTERN void canvas_makefilename(t_glist *c, char *file, char *result,int resultsize); EXTERN t_symbol *canvas_getdir(t_glist *x); +EXTERN char sys_font[]; /* default typeface set in s_main.c */ +EXTERN char sys_fontweight[]; /* default font weight set in s_main.c */ EXTERN int sys_fontwidth(int fontsize); EXTERN int sys_fontheight(int fontsize); EXTERN void canvas_dataproperties(t_glist *x, t_scalar *sc, t_binbuf *b); @@ -479,7 +481,7 @@ typedef struct _signal { int s_n; /* number of points in the array */ t_sample *s_vec; /* the array */ - float s_sr; /* sample rate */ + t_float s_sr; /* sample rate */ int s_refcount; /* number of times used */ int s_isborrowed; /* whether we're going to borrow our array */ struct _signal *s_borrowedfrom; /* signal to borrow it from */ @@ -496,24 +498,24 @@ EXTERN t_int *copy_perform(t_int *args); EXTERN void dsp_add_plus(t_sample *in1, t_sample *in2, t_sample *out, int n); EXTERN void dsp_add_copy(t_sample *in, t_sample *out, int n); -EXTERN void dsp_add_scalarcopy(t_sample *in, t_sample *out, int n); +EXTERN void dsp_add_scalarcopy(t_float *in, t_sample *out, int n); EXTERN void dsp_add_zero(t_sample *out, int n); EXTERN int sys_getblksize(void); -EXTERN float sys_getsr(void); +EXTERN t_float sys_getsr(void); EXTERN int sys_get_inchannels(void); EXTERN int sys_get_outchannels(void); EXTERN void dsp_add(t_perfroutine f, int n, ...); EXTERN void dsp_addv(t_perfroutine f, int n, t_int *vec); -EXTERN void pd_fft(float *buf, int npoints, int inverse); +EXTERN void pd_fft(t_float *buf, int npoints, int inverse); EXTERN int ilog2(int n); -EXTERN void mayer_fht(float *fz, int n); -EXTERN void mayer_fft(int n, float *real, float *imag); -EXTERN void mayer_ifft(int n, float *real, float *imag); -EXTERN void mayer_realfft(int n, float *real); -EXTERN void mayer_realifft(int n, float *real); +EXTERN void mayer_fht(t_sample *fz, int n); +EXTERN void mayer_fft(int n, t_sample *real, t_sample *imag); +EXTERN void mayer_ifft(int n, t_sample *real, t_sample *imag); +EXTERN void mayer_realfft(int n, t_sample *real); +EXTERN void mayer_realifft(int n, t_sample *real); EXTERN float *cos_table; #define LOGCOSTABSIZE 9 @@ -532,13 +534,13 @@ typedef struct _resample t_int downsample; /* downsampling factor */ t_int upsample; /* upsampling factor */ - t_float *s_vec; /* here we hold the resampled data */ + t_sample *s_vec; /* here we hold the resampled data */ int s_n; - t_float *coeffs; /* coefficients for filtering... */ + t_sample *coeffs; /* coefficients for filtering... */ int coefsize; - t_float *buffer; /* buffer for filtering */ + t_sample *buffer; /* buffer for filtering */ int bufsize; } t_resample; @@ -550,18 +552,18 @@ EXTERN void resamplefrom_dsp(t_resample *x, t_sample *in, int insize, int outsiz EXTERN void resampleto_dsp(t_resample *x, t_sample *out, int insize, int outsize, int method); /* ----------------------- utility functions for signals -------------- */ -EXTERN float mtof(float); -EXTERN float ftom(float); -EXTERN float rmstodb(float); -EXTERN float powtodb(float); -EXTERN float dbtorms(float); -EXTERN float dbtopow(float); - -EXTERN float q8_sqrt(float); -EXTERN float q8_rsqrt(float); +EXTERN t_float mtof(t_float); +EXTERN t_float ftom(t_float); +EXTERN t_float rmstodb(t_float); +EXTERN t_float powtodb(t_float); +EXTERN t_float dbtorms(t_float); +EXTERN t_float dbtopow(t_float); + +EXTERN t_float q8_sqrt(t_float); +EXTERN t_float q8_rsqrt(t_float); #ifndef N32 -EXTERN float qsqrt(float); /* old names kept for extern compatibility */ -EXTERN float qrsqrt(float); +EXTERN t_float qsqrt(t_float); /* old names kept for extern compatibility */ +EXTERN t_float qrsqrt(t_float); #endif /* --------------------- data --------------------------------- */ @@ -572,7 +574,7 @@ EXTERN_STRUCT _garray; EXTERN t_class *garray_class; EXTERN int garray_getfloatarray(t_garray *x, int *size, t_float **vec); EXTERN int garray_getfloatwords(t_garray *x, int *size, t_word **vec); -EXTERN float garray_get(t_garray *x, t_symbol *s, t_int indx); +EXTERN t_float garray_get(t_garray *x, t_symbol *s, t_int indx); EXTERN void garray_redraw(t_garray *x); EXTERN int garray_npoints(t_garray *x); EXTERN char *garray_vec(t_garray *x); @@ -622,7 +624,6 @@ defined, there is a "te_xpix" field in objects, not a "te_xpos" as before: */ #define PD_USE_TE_XPIX - #if defined(__i386__) || defined(__x86_64__) /* a test for NANs and denormals. Should only be necessary on i386. */ #define PD_BADFLOAT(f) ((((*(unsigned int*)&(f))&0x7f800000)==0) || \ diff --git a/pd/src/m_sched.c b/pd/src/m_sched.c index 035c0b27..76f24a78 100644 --- a/pd/src/m_sched.c +++ b/pd/src/m_sched.c @@ -28,6 +28,11 @@ int sys_schedblocksize = DEFDACBLKSIZE; int sys_usecsincelastsleep(void); int sys_sleepgrain; +void sched_reopenmeplease(void) /* request from s_audio for deferred reopen */ +{ + sys_quit = SYS_QUIT_RESTART; +} + typedef void (*t_clockmethod)(void *client); struct _clock @@ -286,7 +291,7 @@ static void sched_pollformeters( void) } if (sched_meterson) { - float inmax, outmax; + t_sample inmax, outmax; sys_getmeters(&inmax, &outmax); indb = 0.5 + rmstodb(inmax); outdb = 0.5 + rmstodb(outmax); @@ -311,7 +316,7 @@ static void sched_pollformeters( void) sched_diddsp + (int)(sys_dacsr /(double)sys_schedblocksize); } -void glob_meters(void *dummy, float f) +void glob_meters(void *dummy, t_float f) { if (f == 0) sys_getmeters(0, 0); @@ -342,10 +347,13 @@ void sched_set_using_audio(int flag) sched_referencerealtime = sys_getrealtime(); sched_referencelogicaltime = clock_getlogicaltime(); } - if (flag == SCHED_AUDIO_CALLBACK && sched_useaudio != SCHED_AUDIO_CALLBACK) + if (flag == SCHED_AUDIO_CALLBACK && + sched_useaudio != SCHED_AUDIO_CALLBACK) sys_quit = SYS_QUIT_RESTART; - if (flag != SCHED_AUDIO_CALLBACK && sched_useaudio == SCHED_AUDIO_CALLBACK) - post("sorry, can't turn off callbacks yet; restart Pd"); /* not right yet! */ + if (flag != SCHED_AUDIO_CALLBACK && + sched_useaudio == SCHED_AUDIO_CALLBACK) + post("sorry, can't turn off callbacks yet; restart Pd"); + /* not right yet! */ sys_time_per_dsp_tick = (TIMEUNITPERSEC) * ((double)sys_schedblocksize) / sys_dacsr; @@ -529,7 +537,7 @@ void sched_audio_callbackfn(void) static void m_callbackscheduler(void) { sys_initmidiqueue(); - while (1) + while (!sys_quit) { #ifdef MSW Sleep(1000); diff --git a/pd/src/makefile.in b/pd/src/makefile.in index d77d4ac4..b4ad8217 100644 --- a/pd/src/makefile.in +++ b/pd/src/makefile.in @@ -59,7 +59,7 @@ SRC = g_canvas.c g_graph.c g_text.c g_rtext.c g_array.c g_template.c g_io.c \ OBJ = $(SRC:.c=.o) -GSRC = t_main.c t_tkcmd.c +GSRC = @GUISRC@ GOBJ = $(GSRC:.c=.o) @@ -83,10 +83,10 @@ endif .PHONY: pd gui externs all -all: $(PDEXEC) $(BIN_DIR)/pd-watchdog $(BIN_DIR)/$(GUINAME) $(BIN_DIR)/pdsend \ +all: pd $(BIN_DIR)/pd-watchdog gui $(BIN_DIR)/pdsend \ $(BIN_DIR)/pdreceive $(BIN_DIR)/pd.tk externs -bin: $(PDEXEC) $(BIN_DIR)/pd-watchdog $(BIN_DIR)/$(GUINAME) $(BIN_DIR)/pdsend \ +bin: pd $(BIN_DIR)/pd-watchdog gui $(BIN_DIR)/pdsend \ $(BIN_DIR)/pdreceive $(BIN_DIR)/pd.tk $(OBJ) : %.o : %.c @@ -100,7 +100,11 @@ $(ASIOOBJ): %.o : %.cpp pd: $(PDEXEC) +ifneq ($(GSRC),) gui: $(BIN_DIR)/$(GUINAME) +else +gui: +endif pd-watchdog: $(BIN_DIR)/pd-watchdog @@ -118,7 +122,7 @@ $(BIN_DIR)/pdreceive: u_pdreceive.c $(BIN_DIR) $(PDEXEC): $(OBJ) $(BIN_DIR) cd ../obj; $(CC) $(LDFLAGS) $(DBG_CFLAGS) -o $(PDEXEC) $(OBJ) $(LIB) - + $(BIN_DIR)/pd-gui: $(GOBJ) $(GSRC) cd ../obj; $(CC) $(INCLUDE) -o $(BIN_DIR)/$(GUINAME) $(GOBJ) $(GLIB) @@ -170,12 +174,12 @@ install: all for dir in $(shell ls -1 ../doc | grep -v CVS); do \ echo "installing $$dir"; \ install -d $(pddocdir)/$$dir ; \ - install -p ../doc/$$dir/*.* $(pddocdir)/$$dir ; \ + install -m644 -p ../doc/$$dir/*.* $(pddocdir)/$$dir ; \ done for dir in $(shell ls -1 ../doc/7.stuff | grep -v CVS); do \ echo "installing 7.stuff/$$dir"; \ install -d $(pddocdir)/7.stuff/$$dir ; \ - install -p ../doc/7.stuff/$$dir/*.* $(pddocdir)/7.stuff/$$dir ; \ + install -m644 -p ../doc/7.stuff/$$dir/*.* $(pddocdir)/7.stuff/$$dir ; \ done mv $(ABOUT_FILE) $(ABOUT_FILE).tmp cat $(ABOUT_FILE).tmp | sed 's|PD_VERSION|Pd version $(PD_VERSION)|' \ diff --git a/pd/src/makefile.nt b/pd/src/makefile.nt index d60651cd..addad543 100644 --- a/pd/src/makefile.nt +++ b/pd/src/makefile.nt @@ -2,17 +2,23 @@ all: pd gui ..\bin\pd.tk ..\bin\pdsend.exe ..\bin\pdreceive.exe -VC = "C:\Program Files\Microsoft Visual Studio\VC98" + +VCSDK = "C:\Program Files\Microsoft SDKs\Windows\v6.0A" +VC9 = "C:\Program Files\Microsoft Visual Studio 9.0\VC" #VC="\Program Files\DevStudio\Vc" -INCLUDE = -I.\ -I..\Tcl\include -I\DXSDK\include -I$(VC)\include +INCLUDE = -I.\ -I..\Tcl\include -I\DXSDK\include -I$(VC9)\Include \ + -I$(VCSDK)\Include -LDIR = $(VC)\lib +LDIR = $(VCSDK)\lib +LD2 = $(VC9)\lib -LIB = /NODEFAULTLIB:libc /NODEFAULTLIB:oldnames /NODEFAULTLIB:kernel \ - /NODEFAULTLIB:uuid \ - $(LDIR)\libc.lib $(LDIR)\oldnames.lib $(LDIR)\kernel32.lib \ +LIB = /NODEFAULTLIB:libcmt /NODEFAULTLIB:oldnames /NODEFAULTLIB:libc \ + /NODEFAULTLIB:uuid $(LDIR)\kernel32.lib \ $(LDIR)\wsock32.lib $(LDIR)\winmm.lib $(LDIR)\advapi32.lib \ - $(LDIR)\setupapi.lib ..\bin\pthreadVC.lib + $(LDIR)\setupapi.lib ..\bin\pthreadVC.lib \ + $(LD2)\libcmt.lib $(LD2)\oldnames.lib + +# \ GLIB = $(LIB) ..\bin\tcl84.lib ..\bin\tk84.lib CFLAGS = /nologo /W3 /DMSW /DNT /DPD /DPD_INTERNAL /DWIN32 /DWINDOWS /Ox \ @@ -97,11 +103,11 @@ pd: ..\bin\pd.exe ..\bin\pd.com gui: ..\bin\pdtcl.dll ..\bin\pd.exe: s_entry.obj ..\bin\pd.lib - link $(LFLAGS) /out:..\bin\pd.exe /INCREMENTAL:NO s_entry.obj \ + link $(LFLAGS) /OUT:..\bin\pd.exe /INCREMENTAL:NO s_entry.obj \ ..\bin\pd.lib $(LIB) $(ASIOLIB) ..\bin\pd.dll ..\bin\pd.lib: $(OBJC) $(OBJASIO) - link $(LFLAGS) /dll /export:sys_main /out:..\bin\pd.dll $(OBJC) \ + link /DLL /OUT:..\bin\pd.dll /EXPORT:sys_main $(LFLAGS) $(OBJC) \ $(OBJASIO) $(LIB) $(ASIOLIB) ..\bin\pdtcl.dll: t_tkcmd.obj diff --git a/pd/src/notes.txt b/pd/src/notes.txt index cc709392..b00b03da 100644 --- a/pd/src/notes.txt +++ b/pd/src/notes.txt @@ -1,7 +1,10 @@ ---------------- dolist -------------------- - binbuf_read_via_canvas in x_qlist.c +fixed crash bug closing patches with open GOPs +fixed PC device counting problem (first device invoked by -audiodev 0) +fixed MSTACKSIZE limitation in m_binbuf.c +fixed so that if more than one object is selected, clicking prefers to + "hit" a selected one (better dragging after "duplicate") -PC device counting problem (first device invoked by -audiodev 0) test: compile on various versions of linux @@ -12,17 +15,16 @@ windows: "-audiodev" with no args in registry can't start up? mac: clicking on windows seems sometimes not to open them -what does OSX do when jack is compiled into Pd but not installed?? -turn on paMacCore_ChangeDeviceParameters for mac (pa_mac_core.h) + what does OSX do when jack is compiled into Pd but not installed?? + turn on paMacCore_ChangeDeviceParameters for mac (pa_mac_core.h) Gnome: why don't windows pop up when clicked on? problems: +check real-time gaps in writesf~ fix declare to update current patch when changed objects on GOP don't erase if you edit the GOP while they're showing -MSTACKSIZE limitation in m_binbuf.c add -stack option to make 'regular' stack larger TK menu on Windows says "wish" -activating windows in Gnome? help browser broke on Panurge offer both new and old help browser style look again at array vis/invis conundrum, g_template.c @@ -37,7 +39,6 @@ when retyping abstractions, offer to save dirty one should linux stop grabbing focus on vis? Is there a way to detect whether the mouse is in a window when it opens? arrays that don't fit in bounds don't update (same as red rectangle problem?) -look in d_resample.pd to understand inlet~ upsampling... patcher inlets don't deal with scalars (zbug.pd) check if there's a problem loading libs on startup if superuser read xx.txt in "bad" gives warnings @@ -55,7 +56,8 @@ real-time spectrum grapher document ||, |, etc, better features: -clickles connection (hit 'c' key or something) +flag to prevent unlocking patches +clickless connection (hit 'c' key? see Bouchard paper) messages to suppress menus&accelerators, and invisibilize Pd window machine-independent fonts callback scheduling on Mac diff --git a/pd/src/s_audio.c b/pd/src/s_audio.c index b00c0dd6..04b15b21 100644 --- a/pd/src/s_audio.c +++ b/pd/src/s_audio.c @@ -39,14 +39,14 @@ int sys_outchannels; int sys_advance_samples; /* scheduler advance in samples */ int sys_blocksize = 0; /* audio I/O block size in sample frames */ int sys_audioapi = API_DEFAULT; - +int sys_audioapiopened = -1; /* save last API opened for later closing */ static int sys_meters; /* true if we're metering */ -static float sys_inmax; /* max input amplitude */ -static float sys_outmax; /* max output amplitude */ +static t_sample sys_inmax; /* max input amplitude */ +static t_sample sys_outmax; /* max output amplitude */ /* exported variables */ int sys_schedadvance; /* scheduler advance in microseconds */ -float sys_dacsr; +t_float sys_dacsr; t_sample *sys_soundout; t_sample *sys_soundin; @@ -67,7 +67,10 @@ static int audio_rate; static int audio_advance; static int audio_callback; +static int audio_callback_is_open; /* reflects true actual state */ +static int audio_nextinchans, audio_nextoutchans; void sched_audio_callbackfn(void); +void sched_reopenmeplease(void); static int audio_isopen(void) { @@ -137,18 +140,18 @@ void sys_setchsr(int chin, int chout, int sr) { int nblk; int inbytes = (chin ? chin : 2) * - (DEFDACBLKSIZE*sizeof(float)); + (DEFDACBLKSIZE*sizeof(t_sample)); int outbytes = (chout ? chout : 2) * - (DEFDACBLKSIZE*sizeof(float)); + (DEFDACBLKSIZE*sizeof(t_sample)); if (sys_soundin) freebytes(sys_soundin, (sys_inchannels? sys_inchannels : 2) * - (DEFDACBLKSIZE*sizeof(float))); + (DEFDACBLKSIZE*sizeof(t_sample))); if (sys_soundout) freebytes(sys_soundout, (sys_outchannels? sys_outchannels : 2) * - (DEFDACBLKSIZE*sizeof(float))); + (DEFDACBLKSIZE*sizeof(t_sample))); sys_inchannels = chin; sys_outchannels = chout; sys_dacsr = sr; @@ -156,10 +159,10 @@ void sys_setchsr(int chin, int chout, int sr) if (sys_advance_samples < 3 * DEFDACBLKSIZE) sys_advance_samples = 3 * DEFDACBLKSIZE; - sys_soundin = (t_float *)getbytes(inbytes); + sys_soundin = (t_sample *)getbytes(inbytes); memset(sys_soundin, 0, inbytes); - sys_soundout = (t_float *)getbytes(outbytes); + sys_soundout = (t_sample *)getbytes(outbytes); memset(sys_soundout, 0, outbytes); if (sys_verbose) @@ -193,9 +196,6 @@ void sys_set_audio_settings(int naudioindev, int *audioindev, int nchindev, { return; } - /* if we're already open close it */ - if (sys_inchannels || sys_outchannels) - sys_close_audio(); if (rate < 1) rate = DEFAULTSRATE; @@ -324,10 +324,11 @@ void sys_set_audio_settings(int naudioindev, int *audioindev, int nchindev, nrealoutdev++; } sys_schedadvance = advance * 1000; - sys_setchsr(inchans, outchans, rate); sys_log_error(ERR_NOTHING); + audio_nextinchans = inchans; + audio_nextoutchans = outchans; sys_save_audio_params(nrealindev, realindev, realinchans, - nrealoutdev, realoutdev, realoutchans, sys_dacsr, advance, callback); + nrealoutdev, realoutdev, realoutchans, rate, advance, callback); } void sys_close_audio(void) @@ -339,33 +340,36 @@ void sys_close_audio(void) if (!audio_isopen()) return; #ifdef USEAPI_PORTAUDIO - if (sys_audioapi == API_PORTAUDIO) + if (sys_audioapiopened == API_PORTAUDIO) pa_close_audio(); else #endif #ifdef USEAPI_JACK - if (sys_audioapi == API_JACK) + if (sys_audioapiopened == API_JACK) jack_close_audio(); else #endif #ifdef USEAPI_OSS - if (sys_audioapi == API_OSS) + if (sys_audioapiopened == API_OSS) oss_close_audio(); else #endif #ifdef USEAPI_ALSA - if (sys_audioapi == API_ALSA) + if (sys_audioapiopened == API_ALSA) alsa_close_audio(); else #endif #ifdef USEAPI_MMIO - if (sys_audioapi == API_MMIO) + if (sys_audioapiopened == API_MMIO) mmio_close_audio(); else #endif - post("sys_close_audio: unknown API %d", sys_audioapi); + post("sys_close_audio: unknown API %d", sys_audioapiopened); sys_inchannels = sys_outchannels = 0; + sys_audioapiopened = -1; sched_set_using_audio(SCHED_AUDIO_NONE); + audio_state = 0; + audio_callback_is_open = 0; } /* open audio using whatever parameters were last used */ @@ -376,6 +380,7 @@ void sys_reopen_audio( void) int rate, advance, callback, outcome = 0; sys_get_audio_params(&naudioindev, audioindev, chindev, &naudiooutdev, audiooutdev, choutdev, &rate, &advance, &callback); + sys_setchsr(audio_nextinchans, audio_nextoutchans, rate); if (!naudioindev && !naudiooutdev) { sched_set_using_audio(SCHED_AUDIO_NONE); @@ -426,12 +431,17 @@ void sys_reopen_audio( void) { audio_state = 0; sched_set_using_audio(SCHED_AUDIO_NONE); + sys_audioapiopened = -1; + audio_callback_is_open = 0; } else { + /* fprintf(stderr, "started w/callback %d\n", callback); */ audio_state = 1; sched_set_using_audio( (callback ? SCHED_AUDIO_CALLBACK : SCHED_AUDIO_POLL)); + sys_audioapiopened = sys_audioapi; + audio_callback_is_open = callback; } sys_vgui("set pd_whichapi %d\n", (outcome == 0 ? sys_audioapi : 0)); } @@ -441,11 +451,11 @@ int sys_send_dacs(void) if (sys_meters) { int i, n; - float maxsamp; + t_sample maxsamp; for (i = 0, n = sys_inchannels * DEFDACBLKSIZE, maxsamp = sys_inmax; i < n; i++) { - float f = sys_soundin[i]; + t_sample f = sys_soundin[i]; if (f > maxsamp) maxsamp = f; else if (-f > maxsamp) maxsamp = -f; } @@ -453,7 +463,7 @@ int sys_send_dacs(void) for (i = 0, n = sys_outchannels * DEFDACBLKSIZE, maxsamp = sys_outmax; i < n; i++) { - float f = sys_soundout[i]; + t_sample f = sys_soundout[i]; if (f > maxsamp) maxsamp = f; else if (-f > maxsamp) maxsamp = -f; } @@ -489,7 +499,7 @@ int sys_send_dacs(void) return (0); } -float sys_getsr(void) +t_float sys_getsr(void) { return (sys_dacsr); } @@ -504,7 +514,7 @@ int sys_get_inchannels(void) return (sys_inchannels); } -void sys_getmeters(float *inmax, float *outmax) +void sys_getmeters(t_sample *inmax, t_sample *outmax) { if (inmax) { @@ -684,6 +694,7 @@ void glob_audio_properties(t_pd *dummy, t_floatarg flongform) gfxstub_new(&glob_pdobject, (void *)glob_audio_properties, buf); } +extern int pa_foo; /* new values from dialog window */ void glob_audio_dialog(t_pd *dummy, t_symbol *s, int argc, t_atom *argv) { @@ -697,7 +708,6 @@ void glob_audio_dialog(t_pd *dummy, t_symbol *s, int argc, t_atom *argv) int newrate = atom_getintarg(16, argc, argv); int newadvance = atom_getintarg(17, argc, argv); int newcallback = atom_getintarg(18, argc, argv); - int statewas; for (i = 0; i < 4; i++) { @@ -732,13 +742,14 @@ void glob_audio_dialog(t_pd *dummy, t_symbol *s, int argc, t_atom *argv) if (newcallback < 0) newcallback = 0; - if (audio_callback == newcallback) + if (!audio_callback_is_open && !newcallback) sys_close_audio(); sys_set_audio_settings(nindev, newaudioindev, nindev, newaudioinchan, noutdev, newaudiooutdev, noutdev, newaudiooutchan, newrate, newadvance, (newcallback >= 0 ? newcallback : 0)); - if (audio_callback == newcallback) + if (!audio_callback_is_open && !newcallback) sys_reopen_audio(); + else sched_reopenmeplease(); } void sys_listdevs(void ) @@ -815,7 +826,6 @@ void glob_audio_setapi(void *dummy, t_floatarg f) else if (audio_isopen()) { sys_close_audio(); - audio_state = 0; } } @@ -832,7 +842,6 @@ void sys_set_audio_state(int onoff) if (audio_isopen()) sys_close_audio(); } - audio_state = onoff; } void sys_get_audio_apis(char *buf) diff --git a/pd/src/s_audio_jack.c b/pd/src/s_audio_jack.c index 92f652e9..f00e2f13 100644 --- a/pd/src/s_audio_jack.c +++ b/pd/src/s_audio_jack.c @@ -18,8 +18,8 @@ static jack_nframes_t jack_out_max; #define JACK_OUT_MAX 64 static jack_nframes_t jack_filled = 0; -static float jack_outbuf[NUM_JACK_PORTS*BUF_JACK]; -static float jack_inbuf[NUM_JACK_PORTS*BUF_JACK]; +static t_sample jack_outbuf[NUM_JACK_PORTS*BUF_JACK]; +static t_sample jack_inbuf[NUM_JACK_PORTS*BUF_JACK]; static int jack_started = 0; @@ -39,22 +39,42 @@ static int process (jack_nframes_t nframes, void *arg) { int j; - float *out; - float *in; - + jack_default_audio_sample_t *out, *in; if (nframes > JACK_OUT_MAX) jack_out_max = nframes; else jack_out_max = JACK_OUT_MAX; if (jack_filled >= nframes) { if (jack_filled != nframes) fprintf(stderr,"Partial read"); - - for (j = 0; j < sys_outchannels; j++) { + /* hmm, how to find out whether 't_sample' and 'jack_default_audio_sample_t' are actually the same type??? */ + if(sizeof(t_sample)==sizeof(jack_default_audio_sample_t)) + { + for (j = 0; j < sys_outchannels; j++) { out = jack_port_get_buffer (output_port[j], nframes); - memcpy(out, jack_outbuf + (j * BUF_JACK), sizeof (float) * nframes); - } - for (j = 0; j < sys_inchannels; j++) { + memcpy(out, jack_outbuf + (j * BUF_JACK), sizeof (jack_default_audio_sample_t) * nframes); + } + for (j = 0; j < sys_inchannels; j++) { + in = jack_port_get_buffer( input_port[j], nframes); + memcpy(jack_inbuf + (j * BUF_JACK), in, sizeof (jack_default_audio_sample_t) * nframes); + } + } + else + { + unsigned int frame=0; + t_sample*data; + for (j = 0; j < sys_outchannels; j++) { + out = jack_port_get_buffer (output_port[j], nframes); + data=jack_outbuf + (j * BUF_JACK); + for(frame=0; frame<nframes; frame++) { + *out++=*data++; + } + } + for (j = 0; j < sys_inchannels; j++) { in = jack_port_get_buffer( input_port[j], nframes); - memcpy(jack_inbuf + (j * BUF_JACK), in, sizeof (float) * nframes); + data=jack_inbuf+(j*BUF_JACK); + for(frame=0; frame<nframes; frame++) { + *data++=*in++; + } + } } jack_filled -= nframes; } else { /* PD could not keep up ! */ @@ -322,7 +342,7 @@ void jack_close_audio(void) int jack_send_dacs(void) { - float * fp; + t_sample * fp; int j; int rtnval = SENDDACS_YES; int timenow; @@ -343,12 +363,12 @@ int jack_send_dacs(void) fp = sys_soundout; for (j = 0; j < sys_outchannels; j++) { - memcpy(jack_outbuf + (j * BUF_JACK) + jack_filled,fp, DEFDACBLKSIZE*sizeof(float)); + memcpy(jack_outbuf + (j * BUF_JACK) + jack_filled,fp, DEFDACBLKSIZE*sizeof(t_sample)); fp += DEFDACBLKSIZE; } fp = sys_soundin; for (j = 0; j < sys_inchannels; j++) { - memcpy(fp, jack_inbuf + (j * BUF_JACK) + jack_filled, DEFDACBLKSIZE*sizeof(float)); + memcpy(fp, jack_inbuf + (j * BUF_JACK) + jack_filled, DEFDACBLKSIZE*sizeof(t_sample)); fp += DEFDACBLKSIZE; } @@ -357,7 +377,7 @@ int jack_send_dacs(void) rtnval = SENDDACS_SLEPT; } - memset(sys_soundout,0,DEFDACBLKSIZE*sizeof(float)*sys_outchannels); + memset(sys_soundout,0,DEFDACBLKSIZE*sizeof(t_sample)*sys_outchannels); jack_filled += DEFDACBLKSIZE; return rtnval; } diff --git a/pd/src/s_audio_oss.c b/pd/src/s_audio_oss.c index 965d5b6c..2649d4e1 100644 --- a/pd/src/s_audio_oss.c +++ b/pd/src/s_audio_oss.c @@ -42,8 +42,8 @@ typedef int32_t t_oss_int32; /* GLOBALS */ static int linux_meters; /* true if we're metering */ -static float linux_inmax; /* max input amplitude */ -static float linux_outmax; /* max output amplitude */ +static t_sample linux_inmax; /* max input amplitude */ +static t_sample linux_outmax; /* max output amplitude */ static int linux_fragsize = 0; /* for block mode; block size (sample frames) */ /* our device handles */ @@ -64,7 +64,7 @@ static int linux_noutdevs = 0; static int linux_nindevs = 0; /* exported variables */ -float sys_dacsr; +t_float sys_dacsr; t_sample *sys_soundout; t_sample *sys_soundin; @@ -245,8 +245,27 @@ void oss_configure(t_oss_dev *dev, int srate, int dac, int skipblocksize) static int oss_setchannels(int fd, int wantchannels, char *devname) { - int param = wantchannels; - + int param; + if (sys_verbose) + post("setchan %d", wantchannels); + if (ioctl(fd, SNDCTL_DSP_CHANNELS, ¶m) == -1) + { + if (sys_verbose) + error("OSS: SOUND_DSP_READ_CHANNELS failed %s", devname); + } + else + { + if (sys_verbose) + post("channels originally %d for %s", param, devname); + if (param == wantchannels) + { + if (sys_verbose) + post("number of channels doesn't need setting\n"); + return (wantchannels); + } + } + param = wantchannels; +whynot: while (param > 1) { int save = param; @@ -399,10 +418,12 @@ int oss_open_audio(int nindev, int *indev, int nchin, int *chin, sys_setalarm(1000000); /* perhaps it's already open from the above? */ - if (linux_dacs[n].d_fd >= 0) + if (linux_adcs[n].d_fd >= 0) { fd = linux_adcs[n].d_fd; alreadyopened = 1; + if (sys_verbose) + post("already opened it"); } else { @@ -624,7 +645,7 @@ static void oss_doresync( void) int oss_send_dacs(void) { - float *fp1, *fp2; + t_sample *fp1, *fp2; long fill; int i, j, dev, rtnval = SENDDACS_YES; char buf[OSS_MAXSAMPLEWIDTH * DEFDACBLKSIZE * OSS_MAXCHPERDEV]; @@ -758,7 +779,7 @@ int oss_send_dacs(void) thischan += nchannels; } memset(sys_soundout, 0, - sys_outchannels * (sizeof(float) * DEFDACBLKSIZE)); + sys_outchannels * (sizeof(t_sample) * DEFDACBLKSIZE)); /* do input */ diff --git a/pd/src/s_audio_pa.c b/pd/src/s_audio_pa.c index f05c41d8..85816ee7 100644 --- a/pd/src/s_audio_pa.c +++ b/pd/src/s_audio_pa.c @@ -28,6 +28,8 @@ static t_audiocallback pa_callback; #define MAX_PA_CHANS 32 #define MAX_SAMPLES_PER_FRAME MAX_PA_CHANS * DEFDACBLKSIZE +int pa_foo; + static int pa_lowlevel_callback(const void *inputBuffer, void *outputBuffer, unsigned long framesPerBuffer, const PaStreamCallbackTimeInfo *outTime, PaStreamCallbackFlags myflags, @@ -36,10 +38,12 @@ static int pa_lowlevel_callback(const void *inputBuffer, int i; unsigned int j; float *fbuf, *fp2, *fp3, *soundiop; - if (framesPerBuffer != DEFDACBLKSIZE) - { - fprintf(stderr, "ignoring buffer size %d\n", framesPerBuffer); - return; + if (pa_foo) + fprintf(stderr, "pa_lowlevel_callback\n"); + if (framesPerBuffer != DEFDACBLKSIZE) + { + fprintf(stderr, "ignoring buffer size %d\n", (int)framesPerBuffer); + return 0; } if (inputBuffer != NULL) { @@ -51,6 +55,8 @@ static int pa_lowlevel_callback(const void *inputBuffer, } else memset((void *)pa_soundin, 0, framesPerBuffer * pa_inchans * sizeof(float)); + memset((void *)pa_soundout, 0, + framesPerBuffer * pa_outchans * sizeof(float)); (*pa_callback)(); if (outputBuffer != NULL) { @@ -60,7 +66,8 @@ static int pa_lowlevel_callback(const void *inputBuffer, for (j = 0, fp3 = fp2; j < framesPerBuffer; j++, fp3 += pa_outchans) *fp3 = *soundiop++; } - + if (pa_foo) + fprintf(stderr, "done pa_lowlevel_callback\n"); return 0; } @@ -153,8 +160,7 @@ int pa_open_audio(int inchans, int outchans, int rate, t_sample *soundin, int j, devno, pa_indev = 0, pa_outdev = 0; pa_callback = callbackfn; - if (callbackfn) - fprintf(stderr, "callback enabled\n"); + /* fprintf(stderr, "open callback %d\n", (callbackfn != 0)); */ if (!initialized) { /* Initialize PortAudio */ @@ -254,6 +260,7 @@ int pa_open_audio(int inchans, int outchans, int rate, t_sample *soundin, void pa_close_audio( void) { + /* fprintf(stderr, "close\n"); */ if (pa_inchans || pa_outchans) CloseAudioStream( pa_stream ); pa_inchans = pa_outchans = 0; diff --git a/pd/src/s_entry.c b/pd/src/s_entry.c index 5cef73cc..9a0984ed 100644 --- a/pd/src/s_entry.c +++ b/pd/src/s_entry.c @@ -23,6 +23,7 @@ int WINAPI WinMain(HINSTANCE hInstance, { printf("caught an exception; stopping\n"); } + return (0); } #else /* not _MSC_VER ... */ diff --git a/pd/src/s_inter.c b/pd/src/s_inter.c index 9945466f..816e6207 100644 --- a/pd/src/s_inter.c +++ b/pd/src/s_inter.c @@ -90,7 +90,6 @@ struct _socketreceiver extern char *pd_version; extern int sys_guisetportnumber; -extern char sys_font[]; /* tb: typeface */ static int sys_nfdpoll; static t_fdpoll *sys_fdpoll; @@ -849,7 +848,8 @@ void glob_watchdog(t_pd *dummy) #define FIRSTPORTNUM 5400 -static int defaultfontshit[] = { +#define MAXFONTS 21 +static int defaultfontshit[MAXFONTS] = { 8, 5, 9, 10, 6, 10, 12, 7, 13, 14, 9, 17, 16, 10, 19, 24, 15, 28, 24, 15, 28}; #define NDEFAULTFONT (sizeof(defaultfontshit)/sizeof(*defaultfontshit)) @@ -1237,7 +1237,7 @@ int sys_startgui(const char *guidir) sys_guisock = accept(xsock, (struct sockaddr *) &server, (socklen_t *)&len); #ifdef OOPS - close(xsock); + sys_closesocket(xsock); #endif if (sys_guisock < 0) sys_sockerror("accept"); if (sys_verbose) @@ -1257,8 +1257,8 @@ int sys_startgui(const char *guidir) #endif sys_get_audio_apis(buf); sys_get_midi_apis(buf2); - sys_vgui("pdtk_pd_startup {%s} %s %s {%s}\n", pd_version, buf, buf2, - sys_font); + sys_vgui("pdtk_pd_startup {%s} %s %s {%s} %s\n", pd_version, buf, buf2, + sys_font, sys_fontweight); } return (0); @@ -1292,7 +1292,7 @@ void glob_quit(void *dummy) sys_vgui("exit\n"); if (!sys_nogui) { - close(sys_guisock); + sys_closesocket(sys_guisock); sys_rmpollfn(sys_guisock); } sys_bail(0); diff --git a/pd/src/s_loader.c b/pd/src/s_loader.c index d2022146..4788c13c 100644 --- a/pd/src/s_loader.c +++ b/pd/src/s_loader.c @@ -124,7 +124,7 @@ static int sys_do_load_lib(t_canvas *canvas, char *objectname) symname[i] = 0; if (hexmunge) { - memmove(symname+6, symname, strlen(symname+1)); + memmove(symname+6, symname, strlen(symname)+1); strncpy(symname, "setup_", 6); } else strcat(symname, "_setup"); diff --git a/pd/src/s_main.c b/pd/src/s_main.c index ded67c88..3396e993 100644 --- a/pd/src/s_main.c +++ b/pd/src/s_main.c @@ -58,7 +58,13 @@ int sys_nmidiin = -1; int sys_midiindevlist[MAXMIDIINDEV] = {1}; int sys_midioutdevlist[MAXMIDIOUTDEV] = {1}; -char sys_font[100] = "courier"; /* tb: font name */ +char sys_font[100] = +#ifdef MSW + "Courier"; +#else + "Courier"; +#endif +char sys_fontweight[] = "bold "; /* currently only used for iemguis */ static int sys_main_srate; static int sys_main_advance; static int sys_main_callback; @@ -89,7 +95,7 @@ int* get_sys_main_advance() { return &sys_main_advance; } double* get_sys_time_per_dsp_tick() { return &sys_time_per_dsp_tick; } int* get_sys_schedblocksize() { return &sys_schedblocksize; } double* get_sys_time() { return &sys_time; } -float* get_sys_dacsr() { return &sys_dacsr; } +t_float* get_sys_dacsr() { return &sys_dacsr; } int* get_sys_sleepgrain() { return &sys_sleepgrain; } int* get_sys_schedadvance() { return &sys_schedadvance; } @@ -159,11 +165,7 @@ int sys_fontheight(int fontsize) } int sys_defaultfont; -#ifdef MSW -#define DEFAULTFONT 12 -#else #define DEFAULTFONT 10 -#endif static void openit(const char *dirname, const char *filename) { @@ -383,8 +385,9 @@ static char *(usagemessage[]) = { "-helppath <path> -- add to help file search path\n", "-open <file> -- open file(s) on startup\n", "-lib <file> -- load object library(s)\n", -"-font <n> -- specify default font size in points\n", -"-typeface <name> -- specify default font (default: courier)\n", +"-font-size <n> -- specify default font size in points\n", +"-font-face <name> -- specify default font (default: Bitstream Vera Sans Mono)\n", +"-font-weight <name>-- specify default font weight (normal or bold)\n", "-verbose -- extra printout on startup and when searching for files\n", "-version -- don't run Pd; just print out which version it is \n", "-d <n> -- specify debug level\n", @@ -744,21 +747,26 @@ int sys_argparse(int argc, char **argv) sys_externlist = namelist_append_files(sys_externlist, argv[1]); argc -= 2; argv += 2; } - else if (!strcmp(*argv, "-font") && argc > 1) + else if ((!strcmp(*argv, "-font-size") || !strcmp(*argv, "-font")) && argc > 1) { sys_defaultfont = sys_nearestfontsize(atoi(argv[1])); argc -= 2; argv += 2; } - /* tb: font name { */ - else if (!strcmp(*argv, "-typeface") && argc > 1) + else if ((!strcmp(*argv, "-font-face") || !strcmp(*argv, "-typeface")) && argc > 1) { strncpy(sys_font,*(argv+1),sizeof(sys_font)-1); sys_font[sizeof(sys_font)-1] = 0; argc -= 2; argv += 2; } - /* } tb */ + else if (!strcmp(*argv, "-font-weight") && argc > 1) + { + strncpy(sys_fontweight,*(argv+1),sizeof(sys_fontweight)-1); + sys_fontweight[sizeof(sys_fontweight)-1] = 0; + argc -= 2; + argv += 2; + } else if (!strcmp(*argv, "-verbose")) { sys_verbose++; @@ -814,14 +822,16 @@ int sys_argparse(int argc, char **argv) else if (!strcmp(*argv, "-schedlib")) { sys_externalschedlib = 1; - strcpy(sys_externalschedlibname, argv[1]); + strncpy(sys_externalschedlibname, argv[1], + sizeof(sys_externalschedlibname) - 1); argv += 2; argc -= 2; } else if (!strcmp(*argv, "-extraflags")) { sys_extraflags = 1; - strcpy(sys_extraflagsstring, argv[1]); + strncpy(sys_extraflagsstring, argv[1], + sizeof(sys_extraflagsstring) - 1); argv += 2; argc -= 2; } diff --git a/pd/src/s_path.c b/pd/src/s_path.c index 97591d4c..6abe7d0c 100644 --- a/pd/src/s_path.c +++ b/pd/src/s_path.c @@ -522,11 +522,16 @@ void glob_start_path_dialog(t_pd *dummy) char buf[MAXPDSTRING]; int i; t_namelist *nl; - - for (nl = sys_searchpath, i = 0; nl && i < 10; nl = nl->nl_next, i++) - sys_vgui("pd_set pd_path%d \"%s\"\n", i, nl->nl_string); - for (; i < 10; i++) - sys_vgui("pd_set pd_path%d \"\"\n", i); + + sprintf(buf, "list"); + for (nl = sys_searchpath, i = 0; nl; nl = nl->nl_next, i++) { + if(nl->nl_string){ + strcat(buf, " \""); + strcat(buf, nl->nl_string); + strcat(buf, "\""); + } + } + sys_vgui("pd_set pd_path [%s]\n", buf); sprintf(buf, "pdtk_path_dialog %%s %d %d\n", sys_usestdpath, sys_verbose); gfxstub_new(&glob_pdobject, (void *)glob_start_path_dialog, buf); @@ -554,11 +559,16 @@ void glob_start_startup_dialog(t_pd *dummy) char buf[MAXPDSTRING]; int i; t_namelist *nl; - - for (nl = sys_externlist, i = 0; nl && i < 10; nl = nl->nl_next, i++) - sys_vgui("pd_set pd_startup%d \"%s\"\n", i, nl->nl_string); - for (; i < 10; i++) - sys_vgui("pd_set pd_startup%d \"\"\n", i); + + sprintf(buf, "list"); + for (nl = sys_externlist, i = 0; nl; nl = nl->nl_next, i++) { + if(nl->nl_string){ + strcat(buf, " \""); + strcat(buf, nl->nl_string); + strcat(buf, "\""); + } + } + sys_vgui("pd_set pd_startup [%s]\n", buf); sprintf(buf, "pdtk_startup_dialog %%s %d \"%s\"\n", sys_defeatrt, sys_flags->s_name); diff --git a/pd/src/s_print.c b/pd/src/s_print.c index 1d7695d1..3aacd188 100644 --- a/pd/src/s_print.c +++ b/pd/src/s_print.c @@ -77,13 +77,13 @@ void postatom(int argc, t_atom *argv) int i; for (i = 0; i < argc; i++) { - char buf[80]; - atom_string(argv+i, buf, 80); + char buf[MAXPDSTRING]; + atom_string(argv+i, buf, MAXPDSTRING); poststring(buf); } } -void postfloat(float f) +void postfloat(t_float f) { char buf[80]; t_atom a; @@ -118,7 +118,7 @@ void verbose(int level, const char *fmt, ...) int i; if(level>sys_verbose)return; dopost("verbose("); - postfloat((float)level); + postfloat((t_float)level); dopost("):"); va_start(ap, fmt); diff --git a/pd/src/s_stuff.h b/pd/src/s_stuff.h index 4cde9c42..a1f9026c 100644 --- a/pd/src/s_stuff.h +++ b/pd/src/s_stuff.h @@ -68,7 +68,7 @@ extern int sys_inchannels; extern int sys_outchannels; extern int sys_advance_samples; /* scheduler advance in samples */ extern int sys_blocksize; /* audio I/O block size in sample frames */ -extern float sys_dacsr; +extern t_float sys_dacsr; extern int sys_schedadvance; extern int sys_sleepgrain; void sys_set_audio_settings(int naudioindev, int *audioindev, @@ -83,7 +83,7 @@ int sys_send_dacs(void); void sys_reportidle(void); void sys_set_priority(int higher); void sys_audiobuf(int nbufs); -void sys_getmeters(float *inmax, float *outmax); +void sys_getmeters(t_sample *inmax, t_sample *outmax); void sys_listdevs(void); void sys_setblocksize(int n); @@ -286,9 +286,6 @@ void sys_save_audio_params( typedef void (*t_printhook)(const char *s); extern t_printhook sys_printhook; /* set this to override printing */ extern int sys_printtostderr; -#ifdef MSW -#define vsnprintf _vsnprintf /* jsarlo -- alias this name for msw */ -#endif /* jsarlo { */ @@ -302,7 +299,7 @@ EXTERN int* get_sys_main_advance(void ) ; EXTERN double* get_sys_time_per_dsp_tick(void ) ; EXTERN int* get_sys_schedblocksize(void ) ; EXTERN double* get_sys_time(void ) ; -EXTERN float* get_sys_dacsr(void ) ; +EXTERN t_float* get_sys_dacsr(void ) ; EXTERN int* get_sys_sleepgrain(void ) ; EXTERN int* get_sys_schedadvance(void ) ; diff --git a/pd/src/u_main.tk b/pd/src/u_main.tk index be87b8f5..08d429a1 100644 --- a/pd/src/u_main.tk +++ b/pd/src/u_main.tk @@ -1,14 +1,4 @@ #!/usr/bin/wish - -# set pd_nt (bad name) 0 for unix, 1 for microsoft, and 2 for Mac OSX. -if { $tcl_platform(platform) == "windows" } { - set pd_nt 1 -} elseif { $tcl_platform(os) == "Darwin" } { - set pd_nt 2 -} else { - set pd_nt 0 -} - # Copyright (c) 1997-1999 Miller Puckette. # For information on usage and redistribution, and for a DISCLAIMER OF ALL # WARRANTIES, see the file, "LICENSE.txt," in this distribution. @@ -21,6 +11,39 @@ if { $tcl_platform(platform) == "windows" } { # # all this changes are labeled with #######iemlib########## +# set pd_nt (bad name) 0 for unix, 1 for microsoft, and 2 for Mac OSX. +if { $tcl_platform(platform) == "windows" } { + set pd_nt 1 + set defaultFontFamily {Bitstream Vera Sans Mono} + set defaultFontWeight normal + font create menuFont -family Tahoma -size -11 +} elseif { $tcl_platform(os) == "Darwin" } { + set pd_nt 2 + set defaultFontFamily Monaco + set defaultFontWeight normal +} else { + set pd_nt 0 + set defaultFontFamily Courier + set defaultFontWeight bold +} + +# start Pd-extended font hacks ----------------------------- + +# Pd-0.39.2-extended hacks to make font/box sizes the same across platform +# puts stderr "tk scaling is [tk scaling]" +# tk scaling 1 + +# this font is for the Pd Window console text +font create console_font -family $defaultFontFamily -size -12 \ + -weight $defaultFontWeight +# this font is for text in Pd windows +font create text_font -family {Times} -size -14 -weight normal +# for text in Properties Panels and other panes +font create highlight_font -family $defaultFontFamily -size -14 -weight bold + +# end Pd-extended font hacks ----------------------------- + + # Tearoff is set to true by default: set pd_tearoff 1 @@ -44,11 +67,7 @@ if {$pd_nt == 1} { if {$pd_nt == 2} { # turn on James Tittle II's fast drawing set tk::mac::useCGDrawing 1 - # set minimum line size for anti-aliasing. If set to 1 or 0, then every - # line will be anti-aliased. While this makes connections and circles in - # [bng] and such look really good, it makes boxes and messages look out of - # focus. Setting this to 2 makes it so the thick audio rate connections - # are anti-aliased. <hans@at.or.at> 2005-06-09 +# anti-alias all lines that need it set tk::mac::CGAntialiasLimit 2 global pd_guidir global pd_tearoff @@ -132,6 +151,15 @@ if {$pd_nt != 2} { .mbar add cascade -label "Help" -menu .mbar.help } +# fix menu font size on Windows with tk scaling = 1 +if {$pd_nt == 1} { + .mbar.file configure -font menuFont + .mbar.find configure -font menuFont + .mbar.windows configure -font menuFont + .mbar.audio configure -font menuFont + .mbar.help configure -font menuFont +} + set ctrls_audio_on 0 set ctrls_meter_on 0 set ctrls_inlevel 0 @@ -140,15 +168,14 @@ set ctrls_outlevel 0 frame .controls.switches checkbutton .controls.switches.audiobutton -text {compute audio} \ -variable ctrls_audio_on \ - -anchor w \ -command {pd [concat pd dsp $ctrls_audio_on \;]} checkbutton .controls.switches.meterbutton -text {peak meters} \ -variable ctrls_meter_on \ - -anchor w \ -command {pd [concat pd meters $ctrls_meter_on \;]} -pack .controls.switches.audiobutton .controls.switches.meterbutton -side top +pack .controls.switches.audiobutton .controls.switches.meterbutton \ + -side top -anchor w frame .controls.inout frame .controls.inout.in @@ -175,7 +202,7 @@ pack .controls.dio -side right -padx 20 frame .printout -text .printout.text -relief raised -bd 2 -font -*-courier-bold--normal--12-* \ +text .printout.text -relief raised -bd 2 -font console_font \ -yscrollcommand ".printout.scroll set" -width 80 # .printout.text insert end "\n\n\n\n\n\n\n\n\n\n" scrollbar .printout.scroll -command ".printout.text yview" @@ -365,7 +392,7 @@ proc menu_opentext {filename} { global pd_myversion set name [format ".help%d" $doc_number] toplevel $name - text $name.text -relief raised -bd 2 -font -*-times-regular--normal--14-* \ + text $name.text -relief raised -bd 2 -font text_font \ -yscrollcommand "$name.scroll set" -background white scrollbar $name.scroll -command "$name.text yview" pack $name.scroll -side right -fill y @@ -387,9 +414,16 @@ proc menu_openhtml {filename} { global pd_nt if {$pd_nt == 0} { - exec sh -c \ - [format "firefox file:%s || mozilla file:%s " \ - $filename $filename] & + foreach candidate \ + { gnome-open xdg-open sensible-browser iceweasel firefox mozilla \ + galeon konqueror netscape lynx } { + set browser [lindex [auto_execok $candidate] 0] + if {[string length $browser]} { + puts stderr [format "%s %s" $browser $filename] + exec -- sh -c [format "%s %s" $browser $filename] & + break + } + } } elseif {$pd_nt == 2} { puts stderr [format "open %s" $filename] exec sh -c [format "open %s" $filename] @@ -1143,6 +1177,18 @@ proc pdtk_canvas_new {name width height geometry editable} { $name.popup add command -label {Help} \ -command [concat popup_action $name 2] +# fix menu font size on Windows with tk scaling = 1 +if {$pd_nt == 1} { + $name.m.file configure -font menuFont + $name.m.edit configure -font menuFont + $name.m.find configure -font menuFont + $name.m.put configure -font menuFont + $name.m.windows configure -font menuFont + $name.m.audio configure -font menuFont + $name.m.help configure -font menuFont + $name.popup configure -font menuFont +} + # WM protocol wm protocol $name WM_DELETE_WINDOW [concat menu_close $name] @@ -1162,6 +1208,7 @@ proc pdtk_canvas_new {name width height geometry editable} { bind $name.c <Option-Button> {pdtk_canvas_click %W %x %y %b 4} bind $name.c <Option-Shift-Button> {pdtk_canvas_click %W %x %y %b 5} bind $name.c <Option-Control-Button> {pdtk_canvas_click %W %x %y %b 6} + bind $name.c <Mod1-Button> {pdtk_canvas_click %W %x %y %b 6} bind $name.c <Option-Control-Shift-Button> \ {pdtk_canvas_click %W %x %y %b 7} } else { @@ -1267,6 +1314,7 @@ proc pdtk_array_listview_new {id arrayName page} { global pd_nt global pd_array_listview_page global pd_array_listview_id + global fontname fontweight set pd_array_listview_page($arrayName) $page set pd_array_listview_id($arrayName) $id set windowName [format ".%sArrayWindow" $arrayName] @@ -1280,8 +1328,7 @@ proc pdtk_array_listview_new {id arrayName page} { set $windowName.lb [listbox $windowName.lb -height 20 -width 25\ -selectmode extended \ -relief solid -background white -borderwidth 1 \ - -font [format -*-courier-bold--normal--%d-* \ - $font] \ + -font [format {{%s} %d %s} $fontname $font $fontweight]\ -yscrollcommand "$windowName.lb.sb set"] set $windowName.lb.sb [scrollbar $windowName.lb.sb \ -command "$windowName.lb yview" -orient vertical] @@ -1385,9 +1432,7 @@ proc pdtk_array_listview_paste {arrayName} { proc pdtk_array_listview_edit {arrayName page font} { global pd_array_listview_entry global pd_nt - if {$pd_nt == 0} { - set font [expr $font - 2] - } + global fontname fontweight set lbName [format ".%sArrayWindow.lb" $arrayName] if {[winfo exists $lbName.entry]} { pdtk_array_listview_update_entry \ @@ -1399,7 +1444,7 @@ proc pdtk_array_listview_edit {arrayName page font} { set bbox [$lbName bbox $itemNum] set y [expr [lindex $bbox 1] - 4] set $lbName.entry [entry $lbName.entry \ - -font [format -*-courier-bold--normal--%d-* $font]] + -font [format {{%s} %d %s} $fontname $font $fontweight]] $lbName.entry insert 0 [] place configure $lbName.entry -relx 0 -y $y -relwidth 1 lower $lbName.entry @@ -1875,6 +1920,8 @@ proc pdtk_gatom_dialog {id initwidth initlo inithi \ set vid [string trimleft $id .] + global pd_nt + set var_gatomwidth [concat gatomwidth_$vid] global $var_gatomwidth set var_gatomlo [concat gatomlo_$vid] @@ -1899,87 +1946,96 @@ proc pdtk_gatom_dialog {id initwidth initlo inithi \ set $var_gatomsymto [gatom_unescape $symto] toplevel $id - wm title $id {Atom} + wm title $id "atom box properties" + wm resizable $id 0 0 wm protocol $id WM_DELETE_WINDOW [concat dogatom_cancel $id] - frame $id.buttonframe - pack $id.buttonframe -side bottom -fill x -pady 2m + frame $id.params -height 7 + pack $id.params -side top + label $id.params.entryname -text "width" + entry $id.params.entry -textvariable $var_gatomwidth -width 4 + pack $id.params.entryname $id.params.entry -side left + + labelframe $id.limits -text "limits" -padx 15 -pady 4 -borderwidth 1 \ + -font highlight_font + pack $id.limits -side top -fill x + frame $id.limits.lower + pack $id.limits.lower -side left + label $id.limits.lower.entryname -text "lower" + entry $id.limits.lower.entry -textvariable $var_gatomlo -width 8 + pack $id.limits.lower.entryname $id.limits.lower.entry -side left + frame $id.limits.upper + pack $id.limits.upper -side left + frame $id.limits.upper.spacer -width 20 + label $id.limits.upper.entryname -text "upper" + entry $id.limits.upper.entry -textvariable $var_gatomhi -width 8 + pack $id.limits.upper.spacer $id.limits.upper.entryname \ + $id.limits.upper.entry -side left + + frame $id.spacer1 -height 7 + pack $id.spacer1 -side top + + labelframe $id.label -text "label" -padx 5 -pady 4 -borderwidth 1 \ + -font highlight_font + pack $id.label -side top -fill x + frame $id.label.name + pack $id.label.name -side top + entry $id.label.name.entry -textvariable $var_gatomlabel -width 33 + pack $id.label.name.entry -side left + frame $id.label.radio + pack $id.label.radio -side top + radiobutton $id.label.radio.left -value 0 \ + -variable $var_gatomwherelabel \ + -text "left " -justify left + radiobutton $id.label.radio.right -value 1 \ + -variable $var_gatomwherelabel \ + -text "right" -justify left + radiobutton $id.label.radio.top -value 2 \ + -variable $var_gatomwherelabel \ + -text "top" -justify left + radiobutton $id.label.radio.bottom -value 3 \ + -variable $var_gatomwherelabel \ + -text "bottom" -justify left + pack $id.label.radio.left -side left -anchor w + pack $id.label.radio.right -side right -anchor w + pack $id.label.radio.top -side top -anchor w + pack $id.label.radio.bottom -side bottom -anchor w + + frame $id.spacer2 -height 7 + pack $id.spacer2 -side top + + labelframe $id.s_r -text "messages" -padx 5 -pady 4 -borderwidth 1 \ + -font highlight_font + pack $id.s_r -side top -fill x + frame $id.s_r.paramsymto + pack $id.s_r.paramsymto -side top -anchor e + label $id.s_r.paramsymto.entryname -text "send symbol" + entry $id.s_r.paramsymto.entry -textvariable $var_gatomsymto -width 21 + pack $id.s_r.paramsymto.entry $id.s_r.paramsymto.entryname -side right + + frame $id.s_r.paramsymfrom + pack $id.s_r.paramsymfrom -side top -anchor e + label $id.s_r.paramsymfrom.entryname -text "receive symbol" + entry $id.s_r.paramsymfrom.entry -textvariable $var_gatomsymfrom -width 21 + pack $id.s_r.paramsymfrom.entry $id.s_r.paramsymfrom.entryname -side right + + frame $id.buttonframe -pady 5 + pack $id.buttonframe -side top -fill x -pady 2m button $id.buttonframe.cancel -text {Cancel}\ -command "dogatom_cancel $id" + pack $id.buttonframe.cancel -side left -expand 1 button $id.buttonframe.apply -text {Apply}\ -command "dogatom_apply $id" + pack $id.buttonframe.apply -side left -expand 1 button $id.buttonframe.ok -text {OK}\ -command "dogatom_ok $id" - pack $id.buttonframe.cancel -side left -expand 1 - pack $id.buttonframe.apply -side left -expand 1 pack $id.buttonframe.ok -side left -expand 1 - frame $id.paramsymto - pack $id.paramsymto -side bottom - label $id.paramsymto.entryname -text {send symbol} - entry $id.paramsymto.entry -textvariable $var_gatomsymto -width 20 - pack $id.paramsymto.entryname $id.paramsymto.entry -side left - - frame $id.paramsymfrom - pack $id.paramsymfrom -side bottom - label $id.paramsymfrom.entryname -text {receive symbol} - entry $id.paramsymfrom.entry -textvariable $var_gatomsymfrom -width 20 - pack $id.paramsymfrom.entryname $id.paramsymfrom.entry -side left - - frame $id.radio - pack $id.radio -side bottom - label $id.radio.label -text {show label on:} - frame $id.radio.l - frame $id.radio.r - pack $id.radio.label -side top - pack $id.radio.l $id.radio.r -side left - radiobutton $id.radio.l.radio0 -value 0 \ - -variable $var_gatomwherelabel \ - -text "left" - radiobutton $id.radio.l.radio1 -value 1 \ - -variable $var_gatomwherelabel \ - -text "right" - radiobutton $id.radio.r.radio2 -value 2 \ - -variable $var_gatomwherelabel \ - -text "top" - radiobutton $id.radio.r.radio3 -value 3 \ - -variable $var_gatomwherelabel \ - -text "bottom" - pack $id.radio.l.radio0 $id.radio.l.radio1 -side top -anchor w - pack $id.radio.r.radio2 $id.radio.r.radio3 -side top -anchor w - - - frame $id.paramlabel - pack $id.paramlabel -side bottom - label $id.paramlabel.entryname -text label - entry $id.paramlabel.entry -textvariable $var_gatomlabel -width 20 - pack $id.paramlabel.entryname $id.paramlabel.entry -side left - - frame $id.paramhi - pack $id.paramhi -side bottom - label $id.paramhi.entryname -text "upper limit" - entry $id.paramhi.entry -textvariable $var_gatomhi -width 8 - pack $id.paramhi.entryname $id.paramhi.entry -side left - - frame $id.paramlo - pack $id.paramlo -side bottom - label $id.paramlo.entryname -text "lower limit" - entry $id.paramlo.entry -textvariable $var_gatomlo -width 8 - pack $id.paramlo.entryname $id.paramlo.entry -side left - - frame $id.params - pack $id.params -side bottom - label $id.params.entryname -text width - entry $id.params.entry -textvariable $var_gatomwidth -width 4 - pack $id.params.entryname $id.params.entry -side left - - - - bind $id.paramhi.entry <KeyPress-Return> [concat dogatom_ok $id] - bind $id.paramlo.entry <KeyPress-Return> [concat dogatom_ok $id] + bind $id.limits.upper.entry <KeyPress-Return> [concat dogatom_ok $id] + bind $id.limits.lower.entry <KeyPress-Return> [concat dogatom_ok $id] bind $id.params.entry <KeyPress-Return> [concat dogatom_ok $id] - pdtk_standardkeybindings $id.paramhi.entry - pdtk_standardkeybindings $id.paramlo.entry + pdtk_standardkeybindings $id.limits.upper.entry + pdtk_standardkeybindings $id.limits.lower.entry pdtk_standardkeybindings $id.params.entry $id.params.entry select from 0 $id.params.entry select adjust end @@ -2132,7 +2188,7 @@ proc iemgui_clip_fontsize {id} { if {[eval concat $$var_iemgui_gn_fs] < $iemgui_define_min_fontsize} { set $var_iemgui_gn_fs $iemgui_define_min_fontsize - $id.gnfs.fs_ent configure -textvariable $var_iemgui_gn_fs + $id.label.fs_ent configure -textvariable $var_iemgui_gn_fs } } @@ -2146,20 +2202,20 @@ proc iemgui_set_col_example {id} { set var_iemgui_lcol [concat iemgui_lcol_$vid] global $var_iemgui_lcol - $id.col_example_choose.lb_bk configure \ + $id.colors.sections.lb_bk configure \ -background [format "#%6.6x" [eval concat $$var_iemgui_bcol]] \ -activebackground [format "#%6.6x" [eval concat $$var_iemgui_bcol]] \ -foreground [format "#%6.6x" [eval concat $$var_iemgui_lcol]] \ -activeforeground [format "#%6.6x" [eval concat $$var_iemgui_lcol]] if { [eval concat $$var_iemgui_fcol] >= 0 } { - $id.col_example_choose.fr_bk configure \ + $id.colors.sections.fr_bk configure \ -background [format "#%6.6x" [eval concat $$var_iemgui_bcol]] \ -activebackground [format "#%6.6x" [eval concat $$var_iemgui_bcol]] \ -foreground [format "#%6.6x" [eval concat $$var_iemgui_fcol]] \ -activeforeground [format "#%6.6x" [eval concat $$var_iemgui_fcol]] } else { - $id.col_example_choose.fr_bk configure \ + $id.colors.sections.fr_bk configure \ -background [format "#%6.6x" [eval concat $$var_iemgui_bcol]] \ -activebackground [format "#%6.6x" [eval concat $$var_iemgui_bcol]] \ -foreground [format "#%6.6x" [eval concat $$var_iemgui_bcol]] \ @@ -2243,17 +2299,27 @@ proc iemgui_lilo {id} { } } -proc iemgui_toggle_font {id} { +proc iemgui_toggle_font {id gn_f} { set vid [string trimleft $id .] set var_iemgui_gn_f [concat iemgui_gn_f_$vid] global $var_iemgui_gn_f + global fontname fontweight - set $var_iemgui_gn_f [expr [eval concat $$var_iemgui_gn_f] + 1] - if {[eval concat $$var_iemgui_gn_f] > 2} {set $var_iemgui_gn_f 0} - if {[eval concat $$var_iemgui_gn_f] == 0} {$id.gnfs.fb configure -text "courier" -font {courier 10 bold}} - if {[eval concat $$var_iemgui_gn_f] == 1} {$id.gnfs.fb configure -text "helvetica" -font {helvetica 10 bold}} - if {[eval concat $$var_iemgui_gn_f] == 2} {$id.gnfs.fb configure -text "times" -font {times 10 bold}} + set $var_iemgui_gn_f $gn_f + + switch -- $gn_f { + 0 { set current_font $fontname} + 1 { set current_font "Helvetica" } + 2 { set current_font "Times" } + } + set current_font_spec "{$current_font} 12 $fontweight" + + $id.label.fontpopup_label configure -text $current_font \ + -font $current_font_spec + $id.label.name_entry configure -font $current_font_spec + $id.colors.sections.fr_bk configure -font $current_font_spec + $id.colors.sections.lb_bk configure -font $current_font_spec } proc iemgui_lb {id} { @@ -2399,6 +2465,9 @@ proc pdtk_iemgui_dialog {id mainheader \ set vid [string trimleft $id .] + global pd_nt + global fontname fontweight + set var_iemgui_wdt [concat iemgui_wdt_$vid] global $var_iemgui_wdt set var_iemgui_min_wdt [concat iemgui_min_wdt_$vid] @@ -2486,7 +2555,8 @@ proc pdtk_iemgui_dialog {id mainheader \ set $var_iemgui_l2_f1_b0 0 toplevel $id - wm title $id [format "%s-PROPERTIES" $mainheader] + wm title $id [format "%s Properties" $mainheader] + wm resizable $id 0 0 wm protocol $id WM_DELETE_WINDOW [concat iemgui_cancel $id] frame $id.dim @@ -2519,7 +2589,7 @@ proc pdtk_iemgui_dialog {id mainheader \ $id.rng.max_lab $id.rng.max_ent -side left} } if { [eval concat $$var_iemgui_lin0_log1] >= 0 || [eval concat $$var_iemgui_loadbang] >= 0 || [eval concat $$var_iemgui_num] > 0 || [eval concat $$var_iemgui_steady] >= 0 } { - label $id.space1 -text "---------------------------------" + label $id.space1 -text "" pack $id.space1 -side top } frame $id.para @@ -2548,157 +2618,189 @@ proc pdtk_iemgui_dialog {id mainheader \ pack $id.para.dummy3 $id.para.num_lab $id.para.num_ent -side left -expand 1} if {[eval concat $$var_iemgui_steady] >= 0} { pack $id.para.dummy3 $id.para.stdy_jmp -side left -expand 1} - if { $snd != "nosndno" || $rcv != "norcvno" } { - label $id.space2 -text "---------------------------------" - pack $id.space2 -side top } + + frame $id.spacer0 -height 4 + pack $id.spacer0 -side top - frame $id.snd - pack $id.snd -side top - label $id.snd.dummy1 -text "" -width 2 - label $id.snd.lab -text "send-symbol:" -width 12 - entry $id.snd.ent -textvariable $var_iemgui_snd -width 20 + labelframe $id.s_r -borderwidth 1 -pady 4 -text "messages" \ + -font highlight_font + pack $id.s_r -side top -fill x -ipadx 5 + frame $id.s_r.send + pack $id.s_r.send -side top + label $id.s_r.send.lab -text " send-symbol:" -width 12 -justify right + entry $id.s_r.send.ent -textvariable $var_iemgui_snd -width 22 if { $snd != "nosndno" } { - pack $id.snd.dummy1 $id.snd.lab $id.snd.ent -side left} + pack $id.s_r.send.lab $id.s_r.send.ent -side left} - frame $id.rcv - pack $id.rcv -side top - label $id.rcv.lab -text "receive-symbol:" -width 15 - entry $id.rcv.ent -textvariable $var_iemgui_rcv -width 20 + frame $id.s_r.receive + pack $id.s_r.receive -side top + label $id.s_r.receive.lab -text "receive-symbol:" -width 12 -justify right + entry $id.s_r.receive.ent -textvariable $var_iemgui_rcv -width 22 if { $rcv != "norcvno" } { - pack $id.rcv.lab $id.rcv.ent -side left} + pack $id.s_r.receive.lab $id.s_r.receive.ent -side left} - frame $id.gnam - pack $id.gnam -side top - label $id.gnam.head -text "--------------label:---------------" - label $id.gnam.dummy1 -text "" -width 1 - label $id.gnam.lab -text "name:" -width 6 - entry $id.gnam.ent -textvariable $var_iemgui_gui_nam -width 29 - label $id.gnam.dummy2 -text "" -width 1 - pack $id.gnam.head -side top - pack $id.gnam.dummy1 $id.gnam.lab $id.gnam.ent $id.gnam.dummy2 -side left +# get the current font name from the int given from C-space (gn_f) + set current_font $fontname + if {[eval concat $$var_iemgui_gn_f] == 1} \ + { set current_font "Helvetica" } + if {[eval concat $$var_iemgui_gn_f] == 2} \ + { set current_font "Times" } + + frame $id.spacer1 -height 7 + pack $id.spacer1 -side top - frame $id.gnxy - pack $id.gnxy -side top - label $id.gnxy.x_lab -text "x_off:" -width 6 - entry $id.gnxy.x_ent -textvariable $var_iemgui_gn_dx -width 5 - label $id.gnxy.dummy1 -text " " -width 10 - label $id.gnxy.y_lab -text "y_off:" -width 6 - entry $id.gnxy.y_ent -textvariable $var_iemgui_gn_dy -width 5 - pack $id.gnxy.x_lab $id.gnxy.x_ent $id.gnxy.dummy1 \ - $id.gnxy.y_lab $id.gnxy.y_ent -side left + labelframe $id.label -borderwidth 1 -text "label" -pady 4 \ + -font highlight_font + pack $id.label -side top -fill x + entry $id.label.name_entry -textvariable $var_iemgui_gui_nam -width 30 \ + -font [list $current_font 12 $fontweight] + pack $id.label.name_entry -side top -expand yes -fill both -padx 5 - frame $id.gnfs - pack $id.gnfs -side top - label $id.gnfs.f_lab -text "font:" -width 6 - if {[eval concat $$var_iemgui_gn_f] == 0} { - button $id.gnfs.fb -text "courier" -font {courier 10 bold} -width 7 -command "iemgui_toggle_font $id" } - if {[eval concat $$var_iemgui_gn_f] == 1} { - button $id.gnfs.fb -text "helvetica" -font {helvetica 10 bold} -width 7 -command "iemgui_toggle_font $id" } - if {[eval concat $$var_iemgui_gn_f] == 2} { - button $id.gnfs.fb -text "times" -font {times 10 bold} -width 7 -command "iemgui_toggle_font $id" } - label $id.gnfs.dummy1 -text "" -width 1 - label $id.gnfs.fs_lab -text "fontsize:" -width 8 - entry $id.gnfs.fs_ent -textvariable $var_iemgui_gn_fs -width 5 - pack $id.gnfs.f_lab $id.gnfs.fb $id.gnfs.dummy1 \ - $id.gnfs.fs_lab $id.gnfs.fs_ent -side left + frame $id.label.xy -padx 27 -pady 1 + pack $id.label.xy -side top + label $id.label.xy.x_lab -text "x offset" -width 6 + entry $id.label.xy.x_entry -textvariable $var_iemgui_gn_dx -width 5 + label $id.label.xy.dummy1 -text " " -width 2 + label $id.label.xy.y_lab -text "y offset" -width 6 + entry $id.label.xy.y_entry -textvariable $var_iemgui_gn_dy -width 5 + pack $id.label.xy.x_lab $id.label.xy.x_entry $id.label.xy.dummy1 \ + $id.label.xy.y_lab $id.label.xy.y_entry -side left -anchor e - label $id.col_head -text "--------------colors:--------------" - pack $id.col_head -side top + label $id.label.fontpopup_label -text $current_font \ + -relief groove -font [list $current_font 12 $fontweight] -padx 5 + pack $id.label.fontpopup_label -side left -anchor w -expand yes -fill x + label $id.label.fontsize_label -text "size" -width 4 + entry $id.label.fontsize_entry -textvariable $var_iemgui_gn_fs -width 5 + pack $id.label.fontsize_entry $id.label.fontsize_label \ + -side right -anchor e -padx 5 -pady 5 + menu $id.popup + $id.popup add command \ + -label $fontname \ + -font [format {{%s} 12 %s} $fontname $fontweight] \ + -command "iemgui_toggle_font $id 0" + $id.popup add command \ + -label "Helvetica" \ + -font [format {Helvetica 12 %s} $fontweight] \ + -command "iemgui_toggle_font $id 1" + $id.popup add command \ + -label "Times" \ + -font [format {Times 12 %s} $fontweight] \ + -command "iemgui_toggle_font $id 2" + bind $id.label.fontpopup_label <Button> \ + [list tk_popup $id.popup %X %Y] + + frame $id.spacer2 -height 7 + pack $id.spacer2 -side top - frame $id.col_select - pack $id.col_select -side top - radiobutton $id.col_select.radio0 -value 0 -variable $var_iemgui_l2_f1_b0 \ - -text "backgd" -width 5 - radiobutton $id.col_select.radio1 -value 1 -variable $var_iemgui_l2_f1_b0 \ - -text "front" -width 5 - radiobutton $id.col_select.radio2 -value 2 -variable $var_iemgui_l2_f1_b0 \ - -text "label" -width 5 + labelframe $id.colors -borderwidth 1 -text "colors" -font highlight_font + pack $id.colors -fill x -ipadx 5 -ipady 4 + + frame $id.colors.select + pack $id.colors.select -side top + radiobutton $id.colors.select.radio0 -value 0 -variable \ + $var_iemgui_l2_f1_b0 -text "background" -width 10 -justify left + radiobutton $id.colors.select.radio1 -value 1 -variable \ + $var_iemgui_l2_f1_b0 -text "front" -width 5 -justify left + radiobutton $id.colors.select.radio2 -value 2 -variable \ + $var_iemgui_l2_f1_b0 -text "label" -width 5 -justify left if { [eval concat $$var_iemgui_fcol] >= 0 } { - pack $id.col_select.radio0 $id.col_select.radio1 $id.col_select.radio2 -side left - } else {pack $id.col_select.radio0 $id.col_select.radio2 -side left} + pack $id.colors.select.radio0 $id.colors.select.radio1 \ + $id.colors.select.radio2 -side left + } else { + pack $id.colors.select.radio0 $id.colors.select.radio2 -side left \ + } - frame $id.col_example_choose - pack $id.col_example_choose -side top - button $id.col_example_choose.but -text "compose color" -width 10 \ + frame $id.colors.sections + pack $id.colors.sections -side top + button $id.colors.sections.but -text "compose color" -width 12 \ -command "iemgui_choose_col_bkfrlb $id" - label $id.col_example_choose.dummy1 -text "" -width 1 + pack $id.colors.sections.but -side left -anchor w -padx 10 -pady 5 \ + -expand yes -fill x if { [eval concat $$var_iemgui_fcol] >= 0 } { - button $id.col_example_choose.fr_bk -text "o=||=o" -width 5 \ + label $id.colors.sections.fr_bk -text "o=||=o" -width 6 \ -background [format "#%6.6x" [eval concat $$var_iemgui_bcol]] \ -activebackground [format "#%6.6x" [eval concat $$var_iemgui_bcol]] \ -foreground [format "#%6.6x" [eval concat $$var_iemgui_fcol]] \ - -activeforeground [format "#%6.6x" [eval concat $$var_iemgui_fcol]] -pady 2 + -activeforeground [format "#%6.6x" [eval concat $$var_iemgui_fcol]] \ + -font [list $current_font 12 $fontweight] -padx 2 -pady 2 -relief ridge } else { - button $id.col_example_choose.fr_bk -text "o=||=o" -width 5 \ + label $id.colors.sections.fr_bk -text "o=||=o" -width 6 \ -background [format "#%6.6x" [eval concat $$var_iemgui_bcol]] \ -activebackground [format "#%6.6x" [eval concat $$var_iemgui_bcol]] \ -foreground [format "#%6.6x" [eval concat $$var_iemgui_bcol]] \ - -activeforeground [format "#%6.6x" [eval concat $$var_iemgui_bcol]] -pady 2} - button $id.col_example_choose.lb_bk -text "testlabel" -width 7 \ + -activeforeground [format "#%6.6x" [eval concat $$var_iemgui_bcol]] \ + -font [list $current_font 12 $fontweight] -padx 2 -pady 2 -relief ridge + } + label $id.colors.sections.lb_bk -text "testlabel" -width 9 \ -background [format "#%6.6x" [eval concat $$var_iemgui_bcol]] \ -activebackground [format "#%6.6x" [eval concat $$var_iemgui_bcol]] \ -foreground [format "#%6.6x" [eval concat $$var_iemgui_lcol]] \ - -activeforeground [format "#%6.6x" [eval concat $$var_iemgui_lcol]] -pady 2 - - pack $id.col_example_choose.but $id.col_example_choose.dummy1 \ - $id.col_example_choose.fr_bk $id.col_example_choose.lb_bk -side left - - label $id.space3 -text "------or click color preset:-------" - pack $id.space3 -side top - - frame $id.bcol - pack $id.bcol -side top - foreach i { 0 1 2 3 4 5 6 7 8 9 } hexcol { 16579836 14737632 12369084 \ - 16572640 16572608 16579784 14220504 14220540 14476540 16308476 } { - button $id.bcol.c$i -background [format "#%6.6x" $hexcol] \ - -activebackground [format "#%6.6x" $hexcol] \ - -font {courier 2 normal} -padx 7 -pady 6 \ - -command [format "iemgui_preset_col %s %d" $id $hexcol] } - pack $id.bcol.c0 $id.bcol.c1 $id.bcol.c2 $id.bcol.c3 $id.bcol.c4 \ - $id.bcol.c5 $id.bcol.c6 $id.bcol.c7 $id.bcol.c8 $id.bcol.c9 -side left - - frame $id.fcol - pack $id.fcol -side top - foreach i { 0 1 2 3 4 5 6 7 8 9 } hexcol { 10526880 8158332 6316128 \ - 16525352 16559172 15263784 1370132 2684148 3952892 16003312 } { - button $id.fcol.c$i -background [format "#%6.6x" $hexcol] \ - -activebackground [format "#%6.6x" $hexcol] \ - -font {courier 2 normal} -padx 7 -pady 6 \ - -command [format "iemgui_preset_col %s %d" $id $hexcol] } - pack $id.fcol.c0 $id.fcol.c1 $id.fcol.c2 $id.fcol.c3 $id.fcol.c4 \ - $id.fcol.c5 $id.fcol.c6 $id.fcol.c7 $id.fcol.c8 $id.fcol.c9 -side left - - frame $id.lcol - pack $id.lcol -side top - foreach i { 0 1 2 3 4 5 6 7 8 9 } hexcol { 4210752 2105376 0 \ - 9177096 5779456 7874580 2641940 17488 5256 5767248 } { - button $id.lcol.c$i -background [format "#%6.6x" $hexcol] \ - -activebackground [format "#%6.6x" $hexcol] \ - -font {courier 2 normal} -padx 7 -pady 6 \ - -command [format "iemgui_preset_col %s %d" $id $hexcol] } - pack $id.lcol.c0 $id.lcol.c1 $id.lcol.c2 $id.lcol.c3 $id.lcol.c4 \ - $id.lcol.c5 $id.lcol.c6 $id.lcol.c7 $id.lcol.c8 $id.lcol.c9 -side left + -activeforeground [format "#%6.6x" [eval concat $$var_iemgui_lcol]] \ + -font [list $current_font 12 $fontweight] -padx 2 -pady 2 -relief ridge + pack $id.colors.sections.lb_bk $id.colors.sections.fr_bk \ + -side right -anchor e -expand yes -fill both -pady 7 + +# color scheme by Mary Ann Benedetto http://piR2.org + frame $id.colors.r1 + pack $id.colors.r1 -side top + foreach i { 0 1 2 3 4 5 6 7 8 9} \ + hexcol { 0xFFFFFF 0xDFDFDF 0xBBBBBB 0xFFC7C6 0xFFE3C6 \ + 0xFEFFC6 0xC6FFC7 0xc6FEFF 0xC7C6FF 0xE3C6FF } \ + { + label $id.colors.r1.c$i -background [format "#%6.6x" $hexcol] \ + -activebackground [format "#%6.6x" $hexcol] -relief ridge \ + -padx 7 -pady 0 + bind $id.colors.r1.c$i <Button> [format "iemgui_preset_col %s %d" $id $hexcol] + } + pack $id.colors.r1.c0 $id.colors.r1.c1 $id.colors.r1.c2 $id.colors.r1.c3 \ + $id.colors.r1.c4 $id.colors.r1.c5 $id.colors.r1.c6 $id.colors.r1.c7 \ + $id.colors.r1.c8 $id.colors.r1.c9 -side left + frame $id.colors.r2 + pack $id.colors.r2 -side top + foreach i { 0 1 2 3 4 5 6 7 8 9 } \ + hexcol { 0x9F9F9F 0x7C7C7C 0x606060 0xFF0400 0xFF8300 \ + 0xFAFF00 0x00FF04 0x00FAFF 0x0400FF 0x9C00FF } \ + { + label $id.colors.r2.c$i -background [format "#%6.6x" $hexcol] \ + -activebackground [format "#%6.6x" $hexcol] -relief ridge \ + -padx 7 -pady 0 + bind $id.colors.r2.c$i <Button> \ + [format "iemgui_preset_col %s %d" $id $hexcol] + } + pack $id.colors.r2.c0 $id.colors.r2.c1 $id.colors.r2.c2 $id.colors.r2.c3 \ + $id.colors.r2.c4 $id.colors.r2.c5 $id.colors.r2.c6 $id.colors.r2.c7 \ + $id.colors.r2.c8 $id.colors.r2.c9 -side left - label $id.space4 -text "---------------------------------" - pack $id.space4 -side top + frame $id.colors.r3 + pack $id.colors.r3 -side top + foreach i { 0 1 2 3 4 5 6 7 8 9 } \ + hexcol { 0x404040 0x202020 0x000000 0x551312 0x553512 \ + 0x535512 0x0F4710 0x0E4345 0x131255 0x2F004D } \ + { + label $id.colors.r3.c$i -background [format "#%6.6x" $hexcol] \ + -activebackground [format "#%6.6x" $hexcol] -relief ridge \ + -padx 7 -pady 0 + bind $id.colors.r3.c$i <Button> \ + [format "iemgui_preset_col %s %d" $id $hexcol] + } + pack $id.colors.r3.c0 $id.colors.r3.c1 $id.colors.r3.c2 $id.colors.r3.c3 \ + $id.colors.r3.c4 $id.colors.r3.c5 $id.colors.r3.c6 $id.colors.r3.c7 \ + $id.colors.r3.c8 $id.colors.r3.c9 -side left - frame $id.cao + frame $id.cao -pady 10 pack $id.cao -side top button $id.cao.cancel -text {Cancel} -width 6 \ -command "iemgui_cancel $id" label $id.cao.dummy1 -text "" -width 3 - button $id.cao.apply -text {Apply} -width 6 \ - -command "iemgui_apply $id" + button $id.cao.apply -text {Apply} -width 6 -command "iemgui_apply $id" label $id.cao.dummy2 -text "" -width 3 button $id.cao.ok -text {OK} -width 6 \ -command "iemgui_ok $id" - pack $id.cao.cancel $id.cao.dummy1 \ - $id.cao.apply $id.cao.dummy2 \ - $id.cao.ok -side left - label $id.space5 -text "" - pack $id.space5 -side top + pack $id.cao.cancel $id.cao.dummy1 -side left + pack $id.cao.apply $id.cao.dummy2 -side left + pack $id.cao.ok -side left if {[info tclversion] < 8.4} { bind $id <Key-Tab> {tkTabToWindow [tk_focusNext %W]} @@ -2713,24 +2815,24 @@ proc pdtk_iemgui_dialog {id mainheader \ bind $id.rng.min_ent <KeyPress-Return> [concat iemgui_ok $id] bind $id.rng.max_ent <KeyPress-Return> [concat iemgui_ok $id] bind $id.para.num_ent <KeyPress-Return> [concat iemgui_ok $id] - bind $id.snd.ent <KeyPress-Return> [concat iemgui_ok $id] - bind $id.rcv.ent <KeyPress-Return> [concat iemgui_ok $id] - bind $id.gnam.ent <KeyPress-Return> [concat iemgui_ok $id] - bind $id.gnxy.x_ent <KeyPress-Return> [concat iemgui_ok $id] - bind $id.gnxy.y_ent <KeyPress-Return> [concat iemgui_ok $id] - bind $id.gnfs.fs_ent <KeyPress-Return> [concat iemgui_ok $id] + bind $id.s_r.send.ent <KeyPress-Return> [concat iemgui_ok $id] + bind $id.s_r.receive.ent <KeyPress-Return> [concat iemgui_ok $id] + bind $id.label.name_entry <KeyPress-Return> [concat iemgui_ok $id] + bind $id.label.xy.x_entry <KeyPress-Return> [concat iemgui_ok $id] + bind $id.label.xy.y_entry <KeyPress-Return> [concat iemgui_ok $id] + bind $id.label.fontsize_entry <KeyPress-Return> [concat iemgui_ok $id] bind $id.cao.ok <KeyPress-Return> [concat iemgui_ok $id] pdtk_standardkeybindings $id.dim.w_ent pdtk_standardkeybindings $id.dim.h_ent pdtk_standardkeybindings $id.rng.min_ent pdtk_standardkeybindings $id.rng.max_ent pdtk_standardkeybindings $id.para.num_ent - pdtk_standardkeybindings $id.snd.ent - pdtk_standardkeybindings $id.rcv.ent - pdtk_standardkeybindings $id.gnam.ent - pdtk_standardkeybindings $id.gnxy.x_ent - pdtk_standardkeybindings $id.gnxy.y_ent - pdtk_standardkeybindings $id.gnfs.fs_ent + pdtk_standardkeybindings $id.s_r.send.ent + pdtk_standardkeybindings $id.s_r.receive.ent + pdtk_standardkeybindings $id.label.name_entry + pdtk_standardkeybindings $id.label.xy.x_entry + pdtk_standardkeybindings $id.label.xy.y_entry + pdtk_standardkeybindings $id.label.fontsize_entry pdtk_standardkeybindings $id.cao.ok $id.dim.w_ent select from 0 @@ -2771,7 +2873,7 @@ proc array_apply {id} { } # jsarlo -proc array_viewlist {id name page} { +proc array_viewlist {id} { pd [concat $id arrayviewlistnew\;] } # end jsarlo @@ -2808,6 +2910,7 @@ proc pdtk_array_dialog {id name n flags newone} { toplevel $id wm title $id {array} + wm resizable $id 0 0 wm protocol $id WM_DELETE_WINDOW [concat array_cancel $id] frame $id.name @@ -2860,7 +2963,7 @@ proc pdtk_array_dialog {id name n flags newone} { # jsarlo if {$newone == 0} { button $id.listview -text {View list}\ - -command "array_viewlist $id $name 0" + -command "array_viewlist $id" pack $id.listview -side left } # end jsarlo @@ -3265,18 +3368,22 @@ proc pdtk_pd_ctrlkey {name key shift} { # seven "useful" font sizes. # tb: user defined typefaces -proc pdtk_pd_startup {version apilist midiapilist fontname} { +proc pdtk_pd_startup {version apilist midiapilist fontname_from_pd \ + fontweight_from_pd} { # puts stderr [concat $version $apilist $fontname] - global pd_myversion pd_apilist pd_midiapilist + global pd_myversion pd_apilist pd_midiapilist pd_nt set pd_myversion $version set pd_apilist $apilist set pd_midiapilist $midiapilist + global fontname fontweight + set fontname $fontname_from_pd + set fontweight $fontweight_from_pd global pd_fontlist set pd_fontlist {} set fontlist "" foreach i {8 9 10 12 14 16 18 24 30 36} { - set font [concat $fontname -$i bold] + set font [format {{%s} %d %s} $fontname_from_pd -$i $fontweight_from_pd] set pd_fontlist [linsert $pd_fontlist 100000 $font] set width0 [font measure $font x] set height0 [lindex [font metrics $font] 5] @@ -3523,8 +3630,12 @@ proc audio_popup_action {buttonname varname devlist index} { # create a popup menu proc audio_popup {name buttonname varname devlist} { + global pd_nt if [winfo exists $name.popup] {destroy $name.popup} menu $name.popup -tearoff false + if {$pd_nt == 1} { + $name.popup configure -font menuFont + } # puts stderr [concat $devlist ] for {set x 0} {$x<[llength $devlist]} {incr x} { $name.popup add command -label [lindex $devlist $x] \ @@ -3805,8 +3916,12 @@ proc midi_popup_action {buttonname varname devlist index} { # create a popup menu proc midi_popup {name buttonname varname devlist} { + global pd_nt if [winfo exists $name.popup] {destroy $name.popup} menu $name.popup -tearoff false + if {$pd_nt == 1} { + $name.popup configure -font menuFont + } # puts stderr [concat $devlist ] for {set x 0} {$x<[llength $devlist]} {incr x} { $name.popup add command -label [lindex $devlist $x] \ @@ -4101,15 +4216,16 @@ proc pdtk_alsa_midi_dialog {id indev1 indev2 indev3 indev4 \ proc path_apply {id} { global pd_extrapath pd_verbose - global pd_path0 pd_path1 pd_path2 pd_path3 pd_path4 - global pd_path5 pd_path6 pd_path7 pd_path8 pd_path9 + global pd_path_count + set pd_path {} - pd [concat pd path-dialog $pd_extrapath $pd_verbose \ - [pdtk_encodedialog $pd_path0] [pdtk_encodedialog $pd_path1] \ - [pdtk_encodedialog $pd_path2] [pdtk_encodedialog $pd_path3] \ - [pdtk_encodedialog $pd_path4] [pdtk_encodedialog $pd_path5] \ - [pdtk_encodedialog $pd_path6] [pdtk_encodedialog $pd_path7] \ - [pdtk_encodedialog $pd_path8] [pdtk_encodedialog $pd_path9] \;] + for {set x 0} {$x < $pd_path_count} {incr x} { + global pd_path$x + set this_path [set pd_path$x] + if {0==[string match "" $this_path]} {lappend pd_path [pdtk_encodedialog $this_path]} + } + + pd [concat pd path-dialog $pd_extrapath $pd_verbose $pd_path \;] } proc path_cancel {id} { @@ -4123,8 +4239,16 @@ proc path_ok {id} { proc pdtk_path_dialog {id extrapath verbose} { global pd_extrapath pd_verbose - global pd_path0 pd_path1 pd_path2 pd_path3 pd_path4 - global pd_path5 pd_path6 pd_path7 pd_path8 pd_path9 + global pd_path + global pd_path_count + + set pd_path_count [expr [llength $pd_path] + 2] + if { $pd_path_count < 10 } { set pd_path_count 10 } + + for {set x 0} {$x < $pd_path_count} {incr x} { + global pd_path$x + set pd_path$x [lindex $pd_path $x] + } set pd_extrapath $extrapath set pd_verbose $verbose @@ -4154,8 +4278,8 @@ proc pdtk_path_dialog {id extrapath verbose} { -command "path_apply $id \; pd pd save-preferences \\;" pack $id.extraframe.extra $id.extraframe.verbose $id.extraframe.save \ -side left -expand 1 - - for {set x 0} {$x < 10} {incr x} { + + for {set x 0} {$x < $pd_path_count} {incr x} { entry $id.f$x -textvariable pd_path$x -width 80 bind $id.f$x <KeyPress-Return> [concat path_ok $id] pdtk_standardkeybindings $id.f$x @@ -4174,16 +4298,16 @@ proc pd_set {var value} { proc startup_apply {id} { global pd_nort pd_flags - global pd_startup0 pd_startup1 pd_startup2 pd_startup3 pd_startup4 - global pd_startup5 pd_startup6 pd_startup7 pd_startup8 pd_startup9 + global pd_startup_count - pd [concat pd startup-dialog $pd_nort [pdtk_encodedialog $pd_flags] \ - [pdtk_encodedialog $pd_startup0] [pdtk_encodedialog $pd_startup1] \ - [pdtk_encodedialog $pd_startup2] [pdtk_encodedialog $pd_startup3] \ - [pdtk_encodedialog $pd_startup4] [pdtk_encodedialog $pd_startup5] \ - [pdtk_encodedialog $pd_startup6] [pdtk_encodedialog $pd_startup7] \ - [pdtk_encodedialog $pd_startup8] [pdtk_encodedialog $pd_startup9] \;] + set pd_startup {} + for {set x 0} {$x < $pd_startup_count} {incr x} { + global pd_startup$x + set this_startup [set pd_startup$x] + if {0==[string match "" $this_startup]} {lappend pd_startup [pdtk_encodedialog $this_startup]} + } + pd [concat pd startup-dialog $pd_nort [pdtk_encodedialog $pd_flags] $pd_startup \;] } proc startup_cancel {id} { @@ -4197,8 +4321,16 @@ proc startup_ok {id} { proc pdtk_startup_dialog {id nort flags} { global pd_nort pd_nt pd_flags - global pd_startup0 pd_startup1 pd_startup2 pd_startup3 pd_startup4 - global pd_startup5 pd_startup6 pd_startup7 pd_startup8 pd_startup9 + global pd_startup + global pd_startup_count + + set pd_startup_count [expr [llength $pd_startup] + 2] + if { $pd_startup_count < 10 } { set pd_startup_count 10 } + + for {set x 0} {$x < $pd_startup_count} {incr x} { + global pd_startup$x + set pd_startup$x [lindex $pd_startup $x] + } set pd_nort $nort set pd_flags $flags @@ -4240,7 +4372,9 @@ proc pdtk_startup_dialog {id nort flags} { pack $id.nortframe.save -side left -expand 1 } - for {set x 0} {$x < 10} {incr x} { + + + for {set x 0} {$x < $pd_startup_count} {incr x} { entry $id.f$x -textvariable pd_startup$x -width 80 bind $id.f$x <KeyPress-Return> [concat startup_ok $id] pdtk_standardkeybindings $id.f$x diff --git a/pd/src/x_acoustics.c b/pd/src/x_acoustics.c index eca2d32b..e07a4231 100644 --- a/pd/src/x_acoustics.c +++ b/pd/src/x_acoustics.c @@ -9,39 +9,39 @@ #include <math.h> #define LOGTEN 2.302585092994 -float mtof(float f) +t_float mtof(t_float f) { if (f <= -1500) return(0); else if (f > 1499) return(mtof(1499)); else return (8.17579891564 * exp(.0577622650 * f)); } -float ftom(float f) +t_float ftom(t_float f) { return (f > 0 ? 17.3123405046 * log(.12231220585 * f) : -1500); } -float powtodb(float f) +t_float powtodb(t_float f) { if (f <= 0) return (0); else { - float val = 100 + 10./LOGTEN * log(f); + t_float val = 100 + 10./LOGTEN * log(f); return (val < 0 ? 0 : val); } } -float rmstodb(float f) +t_float rmstodb(t_float f) { if (f <= 0) return (0); else { - float val = 100 + 20./LOGTEN * log(f); + t_float val = 100 + 20./LOGTEN * log(f); return (val < 0 ? 0 : val); } } -float dbtopow(float f) +t_float dbtopow(t_float f) { if (f <= 0) return(0); @@ -53,7 +53,7 @@ float dbtopow(float f) } } -float dbtorms(float f) +t_float dbtorms(t_float f) { if (f <= 0) return(0); diff --git a/pd/src/x_arithmetic.c b/pd/src/x_arithmetic.c index c55e3ea8..f64c8cbd 100644 --- a/pd/src/x_arithmetic.c +++ b/pd/src/x_arithmetic.c @@ -551,8 +551,8 @@ static void *tan_new(void) static void tan_float(t_object *x, t_float f) { - float c = cosf(f); - float t = (c == 0 ? 0 : sinf(f)/c); + t_float c = cosf(f); + t_float t = (c == 0 ? 0 : sinf(f)/c); outlet_float(x->ob_outlet, t); } @@ -575,7 +575,7 @@ static t_class *atan2_class; /* ----------- atan2 --------------- */ typedef struct _atan2 { t_object x_ob; - float x_f; + t_float x_f; } t_atan2; static void *atan2_new(void) @@ -589,7 +589,7 @@ static void *atan2_new(void) static void atan2_float(t_atan2 *x, t_float f) { - float r = (f == 0 && x->x_f == 0 ? 0 : atan2f(f, x->x_f)); + t_float r = (f == 0 && x->x_f == 0 ? 0 : atan2f(f, x->x_f)); outlet_float(x->x_ob.ob_outlet, r); } @@ -604,7 +604,7 @@ static void *sqrt_new(void) static void sqrt_float(t_object *x, t_float f) { - float r = (f > 0 ? sqrtf(f) : 0); + t_float r = (f > 0 ? sqrtf(f) : 0); outlet_float(x->ob_outlet, r); } @@ -619,7 +619,7 @@ static void *log_new(void) static void log_float(t_object *x, t_float f) { - float r = (f > 0 ? logf(f) : -1000); + t_float r = (f > 0 ? logf(f) : -1000); outlet_float(x->ob_outlet, r); } @@ -636,7 +636,7 @@ static void *exp_new(void) #define MAXLOG 87.3365 static void exp_float(t_object *x, t_float f) { - float g; + t_float g; #ifdef MSW char buf[10]; #endif @@ -666,9 +666,9 @@ static t_class *clip_class; typedef struct _clip { t_object x_ob; - float x_f1; - float x_f2; - float x_f3; + t_float x_f1; + t_float x_f2; + t_float x_f3; } t_clip; static void *clip_new(t_floatarg f1, t_floatarg f2) diff --git a/pd/src/x_connective.c b/pd/src/x_connective.c index 3b2bbba5..2f291f50 100644 --- a/pd/src/x_connective.c +++ b/pd/src/x_connective.c @@ -506,7 +506,7 @@ static void route_list(t_route *x, t_symbol *sel, int argc, t_atom *argv) int nelement; if (x->x_type == A_FLOAT) { - float f; + t_float f; if (!argc) return; f = atom_getfloat(argv); for (nelement = x->x_nelement, e = x->x_vec; nelement--; e++) @@ -1057,7 +1057,7 @@ static t_class *spigot_class; typedef struct _spigot { t_object x_obj; - float x_state; + t_float x_state; } t_spigot; static void *spigot_new(t_floatarg f) @@ -1118,7 +1118,7 @@ typedef struct _moses { t_object x_ob; t_outlet *x_out2; - float x_y; + t_float x_y; } t_moses; static void *moses_new(t_floatarg f) @@ -1174,6 +1174,8 @@ static void until_bang(t_until *x) static void until_float(t_until *x, t_float f) { + if (f < 0) + f = 0; x->x_run = 1; x->x_count = f; while (x->x_run && x->x_count) @@ -1202,34 +1204,86 @@ typedef struct _makefilename { t_object x_obj; t_symbol *x_format; + t_atomtype x_accept; + int x_intconvert; } t_makefilename; +static void makefilename_scanformat(t_makefilename *x) +{ + int num=0, infmt=0; + char *str,*chr; + if (!x->x_format) return; + x->x_accept = A_NULL; + for (str=x->x_format->s_name; *str; str++) { + if (!infmt && *str=='%') { + infmt=1; + continue; + } + if (infmt) { + if (strchr("-.#0123456789",*str)!=0) + continue; + if (*str=='s') { + x->x_accept = A_SYMBOL; + x->x_intconvert = 0; + break; + } + if (strchr("fgGeE",*str)!=0) { + x->x_accept = A_FLOAT; + x->x_intconvert = 0; + break; + } + if (strchr("xXdiou",*str)!=0) { + x->x_accept = A_FLOAT; + x->x_intconvert = 1; + break; + } + infmt=0; + } + } +} + static void *makefilename_new(t_symbol *s) { t_makefilename *x = (t_makefilename *)pd_new(makefilename_class); - if (!s->s_name) s = gensym("file.%d"); + if (!s || !s->s_name) s = gensym("file.%d"); outlet_new(&x->x_obj, &s_symbol); x->x_format = s; + x->x_accept = A_NULL; + x->x_intconvert = 0; + makefilename_scanformat(x); return (x); } static void makefilename_float(t_makefilename *x, t_floatarg f) { char buf[MAXPDSTRING]; + if (x->x_accept == A_FLOAT) { + if (x->x_intconvert) sprintf(buf, x->x_format->s_name, (int)f); + else + sprintf(buf, x->x_format->s_name, f); + } + else + sprintf(buf, x->x_format->s_name, ""); + if (buf[0]!=0) outlet_symbol(x->x_obj.ob_outlet, gensym(buf)); } static void makefilename_symbol(t_makefilename *x, t_symbol *s) { char buf[MAXPDSTRING]; + if (x->x_accept == A_SYMBOL) sprintf(buf, x->x_format->s_name, s->s_name); + else + sprintf(buf, x->x_format->s_name, 0); + if (buf[0]!=0) outlet_symbol(x->x_obj.ob_outlet, gensym(buf)); } static void makefilename_set(t_makefilename *x, t_symbol *s) { x->x_format = s; + makefilename_scanformat(x); } static void makefilename_setup(void) diff --git a/pd/src/x_list.c b/pd/src/x_list.c index 8156704a..bb21a8f5 100644 --- a/pd/src/x_list.c +++ b/pd/src/x_list.c @@ -484,13 +484,13 @@ static void *list_length_new( void) static void list_length_list(t_list_length *x, t_symbol *s, int argc, t_atom *argv) { - outlet_float(x->x_obj.ob_outlet, (float)argc); + outlet_float(x->x_obj.ob_outlet, (t_float)argc); } static void list_length_anything(t_list_length *x, t_symbol *s, int argc, t_atom *argv) { - outlet_float(x->x_obj.ob_outlet, (float)argc+1); + outlet_float(x->x_obj.ob_outlet, (t_float)argc+1); } static void list_length_setup(void) diff --git a/pd/src/x_midi.c b/pd/src/x_midi.c index 3e25cf4e..97058108 100644 --- a/pd/src/x_midi.c +++ b/pd/src/x_midi.c @@ -135,9 +135,9 @@ static void *notein_new(t_floatarg f) static void notein_list(t_notein *x, t_symbol *s, int argc, t_atom *argv) { - float pitch = atom_getfloatarg(0, argc, argv); - float velo = atom_getfloatarg(1, argc, argv); - float channel = atom_getfloatarg(2, argc, argv); + t_float pitch = atom_getfloatarg(0, argc, argv); + t_float velo = atom_getfloatarg(1, argc, argv); + t_float channel = atom_getfloatarg(2, argc, argv); if (x->x_channel != 0) { if (channel != x->x_channel) return; @@ -278,8 +278,8 @@ static void *pgmin_new(t_floatarg f) static void pgmin_list(t_pgmin *x, t_symbol *s, int argc, t_atom *argv) { - float value = atom_getfloatarg(0, argc, argv); - float channel = atom_getfloatarg(1, argc, argv); + t_float value = atom_getfloatarg(0, argc, argv); + t_float channel = atom_getfloatarg(1, argc, argv); if (x->x_channel != 0) { if (channel != x->x_channel) return; @@ -546,8 +546,8 @@ static void *midiclkin_new(t_floatarg f) static void midiclkin_list(t_midiclkin *x, t_symbol *s, int argc, t_atom *argv) { - float value = atom_getfloatarg(0, argc, argv); - float count = atom_getfloatarg(1, argc, argv); + t_float value = atom_getfloatarg(0, argc, argv); + t_float count = atom_getfloatarg(1, argc, argv); outlet_float(x->x_outlet2, count); outlet_float(x->x_outlet1, value); } @@ -570,9 +570,9 @@ static void midiclkin_setup(void) void inmidi_clk(double timing) { - static float prev = 0; - static float count = 0; - float cur,diff; + static t_float prev = 0; + static t_float count = 0; + t_float cur,diff; if (midiclkin_sym->s_thing) { @@ -621,8 +621,8 @@ static void *midirealtimein_new( void) static void midirealtimein_list(t_midirealtimein *x, t_symbol *s, int argc, t_atom *argv) { - float portno = atom_getfloatarg(0, argc, argv); - float byte = atom_getfloatarg(1, argc, argv); + t_float portno = atom_getfloatarg(0, argc, argv); + t_float byte = atom_getfloatarg(1, argc, argv); outlet_float(x->x_outlet2, portno); outlet_float(x->x_outlet1, byte); @@ -1068,7 +1068,7 @@ static t_class *poly_class; typedef struct voice { - float v_pitch; + t_float v_pitch; int v_used; unsigned long v_serial; } t_voice; @@ -1078,14 +1078,14 @@ typedef struct poly t_object x_obj; int x_n; t_voice *x_vec; - float x_vel; + t_float x_vel; t_outlet *x_pitchout; t_outlet *x_velout; unsigned long x_serial; int x_steal; } t_poly; -static void *poly_new(float fnvoice, float fsteal) +static void *poly_new(t_float fnvoice, t_float fsteal) { int i, n = fnvoice; t_poly *x = (t_poly *)pd_new(poly_class); diff --git a/pd/src/x_misc.c b/pd/src/x_misc.c index 0c894c72..8a67a5d1 100644 --- a/pd/src/x_misc.c +++ b/pd/src/x_misc.c @@ -70,7 +70,7 @@ static void random_bang(t_random *x) outlet_float(x->x_obj.ob_outlet, nval); } -static void random_seed(t_random *x, float f, float glob) +static void random_seed(t_random *x, t_float f, t_float glob) { x->x_state = f; } @@ -228,7 +228,7 @@ static void cputime_bang(t_cputime *x) static void cputime_bang2(t_cputime *x) { #ifdef UNISTD - float elapsedcpu; + t_float elapsedcpu; struct tms newcputime; times(&newcputime); elapsedcpu = 1000 * ( @@ -237,7 +237,7 @@ static void cputime_bang2(t_cputime *x) outlet_float(x->x_obj.ob_outlet, elapsedcpu); #endif #ifdef MSW - float elapsedcpu; + t_float elapsedcpu; FILETIME ignorethis, ignorethat; LARGE_INTEGER usertime, kerneltime; BOOL retval; diff --git a/pd/src/x_qlist.c b/pd/src/x_qlist.c index 271259a3..fe6df0f3 100644 --- a/pd/src/x_qlist.c +++ b/pd/src/x_qlist.c @@ -18,9 +18,9 @@ typedef struct _qlist void *x_binbuf; int x_onset; /* playback position */ t_clock *x_clock; - float x_tempo; + t_float x_tempo; double x_whenclockset; - float x_clockdelay; + t_float x_clockdelay; t_symbol *x_dir; t_canvas *x_canvas; int x_reentered; @@ -100,7 +100,8 @@ static void qlist_donext(t_qlist *x, int drop, int automatic) if (ap->a_type != A_SYMBOL) continue; else if (!(target = ap->a_w.w_symbol->s_thing)) { - error("qlist: %s: no such object", ap->a_w.w_symbol->s_name); + pd_error(x, "qlist: %s: no such object", + ap->a_w.w_symbol->s_name); continue; } ap++; @@ -180,10 +181,10 @@ static void qlist_read(t_qlist *x, t_symbol *filename, t_symbol *format) if (!strcmp(format->s_name, "cr")) cr = 1; else if (*format->s_name) - error("qlist_read: unknown flag: %s", format->s_name); + pd_error(x, "qlist_read: unknown flag: %s", format->s_name); if (binbuf_read_via_canvas(x->x_binbuf, filename->s_name, x->x_canvas, cr)) - error("%s: read failed", filename->s_name); + pd_error(x, "%s: read failed", filename->s_name); x->x_onset = 0x7fffffff; x->x_reentered = 1; } @@ -197,9 +198,9 @@ static void qlist_write(t_qlist *x, t_symbol *filename, t_symbol *format) if (!strcmp(format->s_name, "cr")) cr = 1; else if (*format->s_name) - error("qlist_read: unknown flag: %s", format->s_name); + pd_error(x, "qlist_read: unknown flag: %s", format->s_name); if (binbuf_write(x->x_binbuf, buf, "", cr)) - error("%s: write failed", filename->s_name); + pd_error(x, "%s: write failed", filename->s_name); } static void qlist_print(t_qlist *x) @@ -210,14 +211,14 @@ static void qlist_print(t_qlist *x) static void qlist_tempo(t_qlist *x, t_float f) { - float newtempo; + t_float newtempo; if (f < 1e-20) f = 1e-20; else if (f > 1e20) f = 1e20; newtempo = 1./f; if (x->x_whenclockset != 0) { - float elapsed = clock_gettimesince(x->x_whenclockset); - float left = x->x_clockdelay - elapsed; + t_float elapsed = clock_gettimesince(x->x_whenclockset); + t_float left = x->x_clockdelay - elapsed; if (left < 0) left = 0; left *= newtempo / x->x_tempo; clock_delay(x->x_clock, left); diff --git a/pd/src/x_time.c b/pd/src/x_time.c index 70285455..60dcf9a5 100644 --- a/pd/src/x_time.c +++ b/pd/src/x_time.c @@ -313,7 +313,7 @@ typedef struct _pipe t_object x_obj; int x_n; int x_nptr; - float x_deltime; + t_float x_deltime; t_pipeout *x_vec; t_gpointer *x_gp; t_hang *x_hang; @@ -327,7 +327,7 @@ static void *pipe_new(t_symbol *s, int argc, t_atom *argv) t_gpointer *gp; int nptr = 0; int i; - float deltime; + t_float deltime; if (argc) { if (argv[argc-1].a_type != A_FLOAT) |