xtc/examples/juce/README.md

96 lines
4.7 KiB
Markdown
Raw Normal View History

2026-11-06 18:29:35 +01:00
# JUCE + xtc examples
These optional examples use an external **JUCE 9.0.4** checkout (qualified
revision `3fb5cbc0340758596dac39f7c8de47d562b4896e`). JUCE is AGPLv3/commercial;
a commercial licence may be required for distribution. Read
[the integration/license details](../../docs/JUCE.md). Original xtc example code
is MIT; JUCE and combined binaries retain their applicable licence obligations.
No SDK or linked binary is copied into normal xtc packages.
## Build and test (Linux)
Supply JUCE explicitly, for example in `/your/path/JUCE`. With CMake >= 3.25,
GNU Make, a C/C++17 toolchain and JUCE's Linux development prerequisites:
```sh
make JUCE_ROOT=/your/path/JUCE juce-examples
make JUCE_ROOT=/your/path/JUCE test-juce
```
The build never downloads JUCE, installs dependencies or copies plugins into
user plugin directories. It builds its own C99 PIC archive with JACK/FLTK disabled
under `build/juce/c-core`. `test-juce` also requires Xvfb and runs the processor
and JUCE-host checks, then loads the built instrument through xtc's C VST3 host.
Normal `make`, `make gui` and `make test` remain JUCE-independent.
Build products:
- `build/juce/XtcJuceSynth_artefacts/Release/VST3/xtc JUCE Synth.vst3`
- `build/juce/XtcJuceSynth_artefacts/Release/Standalone/xtc JUCE Synth`
- `build/juce/xtc-juce-render_artefacts/Release/xtc-juce-render`
Set `BUILD_DIR=...` to move the main build root, or `JUCE_BUILD_DIR=...` to select
only the SDK example build directory.
## Play and shape Soft Keys
```sh
"./build/juce/XtcJuceSynth_artefacts/Release/Standalone/xtc JUCE Synth"
```
The standalone opens JUCE's audio/MIDI device interface. Select the intended
output and MIDI inputs explicitly. Play its on-screen keyboard or a selected
MIDI source. Enable **Filter + reverb**, adjust Tone/Room/Mix, and set Output.
Save/load `.xtcjuce` presets; Panic clears held voices. The native editor is also
available when loading the VST3 into a host with editor support. xtc's existing
C host supports its default instrument configuration, without the JUCE editor.
Building/testing these examples does not open a physical audio device. Running
the standalone may open the system default device; hardware playback is not
inferred from successful builds.
## Render a chord or MIDI file without an audio server
```sh
./build/juce/xtc-juce-render_artefacts/Release/xtc-juce-render --render /absolute/new-demo.wav
./build/juce/xtc-juce-render_artefacts/Release/xtc-juce-render --render /absolute/new-song.wav --midi /absolute/song.mid
```
The output is 48 kHz stereo float32 WAV with filter/reverb enabled and -6 dB
output. The default renders a staggered C-major chord. MIDI input is type 0/1
PPQN, including its tempo map, merged stably across tracks. Supported note,
CC and bend messages use rounded sample positions; other messages are ignored.
Input limits: 4 MiB, 100000 supported events and ten minutes of event timestamps.
The renderer allows half a second after the last event, forces all-notes-off,
then renders a fixed three-second tail. It does not derive exact plugin tails.
Output is written to a same-directory temporary file and atomically linked to
an absent destination. Existing files are preserved, including a concurrent
creator at publication. Errors remove the temporary and publish no output.
On a machine without an X server, prefix commands with `xvfb-run -a`.
## Inspect/host a trusted VST3
```sh
./build/juce/xtc-juce-render_artefacts/Release/xtc-juce-render --inspect-vst3 /absolute/Plugin.vst3
./build/juce/xtc-juce-render_artefacts/Release/xtc-juce-render --host-check "$PWD/build/juce/XtcJuceSynth_artefacts/Release/VST3/xtc JUCE Synth.vst3"
```
Inspection loads only the named module, enumerates its classes and instantiates
them to list parameters and channels. It executes trusted code and is not an
isolated scanner. `--host-check` is specific to the example: it checks five
parameters, opaque state restoration and actual MIDI processing through JUCE's
VST3 host. These operations do not start an audio device.
## Regression checks and an actual editor image
```sh
xvfb-run -a ctest --test-dir build/juce --output-on-failure
xvfb-run -a ./build/juce/xtc-juce-render_artefacts/Release/xtc-juce-render --snapshot /absolute/new-editor.png
```
The processor test checks exact C-synth output, note timing, variable blocks,
mono/stereo, reset, host/GUI MIDI overflow, preset recovery and effect processing.
The snapshot command renders the actual editor to a 1560 × 980 PNG and checks
that it can close/reopen without starting audio hardware. It refuses to overwrite
a destination. Windows/macOS, alternate plugin formats and physical devices have
not been qualified. See [Phase 107](../../docs/ROADMAP.md) for recorded results.