electro-smith / DaisySP

A Powerful DSP Library in C++
https://www.electro-smith.com/daisy
Other
836 stars 131 forks source link

Add Looper and Buffer #168

Closed beserge closed 2 years ago

beserge commented 2 years ago

Works fine so far. The only thing is the way you initialize it is super annoying. Something like

Looper<48000 * 10>               looper;
Buffer<48000 * 10> DSY_SDRAM_BSS buffer;

...

looper.Init(&buffer);

The easiest fix would be to just make the user put the whole looper object in SDRAM rather than just the buffer.

stephenhensley commented 2 years ago

@brbrr Actually great point -- when using #include <cmath> this would require sinf instead of regular sin to prevent unintentional casting to/from double-precision.

However, if we include our local dsp.h instead (that includes math.h, as well as the macros for PI_F, etc.) It should use the std::sin from the cpp std library, which is a template, that correctly maps to the float type.

stephenhensley commented 2 years ago

Pending any changes for new features, and adding a buffer class to DaisySP this seems good to go