I have a question: I’m actually working to a sort of mixer which permits to reproduce audio files and MIDI output. Is there a way to add a node through the definition of a pointer, in order to access the custom variables inside the node’s class, aside from the AudioParameters fields?
For example, is there a way to perform something like this?:
Where idx is the channel of my mixer, and juce::ReferenceCountedArray<Node> nodesForMixer is a ReferenceCountedArray defined in my main audio processor header.
I’m unsure of what you’re really trying to do because it isn’t explained in too much detail, but what I can gather is you want to pass an object “mixer_object” to your mixer as a pointer?
Is there a reason you don’t want to deference it like
Hello HurricaneAudio. First of all, thank you for answering this post
You’re right! I corrected immediately the name of the class!
I know, but actually I would like to mantain the pointer “externally”, in order to access it and modify the variables inside my class later during the execution of my program.
I’m developing a program able to perform the following things:
To instantiate music by reading randomly in a folder some files written by a musician
To instantiate a MIDI loop by reading the UV information of the visible constellations contained in a database. This task is accomplished through a Python script.
Once all the requested tracks are added to the AudioSourceGraph, I would like to access the classes contained inside the nodes for modifying some parameters during the execution of the program (e.g.: the file read by the MixerChannel track or the UV information that has to be sonified by the “Constellation” track).
I hope that this could give you some hints.
E.g.: once added a node in my graph, like insert(*aNode<aClass>), I would like to access later the class aClass of that node. I implemented the addition of the node through the exploitation of a juce::ReferenceCountedArray<Node> since I read the tutorial on the AudioProcessorGraph available here: https://docs.juce.com/master/tutorial_audio_processor_graph.html
So: there’s no way to access the variables of the class inside the node. The only way is to declare AudioParameters variables and then use the getProcessor() -> getParameters() method: is it correct?
Yeah, I would like to obtain a pointer which remains external to the node, in order to access the class added to the node later.
However, with your code I get the following error: “there’s no conversion from std::unique_ptr<MixerChannel, std::default_delete<MixerChannel>> to std::unique_ptr<juce::AudioProcessor, std::default_delete<AudioProcessor>> defined by the user”
I think you have to reveal more of your code. What is mainProcessor e.g? I thought it was an audioProcessor of some kind, but as far as I can see, juce::AudioProcessor doesn’t have a member called addNode(), so I’m a little lost here…
Oh I thought so, but wasn’t sure. If you omit the class name of you variables it’s a good thing to name them after their classes, like mainAudioProcessorgraph or just audioProcessorgraph in short code excerpts.
Why are you using a ReferenceCountedArray for nodesForMixer? The nodes are already handled by the AudioProcessorGraph. Why not use an ordinary juce::Array or a std::vector instead?