NodeMixer32
[ NODE_MIXER32 ]
+--------------------+
| |
IN00--| SIGNAL_00 SIGNAL |--OUT00
IN01--| SIGNAL_01 |
IN02--| SIGNAL_02 |
IN03--| SIGNAL_03 |
IN04--| SIGNAL_04 |
IN05--| SIGNAL_05 |
IN06--| SIGNAL_06 |
IN07--| SIGNAL_07 |
IN08--| SIGNAL_08 |
IN09--| SIGNAL_09 |
IN10--| SIGNAL_0A |
IN11--| SIGNAL_0B |
IN12--| SIGNAL_0C |
IN13--| SIGNAL_0D |
IN14--| SIGNAL_0E |
IN15--| SIGNAL_0F |
IN16--| SIGNAL_10 |
IN17--| SIGNAL_11 |
IN18--| SIGNAL_12 |
IN19--| SIGNAL_13 |
IN20--| SIGNAL_14 |
IN21--| SIGNAL_15 |
IN22--| SIGNAL_16 |
IN23--| SIGNAL_17 |
IN24--| SIGNAL_18 |
IN25--| SIGNAL_19 |
IN26--| SIGNAL_1A |
IN27--| SIGNAL_1B |
IN28--| SIGNAL_1C |
IN29--| SIGNAL_1D |
IN30--| SIGNAL_1E |
IN31--| SIGNAL_1F |
| |
+--------------------+
this nodes mixes 32 incoming signal into 1. it also allows to define the mix value for each incoming signal.
/*
* this example demonstrates how to mix 32 signals into a single signal.
*/
#include "Klangstrom.h"
#include "KlangNodes.hpp"
using namespace klang;
using namespace klangstrom;
static const uint8_t NUM_OF_OSC = NodeMixer32::NUM_CH_IN;
NodeDAC mDAC;
NodeVCOWavetable mOSC[NUM_OF_OSC];
NodeMixer32 mMixer;
void setup() {
for (uint8_t i = 0; i < NUM_OF_OSC; ++i) {
Klang::connect(mOSC[i], Node::CH_OUT_SIGNAL, mMixer, i);
}
Klang::connect(mMixer, Node::CH_OUT_SIGNAL, mDAC, NodeDAC::CH_IN_SIGNAL);
for (uint8_t i = 0; i < NUM_OF_OSC; ++i) {
const float mOffset = 0.02;
mOSC[i].set_frequency(DEFAULT_FREQUENCY * ((NUM_OF_OSC - i) + mOffset));
mOSC[i].set_amplitude(0.5f / NUM_OF_OSC);
mOSC[i].set_waveform(NodeVCOWavetable::WAVEFORM::SINE);
}
}
void loop() {}
void audioblock(float* output_signal[LEFT], float* output_signal[RIGHT],
float* input_signal[LEFT], float* input_signal[RIGHT]) {
mDAC.process_frame(output_signal[LEFT], output_signal[RIGHT]);
}