Skip to content

Instantly share code, notes, and snippets.

@jatinchowdhury18
Last active September 27, 2023 15:15
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save jatinchowdhury18/542af47196d1ba13c469d34b803a1194 to your computer and use it in GitHub Desktop.
Save jatinchowdhury18/542af47196d1ba13c469d34b803a1194 to your computer and use it in GitHub Desktop.
Loading audio files from BinaryData (JUCE/C++)
// loading audio file "guitar.wav"
AudioFormatManager formatManager;
formatManager.registerBasicFormats();
// normal way
File audioFile ("/path/to/guitar.wav");
FileInputStream* input = audioFile.createInputStream();
AudioFormatReader* reader = formatManager.createReaderFor (input);
// from the reader we can load into an audio buffer, etc...
// From BinaryData
MemoryInputStream* input = new MemoryInputStream (BinaryData::guitar_wav, BinaryData::guitar_wavSize, false);
AudioFormatReader* reader = formatManager.createReaderFor (input);
// Don't forget to clean up pointers...
@lazerfox74
Copy link

wow thankyou so much

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment