ubumenu & sprintf question
hello,
im getting my hands back on maxmsp after a long absence. im still running 4.6.3 on OSX 10.5.8. while trying to use an old patch i had written a long time ago for live performances, i noticed a bug but i cannot figure it out. any help mucho appreciated!
here is the problem:
1. I put samples inside folders, and the folders inside a main folder. For example '808' and '909' folders containing drum samples, inside a main 'drum kits' folder.
2. I want to drag and drop the main folder ('drum kits') on a dropfile area, so that the subfolders are listed in an ubumenu. This is very easy to do, since it's in the help patch for the ubumenu object (the subpatch for the prefix settings).
3. Here is where the problem starts: now I want that whenever I select one of the subfolders in the first ubumenu, for example I select '909' with the mouse, then I want that the samples inside it get listed inside a second, different, ubumenu.
I used to do this operation using
-- a simple 'message' object which stored the main folder path at the moment it was sent to the first ubumenu
-- then the subfolder name (outputted by the first ubumenu) was added using the sprintf object which allowed me to combine the two messages (the main folder path + the subfolder name) so that it becomes a subfolder path.
It used to work fine, but today it doesn't, and I don't understand why. Comparing the outputs of the two ubumenus (the one for the mainfolder, and the one for the subfolders) using print objects give me exactly the same message in the Max window, but the second ubumenu doesn't understand it when it comes out of the sprintf object? The only explanation I can imagine would be that sprintf gives a special format to the message, so that ubumenu cannot read it anymore??
Here is the test patch:
hi,
your patch looks like it's working here..
except if i have sub folders with spaces in their names.
this can be fixed by using "symout" argument with sprintf, so you're sure that it always outputs a symbol (it will add quotes if needed).
[sprintf symout %s%s]
not sure if this is related to your problem though
ciao
_y
hi,
thanks a lot for the reply. you say it's working on your machine? here is what i do:
-- open the patch
-- drag and drop the main folder (with the subfolders inside)
--> the subfolders names get listed in the first ubumenu
-- select one of the subfolder names in the first ubumenu with the computer mouse
--> nothing happens in the second ubumenu at the bottom (a list of the soundfiles inside the selected subfolder should appear inside it)
btw: no spaces in the names of the subfolders here
btw2: i used to add a slash in the sprintf, "sprintf %s%s/", it doesn't change anything.
what is really strange for me is that if i perform the operation twice
1) normally, as described above
2) then i drag and drop the subfolder i wanted to select in the ubumenu, and i compare the print message in Max window
--> the messages sent to the first ubumenu and the second one are exactly the same. how come it doesnt work??
this is weird because it works fine here..
(osx, 10.5.7, max-5.0.7)
otherwise, you might want to simplify your patch and see if it's still not working ?
I would use "concatenate" prefix-mode for the umenu that selects the subfolder (as in the example patch below), or use the "folder depth" option (but it can get nasty if you have a lot of files...)
ciao,
_y
thanks a lot, if the same patch works fine for you it means it's a bug somewhere in 4.6.3, and that i can stop trying. thank you very very much for testing it.
i don't have max5 so i think i cannot use the patch you posted, but i'll try with the demo or just have a look at concatenate prefix mode. the problem is the amount of soundfiles, this is why i need to split in two separate ubumenus.
best, thanks again
basile
ah sorry for the format.
here is the patch again (working here on 4.6.3):
(by the way, your 1st patch also works fine on my 4.6.3)
ciao,
_y
sorry i couldn't work on music the last two days, i just tried your patch. it's not only 1000 times more elegant and efficient, it also works fine on my computer. i wonder how i possibly missed this function of ubumenu
and if mine works fine on yours, it means i must have a problem with some externals (duplicates whatever), its also good news.
thanks a lot!! im very happy right now
i think found the gost: if the ubumenu has been set with a prefix_mode 2 command (for example), then it gets saved with the ubumenu object, although it cannot be seen in its inspector window.
there was a command like this somewhere in the main patch, and it got stored inside the ubumenus objects. what i still don't understand is why the patch as text works on your computer and not on mine (i tried to open the text myself, it still doesn't work).
anyway. the patch is too old, thats the problem. need to rewrite everything, tough life.