Vuo
2.4.4
Loading...
Searching...
No Matches
node
vuo.midi
VuoMidiController.c
Go to the documentation of this file.
1
10
#include "
VuoMidiController.h
"
11
#include "
VuoInteger.h
"
12
#include "
VuoText.h
"
13
15
#ifdef VUO_COMPILER
16
VuoModuleMetadata
({
17
"title"
:
"MIDI Controller"
,
18
"description"
:
"A music controller event sent via MIDI."
,
19
"keywords"
: [
"CC"
,
"custom controller"
],
20
"version"
:
"1.0.0"
,
21
"dependencies"
: [
22
"VuoBoolean"
,
23
"VuoInteger"
,
24
"VuoText"
25
]
26
});
27
#endif
29
42
VuoMidiController
VuoMidiController_makeFromJson
(json_object * js)
43
{
44
return
(
VuoMidiController
){
45
VuoJson_getObjectValue
(
VuoInteger
, js,
"channel"
, 1),
46
VuoJson_getObjectValue
(
VuoInteger
, js,
"controllerNumber"
, 1),
47
VuoJson_getObjectValue
(
VuoInteger
, js,
"value"
, 127),
48
};
49
}
50
55
json_object *
VuoMidiController_getJson
(
const
VuoMidiController
mn)
56
{
57
json_object *js = json_object_new_object();
58
59
json_object *channelObject =
VuoInteger_getJson
(mn.
channel
);
60
json_object_object_add(js,
"channel"
, channelObject);
61
62
json_object *controllerNumberObject =
VuoInteger_getJson
(mn.
controllerNumber
);
63
json_object_object_add(js,
"controllerNumber"
, controllerNumberObject);
64
65
json_object *valueObject =
VuoInteger_getJson
(mn.
value
);
66
json_object_object_add(js,
"value"
, valueObject);
67
68
return
js;
69
}
70
75
char
*
VuoMidiController_getSummary
(
const
VuoMidiController
mn)
76
{
77
return
VuoText_format
(
"Channel %d, controller %d (0x%02x): value %d"
,
78
mn.
channel
, mn.
controllerNumber
, mn.
controllerNumber
, mn.
value
);
79
}
80
84
bool
VuoMidiController_areEqual
(
const
VuoMidiController
value1,
const
VuoMidiController
value2)
85
{
86
return
(value1.
channel
== value2.
channel
87
&& value1.
controllerNumber
== value2.
controllerNumber
88
&& value1.
value
== value2.
value
);
89
}
90
95
bool
VuoMidiController_isLessThan
(
const
VuoMidiController
a,
const
VuoMidiController
b)
96
{
97
VuoType_returnInequality
(
VuoInteger
, a.
channel
, b.
channel
);
98
VuoType_returnInequality
(
VuoInteger
, a.
controllerNumber
, b.
controllerNumber
);
99
VuoType_returnInequality
(
VuoInteger
, a.
value
, b.
value
);
100
return
false
;
101
}
Generated on Thu Nov 9 2023 16:59:30 for Vuo by
1.9.8