Looking to encrypt/decrypt external wavs in my sampler

I would suggest to inherit an InputStream and OutputStream. You can give them to any AudioFormatReader, and you have all freedom, if you get your encrypted data from a File, a MemoryBlock, or anything, even from a GZIPDecompressorInputStream…

You need to implement only 5 methods:
virtual int64 getTotalLength ()
virtual bool isExhausted ()
virtual int read (void *destBuffer, int maxBytesToRead)
virtual int64 getPosition ()
virtual bool setPosition (int64 newPosition)

Looks like only the read is specific to your problem…

1 Like