Float, double or template?

I'm kinda new to developing audio plugins, so I was wondering what the best way to deal with the processBlock function is concerning floats or doubles. I've seen some code written with templates, but I don't understand what the compatibility issues are. If I'm developing an audio plugin that I want to work in the most formats, should I write it with floats, doubles or both (templates) in mind? I'm asking about the AudioSampleBuffer perspective.

Thanks. 

 

 

Depends on whether your plugin would ever need to produce 64-bit output, and in most cases the answer is "no", because it rarely makes any noticeable difference to the sound, while using more CPU.

You might want to keep your options open and write it with templates, which will complicate things a bit. But if you don't think any of your users would ever care about 64-bit then the easiest way to do it would be to just use plain old floats.

So whether a plugin is 32 bit or 64 bit has nothing to do with the actual data buffer size, only the memory addressing?

 

 

The confusion is understandable, but there are two entirely separate and unrelated things:

- Whether you're building a binary for 32 or 64-bit CPU architecture.

- Whether your plugin can accept 32-bit (float) and/or 64-bit (double) audio buffers.

1 Like