I wrote a c code to send MIDI message "NOTE ON" to sequencer, but I get
"Segmentation fault".
What's wrong with it?
#include <stdio.h>
#include <stdlib.h>
#include <fcntl.h>
#include <alsa/asoundlib.h>
#define MPUOUT_CLIENT 73
#define MPUOUT_PORT 0
main(){
MIDI_IO();
}
void MIDI_IO(){
int portid;
snd_seq_t *ctxp;
snd_seq_event_t ev;
snd_seq_client_id(ctxp);
snd_seq_open(&ctxp, "hw", SND_SEQ_OPEN_OUTPUT, 0);
portid = snd_seq_create_simple_port(ctxp, "hw",
SND_SEQ_PORT_CAP_WRITE|SND_SEQ_PORT_CAP_SUBS_WRITE|SND_SEQ_PORT_CAP_READ,
SND_SEQ_PORT_TYPE_APPLICATION);
snd_seq_connect_to(ctxp, portid, MPUOUT_CLIENT, MPUOUT_PORT);
ev.type = SND_SEQ_EVENT_NOTEON;
ev.data.note.channel = 0x00;
ev.data.note.note = 0x30;
ev.data.note.velocity = 0x7f;
ev.data.note.duration = 0x7f;
snd_seq_event_output_direct(ctxp,&ev);
return;
}
-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
Alsa-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/alsa-user