Skip to content

Commit

Permalink
Merge branch 'v0.11'
Browse files Browse the repository at this point in the history
  • Loading branch information
dromer committed Feb 16, 2024
2 parents cd6e41a + f12dfa3 commit 948e213
Show file tree
Hide file tree
Showing 38 changed files with 398 additions and 383 deletions.
2 changes: 1 addition & 1 deletion .bumpversion.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[bumpversion]
current_version = 0.10.0
current_version = 0.11.0

[bumpversion:file:setup.cfg]

Expand Down
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
[submodule "tests/src/midifile"]
path = tests/src/midifile
url = https://github.com/craigsapp/midifile.git
[submodule "tests/src/tinywav"]
path = tests/src/tinywav
url = https://github.com/mhroth/tinywav.git
16 changes: 16 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,22 @@
CHANGELOG
=====

0.11.0
-----

* Core: add attributes and send type to send params
* DPF: add "read only" outputParameter type based on send params
* JS: add output Parameter and output Event to generator and html template
* Daisy: update `wstd2daisy` and allow for setting `displayprocess` code into the template
* Testing: move `tinywav` to git submodule
* JS Bugfix: printHook and sendHook for AudioWorklet; mention emsdk limitations in docs
* Object Bugfix: `[stripnote]` missing right inlet
* Small Bugfixes:
* set default name argument
* `emcc` call on Windows - thanks to @vulcu
* deallocation in test_signal - thanks to @eu-ch
* quotes around WWISE paths - thanks to @eu-ch

0.10.0
-----

