[alsa-devel] Tempo event in a Midi sequencer...
vuott at yahoo.it
Wed Jun 20 22:17:09 CEST 2012
I am finally able to make a simple midi sequencer with the Gambas language. It works, but I have some little problem about changing the metronomic Tempo within a midi song.
Since I used the method of sending an Echo event to send Midi Messages groups to ALSA, I thought I'd solve the problem of an eventual return of metronomic Time by sending an echo and backing from Alsa custom (Type: 90). At the time of receipt of the echo by the Alsa function:
int snd_seq_event_input(snd_seq_t *handle, snd_seq_event_t **ev)
the code sends the value of the tempo to a routine, where there are these Alsa functions:
...obviously with teir parametres.
I noticed, though, unfortunately (incomprehensibly) that often the change is a bit 'earlier than required. I do not think there is a problem of Delta Time, since the Delta Time of metronomic Tempo event is treated the same way as that relating to other MIDI events.
Looking for a solution, I had a look at the code of your Aplaymidi, and I saw this statement:
case 0x51: /* tempo */
event->type = SND_SEQ_EVENT_TEMPO;
so, I thought that the change of Tempo occur simply by sending an event by identifying it with precisely the type number: 35. I performed the test, checking the result is listening to the song, seeing both as reported by Aseqdump.
I guess it Aseqdump me signals a correct delivery, because it gives me back this response:
queue + a number depending on the value sent with the Tempo event.
Instead, listening to the midi track, the change does not happen!
I am writing to ask you, if my analysis is correct, and if it is sufficient to send only time that event, or if some function of Alsa is absolutely necessary
More information about the Alsa-devel