diff --git a/Abstractions/Audio/gain2~.pd b/Abstractions/Audio/gain2~.pd index 8555b41ff..a4974789d 100644 --- a/Abstractions/Audio/gain2~.pd +++ b/Abstractions/Audio/gain2~.pd @@ -1,4 +1,4 @@ -#N canvas 524 122 490 434 10; +#N canvas 688 164 490 434 10; #X text 226 125 Alexandre Torres Porres (2016); #X text 224 144 Part of ELSE \; https://github.com/porres/pd-else; #X obj 33 321 outlet~; @@ -10,7 +10,7 @@ #X obj 157 101 cnv 1 10 1 empty empty empty 20 12 0 14 #e0e0e0 #404040 0; #X obj 151 198 cnv 1 24 1 empty empty empty 20 12 0 14 #e0e0e0 #404040 0; #N canvas 964 337 402 409 gain~ 0; -#X obj 37 336 outlet~; +#X obj 38 351 outlet~; #N canvas 930 375 329 221 max_gain 0; #X obj 46 35 inlet~; #X obj 46 171 outlet~; @@ -25,12 +25,12 @@ #X connect 4 0 3 0; #X connect 5 0 6 0; #X connect 6 0 2 1; -#X restore 196 237 pd max_gain; -#X obj 35 21 inlet~; -#X obj 37 292 *~; -#X obj 91 21 inlet~; -#X obj 91 292 *~; -#X obj 91 337 outlet~, f 9; +#X restore 219 252 pd max_gain; +#X obj 38 36 inlet~; +#X obj 38 307 *~; +#X obj 114 36 inlet~; +#X obj 114 307 *~; +#X obj 114 352 outlet~; #N canvas 417 80 357 354 quartic 0; #X obj 77 167 *~; #X obj 77 195 *~; @@ -64,7 +64,7 @@ #X connect 12 0 0 1; #X connect 13 0 6 0; #X connect 13 0 9 0; -#X restore 117 201 pd quartic; +#X restore 140 216 pd quartic; #N canvas 743 262 450 300 dB 0; #X obj 159 235 outlet~; #X obj 129 140 *~ 100; @@ -93,7 +93,7 @@ #X connect 10 0 8 0; #X connect 11 0 5 0; #X connect 12 0 1 0; -#X restore 196 201 pd dB; +#X restore 219 216 pd dB; #N canvas 417 214 450 300 linear 0; #X obj 137 241 outlet~; #X obj 236 54 r \$0-mode; @@ -118,18 +118,20 @@ #X connect 8 1 2 0; #X connect 9 0 0 0; #X connect 10 0 9 0; -#X restore 252 201 pd linear; -#X obj 196 89 receive \$0-slider; -#X obj 265 140 r \$0-ramp; -#X obj 196 139 pack f 20; -#X obj 207 114 s \$0-set-value_arg; -#X obj 196 164 line~; -#X obj 174 62 r \$0-slider-init; +#X restore 275 216 pd linear; +#X obj 219 104 receive \$0-slider; +#X obj 288 155 r \$0-ramp; +#X obj 219 154 pack f 20; +#X obj 230 129 s \$0-set-value_arg; +#X obj 219 179 line~; +#X obj 197 77 r \$0-slider-init; +#X obj 38 65 else/sum~; +#X obj 114 64 else/sum~; #X connect 1 0 3 1; #X connect 1 0 5 1; -#X connect 2 0 3 0; +#X connect 2 0 16 0; #X connect 3 0 0 0; -#X connect 4 0 5 0; +#X connect 4 0 17 0; #X connect 5 0 6 0; #X connect 7 0 1 0; #X connect 8 0 1 0; @@ -142,6 +144,8 @@ #X connect 14 0 8 0; #X connect 14 0 9 0; #X connect 15 0 12 0; +#X connect 16 0 3 0; +#X connect 17 0 5 0; #X restore 33 182 pd gain~; #X obj 105 38 inlet~; #X obj 167 101 cnv 1 1 1 empty empty empty 20 12 0 14 #e0e0e0 #404040 0; diff --git a/Abstractions/Merda/Modules/vca.m~-help.pd b/Abstractions/Merda/Modules/vca.m~-help.pd index 473fa7654..5a0197cf4 100644 --- a/Abstractions/Merda/Modules/vca.m~-help.pd +++ b/Abstractions/Merda/Modules/vca.m~-help.pd @@ -1,7 +1,7 @@ -#N canvas 484 38 427 590 12; -#X text 229 352 see -->; -#X text 213 242 This mono VCA module has a signal input and a CV control to set the VCA level., f 23; -#X obj 289 352 about.MERDA; +#N canvas 484 38 473 631 12; +#X text 251 384 see -->; +#X text 229 187 This mono VCA module has a signal input and a CV control to set the VCA level., f 23; +#X obj 311 384 about.MERDA; #N canvas 439 168 257 249 messages 0; #X obj 90 158 outlet; #X msg 90 122 master \$1; @@ -10,15 +10,17 @@ #X connect 1 0 0 0; #X connect 2 0 3 0; #X connect 3 0 1 0; -#X restore 69 95 pd messages; -#X obj 54 124 else/vca.m~; -#A saved 1; -#X obj 163 71 else/glide~ 50; -#X obj 163 45 else/pulse~ 1; -#X obj 33 53 else/bl.saw~ 110; -#X obj 54 489 else/out~; +#X restore 91 127 pd messages; +#X obj 76 156 else/vca.m~; +#A saved 1.30818; +#A saved; +#X obj 185 103 else/glide~ 50; +#X text 230 258 This module has support for MultiChannels and the VU displays the average sum of all channels., f 24; +#X obj 185 77 else/pulse~ -mc 1 1.7; +#X obj 76 521 else/out.mc~; +#X obj 75 41 else/sine~ -mc 220 470; #X connect 3 0 4 0; #X connect 4 0 8 0; #X connect 5 0 4 1; -#X connect 6 0 5 0; -#X connect 7 0 4 0; +#X connect 7 0 5 0; +#X connect 9 0 4 0; diff --git a/Abstractions/Merda/Modules/vca.m~.pd b/Abstractions/Merda/Modules/vca.m~.pd index b0099cbb0..36ec4a07a 100644 --- a/Abstractions/Merda/Modules/vca.m~.pd +++ b/Abstractions/Merda/Modules/vca.m~.pd @@ -65,7 +65,7 @@ #X obj 78 383 *~, f 4; #X obj 103 308 r \$0-master; #N canvas 275 222 423 453 vu 0; -#X obj 84 57 inlet~; +#X obj 85 33 inlet~; #X obj 84 202 env~ 1024; #X obj 176 171 abs~; #X obj 176 236 snapshot~; @@ -78,8 +78,11 @@ #X obj 84 347 pack; #X obj 84 371 s \$0-vu; #X obj 242 132 else/initmess 150; -#X connect 0 0 2 0; -#X connect 0 0 1 0; +#X obj 86 83 else/sum~; +#X obj 182 84 else/nchs~; +#X obj 160 120 /~ 1; +#X connect 0 0 13 0; +#X connect 0 0 14 0; #X connect 1 0 6 0; #X connect 2 0 5 0; #X connect 3 0 4 0; @@ -92,6 +95,10 @@ #X connect 9 0 5 3; #X connect 10 0 11 0; #X connect 12 0 9 0; +#X connect 13 0 15 0; +#X connect 14 0 15 1; +#X connect 15 0 2 0; +#X connect 15 0 1 0; #X restore 100 422 pd vu; #N canvas 165 143 367 250 route 0; #X obj 136 57 inlet; diff --git a/Documentation/Help-files/gain2~-help.pd b/Documentation/Help-files/gain2~-help.pd index f1e35825b..1adde7b8a 100644 --- a/Documentation/Help-files/gain2~-help.pd +++ b/Documentation/Help-files/gain2~-help.pd @@ -1,4 +1,4 @@ -#N canvas 571 29 564 673 10; +#N canvas 571 38 564 673 10; #X obj 2 327 cnv 3 550 3 empty \$0-pddp.cnv.inlets inlets 8 12 0 13 #dcdcdc #000000 0; #X obj 2 494 cnv 3 550 3 empty \$0-pddp.cnv.outlets outlets 8 12 0 13 #dcdcdc #000000 0; #X obj 306 5 cnv 15 250 40 empty empty empty 12 13 0 18 #7c7c7c #e0e4dc 0; @@ -14,7 +14,7 @@ #X obj 464 27 cnv 10 10 10 empty empty ELSE 0 6 2 13 #7c7c7c #e0e4dc 0; #X obj 502 27 cnv 10 10 10 empty empty library 0 6 2 13 #7c7c7c #e0e4dc 0; #N canvas 207 34 366 264 (subpatch) 0; -#X obj 51 101 tgl 42 0 \$0-tgl-s \$0-tgl-r empty 1 8 1 9 #dcdcdc #7c7c7c #fcfcfc 0 1; +#X obj 51 101 tgl 42 0 \$0-tgl-s \$0-tgl-r empty 1 8 1 9 #4a4f51 #cde5c3 #fcfcfc 0 1; #X obj 215 68 route dsp; #X obj 215 37 receive pd; #N canvas 977 77 379 291 set_color 0; @@ -83,7 +83,7 @@ #X restore 215 165 pd set_color; #X obj 135 122 r \$0-tgl-s; #N canvas 121 482 450 300 (subpatch) 0; -#X obj 101 101 cnv 25 40 25 empty \$0-cnv DSP 3 13 0 20 #dcdcdc #7c7c7c 0; +#X obj 101 101 cnv 25 40 25 empty \$0-cnv DSP 3 13 0 20 #4a4f51 #cde5c3 0; #X coords 0 -1 1 1 42 27 1 100 100; #X restore 51 144 pd; #X obj 226 139 s \$0-tgl-r; @@ -117,11 +117,10 @@ #X obj 264 299 dac~; #X obj 295 278 nbx 8 14 -1e+37 1e+37 0 0 empty empty empty 0 -8 0 10 #dcdcdc #000000 #000000 0 256; #X obj 276 145 osc~ 440; -#X obj 75 501 cnv 17 3 17 empty \$0-pddp.cnv.let.0 0 5 9 0 16 #dcdcdc #9c9c9c 0; -#X obj 75 547 cnv 17 3 17 empty \$0-pddp.cnv.let.0 2 5 9 0 16 #dcdcdc #9c9c9c 0; -#X text 143 502 signal; +#X obj 72 501 cnv 17 3 17 empty \$0-pddp.cnv.let.0 0 5 9 0 16 #dcdcdc #9c9c9c 0; +#X obj 72 547 cnv 17 3 17 empty \$0-pddp.cnv.let.0 2 5 9 0 16 #dcdcdc #9c9c9c 0; #X text 149 548 float; -#X text 193 548 - slider value \, from 0-1 (independent of maximum gain); +#X text 189 548 - slider value \, from 0-1 (independent of maximum gain); #N canvas 835 185 915 382 examples 0; #X msg 468 118 mode \$1; #X obj 468 41 vradio 15 1 0 3 \$0-dummy \$0-dummy-set empty 0 -8 0 10 #dcdcdc #000000 #000000 0; @@ -145,8 +144,10 @@ #X obj 758 61 adc~; #X text 628 19 Use it in conjunction with [else/meter2~]; #X obj 758 94 else/gain2~; +#A saved; #X obj 702 210 else/meter2~; #X obj 371 205 else/gain2~ 0.1 0 0.519685 0 0.519685; +#A saved; #X obj 517 275 s \$0-set; #X obj 371 142 r \$0-set; #X msg 533 198 set \$1; @@ -173,7 +174,7 @@ #X connect 23 2 17 0; #X connect 25 0 23 0; #X connect 26 0 24 0; -#X restore 468 221 pd examples; +#X restore 471 189 pd examples; #N canvas 619 192 678 490 scaling 0; #X obj 32 57 cnv 15 198 198 empty empty empty 20 12 0 14 #f4f8fc #404040 0; #N canvas 0 22 452 302 (subpatch) 0; @@ -218,6 +219,7 @@ #X text 290 77 Quartic (default): This mode just gets the slider values to the power of 4 (so \, for instance \, an input slider value of 0.5 becomes 0.125)., f 57; #X text 33 350 The gain value is a simple multiplier to the output value of the slider and determines the maximum linear gain output regardless of the scaling mode. For example \, "2" will output the double of the input amplitude \, and "0.5" half of it. This is useful if your input isn't loud enough \, if it is too high or even if you're using multiple [gain~] and they're all adding up to the same output.; #X obj 523 343 else/gain2~; +#A saved; #X obj 511 454 dac~; #X obj 361 225 else/db2lin; #X connect 23 0 34 0; @@ -229,16 +231,17 @@ #X connect 34 0 35 0; #X connect 34 1 35 1; #X connect 36 0 26 0; -#X restore 462 247 pd scaling \; modes & gain; +#X restore 465 215 pd scaling \; modes & gain; #X text 153 206 [else/gain2~] ==>; #X obj 276 171 else/gain2~ 1 0 20 0 0; -#X obj 75 470 cnv 17 3 17 empty \$0-pddp.cnv.let.0 1 5 9 0 16 #dcdcdc #9c9c9c 0; +#A saved; +#X obj 72 470 cnv 17 3 17 empty \$0-pddp.cnv.let.0 1 5 9 0 16 #dcdcdc #9c9c9c 0; #X text 146 470 signal; #X text 189 470 - right channel signal whose gain will be adjusted; -#X text 193 502 - the adjusted gain signal of the left channel; +#X text 189 502 - the adjusted gain signal of the left channel; #X text 143 524 signal; -#X text 193 524 - the adjusted gain signal of the right channel; -#X obj 75 524 cnv 17 3 17 empty \$0-pddp.cnv.let.0 1 5 9 0 16 #dcdcdc #9c9c9c 0; +#X text 189 524 - the adjusted gain signal of the right channel; +#X obj 72 524 cnv 17 3 17 empty \$0-pddp.cnv.let.0 1 5 9 0 16 #dcdcdc #9c9c9c 0; #X obj 3 4 cnv 15 301 42 empty empty gain2~ 20 20 2 37 #e0e0e0 #000000 0; #N canvas 0 22 450 278 (subpatch) 0; #X coords 0 1 100 -1 302 42 1; @@ -252,10 +255,10 @@ #X text 38 168 see also:; #X text 78 252 <= [else/gain~]; #X obj 50 192 else/gain~; +#A saved; #X obj 247 145 bng 15 250 50 0 empty empty empty 17 7 0 10 #dcdcdc #000000 #000000; #X text 170 144 mute/unmute; -#X obj 76 334 cnv 17 3 132 empty \$0-pddp.cnv.let.0 0 5 9 0 16 #dcdcdc #9c9c9c 0; -#X text 146 334 signal; +#X obj 73 334 cnv 17 3 132 empty \$0-pddp.cnv.let.0 0 5 9 0 16 #dcdcdc #9c9c9c 0; #X text 110 392 gain ; #X text 110 407 ramp ; #X text 189 362 - sets slider (range is clipped to 0-1), f 58; @@ -270,6 +273,7 @@ #N canvas 730 201 588 422 savestate 0; #X obj 114 61 noise~; #X obj 114 114 else/gain2~ 1 0 20 1 0.666667; +#A saved; #X obj 134 88 else/brown~; #X obj 114 242 else/meter2~; #X text 328 237 see also; @@ -283,28 +287,44 @@ #X connect 1 1 3 1; #X connect 2 0 1 1; #X connect 8 0 1 0; -#X restore 461 303 pd savestate; +#X restore 464 271 pd savestate; #X text 189 421 - non zero sets to init mode, f 58; #X text 80 421 savestate ; #X text 91 624 -savestate: sets to savestate mode, f 73; #X text 152 435 learn; -#X text 192 435 - learns a MIDI controller, f 58; +#X text 189 435 - learns a MIDI controller, f 58; #N canvas 721 242 484 354 learn/forget 0; #X text 82 95 The controller settings get saved with the pacth.; #X msg 197 135 learn; #X msg 217 165 forget; #X text 82 36 If you send the 'learn' message or "alt+click" the object \, it learns a MIDI controller so you can control the gain. You can also forget it with the 'forget' message or "alt+shift+click".; #X obj 197 202 else/gain2~; +#A saved; #X text 233 221 <-- alt+shift+click to learn; #X text 233 241 <-- alt+shift+control to forget; #X connect 1 0 4 0; #X connect 2 0 4 0; -#X restore 444 280 pd learn/forget; +#X restore 447 248 pd learn/forget; #X text 146 450 forget; -#X text 192 450 - forgets a MIDI controller, f 58; -#X connect 15 0 24 1; -#X connect 15 0 24 0; -#X connect 24 0 13 0; -#X connect 24 1 13 1; -#X connect 24 2 14 0; -#X connect 43 0 24 0; +#X text 189 450 - forgets a MIDI controller, f 58; +#N canvas 795 189 371 312 multichannel 0; +#X obj 197 164 setdsp~ 0; +#X obj 101 145 else/gain2~ 1 0 20 0 0.611111; +#A saved; +#X obj 97 265 dac~; +#X obj 101 76 else/sine~ -mc 440 660; +#X obj 120 114 else/sine~ -mc 450 670; +#X text 87 19 The object has built in [sum~] objects \, so it takes and mixes MC input., f 30; +#X connect 1 0 2 0; +#X connect 1 1 2 1; +#X connect 3 0 1 0; +#X connect 4 0 1 1; +#X restore 447 295 pd multichannel; +#X text 128 334 signal(s); +#X text 128 502 signal(s); +#X connect 15 0 23 1; +#X connect 15 0 23 0; +#X connect 23 0 13 0; +#X connect 23 1 13 1; +#X connect 23 2 14 0; +#X connect 42 0 23 0; diff --git a/Documentation/Help-files/gain~-help.pd b/Documentation/Help-files/gain~-help.pd index efd717198..61c97300f 100644 --- a/Documentation/Help-files/gain~-help.pd +++ b/Documentation/Help-files/gain~-help.pd @@ -7,8 +7,7 @@ #X coords 0 -1 1 1 252 42 2 0 0; #X restore 307 7 pd; #X obj 347 15 cnv 10 10 10 empty empty ELSE 0 15 2 30 #7c7c7c #e0e4dc 0; -#X obj 25 44 cnv 4 4 4 empty empty Mono 0 28 2 18 #e0e0e0 #000000 0; -#X obj 76 44 cnv 4 4 4 empty empty gain 0 28 2 18 #e0e0e0 #000000 0; +#X obj 25 44 cnv 4 4 4 empty empty Mono\ or\ multichannel\ gain 0 28 2 18 #e0e0e0 #000000 0; #X obj 460 15 cnv 10 10 10 empty empty EL 0 6 2 13 #7c7c7c #e0e4dc 0; #X obj 480 15 cnv 10 10 10 empty empty Locus 0 6 2 13 #7c7c7c #e0e4dc 0; #X obj 517 15 cnv 10 10 10 empty empty Solus' 0 6 2 13 #7c7c7c #e0e4dc 0; @@ -143,12 +142,14 @@ #X floatatom 334 165 5 0 0 0 - - - 0; #X text 350 145 set slider (0-1); #X obj 154 193 else/gain~ 1 0 0 0 0; +#A saved; #X text 58 25 [gain~] has 3 scaling modes for its slider (the default is "quartic"). You can set a linear gain multiplier \, which needs to be greater than zero and also represents the maximum linear gain achieved., f 40; #X obj 133 321 dac~; #X obj 167 322 nbx 8 14 -1e+37 1e+37 0 0 empty empty empty 0 -8 0 10 #dcdcdc #000000 #000000 0 256; #X obj 154 127 noise~; #X obj 615 43 adc~; #X obj 615 76 else/gain~; +#A saved; #X obj 615 198 else/meter~; #X text 659 94 Use it in conjunction with [else/meter~], f 16; #X obj 334 322 s \$0-set; @@ -217,6 +218,7 @@ #X text 290 121 dB: This mode adopts a decibel scale with a range of 100 dB (using the [dbtorms~] object)., f 55; #X text 290 77 Quartic (default): This mode just gets the slider values to the power of 4 (so \, for instance \, an input slider value of 0.5 becomes 0.125)., f 57; #X obj 463 344 else/gain~; +#A saved; #X text 33 337 The gain value is a simple multiplier to the output value of the slider and determines the maximum linear gain output regardless of the scaling mode. For example \, "2" will output the double of the input amplitude \, and "0.5" half of it. This is useful if your input isn't loud enough \, if it is too high or even if you're using multiple [gain~] and they're all adding up to the same output.; #X obj 441 225 else/db2lin; #X connect 23 0 33 0; @@ -227,6 +229,7 @@ #X connect 35 0 26 0; #X restore 466 204 pd scaling \; modes & gain; #X obj 289 177 else/gain~ 1 0 20 0 0; +#A saved; #X obj 5 7 cnv 15 301 42 empty empty gain~ 20 20 2 37 #e0e0e0 #000000 0; #N canvas 0 22 450 278 (subpatch) 0; #X coords 0 1 100 -1 302 42 1; @@ -236,6 +239,7 @@ #X text 75 556 -ramp : sets ramp time (minimum 5 \, default 20), f 76; #X text 197 410 - non zero sets to init mode, f 58; #X obj 48 199 else/gain2~; +#A saved; #X text 38 175 see also:; #X text 88 257 <= [else/gain2~]; #X obj 1 315 cnv 3 550 3 empty \$0-pddp.cnv.inlets inlets 8 12 0 13 #dcdcdc #000000 0; @@ -258,6 +262,7 @@ #X text 85 410 savestate ; #N canvas 684 159 548 397 savestate 0; #X obj 93 96 else/gain~ 1 0 20 1 0.677778; +#A saved; #X obj 93 218 else/meter~; #X obj 93 33 noise~; #X msg 108 63 savestate 1; @@ -279,6 +284,7 @@ #X obj 97 74 osc~ 440; #X obj 160 74 osc~ 660; #X obj 97 148 else/gain~ 1 0 20 0 0.0666667; +#A saved; #X obj 97 265 dac~ 1; #X connect 0 0 5 0; #X connect 3 0 0 0; @@ -289,6 +295,7 @@ #N canvas 721 242 484 354 learn/forget 0; #X text 82 95 The controller settings get saved with the pacth.; #X obj 197 202 else/gain~ 1 0 20 0 0.491444; +#A saved; #X msg 197 135 learn; #X msg 217 165 forget; #X text 82 36 If you send the 'learn' message or "alt+click" the object \, it learns a MIDI controller so you can control the gain. You can also forget it with the 'forget' message or "alt+shift+click".; @@ -299,8 +306,8 @@ #X restore 449 259 pd learn/forget; #X text 151 438 forget; #X text 197 438 - forgets a MIDI controller, f 58; -#X connect 16 0 26 0; -#X connect 26 0 14 0; -#X connect 26 0 14 1; -#X connect 26 1 15 0; -#X connect 48 0 26 0; +#X connect 15 0 25 0; +#X connect 25 0 13 0; +#X connect 25 0 13 1; +#X connect 25 1 14 0; +#X connect 47 0 25 0; diff --git a/Source/Control/sfload.c b/Source/Control/sfload.c index 66ea23790..9f60dab05 100644 --- a/Source/Control/sfload.c +++ b/Source/Control/sfload.c @@ -10,8 +10,9 @@ static t_class *sfload_class; -typedef struct _sfload{ +typedef struct _sfload { t_object x_obj; + t_outlet *x_info_outlet; AVCodecContext *x_stream_ctx; int x_stream_idx; AVPacket *x_pkt; @@ -27,6 +28,7 @@ typedef struct _sfload{ _Atomic int x_result_ready; t_clock *x_result_clock; char x_path[MAXPDSTRING]; + t_atom x_sfinfo[6]; }t_sfload; void* sfload_read_audio(void *arg){ // read audio into array @@ -85,6 +87,10 @@ void* sfload_read_audio(void *arg){ // read audio into array pd_error(x, "[sfload]: Could not initialize the resampling context\n"); return (NULL); } + + AVDictionaryEntry *loop_start_entry = av_dict_get(x->x_ic->metadata, "loop_start", NULL, 0); + AVDictionaryEntry *loop_end_entry = av_dict_get(x->x_ic->metadata, "loop_end", NULL, 0); + t_sample* x_out = (t_sample*)av_mallocz(nch * FRAMES * sizeof(t_sample)); int output_index = 0; while(av_read_frame(x->x_ic, x->x_pkt) >= 0) { @@ -111,6 +117,14 @@ void* sfload_read_audio(void *arg){ // read audio into array } av_packet_unref(x->x_pkt); } + + SETFLOAT(x->x_sfinfo, x->x_stream_ctx->sample_rate); + SETFLOAT(x->x_sfinfo + 1, nch); + SETFLOAT(x->x_sfinfo + 2, av_get_bytes_per_sample(x->x_stream_ctx->sample_fmt) * 8); + SETFLOAT(x->x_sfinfo + 3, output_index); + SETFLOAT(x->x_sfinfo + 4, loop_start_entry ? atoi(loop_start_entry->value) : 0); + SETFLOAT(x->x_sfinfo + 5, loop_end_entry ? atoi(loop_end_entry->value) : 0); + x->x_result_ready = output_index; av_free(x_out); return (NULL); @@ -127,18 +141,24 @@ void sfload_check_done(t_sfload* x){ // result clock x->x_result_ready = 0; free(x->x_all_out); x->x_all_out = NULL; + outlet_list(x->x_info_outlet, &s_, 6, x->x_sfinfo); } else clock_delay(x->x_result_clock, 20); } -static void sfload_find_file(t_sfload *x, t_symbol* file, char* dir_out, char* filename_out){ - const char *filename = file->s_name; - const char *dirname = canvas_getdir(x->x_canvas)->s_name; - char* fileout; - open_via_path(dirname, filename, "", dir_out, &fileout, MAXPDSTRING-1, 0); - memcpy(filename_out, fileout, strlen(fileout) + 1); - strcat(dir_out, "/"); +static void sfload_find_file(t_sfload *x, t_symbol* file, char* dir_out){ + static char fname[MAXPDSTRING]; + char *bufptr; + int fd = canvas_open(x->x_canvas, file->s_name, "", fname, &bufptr, MAXPDSTRING, 1); + if(fd < 0){ + post("[sfload] file '%s' not found", file->s_name); + return; + } + else { + if(bufptr > fname) bufptr[-1] = '/'; + strcpy(dir_out, fname); + } } void sfload_load(t_sfload* x, t_symbol* s, int ac, t_atom* av){ @@ -202,6 +222,7 @@ static void *sfload_new(t_symbol *s, int ac, t_atom *av){ x->x_canvas = canvas_getcurrent(); x->x_result_ready = 0; x->x_result_clock = clock_new(x, (t_method)sfload_check_done); + x->x_info_outlet = outlet_new(x, &s_list); return(x); }