[CM] Fwd: Linux/Midi Test

Kjetil S. Matheussen k.s.matheussen at notam02.no
Tue Aug 11 06:43:31 PDT 2009



On Tue, 11 Aug 2009, lieven moors wrote:

> I think I might know what the problem is with Juce. I had a look at the
> Juce code myself,
> and it looks like sendMessageNow() is not calling the
> snd_seq_drain_output().

For what its worth, the one time I've written code which sends
midi via alsa, the code calls snd_seq_drain_output as last
operation. I don't remember what I did back then, but this
could definitely be the problem. It sounds likely, at least.


static void alsaseq_PutMidi(
 			    struct MidiLink *midilink,
 			    uint32_t msg
 			    )
{
   unsigned int d3=(msg>>8)&0xff;
   unsigned int d2=(msg>>16)&0xff;
   unsigned int d1=(msg>>24)&0xff;

   unsigned char buffer[3]={d1,d2,d3};
   snd_seq_event_t ev;
   snd_midi_event_t *midi_ev;
   snd_midi_event_new( 10, &midi_ev );

   snd_seq_ev_clear( &ev );
   snd_midi_event_encode(midi_ev,
 			buffer,
 			3,
 			&ev);
   snd_midi_event_free( midi_ev );

   snd_seq_ev_set_source(&ev,midilink->port);
   snd_seq_ev_set_subs(&ev);

   snd_seq_ev_schedule_tick( &ev, radium_queue, 1, 1);

   snd_seq_event_output(radium_seq, &ev);

   snd_seq_drain_output(radium_seq);

}



More information about the Cmdist mailing list