36 lines
725 B
C++
Executable File
36 lines
725 B
C++
Executable File
#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;}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
}
|