Hallo august, devs!
I made some changes to your readanysf~: I tried to play a file, when it is opened (and trigger it with the length message) and PD crashed... So I added an additional output message to the 2.outlet, which puts out [opened bang(, when the file is loaded - so it's possible to synchronize it with pd ...
I also fixed your output messages (you made a 2 element list as output for length, samplerate, etc. but only with one valid element ...)
The changes in main.cpp are attached, and also a modified help patch.
Would be cool if you could include this in readanysf~.
Thanks, LG Georg
PS: do you want to add readanysf to the pd cvs? would be easier to find ... :)
--- main.cpp.old 2005-08-01 11:03:37.000000000 +0200 +++ main.cpp 2005-08-01 10:49:43.000000000 +0200 @@ -355,6 +355,15 @@ fifo->Flush (); readsf->Rewind(); setSys (STATE_IDLE, R_PROCESS); + + // Georg Holzmann: + // send [opened bang( to outlet2, so that you can see, + // when the file is opened and ready to play ... + t_atom lst[2]; + SetString (lst[0], "opened"); + SetString (lst[1], "bang"); + ToOutAnything (2, GetSymbol(lst[0]), 1, lst+1); + } else { // Set state to STARTUP at begingin of open and make sure to set // it to IDLE or NOTHING after succesfully opening; @@ -428,6 +437,15 @@ varmutex.Unlock(); setSys (STATE_IDLE, R_PROCESS); fifo->Flush (); + + // Georg Holzmann: + // send [opened bang( to outlet2, so that you can see, + // when the file is opened and ready to play ... + t_atom lst[2]; + SetString (lst[0], "opened"); + SetString (lst[1], "bang"); + ToOutAnything (2, GetSymbol(lst[0]), 1, lst+1); + } else { post("Readanysf:: Couldn't initialize the file/stream!!!, sucks for you dude"); if (readsf != NULL) // safe without locking ??? @@ -526,7 +544,7 @@ if (counttick++ > outtick) { SetString (lst[0], "cache"); SetFloat (lst[1], cachemsg); - ToOutAnything (2, GetSymbol (lst[0]), 2, lst + 1); + ToOutAnything (2, GetSymbol (lst[0]), 1, lst + 1); counttick = 0; } varmutex.Unlock (); @@ -607,10 +625,10 @@ { SetString (lst[0], "length"); SetFloat (lst[1], lengthinseconds); - ToOutAnything (2, GetSymbol (lst[0]), 2, lst + 1); + ToOutAnything (2, GetSymbol (lst[0]), 1, lst + 1); SetString (lst[0], "rate"); SetFloat (lst[1], (float) samplerate); - ToOutAnything (2, GetSymbol (lst[0]), 2, lst + 1); + ToOutAnything (2, GetSymbol (lst[0]), 1, lst + 1); sendout = false; } varmutex.Unlock ();
#N canvas 812 201 538 312 10; #X obj 150 223 dac~; #X msg 149 123 play; #X msg 232 123 stop; #X msg 187 123 pause; #X obj 29 25 hsl 100 15 0 15 0 0 empty empty empty -2 -6 0 8 -44926 -1 -1 0 1; #X floatatom 95 40 5 0 0 0 - - -; #X msg 26 45 speed $1; #X msg 170 41 loop $1; #X obj 170 25 tgl 15 0 empty empty empty 0 -6 0 8 -44926 -1 -1 0 1 ; #X obj 449 245 bng 15 250 50 0 empty empty empty 0 -6 0 8 -143491 -1 -1; #X obj 214 282 nbx 4 10 -1e+37 1e+37 0 0 empty empty empty 0 -6 0 10 -241291 -1 -1 7.68583 256; #X obj 260 272 nbx 6 10 -1e+37 1e+37 0 0 empty empty empty 0 -6 0 10 -260818 -1 -1 20.0981 256; #X obj 307 259 nbx 5 10 -1e+37 1e+37 0 0 empty empty empty 0 -6 0 10 -260241 -1 -1 44100 256; #X obj 353 245 nbx 7 12 -1e+37 1e+37 0 0 empty empty empty 0 -6 0 10 -259729 -1 -1 0 256; #X msg 21 269 ; pd dsp 1; #X obj 21 244 loadbang; #X obj 149 180 readanysf~; #X obj 53 163 r rany; #X obj 26 72 s rany; #X obj 170 67 s rany; #X msg 253 50 recover 1; #N canvas 153 352 570 425 testfiles 0; #X msg 104 215 open Schnucki.wav; #X msg 43 53 open $1; #X obj 43 33 openpanel; #X obj 43 15 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 -1; #X msg 104 120 open http://fro.at:8008/24k; #X msg 104 196 open Schnucki.ogg; #X msg 104 176 open Schnucki.mp3; #X obj 43 372 s rany; #X msg 104 78 open http://localhost:8000/pd; #X msg 104 140 open http://66.28.68.70:8000/; #X msg 133 344 open http://sinnlos.st/audio/24kbs_blind_tv_100403.mp3 ; #X msg 133 323 open http://212.23.57.33:8010; #X msg 104 236 open Schnucki.fla; #X msg 256 221 open Schnucki.aif; #X connect 0 0 7 0; #X connect 1 0 7 0; #X connect 2 0 1 0; #X connect 3 0 2 0; #X connect 4 0 7 0; #X connect 5 0 7 0; #X connect 6 0 7 0; #X connect 8 0 7 0; #X connect 9 0 7 0; #X connect 10 0 7 0; #X connect 11 0 7 0; #X connect 12 0 7 0; #X connect 13 0 7 0; #X restore 389 31 pd testfiles; #N canvas 0 22 450 300 testseek 0; #X msg 145 167 pcm_seek $1; #X floatatom 145 147 5 0 0 0 - - -; #X obj 145 192 s rany; #X floatatom 149 60 5 0 0 0 - - -; #X obj 149 99 s rany; #X msg 149 77 time_seek $1; #X obj 184 147 * 44100; #X msg 145 126 13; #X msg 149 41 13; #X obj 204 124 f; #X obj 208 102 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 -1; #X floatatom 240 100 5 0 0 0 - - -; #X msg 268 130 81; #X msg 268 155 19; #X connect 0 0 2 0; #X connect 1 0 6 0; #X connect 3 0 5 0; #X connect 5 0 4 0; #X connect 6 0 0 0; #X connect 7 0 1 0; #X connect 8 0 3 0; #X connect 9 0 6 0; #X connect 10 0 9 0; #X connect 11 0 9 1; #X connect 12 0 1 0; #X connect 13 0 1 0; #X restore 390 61 pd testseek; #X obj 214 223 route float length rate cache opened bang; #X obj 402 265 bng 15 250 50 0 empty empty empty 0 -6 0 8 -258699 -1 -1; #X connect 1 0 16 0; #X connect 2 0 16 0; #X connect 3 0 16 0; #X connect 4 0 5 0; #X connect 4 0 6 0; #X connect 6 0 18 0; #X connect 7 0 19 0; #X connect 8 0 7 0; #X connect 15 0 14 0; #X connect 16 0 0 0; #X connect 16 1 0 1; #X connect 16 2 23 0; #X connect 17 0 16 0; #X connect 20 0 19 0; #X connect 23 0 10 0; #X connect 23 1 11 0; #X connect 23 2 12 0; #X connect 23 3 13 0; #X connect 23 4 24 0; #X connect 23 5 9 0;
#N canvas 105 11 865 702 10; #X obj 219 386 readanysf~; #X msg 33 337 stop; #X msg 33 241 open $1; #X obj 33 220 symbol; #X obj 32 201 openpanel; #X obj 32 146 bng 45 250 50 0 empty empty empty 0 -6 0 8 -258699 -1 -1; #X msg 33 308 pause; #X msg 33 369 play; #X text 649 359 TIME seeking.; #X text 649 376 seeks to seconds of time; #X text 671 446 bang at end of file; #X text 669 460 it won't bang in loop mode; #X obj 549 103 hsl 100 15 0 15 0 0 empty empty empty -2 -6 0 8 -44926 -1 -1 0 1; #X floatatom 615 118 5 0 0 0 - - -; #X msg 546 123 speed $1; #X msg 34 529 ; pd dsp 1; #X obj 34 507 loadbang; #X msg 546 77 1; #X msg 577 77 2; #X msg 609 77 3; #X obj 546 301 * 44100; #X msg 546 320 pcm_seek $1; #X obj 546 285 nbx 3 14 0 1e+37 0 0 empty empty empty 0 -6 0 10 -241291 -1 -1 0 256; #X msg 643 77 1.378; #X obj 588 487 bng 15 250 50 0 empty empty empty 0 -6 0 8 -258699 -1 -1; #X text 519 567 length of file in seconds; #X text 545 155 how often to send seconds played; #X text 544 170 to 3rd outlet (relative to blocksize); #X msg 546 370 time_seek $1; #X obj 546 354 nbx 3 14 0 1e+37 0 0 empty empty empty 0 -6 0 10 -241291 -1 -1 0 256; #X text 641 316 seeks to this frame number.; #X text 642 299 PCM seeking.; #X obj 200 498 catch~ L; #X obj 222 517 catch~ R; #X obj 220 466 throw~ L; #X obj 251 446 throw~ R; #X obj 312 514 env~; #X floatatom 312 532 5 0 0 0 - - -; #X obj 276 534 env~; #X floatatom 276 552 5 0 0 0 - - -; #X obj 200 547 dac~; #X text 550 21 speed adjustment; #X text 550 35 is automatically set; #X text 549 51 to (pd_samplerate/file_samplerate); #X text 613 233 turn looping on/off; #X text 466 593 secs played (+/- .5); #X obj 400 594 nbx 5 20 -1e+37 1e+37 0 0 empty empty empty 0 -6 0 10 -241291 -1 -1 0 256; #N canvas 215 67 473 305 urlhelp 0; #X text 21 195 if you are having troubles with playing the stream , pause it and wait a few seconds to let the buffer cache fill up. buffer is set to a default of 32kb. same as xmms.; #X text 37 109 openurl mp3 http://webist.com:8000/mount; #X text 34 150 openurl ogg http://webist.com:8000/mount; #X text 20 80 to start a stream open it with:; #X text 112 127 or; #X text 22 30 mp3 and Ogg Vorbis Urls are supported for shoutcast and icecast servers; #X restore 449 25 pd urlhelp; #X text 612 653 readanysf~ (C) august black 2003; #X text 613 671 http://aug.ment.org/readanysf; #X obj 447 566 nbx 5 16 -1e+37 1e+37 0 0 empty empty empty 0 -6 0 10 -260818 -1 -1 0 256; #X msg 277 137 openurl mp3 http://fro.at:8008/24k; #X msg 242 114 openurl mp3 http://bonjour.mp3.at:8000/; #X obj 546 227 tgl 15 0 empty empty empty 0 -6 0 8 -241291 -1 -1 0 1; #X msg 546 243 loop $1; #X obj 494 542 nbx 5 14 -1e+37 1e+37 0 0 empty empty empty 0 -6 0 10 -260241 -1 -1 0 256; #X obj 541 519 nbx 7 12 -1e+37 1e+37 0 0 empty empty empty 0 -6 0 10 -259729 -1 -1 0 256; #X text 559 542 samperate; #X msg 546 188 set_tick 100; #X text 32 104 !!!!!!!!!!; #X text 32 120 START HERE; #X msg 172 78 openurl ogg http://radiostudio.org:8000/streaps_broadband.ogg ; #X text 625 521 amount of cache used; #X text 654 532 for http streams; #X msg 95 55 openurl ogg http://radiostudio.org:8000/free_radio_linux.ogg ; #X obj 400 428 route float length rate cache opened bang; #X obj 635 452 bng 15 250 50 0 empty empty empty 0 -6 0 8 -143491 -1 -1; #X text 613 481 bang when file is loaded , so; #X text 612 494 you can trigger play now; #X connect 0 0 34 0; #X connect 0 1 35 0; #X connect 0 2 65 0; #X connect 1 0 0 0; #X connect 2 0 0 0; #X connect 3 0 2 0; #X connect 4 0 3 0; #X connect 5 0 4 0; #X connect 6 0 0 0; #X connect 7 0 0 0; #X connect 12 0 13 0; #X connect 12 0 14 0; #X connect 14 0 0 0; #X connect 16 0 15 0; #X connect 17 0 12 0; #X connect 18 0 12 0; #X connect 19 0 12 0; #X connect 20 0 21 0; #X connect 21 0 0 0; #X connect 22 0 20 0; #X connect 23 0 12 0; #X connect 28 0 0 0; #X connect 29 0 28 0; #X connect 32 0 40 0; #X connect 32 0 36 0; #X connect 33 0 40 1; #X connect 33 0 38 0; #X connect 36 0 37 0; #X connect 38 0 39 0; #X connect 51 0 0 0; #X connect 52 0 0 0; #X connect 53 0 54 0; #X connect 54 0 0 0; #X connect 58 0 0 0; #X connect 61 0 0 0; #X connect 64 0 0 0; #X connect 65 0 46 0; #X connect 65 1 50 0; #X connect 65 2 55 0; #X connect 65 3 56 0; #X connect 65 4 24 0; #X connect 65 5 66 0;