[Audio] Mix engine : 32 or 64 bit?

Hi, I was wondering about the bit depth of the mixing engine.

I looked into the mixer code, and the mixing operation itself consits of a float+float operation ( *d++ += *s++; with d and s being pointers to float)

[code]void AudioSampleBuffer::addFrom (const int destChannel,
const int destStartSample,
const AudioSampleBuffer& source,
const int sourceChannel,
const int sourceStartSample,
int numSamples,
const float gain) throw()
jassert (&source != this || sourceChannel != destChannel);
jassert (((unsigned int) destChannel) < (unsigned int) numChannels);
jassert (destStartSample >= 0 && destStartSample + numSamples <= size);
jassert (((unsigned int) sourceChannel) < (unsigned int) source.numChannels);
jassert (sourceStartSample >= 0 && sourceStartSample + numSamples <= source.size);

if (gain != 0.0f && numSamples > 0)
    float* d = channels [destChannel] + destStartSample;
    const float* s  = source.channels [sourceChannel] + sourceStartSample;

    if (gain != 1.0f)
        while (--numSamples >= 0)
          *d++ += gain * *s++;
        while (--numSamples >= 0)
           *d++ += *s++;


Now floats are supposed to be 32bit, aren’t they ? So float+float gives you a float so 32bit. Everything is 32bit here :smiley:
I had a doubt because, I saw that Tracktion, which AFAIK, is based on Juce, claimls to have a 64bit mixing engine.
If someone could shed some light on this, it would be much appreciated :smiley:

Since an AudioSampleBuffer holds 32-bit data, I don’t think an awful lot would be gained by doing that addition with doubles!

Tracktion has its own audio code - I wrote the juce audio classes afterwards, and AFAIK they’re not used for summing the channels. (Though TBH I doubt if anyone would be actually be able to tell the difference)

Thanks !

Yep definitely, I think that’s more a marketting thing than anything else :slight_smile: