[SOLVED] SamplerSound applying to single note...confused


Hi all,

So I’m trying to use the SamplerSound class in a quick and dirty way for a bit of prototyping inside a plugin. I just need a single kick and snare sound from a binary resource / wav that I can trigger on a single note from a Synthesiser object.

Ideally I want my loaded sample to play for a single note only. I am able to play my samples fine when I set their ranges from 0-128 etc. but cannot seem to get any playback when specifying a single note range for the SamplerSound object. If I hit MIDI note 36 (C3) I get nothing. No sample triggering on any MIDI note / key when I use a single note range.

Can anyone see an obvious/thick mistake I am making in the code below ? Never really used the SamplerSound class before or even attempted to write a sample instrument so I’m probably doing something wrong.

 //Initialise the synth
        WavAudioFormat wavFormat;
        std::unique_ptr<AudioFormatReader> audioReaderKick(wavFormat.createReaderFor(new MemoryInputStream(BinaryData::bassdrum_wav,

        std::unique_ptr<AudioFormatReader> audioReaderSnare(wavFormat.createReaderFor(new MemoryInputStream(BinaryData::snaredrum_wav,
        BigInteger kickNotes;

        BigInteger snareNotes;

        synth.addSound(new SamplerSound("Kick Sound", *audioReaderKick, kickNotes, 36, 0.0, 0.1, 5.0));
        synth.addSound(new SamplerSound("Snare Sound", *audioReaderSnare, snareNotes, 60, 0.0, 0.1, 5.0));

        synth.addVoice(new SamplerVoice());

Thanks Jucers.


Ah. Solved. Appeared to be down to a build issue rather than the code.