Forums > MaxMSP

strange behavior – bug?

February 24, 2007 | 4:51 am

Hello all,

I’m writing a patch to load and manage buffers. I have a coll that keeps track of which buffers have which files loaded.

I’m working on a subpatch that finds the next free slot (I have 50 buffers available). For instance, after adding and removing many buffers, the coll might look like:

7, bandolin.aif "Macintosh HD:/Users/kevin/Documents/max stuff/a samples/freesound/bandolin.aif";
8, bandolin2.aif "Macintosh HD:/Users/kevin/Documents/max stuff/a samples/freesound/bandolin2.aif";
9, bandolin3.aif "Macintosh HD:/Users/kevin/Documents/max stuff/a samples/freesound/bandolin3.aif";
10, chimes.aif "Macintosh HD:/Users/kevin/Documents/max stuff/a samples/freesound/chimes.aif";
11, zoo.aif "Macintosh HD:/Users/kevin/Documents/max stuff/a samples/freesound/zoo.aif";
12, hens.wav "Macintosh HD:/Users/kevin/Documents/max stuff/a samples/freesound/hens.wav";
13, highs_lows.wav "Macintosh HD:/Users/kevin/Documents/max stuff/a samples/freesound/highs_lows.wav";

Each time I bang this subpatch, it should spit out 1, then 2, (etc) to 6, then skip to 14, and go on to 50.

Here’s what I have. This should work, and at first glance it seems to just be off by one, but if you turn on trace and go through it, it seems like a bug. Right when the last number box gets to 14 (the result I want), the trigger at the top counts down to 7. I have absolutely no idea why this happens.

Any ideas!? Maybe somebody has a better way to write this patch?

#P window setfont "Sans Serif" 9.;
#P window linecount 1;
#P newex 76 189 30 196617 t b b;
#P newex 60 278 29 196617 gate;
#P newex 63 249 27 196617 – 1;
#P button 101 60 15 0;
#P newex 96 249 29 196617 gate;
#P number 96 273 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#N counter 1 50;
#X flags 0 0;
#P newobj 101 83 68 196617 counter 1 50;
#P button 96 171 15 0;
#P message 113 210 14 196617 1;
#P toggle 96 229 15 0;
#P newex 101 121 40 196617 t i i b;
#P number 101 103 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#N coll stuff;
#T flags 1 0;
#T 7 bandolin.aif "Macintosh HD:/Users/kevin/Documents/max stuff/a samples/freesound/bandolin.aif";
#T 8 bandolin2.aif "Macintosh HD:/Users/kevin/Documents/max stuff/a samples/freesound/bandolin2.aif";
#T 9 bandolin3.aif "Macintosh HD:/Users/kevin/Documents/max stuff/a samples/freesound/bandolin3.aif";
#T 10 chimes.aif "Macintosh HD:/Users/kevin/Documents/max stuff/a samples/freesound/chimes.aif";
#T 11 zoo.aif "Macintosh HD:/Users/kevin/Documents/max stuff/a samples/freesound/zoo.aif";
#T 12 hens.wav "Macintosh HD:/Users/kevin/Documents/max stuff/a samples/freesound/hens.wav";
#T 13 highs_lows.wav "Macintosh HD:/Users/kevin/Documents/max stuff/a samples/freesound/highs_lows.wav";
#P newobj 96 152 53 196617 coll stuff;
#P message 96 210 14 196617 0;
#P connect 3 1 1 0;
#P connect 1 0 6 0;
#P connect 3 0 9 1;
#P connect 3 2 5 0;
#P connect 2 0 3 0;
#P connect 7 0 2 0;
#P connect 10 0 7 0;
#P connect 12 0 10 0;
#P connect 9 0 8 0;
#P connect 4 0 11 0;
#P connect 4 0 9 0;
#P connect 0 0 4 0;
#P connect 5 0 4 0;
#P connect 13 1 0 0;
#P connect 13 0 12 1;
#P connect 6 0 13 0;
#P connect 11 0 12 0;
#P window clipboard copycount 14;

Thanks,
Kevin


February 24, 2007 | 10:59 am

?? it works fine here …

try this one (I just cleaned yours a bit):

