I'm use BASS_MIDI in iPhone development. I create midiStream from file like this
midiStream = BASS_MIDI_StreamCreateFile(false, filePath, 0, 0, 0, 44100);
Then i play/position/pause it, changing volume and tempo. I change tempo(for playback speed control) before playing like this
BASS_MIDI_StreamEvent(midiStream, 0, MIDI_EVENT_TEMPO, currentTempo);//microseconds per quarter note
BASS_ChannelPlay(midiStream, false);
It works good, but i have one problem. If position of midistream is 0, then tempo not changed(volume, and another BASS_MIDI_StreamEvent's don't works too). If change call order like this
BASS_ChannelPlay(midiStream, false);
BASS_MIDI_StreamEvent(midiStream, 0, MIDI_EVENT_TEMPO, currentTempo);//microseconds per quarter note
then i have some lag(playback starts with incorrect speed and it change after a half of second, or less. How can i fix it? Is there a way to call events before playing in zero position?
P.S. Sorry for bad English.
Answer was founded on offecial BASS forum.
The problem there is that your events are being overridden by events in the MIDI file. To avoid that, you can use "mixtime" BASS_SYNC_MIDI_EVENT syncs to override the file's events. A demonstration of this can be found in the MIDITEST example (get it from one of the other platform BASSMIDI packages)...
Note it's also setting a BASS_SYNC_SETPOS sync because the events are reset to the MIDI file's values when seeking too.