How to use umenu and sprintf

Aug 10, 2010 at 12:10pm

How to use umenu and sprintf

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

#51740
Aug 10, 2010 at 12:27pm

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

#185629
Aug 10, 2010 at 12:40pm

thank you. I will try it out

#185630
Aug 10, 2010 at 6:38pm

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.

#185631

You must be logged in to reply to this topic.