#include <Audio.h>
#include <RA8875.h>
AudioInputI2S AudioIn;
AudioOutputI2S AudioOut;
AudioMixer4 AudioMixer;
AudioRecordQueue AudioStream;
AudioConnection patchCord1(AudioIn, 0, AudioMixer, 0);
AudioConnection patchCord2(AudioIn, 1, AudioMixer, 1);
AudioConnection patchCord3(AudioIn, 0, AudioOut, 0);
AudioConnection patchCord4(AudioIn, 1, AudioOut, 1);
AudioConnection patchCord6(AudioMixer, AudioStream);
AudioControlSGTL5000 audioShield;
RA8875 tft = RA8875(20, 2, 7, 14, 8);
void setup() {
tft.begin(RA8875_800x480);
AudioMemory(50);
audioShield.enable();
audioShield.inputSelect(AUDIO_INPUT_LINEIN);
AudioStream.begin();
}
void loop() {
int16_t x, y, mybuffer[128];
if (AudioStream.available() >= 1) {
memcpy(mybuffer, AudioStream.readBuffer(), 256);
AudioStream.freeBuffer();
tft.fillWindow(RA8875_BLACK);
for (x=0; x<128; ++x) {
y = map(mybuffer[x], -32768, 32767, 0, tft.height()-1);
tft.drawPixel(x,y, RA8875_WHITE);
}
}
}