Hello,
This is my first post here and it is probably more a question related to general object-oriented coding practices then it is to the audio library specifically, but I'm hoping someone might be able to give me some guidance, point me in the right direction, or let me know if I am spinning my wheels. I normally program PLC's (please don't judge) and have done some C programming, but C++ and true OOP are fairly new to me. I haven't had any luck searching through the forum but that might be because I am not 100% sure what I am searching for.
What I am hoping to accomplish is to create a new object (most likely extending AudioStream as new objects are normally created) that encapsulates several other AudioStream/AudioConnection class objects for use in a larger project. To test this I have created a small test project where the new object would basically be a mixer with each of the inputs being fed through a filter with the same fc (as attached). This application itself is of no use to me (or anyone probably) but I am using it as a POP before trying to tackle a more difficult application.
I am stuck on the implementation of the new object (AudioFilteredMixer), I niavely thought I could just use AudioConnections in my class declaration but the compiler does not agree with this:
I am also confuse don how to make the connections from the inputs of my new object to the inputs of the existing objects that I hope to use within. Is what I am trying to do possible? or am I going about this all wrong? I think the picture probably gives the most clear explanation of what I am looking to accomplish, I'm sure my explanation could be a bit more clear but I am running on fumes tonight.
Full source code is attached, I had just started the implementation of this new object. I sandwiched most of it into the one file for testing purposes. I am using a Teensy 4.0 with Blackaddr audio shield (WM8731). Thanks for reading!
View attachment main.cpp
This is my first post here and it is probably more a question related to general object-oriented coding practices then it is to the audio library specifically, but I'm hoping someone might be able to give me some guidance, point me in the right direction, or let me know if I am spinning my wheels. I normally program PLC's (please don't judge) and have done some C programming, but C++ and true OOP are fairly new to me. I haven't had any luck searching through the forum but that might be because I am not 100% sure what I am searching for.
What I am hoping to accomplish is to create a new object (most likely extending AudioStream as new objects are normally created) that encapsulates several other AudioStream/AudioConnection class objects for use in a larger project. To test this I have created a small test project where the new object would basically be a mixer with each of the inputs being fed through a filter with the same fc (as attached). This application itself is of no use to me (or anyone probably) but I am using it as a POP before trying to tackle a more difficult application.
I am stuck on the implementation of the new object (AudioFilteredMixer), I niavely thought I could just use AudioConnections in my class declaration but the compiler does not agree with this:
Code:
private:
float _freq; //gain of both filters
float _gain; //gain of both mixer inputs
AudioFilterStateVariable _filter2; //xy=480.00001525878906,737.0000228881836
AudioFilterStateVariable _filter1; //xy=487,626
AudioMixer4 _mixer1; //xy=690.0000152587891,657.0000190734863
AudioConnection _patchCord5(_filter2, 1, _mixer1, 1); //<-- This doesn't work, "_filter2(etc) is not a type name" error
AudioConnection _patchCord6(_filter1, 1, _mixer1, 0); //<-- This doesn't work
audio_block_t *inputQueueArray[2];
I am also confuse don how to make the connections from the inputs of my new object to the inputs of the existing objects that I hope to use within. Is what I am trying to do possible? or am I going about this all wrong? I think the picture probably gives the most clear explanation of what I am looking to accomplish, I'm sure my explanation could be a bit more clear but I am running on fumes tonight.
Full source code is attached, I had just started the implementation of this new object. I sandwiched most of it into the one file for testing purposes. I am using a Teensy 4.0 with Blackaddr audio shield (WM8731). Thanks for reading!
View attachment main.cpp