comments
This commit is contained in:
@@ -9,28 +9,23 @@ find_package(Qt6 REQUIRED COMPONENTS Widgets)
|
|||||||
|
|
||||||
if (WIN32) # windows 11 x86_64
|
if (WIN32) # windows 11 x86_64
|
||||||
|
|
||||||
# Header-only target (real target, no ::)
|
# dont judge me i had a lot of issues with this
|
||||||
add_library(rtaudio_headers INTERFACE)
|
add_library(rtaudio_headers INTERFACE)
|
||||||
target_include_directories(rtaudio_headers INTERFACE
|
target_include_directories(rtaudio_headers INTERFACE
|
||||||
"C:/rtaudio/include"
|
"C:/rtaudio/include"
|
||||||
"C:/rtaudio/include/rtAudio"
|
"C:/rtaudio/include/rtAudio"
|
||||||
)
|
)
|
||||||
|
|
||||||
# Imported binary (real target, no ::)
|
|
||||||
add_library(rtaudio_binary SHARED IMPORTED)
|
add_library(rtaudio_binary SHARED IMPORTED)
|
||||||
set_target_properties(rtaudio_binary PROPERTIES
|
set_target_properties(rtaudio_binary PROPERTIES
|
||||||
IMPORTED_LOCATION "C:/rtaudio/bin/rtaudio.dll"
|
IMPORTED_LOCATION "C:/rtaudio/bin/rtaudio.dll"
|
||||||
IMPORTED_IMPLIB "C:/rtaudio/lib/rtaudio.lib"
|
IMPORTED_IMPLIB "C:/rtaudio/lib/rtaudio.lib"
|
||||||
)
|
)
|
||||||
|
|
||||||
# Unified interface target
|
|
||||||
add_library(rtaudio INTERFACE)
|
add_library(rtaudio INTERFACE)
|
||||||
target_link_libraries(rtaudio INTERFACE
|
target_link_libraries(rtaudio INTERFACE
|
||||||
rtaudio_headers
|
rtaudio_headers
|
||||||
rtaudio_binary
|
rtaudio_binary
|
||||||
)
|
)
|
||||||
|
|
||||||
# Public alias (this is where :: belongs)
|
|
||||||
add_library(RtAudio::RtAudio ALIAS rtaudio)
|
add_library(RtAudio::RtAudio ALIAS rtaudio)
|
||||||
|
|
||||||
add_library(rtmidi_headers INTERFACE)
|
add_library(rtmidi_headers INTERFACE)
|
||||||
@@ -59,6 +54,7 @@ endif()
|
|||||||
|
|
||||||
qt_standard_project_setup()
|
qt_standard_project_setup()
|
||||||
|
|
||||||
|
# TODO: prob fix this to make it less ugly
|
||||||
qt_add_executable(metabolus
|
qt_add_executable(metabolus
|
||||||
src/main.cpp
|
src/main.cpp
|
||||||
src/ui/MainWindow.cpp
|
src/ui/MainWindow.cpp
|
||||||
|
|||||||
@@ -1,9 +1,7 @@
|
|||||||
@echo off
|
@echo off
|
||||||
setlocal
|
setlocal
|
||||||
|
|
||||||
REM ================================
|
REM config
|
||||||
REM Configuration
|
|
||||||
REM ================================
|
|
||||||
|
|
||||||
set BUILD_DIR=build
|
set BUILD_DIR=build
|
||||||
set CONFIG=Release
|
set CONFIG=Release
|
||||||
@@ -12,22 +10,18 @@ set QT_ROOT=C:\Qt\6.10.1\msvc2022_64
|
|||||||
set RTAUDIO_ROOT=C:\rtaudio
|
set RTAUDIO_ROOT=C:\rtaudio
|
||||||
set RTMIDI_ROOT=C:\rtmidi
|
set RTMIDI_ROOT=C:\rtmidi
|
||||||
|
|
||||||
REM ================================
|
REM setup
|
||||||
REM Environment setup
|
|
||||||
REM ================================
|
|
||||||
|
|
||||||
call "%ProgramFiles%\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build\vcvars64.bat"
|
call "%ProgramFiles%\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build\vcvars64.bat"
|
||||||
|
|
||||||
set PATH=%QT_ROOT%\bin;%PATH%
|
set PATH=%QT_ROOT%\bin;%PATH%
|
||||||
|
|
||||||
REM ================================
|
|
||||||
REM Configure
|
|
||||||
REM ================================
|
|
||||||
|
|
||||||
if not exist %BUILD_DIR% (
|
if not exist %BUILD_DIR% (
|
||||||
mkdir %BUILD_DIR%
|
mkdir %BUILD_DIR%
|
||||||
)
|
)
|
||||||
|
|
||||||
|
REM configure
|
||||||
|
|
||||||
cmake -S . -B %BUILD_DIR% ^
|
cmake -S . -B %BUILD_DIR% ^
|
||||||
-G Ninja ^
|
-G Ninja ^
|
||||||
-DCMAKE_BUILD_TYPE=%CONFIG% ^
|
-DCMAKE_BUILD_TYPE=%CONFIG% ^
|
||||||
@@ -36,17 +30,12 @@ cmake -S . -B %BUILD_DIR% ^
|
|||||||
|
|
||||||
if errorlevel 1 goto error
|
if errorlevel 1 goto error
|
||||||
|
|
||||||
REM ================================
|
REM build
|
||||||
REM Build
|
|
||||||
REM ================================
|
|
||||||
|
|
||||||
cmake --build %BUILD_DIR%
|
cmake --build %BUILD_DIR%
|
||||||
|
|
||||||
if errorlevel 1 goto error
|
if errorlevel 1 goto error
|
||||||
|
|
||||||
REM ================================
|
REM link dlls
|
||||||
REM Deploy Qt + RtAudio
|
|
||||||
REM ================================
|
|
||||||
|
|
||||||
cd %BUILD_DIR%
|
cd %BUILD_DIR%
|
||||||
|
|
||||||
@@ -56,12 +45,12 @@ copy "%RTAUDIO_ROOT%\bin\rtaudio.dll" .
|
|||||||
copy "%RTMIDI_ROOT%\bin\rtmidi.dll" .
|
copy "%RTMIDI_ROOT%\bin\rtmidi.dll" .
|
||||||
|
|
||||||
echo.
|
echo.
|
||||||
echo Build successful.
|
echo Build successful
|
||||||
goto end
|
goto end
|
||||||
|
|
||||||
:error
|
:error
|
||||||
echo.
|
echo.
|
||||||
echo Build FAILED.
|
echo Build failed
|
||||||
exit /b 1
|
exit /b 1
|
||||||
|
|
||||||
:end
|
:end
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ MidiController::MidiController(NoteQueue& queue) : noteQueue_(queue) {
|
|||||||
midiIn_ = std::make_unique<RtMidiIn>();
|
midiIn_ = std::make_unique<RtMidiIn>();
|
||||||
midiIn_->ignoreTypes(false, false, false);
|
midiIn_->ignoreTypes(false, false, false);
|
||||||
} catch (RtMidiError& e) {
|
} catch (RtMidiError& e) {
|
||||||
std::cerr << "RtMidi init failed: " << e.getMessage() << std::endl;
|
std::cout << "RtMidi init failed: " << e.getMessage() << std::endl;
|
||||||
}
|
}
|
||||||
// TODO: this still doesnt work on windows
|
// TODO: this still doesnt work on windows
|
||||||
}
|
}
|
||||||
@@ -22,7 +22,7 @@ MidiController::~MidiController() {
|
|||||||
bool MidiController::openDefaultPort() {
|
bool MidiController::openDefaultPort() {
|
||||||
if (!midiIn_) return false;
|
if (!midiIn_) return false;
|
||||||
if (midiIn_->getPortCount() == 0) {
|
if (midiIn_->getPortCount() == 0) {
|
||||||
std::cerr << "No MIDI input ports available\n";
|
std::cout << "No MIDI input ports available" << std::endl;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return openPort(0);
|
return openPort(0);
|
||||||
@@ -34,7 +34,7 @@ bool MidiController::openPort(unsigned int index) {
|
|||||||
try {
|
try {
|
||||||
midiIn_->openPort(index);
|
midiIn_->openPort(index);
|
||||||
midiIn_->setCallback(&MidiController::midiCallback, this);
|
midiIn_->setCallback(&MidiController::midiCallback, this);
|
||||||
std::cout << "Opened MIDI port: " << midiIn_->getPortName(index) << "\n";
|
std::cout << "Opened MIDI port: " << midiIn_->getPortName(index) << std::endl;
|
||||||
return true;
|
return true;
|
||||||
} catch (RtMidiError& e) {
|
} catch (RtMidiError& e) {
|
||||||
std::cerr << e.getMessage() << std::endl;
|
std::cerr << e.getMessage() << std::endl;
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
// add event to noteQueue, called by MidiController or keyboardController
|
// add event to noteQueue, called by MidiController or keyboardController
|
||||||
bool NoteQueue::push(const NoteEvent& event) {
|
bool NoteQueue::push(const NoteEvent& event) {
|
||||||
size_t head = head_.load(std::memory_order_relaxed);
|
size_t head = head_.load(std::memory_order_relaxed);
|
||||||
size_t next = (head + 1) % SIZE;
|
size_t next = (head + 1) % SYNTH_NOTE_QUEUE_SIZE;
|
||||||
|
|
||||||
if(next == tail_.load(std::memory_order_relaxed)) return false; // full
|
if(next == tail_.load(std::memory_order_relaxed)) return false; // full
|
||||||
|
|
||||||
@@ -22,7 +22,7 @@ bool NoteQueue::pop(NoteEvent& event) {
|
|||||||
if(tail == head_.load(std::memory_order_acquire)) return false; // empty
|
if(tail == head_.load(std::memory_order_acquire)) return false; // empty
|
||||||
|
|
||||||
event = buffer_[tail];
|
event = buffer_[tail];
|
||||||
tail_.store((tail + 1) % SIZE, std::memory_order_release);
|
tail_.store((tail + 1) % SYNTH_NOTE_QUEUE_SIZE, std::memory_order_release);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,6 +6,8 @@
|
|||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
#include <chrono>
|
#include <chrono>
|
||||||
|
|
||||||
|
#define SYNTH_NOTE_QUEUE_SIZE 128
|
||||||
|
|
||||||
enum class NoteEventType {
|
enum class NoteEventType {
|
||||||
NoteOn,
|
NoteOn,
|
||||||
NoteOff
|
NoteOff
|
||||||
@@ -29,9 +31,8 @@ public:
|
|||||||
bool pop(NoteEvent& event);
|
bool pop(NoteEvent& event);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static constexpr size_t SIZE = 128;
|
|
||||||
|
|
||||||
std::array<NoteEvent, SIZE> buffer_;
|
std::array<NoteEvent, SYNTH_NOTE_QUEUE_SIZE> buffer_;
|
||||||
std::atomic<size_t> head_{ 0 };
|
std::atomic<size_t> head_{ 0 };
|
||||||
std::atomic<size_t> tail_{ 0 };
|
std::atomic<size_t> tail_{ 0 };
|
||||||
|
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ void ScopeBuffer::push(float sample) {
|
|||||||
buffer_[w % buffer_.size()] = sample;
|
buffer_[w % buffer_.size()] = sample;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO: needs a mutex to prevent flickering
|
||||||
// outputs value from the scope buffer, called by the scope widget
|
// outputs value from the scope buffer, called by the scope widget
|
||||||
void ScopeBuffer::read(std::vector<float>& out) const {
|
void ScopeBuffer::read(std::vector<float>& out) const {
|
||||||
size_t w = writeIndex_.load(std::memory_order_relaxed);
|
size_t w = writeIndex_.load(std::memory_order_relaxed);
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ WavetableController::WavetableController() {
|
|||||||
|
|
||||||
init();
|
init();
|
||||||
|
|
||||||
std::cout << "wavetable init" << std::endl;
|
//std::cout << "wavetable init" << std::endl;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -4,8 +4,6 @@
|
|||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
// TODO: package the rogue sliders into the envelopeGenerators with a "base" column (its what the "peak" slider in the esp synth was supposed to be)
|
|
||||||
|
|
||||||
EnvelopeGenerator::EnvelopeGenerator(QWidget* parent) : QWidget(parent), ui_(new Ui::EnvelopeGenerator) {
|
EnvelopeGenerator::EnvelopeGenerator(QWidget* parent) : QWidget(parent), ui_(new Ui::EnvelopeGenerator) {
|
||||||
|
|
||||||
ui_->setupUi(this);
|
ui_->setupUi(this);
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
#include "Scope.h"
|
#include "Scope.h"
|
||||||
#include "ui_Scope.h"
|
#include "ui_Scope.h"
|
||||||
|
|
||||||
|
// TODO: fix include directories because what is this
|
||||||
#include "../../../synth/ScopeBuffer.h"
|
#include "../../../synth/ScopeBuffer.h"
|
||||||
|
|
||||||
#include <QPainter>
|
#include <QPainter>
|
||||||
|
|||||||
Reference in New Issue
Block a user