Voss Connection Detection  1
Detect a connector click using realtime code on Bela hardware
tools.h
Go to the documentation of this file.
1 
5 #pragma once
6 #include <string>
7 #include <array>
8 #include <Bela.h>
9 #include <libraries/Gui/Gui.h>
10 #include <libraries/WriteFile/WriteFile.h>
11 #include "config.h"
12 #include <libraries/Pipe/Pipe.h>
13 
30 bool StartupSanityChecks(BelaContext *context);
31 
39 std::vector<std::string> list_dir(const char *path);
40 
49 time_t last_modification_time(const std::string& filepath);
50 
51 
57 template <us num_cols>
58 class LogFile {
59  WriteFile* file;
60  public:
70  LogFile(const char* filename, const char* header, bool createUnique=true);
71  ~LogFile();
77  void log(const std::array<float, num_cols>& data);
78 
79 };
80 
91 double retrieveAsNumber(JSONObject& json, const std::string& str);
92 
LogFile::~LogFile
~LogFile()
Definition: tools.cpp:182
StartupSanityChecks
bool StartupSanityChecks(BelaContext *context)
Perform sanity checks on startup, for the parameters that should be set properly in 'settings'....
Definition: tools.cpp:54
LogFile
A class for opening a logfile, and writing data to a log.
Definition: conndetect.h:14
retrieveAsNumber
double retrieveAsNumber(JSONObject &json, const std::string &str)
Searches for the key str in the JSON object and returns a the number. Throws a runtime error if the k...
Definition: tools.cpp:195
last_modification_time
time_t last_modification_time(const std::string &filepath)
Determine the last modification time of a file and returns it as a time_t value.
Definition: tools.cpp:123
LogFile::log
void log(const std::array< float, num_cols > &data)
Log the data to the file.
Definition: tools.cpp:177
LogFile::LogFile
LogFile(const char *filename, const char *header, bool createUnique=true)
Initialize a log file.
Definition: tools.cpp:133
list_dir
std::vector< std::string > list_dir(const char *path)
List the contents of a directory path, and return the contents.
Definition: tools.cpp:108
config.h
Configuration parameters for connection detection.