Multiple patches to a single window

Carlos Frías's icon

I have a few patches that I would like to have appear in a single main window, and I would also like to be able to mix some of them together or alternate their appearance in said main window. I would also like to be able to record both the image and the audio of said main window. Here is a small example of what I am doing...

In the example, on the right, there are the patches and at the moment there are two, but I hope to understand the solution and learn it to add more patches to the main window.

Thank you very much in advance for your time and dedication.

A_Espejos obliucos_2.maxpat
Max Patch

TFL's icon

Seems like you're looking for [bpatcher].

You will also probably want to use presentation mode.

To change the bpatcher visibility and position, you can change its patching_rect or presentation_rect attributes as well as its hidden attribute. For this, have a look at the [thispatcher] helpfile, especially in [p moreScripting] and [p sendbox].

Carlos Frías's icon

Well, thank you. I'll try it tonight... I have to go to work now.

Carlos Frías's icon

I'm sorry but I don't quite understand it. Here's a simplified example. If someone can fill in the missing "gaps", I'd be extremely grateful. From there, I think I can figure out how to continue the process with more patches and more windows. As I said, it's all about being able to send the window I want

A_Espejos obliucos_SIMPLE.maxpat
Max Patch

to the main window.

Again, thank you very much for your time.

Source Audio's icon

post your patches in compressed form.

select all - edit - copy compressed- paste here.

otherwise one has to download your patch to local hard drive, delete it later an so on.

Carlos Frías's icon

I hope this works out....

My apologies.

Max Patch
Copy patch and select New From Clipboard in Max.

Source Audio's icon

You are not trying to combine patches , but video output from several sources.

Maybe change your title to make it more understandable

for anyone that feels like replying.

Video is not my domain, so ...

TFL's icon

You are not trying to combine patches , but video output from several sources.

Ah thanks!

A lot of things get confused here:

  • You need only 1 [jit.world] in your main patch, that's all.

  • Each subpatch/visual should be drawn in their own [jit.gl.node]

  • Remove all [jit.gl.asyncread], you don't need them for what you want to do. Use @capture 1 on the jit.gl.node instead.

  • Remove all [jit.gl.render], you don't need them as you already have a [jit.world]

  • Be careful with context naming. jit.world has a name (I named it "main"). jit.gl.nodes each have an individual name (@name nodo_1 and @name nodo_2) and they @drawto main. GL objects need to be drawn to their correspond node, ie adding @drawto nodo_1 or @drawto nodo_2 to your jit.gl.mesh (or setting their first argument to nodo_1 or nodo_2, it's the same).

  • Still not sure how you want to be able to mix your various visuals. Here is a basic mix example allowing you to fade between the result of both subpatches.

Max Patch
Copy patch and select New From Clipboard in Max.

Carlos Frías's icon

Thank you so much. This is what I was looking for. What I don't see working is the combination of both... I hope to fix it on my own, if not, I'll come back to you!

Thanks again for your time!

TFL's icon

If you set a crossfade value between 0. and 1. (like 0.5) it will mix both visuals.

Carlos Frías's icon

Exactly! I realized this shortly after.

Thanks again!

Carlos Frías's icon

Well, now I'm trying to add another video output to the main window but I'm having trouble...

I don't know if it's possible to merge all three or to display only one of them (depending on the needs)

Thanks, as always, in advance.

Max Patch
Copy patch and select New From Clipboard in Max.

TFL's icon

It really depends how you want to merge/blend them. You can use [switch] to choose which from the 3 sources will be displayed (only one at a time), but if you want to be able to blend sources with each other, then you need to give precision about how you want to blend them. Classic alphablend? Other kind of blendings? Only two by two? All three at the same time?

You can add a third inlet to jit.gl.pix so it can receive all of your three sources, and if you study a bit what I did in that jit.gl.pix you should be able to find how to mix the third input with the two others.

Also, jit.qt.movie is outdated. You want to use [jit.movie @output_texture 1] instead (no need for the [qmetro] either).

Carlos Frías's icon

Ops!

I hadn't noticed that jit.gl.pix was an object I could access... Until now I had been working with sound in Max and these are my first experiences with images: I'm a newbie!

I think I can do what I want now that I've been able to see how jit.gl.pix works; in fact the three videos already appear although I still have to find a way to combine them to my liking.

Thanks again for your time!