All of lore.kernel.org
 help / color / mirror / Atom feed
* usage of snd_seq_set_client_event_filter
@ 2012-07-08 19:41 Kaspar Bumke
  2012-07-08 19:43 ` Kaspar Bumke
  2012-07-10 20:04 ` Clemens Ladisch
  0 siblings, 2 replies; 4+ messages in thread
From: Kaspar Bumke @ 2012-07-08 19:41 UTC (permalink / raw)
  To: alsa-devel

[-- Attachment #1: Type: text/plain, Size: 678 bytes --]

Hi all,

I was trying to use snd_seq_set_client_event_filter in my application but I
can't seem to get it to work correctly.

I have attached a small test program which can be compiled with "g++ -o
test test.cpp -lasound".  My alsa-lib is at 1.0.25. It should simple print
the note number for any noteOn events.

I was under the impression that the way I have used it only noteOn events
would get through but it seems that only the first noteOn event I send it
gets through. I have been sending events using VMPK.

If I remove snd_seq_set_client_event_filter everything seems to work
(except the events aren't filtered of course).

What am I doing wrong?

All the Best,

Kaspar

[-- Attachment #2: test.cpp --]
[-- Type: text/x-c++src, Size: 578 bytes --]

#include <alsa/asoundlib.h>
#include <unistd.h>
#include <iostream>
using namespace std;

snd_seq_t * handle;

int main() 
{
	snd_seq_open(&handle, "default", SND_SEQ_OPEN_INPUT, 0);
	snd_seq_set_client_name(handle, "test");

	//snd_seq_set_client_event_filter(handle, SND_SEQ_EVENT_NOTEON);

	snd_seq_create_simple_port(handle, "in", SND_SEQ_PORT_CAP_WRITE | SND_SEQ_PORT_CAP_SUBS_WRITE, SND_SEQ_PORT_TYPE_APPLICATION); 
	while (1) {
		//sleep(1);
		snd_seq_event_t * event;
		if(snd_seq_event_input(handle, &event) >= 0)
			cout << (int)(*event).data.note.note << endl;
	}

}

[-- Attachment #3: Type: text/plain, Size: 0 bytes --]



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

* Re: usage of snd_seq_set_client_event_filter
  2012-07-08 19:41 usage of snd_seq_set_client_event_filter Kaspar Bumke
@ 2012-07-08 19:43 ` Kaspar Bumke
  2012-07-10 20:04 ` Clemens Ladisch
  1 sibling, 0 replies; 4+ messages in thread
From: Kaspar Bumke @ 2012-07-08 19:43 UTC (permalink / raw)
  To: alsa-devel

Sorry, in test.cpp, the line with snd_seq_set_client_event_filter should be
uncommented of course.

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

* Re: usage of snd_seq_set_client_event_filter
  2012-07-08 19:41 usage of snd_seq_set_client_event_filter Kaspar Bumke
  2012-07-08 19:43 ` Kaspar Bumke
@ 2012-07-10 20:04 ` Clemens Ladisch
  2012-07-10 20:16   ` Kaspar Bumke
  1 sibling, 1 reply; 4+ messages in thread
From: Clemens Ladisch @ 2012-07-10 20:04 UTC (permalink / raw)
  To: Kaspar Bumke; +Cc: alsa-devel

Kaspar Bumke wrote:
> I was trying to use snd_seq_set_client_event_filter in my application but I
> can't seem to get it to work correctly.
>
> I have attached a small test program which can be compiled with "g++ -o
> test test.cpp -lasound".  My alsa-lib is at 1.0.25. It should simple print
> the note number for any noteOn events.
>
> I was under the impression that the way I have used it only noteOn events
> would get through but it seems that only the first noteOn event I send it
> gets through. I have been sending events using VMPK.

Any filtered-out events gets rejected with an error, which gets reported
back to the sending application.  If that application does nothing to
handle the error, all further attempts to send events will get the same
error because the event being rejected is still in the output buffer.

This behaviour makes event filters pretty much useless.
Just ignore any events you don't want.


Regards,
Clemens

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

* Re: usage of snd_seq_set_client_event_filter
  2012-07-10 20:04 ` Clemens Ladisch
@ 2012-07-10 20:16   ` Kaspar Bumke
  0 siblings, 0 replies; 4+ messages in thread
From: Kaspar Bumke @ 2012-07-10 20:16 UTC (permalink / raw)
  To: Clemens Ladisch; +Cc: alsa-devel

>
> This behaviour makes event filters pretty much useless.
> Just ignore any events you don't want.


Ok, will do. Thanks for the answer!

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

end of thread, other threads:[~2012-07-10 20:16 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-07-08 19:41 usage of snd_seq_set_client_event_filter Kaspar Bumke
2012-07-08 19:43 ` Kaspar Bumke
2012-07-10 20:04 ` Clemens Ladisch
2012-07-10 20:16   ` Kaspar Bumke

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.