Open philipphunger opened 9 years ago
Hi Phillip, A bit delayed here on the reply, I'm aware. My apologies.
From the looks of it you're using the 'lib' branch (which is good, as it is the most up-to-date). Seeing as this was a personal experiment the documentation isn't great (not to mention the example is outdated), so I understand your confusion!
You must pass a callback function into the constructor, to be called when a beat is detected. This callback must take a 'BeatInfo' struct (as defined in Beat.h) as an argument — this struct contains some information regarding the number of peaks detected and the peak level of the beat (to be honest, I'm not all too sure why it is there, was probably using it for something at some point).
To make the example work:
Change:
BeatAnalyzer beatAnalyzer(&analyzer);
To:
BeatAnalyzer beatAnalyzer(&analyzer, &onBeat);
...And add a callback function somewhere in the program, along these lines:
void onBeat(BeatInfo info) {
// do stuff //
}
Hopefully, at some point, I will get around to cleaning up this codebase. Thanks!
Arduino: 1.6.1 (Windows 7), TD: 1.21, Platine: "Teensy 3.1, Serial, 72 MHz, German"
Verwende die Bibliothek Audio im Ordner: C:\Program Files (x86)\Arduino\hardware\teensy\avr\libraries\Audio (1.0.x format)
Verwende die Bibliothek Wire im Ordner: C:\Program Files (x86)\Arduino\hardware\teensy\avr\libraries\Wire (1.0.x format)
Verwende die Bibliothek SPI im Ordner: C:\Program Files (x86)\Arduino\hardware\teensy\avr\libraries\SPI (1.0.x format)
Verwende die Bibliothek SD im Ordner: C:\Program Files (x86)\Arduino\hardware\teensy\avr\libraries\SD (1.0.x format)
Verwende die Bibliothek BeatDetectionTeensy im Ordner: C:\Program Files (x86)\Arduino\libraries\BeatDetectionTeensy (1.0.x format)
C:\Program Files (x86)\Arduino/hardware/tools/arm/bin/arm-none-eabi-g++ -c -Os -g -Wall -ffunction-sections -fdata-sections -MMD -nostdlib -fno-exceptions -felide-constructors -std=gnu++0x -fno-rtti -mthumb -mcpu=cortex-m4 -DMK20DX256 -DTEENSYDUINO=121 -DARDUINO=10601 -DF_CPU=72000000 -DARDUINO_ARCH_AVR -DUSB_SERIAL -DLAYOUT_GERMAN -IC:\Program Files (x86)\Arduino\hardware\teensy\avr\cores\teensy3 -IC:\Program Files (x86)\Arduino\hardware\teensy\avr\libraries\Audio -IC:\Program Files (x86)\Arduino\hardware\teensy\avr\libraries\Wire -IC:\Program Files (x86)\Arduino\hardware\teensy\avr\libraries\SPI -IC:\Program Files (x86)\Arduino\hardware\teensy\avr\libraries\SD -IC:\Program Files (x86)\Arduino\libraries\BeatDetectionTeensy C:\Users\Philipp\AppData\Local\Temp\build8997784419104220277.tmp\BeatDetectionSimpleDemo.cpp -o C:\Users\Philipp\AppData\Local\Temp\build8997784419104220277.tmp\BeatDetectionSimpleDemo.cpp.o
BeatDetectionSimpleDemo.ino:22:36: error: no matching function for call to 'BeatAnalyzer::BeatAnalyzer(AudioAnalyzePeak*)'
BeatDetectionSimpleDemo.ino:22:36: note: candidates are:
In file included from BeatDetectionSimpleDemo.ino:7:0:
C:\Program Files (x86)\Arduino\libraries\BeatDetectionTeensy/Beat.h:27:5: note: BeatAnalyzer::BeatAnalyzer(AudioAnalyzePeak*, BeatAnalyzer::beat_callback)
C:\Program Files (x86)\Arduino\libraries\BeatDetectionTeensy/Beat.h:27:5: note: candidate expects 2 arguments, 1 provided
C:\Program Files (x86)\Arduino\libraries\BeatDetectionTeensy/Beat.h:18:7: note: constexpr BeatAnalyzer::BeatAnalyzer(const BeatAnalyzer&)
class BeatAnalyzer {
C:\Program Files (x86)\Arduino\libraries\BeatDetectionTeensy/Beat.h:18:7: note: no known conversion for argument 1 from 'AudioAnalyzePeak*' to 'const BeatAnalyzer&'
no matching function for call to 'BeatAnalyzer::BeatAnalyzer(AudioAnalyzePeak*)'