Skip to content

Commit 7eb3a41

Browse files
committed
Merge branch 'release/0.13.3'
2 parents ac87fbf + 471d367 commit 7eb3a41

15 files changed

Lines changed: 127 additions & 72 deletions

File tree

.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.13.1
2+
current_version = 0.13.3
33

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

.gitattributes

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,5 @@
11
**.dll filter=lfs diff=lfs merge=lfs -text
22
**.wav filter=lfs diff=lfs merge=lfs -textx
3+
4+
# never include repository configurations in exports
5+
.git* export-ignore

CHANGELOG.md

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

4+
0.13.3
5+
-----
6+
7+
Bugfixes:
8+
9+
* Daisy: add ScopedIrqBlocker to several functions. Should fix midi input issues and potentially others.
10+
* Daisy: use FIFO to buffer midi TX messages and call them in the main loop instead of during process()
11+
* JS: Ignore windows batch if inside of MingW environment
12+
13+
0.13.2
14+
-----
15+
16+
Bugfixes:
17+
18+
* Incorrect use of new extern formatting in ir2c and c2js templates
19+
420
0.13.1
521
-----
622

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Heavy Compiler Collection (hvcc)
22

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

docs/02.getting_started.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ This list will be continuously epanded to document differences in object behavio
101101
* 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.
102102
* On the `[select]` object it is currently not possible to set the arguments via the right inlet (internally a hardcoded switch_case is used).
103103
* Heavy supports remote/send messages, however empty messages are currently removed. So the typical `[; bla 1(` multiline message needs to contain at least something on the first line: `[_; bla 1(`.
104-
* Remote/send messages with `sinesum` argument to fill tables are not supported.
104+
* Remote/send messages with `sinesum` or `const` arguments to initialize table values are not supported.
105105
* `[metro]` and `[timer]` objects do not accept tempo messages or unit arguments.
106106
* `[snapshot~]` does not respond within the same control flow as it executes in signal context. Its output happens on the next audio cycle, so additional care for this control flow needs to be taken into account if you depend on synchronous execution. It also doesn't accept `[set(` messages.
107107
* Certain filters are sensitive to ‘blowing up’ at very low or very high cutoff frequencies and/or resonances, due to the filter coefficients not being perfectly represented with a finite number of bits. While Pure data natively uses 64 bits, platforms like `OWL` and `Daisy` that use 32 bit float are more sensitive to this. For example, the Pure data `[bp~]` filter is implemented with a biquad which is prone to fail or distort with cutoff frequencies less than around 200 Hz (at 48kHz sample rate).

hvcc/generators/c2daisy/templates/HeavyDaisy.cpp

Lines changed: 35 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
#define SAMPLE_RATE {{samplerate}}.f
88

9-
{% if has_midi or usb_midi %}
9+
{% if (has_midi is sameas true) or (usb_midi is sameas true) %}
1010
#define HV_HASH_NOTEIN 0x67E37CA3
1111
#define HV_HASH_CTLIN 0x41BE0f9C
1212
#define HV_HASH_POLYTOUCHIN 0xBC530F59
@@ -31,6 +31,8 @@
3131
#define MIDI_RT_STOP 0xFC
3232
#define MIDI_RT_ACTIVESENSE 0xFE
3333
#define MIDI_RT_RESET 0xFF
34+
35+
#define MIDI_OUT_FIFO_SIZE 128
3436
{% endif %}
3537

