Re: [linux-audio-dev] LAAGA: updates, laaga-0.2.0 tarball available

New Message Reply About this list Date view Thread view Subject view Author view Other groups

Subject: Re: [linux-audio-dev] LAAGA: updates, laaga-0.2.0 tarball available
From: Paul Davis (pbd_AT_Op.Net)
Date: Thu Jul 05 2001 - 14:43:57 EEST


>Paul, I'd suggest the following (less functions and infinite
>extensibility without any new functions):
>
>typedef int (*LaagaCallback)(laaga_client_t *client, LaagaPropertyId);
>/* To get callback arg */
>void *laaga_get_property_custom(laaga_client_t *client,
>LaagaPropertyId);
>/* To get sample rate, buffer_size, etc. */
>int laaga_get_value_integer(laaga_client_t *client, LaagaPropertyId);
>
>int laaga_set_property_callback(laaga_client_t *client, LaagaPropertyId,
>LaagaCallback);
>int laaga_set_property_custom(laaga_client_t *client, LaagaPropertyId,
>void *);
>
>No other functions (do you want a simple client API, don't you?)

I personally dislike this kind of generic API. And there is a more
fundamental problem that in order to be type-safe, there is no such
thing as a "LaagaCallback" type. This isn't a problem in C++, where
templates can help out, and in where libsigc++ already provides this
kind of thing in a more-or-less perfect way. But in C, this implies
the usual hack of passing structs with unions around in a public API,
which I find very unpleasant, *and* it leads to binary incompatibility
if the union or struct has to change. And I really dislike

   laaga_get_value_integer(...);
   laaga_get_value_float(...);
   laaga_get_value_whatever(...);

By contrast, once we establish laaga_set_foobar_callback (X, Y, Z),
then that particular function never changes, and programs that call it
remain binary compatible across library revisions. But you know what,
we had this discussion about alsa-lib and the {sw,hw}_params stuff.

I just have a very different philosophy about this kind of interface
than you do Abramo. I see simplicity and stability in explicitly
enumerating (growing) set of mutator/access functions; you see
simplicitly and stability in enumerating a (growing) set of macro
constants and providing a generic set of functions to use them with.

But I'm perfectly willing to listen to the crowd.

--p


New Message Reply About this list Date view Thread view Subject view Author view Other groups

This archive was generated by hypermail 2b28 : Thu Jul 05 2001 - 14:45:52 EEST