#P window setfont "Sans Serif" 9.;
#P window linecount 1;
#P newex 56 153 27 9109513 t b 1;
#P newex 55 191 29 9109513 gate;
#P button 56 38 15 0;
#N counter 1 50;
#X flags 0 0;
#P newobj 56 61 66 9109513 counter 1 50;
#P newex 56 107 67 9109513 t i 0;
#P number 56 86 35 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
#N coll stuff;
#T flags 1 0;
#T 7 bandolin.aif "Macintosh HD:/Users/kevin/Documents/max stuff/a
samples/freesound/bandolin.aif";
#T 8 bandolin2.aif "Macintosh HD:/Users/kevin/Documents/max stuff/a
samples/freesound/bandolin2.aif";
#T 9 bandolin3.aif "Macintosh HD:/Users/kevin/Documents/max stuff/a
samples/freesound/bandolin3.aif";
#T 10 chimes.aif "Macintosh HD:/Users/kevin/Documents/max stuff/a
samples/freesound/chimes.aif";
#T 11 zoo.aif "Macintosh HD:/Users/kevin/Documents/max stuff/a
samples/freesound/zoo.aif";
#T 12 hens.wav "Macintosh HD:/Users/kevin/Documents/max stuff/a
samples/freesound/hens.wav";
#T 13 highs_lows.wav "Macintosh HD:/Users/kevin/Documents/max stuff/a
samples/freesound/highs_lows.wav";
#P newobj 56 130 53 9109513 coll stuff;
#P comment 93 86 51 9109513 free slots;
#P fasten 3 1 6 0 118 180 60 180;
#P connect 7 1 6 0;
#P fasten 6 0 5 0 60 215 41 215 41 28 61 28;
#P connect 5 0 4 0;
#P connect 4 0 2 0;
#P connect 2 0 3 0;
#P connect 3 0 1 0;
#P connect 1 0 7 0;
#P connect 7 0 6 1;
#P window clipboard copycount 8;


February 24, 2007 | 9:27 pm

Thanks!

Indeed – yours is cleaner, and it works fine.

Did you try tracing mine, though? I really have no idea why or how trigger would start counting down. Strange.

Well, thanks again – much appreciated!


February 24, 2007 | 10:12 pm

Oh, no, that doesn’t quite work for me – while it stops on the proper number, it still outputs the numbers I don’t want (albeit very quickly).

I’m working on it now, but if anybody comes up with anything, I’m all ears…


February 25, 2007 | 11:46 am

oops, it should have been obvious that there was a mistake.

try this one:

#P window setfont "Sans Serif" 9.;
#P window linecount 1;
#P newex 71 196 43 9109513 deferlow;
#P newex 144 234 48 9109513 print free;
#P number 127 258 35 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 127 167 19 9109513 t 0;
#P newex 127 205 50 9109513 gate;
#P button 108 74 15 0;
#N counter 1 50;
#X flags 0 0;
#P newobj 108 92 66 9109513 counter 1 50;
#P newex 108 116 112 9109513 t i i 1;
#N coll stuff;
#T flags 1 0;
#T 7 bandolin.aif "Macintosh HD:/Users/kevin/Documents/max stuff/a
samples/freesound/bandolin.aif";
#T 8 bandolin2.aif "Macintosh HD:/Users/kevin/Documents/max stuff/a
samples/freesound/bandolin2.aif";
#T 9 bandolin3.aif "Macintosh HD:/Users/kevin/Documents/max stuff/a
samples/freesound/bandolin3.aif";
#T 10 chimes.aif "Macintosh HD:/Users/kevin/Documents/max stuff/a
samples/freesound/chimes.aif";
#T 11 zoo.aif "Macintosh HD:/Users/kevin/Documents/max stuff/a
samples/freesound/zoo.aif";
#T 12 hens.wav "Macintosh HD:/Users/kevin/Documents/max stuff/a
samples/freesound/hens.wav";
#T 13 highs_lows.wav "Macintosh HD:/Users/kevin/Documents/max stuff/a
samples/freesound/highs_lows.wav";
#P newobj 127 144 53 9109513 coll stuff;
#P comment 123 276 51 9109513 free slots;
#P connect 3 0 2 0;
#P connect 4 0 3 0;
#P connect 5 0 7 0;
#P connect 5 0 8 0;
#P connect 6 0 9 0;
#P connect 6 0 5 0;
#P connect 2 2 5 0;
#P connect 1 0 6 0;
#P fasten 2 1 1 0 164 139 132 139;
#P fasten 2 0 5 1 113 193 172 193;
#P fasten 9 0 4 0 76 220 65 220 65 67 113 67;
#P window clipboard copycount 10;

_y.


February 26, 2007 | 12:12 pm

Kevin Cox wrote:
> I’m working on it now, but if anybody comes up with anything, I’m all
> ears…

look at my "nextfree" abhaXion, its made for that purpose…

Stefan

http://www.cycling74.com/twiki/bin/view/Share/StefanTiedje

Stefan Tiedje————x——-
–_____———–|————–
–(_|_ —-|—–|—–()——-
– _|_)—-|—–()————–
———-()——–www.ccmix.com


February 28, 2007 | 1:40 am

Thanks, everybody!

I ended up coming up with my own thing just before gusano posted – but thanks anyway. you guys are great!


Viewing 7 posts - 1 through 7 (of 7 total)