Vuo  2.0.0
VuoAudioBinAverageType.c
Go to the documentation of this file.
1 
10 #include "type.h"
11 #include "VuoAudioBinAverageType.h"
13 
15 #ifdef VUO_COMPILER
17  "title" : "Audio Bin Averaging Type",
18  "description" : "How to average multiple bins together.",
19  "keywords" : [ "fft", "analyze", "frequency" ],
20  "version" : "1.0.0",
21  "dependencies" : [
22  "VuoList_VuoAudioBinAverageType"
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  VuoAudioBinAverageType value = VuoAudioBinAverageType_Quadratic;
39 
40  if (!strcmp(valueAsString, "none"))
42  else if (!strcmp(valueAsString, "quadratic"))
43  value = VuoAudioBinAverageType_Quadratic;
44  else if (!strcmp(valueAsString, "logarithmic"))
45  value = VuoAudioBinAverageType_Logarithmic;
46 
47  return value;
48 }
49 
55 {
56  char *valueAsString = "";
57 
58  switch (value)
59  {
61  valueAsString = "none";
62  break;
63 
64  case VuoAudioBinAverageType_Quadratic:
65  valueAsString = "quadratic";
66  break;
67 
68  case VuoAudioBinAverageType_Logarithmic:
69  valueAsString = "logarithmic";
70  break;
71  }
72 
73  return json_object_new_string(valueAsString);
74 }
75 
80 {
82 
84  VuoListAppendValue_VuoAudioBinAverageType(l, VuoAudioBinAverageType_Quadratic);
85  VuoListAppendValue_VuoAudioBinAverageType(l, VuoAudioBinAverageType_Logarithmic);
86 
87  return l;
88 }
94 {
95  char *valueAsString = "";
96 
97  switch (value)
98  {
100  valueAsString = "None";
101  break;
102 
103  case VuoAudioBinAverageType_Quadratic:
104  valueAsString = "Quadratic";
105  break;
106  case VuoAudioBinAverageType_Logarithmic:
107  valueAsString = "Logarithmic";
108  break;
109  }
110 
111  return strdup(valueAsString);
112 }