From: Takashi Iwai <tiwai@suse.de>
To: Guenther Sohler <guenther.sohler@newlogic.com>
Cc: alsa-devel@lists.sourceforge.net
Subject: Re: Most simple use of sequencer in ALSA
Date: Fri, 15 Feb 2002 17:32:21 +0100 [thread overview]
Message-ID: <s5hlmdud7u2.wl@alsa2.suse.de> (raw)
In-Reply-To: <XFMail.020215072124.guenther.sohler@newlogic.com>
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
Alsa-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/alsa-devel
next prev parent reply other threads:[~2002-02-15 16:32 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <XFMail.020204113205.guenther.sohler@newlogic.com>
2002-02-15 6:21 ` Most simple use of sequencer in ALSA Guenther Sohler
2002-02-15 16:32 ` Takashi Iwai [this message]
2002-02-15 17:58 ` Matthew Flax
2002-02-16 8:47 ` Guenther Sohler
2002-02-16 15:13 ` mixer problem with creative audixy - was most simple alsa seq application Guenther Sohler
2002-02-15 15:20 ` Most simple use of sequencer in ALSA Guenther Sohler
[not found] <s5h3d0hxy8h.wl@alsa1.suse.de>
2002-02-14 6:39 ` Most simple use of sequencer in alsa Guenther Sohler
2002-02-14 6:50 ` Ricardo Colon
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=s5hlmdud7u2.wl@alsa2.suse.de \
--to=tiwai@suse.de \
--cc=alsa-devel@lists.sourceforge.net \
--cc=guenther.sohler@newlogic.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.