diff --git a/CHANGELOG.md b/CHANGELOG.md index ba973e56..cbab2047 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ Next Release * Documentation fixes/additions * Daisy: ability to set samplerate and blocksize * Daisy: adding midirealtimein, polytouchin/out, midiin (midiout WIP) +* Daisy: use `libdaisy_path` in meta config; both string/path and int/depth possible * DPF: enum for UI parameter IDs * DPF bugfixes: correct input PortGroup names; correct UI slider updates; midiout reimplementation * Wwise: complete rewrite/refactor - now uses SDK build tools - thanks to @eu-ch !! diff --git a/docs/03.gen.daisy.md b/docs/03.gen.daisy.md index 0e85ede7..362e5c26 100644 --- a/docs/03.gen.daisy.md +++ b/docs/03.gen.daisy.md @@ -34,6 +34,26 @@ The custom layout can be passed on via the meta.json as such: } ``` +You can also set a custom path to your libDaisy directory. This can either be a string to the full or relative path or a number indicating the levels deep this directory is compared to the output directory. The default value for this is `2`. + +```json +{ + "daisy": { + "libdaisy_path": "/somewhere/libdaisy/" + } +} +``` + +Or the level: + +```json +{ + "daisy": { + "libdaisy_path": 5 + } +} +``` + ## MIDI Board files that have `OOPSY_TARGET_HAS_MIDI_INPUT` configured will automatically set up UART MIDI on the default USART1 Rx and Tx pins of the Daisy (D13/14). diff --git a/hvcc/generators/c2daisy/c2daisy.py b/hvcc/generators/c2daisy/c2daisy.py index 00a8d41f..490f5009 100644 --- a/hvcc/generators/c2daisy/c2daisy.py +++ b/hvcc/generators/c2daisy/c2daisy.py @@ -88,10 +88,22 @@ def compile( component_glue['has_midi'] = board_info['has_midi'] component_glue['debug_printing'] = daisy_meta.get('debug_printing', False) component_glue['usb_midi'] = daisy_meta.get('usb_midi', False) - component_glue['samplerate'] = daisy_meta.get('samplerate') - blocksize = daisy_meta.get('blocksize') + # samplerate + samplerate = daisy_meta.get('samplerate', 48000) + if samplerate >= 96000: + component_glue['samplerate'] = 96000 + elif samplerate >= 48000: + component_glue['samplerate'] = 48000 + elif samplerate >= 32000: + component_glue['samplerate'] = 32000 + elif samplerate >= 16000: + component_glue['samplerate'] = 16000 + else: + component_glue['samplerate'] = 8000 + # blocksize + blocksize = daisy_meta.get('blocksize') if blocksize: component_glue['blocksize'] = max(min(256, blocksize), 1) else: @@ -115,8 +127,14 @@ def compile( makefile_replacements['linker_script'] = daisy_meta.get('linker_script', '') if makefile_replacements['linker_script'] != '': makefile_replacements['linker_script'] = daisy_meta["linker_script"] - depth = daisy_meta.get('libdaisy_depth', 2) - makefile_replacements['libdaisy_path'] = f'{"../" * depth}libdaisy' + + # libdaisy path + path = daisy_meta.get('libdaisy_path', 2) + if isinstance(path, int): + makefile_replacements['libdaisy_path'] = f'{"../" * path}libdaisy' + elif isinstance(path, str): + makefile_replacements['libdaisy_path'] = path + makefile_replacements['bootloader'] = daisy_meta.get('bootloader', '') makefile_replacements['debug_printing'] = daisy_meta.get('debug_printing', False) diff --git a/hvcc/generators/c2daisy/templates/HeavyDaisy.cpp b/hvcc/generators/c2daisy/templates/HeavyDaisy.cpp index e957dca8..72190bfe 100644 --- a/hvcc/generators/c2daisy/templates/HeavyDaisy.cpp +++ b/hvcc/generators/c2daisy/templates/HeavyDaisy.cpp @@ -4,7 +4,7 @@ #include "Heavy_{{patch_name}}.hpp" #include "HeavyDaisy_{{patch_name}}.hpp" -#define SAMPLE_RATE 48000.f +#define SAMPLE_RATE {{samplerate}}.f {% if has_midi or usb_midi %} #define HV_HASH_NOTEIN 0x67E37CA3