I’m new to this forum.
I played a little with juce during the last year.
But was only on midi.
So first : big congrats for this lib as it’s what helped me started c++.
Now i’m starting to play with the audio.
I’m just trying to open a wav file, fill an AudioSampleBufferfrom a reader, and then write a new wave File.
Of course the idea will be to play with the samples in the buffer.
Anyway, the code below is what i did.
the file “seems” to be opened fine and written, but i can’t open it in any audio editor. Except in vlc.
I believe i don’t use the metadata correctly.
Plus the sizes are different.
Anyone can tell me what’s wrong in it ?
Thanks a lot.
class CoreEngine : public Thread
TextEditor* text; ComboBox *projet; String outFileName; FileInputStream *fileInputStream; FileOutputStream *fileOutputStream; WavAudioFormat *format; AudioFormatReader *reader; AudioFormatWriter *writer; AudioSampleBuffer *buffer; void run(); juce_UseDebuggingNewOperator
outFileName = “outwave.wav”;
fileInputStream = new FileInputStream(projet->getText());
fileOutputStream = new FileOutputStream(outFileName);
format= new WavAudioFormat;
text->setText(T("Creating Input")); wait(1000); reader = format->createReaderFor(fileInputStream,false); text->setText(T("Creating Output")); wait(1000); writer = format->createWriterFor(fileOutputStream,reader->sampleRate,reader->numChannels,reader->bitsPerSample,&reader->metadataValues,0); text->setText(T("Creating Processor")); wait(1000); buffer = new AudioSampleBuffer(reader->numChannels,reader->lengthInSamples); text->setText(T("Processing File")); wait(1000); buffer->readFromAudioReader(reader,0,reader->lengthInSamples,0,true,true); text->setText(T("Writing to Output")); wait(1000); buffer->writeToAudioWriter(writer,0,buffer->getNumSamples()); text->setText(T("Finished !!!")); wait(1000);