Skip to content

Commit

Permalink
Merge branch 'v0.6.2'
Browse files Browse the repository at this point in the history
  • Loading branch information
dromer committed Dec 17, 2022
2 parents 0eafdda + 331b8e6 commit 56cdfe6
Show file tree
Hide file tree
Showing 46 changed files with 312 additions and 267 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.6.1
current_version = 0.6.2

[bumpversion:file:setup.cfg]

Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,16 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.7, 3.8, 3.9, 3.10-dev]
python-version: ['3.7', '3.8', '3.9', '3.10', '3.11']

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
lfs: true
- name: Initialize lfs
run: git lfs pull
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
Expand Down
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
CHANGELOG
=====

0.6.2
-----

* dpf: add CLAP to docs; cleanup templates
* dpf: bugfix -> wrong frame count used for sendMessageToReceiverV()
* general: style fixes
* general: py311 support
* general: un/supported objects

0.6.1
-----

Expand Down
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[![Build Status](https://github.com/Wasted-Audio/hvcc/actions/workflows/python.yml/badge.svg)](https://github.com/Wasted-Audio/hvcc/actions)
[![Build Status](https://github.com/Wasted-Audio/hvcc/actions/workflows/build.yml/badge.svg)](https://github.com/Wasted-Audio/hvcc/actions)

This is an attempt to modernize `hvcc` to work with `python3` and add some additional targets.

Expand Down Expand Up @@ -89,7 +89,9 @@ A list of available generator options can be found [here](/docs/03.generators.md

This can be handy when using a third-party patch library for example https://github.com/Wasted-Audio/heavylib.

`$ hvcc ~/myProject/_main.pd -o ~/Desktop/somewhere/else/ -n mySynth -p "[~/Workspace/Projects/Enzien/heavylib/, ~/Desktop/myLib/]"`
Simply append any folder paths after the `-p` flag like so:

`$ hvcc ~/myProject/_main.pd -o ~/Desktop/somewhere/else/ -n mySynth -p ~/Workspace/Projects/Enzien/heavylib/ ~/Desktop/myLib/`

### `-m` Meta Data
`hvcc` can take extra meta-data via a supplied json file. It depends on the generator which fields are supported.
Expand Down
8 changes: 5 additions & 3 deletions docs/01.introduction.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,12 @@ Heavy can interpret and convert a subset of features from Pure Data patches:
* [Unity 5](https://unity3d.com)
* [Distrho Plugin Framework](https://distrho.github.io/DPF)
* [LV2](https://lv2plug.in)
* [VST2](https://www.steinberg.net/en/products/vst.html)
* [VST2](https://www.steinberg.net/technology/)
* [VST3](https://www.steinberg.net/technology/)
* [CLAP](https://cleveraudio.org/)
* [JACK](https://jackaudio.org)
* [Wwise](https://www.audiokinetic.com)
* [Web Audio API (Script Processor)](https://developer.mozilla.org/en-US/docs/Web/API/ScriptProcessorNode)
* [Web Audio API (AudioWorkletProcessor)](https://developer.mozilla.org/en-US/docs/Web/API/AudioWorkletProcessor)

## Optimisations
Heavy-generated code comes pre-optimised for architectures that can take advantage of AVX, SSE or NEON instructions. For more bespoke platforms, Heavy also provides a basic implementation supporting single sample block sizes.
Expand All @@ -62,4 +64,4 @@ The files that `hvcc` generates are split into two types:

## How to start patching for heavy

See the [Getting started](02.getting_started.md) page on more information about how to construct compatible pure data patches.
See the [Getting started](02.getting_started.md) page on more information about how to construct compatible pure data patches.
8 changes: 5 additions & 3 deletions docs/03.gen.dpf.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# DPF

Heavy can generate LV2 and VST2 plugins from your patch using the [Distrho Plugin Framework](https://github.com/DISTRHO/DPF). It can be either a synth (output-only) or an effect (input and output), supports an arbitrary number of parameters, and can process midi events.
Heavy can generate LV2, VST2, VST3, and CLAP plugins from your patch using the [Distrho Plugin Framework](https://github.com/DISTRHO/DPF). It can be either a synth (output-only) or an effect (input and output), supports an arbitrary number of parameters, and can process midi events.

Some [examples](https://github.com/Wasted-Audio/hvcc-examples-dpf) are built for the major operating systems (Linux/Windows/MacOS) in various formats (LV2/VST2/VST3).
Some [examples](https://github.com/Wasted-Audio/hvcc-examples-dpf) are built for the major operating systems (Linux/Windows/MacOS) in various formats (LV2/VST2/VST3/CLAP).

## Defining Parameters
Each [exposed parameter](02.getting_started.md#exposing-parameters) will automatically generate a slider in the plugin interface.
Expand Down Expand Up @@ -50,7 +50,9 @@ Each of these are optional and have either a default value or are entirely optio
"midi_output": 0,
"plugin_formats": [
"lv2_dsp",
"vst",
"vst2",
"vst3",
"clap",
"jack"
]
}
Expand Down
2 changes: 2 additions & 0 deletions docs/09.supported_vanilla_objects.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ outlet
pack
pgmin
pgmout
pd
pipe
poly
pow
Expand Down Expand Up @@ -131,6 +132,7 @@ dac~
dbtopow~
dbtorms~
delread~
delread4~
delwrite~
env~
exp~
Expand Down
2 changes: 0 additions & 2 deletions docs/10.unsupported_vanilla_objects.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ netsend
openpanel
oscformat
oscparse
pd
plot
pointer
polytouchin
Expand Down Expand Up @@ -68,7 +67,6 @@ block~
bob~
bonk~
complex-mod~
delread4~
expr~
fexpr~
fft~
Expand Down
4 changes: 2 additions & 2 deletions hvcc/core/hv2ir/BufferPool.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ def retain_buffer(self, b, count=1):
""" Increases the retain count of the buffer. Returns the new count.
"""
# adc~ and ZERO_BUFFER are special. They cannot be retained.
if b[0] in ["zero", "input"]:
if b[0] in {"zero", "input"}:
return 0
else:
pool = self.pool[b[0]]
Expand All @@ -79,7 +79,7 @@ def release_buffer(self, b, count=1):
# adc~, ZERO_BUFFER, send~ buffers are special. They can not be released.
# if the buffer is otherwise unknown (as may be in the case that objects provide their own),
# they cannot be released
if b[0] in ["zero", "input"]:
if b[0] in {"zero", "input"}:
return 0
else:
pool = self.pool[b[0]]
Expand Down
2 changes: 1 addition & 1 deletion hvcc/core/hv2ir/Connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ def is_mixed(self):

@classmethod
def is_signal_type(clazz, type):
return type in ["~i>", "~f>"]
return type in {"~i>", "~f>"}

def __eq__(self, other):
return self.__hash == other.__hash__() if isinstance(other, Connection) else False
Expand Down
2 changes: 1 addition & 1 deletion hvcc/core/hv2ir/HIrTabhead.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class HIrTabhead(HeavyIrObject):
"""

def __init__(self, obj_type, args=None, graph=None, annotations=None):
assert obj_type in ["__tabhead~f", "__tabhead"]
assert obj_type in {"__tabhead~f", "__tabhead"}
HeavyIrObject.__init__(self, obj_type, args=args, graph=graph, annotations=annotations)

def reduce(self):
Expand Down
2 changes: 1 addition & 1 deletion hvcc/core/hv2ir/HIrTabread.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class HIrTabread(HeavyIrObject):
"""

def __init__(self, obj_type, args=None, graph=None, annotations=None):
assert obj_type in ["__tabread~if", "__tabread~f", "__tabreadu~f", "__tabread"]
assert obj_type in {"__tabread~if", "__tabread~f", "__tabreadu~f", "__tabread"}
HeavyIrObject.__init__(self, obj_type, args=args, graph=graph, annotations=annotations)

def reduce(self):
Expand Down
2 changes: 1 addition & 1 deletion hvcc/core/hv2ir/HIrTabwrite.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class HIrTabwrite(HeavyIrObject):
"""

def __init__(self, obj_type, args=None, graph=None, annotations=None):
assert obj_type in ["__tabwrite~f", "__tabwrite_stoppable~f", "__tabwrite"]
assert obj_type in {"__tabwrite~f", "__tabwrite_stoppable~f", "__tabwrite"}
HeavyIrObject.__init__(self, obj_type, args=args, graph=graph, annotations=annotations)

def reduce(self):
Expand Down
8 changes: 4 additions & 4 deletions hvcc/core/hv2ir/HLangSequence.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,13 @@ def __init__(self, obj_type, args, graph, annotations=None):
def reduce(self):
cast_objs = []
for a in self.args[self.name_for_arg()]:
if a in ["a", "anything", "l", "list"]:
if a in {"a", "anything", "l", "list"}:
cast_objs.append(None) # pass through
elif a in ["b", "bang"]:
elif a in {"b", "bang"}:
cast_objs.append(HeavyIrObject("__cast_b", {}))
elif a in ["f", "float"]:
elif a in {"f", "float"}:
cast_objs.append(HeavyIrObject("__cast_f", {}))
elif a in ["s", "symbol"]:
elif a in {"s", "symbol"}:
cast_objs.append(HeavyIrObject("__cast_s", {}))
else:
raise HeavyException(f"Unsupported cast type '{a}'.")
Expand Down
20 changes: 10 additions & 10 deletions hvcc/core/hv2ir/HeavyGraph.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ def resolve_arguments(self, obj_args):
for k in self.args:
# replace all instances of $k with the argument value
# do this for all keys in the graph's argument dictionary
dollar_key = "$" + k
dollar_key = f"${k}"
if value.find(dollar_key) > -1:
if value == dollar_key:
value = self.args[k] # maintain the original data type
Expand Down Expand Up @@ -160,32 +160,32 @@ def add_object(self, obj, obj_id=None):
self.objs[obj_id] = obj

# some object needs to be specially handled when added to the graph
if obj.type in ["inlet", "__inlet"]:
if obj.type in {"inlet", "__inlet"}:
self.inlet_connections.append([])
self.inlet_buffers.append(("zero", 0))
self.inlet_objs.append(obj)
# sort inlet objects according to their index, ascending
self.inlet_objs.sort(key=lambda o: o.args["index"])
elif obj.type in ["outlet", "__outlet"]:
elif obj.type in {"outlet", "__outlet"}:
self.outlet_connections.append([])
self.outlet_buffers.append(("zero", 0))
self.outlet_objs.append(obj)
self.outlet_objs.sort(key=lambda o: o.args["index"])
elif obj.type in ["adc"]:
elif obj.type in {"adc"}:
self.input_channel_set.update(obj.args["channels"])
elif obj.type in ["dac"]:
elif obj.type in {"dac"}:
# if the object is a dac, keep track of the output channels
# that this graph is writing to
self.output_channel_set.update(obj.args["channels"])
elif obj.type in ["receive", "__receive", "send", "__send"]:
elif obj.type in {"receive", "__receive", "send", "__send"}:
self.__register_named_object(obj, obj.name)
elif obj.type in ["table", "__table"]:
elif obj.type in {"table", "__table"}:
self.__register_named_object(
obj,
obj.name,
static=obj.static,
unique=True)
elif obj.type in ["var"] and obj.name is not None:
elif obj.type in {"var"} and obj.name is not None:
self.__register_named_object(
obj,
obj.name,
Expand Down Expand Up @@ -291,7 +291,7 @@ def remove_object(self, o, obj_id=None):
del self.objs[k]
break

if o.type in ["receive", "__receive", "send", "__send"]:
if o.type in {"receive", "__receive", "send", "__send"}:
self.__unregister_named_object(o, o.name)

def get_inlet_object(self, index):
Expand Down Expand Up @@ -358,7 +358,7 @@ def get_object_counter(self, recursive=False):
for o in self.objs.values():
if o.type == "__graph" and recursive:
c += o.get_object_counter(recursive=True)
elif o.type in ["__inlet", "__outlet"]:
elif o.type in {"__inlet", "__outlet"}:
c[o.type[2:]] += 1 # remove leading "__"
else:
c[o.type] += 1
Expand Down
4 changes: 2 additions & 2 deletions hvcc/core/hv2ir/HeavyIrObject.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,12 +93,12 @@ def __obj_desc(self):
def inlet_requires_signal(self, inlet_index=0):
""" Returns True if the indexed inlet requires a signal connection. False otherwise.
"""
return self.__obj_desc["inlets"][inlet_index] in ["~i>", "~f>"]
return self.__obj_desc["inlets"][inlet_index] in {"~i>", "~f>"}

def outlet_requires_signal(self, inlet_index=0):
""" Returns True if the indexed outlet requires a signal connection. False otherwise.
"""
return self.__obj_desc["outlets"][inlet_index] in ["~i>", "~f>"]
return self.__obj_desc["outlets"][inlet_index] in {"~i>", "~f>"}

def reduce(self):
# A Heavy IR object is already reduced. Returns itself and no connection changes.
Expand Down
4 changes: 2 additions & 2 deletions hvcc/core/hv2ir/HeavyLangObject.py
Original file line number Diff line number Diff line change
Expand Up @@ -275,13 +275,13 @@ def _get_connection_format(self, connections_list):
fmt.append("m")
return "".join(fmt)

def has_inlet_connection_format(self, fmts=[]):
def has_inlet_connection_format(self, fmts=None):
""" Returns true if the object has given format at its inlets.
"""
fmts = fmts if isinstance(fmts, list) else [fmts]
return self._get_connection_format(self.inlet_connections) in fmts

def has_outlet_connection_format(self, fmts=[]):
def has_outlet_connection_format(self, fmts=None):
""" Returns true if the object has given format at its outlets.
Take either litteral or list as input.
"""
Expand Down
6 changes: 4 additions & 2 deletions hvcc/generators/c2dpf/templates/DistrhoPluginInfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,13 @@
#pragma once

#define DISTRHO_PLUGIN_NAME "{{name}}"
{% if meta.plugin_uri is defined %}
{%- if meta.plugin_uri is defined %}
#define DISTRHO_PLUGIN_URI "{{meta.plugin_uri}}"
#define DISTRHO_PLUGIN_CLAP_ID "{{meta.plugin_uri}}"
{% else %}
#define DISTRHO_PLUGIN_URI "http://wasted.audio/lv2/plugin/{{name}}"
{% endif %}
#define DISTRHO_PLUGIN_CLAP_ID "http://wasted.audio/lv2/plugin/{{name}}"
{%- endif %}
#define DISTRHO_PLUGIN_NUM_INPUTS {{num_input_channels}}
#define DISTRHO_PLUGIN_NUM_OUTPUTS {{num_output_channels}}
#define DISTRHO_PLUGIN_IS_SYNTH {{1 if num_output_channels > 0 and meta.midi_input else 0}}
Expand Down
Loading

0 comments on commit 56cdfe6

Please sign in to comment.