Skip to content

Commit

Permalink
fixes for daisy samplerate; daisy docs
Browse files Browse the repository at this point in the history
  • Loading branch information
dromer committed Dec 4, 2023
1 parent 36fe158 commit 77560ea
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 5 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 !!
Expand Down
20 changes: 20 additions & 0 deletions docs/03.gen.daisy.md
Original file line number Diff line number Diff line change
Expand Up @@ -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).
Expand Down
26 changes: 22 additions & 4 deletions hvcc/generators/c2daisy/c2daisy.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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)

Expand Down
2 changes: 1 addition & 1 deletion hvcc/generators/c2daisy/templates/HeavyDaisy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 77560ea

Please sign in to comment.