Can i embed .wav audio to the vst plugin?

Hi all. Can you please help me with a problem?
I want to play a wav file in my vst plugin.
Then how can i do it?
i think i must embed the wav data to the plugin.
If i am right, can anybody help me how to do it?
Thank you very much!

How big is it?

You can either keep it external to the VST and load it from a file or use BinaryData and embed it inside your plugin as a resource.

Rail

HI, Rail

Thanks for your information.
I got it. :slight_smile:

Jin

here is an example of how to do that:

juce::AudioFormatManager formatManager;
formatManager.registerBasicFormats();

juce::MemoryInputStream* wavdata = new juce::MemoryInputStream(BinaryData::Vinyl_wav, BinaryData::Vinyl_wavSize, false);
auto reader = formatManager.createReaderFor((std::unique_ptr<juce::InputStream>)wavdata);

juce::AudioBuffer<float> audioBuffer;
audioBuffer.setSize(reader->numChannels, reader->lengthInSamples);
reader->read(&audioBuffer, 0, reader->lengthInSamples, 0, true, true);

delete reader;