This commit is contained in:
Maurice Grönwoldt 2025-11-01 22:08:48 +01:00
commit bbd208aacf
Signed by: versustunez
GPG key ID: 3DBA8C59A63DEE3A
6 changed files with 238 additions and 224 deletions

View file

@ -33,6 +33,12 @@ cmake -DCMAKE_BUILD_TYPE=Debug ..
make -DCMAKE_BUILD_TYPE=Release .. make -DCMAKE_BUILD_TYPE=Release ..
``` ```
## UDEV
```udev
ACTION=="add", SUBSYSTEMS=="usb", ATTRS{idVendor}=="1e7d", ATTRS{idProduct}=="307a", MODE="660", GROUP="wheel"
ACTION=="add", SUBSYSTEMS=="usb", ATTRS{idVendor}=="1e7d", ATTRS{idProduct}=="3098", MODE="660", GROUP="wheel"
```
## RUN ## RUN
`./anyVulcanoLE` `./anyVulcanoLE`

View file

@ -2,6 +2,7 @@
#include <algorithm> #include <algorithm>
#include <string> #include <string>
#include <vector>
namespace VUtils { namespace VUtils {
class StringUtils { class StringUtils {
@ -18,13 +19,15 @@ namespace VUtils {
static std::string trimCopy(std::string s); static std::string trimCopy(std::string s);
static std::vector<std::string> split(const std::string &s, const std::string &delimiter); static std::vector<std::string> split(const std::string &s,
const std::string &delimiter);
static std::string urlDecode(const std::string &url); static std::string urlDecode(const std::string &url);
static std::string urlEncode(const std::string &url); static std::string urlEncode(const std::string &url);
static std::string join(const std::vector<std::string>& vector, const std::string& delimiter); static std::string join(const std::vector<std::string> &vector,
const std::string &delimiter);
static bool hasNullByte(int size, const char string[1024]); static bool hasNullByte(int size, const char string[1024]);
}; };

View file

@ -2,10 +2,12 @@
#include <iomanip> #include <iomanip>
#include <sstream> #include <sstream>
#include <vector>
namespace VUtils { namespace VUtils {
void StringUtils::leftTrim(std::string &s) { void StringUtils::leftTrim(std::string &s) {
s.erase(s.begin(), std::find_if(s.begin(), s.end(), s.erase(s.begin(),
std::find_if(s.begin(), s.end(),
std::not1(std::ptr_fun<int, int>(std::isspace)))); std::not1(std::ptr_fun<int, int>(std::isspace))));
} }
@ -36,7 +38,8 @@ namespace VUtils {
return s; return s;
} }
std::vector<std::string> StringUtils::split(const std::string &s, const std::string &delimiter) { std::vector<std::string> StringUtils::split(const std::string &s,
const std::string &delimiter) {
size_t pos_start = 0, pos_end, delim_len = delimiter.length(); size_t pos_start = 0, pos_end, delim_len = delimiter.length();
std::string token; std::string token;
std::vector<std::string> res; std::vector<std::string> res;
@ -85,13 +88,13 @@ namespace VUtils {
return escaped.str(); return escaped.str();
} }
std::string StringUtils::join(const std::vector<std::string> &vector, const std::string &delimiter) { std::string StringUtils::join(const std::vector<std::string> &vector,
const std::string &delimiter) {
std::stringstream string; std::stringstream string;
for (int i = 0; i < vector.size(); ++i) { for (int i = 0; i < vector.size(); ++i) {
if (i != 0) if (i != 0)
string << delimiter; string << delimiter;
string << vector[i]; string << vector[i];
} }
return string.str(); return string.str();
} }

View file

@ -1,9 +1,9 @@
#include <cmath>
#include <VulcanoLE/Audio/AudioGrabber.h>
#include <VUtils/Logging.h>
#include <VulcanoLE/Audio/JackClient.h>
#include "VUtils/Math.h" #include "VUtils/Math.h"
#include <VUtils/Logging.h>
#include <VulcanoLE/Audio/AudioGrabber.h>
#include <VulcanoLE/Audio/JackClient.h>
#include <cmath>
#include <iostream>
AudioGrabber::AudioGrabber() = default; AudioGrabber::AudioGrabber() = default;
AudioGrabber::~AudioGrabber() = default; AudioGrabber::~AudioGrabber() = default;
@ -25,7 +25,8 @@ AudioGrabber *AudioGrabber::createAudioGrabber() {
} }
void AudioGrabber::init() { void AudioGrabber::init() {
m_buffer = static_cast<stereoSample *>(calloc(BUFFER_SIZE, sizeof(stereoSample))); m_buffer =
static_cast<stereoSample *>(calloc(BUFFER_SIZE, sizeof(stereoSample)));
if (env != nullptr) if (env != nullptr)
m_scale = env->getAsDouble("audio_scale", 1.0); m_scale = env->getAsDouble("audio_scale", 1.0);
m_filter.scale = 1.0; m_filter.scale = 1.0;
@ -90,9 +91,7 @@ bool AudioGrabber::work() {
return false; return false;
} }
} }
Audio::FilterHelper &AudioGrabber::getFilter() { Audio::FilterHelper &AudioGrabber::getFilter() { return m_filter; }
return m_filter;
}
double AudioGrabber::getBass() { double AudioGrabber::getBass() {
auto fftData = fft.getData(); auto fftData = fft.getData();
auto val = 0.0; auto val = 0.0;

View file

@ -49,6 +49,8 @@ bool FFT::prepareInput(stereoSample *buffer, uint32_t sampleSize, double scale)
for (size_t i = 0; i < sampleSize; ++i) { for (size_t i = 0; i < sampleSize; ++i) {
m_fftwInputLeft[i][0] = VUtils::Math::clamp(buffer[i].r * scale, -1, 1) * hannWindow[i]; m_fftwInputLeft[i][0] = VUtils::Math::clamp(buffer[i].r * scale, -1, 1) * hannWindow[i];
m_fftwInputRight[i][0] = VUtils::Math::clamp(buffer[i].r * scale, -1, 1) * hannWindow[i]; m_fftwInputRight[i][0] = VUtils::Math::clamp(buffer[i].r * scale, -1, 1) * hannWindow[i];
m_fftwInputLeft[i][1] = 0;
m_fftwInputRight[i][1] = 0;
if (is_silent && (m_fftwInputLeft[i][0] != 0 || m_fftwInputRight[i][0] != 0)) is_silent = false; if (is_silent && (m_fftwInputLeft[i][0] != 0 || m_fftwInputRight[i][0] != 0)) is_silent = false;
} }
return is_silent; return is_silent;

View file

@ -1,8 +1,11 @@
#include <VulcanoLE/Scripts/TheUknown.h>
#include <VUtils/SimplexNoise.h> #include <VUtils/SimplexNoise.h>
#include <VulcanoLE/Scripts/TheUknown.h>
#include <algorithm>
namespace VIZ { namespace VIZ {
TheUnknown::TheUnknown(AudioGrabber *pGrabber, Vulcan121 *vulcan) : VIZ(pGrabber, vulcan) { TheUnknown::TheUnknown(AudioGrabber *pGrabber, Vulcan121 *vulcan)
: VIZ(pGrabber, vulcan) {
m_random.setDist(0, 128); m_random.setDist(0, 128);
for (int i = 0; i < NUM_KEYS; i++) { for (int i = 0; i < NUM_KEYS; i++) {
m_keyHeightMap[i] = std::abs(SimplexNoise::noise(i + 1.0f)) * 0.1; m_keyHeightMap[i] = std::abs(SimplexNoise::noise(i + 1.0f)) * 0.1;
@ -35,7 +38,5 @@ namespace VIZ {
} }
keyboard->sendLedMap(map); keyboard->sendLedMap(map);
} }
const char *TheUnknown::name() { const char *TheUnknown::name() { return "TheUnknown"; }
return "TheUnknown"; } // namespace VIZ
}
}