From da336e393c808407c3b4de31606ed34ec2473548 Mon Sep 17 00:00:00 2001 From: dreamer Date: Fri, 10 Nov 2023 13:31:38 +0100 Subject: [PATCH] mention max blocksize; clamp blocksize between 1 and 256 --- docs/03.gen.daisy.md | 2 +- hvcc/generators/c2daisy/c2daisy.py | 10 ++++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/docs/03.gen.daisy.md b/docs/03.gen.daisy.md index 16cdc98d..3ac95c2c 100644 --- a/docs/03.gen.daisy.md +++ b/docs/03.gen.daisy.md @@ -79,4 +79,4 @@ This can be done by adding either to the meta.json: } ``` -Do note that the samplerate will be automatically set to either 16k, 32k, 48k, or 96k. +Do note that the samplerate will be automatically set to either 16k, 32k, 48k, or 96k. Blocksize will need to be less than 256. diff --git a/hvcc/generators/c2daisy/c2daisy.py b/hvcc/generators/c2daisy/c2daisy.py index 3436a2da..e72c7298 100644 --- a/hvcc/generators/c2daisy/c2daisy.py +++ b/hvcc/generators/c2daisy/c2daisy.py @@ -84,11 +84,17 @@ def compile( component_glue['header'] = f"HeavyDaisy_{patch_name}.hpp" component_glue['max_channels'] = board_info['channels'] component_glue['num_output_channels'] = num_output_channels + 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') - component_glue['blocksize'] = daisy_meta.get('blocksize') - component_glue['has_midi'] = board_info['has_midi'] + + blocksize = daisy_meta.get('blocksize') + + if blocksize: + component_glue['blocksize'] = max(min(256, blocksize), 1) + else: + component_glue['blocksize'] = None component_glue['copyright'] = copyright_c