yaml testing (not good) :(

This commit is contained in:
2026-01-24 02:23:42 -06:00
parent 60ba371a05
commit a4ea6490a4
6 changed files with 81 additions and 5 deletions

View File

@@ -68,6 +68,8 @@ On Linux (GCC):
./scripts/build.sh ./scripts/build.sh
``` ```
TODO: right now you need to run the executable from the executable's directory because of CWD paths and such. Needs to be fixed because annoying
Configure the CMake/build script if you have issues Configure the CMake/build script if you have issues
To clean: To clean:
@@ -75,8 +77,16 @@ To clean:
.\scripts\clean.ps1 .\scripts\clean.ps1
./scripts/clean.sh ./scripts/clean.sh
``` ```
Note: dependencies are built into build/lib, so don't delete that unless you want to rebuild qt which takes forever :) Note: dependencies are built into build/lib, so don't delete unless you need to rebuild the libraries
Use the install_dependencies script to manually install dependencies. Use the install_dependencies script to manually install dependencies.
Build troubleshooting: Build troubleshooting:
On windows, `bcdedit /set IncreaseUserVa 3072` solved cc1plus.exe: out of memory errors while building qt for me On windows, `bcdedit /set IncreaseUserVa 3072` solved cc1plus.exe: out of memory errors while building qt for me
## Configurations (NOT YET IMPLEMENTED)
Default config files are located in the config/ directory, and they are replicated into build/config/ if they dont already exist there. To edit the configurations, edit the config files in the build directory, not the defaults. Most config files are loaded/parsed at startup (TODO: investigate some reloading functions), so the program must be restarted, although not recompiled, for new configs to take effect. \
Voice profiles are saved into config files into a human-readable format (YAML) and can be edited manually or by saving within the app. \
## Wavetables (NOT YET IMPLEMENTED)
Wavetables are this synthesizer's starting point for audio synthesis. A wavetable (as defined for this synthesizer, not elsewhere) contains a single period of a particular wave-shape with a discrete number of samples. Wavetables are loaded at runtime and sampled by oscillator objects to define and mix different wave shapes. Further specifications, as well as instructions for generating your own wavetable (including an example python script << TODO), are located within config/wavetables/README.md

16
config/audio.yaml Normal file
View File

@@ -0,0 +1,16 @@
# audio.yaml
# Configures properties for the RtAudio engine
# Number of samples per second
sampleRate: 44100
# unconfigurable: sampleFormat; [-1, 1] float
# number of audio channels
channels: 2
# 0 = mono, 1 = stereo, 2 = pseudo-stereo
stereoMode: 2
# number of samples per audio buffer
bufferSize: 512

View File

View File

@@ -13,6 +13,8 @@ $RTAUDIO_ROOT = "$BUILD_DIR\lib\rtaudio"
$RTMIDI_ROOT = "$BUILD_DIR\lib\rtmidi" $RTMIDI_ROOT = "$BUILD_DIR\lib\rtmidi"
$YAMLCPP_ROOT = "$BUILD_DIR\lib\yaml-cpp" $YAMLCPP_ROOT = "$BUILD_DIR\lib\yaml-cpp"
$CONFIG_ROOT = "$PROJECT_ROOT\config"
# setup # setup
& "$Env:Programfiles\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build\vcvars64.bat" & "$Env:Programfiles\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build\vcvars64.bat"
@@ -56,18 +58,20 @@ cmake -S . -B $BUILD_DIR -G "Visual Studio 17 2022" `
Write-Host "Building metabolus..." Write-Host "Building metabolus..."
cmake --build $BUILD_DIR cmake --build $BUILD_DIR
# TODO: install
# link dlls # link dlls
Write-Host "Deploying metabolus..." Write-Host "Deploying metabolus..."
cd $BUILD_DIR cd $BUILD_DIR
& "$QT_ROOT\bin\windeployqt6.exe" .\Debug\metabolus.exe & "$QT_ROOT\bin\windeployqt6.exe" .\Debug\metabolus.exe
# copy dlls
Copy-Item -Path "$RTAUDIO_ROOT\bin\rtaudio.dll" -Destination .\Debug Copy-Item -Path "$RTAUDIO_ROOT\bin\rtaudio.dll" -Destination .\Debug
Copy-Item -Path "$RTMIDI_ROOT\bin\rtmidi.dll" -Destination .\Debug Copy-Item -Path "$RTMIDI_ROOT\bin\rtmidi.dll" -Destination .\Debug
Copy-Item -Path "$YAMLCPP_ROOT\bin\yaml-cpp.dll" -Destination .\Debug Copy-Item -Path "$YAMLCPP_ROOT\bin\yaml-cpp.dll" -Destination .\Debug
# copy configs, but don't overwrite
# TODO: allow input of an external qt install because this one is huge Copy-Item -Path "$CONFIG_ROOT" -Destination ".\Debug\" -Recurse -ErrorAction SilentlyContinue
# TODO: remove unnecessary qt modules bc why is this install like 80 gb
cd $PROJECT_ROOT cd $PROJECT_ROOT

View File

@@ -1,8 +1,49 @@
#include "ConfigInterface.h" #include "ConfigInterface.h"
#include "yaml-cpp/yaml.h"
#include <iostream> #include <iostream>
#include <fstream>
#include <filesystem>
namespace fs = std::filesystem;
ConfigInterface::ConfigInterface() { ConfigInterface::ConfigInterface() {
std::cout << "Config constructor" << std::endl;
std::string audioConfig = configRoot + "/" + filename;
std::cout << "CWD: " << fs::current_path() << std::endl;
std::cout << "Audio config: " << fs::absolute(audioConfig).string() << std::endl;
// opening the file myself because YAML::LoadFile didn't seem to work on windows
std::ifstream file(fs::absolute(audioConfig).string());
if(file.good()) {
std::cout << "File exists" << std::endl;
} else {
std::cout << "File does not exist" << std::endl;
}
//YAML::Node config;
/*
try {
YAML::Node config = YAML::Load("{sampleRate: 44100}");
std::cout << "Loaded config file" << std::endl;
std::cout << "Type enum: " << static_cast<int>(config.Type()) << std::endl;
if(config["sampleRate"]) {
//int sampleRate = config["sampleRate"].as<int>();
//std::cout << sampleRate << std::endl;
} else {
std::cout << "Key does not exist" << std::endl;
}
} catch(const std::exception& e) {
std::cerr << e.what() << '\n';
}
*/
YAML::Node n = YAML::Load("{sampleRate: 44100}");
std::cout << n["sampleRate"].as<int>() << "\n";
} }

View File

@@ -1,6 +1,8 @@
#pragma once #pragma once
#include <string>
class ConfigInterface { class ConfigInterface {
public: public:
@@ -10,4 +12,7 @@ public:
private: private:
const std::string configRoot = "config";
const std::string filename = "audio.yaml";
}; };