Skip to content

Commit 1f88408

Browse files
committed
Merge branch 'release/0.16.1'
2 parents 14f682c + 5be5184 commit 1f88408

30 files changed

Lines changed: 153 additions & 65 deletions

.bumpversion.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[bumpversion]
2-
current_version = 0.16.0
2+
current_version = 0.16.1
33

44
[bumpversion:file:pyproject.toml]
55
search = {current_version}

CHANGELOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,16 @@
11
CHANGELOG
22
=====
33

4+
0.16.1
5+
-----
6+
7+
Bugfixes:
8+
9+
* Allow diacritics in send/receive (#344)
10+
* Resolve absolute nam path (#377)
11+
* Fix issue with Path in jinja2 environment
12+
* Daisy: Don't show warning if board doesn't have display section (#349)
13+
414
0.16.0
515
-----
616

hvcc/core/hv2ir/HeavyLangObject.py

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -375,10 +375,10 @@ def _resolve_connection_types(self, obj_stack: Optional[set] = None) -> None:
375375
c.to_object._resolve_connection_types(obj_stack) # turtle all the way down
376376

377377
@classmethod
378-
def get_hash(cls, x: str) -> int:
378+
def get_hash(cls, x: Union[str, float, int]) -> int:
379379
""" Compute the message element hash used by msg_getHash(). Returns a 32-bit integer.
380380
"""
381-
if isinstance(x, float) or isinstance(x, int):
381+
if isinstance(x, (float, int)) and not isinstance(x, str):
382382
# interpret the float bytes as an unsigned integer
383383
return unpack("@I", pack("@f", float(x)))[0]
384384
elif x == "bang":
@@ -387,28 +387,27 @@ def get_hash(cls, x: str) -> int:
387387
# this hash is based MurmurHash2
388388
# http://en.wikipedia.org/wiki/MurmurHash
389389
# https://sites.google.com/site/murmurhash/
390-
x = str(x)
390+
data = x.encode("utf-8")
391391
m = 0x5bd1e995
392392
r = 24
393-
h = len(x)
393+
h = len(data)
394394
i = 0
395-
while i < len(x) & ~0x3:
396-
k = unpack("@I", bytes(x[i:i + 4], "utf-8"))[0]
395+
while i <= len(data) - 4:
396+
k = unpack("@I", data[i:i + 4])[0]
397397
k = (k * m) & 0xFFFFFFFF
398398
k ^= k >> r
399399
k = (k * m) & 0xFFFFFFFF
400400
h = (h * m) & 0xFFFFFFFF
401401
h ^= k
402402
i += 4
403403

404-
n = len(x) & 0x3
405-
x = x[i:i + n]
404+
n = len(data) - i
406405
if n >= 3:
407-
h ^= (ord(x[2]) << 16) & 0xFFFFFFFF
406+
h ^= (data[i + 2] << 16) & 0xFFFFFFFF
408407
if n >= 2:
409-
h ^= (ord(x[1]) << 8) & 0xFFFFFFFF
408+
h ^= (data[i + 1] << 8) & 0xFFFFFFFF
410409
if n >= 1:
411-
h ^= ord(x[0])
410+
h ^= data[i]
412411
h = (h * m) & 0xFFFFFFFF
413412

414413
h ^= h >> 13

hvcc/generators/c2daisy/c2daisy.py

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -88,24 +88,19 @@ def compile(
8888
else:
8989
header, board_info = generate_header_from_name(board)
9090
display_params = {}
91-
warnings.append(
92-
CompilerMsg(
93-
enum=NotificationEnum.WARNING_GENERIC,
94-
message=f"Unable to load board description from {daisy_meta.board_file}. Using fallback."
95-
)
96-
)
9791

9892
# inject display process code
9993
try:
10094
display_process = display_processor(daisy_meta.board_file)
10195
except (FileNotFoundError, KeyError, ValueError):
10296
display_process = board_info['displayprocess']
103-
warnings.append(
104-
CompilerMsg(
105-
enum=NotificationEnum.WARNING_GENERIC,
106-
message=f"Unable to load display code from {daisy_meta.board_file}. Using fallback."
97+
if display_process is not None:
98+
warnings.append(
99+
CompilerMsg(
100+
enum=NotificationEnum.WARNING_GENERIC,
101+
message=f"Unable to load display code from {board_info['name']}. Using fallback."
102+
)
107103
)
108-
)
109104

110105
# remove heavy out params from externs
111106
externs.parameters.outParam = [
@@ -153,7 +148,7 @@ def compile(
153148
with open(daisy_h_path, "w") as f:
154149
f.write(header)
155150

156-
loader = jinja2.FileSystemLoader(Path(Path(__file__).parent, 'templates'))
151+
loader = jinja2.FileSystemLoader(Path(__file__).parent / 'templates')
157152
env = jinja2.Environment(loader=loader, trim_blocks=True, lstrip_blocks=True)
158153
daisy_cpp_path = Path(source_dir, f"HeavyDaisy_{patch_name}.cpp")
159154

hvcc/generators/c2daisy/json2daisy/json2daisy.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
import json
33

44
from importlib import resources
5-
from typing import Optional
65
from pathlib import Path
6+
from typing import Optional
77

88

99
def map_load(pair: list, json_defs_file: Path):
@@ -321,7 +321,7 @@ def generate_header(board_description_dict: dict) -> 'tuple[str, dict]':
321321
'aliases': target['aliases'],
322322
'channels': audio_channels,
323323
'has_midi': target.get('has_midi', False),
324-
'displayprocess': target.get('displayprocess', '')
324+
'displayprocess': target.get('displayprocess', '') if 'display' in target else None
325325
}
326326

327327
return rendered_header, board_info

hvcc/generators/c2dpf/c2dpf.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,7 @@ def compile(
8585
env = jinja2.Environment()
8686
env.filters["uniqueid"] = filter_uniqueid
8787

88-
env.loader = jinja2.FileSystemLoader(
89-
Path(Path(__file__).parent, "templates"))
88+
env.loader = jinja2.FileSystemLoader(Path(__file__).parent / "templates")
9089

9190
# generate DPF wrapper from template
9291
dpf_h_path = Path(source_dir, f"HeavyDPF_{patch_name}.hpp")

hvcc/generators/c2dpf/static/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ This will result in an `bin/` folder with all binary assets.
2424

2525
## Metadata
2626

27-
You will likely want to add more configuration options to your project. Create a json file as described in the [documentation](https://wasted-audio.github.io/hvcc/docs/03.gen.dpf.html#metadata).
27+
You will likely want to add more configuration options to your project. Create a json file as described in the [documentation](https://wasted-audio.github.io/hvcc/latest/generators/dpf/#metadata).
2828

2929
## Jack
3030

hvcc/generators/c2fmod/c2fmod.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ def compile(
4646

4747
copyright_c = copyright_manager.get_copyright_for_c(copyright)
4848

49-
templates_dir = Path(Path(__file__).parent, "templates")
49+
templates_dir = Path(__file__).parent / "templates"
5050
is_source_plugin = num_input_channels == 0
5151

5252
out_dir = Path(out_dir, "fmod")

hvcc/generators/c2js/c2js.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -197,9 +197,7 @@ def compile(
197197
try:
198198
# initialise the jinja template environment
199199
env = jinja2.Environment()
200-
env.loader = jinja2.FileSystemLoader(Path(
201-
Path(__file__).parent,
202-
"template"))
200+
env.loader = jinja2.FileSystemLoader(Path(__file__).parent / "template")
203201

204202
# generate heavy js wrapper from template
205203
# Note: this file will be incorporated into the emscripten output

hvcc/generators/c2owl/c2owl.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ def compile(
104104
# initialize the jinja template environment
105105
env = jinja2.Environment()
106106

107-
env.loader = jinja2.FileSystemLoader(Path(Path(__file__).parent), "templates")
107+
env.loader = jinja2.FileSystemLoader(Path(__file__).parent / "templates")
108108

109109
# construct jdata from ir
110110
ir_dir = Path(c_src_dir, "../ir")

0 commit comments

Comments
 (0)