[CM] Fwd: Linux/Midi Test
lieven moors
lievenmoors at gmail.com
Tue Aug 11 07:05:11 PDT 2009
Kjetil S. Matheussen wrote:
>
>
> 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);
>
> }
>
>
But the code in Juce calls snd_seq_event_output_direct() instead of
snd_seq_event_output()
and doesn't call snd_seq_drain_output().
I've tried replacing
snd_seq_event_output_direct()
with
snd_seq_event_output()
snd_seq_drain_output()
but timing still doesn't sound right. I can't say for sure if it sounds
different
So it is not that simple. But I think there is a problem with how the
buffers are used.
More information about the Cmdist
mailing list