| 1162 | } |
| 1163 | |
| 1164 | void Utilities::generateAudioValueCode() { |
| 1165 | std::ofstream output_file; |
| 1166 | output_file.open("/home/frot/odin2/Source/GeneratedAudioValueCode.h"); |
| 1167 | |
| 1168 | output_file << "//This code was automatically generated by " |
| 1169 | "Utilities::generateAudioValueCode()\n\n"; |
| 1170 | output_file << "//WAVEDRAW\n\n"; |
| 1171 | |
| 1172 | for (int i = 0; i < WAVEDRAW_STEPS_X; ++i) { |
| 1173 | float val = sin(2 * M_PI * i / (float)WAVEDRAW_STEPS_X) * 0.9; |
| 1174 | output_file << "std::make_unique<AudioParameterFloat> (\"osc1_wavedraw[" + std::to_string(i) + |
| 1175 | "]\",\"osc1_wavedraw[" + std::to_string(i) + "]\",-1,1," + std::to_string(val) + "),\n"; |
| 1176 | output_file << "std::make_unique<AudioParameterFloat> (\"osc2_wavedraw[" + std::to_string(i) + |
| 1177 | "]\",\"osc2_wavedraw[" + std::to_string(i) + "]\",-1,1," + std::to_string(val) + "),\n"; |
| 1178 | output_file << "std::make_unique<AudioParameterFloat> (\"osc3_wavedraw[" + std::to_string(i) + |
| 1179 | "]\",\"osc3_wavedraw[" + std::to_string(i) + "]\",-1,1," + std::to_string(val) + "),\n"; |
| 1180 | } |
| 1181 | |
| 1182 | output_file << "\n//CHIPDRAW\n\n"; |
| 1183 | |
| 1184 | for (int i = 0; i < CHIPDRAW_STEPS_X; ++i) { |
| 1185 | float val = i < CHIPDRAW_STEPS_X / 2 ? 0.875f : -0.875f; |
| 1186 | output_file << "std::make_unique<AudioParameterFloat> (\"osc1_chipdraw[" + std::to_string(i) + |
| 1187 | "]\",\"osc1_chipdraw[" + std::to_string(i) + "]\",-1,1," + std::to_string(val) + "),\n"; |
| 1188 | output_file << "std::make_unique<AudioParameterFloat> (\"osc2_chipdraw[" + std::to_string(i) + |
| 1189 | "]\",\"osc2_chipdraw[" + std::to_string(i) + "]\",-1,1," + std::to_string(val) + "),\n"; |
| 1190 | output_file << "std::make_unique<AudioParameterFloat> (\"osc3_chipdraw[" + std::to_string(i) + |
| 1191 | "]\",\"osc3_chipdraw[" + std::to_string(i) + "]\",-1,1," + std::to_string(val) + "),\n"; |
| 1192 | } |
| 1193 | |
| 1194 | output_file << "\n//SPECDRAW\n\n"; |
| 1195 | |
| 1196 | for (int i = 0; i < SPECDRAW_STEPS_X; ++i) { |
| 1197 | float val = i == 0 ? 1 : 0; |
| 1198 | output_file << "std::make_unique<AudioParameterFloat> (\"osc1_specdraw[" + std::to_string(i) + |
| 1199 | "]\",\"osc1_specdraw[" + std::to_string(i) + "]\",0,1," + std::to_string(val) + "),\n"; |
| 1200 | output_file << "std::make_unique<AudioParameterFloat> (\"osc2_specdraw[" + std::to_string(i) + |
| 1201 | "]\",\"osc2_specdraw[" + std::to_string(i) + "]\",0,1," + std::to_string(val) + "),\n"; |
| 1202 | output_file << "std::make_unique<AudioParameterFloat> (\"osc3_specdraw[" + std::to_string(i) + |
| 1203 | "]\",\"osc3_specdraw[" + std::to_string(i) + "]\",0,1," + std::to_string(val) + "),\n"; |
| 1204 | } |
| 1205 | |
| 1206 | output_file.close(); |
| 1207 | } |
| 1208 | |
| 1209 | void Utilities::writeSampleTableToFile(const std::string &p_filename) { |
| 1210 |
nothing calls this directly
no outgoing calls
no test coverage detected