initial commit
This commit is contained in:
35
main.cpp
Executable file
35
main.cpp
Executable file
@@ -0,0 +1,35 @@
|
||||
#include "pulseaudio.h"
|
||||
|
||||
#include "BeatDetection2.h"
|
||||
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
|
||||
PulseAudio pa;
|
||||
//pa.join();
|
||||
|
||||
int16_t buf[1024];
|
||||
|
||||
BeatDetection2<float> bestBass(Mode::BASS);
|
||||
BeatDetection2<float> beatSnare(Mode::SNARE);
|
||||
|
||||
while(true) {
|
||||
|
||||
pa.read(buf, 1024);
|
||||
|
||||
for (int i = 0; i < 1024; ++i) {
|
||||
const float left = buf[i];
|
||||
const float right = buf[i];
|
||||
|
||||
const bool bBass = bestBass.add(left, right);
|
||||
if (bBass) {std::cout << "bass\n" << std::flush;}
|
||||
|
||||
const bool bSnare = beatSnare.add(left, right);
|
||||
if (bSnare) {std::cout << "snare...\n" << std::flush;}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user