Compare commits
No commits in common. "dacb8d820d721dbc18a441c69ee6c399951dc77e" and "60da6c131aa4115b5a0d72b0441285feced4169a" have entirely different histories.
dacb8d820d
...
60da6c131a
|
@ -51,9 +51,6 @@ Ergodox& Ergodox::init(
|
|||
return Instance;
|
||||
}
|
||||
|
||||
|
||||
// Instance is a static function variable,
|
||||
// and will be deleted at end of program.
|
||||
Ergodox::~Ergodox() {
|
||||
close();
|
||||
hid_exit();
|
||||
|
|
|
@ -43,9 +43,9 @@ class FFT_Visualizer {
|
|||
// Visualizer parameters
|
||||
///
|
||||
|
||||
// Horizontal resolution
|
||||
// How many bars this visualizer will generate
|
||||
const size_t width;
|
||||
// Vertical resolution
|
||||
// Resolution of this visualizer's bars.
|
||||
const size_t height;
|
||||
// Leftmost frequency in spectrum
|
||||
const double HZ_MIN;
|
||||
|
|
46
src/test.cpp
46
src/test.cpp
|
@ -44,25 +44,7 @@ const size_t height = 150;
|
|||
|
||||
int main(int argc, char *argv[]) {
|
||||
|
||||
// buffer size for waveform:
|
||||
// (44100 / fps * 10), make 10 bigger for slower scrolling
|
||||
//
|
||||
// Double both buffer sizes if stereo
|
||||
|
||||
// FFT generator
|
||||
FFT_Visualizer fft = FFT_Visualizer(
|
||||
width, height,
|
||||
100, 10000
|
||||
);
|
||||
|
||||
// Audio buffer
|
||||
Buffer buf = Buffer(
|
||||
"/tmp/mpd.fifo",
|
||||
44100 / 2, // Keep 500ms of data in buffer
|
||||
fft.compute_buffer_output_size()
|
||||
);
|
||||
|
||||
// HID interface wrapper
|
||||
uint8_t hid_buf[20];
|
||||
Ergodox Dox = Ergodox::init(
|
||||
0x3297,
|
||||
0x4976,
|
||||
|
@ -70,13 +52,34 @@ int main(int argc, char *argv[]) {
|
|||
0xFF60
|
||||
);
|
||||
|
||||
// Data buffer
|
||||
uint8_t hid_buf[12];
|
||||
// buffer size for waveform:
|
||||
// (44100 / fps * 10), make 10 bigger for slower scrolling
|
||||
//
|
||||
// Double both buffer sizes if stereo
|
||||
|
||||
FFT_Visualizer fft = FFT_Visualizer(
|
||||
width, height,
|
||||
100, 10000
|
||||
);
|
||||
|
||||
std::vector<size_t> waveform;
|
||||
waveform.resize(width);
|
||||
|
||||
Buffer buf = Buffer(
|
||||
"/tmp/mpd.fifo",
|
||||
//"/home/mark/Workbench/sospi/pulse.fifo",
|
||||
44100 / 2, // Keep 500ms of data in buffer
|
||||
fft.compute_buffer_output_size()
|
||||
);
|
||||
|
||||
Bitmap b = Bitmap(width, height);
|
||||
|
||||
while (1) {
|
||||
//b.clear();
|
||||
buf.update();
|
||||
fft.update(buf);
|
||||
//draw_spectrum_bitmap(fft.get_output(), b);
|
||||
//b.save("/tmp/o.bmp");
|
||||
|
||||
hid_buf[0] = 0x01;
|
||||
hid_buf[1] = 0x02;
|
||||
|
@ -89,6 +92,5 @@ int main(int argc, char *argv[]) {
|
|||
|
||||
Dox.write(hid_buf, 12);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
Loading…
Reference in New Issue