Expand Down
26 changes: 15 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,21 +36,25 @@ It has since then been expanded to provide further support for many different pl

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).
* [plugdata](https://plugdata.org/) - Modern interface for Pure Data. Includes a full cross-platform toolchain and targets Daisy, DPF and PD Externals.
* [mod-cloud-builder](https://github.com/moddevices/mod-cloud-builder) - Online service for building LV2 plugins for the MOD platform.
* [OWL Patch Library](https://www.rebeltech.org/patch-library) - Online service for building OWL plugins (uses an old fork).

## Requirements

python 3.8 until 3.12
Python 3.8 up to 3.12

* `jinja2` (for generator templating)
* `importlib_resources` (for reading static resources)
* `json2daisy` (for daisy integration)
* `tox` (for tests, optional)
* `numpy/scipy` (for tests, optional)
* `midifile` (for tests, optional)
* `clang/clang++` (for building tests, optional)
* `jinja2` (for generator templating)
* `importlib_resources` (for reading static resources)
* `json2daisy` (for daisy integration)

For tests:

* `tox` (python install)
* `numpy/scipy` (requirements-dev)
* `midifile` (git submodule)
* `tinywav` (git submodule)
* `clang/clang++` (system install)

## Installation

Expand Down
4 changes: 3 additions & 1 deletion docs/02.getting_started.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ To send audio output add a `[dac~]` The number of channels can be configured by

Note that top-level graphs (e.g. `_main.pd`) should not have any `[inlet~]` or `[outlet~]` objects. These are reserved only for abstractions.

> NOTE: Currently if your main patch does not have at least an `adc~` or `dac~` configured signal rate objects will not be evaluated in the graph!
## Exposing Parameters

### Input Parameters
Expand Down Expand Up @@ -40,7 +42,7 @@ See the specific framework details for more information on output parameter supp

## Exposing Events

All (control) `[receive]` and `[r]` objects annotated with `@hv_event` will be exposed as events in the Unity target only.
All (control) `[receive]` and `[r]` objects annotated with `@hv_event` will be exposed as events in the Unity and Javascript targets only.

![events](img/docs_exposed_events.png)

Expand Down
4 changes: 4 additions & 0 deletions docs/03.gen.javascript.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Javascript

> Emscripten versions 3.1.42 until 3.1.47 contain a bug that breaks our builds.
>
> Use a version earlier or later with this Generator for functional output.
## Getting Started

Heavy can provide a Javascript (JS) implementation of your patch using WebAssembly. The library provides a basic interface for processing audio, handling playback and sending or receiving messages. Both `AudioWorklet` and `ScriptProcessorNode` are supported. The old `asm.js` implementation has been deprecated.
Expand Down
14 changes: 7 additions & 7 deletions docs/03.gen.wwise.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,15 +101,15 @@ cd Hvcc_Out_Dir\wwise
Generate Visual Studio project files; note, WWISEROOT environment variable can be set from Wwise Launcher by clicking on *Set Environment Variables* button in front of an installed Wwise entry:

```cmd
python %WWISEROOT%\Scripts\Build\Plugins\wp.py premake Authoring
python %WWISEROOT%\Scripts\Build\Plugins\wp.py premake Windows_vc160
python "%WWISEROOT%\Scripts\Build\Plugins\wp.py" premake Authoring
python "%WWISEROOT%\Scripts\Build\Plugins\wp.py" premake Windows_vc160
```

Build Authoring and Engine plugins in Release configurations; for Visual Studio 2022 replace vc160 with vc170:

```cmd
python %WWISEROOT%\Scripts\Build\Plugins\wp.py build -c Release -x x64 -t vc160 Authoring
python %WWISEROOT%\Scripts\Build\Plugins\wp.py build -c Release -x x64 -t vc160 Windows_vc160
python "%WWISEROOT%\Scripts\Build\Plugins\wp.py" build -c Release -x x64 -t vc160 Authoring
python "%WWISEROOT%\Scripts\Build\Plugins\wp.py" build -c Release -x x64 -t vc160 Windows_vc160
```

At this point, the plugins should be placed in correct SDK directories and be ready for use in the Authoring app.
Expand All @@ -119,9 +119,9 @@ At this point, the plugins should be placed in correct SDK directories and be re
We can go a step further and package the plugins into a bundle that can be installed conveniently from Wwise Launcher.

```cmd
python %WWISEROOT%\Scripts\Build\Plugins\wp.py package --version 2022.1.0.1 Authoring
python %WWISEROOT%\Scripts\Build\Plugins\wp.py package --version 2022.1.0.1 Windows_vc160
python %WWISEROOT%\Scripts\Build\Plugins\wp.py generate-bundle --version 2022.1.0.1
python "%WWISEROOT%\Scripts\Build\Plugins\wp.py" package --version 2022.1.0.1 Authoring
python "%WWISEROOT%\Scripts\Build\Plugins\wp.py" package --version 2022.1.0.1 Windows_vc160
python "%WWISEROOT%\Scripts\Build\Plugins\wp.py" generate-bundle --version 2022.1.0.1
mkdir Bundle
copy /y bundle.json Bundle
copy /y *.tar.xz Bundle
Expand Down
1 change: 1 addition & 0 deletions hvcc/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -316,6 +316,7 @@ def main() -> bool:
parser.add_argument(
"-n",
"--name",
default="heavy",
help="Provides a name for the generated Heavy context.")
parser.add_argument(
"-m",
Expand Down
2 changes: 2 additions & 0 deletions hvcc/core/hv2ir/HIrSend.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,10 @@ def get_ir_control_list(self) -> List:
on_message_list = [x for o in receive_objs for x in o.get_ir_on_message(inlet_index=0)]
return [{
"id": self.id,
"type": "send",
"onMessage": [on_message_list],
"extern": self.args["extern"],
"attributes": self.args["attributes"],
"hash": self.args["hash"],
"display": self.args["name"],
"name": ((f"_{self.args['name']}") if re.match(r"\d", self.args["name"]) else self.args["name"])
Expand Down
1 change: 1 addition & 0 deletions hvcc/generators/c2daisy/c2daisy.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ def compile(
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['displayprocess'] = board_info['displayprocess']
component_glue['debug_printing'] = daisy_meta.get('debug_printing', False)
component_glue['usb_midi'] = daisy_meta.get('usb_midi', False)

Expand Down
7 changes: 4 additions & 3 deletions hvcc/generators/c2dpf/c2dpf.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ def compile(

out_dir = os.path.join(out_dir, "plugin")
receiver_list = externs['parameters']['in']
sender_list = externs["parameters"]["out"]

if patch_meta:
patch_name = patch_meta.get("name", patch_name)
Expand Down Expand Up @@ -87,6 +88,7 @@ def compile(
num_input_channels=num_input_channels,
num_output_channels=num_output_channels,
receivers=receiver_list,
senders=sender_list,
copyright=copyright_c))
dpf_cpp_path = os.path.join(source_dir, f"HeavyDPF_{patch_name}.cpp")
with open(dpf_cpp_path, "w") as f:
Expand All @@ -97,6 +99,7 @@ def compile(
num_input_channels=num_input_channels,
num_output_channels=num_output_channels,
receivers=receiver_list,
senders=sender_list,
pool_sizes_kb=externs["memoryPoolSizesKb"],
copyright=copyright_c))
if dpf_meta.get("enable_ui"):
Expand All @@ -106,9 +109,8 @@ def compile(
name=patch_name,
meta=dpf_meta,
class_name=f"HeavyDPF_{patch_name}",
num_input_channels=num_input_channels,
num_output_channels=num_output_channels,
receivers=receiver_list,
senders=sender_list,
copyright=copyright_c))
dpf_h_path = os.path.join(source_dir, "DistrhoPluginInfo.h")
with open(dpf_h_path, "w") as f:
Expand All @@ -118,7 +120,6 @@ def compile(
class_name=f"HeavyDPF_{patch_name}",
num_input_channels=num_input_channels,
num_output_channels=num_output_channels,
receivers=receiver_list,
pool_sizes_kb=externs["memoryPoolSizesKb"],
copyright=copyright_c))

Expand Down
84 changes: 27 additions & 57 deletions hvcc/generators/c2dpf/templates/HeavyDPF.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#include <set>


#define HV_LV2_NUM_PARAMETERS {{receivers|length}}
#define HV_DPF_NUM_PARAMETER {{receivers|length + senders|length}}

#define HV_HASH_NOTEIN 0x67E37CA3
#define HV_HASH_CTLIN 0x41BE0f9C
Expand Down Expand Up @@ -55,6 +55,7 @@ static void hvSendHookFunc(HeavyContextInterface *c, const char *sendName, uint3
{{class_name}}* plugin = ({{class_name}}*)c->getUserData();
if (plugin != nullptr)
{
plugin->setOutputParameter(sendHash, m);
{%- if meta.midi_output is defined and meta.midi_output == 1 %}
#if DISTRHO_PLUGIN_WANT_MIDI_OUTPUT
plugin->handleMidiSend(sendHash, m);
Expand All @@ -78,9 +79,9 @@ static void hvPrintHookFunc(HeavyContextInterface *c, const char *printLabel, co
// Main DPF plugin class

{{class_name}}::{{class_name}}()
: Plugin(HV_LV2_NUM_PARAMETERS, 0, 0)
: Plugin(HV_DPF_NUM_PARAMETER, 0, 0)
{
{% for k, v in receivers -%}
{% for k, v in receivers + senders -%}
_parameters[{{loop.index-1}}] = {{v.attributes.default}}f;
{% endfor %}

Expand All @@ -91,7 +92,7 @@ static void hvPrintHookFunc(HeavyContextInterface *c, const char *printLabel, co

{% if receivers|length > 0 %}
// ensure that the new context has the current parameters
for (int i = 0; i < HV_LV2_NUM_PARAMETERS; ++i) {
for (int i = 0; i < HV_DPF_NUM_PARAMETER; ++i) {
setParameterValue(i, _parameters[i]);
}
{%- endif %}
Expand All @@ -102,62 +103,18 @@ static void hvPrintHookFunc(HeavyContextInterface *c, const char *printLabel, co
}

{%- if meta.port_groups is defined %}
{% include 'HeavyDPF_PortGroups.cpp' %}
{% include 'portGroups.cpp' %}
{%- endif %}

void {{class_name}}::initParameter(uint32_t index, Parameter& parameter)
{
{%- if receivers|length > 0 -%}
{%- if (receivers|length > 0) or (senders|length > 0) -%}
// initialise parameters with defaults
switch (index)
{
{% for k, v in receivers -%}
case param{{v.display}}:
parameter.name = "{{v.display.replace('_', ' ')}}";
parameter.symbol = "{{v.display|lower}}";
{%- if v.attributes.type == 'db': %}
parameter.unit = "dB";
{%- elif v.attributes.type in ['hz', 'log_hz']: %}
parameter.unit = "Hz";
{%- endif %}
parameter.hints = kParameterIsAutomatable
{%- if v.attributes.type == 'bool': %}
| kParameterIsBoolean
{%- elif v.attributes.type == 'trig': -%}
| kParameterIsTrigger
{%- elif v.attributes.type == 'int': -%}
| kParameterIsInteger
{%- elif v.attributes.type in ['log', 'log_hz']: -%}
| kParameterIsLogarithmic
{%- endif %};
parameter.ranges.min = {{v.attributes.min}}f;
parameter.ranges.max = {{v.attributes.max}}f;
parameter.ranges.def = {{v.attributes.default}}f;
{%- if v.attributes.type == 'db' and not (meta.enumerators is defined and meta.enumerators[v.display] is defined): %}
{
ParameterEnumerationValue* const enumValues = new ParameterEnumerationValue[1];
enumValues[0].value = {{v.attributes.min}}f;
enumValues[0].label = "-inf";
parameter.enumValues.count = 1;
parameter.enumValues.values = enumValues;
}
{%- endif %}
{%- if meta.enumerators is defined and meta.enumerators[v.display] is defined %}
{% set enums = meta.enumerators[v.display] %}
{% set enumlen = enums|length %}
if (ParameterEnumerationValue *values = new ParameterEnumerationValue[{{enumlen}}])
{
parameter.enumValues.restrictedMode = true;
{% for i in enums -%}
values[{{loop.index - 1}}].value = {{loop.index - 1}}.0f;
values[{{loop.index - 1}}].label = "{{i}}";
{% endfor -%}
parameter.enumValues.count = {{enumlen}};
parameter.enumValues.values = values;
}
{%- endif %}
break;
{% endfor %}
{% for k, v in receivers + senders %}
{% include 'initParameter.cpp' %}
{% endfor -%}
}
{% endif %}
}
Expand All @@ -167,7 +124,7 @@ void {{class_name}}::initParameter(uint32_t index, Parameter& parameter)

float {{class_name}}::getParameterValue(uint32_t index) const
{
{%- if receivers|length > 0 %}
{%- if (receivers|length > 0) or (senders|length > 0) %}
return _parameters[index];
{% else %}
return 0.0f;
Expand All @@ -194,6 +151,19 @@ void {{class_name}}::setParameterValue(uint32_t index, float value)
{%- endif %}
}

void {{class_name}}::setOutputParameter(uint32_t sendHash, const HvMessage *m)
{
{%- if senders|length > 0 %}
switch (sendHash) {
{% for k, v in senders -%}
case {{v.hash}}: // {{v.display}}
_parameters[param{{v.display}}] = hv_msg_getFloat(m, 0);
break;
{% endfor %}
}
{%- endif %}
}


// -------------------------------------------------------------------
// Process
Expand All @@ -210,13 +180,13 @@ void {{class_name}}::setParameterValue(uint32_t index, float value)

{%- if meta.midi_input is defined and meta.midi_input == 1 %}
#if DISTRHO_PLUGIN_WANT_MIDI_INPUT
{% include 'HeavyDPF_MIDI_Input.cpp' %}
{% include 'midiInput.cpp' %}
#endif
{% endif %}

{%- if meta.midi_output is defined and meta.midi_output == 1 %}
#if DISTRHO_PLUGIN_WANT_MIDI_OUTPUT
{% include 'HeavyDPF_MIDI_Output.cpp' %}
{% include 'midiOutput.cpp' %}
#endif
{% endif %}

Expand Down Expand Up @@ -254,7 +224,7 @@ void {{class_name}}::sampleRateChanged(double newSampleRate)

{% if receivers|length > 0 -%}
// ensure that the new context has the current parameters
for (int i = 0; i < HV_LV2_NUM_PARAMETERS; ++i) {
for (int i = 0; i < HV_DPF_NUM_PARAMETER; ++i) {
setParameterValue(i, _parameters[i]);
}
{%- endif %}
Expand Down
Loading

0 comments on commit 948e213

Please sign in to comment.