I'm making my first steps with the JUCE Framework (and with C++, too). I want to write a simple Application to convert a Aif-File to a Wav-File.
Here is my Code:
File aifFile = File("/Users/tedferry/Desktop/SoundFile.aif"); FileInputStream *soundFileInputStream = aifFile.createInputStream(); File wavFile = File("/Users/tedferry/Desktop/SoundFile.wav"); FileOutputStream *soundFileOutputStream = wavFile.createOutputStream(); AiffAudioFormat aif; AudioFormatReader *aifReader = aif.createReaderFor(soundFileInputStream, 0); WavAudioFormat wav; AudioFormatWriter *wavWriter = wav.createWriterFor(soundFileOutputStream, 44100, 2, 16, nullptr, 0); wavWriter->writeFromAudioReader(*aifReader, 0, -1);
The aif-data is written to the wav-file. The only problem is if I'm trying to open the wav-File with the finder on my mac the duration shown is 0 seconds. The filesize on the other hand is nearly as big as the aif-file.
What I'm missing? I've read the framework documentation with the related classes but I can't find my mistake.
Please let me know, if anyone has any advice for me and sorry for my bad english.