Skip to content

Feature/midi automation#113

Merged
malisimat merged 28 commits into
masterfrom
feature/midi-automation
Jun 21, 2026
Merged

Feature/midi automation#113
malisimat merged 28 commits into
masterfrom
feature/midi-automation

Conversation

@malisimat

Copy link
Copy Markdown
Owner

This pull request introduces a new VST automation feature, allowing recording and playback of MIDI automation as part of MIDI loops.

Also introduces some general clean-up changes, including:

  • Build System and Dependency Management - Updated Jamma.vcxproj to include the main vcpkg lib directories and added post-build steps to copy necessary DLLs (ogg.dll, vorbis.dll, vorbisenc.dll) to the output directory.
  • Resource and Shader Management - Added new automation shaders (automation.frag, automation.vert) for visualizing automation lanes.
  • Window Placement and User Experience - Implemented logic in Main.cpp to check if the saved window position is within the visible work area.
  • Input Handling Improvements - polling for global insert key capture in the main application loop.

Copilot AI review requested due to automatic review settings June 20, 2026 22:18

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds MIDI-loop–based parameter automation for hosted VST plugins, including recording automation from MIDI CC and VST editor touches, playing it back on the audio thread, and rendering automation lanes in the loop UI. It also includes build/project plumbing updates, some input handling changes (global Insert key), and a few small UX cleanups.

Changes:

  • Add automation lanes to midi::MidiLoop and an audio-thread automation dispatch path in engine::Station.
  • Add automation record/learn/wire key handling plus editor-touch suppression logic in midi::MidiRouter, with related tests.
  • Add automation lane visualization (new shaders + render path) and update project files/resources accordingly.

Reviewed changes

Copilot reviewed 39 out of 39 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
test/JammaLib_Tests/src/vst/Vst2Plugin_Tests.cpp Adds coverage for VST2 audioMasterAutomate touch publication behavior.
test/JammaLib_Tests/src/midi/VstEditorAutomationSuppression_Tests.cpp Adds tests for editor-touch playback suppression table behavior.
test/JammaLib_Tests/src/midi/MidiRouterAutomationKey_Tests.cpp Adds tests for Insert-based automation record key state handling.
test/JammaLib_Tests/src/midi/MidiAutomationLaneResolution_Tests.cpp Adds tests for lane resolution/wiring/overwrite/phase anchor semantics.
test/JammaLib_Tests/src/engine/StationMidiInstrument_Tests.cpp Adds end-to-end automation playback + suppression tests through Station.
test/JammaLib_Tests/JammaLib_Tests.vcxproj.filters Registers new test sources in VS filters.
test/JammaLib_Tests/JammaLib_Tests.vcxproj Registers new tests and updates vcpkg library dirs.
scripts/run-vst-editor-debug.ps1 Removed (debug helper script cleanup).
scripts/bootstrap.cmd Removed (unused/incorrect bootstrap stub).
JammaLib/src/vst/VstEditorWindowManager.cpp Reuses/focuses existing editor window when reopening the same plugin.
JammaLib/src/vst/VstChain.h Adds ContainsPlugin helper for ownership checks.
JammaLib/src/vst/Vst3Plugin.h Adds IVstPlugin parameter API stubs (not yet wired for VST3 automation).
JammaLib/src/vst/Vst3Plugin.cpp Implements VST3 parameter API stubs.
JammaLib/src/vst/Vst2Plugin.h Adds parameter API + test host callback entry point.
JammaLib/src/vst/Vst2Plugin.cpp Implements VST2 parameter API + publishes last-touched param on audioMasterAutomate.
JammaLib/src/vst/Vst.cpp Defines the global last-touched parameter registry.
JammaLib/src/vst/IVstPlugin.h Extends plugin interface with Set/GetParameter + last-touched registry declaration.
JammaLib/src/midi/MidiRouter.h Adds automation key handling + suppression table APIs/state.
JammaLib/src/midi/MidiRouter.cpp Implements automation learn/wire/delete, CC recording, editor-touch capture, suppression logic.
JammaLib/src/midi/MidiLoop.h Adds automation lane data structures + phase anchor + automation APIs.
JammaLib/src/midi/MidiLoop.cpp Implements automation lane point storage/interp, overwrite windows, seqlock snapshotting.
JammaLib/src/io/IoInputSubsystem.h Adds global Insert key capture hook plumbing.
JammaLib/src/io/IoInputSubsystem.cpp Implements low-level keyboard hook + Insert polling dispatch.
JammaLib/src/graphics/VstEditorWindow.h Exposes plugin + editor HWND accessors for window manager.
JammaLib/src/graphics/MidiModel.h Adds automation rendering state + loop back-pointer plumbing.
JammaLib/src/graphics/MidiModel.cpp Implements automation “curtain” rendering using new shaders.
JammaLib/src/engine/Station.h Adds automation dispatch structures + public rebuild/resolve/test hook APIs.
JammaLib/src/engine/Station.cpp Runs automation dispatch on audio thread + builds/publishes dispatch list.
JammaLib/src/engine/Scene.h Adds global Insert capture methods; minor header formatting change.
JammaLib/src/engine/Scene.cpp Routes automation key handling through input subsystem; shuts down global capture.
JammaLib/src/engine/LoopTake.h Adds OwnsPlugin helper for editor automation ownership resolution.
JammaLib/src/engine/LoopTake.cpp Anchors MIDI loop phase on EndRecord + propagates MIDI loop sample rate.
JammaLib/JammaLib.vcxproj Updates vcpkg include directories.
Jamma/src/Main.cpp Validates saved window placement visibility; pumps global Insert capture each frame.
Jamma/resources/shaders/automation.vert Adds automation lane vertex shader.
Jamma/resources/shaders/automation.frag Adds automation lane fragment shader.
Jamma/resources/ResourceList.txt Registers the new automation shader resource.
Jamma/Jamma.vcxproj.filters Registers new shader content in VS filters.
Jamma/Jamma.vcxproj Adds vcpkg lib dir + post-build DLL copies; deploys new shaders.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +450 to +452
const bool active = _automationSource->IsAutomationLaneActive(lane);
const auto count = _automationSource->SnapshotAutomationLanePoints(lane, pts.data(), pts.size());
if (!active && 0u == count)
Comment thread JammaLib/src/midi/MidiLoop.cpp Outdated
Comment on lines +510 to +514
const auto& lane = _lanes[laneIdx];
const auto count = lane.PointCount;
if (0u == count)
return 0.0f;

