38 lines
941 B
C++
38 lines
941 B
C++
#include <VulcanoLE/Audio/VisAudioRunner.h>
|
|
#include <VUtils/Logging.h>
|
|
|
|
VisAudioRunner::VisAudioRunner(AudioGrabber *ag, VIZ::VisPlugins *vp) : grabber(ag), plugins(vp) {}
|
|
|
|
VisAudioRunner::~VisAudioRunner() {
|
|
delete plugins;
|
|
delete grabber;
|
|
}
|
|
|
|
VisAudioRunner *VisAudioRunner::create() {
|
|
return new VisAudioRunner(AudioGrabber::createAudioGrabber(), new VIZ::VisPlugins());
|
|
}
|
|
|
|
|
|
void VisAudioRunner::init() {
|
|
grabber->env = env;
|
|
plugins->env = env;
|
|
grabber->init();
|
|
plugins->on_startup();
|
|
LOG("Create Visual Audio Runner Thread")
|
|
thread = std::thread(&VisAudioRunner::run, this);
|
|
}
|
|
|
|
void VisAudioRunner::run() const {
|
|
usleep(5000);
|
|
while (isActive) {
|
|
if (grabber->doWork()) {
|
|
plugins->on_tick();
|
|
} else {
|
|
std::this_thread::sleep_for(std::chrono::milliseconds(100ul));
|
|
}
|
|
}
|
|
usleep(50000);
|
|
DBG("SHUTDOWN HOOk")
|
|
plugins->on_shutdown();
|
|
}
|