[linux-audio-user] sending program change to alsa

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




Clemens,
> In C, this would be something like this:
> 
> snd_seq_t *seq;
> snd_seq_event_t ev;
> 
> snd_seq_open(&seq, "default", SND_SEQ_OPEN_DUPLEX, 0);
> snd_seq_set_client_name(seq, "my funky program changer");
> snd_seq_create_simple_port(seq, "source port",
> 			   SND_SEQ_PORT_CAP_READ,
> 			   SND_SEQ_PORT_TYPE_MIDI_GENERIC |
> 			   SND_SEQ_PORT_TYPE_APPLICATION);
> snd_seq_ev_clear(&ev);
> snd_seq_ev_set_dest(&ev, dest_client, dest_port);
> snd_seq_ev_set_direct(&ev);
> snd_seq_ev_set_pgmchange(&ev, channel, program);
> snd_seq_event_output_direct(seq, &ev);

I've taken your code snippet and replaced the line
    snd_seq_ev_set_dest(...)
by
    snd_seq_ev_set_broadcast(...)
expecting to see this event broadcast to any ports
that'll listen, but I'm not seeing any reception on
any input port. Isn't this the way to broadcast
events? Any pointers would be appreciated.
Best,
    Peter

PS: Here's the modified code:

#include <alsa/asoundlib.h>

int main(int argc, char **argv) {
    snd_seq_t *seq;
    snd_seq_event_t ev;

    snd_seq_open(&seq, "default", SND_SEQ_OPEN_DUPLEX, 0);
    snd_seq_set_client_name(seq, "my funky program changer");
    snd_seq_create_simple_port(seq, "source port",
                   SND_SEQ_PORT_CAP_READ,
                   SND_SEQ_PORT_TYPE_MIDI_GENERIC |
                   SND_SEQ_PORT_TYPE_APPLICATION);
    snd_seq_ev_clear(&ev);
    //snd_seq_ev_set_dest(&ev, 80, 0); 
    snd_seq_ev_set_broadcast(&ev);
    snd_seq_ev_set_direct(&ev);
    snd_seq_ev_set_pgmchange(&ev, 1, 9);
    snd_seq_event_output_direct(seq, &ev);

    return 0;
}



[Index of Archives]     [Linux Sound]     [ALSA Users]     [Pulse Audio]     [ALSA Devel]     [Sox Users]     [Linux Media]     [Kernel]     [Photo Sharing]     [Gimp]     [Yosemite News]     [Linux Media]

  Powered by Linux