Comment on lines +502 to +506
_automationDispatchCount[back] = count;
// Release pairs with the audio thread's acquire load: makes all MIDI-thread
// writes to lane Points visible before the new list is consumed.
_automationDispatch.store(buf, std::memory_order_release);
_automationDispatchBack ^= 1u;
Comment thread JammaLib/src/vst/Vst2Plugin.h Outdated
Comment on lines +128 to +137
static VstIntPtr HostCallbackForTest(AEffect* effect,
VstInt32 opcode,
VstInt32 index,
VstIntPtr value,
void* ptr,
float opt)
{
return HostCallback(effect, opcode, index, value, ptr, opt);
}

Comment thread JammaLib/src/vst/IVstPlugin.h Outdated
std::shared_ptr<IVstPlugin> MakePluginForPath(const std::wstring& path);

// Queue a plugin for destruction on the UI thread.
std::shared_ptr<IVstPlugin> MakePluginForPath(const std::wstring& path); // Queue a plugin for destruction on the UI thread.
Comment thread JammaLib/src/engine/Scene.h Outdated
actions::ActionResult _HandleUndo();
void _SetQuantisation(unsigned int quantiseSamps, utils::Timer::QuantisationType quantisation);
void _SetMidiQuantisationGrain(unsigned int grainSamps, const char* source)
void _SetQuantisation(unsigned int quantiseSamps, utils::Timer::QuantisationType quantisation); void _SetMidiQuantisationGrain(unsigned int grainSamps, const char* source)
@malisimat

Copy link
Copy Markdown
Owner Author

@copilot I've addressed the comments, do a final review of safety/performance/correctness before I merge

@malisimat malisimat merged commit bf3fa8e into master Jun 21, 2026
1 check failed
@malisimat malisimat deleted the feature/midi-automation branch June 21, 2026 11:07
Copilot stopped work on behalf of malisimat due to an error June 21, 2026 11:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants