All of lore.kernel.org
 help / color / mirror / Atom feed
* Most simple use of sequencer in alsa
       [not found] <s5h3d0hxy8h.wl@alsa1.suse.de>
@ 2002-02-14  6:39 ` Guenther Sohler
  2002-02-14  6:50   ` Ricardo Colon
  0 siblings, 1 reply; 8+ messages in thread
From: Guenther Sohler @ 2002-02-14  6:39 UTC (permalink / raw)
  To: alsa-devel

Yesterday I was trying to use the sequencer to send a NOTEON EVENT to my
wavetable device. I did

*open the sequencer
*allocated a port_info structure
*filled in port and client to port_info
*attached info to sequencer
*allocated event
*freed event
* freed port structure

I was not able to get further as My program now caused a segfault which i was
not able to solve.

Can anyone email me a simple program to put a NOTEON event to any client/port
of the sequencer. I do not understand pmidi because it is too complex for me to
understand. I'd wish to get/receive/see a simple program with approx 30 lines

Can anybody help me ?

_______________________________________________
Alsa-devel mailing list
Alsa-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/alsa-devel

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Most simple use of sequencer in alsa
  2002-02-14  6:39 ` Most simple use of sequencer in alsa Guenther Sohler
@ 2002-02-14  6:50   ` Ricardo Colon
  0 siblings, 0 replies; 8+ messages in thread
From: Ricardo Colon @ 2002-02-14  6:50 UTC (permalink / raw)
  To: Guenther Sohler; +Cc: alsa-devel

Take a look at the seq.c file. It's in the directory of test programs that
come with ALSA. It's definitely the simplest example.

Otherwise, I can't really help you unless I see your code.

Thanks.

					-- R:

On Thu, 14 Feb 2002, Guenther Sohler wrote:

> Yesterday I was trying to use the sequencer to send a NOTEON EVENT to my
> wavetable device. I did
>
> *open the sequencer
> *allocated a port_info structure
> *filled in port and client to port_info
> *attached info to sequencer
> *allocated event
> *freed event
> * freed port structure
>
> I was not able to get further as My program now caused a segfault which i was
> not able to solve.
>
> Can anyone email me a simple program to put a NOTEON event to any client/port
> of the sequencer. I do not understand pmidi because it is too complex for me to
> understand. I'd wish to get/receive/see a simple program with approx 30 lines
>
> Can anybody help me ?
>
> _______________________________________________
> Alsa-devel mailing list
> Alsa-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/alsa-devel
>


_______________________________________________
Alsa-devel mailing list
Alsa-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/alsa-devel

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Most simple use of sequencer in ALSA
       [not found] <XFMail.020204113205.guenther.sohler@newlogic.com>
@ 2002-02-15  6:21 ` Guenther Sohler
  2002-02-15 16:32   ` Takashi Iwai
  2002-02-15 15:20 ` Most simple use of sequencer in ALSA Guenther Sohler
  1 sibling, 1 reply; 8+ messages in thread
From: Guenther Sohler @ 2002-02-15  6:21 UTC (permalink / raw)
  To: alsa-devel

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
What does "hw" mean ? what are the other possibilities ?



_______________________________________________
Alsa-devel mailing list
Alsa-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/alsa-devel

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Most simple use of sequencer in ALSA
       [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 15:20 ` Guenther Sohler
  1 sibling, 0 replies; 8+ messages in thread
From: Guenther Sohler @ 2002-02-15 15:20 UTC (permalink / raw)
  To: alsa-devel

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
What does "hw" mean ? what are the other possibilities ?



_______________________________________________
Alsa-devel mailing list
Alsa-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/alsa-devel

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Most simple use of sequencer in ALSA
  2002-02-15  6:21 ` Most simple use of sequencer in ALSA Guenther Sohler
@ 2002-02-15 16:32   ` Takashi Iwai
  2002-02-15 17:58     ` Matthew Flax
                       ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Takashi Iwai @ 2002-02-15 16:32 UTC (permalink / raw)
  To: Guenther Sohler; +Cc: alsa-devel

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

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Most simple use of sequencer in ALSA
  2002-02-15 16:32   ` Takashi Iwai
@ 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
  2 siblings, 0 replies; 8+ messages in thread
From: Matthew Flax @ 2002-02-15 17:58 UTC (permalink / raw)
  To: Takashi Iwai; +Cc: Guenther Sohler, alsa-devel

Yeah mate - I like it when you dream ....
Do you dream in mosaics of computer screens and code ?

On 15 February 2002, 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
> Alsa-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/alsa-devel

-- 
Matt

For electronic musicians ...
Vector Bass          : http://mffmvectorbass.sourceforge.net/
For developers ...
TimeScale Audio Mod  : http://mffmtimescale.sourceforge.net/
Multimedia Time Code : http://mffmtimecode.sourceforge.net/
3D Audio Library     : http://mffm3daudiolib.sourceforge.net/

_______________________________________________
Alsa-devel mailing list
Alsa-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/alsa-devel

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Most simple use of sequencer in ALSA
  2002-02-15 16:32   ` Takashi Iwai
  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
  2 siblings, 0 replies; 8+ messages in thread
From: Guenther Sohler @ 2002-02-16  8:47 UTC (permalink / raw)
  To: Takashi Iwai; +Cc: alsa-devel

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
> Alsa-devel@lists.sourceforge.net
> 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: guenther.sohler@newlogic.com       Fax:   +43-5577-62000-988


_______________________________________________
Alsa-devel mailing list
Alsa-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/alsa-devel

^ permalink raw reply	[flat|nested] 8+ messages in thread

* mixer problem with creative audixy - was most simple alsa seq application
  2002-02-15 16:32   ` Takashi Iwai
  2002-02-15 17:58     ` Matthew Flax
  2002-02-16  8:47     ` Guenther Sohler
@ 2002-02-16 15:13     ` Guenther Sohler
  2 siblings, 0 replies; 8+ messages in thread
From: Guenther Sohler @ 2002-02-16 15:13 UTC (permalink / raw)
  To: Takashi Iwai; +Cc: alsa-devel

Thank you very much for the advice.
I dont need thr queue any more
Now almost all midi works again in my application - but now for alsa(instead of
oss)
But there is another problem now. I use an audixy card in my pc connected to an
external amplifier. 
Even the amplifier is set to the maximal volume, midi synth is quite silent
whereas pcm is very loud.

Obviously the problem is in the mixer

alsmixer shows me a lot of volumes to adjust, but actually just the volume of
"music" show en effect. maximum volume on music makes me hear a silent tune.
but "master" and all other volumes do not show(sound) a change in the volume.

In my application i can now select where the output goes to

64:0 is the external midi and 65:0-3 is the awe synth
64:0 does not work all the time. but directly piping midi date to the
respective /dev/snd/midixxxx always works(i hear a tune on the external
keyboard).
whats the problem here ?


_______________________________________________
Alsa-devel mailing list
Alsa-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/alsa-devel

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2002-02-16 15:13 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [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
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

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.