MCPcopy Create free account
hub / github.com/amsynth/amsynth / float_from_string

Function float_from_string

src/core/synth/PresetController.cpp:292–313  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

290}
291
292static float float_from_string(const char *s)
293{
294 if (strchr(s, 'e'))
295 return Parameter::valueFromString(std::string(s));
296 float rez = 0, fact = 1;
297 if (*s == '-'){
298 s++;
299 fact = -1;
300 };
301 for (int point_seen = 0; *s; s++){
302 if (*s == '.'){
303 point_seen = 1;
304 continue;
305 };
306 int d = *s - '0';
307 if (d >= 0 && d <= 9){
308 if (point_seen) fact /= 10.0f;
309 rez = rez * 10.0f + (float)d;
310 };
311 };
312 return rez * fact;
313}
314
315static bool readBankFile(const char *filename, Preset *presets)
316{

Callers 1

readBankFileFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected