thank you for your info. now i know that my procedure was almost correct. Until now i had good success in porting my app to alsa. it will be completed soon.
rds guenther On 15-Feb-02 Takashi Iwai wrote: > At Fri, 15 Feb 2002 07:21:24 +0100 (MET), > Guenther Sohler wrote: >> >> I have simplified the seq.c in the alsa-driver-test direcory for me >> to also understand. >> >> The program is now quite short and outputs a note and quits >> >> here is it >> ----------- >> >> #include <stdio.h> >> #include "alsa/asoundlib.h" >> >> >> int main(int argc, char *argv[]) >> { >> snd_seq_t *handle; >> snd_seq_event_t ev; >> >> snd_seq_open(&handle, "hw", SND_SEQ_OPEN_DUPLEX, 0); >> snd_seq_alloc_queue(handle); >> >> bzero(&ev, sizeof(ev)); >> ev.dest.client=65; >> ev.dest.port=0; >> ev.type = SND_SEQ_EVENT_NOTEON; >> ev.data.note.channel = 0; >> ev.data.note.note = 64 ; >> ev.data.note.velocity = 127; >> snd_seq_event_output_direct(handle, &ev); >> sleep(1); >> ev.type = SND_SEQ_EVENT_NOTEOFF; >> snd_seq_event_output_direct(handle, &ev); >> snd_seq_drain_output(handle); >> return 0; >> } >> >> There are two questions ? >> >> Why doesn't it work if I allocate no queue ? There is no need for a queue as >> i >> directly output events > > No, you don't need to allocate a queue if you schedule by yourself. > your program lack the schedule of events, i.e. > > snd_seq_ev_set_direct(&ev); > > before output the event packet. this is equivalent with > > ev.queue = SND_SEQ_QUEUE_DIRECT; > > if this is specified, the event is sent immediately to the > destination, so you don't need any queue. > as default, the event is scheduled using a specified queue, and as > default, the queue is #0. that's why you had to allocate a queue. > > one more note: you don't need to call snd_seq_drain_output() when you > send events via snd_seq_event_output_direct(). the drain_output() is > necessary for buffered outputs via normal snd_seq_event_output() > functions. > > >> What does "hw" mean ? what are the other possibilities ? > > originally it means "hardware". > in future it can be other ones, such like "network:foo", etc. > (well, we can dream :) > > > ciao, > > Takashi > > _______________________________________________ > Alsa-devel mailing list > [EMAIL PROTECTED] > https://lists.sourceforge.net/lists/listinfo/alsa-devel Guenther Sohler NewLogic Technologies AG Millennium Park 6 A-6890 Lustenau Phone: +43-5577-62000-507 E-Mail: [EMAIL PROTECTED] Fax: +43-5577-62000-988 _______________________________________________ Alsa-devel mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/alsa-devel