Thanks Paul for the quick response. In configuring the patch cords and declaring the usb1 object, I'm getting these errors stating usb1 was not declared in this scope:
API_Version_Serial14:41: error: 'usb1' was not declared in this scope
AudioConnection patchCord5(usb1, 0, mixer1, 2);
API_Version_Serial14:42: error: 'usb1' was not declared in this scope
AudioConnection patchCord6(usb1, 1, mixer1, 3);
Include & GUItool patches:
#include <Arduino.h>
#include <XPT2046_Touchscreen.h> //New
#include <ILI9341_t3.h>
#include <font_Arial.h> // from ILI9341_t3
#include <font_ArialBold.h> // from ILI9341_t3
#include <Audio.h> //Audio Library
#include <Wire.h>
#include <SPI.h> //For LCD display
#include <SD.h> //For SD Card
#include <SerialFlash.h>
#include <EEPROM.h>
#include <XBee.h> //Using serial for XBee instead
//#include <TimeLib.h> //For internal Real Time Clock
#include <Bounce.h>
// GUItool: begin automatically generated code
AudioPlaySdWav playSdWav1; //xy=251,269
AudioPlaySdRaw playRaw1; //xy=261,417
AudioInputUSB usb1; //xy=266,336
AudioMixer4 mixer1; //xy=465,306
AudioMixer4 mixer2; //xy=465,380
AudioInputI2S i2s2; //xy=469,508
AudioRecordQueue queue1; //xy=655,502
AudioMixer4 mixer3; //xy=774,326
AudioOutputI2S i2s1; //xy=972,255
AudioAnalyzeFFT1024 fft1024_1; //xy=973,326
AudioConnection patchCord1(playSdWav1, 0, mixer1, 0);
AudioConnection patchCord2(playSdWav1, 1, mixer1, 1);
AudioConnection patchCord3(playRaw1, 0, mixer2, 0);
AudioConnection patchCord4(playRaw1, 0, mixer2, 1);
AudioConnection patchCord5(usb1, 0, mixer1, 2);
AudioConnection patchCord6(usb1, 1, mixer1, 3);
AudioConnection patchCord7(mixer1, 0, mixer3, 0);
AudioConnection patchCord8(mixer1, 0, mixer3, 1);
AudioConnection patchCord9(mixer2, 0, mixer3, 2);
AudioConnection patchCord10(mixer2, 0, mixer3, 3);
AudioConnection patchCord11(i2s2, 0, queue1, 0);
AudioConnection patchCord12(mixer3, fft1024_1);
AudioConnection patchCord13(mixer3, 0, i2s1, 0);
AudioConnection patchCord14(mixer3, 0, i2s1, 1);
AudioControlSGTL5000 sgtl5000_1; //xy=467,449
// GUItool: end automatically generated code
Do I need to declare usb1 as equating to some input device like the Serial port or something else? I thought the GUItool declaration was enough, but obviously I'm missing something. The mixer gain control takes place in a subroutine below:
void configMixer() {
if (Audio_Input == 0) { //Change audio input selection to SD Card
tft.setCursor(140, 175);
tft.print("SD"); //Display SD card input setting
mixer1.gain(0, 0.7); //SD left input
mixer1.gain(1, 0.7); //SD right input
mixer1.gain(2, 0.0); //Turn off left USB input
mixer1.gain(3, 0.0); //Turn off right USB input
mixer2.gain(0, 0.0); //Turn off playRaw left input
mixer2.gain(1, 0.0); //Turn off playRaw right input
mixer3.gain(0, 0.7); //SD combined playRaw input
mixer3.gain(1, 0.7); //Turn off playRaw input
mixer3.gain(2, 0.0); //SD combined playRaw input
mixer3.gain(3, 0.0); //Turn off playRaw input
Serial.println("SD input");
}
else if (Audio_Input == 1) { //Change audio input selection to Line
tft.setCursor(130, 175);
tft.print("LINE"); //Display audio line input setting
mixer1.gain(0, 0.0); //SD left input
mixer1.gain(1, 0.0); //SD right input
mixer1.gain(2, 0.0); //Turn off left USB input
mixer1.gain(3, 0.0); //Turn off right USB input
mixer2.gain(0, 0.7); //Turn off playRaw left input
mixer2.gain(1, 0.7); //Turn off playRaw right input
mixer3.gain(0, 0.0); //SD combined playRaw input
mixer3.gain(1, 0.0); //Turn off playRaw input
mixer3.gain(2, 0.7); //SD combined playRaw input
mixer3.gain(3, 0.7); //Turn off playRaw input
Serial.println("Line input");
}
else { //Else audio input must be USB
tft.setCursor(135, 175);
tft.print("USB"); //Display USB input setting
mixer1.gain(0, 0.0); //SD left input
mixer1.gain(1, 0.0); //SD right input
mixer1.gain(2, 0.7); //Turn off left USB input
mixer1.gain(3, 0.7); //Turn off right USB input
mixer2.gain(0, 0.0); //Turn off playRaw left input
mixer2.gain(1, 0.0); //Turn off playRaw right input
mixer3.gain(0, 0.0); //SD combined playRaw input
mixer3.gain(1, 0.0); //Turn off playRaw input
mixer3.gain(2, 0.7); //SD combined playRaw input
mixer3.gain(3, 0.7); //Turn off playRaw input
Serial.println("USB input");
}
}
I would post the code, but the sketch is almost 7,000 lines. The SD input works fine, but the audio line input has not been tested yet (I'm sure it will).