Initial Commit
This commit is contained in:
commit
c13016275b
41 changed files with 3596 additions and 0 deletions
70
main.cpp
Normal file
70
main.cpp
Normal file
|
|
@ -0,0 +1,70 @@
|
|||
#include <unistd.h>
|
||||
#include <iostream>
|
||||
#include <VulcanoLE/API/HIDHelper.h>
|
||||
#include <VUtils/Logging.h>
|
||||
#include <csignal>
|
||||
#include <VulcanoLE/Audio/VisAudioRunner.h>
|
||||
#include <VUtils/Environment.h>
|
||||
|
||||
bool shouldRun = true;
|
||||
void my_handler(int s) {
|
||||
printf("Caught signal %d\n", s);
|
||||
shouldRun = false;
|
||||
}
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
// signal handler!
|
||||
struct sigaction sigIntHandler;
|
||||
sigIntHandler.sa_handler = my_handler;
|
||||
sigemptyset(&sigIntHandler.sa_mask);
|
||||
sigIntHandler.sa_flags = 0;
|
||||
sigaction(SIGINT, &sigIntHandler, nullptr);
|
||||
// Load Config...
|
||||
VUtils::Environment config{VUtils::FileHandler::getFromHomeDir("/.config/VulcanoLE/state.env").c_str()};
|
||||
config.loadFile();
|
||||
LOG(R"(
|
||||
|
||||
[===============================================]
|
||||
_ _ _ _ _ _ _ _ _
|
||||
/ \ / \ / \ / \ / \ / \ / \ / \ / \
|
||||
( V | U | L | C | A | N | O ) ( L | E )
|
||||
\_/ \_/ \_/ \_/ \_/ \_/ \_/ \_/ \_/
|
||||
[===============================================]
|
||||
)")
|
||||
HIDHelper helper{};
|
||||
if (helper.openDevices() < 0) {
|
||||
ERR("Unable to find Keyboard!")
|
||||
exit(0);
|
||||
};
|
||||
usleep(10000);
|
||||
auto runner = VisAudioRunner::create();
|
||||
runner->env = &config;
|
||||
runner->plugins->init(&helper, runner->grabber);
|
||||
runner->init();
|
||||
runner->plugins->setCurrentMode(config.getAsInt("visual_mode", 1));
|
||||
while (shouldRun) {
|
||||
int mode;
|
||||
LOGWN("Enter Visual Mode: %d-%d < 0 = EXIT:\t", 0, 1)
|
||||
std::cin >> mode;
|
||||
if (std::cin.fail()) {
|
||||
ERR("ERROR -- You did not enter an integer")
|
||||
std::cin.clear();
|
||||
std::cin.ignore(std::numeric_limits<std::streamsize>::max(), '\n');
|
||||
continue;
|
||||
}
|
||||
if (mode < 0) {
|
||||
shouldRun = false;
|
||||
continue;
|
||||
}
|
||||
runner->plugins->setCurrentMode(mode);
|
||||
}
|
||||
DBG("Shutdown... Waiting for Thread to Finish!")
|
||||
runner->isActive = false;
|
||||
if (runner->thread.joinable()) {
|
||||
runner->thread.join();
|
||||
}
|
||||
DBG("Exit!")
|
||||
usleep(1000);
|
||||
config.saveFile();
|
||||
return 0;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue