Songbird C++ Backend (app/)
The C++ backend is a standalone JUCE desktop application that hosts a Tracktion Engine audio engine and communicates with a React-based UI through a WebView bridge.
Architecture Overview
Key Classes
SongbirdEditor (SongbirdEditor.h/.cpp)
The main application component. Owns the Tracktion Engine, the WebView, and orchestrates all subsystems. Inherits from juce::Component, juce::Timer, and juce::AudioProcessorListener.
Responsibilities:
- Application lifecycle (constructor, destructor, timer loop)
- Bird file loading and reloading
- Plugin state tracking (audio thread → UI sync)
- Undo/redo orchestration
- Export (stems, master, sheet music)
- MIDI editing helpers (piano roll → bird file round-trip)
WebViewBridge (WebViewBridge.cpp)
Implements createWebViewOptions() which registers all JS↔C++ native function handlers. This is the sole communication layer between React and C++.
Handler domains:
- State —
loadState,updateState,resetState,reactReady,getHistory - Transport —
transportPlay/Pause/Stop/Seek,setLoopRange,setBpm,setProjectScale - Plugins —
openPlugin,changePlugin,getPluginParams,setPluginParam,getAvailablePlugins - Mixer —
setTrackMixer,setMixerParamRT,setSidechainSource - Bird Files —
readBird,loadBird,updateBird,writeBirdUser,saveBird - Export —
exportSheetMusic,exportStems,exportMaster - MIDI —
listMidiInputs,setMidiInput,sendKeyboardMidi, recording controls - Settings —
getApiKey,setApiKey,getSystemTheme,setZoom,uiReady - AI —
addGeneratedTrack,removeGeneratedTrack, Lyria config/prompts
StateSync (StateSync.cpp)
Bidirectional state synchronization between Zustand stores (React) and the Tracktion Engine:
handleStateUpdate()— dispatches incoming Zustand state to engine (transport, mixer)applyTransportState()— maps transport store →te::TransportControlapplyMixerState()— maps mixer store → track volume/pan/mute/solocreateTrackWatchers()— per-track ValueTree listeners for C++ → React push
BirdLoader (BirdLoader.h/.cpp)
Parser for the .bird music notation format. Converts .bird text files into Tracktion Engine edits.
Pipeline: .bird text → parse() → BirdParseResult → populateEdit() → te::Edit
ProjectState (ProjectState.h/.cpp)
Git-based undo/redo system using libgit2. Manages an in-process git repository for the project directory.
Key operations: commit(), undo(), redo(), revertLastLLM(), getHistory()
PlaybackInfo (PlaybackInfo.h/.cpp)
Real-time audio analysis and transport position tracking. Runs on a 30Hz timer, processes the master audio buffer for level meters, spectrum analysis, stereo width, and phase correlation.
MidiRecorder / AudioRecorder
Real-time recording systems that capture MIDI/audio input and write to Tracktion clips.MacroMapper (MacroMapper.h/.cpp)
Maps high-level macro parameters (e.g., “drive”, “warmth”) to specific plugin parameters on channel strips like Console 1.
Data Flow
Bird File Loading
State Synchronization
Build
SongbirdPlayer.app in build/SongbirdPlayer_artefacts/.