How do I wrap a Sampler/Synthesiser inside of an AudioSource?

@fabian, turns out this doesn’t really work as I expected it to - ResamplingAudioSource may call multiple times its input->getNextAudioBlock() even when ratio=1 and on the SamplerAudioSource side I would still pass the same midiMessageBuffer, which causes the messages to be handled multiple times.

Also, these messages should be aligned according to the DAW sampling rate, right? But I am directly passing them to the sampler without any modification. Doesn’t this mean that, if DAW sampleRate=88kHz (just for ease of calculation) and my sampler’s sampleRate=44kHz, if I get a message which has a samplePosition=10, I should translate that to a message with samplePosition=5 and THEN pass it to the sampler, right?

The first issue I could solve by clearing messages, which have already been handled (with MidiBuffer::clear (int start, int numSamples)), or maybe there is a better way?

Is there some JUCE magic I’m unaware of for problem #2?