The goal of this project is to offer mock classes of the Reason SDK APIs in order to be able to unit test (or black box test) rack extensions (for Reason DAW by Reason Studios).
- Allow for testing rack extensions by fully controlling the event loop
- Supports 100% of
Jukebox.h
functions (ex:JBox_LoadMOMProperty
) - Supports 100% of
jbox.lua
functions (inrealtime_controller.lua
) (ex:jbox.load_sample_async
) - Load
info.lua
,motherboard_def.lua
andrealtime_controller.lua
to build the rack extension exactly as Reason does - Support loading and saving sample files (wav, aiff...)
- Support loading patch files (for example a patch file saved in Recon/Reason)
- Support for simulating slow loads and errors (when loading samples or blobs)
- Support loading midi files to populate the sequencer track
- Powerful APIs to help in common testing use cases (like "playing an instrument" or "processing a sample through an effect")
- much, much more
Example of unit test (using GoogleTest):
// Creates a config by reading info.lua, motherboard_def.lua and realtime_controller.lua
auto c = DeviceConfig<MyInstrument>::fromJBoxExport(RE_CMAKE_PROJECT_DIR);
// Creates a tester for the device (an instrument device)
auto tester = InstrumentTester<MyInstrument>(c, 48000);
// wiring main out sockets
tester.wireMainOut("OutLeft", "OutRight");
// first batch = initialization
tester.nextBatch();
// load a patch to set all the parameters of the device to a known state
tester.device().loadPatch("/Public/Sync Bell.repatch");
// apply patch
tester.nextBatch();
// import a Midi file containing note on/off events
tester.importMidi(resource::File{fmt::path(RE_CMAKE_PROJECT_DIR, "test", "midi", "test1.mid")});
// set the transport position at the start of bar 2
tester.transportPlayPos(sequencer::Time(2,1,1,0));
// play for 2 bars (so bar 2 and 3) and captures the output
auto sample = tester.bounce(sequencer::Duration::k1Beat_4x4 * 2);
// make sure that the sample is what we expect
ASSERT_EQ(*sample, *tester.loadSample(resource::File{fmt::path(RE_CMAKE_PROJECT_DIR, "test", "wav", "test1.wav")));
// Optionally the sample can be saved to a file (for listening to it or opening in an audio visualizer...)
// tester.saveSample(*sample, resource::File{"/tmp/result.wav"});
Example of command line tool: offline effect processor
// invoke with <path to RE>, <patch>, <input file (to process)>, <output file (result)>
int main(int argc, char *argv[])
{
// ignoring all error handling for this brief example!!!
auto c = DeviceConfig<MyEffect>::fromJBoxExport(argv[1]);
auto tester = StudioEffectTester<MyEffect>(c);
tester.device().loadPatch(argv[2]); // set the device in a known state (optional of course)
auto sample = tester.processSample(argv[3]);
tester.saveSample(*sample, resource::File{argv[4]});
}
- Upgraded SDK to 4.5.0 (although there is no API change)
- Added support for
device_categories
ininfo.lua
which was added as a new requirement with Reason 13 - Deprecated automatic support for
std::filesystem::path
infmt
due to UTF8: usepath.u8string()
instead
- Upgraded SDK to 4.4.0
- Embed the Jukebox SDK API (2 header files) to make this project totally standalone with 0 external dependencies (unless you run the tests which depend on GoogleTest)
- Fixed hard coded path in test
- When no SDK installed, the sanity check tests are skipped
- Integrate with github-actions to automatically run the tests on a matrix of machines (macOS / Windows)
- Updated google test version and use hash to guarantee download
- Fixed issue when the same
source
was defined multiple times (to differentdest
) inrtc_bindings
inrealtime_controler.lua
- Use miniaudio instead of libsndfile for loading/saving audio files: this makes generating the CMake project and compiling much faster. As a result the CMake option
RE_MOCK_SUPPORT_FOR_AUDIO_FILE
has been removed entirely. - Minor bug fix (wrong message)
- Removed warnings
- Updated libsnfile and GoogleTest to new versions
- Download the version instead of cloning the full repo
- Adjusted property type and owner (
/device_host/delete_sample
,/device_host/edit_sample
,/transport/pattern_index
,/transport/pattern_start_pos
) - Made boolean a stepped property (2 steps)
- Read all fields from
info.lua
- Introduced
JboxPropertyType
for symetry in the APIs and made some enums bitmasks
- Much better error reporting (when error in lua files)
- Use of
std::filesystem
throughout the APIs - Use
stb_sprintf
for better performance
On macOS, the
std::filesystem
APIs were introduced in macOS 10.15, so as a result,re-mock
now requires a minimum of macOS 10.15
- Handle discrete properties
instance
is now optional (although it does not make a lot of sense for a real device, some examples in the SDK do not have one!)- added missing
/transport/muted
property - allow string parameter in
jbox.native_object
default parameter list - Exposes more internal APIS (like
JboxPropertyInfo
) in order to build other tools on top ofre-mock
- Fixed various bugs
- Fixes for Windows 10
- Reached maturity to be a 1.0.0 release (70 commits since 0.9.3!)
- Added
ui_percent
to the list of ignored lua keywords
- Fixed output buffers not being cleaned before
nextFrame
- Fixed input buffers not being cleaned after
nextFrame
- Fixed "warning: unused function 'compare'" message
- Added missing licenses
- First Beta/Feedback release.
-
This project is released under the terms of the Apache 2.0 license
-
This project uses the Rack extension SDK released under the Rack Extension License agreement. Note that the API (2 header files) is included in this project.
-
This project includes lua-cmake released under an MIT License
-
This project includes lua 5.4.1 released under an MIT License
-
This project includes midifile released under a BSD 2-Clause "Simplified" License
-
This project includes stb_sprintf released under a Public Domain License
-
This project includes miniaudio relased under a Public Domain License
-
This project uses GoogleTest released under a BSD 3-Clause License (only for testing the project itself)