Simple Midi Sequencer VST/AU Demo Request


hi guys,
I’m struggling to make a realtime sequencer.
There are values like SampleRate, SamplesPerBlock, buffer.getNumSamples(), etc…
and then the AudioPlayHead with bpm, ppq, samples, second etc…
What is the right approach to build a simple sequencer with a resolution of 24 ticks per quarter?
one of the problems i also have is that if i have long sounding notes and set the noteOff sample offset (f.e. 4sec * samplerate), the new NoteOn’s get stucked 'till the old one is released…
a simple demo code would be really helpful!
sorry for the bad spelling and many thanks!