3638
using namespace daisy;
@@ -48,6 +50,9 @@ FIFO<FixedCapStr<64>, 64> event_log;
4850
{% elif usb_midi is sameas true %}
4951
daisy::MidiUsbHandler midiusb;
5052
{% endif %}
53+
{% if (has_midi is sameas true) or (usb_midi is sameas true) %}
54+
FIFO<uint8_t, MIDI_OUT_FIFO_SIZE> midi_tx_fifo;
55+
{% endif %}
5156
// int midiOutCount;
5257
// uint8_t* midiOutData;
5358
void CallbackWriteIn(Heavy_{{patch_name}}* hv);
@@ -99,6 +104,8 @@ DaisyHvParamOut DaisyOutputParameters[DaisyNumOutputParameters] = {
99104
// Typical Switch case for Message Type.
100105
void HandleMidiMessage(MidiEvent m)
101106
{
107+
ScopedIrqBlocker block; //< Disables interrupts while in scope
108+
102109
for (int i = 0; i <= 2; ++i) {
103110
hv->sendMessageToReceiverV(HV_HASH_MIDIIN, 0, "ff",
104111
(float) m.data[i],
@@ -258,6 +265,26 @@ int main(void)
258265
LoopWriteOut();
259266
{% endif %}
260267

268+
{% if (has_midi is sameas true) or (usb_midi is sameas true) %}
269+
uint8_t midiData[MIDI_OUT_FIFO_SIZE];
270+
size_t numElements = 0;
271+
272+
while(!midi_tx_fifo.IsEmpty() && numElements < MIDI_OUT_FIFO_SIZE)
273+
{
274+
midiData[numElements++] = midi_tx_fifo.PopFront();
275+
}
276+
277+
if(numElements > 0)
278+
{
279+
{% if has_midi is sameas true %}
280+
hardware.midi.SendMessage(midiData, numElements);
281+
{% endif %}
282+
{% if (debug_printing is not sameas true) and (usb_midi is sameas true) %}
283+
midiusb.SendMessage(midiData, numElements);
284+
{% endif %}
285+
}
286+
{% endif %}
287+
261288
{% if debug_printing is sameas true %}
262289
/** Now separately, every 5ms we'll print the top message in our queue if there is one */
263290
if(now - log_time > 5)
@@ -300,12 +327,9 @@ void audiocallback(daisy::AudioHandle::InputBuffer in, daisy::AudioHandle::Outpu
300327
{% if (has_midi is sameas true) or (usb_midi is sameas true) %}
301328
void HandleMidiOut(uint8_t *midiData, const uint8_t numElements)
302329
{
303-
{% if has_midi is sameas true %}
304-
hardware.midi.SendMessage(midiData, numElements);
305-
{% endif %}
306-
{% if (debug_printing is not sameas true) and (usb_midi is sameas true) %}
307-
midiusb.SendMessage(midiData, numElements);
308-
{% endif %}
330+
for (int i = 0; i < numElements; i++) {
331+
midi_tx_fifo.PushBack(midiData[i]);
332+
}
309333
}
310334

311335
void HandleMidiSend(uint32_t sendHash, const HvMessage *m)
@@ -476,6 +500,8 @@ static void printHook(HeavyContextInterface *c, const char *printLabel, const ch
476500
*/
477501
void LoopWriteIn(Heavy_{{patch_name}}* hv)
478502
{
503+
ScopedIrqBlocker block; //< Disables interrupts while in scope
504+
479505
{% for param in loop_write_in %}
480506
{% if param.bool %}
481507
if ({{param.process}})
@@ -505,6 +531,8 @@ void CallbackWriteIn(Heavy_{{patch_name}}* hv)
505531
*
506532
*/
507533
void LoopWriteOut() {
534+
ScopedIrqBlocker block; //< Disables interrupts while in scope
535+
508536
{% for param in loop_write_out %}
509537
{% if param.bool %}
510538
if ({{param.value}})

hvcc/generators/c2js/c2js.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,8 @@ def run_emscripten(
8080
"""Run the emcc command to compile C source files to a javascript library.
8181
"""
8282

83-
if os.name == 'nt':
83+
# Detect Windows OS, but ignore if running in MingW
84+
if os.name == 'nt' and os.environ.get('MSYSTEM') is None:
8485
emcc_path = which("emcc.bat")
8586
else:
8687
emcc_path = which("emcc")

hvcc/generators/c2js/template/hv_worklet.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -176,25 +176,25 @@ class {{name}}_AudioLibWorklet extends AudioWorkletProcessor {
176176
}
177177

178178
var parameterInHashes = {
179-
{%- for k,v in externs.parameters.in %}
179+
{%- for k,v in externs.parameters.inParam %}
180180
"{{v.display}}": {{v.hash}}, // {{v.display}}
181181
{%- endfor %}
182182
};
183183

184184
var parameterOutHashes = {
185-
{%- for k,v in externs.parameters.out %}
185+
{%- for k,v in externs.parameters.outParam %}
186186
"{{v.display}}": {{v.hash}}, // {{v.display}}
187187
{%- endfor %}
188188
};
189189

190190
var eventInHashes = {
191-
{%- for k,v in externs.events.in %}
191+
{%- for k,v in externs.events.inEvent %}
192192
"{{v.display}}": {{v.hash}}, // {{v.display}}
193193
{%- endfor %}
194194
};
195195

196196
var eventOutHashes = {
197-
{%- for k,v in externs.events.out %}
197+
{%- for k,v in externs.events.outEvent %}
198198
"{{v.display}}": {{v.hash}}, // {{v.display}}
199199
{%- endfor %}
200200
};
@@ -216,22 +216,22 @@ function sendMidiIn(hv_context, message) {
216216
var channel = message[0] & 0x0F;
217217
var data1 = message[1];
218218
var data2 = message[2];
219-
219+
220220
// all events to [midiin]
221221
for (var i = 1; i <= 2; i++) {
222222
_hv_sendMessageToReceiverFF(hv_context, HV_HASH_MIDIIN, 0,
223223
message[i],
224224
channel
225225
);
226226
}
227-
227+
228228
// realtime events to [midirealtimein]
229229
if (MIDI_REALTIME.includes(message[0])) {
230230
_hv_sendMessageToReceiverFF(hv_context, HV_HASH_MIDIREALTIMEIN, 0,
231231
message[0]
232232
);
233233
}
234-
234+
235235
switch(command) {
236236
case 0x80: // note off
237237
_hv_sendMessageToReceiverFFF(hv_context, HV_HASH_NOTEIN, 0,
@@ -335,7 +335,7 @@ function sendMidiOut(sendName, msg) {
335335
]
336336
case "__hv_midiout":
337337
let firstByte = _hv_msg_getFloat(msg, 0);
338-
return (firstByte === 192 || firstByte === 208) ?
338+
return (firstByte === 192 || firstByte === 208) ?
339339
[_hv_msg_getFloat(msg, 0), _hv_msg_getFloat(msg, 1)] :
340340
[_hv_msg_getFloat(msg, 0), _hv_msg_getFloat(msg, 1), _hv_msg_getFloat(msg, 2)];
341341
default:

hvcc/generators/c2js/template/hv_wrapper.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -168,25 +168,25 @@ var {{name}}_AudioLib = function(options) {
168168
}
169169

170170
var parameterInHashes = {
171-
{%- for k,v in externs.parameters.in %}
171+
{%- for k,v in externs.parameters.inParam %}
172172
"{{v.display}}": {{v.hash}}, // {{v.display}}
173173
{%- endfor %}
174174
};
175175

176176
var parameterOutHashes = {
177-
{%- for k,v in externs.parameters.out %}
177+
{%- for k,v in externs.parameters.outParam %}
178178
"{{v.display}}": {{v.hash}}, // {{v.display}}
179179
{%- endfor %}
180180
};
181181

182182
var eventInHashes = {
183-
{%- for k,v in externs.events.in %}
183+
{%- for k,v in externs.events.inEvent %}
184184
"{{v.display}}": {{v.hash}}, // {{v.display}}
185185
{%- endfor %}
186186
};
187187

188188
var eventOutHashes = {
189-
{%- for k,v in externs.events.out %}
189+
{%- for k,v in externs.events.outEvent %}
190190
"{{v.display}}": {{v.hash}}, // {{v.display}}
191191
{%- endfor %}
192192
};
@@ -319,22 +319,22 @@ function sendMidiIn(hv_context, message) {
319319
var channel = message[0] & 0x0F;
320320
var data1 = message[1];
321321
var data2 = message[2];
322-
322+
323323
// all events to [midiin]
324324
for (var i = 1; i <= 2; i++) {
325325
_hv_sendMessageToReceiverFF(hv_context, HV_HASH_MIDIIN, 0,
326326
message[i],
327327
channel
328328
);
329329
}
330-
330+
331331
// realtime events to [midirealtimein]
332332
if (MIDI_REALTIME.includes(message[0])) {
333333
_hv_sendMessageToReceiverFF(hv_context, HV_HASH_MIDIREALTIMEIN, 0,
334334
message[0]
335335
);
336336
}
337-
337+
338338
switch(command) {
339339
case 0x80: // note off
340340
_hv_sendMessageToReceiverFFF(hv_context, HV_HASH_NOTEIN, 0,
@@ -438,7 +438,7 @@ function sendMidiOut(sendName, msg) {
438438
]
439439
case "__hv_midiout":
440440
let firstByte = _hv_msg_getFloat(msg, 0);
441-
return (firstByte === 192 || firstByte === 208) ?
441+
return (firstByte === 192 || firstByte === 208) ?
442442
[_hv_msg_getFloat(msg, 0), _hv_msg_getFloat(msg, 1)] :
443443
[_hv_msg_getFloat(msg, 0), _hv_msg_getFloat(msg, 1), _hv_msg_getFloat(msg, 2)];
444444
default:

hvcc/generators/c2pdext/templates/Makefile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,5 @@ common.sources += $(wildcard pdext/*.cpp)
1515
# all extra files to be included in binary distribution of the library
1616
#datafiles = helloworld-help.pd helloworld-meta.pd README.md
1717

18-
include Makefile.pdlibbuilder
18+
PDLIBBUILDER_DIR=.
19+
include $(PDLIBBUILDER_DIR)/Makefile.pdlibbuilder

0 commit comments

Comments
 (0)