You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm currently trying to get some simple modular synth running using dasp_graph.
For that it would be required, to be able to distinguish the inputs of a node in the method, computing the node.
Seeing, that the definition of input currently looks like this:
/// A reference to another node that is an input to the current node. ////// *TODO: It may be useful to provide some information that can uniquely identify the input node./// This could be useful to allow to distinguish between side-chained and regular inputs for /// example.*pubstructInput{buffers_ptr:*constBuffer,buffers_len:usize,}
was a bit unfortunate.
I dug around a little and pentagraph supports EdgeWeights, wich are generics, that can hold information on the edge.
It would be nice to be able to define EdgeWeights when creating the graph and have them put into the input.
I tried around, but the process method does not directly use the graph, so I'm a bit stuck.
The edge_weight() function is available, so if one could get the edge_id, the data can be read.
However, I don't see a possibility to get the edge_id as the find_edge() function is not available.
pubfnprocess<G,T>(processor:&mutProcessor<G>,graph:&mutG,node:G::NodeId)whereG:Data<NodeWeight = NodeData<T>> + DataMapMut + Visitable,for<'a>&'a G:GraphBase<NodeId = G::NodeId> + IntoNeighborsDirected,T:Node,{constNO_NODE:&str = "no node exists for the given index";
processor.dfs_post_order.reset(Reversed(&*graph));
processor.dfs_post_order.move_to(node);whileletSome(n) = processor.dfs_post_order.next(Reversed(&*graph)){let data:*mutNodeData<T> = graph.node_weight_mut(n).expect(NO_NODE)as*mut_;
processor.inputs.clear();for in_n in(&*graph).neighbors_directed(n,Incoming){// Skip edges that connect the node to itself to avoid aliasing `node`.if n == in_n {continue;}// ADDED Get Edge Informationlet edgeId = graph.find_edge(in_n, n).unwrap();// this is not availablelet edge_weight = graph.edge_weight(edgeId);let input_container = graph.node_weight(in_n).expect(NO_NODE);let input = node::Input::new(&input_container.buffers);// The EdgeWeight would be added to this constructor
processor.inputs.push(input);}// Here we deference our raw pointer to the `NodeData`. The only references to the graph at// this point in time are the input references and the node itself. We know that the input// references do not alias our node's mutable reference as we explicitly check for it while// looping through the inputs above.unsafe{(*data).node.process(&processor.inputs,&mut(*data).buffers);}}}
If somebody can point me in the right direction, I would gladly finish this up and prepare a pull request.
Or if somebody has already solved this in a different way, that would also be great to hear.
The text was updated successfully, but these errors were encountered:
If I remember correctly, the order of the Input is the reverse of the connecting order.
So, inputs[0] would be the latest connected one.
Of course, you also need to experiment on the direction of add_edge() to make it right.
I agree that the docs should cover that part and an optional unique ID would be great.
I'm currently trying to get some simple modular synth running using dasp_graph.
For that it would be required, to be able to distinguish the inputs of a node in the method, computing the node.
Seeing, that the definition of input currently looks like this:
was a bit unfortunate.
I dug around a little and pentagraph supports EdgeWeights, wich are generics, that can hold information on the edge.
It would be nice to be able to define EdgeWeights when creating the graph and have them put into the input.
I tried around, but the process method does not directly use the graph, so I'm a bit stuck.
The
edge_weight()
function is available, so if one could get theedge_id
, the data can be read.However, I don't see a possibility to get the
edge_id
as thefind_edge()
function is not available.If somebody can point me in the right direction, I would gladly finish this up and prepare a pull request.
Or if somebody has already solved this in a different way, that would also be great to hear.
The text was updated successfully, but these errors were encountered: