* Direct Delivery of NoteOn events
@ 2006-10-23 19:58 paul santa clara
2006-10-24 8:00 ` Clemens Ladisch
0 siblings, 1 reply; 7+ messages in thread
From: paul santa clara @ 2006-10-23 19:58 UTC (permalink / raw)
To: alsa-devel
[-- Attachment #1.1: Type: text/plain, Size: 1205 bytes --]
Hi everyone,
I am having difficulty getting alsa to actually delivery a noteon
event for me. I am came across a list posting from 2004 which
claimed that Queue's were necessary for NoteOn's to allow alsa to
schedule the concomitant Noteoff at the appropriate time.
Nevertheless, i can find nothing in the documentation which
collaborates this. Still, i did attempt to use to a Q but was unable
to produce any results. Here is the offending code:
snd_seq_ev_clear( &event );
snd_seq_ev_set_source( &event, our_parcel->out_port );
snd_seq_ev_set_subs( &event ); //subscription was graphically
verified with Qjack
snd_seq_ev_set_direct( &event );
snd_seq_ev_schedule_tick( &event, queue, 0, 4 );
snd_seq_ev_set_note( &event, 1, 67, 127, 8 );
//Queue stuff
snd_seq_queue_tempo_t *tempo;
int queue = snd_seq_alloc_queue( our_parcel->seq );
snd_seq_queue_tempo_alloca( &tempo );
snd_seq_queue_tempo_set_tempo( tempo, 100000);
snd_seq_queue_tempo_set_ppq( tempo,64 );
snd_seq_set_queue_tempo( our_parcel->seq, queue, tempo );
snd_seq_start_queue( our_parcel->seq, queue, NULL );
snd_seq_drain_output( our_parcel->seq );
Any help would be much appreciated.
thanks in advance,
-paul
[-- Attachment #1.2: Type: text/html, Size: 9397 bytes --]
[-- Attachment #2: Type: text/plain, Size: 373 bytes --]
-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
[-- Attachment #3: Type: text/plain, Size: 161 bytes --]
_______________________________________________
Alsa-devel mailing list
Alsa-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/alsa-devel
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Direct Delivery of NoteOn events
2006-10-23 19:58 Direct Delivery of NoteOn events paul santa clara
@ 2006-10-24 8:00 ` Clemens Ladisch
[not found] ` <99C795AE-FCD2-4E95-ABE0-145AA81EFB58@comcast.net>
0 siblings, 1 reply; 7+ messages in thread
From: Clemens Ladisch @ 2006-10-24 8:00 UTC (permalink / raw)
To: paul santa clara, alsa-devel
paul santa clara wrote:
> I am having difficulty getting alsa to actually delivery a noteon
> event for me. I am came across a list posting from 2004 which
> claimed that Queue's were necessary for NoteOn's to allow alsa to
> schedule the concomitant Noteoff at the appropriate time.
This applies only to note events, not to note on events.
Note events are split into a note on and a note off event.
> Nevertheless, i can find nothing in the documentation which
> collaborates this.
Well, there is no documentation ...
> Still, i did attempt to use to a Q but was unable
> to produce any results. Here is the offending code:
> ...
> snd_seq_ev_set_direct( &event );
You shouldn't use this when using a queue. (However, the following
call to snd_seq_ev_schedule_tick() will correct this.)
> int queue = snd_seq_alloc_queue( our_parcel->seq );
You must create the queue before you try to send events through it.
HTH
Clemens
-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Direct Delivery of NoteOn events
@ 2006-10-24 22:24 paul santa clara
0 siblings, 0 replies; 7+ messages in thread
From: paul santa clara @ 2006-10-24 22:24 UTC (permalink / raw)
To: alsa-devel
[-- Attachment #1.1: Type: text/plain, Size: 1661 bytes --]
Hi Clemens!
This applies only to note events, not to note on events.
Note events are split into a note on and a note off event.
Gotcha. That is what I meant. :)
int queue = snd_seq_alloc_queue( our_parcel->seq );
You must create the queue before you try to send events through it.
I attempted this which still does not work correctly. >>> indicates
changes.
//Queue
snd_seq_queue_tempo_t *tempo;
>>> int queue = snd_seq_alloc_named_queue( our_parcel->seq, "Q1" );
snd_seq_queue_tempo_alloca( &tempo );
snd_seq_queue_tempo_set_tempo( tempo, 1000000);
snd_seq_queue_tempo_set_ppq( tempo, 48 );
snd_seq_set_queue_tempo( our_parcel->seq, queue, tempo );
>>> snd_seq_start_queue( our_parcel->seq, queue, NULL );
snd_seq_ev_clear( &event );
snd_seq_ev_set_source( &event, our_parcel->out_port );
//snd_seq_ev_set_subs( &event );
snd_seq_ev_set_dest( &event, dest.client, dest.port );
snd_seq_ev_schedule_tick( &event, queue, 0, 20000 );
snd_seq_ev_set_note( &event, 1, 67, 127, 800 );
Note, that above I have tried both using subscriptions and directly
sending to the destination port. Neither works correctly when i am
sending the alsa event to another process, but snd_seq_ev_set_dest()
does work when sending to another port in the SAME process/client. I
verified this using another thread listening on the 2nd port. Pretty
odd. Finally, I output the event and drain the output...
>>>snd_seq_event_output( our_parcel->seq, &event );
snd_seq_drain_output( our_parcel->seq );
I've read thru a couple of small programs now which seem to do just
this but actually work. Any idea what i am missing?
thanks a bunch ,
-paul
[-- Attachment #1.2: Type: text/html, Size: 12198 bytes --]
[-- Attachment #2: Type: text/plain, Size: 373 bytes --]
-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
[-- Attachment #3: Type: text/plain, Size: 161 bytes --]
_______________________________________________
Alsa-devel mailing list
Alsa-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/alsa-devel
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Direct Delivery of NoteOn events
[not found] ` <99C795AE-FCD2-4E95-ABE0-145AA81EFB58@comcast.net>
@ 2006-10-25 8:25 ` Clemens Ladisch
2006-10-25 23:56 ` paul santa clara
0 siblings, 1 reply; 7+ messages in thread
From: Clemens Ladisch @ 2006-10-25 8:25 UTC (permalink / raw)
To: paul santa clara; +Cc: alsa-devel
paul santa clara wrote:
> ...
> Note, that above I have tried both using subscriptions and directly
> sending to the destination port. Neither works correctly when i am
> sending the alsa event to another process, but snd_seq_ev_set_dest()
> does work when sending to another port in the SAME process/client. I
> verified this using another thread listening on the 2nd port. Pretty
> odd. Finally, I output the event and drain the output...
>
> >>>snd_seq_event_output( our_parcel->seq, &event );
> snd_seq_drain_output( our_parcel->seq );
What is your program doing after this call? If you don't wait until the
event has been delivered, the queue with the events still in it will be
destroyed.
HTH
Clemens
-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Direct Delivery of NoteOn events
2006-10-25 8:25 ` Clemens Ladisch
@ 2006-10-25 23:56 ` paul santa clara
2006-10-26 7:23 ` Clemens Ladisch
0 siblings, 1 reply; 7+ messages in thread
From: paul santa clara @ 2006-10-25 23:56 UTC (permalink / raw)
To: Clemens Ladisch; +Cc: alsa-devel
[-- Attachment #1.1: Type: text/plain, Size: 752 bytes --]
On Oct 25, 2006, at 4:25 AM, Clemens Ladisch wrote:
>
> What is your program doing after this call?
The function enters into an infinite while{} which bombards alsa with
events. No relevant variables go out of scope.
int i=1;
while (1) {
event.data.note.note = i;
snd_seq_event_output( our_parcel->seq, &event );
snd_seq_drain_output( our_parcel->seq );
printf("sleep\n");
sleep(1);
i++;
if (i > 127)
i = 1;
}
> If you don't wait until the
> event has been delivered, the queue with the events still in it
> will be
> destroyed.
Hmmm...I'm not sure you what you mean here. Is there a function i
can call to block the thread until ALSA has delivered the events?
How exactly is the Queue destroyed?
thanks,
-paul santa clara
[-- Attachment #1.2: Type: text/html, Size: 6050 bytes --]
[-- Attachment #2: Type: text/plain, Size: 373 bytes --]
-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
[-- Attachment #3: Type: text/plain, Size: 161 bytes --]
_______________________________________________
Alsa-devel mailing list
Alsa-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/alsa-devel
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Direct Delivery of NoteOn events
2006-10-25 23:56 ` paul santa clara
@ 2006-10-26 7:23 ` Clemens Ladisch
2006-10-26 19:26 ` paul santa clara
0 siblings, 1 reply; 7+ messages in thread
From: Clemens Ladisch @ 2006-10-26 7:23 UTC (permalink / raw)
To: paul santa clara; +Cc: alsa-devel
paul santa clara wrote:
> On Oct 25, 2006, at 4:25 AM, Clemens Ladisch wrote:
> > What is your program doing after this call?
>
> The function enters into an infinite while{} which bombards alsa with
> events.
Should be OK.
> > If you don't wait until the event has been delivered, the queue
> > with the events still in it will be destroyed.
>
> Hmmm...I'm not sure you what you mean here.
When the program exits, all resources are cleaned up.
> Is there a function i can call to block the thread until ALSA has
> delivered the events?
snd_seq_sync_output_queue(), but this doesn't seem to be your problem.
Please check whether any of the ALSA functions returns an error code.
What gets output when you play to an instance of aseqdump?
Regards,
Clemens
-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Direct Delivery of NoteOn events
2006-10-26 7:23 ` Clemens Ladisch
@ 2006-10-26 19:26 ` paul santa clara
0 siblings, 0 replies; 7+ messages in thread
From: paul santa clara @ 2006-10-26 19:26 UTC (permalink / raw)
To: Clemens Ladisch; +Cc: alsa-devel
Dearest Clemens,
Thank you so much for your help. After I checked the results of
each and every alsa function + macro, i discovered that the source
field of the event was not being set properly. It turns out that
snd_seq_create_simple_port was returning 0 for both calls. As a work
around, i simply scanned for the ports and used that id in
snd_seq_port_subscribe_set_source. I assume this is a bug? Just out
of curiosity, i attempted to switch over to snd_seq_create_port but
gcc was unable to determine the size of the snd_seq_port_info_t
struct. The headers reveal it to be a typedef of _snd_seq_port_info
but the trail ended there.
best regards and thanks again. :)
-paul santa clara
-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2006-10-26 19:26 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-10-23 19:58 Direct Delivery of NoteOn events paul santa clara
2006-10-24 8:00 ` Clemens Ladisch
[not found] ` <99C795AE-FCD2-4E95-ABE0-145AA81EFB58@comcast.net>
2006-10-25 8:25 ` Clemens Ladisch
2006-10-25 23:56 ` paul santa clara
2006-10-26 7:23 ` Clemens Ladisch
2006-10-26 19:26 ` paul santa clara
-- strict thread matches above, loose matches on Subject: below --
2006-10-24 22:24 paul santa clara
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.