Skip to contentSkip to conversation

sequencer filter client

DISCUSSION Garett Shulman 2 participants 3 messages Jan 23, 2004 – Jan 27, 2004

lore
Share & tools
lore
#0 lore raw

Hello, I am trying to create a very simple midi filter client for the alsa sequencer based on aseqview-0.1.4. I have alsa 0.9.8. This code shows the input and the output port in aconnect when executed. And, when the raw_midi client is connected The callback does get called when I play keys on my piano. However, Its as though the message is getting sent back to this client and not on to the next client. The process_event function keeps getting called over and over again with the same message when I hit one piano key. It's as though it is sending itself the message. Any Ideas are greatly appreciated. -Garett

#include "portlib.h"

int process_event(port_t *p, int type, snd_seq_event_t *ev, int *priate_data) {
port_write_event(p, ev, 0);
}

int main()
{
unsigned int caps = SND_SEQ_PORT_CAP_WRITE |
SND_SEQ_PORT_CAP_SUBS_WRITE | SND_SEQ_PORT_CAP_READ | SND_SEQ_PORT_CAP_SUBS_READ;

port_client_t *client = port_client_new("MIDI filter",
SND_SEQ_OPEN_DUPLEX);
port_t *port = port_attach(client, "FILTER port", caps,

SND_SEQ_PORT_TYPE_MIDI_GENERIC);
       int *priv_data;

       /* add callback */
       port_add_callback(port, PORT_MIDI_EVENT_CB, 

(port_callback_t)process_event, priv_data);

       port_client_do_loop(client);

       return port_detach(port);
}

-------------------------------------------------------
The SF.Net email is sponsored by EclipseCon 2004 Premiere Conference on Open Tools Development and Integration See the breadth of Eclipse activity. February 3-5 in Anaheim, CA.
http://www.eclipsecon.org/osdn

#1 lore raw
Quoted 11 lines · Garett Shulman

Hello, I am trying to create a very simple midi filter client for the alsa sequencer based on aseqview-0.1.4. I have alsa 0.9.8. This code shows the input and the output port in aconnect when executed. And, when the raw_midi client is connected The callback does get called when I play keys on my piano. However, Its as though the message is getting sent back to this client and not on to the next client.

int process_event(port_t *p, int type, snd_seq_event_t *ev, int *priate_data)

{
    port_write_event(p, ev, 0);
}

The event will be sent to the destination as specified in ev->dest. For events you have just received, the destination is your own client/port.

Call snd_seq_ev_set_source(ev, ?) to set your source port, and call snd_seq_ev_set_subs(ev) to specify that the event is to be sent to all ports subscribed to your port.

HTH
Clemens

-------------------------------------------------------
The SF.Net email is sponsored by EclipseCon 2004 Premiere Conference on Open Tools Development and Integration See the breadth of Eclipse activity. February 3-5 in Anaheim, CA.
http://www.eclipsecon.org/osdn

#2 lore raw
Quoted 21 lines · Clemens Ladisch
Quoted 7 lines · Garett Shulman

Hello, I am trying to create a very simple midi filter client for the alsa sequencer based on aseqview-0.1.4. I have alsa 0.9.8. This code shows the input and the output port in aconnect when executed. And, when the raw_midi client is connected The callback does get called when I play keys on my piano. However, Its as though the message is getting sent back to this client and not on to the next client.

Quoted 6 lines

int process_event(port_t *p, int type, snd_seq_event_t *ev, int *priate_data)

{
   port_write_event(p, ev, 0);
}

The event will be sent to the destination as specified in ev->dest. For events you have just received, the destination is your own client/port.

Quoted 10 lines

Call snd_seq_ev_set_source(ev, ?) to set your source port, and call snd_seq_ev_set_subs(ev) to specify that the event is to be sent to all ports subscribed to your port.

HTH
Clemens

This does help. Thank you. -Garett

-------------------------------------------------------
The SF.Net email is sponsored by EclipseCon 2004 Premiere Conference on Open Tools Development and Integration See the breadth of Eclipse activity. February 3-5 in Anaheim, CA.
http://www.eclipsecon.org/osdn