Skip to content

Commit

Permalink
bugfix extern format
Browse files Browse the repository at this point in the history
  • Loading branch information
dromer committed Dec 31, 2024
1 parent 2d2699c commit 674e222
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 20 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
CHANGELOG
=====

Next Release
-----

Bugfixes:

* Incorrect use of new extern formatting in ir2c and c2js templates

0.13.1
-----

Expand Down
16 changes: 8 additions & 8 deletions hvcc/generators/c2js/template/hv_worklet.js
Original file line number Diff line number Diff line change
Expand Up @@ -176,25 +176,25 @@ class {{name}}_AudioLibWorklet extends AudioWorkletProcessor {
}

var parameterInHashes = {
{%- for k,v in externs.parameters.in %}
{%- for k,v in externs.parameters.inParam %}
"{{v.display}}": {{v.hash}}, // {{v.display}}
{%- endfor %}
};

var parameterOutHashes = {
{%- for k,v in externs.parameters.out %}
{%- for k,v in externs.parameters.outParam %}
"{{v.display}}": {{v.hash}}, // {{v.display}}
{%- endfor %}
};

var eventInHashes = {
{%- for k,v in externs.events.in %}
{%- for k,v in externs.events.inEvent %}
"{{v.display}}": {{v.hash}}, // {{v.display}}
{%- endfor %}
};

var eventOutHashes = {
{%- for k,v in externs.events.out %}
{%- for k,v in externs.events.outEvent %}
"{{v.display}}": {{v.hash}}, // {{v.display}}
{%- endfor %}
};
Expand All @@ -216,22 +216,22 @@ function sendMidiIn(hv_context, message) {
var channel = message[0] & 0x0F;
var data1 = message[1];
var data2 = message[2];

// all events to [midiin]
for (var i = 1; i <= 2; i++) {
_hv_sendMessageToReceiverFF(hv_context, HV_HASH_MIDIIN, 0,
message[i],
channel
);
}

// realtime events to [midirealtimein]
if (MIDI_REALTIME.includes(message[0])) {
_hv_sendMessageToReceiverFF(hv_context, HV_HASH_MIDIREALTIMEIN, 0,
message[0]
);
}

switch(command) {
case 0x80: // note off
_hv_sendMessageToReceiverFFF(hv_context, HV_HASH_NOTEIN, 0,
Expand Down Expand Up @@ -335,7 +335,7 @@ function sendMidiOut(sendName, msg) {
]
case "__hv_midiout":
let firstByte = _hv_msg_getFloat(msg, 0);
return (firstByte === 192 || firstByte === 208) ?
return (firstByte === 192 || firstByte === 208) ?
[_hv_msg_getFloat(msg, 0), _hv_msg_getFloat(msg, 1)] :
[_hv_msg_getFloat(msg, 0), _hv_msg_getFloat(msg, 1), _hv_msg_getFloat(msg, 2)];
default:
Expand Down
16 changes: 8 additions & 8 deletions hvcc/generators/c2js/template/hv_wrapper.js
Original file line number Diff line number Diff line change
Expand Up @@ -168,25 +168,25 @@ var {{name}}_AudioLib = function(options) {
}

var parameterInHashes = {
{%- for k,v in externs.parameters.in %}
{%- for k,v in externs.parameters.inParam %}
"{{v.display}}": {{v.hash}}, // {{v.display}}
{%- endfor %}
};

var parameterOutHashes = {
{%- for k,v in externs.parameters.out %}
{%- for k,v in externs.parameters.outParam %}
"{{v.display}}": {{v.hash}}, // {{v.display}}
{%- endfor %}
};

var eventInHashes = {
{%- for k,v in externs.events.in %}
{%- for k,v in externs.events.inEvent %}
"{{v.display}}": {{v.hash}}, // {{v.display}}
{%- endfor %}
};

var eventOutHashes = {
{%- for k,v in externs.events.out %}
{%- for k,v in externs.events.outEvent %}
"{{v.display}}": {{v.hash}}, // {{v.display}}
{%- endfor %}
};
Expand Down Expand Up @@ -319,22 +319,22 @@ function sendMidiIn(hv_context, message) {
var channel = message[0] & 0x0F;
var data1 = message[1];
var data2 = message[2];

// all events to [midiin]
for (var i = 1; i <= 2; i++) {
_hv_sendMessageToReceiverFF(hv_context, HV_HASH_MIDIIN, 0,
message[i],
channel
);
}

// realtime events to [midirealtimein]
if (MIDI_REALTIME.includes(message[0])) {
_hv_sendMessageToReceiverFF(hv_context, HV_HASH_MIDIREALTIMEIN, 0,
message[0]
);
}

switch(command) {
case 0x80: // note off
_hv_sendMessageToReceiverFFF(hv_context, HV_HASH_NOTEIN, 0,
Expand Down Expand Up @@ -438,7 +438,7 @@ function sendMidiOut(sendName, msg) {
]
case "__hv_midiout":
let firstByte = _hv_msg_getFloat(msg, 0);
return (firstByte === 192 || firstByte === 208) ?
return (firstByte === 192 || firstByte === 208) ?
[_hv_msg_getFloat(msg, 0), _hv_msg_getFloat(msg, 1)] :
[_hv_msg_getFloat(msg, 0), _hv_msg_getFloat(msg, 1), _hv_msg_getFloat(msg, 2)];
default:
Expand Down
8 changes: 4 additions & 4 deletions hvcc/generators/ir2c/templates/Heavy_NAME.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,31 +13,31 @@ extern "C" {
#pragma mark - Heavy Context
#endif

{% if externs.parameters.in|length > 0 -%}
{% if externs.parameters.inParam|length > 0 -%}
typedef enum {
{%- for k,v in externs.parameters.inParam %}
HV_{{name|upper}}_PARAM_IN_{{k|upper}} = {{v.hash}}, // {{v.display}}
{%- endfor %}
} Hv_{{name}}_ParameterIn;
{% endif -%}

{% if externs.parameters.out|length > 0 %}
{% if externs.parameters.outParam|length > 0 %}
typedef enum {
{%- for k,v in externs.parameters.outParam %}
HV_{{name|upper}}_PARAM_OUT_{{k|upper}} = {{v.hash}}, // {{v.display}}
{%- endfor %}
} Hv_{{name}}_ParameterOut;
{% endif -%}

{% if externs.events.in|length > 0 %}
{% if externs.events.inEvent|length > 0 %}
typedef enum {
{%- for k,v in externs.events.inEvent %}
HV_{{name|upper}}_EVENT_IN_{{k|upper}} = {{v.hash}}, // {{v.display}}
{%- endfor %}
} Hv_{{name}}_EventIn;
{% endif -%}

{% if externs.events.out|length > 0 %}
{% if externs.events.outEvent|length > 0 %}
typedef enum {
{%- for k,v in externs.events.outEvent %}
HV_{{name|upper}}_EVENT_OUT_{{k|upper}} = {{v.hash}}, // {{v.display}}
Expand Down

0 comments on commit 674e222

Please sign in to comment.