-
ContextI implement an IO connection matrix in my application with sources as columns and destinations as rows. It is possible to set up configurations in which any node is not ultimately connected (either directly or through a series of connections) to the graph endpoint node. I also use a custom MA "monitor" node for each node's input/output - this custom node is simply a passthrough that copies the frames on each data callback to a buffer of size Needs/Questions
What is the best way to determine whether any given node should expect its data callback to be called (whether it's "active" in the graph)? The two ways I've thought of are:
The first one seems tricky and heavy, especially since traversing through input buses is somewhat involved. The second one has the problem of needing a magic number for the duration where I'm confident calling a node inactive, especially when the definitive answer is known via method 1. Does this all sound right? Am I missing something in the API that would make my life easier? Or any other ideas? Thank you! |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments
-
I thought of a third way, which is basically doing (1), but with my application's connection matrix state instead of traversing the MA graph. I think I'll go this route for now, but still curious about any thoughts/suggestions! |
Beta Was this translation helpful? Give feedback.
-
Sorry for my exceptionally slow response to your questions. So miniaudio doesn't explicitly expose connection state retrieval APIs, the main reason being that the node graph is (mostly) lock-free while being thread-safe and as a result is rather non-trivial. A simple API like |
Beta Was this translation helpful? Give feedback.
-
Great, thanks! This approach worked out - I keep a connection adjacency list and do DFS on each node to see if there's a path to the graph endpoint node. |
Beta Was this translation helpful? Give feedback.
Sorry for my exceptionally slow response to your questions. So miniaudio doesn't explicitly expose connection state retrieval APIs, the main reason being that the node graph is (mostly) lock-free while being thread-safe and as a result is rather non-trivial. A simple API like
ma_node_is_connected()
is not quite a simple as it sounds. However, typically a program will be maintaining it's own state and will have some kind of knowledge of the connection status, such as whatever logic was used when deciding to callma_node_attach/detach_output_bus()
in the first place. That's what I'd recommend you do in you case, which sounds just like your third suggestion.