fixed windows build platform
This commit is contained in:
4
.gitmodules
vendored
4
.gitmodules
vendored
@@ -4,7 +4,3 @@
|
|||||||
[submodule "lib/rtmidi"]
|
[submodule "lib/rtmidi"]
|
||||||
path = lib/rtmidi
|
path = lib/rtmidi
|
||||||
url = https://github.com/thestk/rtmidi.git
|
url = https://github.com/thestk/rtmidi.git
|
||||||
[submodule "lib/qt5"]
|
|
||||||
path = lib/qt5
|
|
||||||
url = https://github.com/qt/qt5.git
|
|
||||||
branch = 6.11
|
|
||||||
|
|||||||
@@ -9,41 +9,19 @@ find_package(Qt6 REQUIRED COMPONENTS Widgets)
|
|||||||
|
|
||||||
if (WIN32) # windows 11 x86_64
|
if (WIN32) # windows 11 x86_64
|
||||||
|
|
||||||
# dont judge me i had a lot of issues with this
|
add_library(RtAudio::rtaudio SHARED IMPORTED)
|
||||||
add_library(rtaudio_headers INTERFACE)
|
set_target_properties(RtAudio::rtaudio PROPERTIES
|
||||||
target_include_directories(rtaudio_headers INTERFACE
|
IMPORTED_LOCATION "${RtAudio_ROOT}/bin/rtaudio.dll"
|
||||||
"C:/rtaudio/include"
|
IMPORTED_IMPLIB "${RtAudio_ROOT}/lib/rtaudio.lib"
|
||||||
"C:/rtaudio/include/rtAudio"
|
INTERFACE_INCLUDE_DIRECTORIES "${RtAudio_ROOT}/include/rtaudio"
|
||||||
)
|
)
|
||||||
add_library(rtaudio_binary SHARED IMPORTED)
|
|
||||||
set_target_properties(rtaudio_binary PROPERTIES
|
add_library(RtMidi::rtmidi SHARED IMPORTED)
|
||||||
IMPORTED_LOCATION "C:/rtaudio/bin/rtaudio.dll"
|
set_target_properties(RtMidi::rtmidi PROPERTIES
|
||||||
IMPORTED_IMPLIB "C:/rtaudio/lib/rtaudio.lib"
|
IMPORTED_LOCATION "${RtMidi_ROOT}/bin/rtmidi.dll"
|
||||||
|
IMPORTED_IMPLIB "${RtMidi_ROOT}/lib/rtmidi.lib"
|
||||||
|
INTERFACE_INCLUDE_DIRECTORIES "${RtMidi_ROOT}/include/rtmidi"
|
||||||
)
|
)
|
||||||
add_library(rtaudio INTERFACE)
|
|
||||||
target_link_libraries(rtaudio INTERFACE
|
|
||||||
rtaudio_headers
|
|
||||||
rtaudio_binary
|
|
||||||
)
|
|
||||||
|
|
||||||
add_library(RtAudio::RtAudio ALIAS rtaudio)
|
|
||||||
|
|
||||||
add_library(rtmidi_headers INTERFACE)
|
|
||||||
target_include_directories(rtmidi_headers INTERFACE
|
|
||||||
"C:/rtmidi/include"
|
|
||||||
"C:/rtmidi/include/rtMidi"
|
|
||||||
)
|
|
||||||
add_library(rtmidi_binary SHARED IMPORTED)
|
|
||||||
set_target_properties(rtmidi_binary PROPERTIES
|
|
||||||
IMPORTED_LOCATION "C:/rtmidi/bin/rtmidi.dll"
|
|
||||||
IMPORTED_IMPLIB "C:/rtmidi/lib/rtmidi.lib"
|
|
||||||
)
|
|
||||||
add_library(rtmidi INTERFACE)
|
|
||||||
target_link_libraries(rtmidi INTERFACE
|
|
||||||
rtmidi_headers
|
|
||||||
rtmidi_binary
|
|
||||||
)
|
|
||||||
add_library(RtMidi::RtMidi ALIAS rtmidi)
|
|
||||||
|
|
||||||
|
|
||||||
else() # debian 12 x86_64
|
else() # debian 12 x86_64
|
||||||
@@ -97,6 +75,7 @@ qt_add_executable(metabolus
|
|||||||
)
|
)
|
||||||
|
|
||||||
set_target_properties(metabolus PROPERTIES AUTOUIC ON)
|
set_target_properties(metabolus PROPERTIES AUTOUIC ON)
|
||||||
|
target_compile_options(metabolus PUBLIC "/Zc:__cplusplus")
|
||||||
|
|
||||||
target_include_directories(metabolus PRIVATE
|
target_include_directories(metabolus PRIVATE
|
||||||
${CMAKE_SOURCE_DIR}/src/ui
|
${CMAKE_SOURCE_DIR}/src/ui
|
||||||
@@ -106,9 +85,9 @@ target_include_directories(metabolus PRIVATE
|
|||||||
if (WIN32)
|
if (WIN32)
|
||||||
target_link_libraries(metabolus
|
target_link_libraries(metabolus
|
||||||
PRIVATE
|
PRIVATE
|
||||||
|
RtAudio::rtaudio
|
||||||
|
RtMidi::rtmidi
|
||||||
Qt6::Widgets
|
Qt6::Widgets
|
||||||
RtAudio::RtAudio
|
|
||||||
RtMidi::RtMidi
|
|
||||||
)
|
)
|
||||||
|
|
||||||
else()
|
else()
|
||||||
|
|||||||
@@ -40,10 +40,10 @@ This synthesizer isn't very good, but it's neat :3
|
|||||||
## Build Instructions
|
## Build Instructions
|
||||||
|
|
||||||
Prerequisites:
|
Prerequisites:
|
||||||
CMake: https://cmake.org/download/
|
CMake: https://cmake.org/download/ \
|
||||||
Ninja: https://github.com/ninja-build/ninja/releases
|
QtWidgets: https://www.qt.io/development/download-qt-installer-oss
|
||||||
|
|
||||||
Windows: MSVC
|
Windows: MSVC (The build scripts use Visual Studio 17 2022)
|
||||||
Linux: GCC
|
Linux: GCC
|
||||||
|
|
||||||
Clone repository
|
Clone repository
|
||||||
@@ -55,6 +55,7 @@ or if you forgot to --recursive:
|
|||||||
git clone https://github.com/Blitblank/metabalus.git
|
git clone https://github.com/Blitblank/metabalus.git
|
||||||
git submodule update --init --recursive
|
git submodule update --init --recursive
|
||||||
```
|
```
|
||||||
|
\
|
||||||
Build. The script will build and install dependencies automatically
|
Build. The script will build and install dependencies automatically
|
||||||
|
|
||||||
On Windows (MSVC):
|
On Windows (MSVC):
|
||||||
|
|||||||
1
lib/qt5
1
lib/qt5
Submodule lib/qt5 deleted from f5f14e7b58
@@ -6,8 +6,8 @@ $PROJECT_ROOT = $PWD
|
|||||||
$BUILD_DIR = "$PWD/build"
|
$BUILD_DIR = "$PWD/build"
|
||||||
$CONFIG = "Release"
|
$CONFIG = "Release"
|
||||||
|
|
||||||
# change these to the build libs
|
# change these to your need
|
||||||
$QT_ROOT = "$BUILD_DIR\lib\qt\install"
|
$QT_ROOT = "C:\Qt\6.10.1\msvc2022_64"
|
||||||
$RTAUDIO_ROOT = "$BUILD_DIR\lib\rtaudio"
|
$RTAUDIO_ROOT = "$BUILD_DIR\lib\rtaudio"
|
||||||
$RTMIDI_ROOT = "$BUILD_DIR\lib\rtmidi"
|
$RTMIDI_ROOT = "$BUILD_DIR\lib\rtmidi"
|
||||||
|
|
||||||
@@ -23,7 +23,7 @@ if (-not (Test-Path -Path $BUILD_DIR)) {
|
|||||||
|
|
||||||
# detect dependencies
|
# detect dependencies
|
||||||
|
|
||||||
$libraries = @("qt", "rtaudio", "rtmidi")
|
$libraries = @("rtaudio", "rtmidi")
|
||||||
$dependencies_found = 0
|
$dependencies_found = 0
|
||||||
foreach ($lib in $libraries) {
|
foreach ($lib in $libraries) {
|
||||||
if (Test-Path -Path ".\build\lib\$lib") {
|
if (Test-Path -Path ".\build\lib\$lib") {
|
||||||
@@ -37,12 +37,12 @@ foreach ($lib in $libraries) {
|
|||||||
if (-not ($dependencies_found -eq $libraries.Count)) {
|
if (-not ($dependencies_found -eq $libraries.Count)) {
|
||||||
& "scripts\install_dependencies.ps1"
|
& "scripts\install_dependencies.ps1"
|
||||||
} else {
|
} else {
|
||||||
Write-Host "All dependencies detected, skipping depency install step..."
|
Write-Host "All dependencies detected, skipping dependency install step..."
|
||||||
}
|
}
|
||||||
|
|
||||||
# configure
|
# configure
|
||||||
Write-Host "Configuring metabolus..."
|
Write-Host "Configuring metabolus..."
|
||||||
cmake -S . -B $BUILD_DIR -G Ninja -DCMAKE_BUILD_TYPE=$CONFIG -DQt6_ROOT="$QT_ROOT\lib\cmake\Qt6" -DRTAUDIO_ROOT=$RTAUDIO_ROOT -DRTMIDI_ROOT=$RTMIDI_ROOT
|
cmake -S . -B $BUILD_DIR -G "Visual Studio 17 2022" -DCMAKE_BUILD_TYPE=Release -DQt6_ROOT="$QT_ROOT\lib\cmake\Qt6" -DRtAudio_ROOT="$RTAUDIO_ROOT" -DRtMidi_ROOT="$RTMIDI_ROOT"
|
||||||
|
|
||||||
# build
|
# build
|
||||||
Write-Host "Building metabolus..."
|
Write-Host "Building metabolus..."
|
||||||
@@ -52,11 +52,13 @@ cmake --build $BUILD_DIR
|
|||||||
Write-Host "Deploying metabolus..."
|
Write-Host "Deploying metabolus..."
|
||||||
cd $BUILD_DIR
|
cd $BUILD_DIR
|
||||||
|
|
||||||
& "$QT_ROOT\bin\windeployqt.exe" metabolus.exe
|
& "$QT_ROOT\bin\windeployqt6.exe" .\Debug\metabolus.exe
|
||||||
|
|
||||||
Copy-Item -Path "$RTAUDIO_ROOT\bin\rtaudio.dll" -Destination .
|
Copy-Item -Path "$RTAUDIO_ROOT\bin\rtaudio.dll" -Destination .\Debug
|
||||||
Copy-Item -Path "$RTMIDI_ROOT\bin\rtmidi.dll" -Destination .
|
Copy-Item -Path "$RTMIDI_ROOT\bin\rtmidi.dll" -Destination .\Debug
|
||||||
|
|
||||||
|
|
||||||
# TODO: allow input of an external qt install because this one is huge
|
# TODO: allow input of an external qt install because this one is huge
|
||||||
# TODO: remove unnecessary qt modules bc why is this install like 80 gb
|
# TODO: remove unnecessary qt modules bc why is this install like 80 gb
|
||||||
|
|
||||||
|
cd $PROJECT_ROOT
|
||||||
|
|||||||
@@ -9,19 +9,10 @@ if (-not (Test-Path -Path "$PWD\build\lib")) {
|
|||||||
|
|
||||||
$build_lib_dir = "$PWD\build\lib"
|
$build_lib_dir = "$PWD\build\lib"
|
||||||
|
|
||||||
# qt
|
|
||||||
mkdir "$build_lib_dir\qt" -Force
|
|
||||||
#cd $project_root\lib\qt5
|
|
||||||
cd $build_lib_dir\qt
|
|
||||||
& "$project_root\lib\qt5\configure.bat" -prefix .\install -submodules qttools,qtbase -widgets
|
|
||||||
cmake --build . --parallel
|
|
||||||
cmake --install .
|
|
||||||
|
|
||||||
|
|
||||||
# rtaudio
|
# rtaudio
|
||||||
mkdir "$build_lib_dir\rtaudio" -Force
|
mkdir "$build_lib_dir\rtaudio" -Force
|
||||||
cd $project_root\lib\rtaudio
|
cd $project_root\lib\rtaudio
|
||||||
cmake -S . -B build -DRTDUIO_API_WASAPI=ON -DRTAUDIO_API_DS=OFF -DRT_AUDIO_API_ASIO=OFF -DRTAUDIO_BUILD_SHARED_LIBS=ON
|
cmake -S . -B build -G "Visual Studio 17 2022" -DRTDUIO_API_WASAPI=ON -DRTAUDIO_API_DS=OFF -DRT_AUDIO_API_ASIO=OFF -DRTAUDIO_BUILD_SHARED_LIBS=ON
|
||||||
cmake --build build --config Release
|
cmake --build build --config Release
|
||||||
cmake --install build --prefix "$build_lib_dir\rtaudio"
|
cmake --install build --prefix "$build_lib_dir\rtaudio"
|
||||||
|
|
||||||
@@ -29,7 +20,7 @@ cmake --install build --prefix "$build_lib_dir\rtaudio"
|
|||||||
# rtmidi
|
# rtmidi
|
||||||
mkdir "$build_lib_dir\rtmidi" -Force
|
mkdir "$build_lib_dir\rtmidi" -Force
|
||||||
cd $project_root\lib\rtmidi
|
cd $project_root\lib\rtmidi
|
||||||
cmake -S . -B build -DRT_MIDI_API_WINMM=ON -DRTMIDI_BUILD_SHARED_LIBS=ON
|
cmake -S . -B build -G "Visual Studio 17 2022" -DRT_MIDI_API_WINMM=ON -DRTMIDI_BUILD_SHARED_LIBS=ON
|
||||||
cmake --build build --config Release
|
cmake --build build --config Release
|
||||||
cmake --install build --prefix "$build_lib_dir\rtmidi"
|
cmake --install build --prefix "$build_lib_dir\rtmidi"
|
||||||
|
|
||||||
|
|||||||
@@ -98,7 +98,7 @@ float Voice::process(float* params, bool& scopeTrigger) {
|
|||||||
float osc3 = oscillators_[2].process(osc3NoteOffset + note_, getParam(ParamId::Osc3PitchOffset)/100.0f, temp);
|
float osc3 = oscillators_[2].process(osc3NoteOffset + note_, getParam(ParamId::Osc3PitchOffset)/100.0f, temp);
|
||||||
|
|
||||||
// mix oscillators
|
// mix oscillators
|
||||||
float sampleOut = (osc1 + osc2*0.5f + osc3*0.25f) * gain;
|
float sampleOut = (osc1 + osc2*0.25f + osc3*0.125f) * gain;
|
||||||
|
|
||||||
// filter sample
|
// filter sample
|
||||||
float baseFreq = oscillators_[0].frequency();
|
float baseFreq = oscillators_[0].frequency();
|
||||||
@@ -106,8 +106,8 @@ float Voice::process(float* params, bool& scopeTrigger) {
|
|||||||
float resonance = resonanceEnv * getParam(ParamId::FilterResonanceDepth) * velocityGain;
|
float resonance = resonanceEnv * getParam(ParamId::FilterResonanceDepth) * velocityGain;
|
||||||
filter1_.setParams(Filter::Type::BiquadLowpass, cutoffFreq, resonance);
|
filter1_.setParams(Filter::Type::BiquadLowpass, cutoffFreq, resonance);
|
||||||
filter2_.setParams(Filter::Type::BiquadLowpass, cutoffFreq, resonance);
|
filter2_.setParams(Filter::Type::BiquadLowpass, cutoffFreq, resonance);
|
||||||
sampleOut = filter1_.biquadProcess(sampleOut);
|
float filteredSample = filter1_.biquadProcess(sampleOut);
|
||||||
sampleOut = filter2_.biquadProcess(sampleOut);
|
// sampleOut = filter2_.biquadProcess(sampleOut); // TODO: for some reason second filter is unstable only on windows 🤷
|
||||||
|
|
||||||
return sampleOut;
|
return filteredSample;
|
||||||
}
|
}
|
||||||
@@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
#include <array>
|
#include <array>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
#include <cstdint>
|
||||||
|
|
||||||
#define SYNTH_WAVETABLE_SIZE 2048
|
#define SYNTH_WAVETABLE_SIZE 2048
|
||||||
#ifndef M_PI // I hate my stupid chungus life
|
#ifndef M_PI // I hate my stupid chungus life
|
||||||
|
|||||||
@@ -52,7 +52,10 @@ MainWindow::MainWindow(QWidget *parent) :
|
|||||||
audio_->start();
|
audio_->start();
|
||||||
|
|
||||||
// midi
|
// midi
|
||||||
|
#ifndef _WIN32
|
||||||
midi_.openPort(1); // TODO: error check
|
midi_.openPort(1); // TODO: error check
|
||||||
|
#endif
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
MainWindow::~MainWindow() {
|
MainWindow::~MainWindow() {
|
||||||
|
|||||||
Reference in New Issue
Block a user