-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.cpp
61 lines (49 loc) · 1.77 KB
/
main.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#include <boost/program_options.hpp>
#include <iostream>
#include <opencv2/opencv.hpp>
#include <string>
#include "AudioLoopbackWorker.h"
#include "FftWorker.h"
#include "Logger.h"
#include "MuviConfig.h"
#include "RendererWorker.h"
namespace po = boost::program_options;
int main(int argc, char** argv) {
Muvi::renderer_config_t config;
po::options_description desc("Allowed options");
desc.add_options()
("help", "print usage message")
("debug", "Enable additional logs")
("color",
po::value<int>(&config.colormap)->default_value(DEFAULT_COLORMAP),
"Color map to use. Range 0-21. See OpenCV 4.7.0-dev documentation "
"https://docs.opencv.org/4.x/d3/d50/group__imgproc__colormap.html")
("width", po::value<int>(&config.width)->default_value(DEFAULT_WIDTH),
"Width of the window")
("height",
po::value<int>(&config.height)->default_value(DEFAULT_HEIGHT),
"Height of the window");
po::variables_map vm;
po::store(po::command_line_parser(argc, argv).options(desc).run(), vm);
po::notify(vm);
if(vm.count("help")){
std::cout << desc << std::endl;
return 0;
}
MuVi::Logger::Init(vm.count("debug"));
if (config.colormap < cv::COLORMAP_AUTUMN ||
config.colormap > cv::COLORMAP_DEEPGREEN) {
MUVI_ERROR("Invalid colormap value. Falling to default: {}",
DEFAULT_COLORMAP);
}
Muvi::AudioLoopbackWorker audioLoopbackWorker;
audioLoopbackWorker.Spawn();
Muvi::FftWorker fftWorker(audioLoopbackWorker);
fftWorker.Spawn();
Muvi::RendererWorker rendererWorker(fftWorker, config);
rendererWorker.Spawn();
audioLoopbackWorker.Join();
fftWorker.Join();
rendererWorker.Join();
return 0;
}