Re: [LAD] send midi message

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: <davers@...>
Cc: <linux-audio-dev@...>
Date: Friday, January 6, 2012 - 10:22 am

On Friday 06 January 2012, you wrote:

The functions are: snd_seq_query_next_client() and snd_seq_query_next_port();
you need to loop calling these functions while they return a correct answer.
For instance, this is the relevant code in "aconnect.c" :

static void do_search_port(snd_seq_t *seq, int perm, action_func_t do_action)
{
snd_seq_client_info_t *cinfo;
snd_seq_port_info_t *pinfo;
int count;

snd_seq_client_info_alloca(&cinfo);
snd_seq_port_info_alloca(&pinfo);
snd_seq_client_info_set_client(cinfo, -1);
while (snd_seq_query_next_client(seq, cinfo) >= 0) {
/* reset query info */
snd_seq_port_info_set_client(pinfo,
snd_seq_client_info_get_client(cinfo));
snd_seq_port_info_set_port(pinfo, -1);
count = 0;
while (snd_seq_query_next_port(seq, pinfo) >= 0) {
if (check_permission(pinfo, perm)) {
do_action(seq, cinfo, pinfo, count);
count++;
}
}
}
}

See:
http://git.alsa-project.org/?p=alsa-utils.git;a=blob;f=seq/aconnect/acon...
I guess you already know the reference documentation site:
http://www.alsa-project.org/alsa-doc/alsa-lib/seq.html

Just for comparison, a similar enumeration using Drumstick looks like this:

QListIterator it(m_Client->getAvailableOutputs());
while(it.hasNext()) {
PortInfo p = it.next();
cout << p.getClientName() << ":" << p.getPort();
}

See Drumstick's example "drumgrid":
http://drumstick.sourceforge.net/docs/drumgrid.cpp-example.html

Regards,
Pedro
_______________________________________________
Linux-audio-dev mailing list
Linux-audio-dev@lists.linuxaudio.org
http://lists.linuxaudio.org/listinfo/linux-audio-dev

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
Re: [LAD] send midi message, Pedro Lopez-Cabanillas, (Fri Jan 6, 10:22 am)
Re: [LAD] send midi message, Dave Stikkolorum, (Fri Jan 6, 10:37 am)
Re: [LAD] send midi message, Dan Muresan, (Fri Jan 6, 11:07 am)
Re: [LAD] send midi message, Pedro Lopez-Cabanillas, (Sat Jan 7, 10:56 am)
Re: [LAD] send midi message, Dan Muresan, (Sat Jan 7, 10:13 pm)
Re: [LAD] send midi message, Pedro Lopez-Cabanillas, (Sun Jan 8, 11:15 am)
Re: [LAD] send midi message, Paul Davis, (Sun Jan 8, 3:28 pm)
Re: [LAD] send midi message, Paul Davis, (Sat Jan 7, 11:31 pm)
Re: [LAD] send midi message, Dave Stikkolorum, (Sun Jan 8, 10:48 am)
Re: [LAD] send midi message, Dave Stikkolorum, (Sat Jan 7, 11:06 am)
Re: [LAD] send midi message, thijs van severen, (Sat Jan 7, 9:35 pm)
Re: [LAD] send midi message, Ralf Mardorf, (Thu May 16, 2:10 pm)
[LAD] UIs (was Re: send midi message), Julien Claassen, (Thu May 16, 2:57 pm)
Re: [LAD] UIs (was Re: send midi message), Ralf Mardorf, (Fri May 17, 6:58 am)
Re: [LAD] UIs (was Re: send midi message), hermann meyer, (Fri May 17, 11:16 am)
Re: [LAD] UIs (was Re: send midi message), Ralf Mardorf, (Fri May 17, 11:40 am)
Re: [LAD] UIs (was Re: send midi message), hermann meyer, (Fri May 17, 11:56 am)
Re: [LAD] UIs theming problem (was Re: UIs), Nikita Zlobin, (Fri May 17, 9:38 am)
Re: [LAD] UIs theming problem (was Re: UIs), Paul Davis, (Fri May 17, 10:32 am)
Re: [LAD] send midi message, Dave Stikkolorum, (Fri Jan 6, 11:19 am)
Re: [LAD] send midi message, Dan Muresan, (Fri Jan 6, 11:33 am)
Re: [LAD] send midi message, thijs van severen, (Fri Jan 6, 10:05 pm)
Re: [LAD] send midi message, m.wolkstein@gmx.de, (Fri Jan 6, 10:21 pm)
Re: [LAD] send midi message, Dan Muresan, (Sat Jan 7, 7:59 am)
Re: [LAD] send midi message, Dave Stikkolorum, (Sat Jan 7, 11:04 am)
Re: [LAD] send midi message, Dave Stikkolorum, (Fri Jan 6, 12:14 pm)
Re: [LAD] send midi message, Paul Davis, (Fri Jan 6, 12:22 pm)
Re: [LAD] send midi message, Dave Stikkolorum, (Fri Jan 6, 12:32 pm)
Re: [LAD] send midi message, Tim E. Real, (Fri Jan 6, 8:59 pm)
Re: [LAD] send midi message, Dave Phillips, (Fri Jan 6, 12:40 pm)
Re: [LAD] send midi message, Dave Stikkolorum, (Fri Jan 6, 12:54 pm)
Re: [LAD] send midi message, Paul Davis, (Fri Jan 6, 1:02 pm)