Make mapSectionOfFile virtual

Hi,

quick question: is there a reason why mapSectionOfFile in MemoryMappedAudioFormatReader() isn’t virtual (besides no one asked for it before?)

I am writing a lossless audio codec and it has a little bit more to do than just arithmetically converting the sample index to a byte position in the input stream (it must lookup the block index in a header and seek from there to the actual sample index so it needs to round down the samples to the block size of 4096) and in order to keep maximal compatibility to the interface of this class, I would have to overwrite this method.

I just made it virtual in my local JUCE codebase and it didn’t light the world on fire, but as with everything I would prefer if it found its way into the official codebase so I don’t have to change it everytime I update the JUCE version.

1 Like

OK… I guess there’s no particular reason why that couldn’t be virtual. I’ll change that for you.

1 Like

That sounds interesting! Is it an implementation of an existing, or are you creating a new codec?
Would love to hear more about, if you can/are allowed to tell :slight_smile:

It’s a custom codec heavily specialised for sample based instruments (I was inspired by the BFDLAC talk because I needed something similar and FLAC is way too slow for my purpose).

Basically it has a lower compression ratio compared to FLAC (for decaying samples it has ~45% size while FLAC comes down to 25%). However the decompression speed is just as fast as uncompressed PCM read (the complexity of the decompression algorithm is a bit more complicated than deinterleaving stereo samples…).

I am currently finishing the first version which will be BSD licensed. I’ll keep you posted when it’s ready :slight_smile:

2 Likes

Yes, please do. Sounds very interesting!
Cheers

BFDLAC is now available for licencing, if anyone is interested. I’ve ported it to ARM NEON, added a JUCE interface, and added further AVX optimizations & sub-algorithms. contact me: skot@roli.com

2 Likes