Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add functions to draw multichannel connections #2059

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

charlesneimog
Copy link
Contributor

As recommended by @Spacechild1 in #1997 and #2057...

There is a need to redraw the connections after the DSP is turned on.

mc-connects.mp4

src/m_obj.c Outdated Show resolved Hide resolved
@Spacechild1
Copy link
Contributor

Don't forget to redraw all canvases after a DSP graph update, probably at the end of canvas_start_dsp.

@charlesneimog charlesneimog force-pushed the mc-connections-draw branch 3 times, most recently from 7e021a1 to c23a330 Compare July 11, 2023 20:35
@sebshader
Copy link
Contributor

is it possible to just redraw the lines? redrawing the entire canvas seems like overkill

@sebshader
Copy link
Contributor

sebshader commented Jul 11, 2023

seems like it would be better if object authors could just set the number of channels for an outlet, then whenever the number of channels changes for that outlet just the connections for that outlet can be redrawn (without having to do redrawing everything when the graph gets updated which seems like a lot of extra computer work)
But tbh I haven't familiarized myself w/ the multichannel architecture at all

@Spacechild1
Copy link
Contributor

is it possible to just redraw the lines? redrawing the entire canvas seems like overkill

Sure. That would be even better! I don't immediately see a function for this, but we could add canvas_updatelines, based on canvas_drawlines, and call it recursively on all (visible) canvases.

seems like it would be better if object authors could just set the number of channels for an outlet, then whenever the number of channels changes for that outlet just the connections for that outlet can be redrawn (without having to do redrawing everything when the graph gets updated which seems like a lot of extra computer work)

Hmmm. Objects call signal_setmultiout with the desired channel count in the "dsp" method. In theory, when we call obj_sigoutletsetchans in ugen_doit, we could compare it against the previous channel count and send a message to the GUI to change the line width. However, I'm not sure if we should really send graphics updates from within the DSP sorting routine...

But tbh I haven't familiarized myself w/ the multichannel architecture at all

You should ;-)

@Spacechild1 Spacechild1 changed the title Add functions to draw multichannel connections, see #1997 Add functions to draw multichannel connections Jul 12, 2023
@Spacechild1 Spacechild1 added the improvement improves an existing functionality without adding new features label Jul 12, 2023
@sebshader
Copy link
Contributor

sebshader commented Jul 12, 2023

It seems like object authors could call a function to set the channel count (whether dsp is running or not). That would set the number of channels in t_outlet, redraw the cables if necessary, re-make the dsp graph if dsp is running etc.
then when the dsp graph gets made pd can use that channel count (and call obj_sigoutletsetchans or whatever)

@Spacechild1
Copy link
Contributor

Spacechild1 commented Jul 12, 2023

It seems like object authors could call a function to set the channel count (whether dsp is running or not). That would set the number of channels in t_outlet

That's not how it works. Most objects derive the output channel count from the input(s), in which case the "dsp" method is the only place to set the channel count (via signal_setmultiout).

@sebshader
Copy link
Contributor

sebshader commented Jul 12, 2023

hmm well maybe it should just be based on if it's 'multi-aware' then.. but I'll refrain from further suggestions until I actually look at it, haven't found the time yet

@Spacechild1
Copy link
Contributor

maybe it should just be based on if it's 'multi-aware' then..

I don't think that would be particularly useful.

Actually, I have already proposed several solutions for updating the cables based on the actual channel count. Maybe let's just give it a try?

@sebshader
Copy link
Contributor

I guess I was trying to find ways to avoid a redraw of every canvas (or even every connection) when the dsp gets turned on. (also, would cables not look multichannel until dsp is turned on? that would be a bit odd imo)

@Spacechild1
Copy link
Contributor

I guess I was trying to find ways to avoid a redraw of every canvas

I think I have proposed a solution in #2059 (comment)

(also, would cables not look multichannel until dsp is turned on? that would be a bit odd imo)

Signal outlets only get their channel count in the "dsp" method, so naturally they can't appear as multichannel before DSP is turned on.

@porres
Copy link
Contributor

porres commented May 6, 2024

Hi, why is this still a draft? Can we try and make it a final proposal for the upcoming 0.55 release?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
improvement improves an existing functionality without adding new features
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants