julesjulesjules
Member
Hi,
I'm having some trouble integrating the GDSTx library to send data streamed from the teensy audio library to a display. The two libraries work fine separately, but putting them in one project breaks everything. Right off the bat, they make calls to different SD.h libraries, but that was an easy fix since I don't need SD card access.
The real problem is that the moment I run GD.begin(), my record queue becomes all 0.00 values and will not fill up. I am using an I2S input object patched through to a recording queue.
I was wondering if anyone knows where to start with fixing this? Any ideas what might be causing this? I'm assuming they are using the same registers to store data?
I don't imagine it will help but I've included my code here anyway.
I'm having some trouble integrating the GDSTx library to send data streamed from the teensy audio library to a display. The two libraries work fine separately, but putting them in one project breaks everything. Right off the bat, they make calls to different SD.h libraries, but that was an easy fix since I don't need SD card access.
The real problem is that the moment I run GD.begin(), my record queue becomes all 0.00 values and will not fill up. I am using an I2S input object patched through to a recording queue.
I was wondering if anyone knows where to start with fixing this? Any ideas what might be causing this? I'm assuming they are using the same registers to store data?
I don't imagine it will help but I've included my code here anyway.
Code:
#include <ADC.h>
#include <queue>
#include <math.h>
#include <unordered_map>
#include <GDSTx.h>
#include <Audio.h>
#include <Wire.h>
#include <SPI.h>
struct Point {
float x,y;
unsigned long valueHash;
};
const int x_res = 1024;
const int y_res = 600;
const int ax_center[] = {x_res/2, y_res/2};
const double cosTheta = cos(45 * M_PI / 180.0);
const double sinTheta = sin(45 * M_PI / 180.0);
AudioInputI2S i2s1; //xy=151,200
AudioAnalyzePrint print1;
AudioRecordQueue leftqueue; //xy=362,195
AudioRecordQueue rightqueue; //xy=362,195
AudioConnection patchCord1(i2s1, 0, leftqueue, 0);
AudioConnection patchCord2(i2s1, 1, rightqueue, 0);
AudioConnection patchCord3(i2s1, 0, print1, 0);
std::unordered_map<long, int> plotcount;
std::queue<Point> measurementQueue;
void setup() {
AudioMemory(12);
GD.begin();
Serial.begin(9600);
}
void loop() {
leftqueue.clear();
rightqueue.clear();
leftqueue.begin();
rightqueue.begin();
while(leftqueue.available() < 6 && rightqueue.available() < 6){
;
}
leftqueue.end();
rightqueue.end();
for (int b = 1; b <= 6; b++){
int16_t rightinterim[256];
int16_t leftinterim[256];
memcpy(rightinterim,rightqueue.readBuffer(),256);
rightqueue.freeBuffer();
memcpy(leftinterim,leftqueue.readBuffer(),256);
leftqueue.freeBuffer();
for (int i=1;i<128;i++){
Point p;
p.x = rightinterim[i];
p.y = leftinterim[i];
p.valueHash = static_cast<long>(p.x, p.y);
plotcount[p.valueHash] = 0;
Serial.print(p.x);
Serial.print(", ");
Serial.println(p.y);
Serial.print(p.x);
Serial.print(", ");
Serial.println(p.y);
measurementQueue.push(p); //
}
}
while (!measurementQueue.empty()) {
Point p = measurementQueue.front();
measurementQueue.pop();
}
plotcount.clear();
}