Permalink
Find file
Fetching contributors…
Cannot retrieve contributors at this time
22 lines (17 sloc) 390 Bytes
#include "fifo.h"
using namespace std;
void setFifo()
{
fifo = open(FIFO_PATH, O_RDONLY | O_NONBLOCK);
}
int* getFifo(int windowHeight)
{
int16_t buf[1024];
ssize_t data = read(fifo, &buf, sizeof(buf));
if (data != -1) {
for (int i = 0; i < 1024; i++) {
freqPercent[i] = (buf[i] / 2e4) * (windowHeight / 5);
}
}
return freqPercent;
}