Skip to content

Commit

Permalink
allow setting samplerate and blocksize for Daisy using meta info
Browse files Browse the repository at this point in the history
  • Loading branch information
dromer committed Nov 10, 2023
1 parent 9b2c80e commit 8bf154d
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ Next Release

* Objects: `[bang~]`
* Documentation fixes/additions
* Daisy: ability to set samplerate and blocksize
* DPF: enum for UI parameter IDs
* DPF bugfixes: correct input PortGroup names

Expand Down
2 changes: 2 additions & 0 deletions hvcc/generators/c2daisy/c2daisy.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,8 @@ def compile(
component_glue['num_output_channels'] = num_output_channels
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']

component_glue['copyright'] = copyright_c
Expand Down
6 changes: 6 additions & 0 deletions hvcc/generators/c2daisy/templates/HeavyDaisy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,12 @@ void HandleMidiMessage(MidiEvent m)
int main(void)
{
hardware.Init(true);
{% if samplerate is not none %}
hardware.SetAudioSampleRate({{samplerate}});
{% endif %}
{% if blocksize is not none %}
hardware.SetAudioBlockSize({{blocksize}});
{% endif %}
{% if has_midi %}
MidiUartHandler::Config midi_config;
hardware.midi.Init(midi_config);
Expand Down

0 comments on commit 8bf154d

Please sign in to comment.