electro-smith / json2daisy

Utility for converting JSON board definitions into valid, libDaisy compatible C++ board support files
MIT License
6 stars 4 forks source link

Consider output format for mappings #11

Open CorvusPrudens opened 3 years ago

CorvusPrudens commented 3 years ago

Since the intended uses for the generated code is not only PD, it's not necessary (and maybe undesirable) to convert everything to a float.

stephenhensley commented 3 years ago

Not a bad idea.

I've seen a few other generator-friendly glue code that's got a bunch of functions for different types -- i.e. AsFloat() asInt() asString(), etc.

Afaik most things already cast to float without too much issue (i.e. Switch::Pressed() can be cast to float and it should resolve to 0/1), and for actual use within c++, it is still preferable from a performance perspective to work with integer types where possible.