Vuo
2.1.1
node
vuo.midi
VuoMidiInputDevice.c
Go to the documentation of this file.
1
10
#include "
type.h
"
11
#include "
VuoMidiInputDevice.h
"
12
14
#ifdef VUO_COMPILER
15
VuoModuleMetadata
({
16
"title"
:
"MIDI Input Device"
,
17
"description"
:
"A set of specifications for choosing a MIDI input device."
,
18
"keywords"
: [ ],
19
"version"
:
"1.0.0"
,
20
"dependencies"
: [
21
"VuoInteger"
,
22
"VuoText"
23
]
24
});
25
#endif
26
38
VuoMidiInputDevice
VuoMidiInputDevice_makeFromJson
(
json_object
* js)
39
{
40
return
(
VuoMidiInputDevice
){
41
VuoJson_getObjectValue
(
VuoInteger
, js,
"id"
, -1),
42
VuoJson_getObjectValue
(
VuoText
, js,
"name"
, NULL),
43
""
};
44
}
45
49
json_object
*
VuoMidiInputDevice_getJson
(
const
VuoMidiInputDevice
md)
50
{
51
json_object
*js = json_object_new_object();
52
53
if
(md.
id
> 0)
54
{
55
json_object
*idObject =
VuoInteger_getJson
(md.
id
);
56
json_object_object_add(js,
"id"
, idObject);
57
}
58
59
if
(md.
name
)
60
{
61
json_object
*nameObject =
VuoText_getJson
(md.
name
);
62
json_object_object_add(js,
"name"
, nameObject);
63
}
64
65
return
js;
66
}
67
71
char
*
VuoMidiInputDevice_getSummary
(
const
VuoMidiInputDevice
md)
72
{
73
if
(md.
id
== -1 &&
VuoText_isEmpty
(md.
name
))
74
return
VuoText_format
(
"The first MIDI input device"
);
75
else
if
(md.
id
== -1)
76
return
VuoText_format
(
"The first MIDI input device whose name contains \"%s\""
, md.
name
);
77
else
if
(strlen(md.
name
) == 0)
78
return
VuoText_format
(
"MIDI input device #%lld"
, md.
id
);
79
else
80
return
VuoText_format
(
"MIDI input device #%lld (\"%s\")"
, md.
id
, md.
name
);
81
}
82
86
bool
VuoMidiInputDevice_areEqual
(
const
VuoMidiInputDevice
value1,
const
VuoMidiInputDevice
value2)
87
{
88
return
value1.
id
== value2.
id
89
&&
VuoText_areEqual
(value1.
name
, value2.
name
);
90
}
91
96
bool
VuoMidiInputDevice_isLessThan
(
const
VuoMidiInputDevice
a,
const
VuoMidiInputDevice
b)
97
{
98
return
a.
id
< b.
id
;
99
}
Generated on Thu Jul 9 2020 21:02:23 for Vuo by
1.8.18