[linux-audio-dev] Aeolus and OSC - comments requested
Pieter Palmers
pieterp at joow.be
Thu May 12 21:21:28 UTC 2005
Dave Robillard wrote:
>On Thu, 2005-12-05 at 17:54 +0200, stefan kersten wrote:
>
>>On Thu, May 12, 2005 at 05:22:43PM +0200, Alfons Adriaensen wrote:
>>
>>>One thing I forgot to mention regarding /addclient : the response
>>>to this will include a client ID (integer) that is a required
>>>parameter to all polled requests for information, such as e.g.
>>>the list of stops. This ID identifies the client on the common
>>>server socket (I see no other way to do this with a single socket).
>>>
>>i might be missing something, but why don't you use the
>>client network address as a unique identifier? you can use
>>recvfrom(2) to extract the return address from a udp packet.
>>
>
>I allow either method in Om. Using the client address does work
>usually, but there seems to be a bug in liblo (or below) where the
>source network address is garbled, that I havn't been able to figure out
>yet... allowing the user to explicitly set the address allows working
>around this and other networking oddities.
>
I use this sort of code for request/response RPC-like IPC. In order for
this to work I did have to fix a bug in liblo-0.18, but that was about
sockets not being closed properly. I wonder if this fix would solve your
problem too. I sent the bugfix to Steve, but at that moment he'd just
released 0.18 and feared the anger of Frenando at planetccrma if he'd
release a 0.19. So I guess it's queued for the next release. In the
meantime there is a patched version up at:
http://prdownloads.sourceforge.net/freebob/liblo-0.18-pp.tar.bz2?download
Maybe you should try this one and see if it solves the problem.
As a side note: It might be worthwile to think about a generic solution
to this need for inter-process notifications and/or RPC. I see
LinuxSampler implementing a solution, I know we at freebob need it,
apparently Om does also, the question comes up regarding aeolus. I would
think that this is a natural extention because it pops up every time one
wants to control an app with multiple controllers (e.g. a separate UI
and a HW controller).
Greets,
Pieter
PS:For your reference: I added my code below. It is from the IPC handler
in the freebob deamon, but I removed all error checking and debug
statements for clarity.
<code>
int request_handler(const char *path, const char *types, lo_arg **argv,
int argc, lo_message msg, void *user_data) {
IPCHandler *handler=(IPCHandler *)user_data;
return handler->requestHandler(path, types,argv, argc, msg);
}
int
IPCHandler::requestHandler(const char *path,
const char *types,
lo_arg **argv,
int argc,
lo_message msg)
{
lo_address src=lo_message_get_source ( msg );
if(argc==1) {
if(strcasecmp(&argv[0]->s,"connection_info")==0) {
// send response
lo_send(src, "/response", "s", pConnectionInfo );
}
}
return 0;
}
FBReturnCodes IPCHandler::initialize()
{
/* start a new server */
m_serverThread = lo_server_thread_new(portnumber, ipc_error);
/* add request handler */
lo_server_thread_add_method(m_serverThread, "/freebob/request", "s",
request_handler, (void *)this);
return eFBRC_Success;
}
FBReturnCodes IPCHandler::start() {
lo_server_thread_start(m_serverThread);
return eFBRC_Success;
}
FBReturnCodes IPCHandler::stop() {
lo_server_thread_stop(m_serverThread);
return eFBRC_Success;
}
</code>
More information about the Linux-audio-dev
mailing list