Vuo 2.4.4
Loading...
Searching...
No Matches
VuoAudioOutputDevice.c
Go to the documentation of this file.
1
11
13#ifdef VUO_COMPILER
15 "title" : "Audio Output Device",
16 "description" : "Information about an audio output device.",
17 "keywords" : [ ],
18 "version" : "1.0.0",
19 "dependencies" : [
20 "VuoInteger",
21 "VuoText"
22 ]
23 });
24#endif
26
39{
40 return (VuoAudioOutputDevice){
42 VuoJson_getObjectValue(VuoText, js, "modelUid", NULL),
43 VuoJson_getObjectValue(VuoText, js, "name", NULL),
44 VuoJson_getObjectValue(VuoInteger, js, "channelCount", 0)
45 };
46}
47
52{
53 json_object *js = json_object_new_object();
54
55 if (value.id != -1)
56 {
57 json_object *idObject = VuoInteger_getJson(value.id);
58 json_object_object_add(js, "id", idObject);
59 }
60
61 if (value.modelUid)
62 {
63 json_object *nameObject = VuoText_getJson(value.modelUid);
64 json_object_object_add(js, "modelUid", nameObject);
65 }
66
67 if (value.name)
68 {
69 json_object *nameObject = VuoText_getJson(value.name);
70 json_object_object_add(js, "name", nameObject);
71 }
72
73 if (value.channelCount)
74 {
75 json_object *channelCountObject = VuoInteger_getJson(value.channelCount);
76 json_object_object_add(js, "channelCount", channelCountObject);
77 }
78
79 return js;
80}
81
86{
87 if (value.id == -1)
88 {
89 if (VuoText_isEmpty(value.modelUid))
90 {
91 if (VuoText_isEmpty(value.name))
92 return strdup("The default audio output device");
93 else // have name
94 return VuoText_format("The first audio output device whose name contains \"%s\"", value.name);
95 }
96 else // have model
97 {
98 if (VuoText_isEmpty(value.name))
99 return VuoText_format("The first audio output device whose model contains \"%s\"", value.modelUid);
100 else // have name
101 return VuoText_format("The first audio output device of the same model as \"%s\"", value.name);
102 }
103 }
104 else // have ID
105 {
106 if (VuoText_isEmpty(value.name))
107 return VuoText_format("Audio output device #%lld", value.id);
108 else
109 // An actual detected audio output device (rather than abstract criteria).
110 return VuoText_format("Audio output device #%lld<br>Name: \"%s\"<br>Model: \"%s\"<br>%lld output channels", value.id, value.name, value.modelUid, value.channelCount);
111 }
112}
113
118{
119 if (value.id == -1)
120 {
121 if (VuoText_isEmpty(value.modelUid))
122 {
123 if (VuoText_isEmpty(value.name))
124 return strdup("Default");
125 else // have name
126 return strdup(value.name);
127 }
128 else // have model
129 {
130 if (VuoText_isEmpty(value.name))
131 return strdup(value.modelUid);
132 else // have name
133 return strdup(value.name);
134 }
135 }
136 else // have ID
137 {
138 if (VuoText_isEmpty(value.name))
139 return VuoText_format("Device #%lld", value.id);
140 else
141 // An actual detected audio output device (rather than abstract criteria).
142 return strdup(value.name);
143 }
144}
145
150{
151 return (value1.id == value2.id &&
152 VuoText_areEqual(value1.modelUid, value2.modelUid) &&
153 VuoText_areEqual(value1.name, value2.name) &&
154 value1.channelCount == value2.channelCount);
155}
156
162{
163 return a.id < b.id;
164}