Vuo  2.0.2
VuoNoise.c
Go to the documentation of this file.
1 
10 #include "type.h"
11 #include "VuoNoise.h"
12 #include "VuoList_VuoNoise.h"
13 
15 #ifdef VUO_COMPILER
17  "title" : "Noise",
18  "description" : "Type of noise.",
19  "keywords" : [ ],
20  "version" : "1.0.0",
21  "dependencies" : [
22  "VuoList_VuoNoise"
23  ]
24  });
25 #endif
26 
33 {
34  const char *valueAsString = "";
35  if (json_object_get_type(js) == json_type_string)
36  valueAsString = json_object_get_string(js);
37 
38  VuoNoise noise = VuoNoise_White;
39 
40  if (strcmp(valueAsString, "white") == 0) {
41  noise = VuoNoise_White;
42  } else if (strcmp(valueAsString, "grey") == 0) {
43  noise = VuoNoise_Grey;
44  } else if (strcmp(valueAsString, "pink") == 0) {
45  noise = VuoNoise_Pink;
46  } else if (strcmp(valueAsString, "brown") == 0) {
47  noise = VuoNoise_Brown;
48  } else if (strcmp(valueAsString, "blue") == 0) {
49  noise = VuoNoise_Blue;
50  } else if (strcmp(valueAsString, "violet") == 0) {
51  noise = VuoNoise_Violet;
52  }
53 
54  return noise;
55 }
56 
62 {
63  char * valueAsString = "";
64 
65  switch (value) {
66  case VuoNoise_White:
67  valueAsString = "white";
68  break;
69  case VuoNoise_Grey:
70  valueAsString = "grey";
71  break;
72  case VuoNoise_Pink:
73  valueAsString = "pink";
74  break;
75  case VuoNoise_Brown:
76  valueAsString = "brown";
77  break;
78  case VuoNoise_Blue:
79  valueAsString = "blue";
80  break;
81  case VuoNoise_Violet:
82  valueAsString = "violet";
83  break;
84  }
85 
86  return json_object_new_string(valueAsString);
87 }
88 
93 {
95  VuoListAppendValue_VuoNoise(l, VuoNoise_White);
96  VuoListAppendValue_VuoNoise(l, VuoNoise_Grey);
97  VuoListAppendValue_VuoNoise(l, VuoNoise_Pink);
98  VuoListAppendValue_VuoNoise(l, VuoNoise_Brown);
99  VuoListAppendValue_VuoNoise(l, VuoNoise_Blue);
100  VuoListAppendValue_VuoNoise(l, VuoNoise_Violet);
101  return l;
102 }
103 
108 char * VuoNoise_getSummary(const VuoNoise value)
109 {
110  return VuoNoise_getString(value);
111 }