Brix wrote:
> My code doesn't return any error, i just can't hear anything. If i
> do it via the RawMIDI API, it works fine (but it's, bleahh,
> horrible to use).
>
> I thought it was because i didn't assign any path/instrument to
> the midi channels,

The default instrument is 0 (grand piano).

> so i tried to set them via RawMIDI, but it still doesn't work.

You can send program change messages with the sequencer, too.

> void set_chan_instr( int chan, int instrument ) {
>   int ch = 0xC0 + chan;
>   snd_rawmidi_write(handle_out, &ch, 1);

This does not work on big-endian machines, use char for ch.

>   // now we try to set up channel 0 via RawMIDI
>   snd_rawmidi_open( NULL, &handle_out, "hw:0,1", 0)
>   // ok, let's assign instrument #4
>   set_chan_instr( 0, 4 );

If the rawmidi device is already opened, it may not be possible for
the sequencer to open it, too.  Call snd_rawmidi_close, or leave this
code out altogether.

>   // let's play! (we hope..)
>   snd_seq_event_output(seq, &ev);
>   snd_seq_drain_output(seq);
>   snd_seq_start_queue(seq, queue, NULL);
>   snd_seq_drain_output(seq);
>
>   return 0;
> }

Directly after starting the queue, the program exists, and the queue
gets destroyed.  Try snd_seq_sync_output.


HTH
Clemens




-------------------------------------------------------
The SF.Net email is sponsored by EclipseCon 2004
Premiere Conference on Open Tools Development and Integration
See the breadth of Eclipse activity. February 3-5 in Anaheim, CA.
http://www.eclipsecon.org/osdn
_______________________________________________
Alsa-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/alsa-devel

Reply via email to