How to use umenu and sprintf

Thinksamuel's icon

I would like to have some more control about the sprintf message I am using to record a file. Can anyone tell me how to write the message so that I will be able to alter the framerate, compression type and quality? I know I have to use %, but what comes after it? For now th message looks like this:

sprintf write %srawgrab_%i.mov 30. motion_jpeg_a best

Timo Rozendal's icon

sprintf write %srawgrab_%i.mov %f %s %s

so %s for symbols/"strings", %i for integers, %f for floats (more options are possible, see http://www.cplusplus.com/reference/clibrary/cstdio/sprintf/ )

you should keep in mind that this will fail if your file name (or filepath) has spaces then you need to split up the messages and combine later

fill your umenu's with the info from [p codec_info] in the helpfile and connect the middle outlet to the appropriate sprintf inlet

Thinksamuel's icon

thank you. I will try it out

seejayjames's icon

spaces in folders can be a problem. you can use [tosymbol] to combine it all together, then use [prepend] as in the sprintf help file.

Again, another candidate for a "Frequently Asked Question" list... this isn't too complicated when you get it, but it's definitely tricky at first, I know I spent a good chunk of time fiddling until I got it.