I've used the audio library before and had trouble when pasting the init code in another .hpp file, other than main.cpp
By init code I mean the code the audio library generates:
I'd rather put it in a separate audioController.hpp file and use it in audioController.cpp as to organise my project well.
Last time I've fixed this by passing pointers of all audio instances into the constructor of the audioController.
Now before starting to work on the audio part of this rather large project I wonder if anyone else has come across this and maybe has a solution for it.
Thanks in advance
By init code I mean the code the audio library generates:
Code:
#include <Audio.h>
#include <Wire.h>
#include <SPI.h>
#include <SD.h>
#include <SerialFlash.h>
// GUItool: begin automatically generated code
AudioInputI2S i2s2; //xy=128,351
AudioSynthWaveformSine sine1; //xy=221,562
AudioMixer4 mixer1; //xy=282,369
AudioSynthWaveformSineModulated sine_fm1; //xy=409,553
AudioAnalyzePeak peak1; //xy=410,336
AudioEffectDelay delay1; //xy=603,418
AudioEffectFreeverb freeverb1; //xy=720,280
AudioMixer4 mixer2; //xy=918,300
AudioOutputI2S i2s1; //xy=1102,294
AudioOutputUSB usb1; //xy=1108,353
AudioConnection patchCord1(i2s2, 0, mixer1, 0);
AudioConnection patchCord2(i2s2, 1, mixer1, 1);
AudioConnection patchCord3(sine1, delay1);
AudioConnection patchCord4(mixer1, peak1);
AudioConnection patchCord5(sine_fm1, delay1);
AudioConnection patchCord6(delay1, 0, freeverb1, 0);
AudioConnection patchCord7(delay1, 0, mixer2, 1);
AudioConnection patchCord8(freeverb1, 0, mixer2, 0);
AudioConnection patchCord9(mixer2, 0, i2s1, 0);
AudioConnection patchCord10(mixer2, 0, i2s1, 1);
AudioConnection patchCord11(mixer2, 0, usb1, 0);
AudioConnection patchCord12(mixer2, 0, usb1, 1);
AudioControlSGTL5000 sgtl5000_1; //xy=136,157
// GUItool: end automatically generated code
I'd rather put it in a separate audioController.hpp file and use it in audioController.cpp as to organise my project well.
Last time I've fixed this by passing pointers of all audio instances into the constructor of the audioController.
Now before starting to work on the audio part of this rather large project I wonder if anyone else has come across this and maybe has a solution for it.
Thanks in advance