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