Last active
September 27, 2023 15:15
-
-
Save jatinchowdhury18/542af47196d1ba13c469d34b803a1194 to your computer and use it in GitHub Desktop.
Loading audio files from BinaryData (JUCE/C++)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
wow thankyou so much