Skip to content

Commit

Permalink
Merge branch 'develop' into dpf/cv_ports
Browse files Browse the repository at this point in the history
  • Loading branch information
dromer committed Nov 15, 2023
2 parents 317cbe5 + daa5c94 commit 44ed563
Show file tree
Hide file tree
Showing 20 changed files with 114 additions and 186 deletions.
2 changes: 2 additions & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
github: Wasted-Audio
patreon: WastedAudio
ko_fi: wastedaudio
liberapay: WastedAudio
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:
jobs:
build:

runs-on: ubuntu-latest
runs-on: ubuntu-20.04
strategy:
matrix:
python-version: ['3.7', '3.8', '3.9', '3.10', '3.11']
Expand Down
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,16 @@
CHANGELOG
=====

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
* Cleanup: remove deprecated build.json

0.9.0
-----

Expand Down
49 changes: 30 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# Heavy Compiler Collection (hvcc)

[![Build Status](https://github.com/Wasted-Audio/hvcc/actions/workflows/build.yml/badge.svg)](https://github.com/Wasted-Audio/hvcc/actions)
[![pypi](https://img.shields.io/pypi/v/hvcc.svg)](https://pypi.python.org/pypi/hvcc)
[![python](https://img.shields.io/pypi/pyversions/hvcc.svg)](https://pypi.python.org/pypi/hvcc)

`hvcc` is a python-based dataflow audio programming language compiler that generates C/C++ code and a variety of specific framework wrappers.

Expand All @@ -12,9 +14,36 @@ The goal was to leverage Pure Data as a design interface and statically interpre

It has since then been expanded to provide further support for many different platforms and frameworks, targeting game audio design, daw plugins and embedded production tools. In 2021 Wasted Audio took over maintenance of the project.

## Documentation

* [Introduction](/docs/01.introduction.md)
* [What is heavy?](/docs/01.introduction.md#what-is-heavy)
* [Supported patch formats](/docs/01.introduction.md#supported-patch-formats)
* [Supported platforms](/docs/01.introduction.md#supported-platforms)
* [Supported frameworks](/docs/01.introduction.md#supported-frameworks)
* [Licensing](/docs/01.introduction.md#licensing)
* [Getting Started](/docs/02.getting_started.md)
* [Generators](/docs/03.generators.md)
* [MIDI](/docs/04.midi.md)
* [C API](/docs/05.c.md)
* [C++ API](/docs/06.cpp.md)
* [Heavy Lang Info](/docs/07.heavy_lang.md)
* [Heavy IR Info](/docs/08.heavy_ir_lang.md)
* [Supported vanilla objects](/docs/09.supported_vanilla_objects.md)
* [Unsupported vanilla objects](/docs/10.unsupported_vanilla_objects.md)

## Integrations

hvcc has been integrated into several projects and services. This allows to easily compile patches without having to install hvcc manually.

* [plugdata](https://plugdata.org/) - a new way to use Pure Data. Includes a full toolchain and targets Daisy, DPF and pd externals.
* [mod-cloud-builder](https://github.com/moddevices/mod-cloud-builder) - An online service for building LV2 plugins for the MOD platform.
* [OWL Patch Library](https://www.rebeltech.org/patch-library) - An online service for building OWL plugins (uses an old fork).

## Requirements

* python 3.7 or higher
python 3.7 or higher

* `jinja2` (for generator templating)
* `importlib_resources` (for reading static resources)
* `json2daisy` (for daisy integration)
Expand Down Expand Up @@ -113,24 +142,6 @@ This can be changed with `--copyright` parameter

Displays all the available parameters and options for hvcc.

## Documentation

* [Introduction](/docs/01.introduction.md)
* [What is heavy?](/docs/01.introduction.md#what-is-heavy)
* [Supported patch formats](/docs/01.introduction.md#supported-patch-formats)
* [Supported platforms](/docs/01.introduction.md#supported-platforms)
* [Supported frameworks](/docs/01.introduction.md#supported-frameworks)
* [Licensing](/docs/01.introduction.md#licensing)
* [Getting Started](/docs/02.getting_started.md)
* [Generators](/docs/03.generators.md)
* [MIDI](/docs/04.midi.md)
* [C API](/docs/05.c.md)
* [C++ API](/docs/06.cpp.md)
* [Heavy Lang Info](/docs/07.heavy_lang.md)
* [Heavy IR Info](/docs/08.heavy_ir_lang.md)
* [Supported vanilla objects](/docs/09.supported_vanilla_objects.md)
* [Unsupported vanilla objects](/docs/10.unsupported_vanilla_objects.md)

## Contact

There are several places where heavy/hvcc conversation is happening:
Expand Down
2 changes: 1 addition & 1 deletion docs/01.introduction.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ Heavy can interpret and convert a subset of features from Pure Data patches:

## Supported Platforms

* Windows 8, 10 and WSA
* Windows 10, 11 and WSA
* Mac OSX
* Linux
* PS4
Expand Down
3 changes: 3 additions & 0 deletions docs/02.getting_started.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,10 @@ If you experience any problems or have some thoughts on how to improve heavy mak

## Known Limitations

* Many objects do not take control signals on their left inlet. `[osc~]` for instance always requires the use of `[sig~]` before connecting a value.
* Heavy does not support symbols in `[pack]`. e.g. `[pack s f]`.
* Heavy does not support numbers in `[unpack]`, e.g. `[unpack 0 0]` gives `Heavy only supports arguments 'f' and 's' to unpack.` Workaround is to use `f` instead, e.g. `[unpack f f]`, and if necessary prime the default values with a `[loadbang]` and `[0 0(`.
* Sliders and number inputs are converted to `[f ]` and thus do not store send/receive/initialization/etc. settings.
* Heavy does not accept arguments and control connections to: `[rzero~]`, `[rzero_rev~]`, `[czero~]`, `[czero_rev~]`. In Heavy, these objects accept only signal inputs. Arguments and control connections are ignored.
* On the `[select]` object it is currently not possible to set the arguments via the right inlet (internally a hardcoded switch_case is used).
* `[metro]` and `[timer]` objects do not accept tempo messages or unit arguments.
Expand Down
23 changes: 20 additions & 3 deletions docs/03.gen.daisy.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@

Daisy is an embedded platform for music. It features everything you need for creating high fidelity audio hardware devices.

This Generator is typically it is used in combination with [pd2dsy](https://github.com/electro-smith/pd2dsy).

Currently daisy platform is supported for:

* `field`
* `seed`
* `pod`
* `petal`
* `patch`
* `patch_init`
* `patch_sm`
* `field`

Which can be configured using the `-m` metadata.json `daisy.board` setting:

Expand Down Expand Up @@ -50,6 +50,8 @@ Additionally `usb_midi`, running on the onboard micro-usb, can be enabled separa

At the moment all midi messages will be merged between USB and UART MIDI interfaces. In the future it will likely be possible to assign additional UART pins and group them under a specific PD midi "port".

Currently supported MIDI messages are: Note On/Off, Control Change, Program Change, Channel Pressure, and Pitch Bend.

## [print] object

Printing to serial console can be enabled using the `debug_printing` flag in the meta.json:
Expand All @@ -63,3 +65,18 @@ Printing to serial console can be enabled using the `debug_printing` flag in the
```

This will increase the program size with a few kb and will disable `usb_midi` as we currently do not have composite USB device yet.

## Custom samplerate and blocksize

This can be done by adding either to the meta.json:

```json
{
"daisy": {
"samplerate": 96000,
"blocksize": 128
}
}
```

Do note that the samplerate will be automatically set to either 16k, 32k, 48k, or 96k. Blocksize will need to be 256 or less and is automatically capped.
1 change: 1 addition & 0 deletions docs/09.supported_vanilla_objects.md
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ wrap
/~
abs~
adc~
bang~
biquad~
bp~
catch~
Expand Down
1 change: 0 additions & 1 deletion docs/10.unsupported_vanilla_objects.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ value
## Signal Objects

```list
bang~
block~
bob~
bonk~
Expand Down
Empty file.
85 changes: 0 additions & 85 deletions hvcc/generators/buildjson/buildjson.py

This file was deleted.

15 changes: 9 additions & 6 deletions hvcc/generators/c2daisy/c2daisy.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

from typing import Dict, Optional

from ..buildjson import buildjson
from ..copyright import copyright_manager
from . import parameters

Expand Down Expand Up @@ -84,9 +83,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['has_midi'] = board_info['has_midi']
component_glue['samplerate'] = daisy_meta.get('samplerate')

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

Expand Down Expand Up @@ -117,10 +124,6 @@ def compile(

# ======================================================================================

buildjson.generate_json(
out_dir,
linux_x64_args=["-j"])

return {
"stage": "c2daisy",
"notifs": {
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
26 changes: 18 additions & 8 deletions hvcc/generators/c2dpf/templates/HeavyDPF_UI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,14 @@
START_NAMESPACE_DISTRHO

// --------------------------------------------------------------------------------------------------------------------
{%- if receivers|length > 0 %}
enum HeavyParams {
{%- for k, v in receivers %}
{{v.display|upper}},
{%- endfor %}
};
{%- endif %}

class ImGuiPluginUI : public UI
{
{% for k, v in receivers -%}
Expand Down Expand Up @@ -51,7 +59,7 @@ class ImGuiPluginUI : public UI
{%- if receivers|length > 0 %}
switch (index) {
{% for k, v in receivers -%}
case {{loop.index-1}}:
case {{v.display|upper}}:
{%- if v.attributes.type == 'bool': %}
f{{v.display|lower}} = value != 0.0f;
{%- else %}
Expand Down Expand Up @@ -105,8 +113,8 @@ class ImGuiPluginUI : public UI
if (ImGui::Selectable({{enum_list}}[n], is_selected))
{
f{{v_display}} = n;
editParameter({{loop.index-1}}, true);
setParameterValue({{loop.index-1}}, f{{v_display}});
editParameter({{v.display|upper}}, true);
setParameterValue({{v.display|upper}}, f{{v_display}});
}
if (is_selected)
ImGui::SetItemDefaultFocus();
Expand All @@ -116,23 +124,25 @@ class ImGuiPluginUI : public UI
{%- else %}
{%- if v.attributes.type == 'bool': %}
if (ImGui::Toggle("{{v.display.replace('_', ' ')}}", &f{{v_display}}))
{%- elif v.attributes.type == 'int' %}
if (ImGui::SliderInt("{{v.display.replace('_', ' ')}}", &f{{v_display}}, {{v.attributes.min}}f, {{v.attributes.max}}f))
{%- else %}
if (ImGui::SliderFloat("{{v.display.replace('_', ' ')}}", &f{{v_display}}, {{v.attributes.min}}f, {{v.attributes.max}}f))
{%- endif %}
{
if (ImGui::IsItemActivated())
{
editParameter({{loop.index-1}}, true);
setParameterValue({{loop.index-1}}, f{{v_display}});
editParameter({{v.display|upper}}, true);
setParameterValue({{v.display|upper}}, f{{v_display}});
}
}
{%- endif %}
{% endfor %}
if (ImGui::IsItemDeactivated())
{
{%- for i in range(0, receivers|length) %}
editParameter({{i}}, false);
{%- endfor %}
{%- for k, v in receivers -%}
editParameter({{v.display|upper}}, false);
{% endfor -%}
}
}
ImGui::End();
Expand Down
Loading

0 comments on commit 44ed563

Please sign in to comment.