Example #1
0
    void setUsingSampledSound()
    {
        synth.clearSounds();

        WavAudioFormat wavFormat;

        AudioFormatReader* audioReader
            = wavFormat.createReaderFor (new MemoryInputStream (BinaryData::cello_wav,
                                                                BinaryData::cello_wavSize,
                                                                false),
                                         true);

        BitArray allNotes;
        allNotes.setRange (0, 128, true);

        synth.addSound (new SamplerSound (T("demo sound"),
                                          *audioReader,
                                          allNotes,
                                          74,   // root midi note
                                          0.1,  // attack time
                                          0.1,  // release time
                                          10.0  // maximum sample length
                                          ));

        delete audioReader;
    }