Re: [LAD] [Jackit-devel] Abstraction for JACK control API

From: Stéphane Letz <letz@email-addr-hidden>
Date: Mon Jan 28 2008 - 17:20:27 EET

Le 25 janv. 08 à 23:05, Nedko Arnaudov a écrit :

> After some discussion on IRC with Stéphane Letz, I created abstract
> description of the API that is needed to implement current jackdbus
> functionality (i.e. without the coming patchbay and transport control
> interfaces). I've decided to describe it in C++ just because it will
> be
> more clear to general public than plain C OO abstraction, or UML
> diagram. jackdbus code itself is in plain C. Hope is that such
> abstraction will help to have same D-Bus interface implemented (and
> much
> of related code - shared) for both jackd and jackdmp.
>
> // -*- Mode: C++ ; c-basic-offset: 2 -*-
> ///////////////////////////////////////////////////////////////////////////////
> //
> // DESCRIPTION:
> // Abstraction of the API needed to implement jackdbus
> //
> ///////////////////////////////////////////////////////////////////////////////
>
> #ifndef JACKSERVER_H__775F79BA_DDE0_4FEA_AC4B_7BE05638499C__INCLUDED
> #define JACKSERVER_H__775F79BA_DDE0_4FEA_AC4B_7BE05638499C__INCLUDED
>
> /** Parameter types, intentionally similar to
> jack_driver_param_type_t */
> typedef enum
> {
> JackParamInt = 1,
> JackParamUInt,
> JackParamChar,
> JackParamString,
> JackParamBool,
> } jack_param_type_t;
>
> class ImmutableString;
> class ImmutableVariant;
> template<class T> class ImmutableSet;
>
> class JackConfigurationParameter
> {
> public:
> ImmutableString& GetName() const;
> ImmutableString& GetShortDescription() const;
> ImmutableString& GetLongDescription() const;
> jack_param_type_t GetType() const;
> ImmutableVariant& GetValue() const;
> void SetValue(ImmutableVariant& value);
> };
>
> class JackConfigurationDriverParameter: public
> JackConfigurationParameter
> {
> public:
> bool IsSet() const;
> ImmutableVariant GetDefault() const;
> };
>
> class JackConfigurableObject
> {
> public:
> virtual ImmutableSet<JackConfigurationParameter>& GetParameters()
> const = 0;
>
> // helpers
> JackConfigurationParameter& FindParameter(ImmutableString&
> parameter_name);
> };
>
> class JackDriver: public JackConfigurableObject
> {
> };
>
> class JackEngine: public JackConfigurableObject
> {
> };
>
> class JackServerInterface: public JackEngine
> {
> public:
> ImmutableSet<JackDriver> GetAvailableDrivers();
>
> void StartServer(JackDriver& driver);
> // next ones are called only on started server
> void StopServer();
> double GetLoad() const; // In percent
> unsigned int GetSampleRate() const; // in Hz
> double GetLatency() const; // in milliseconds
> bool IsRealtime() const; // whether engine is running
> unsigned int GetXruns() const;
> void ResetXruns(); // reset value being returned by
> GetXruns() to 0
> };
>
> #endif // #ifndef
> JACKSERVER_H__775F79BA_DDE0_4FEA_AC4B_7BE05638499C__INCLUDED
>

Could JackEngine here be renamed "JackServer"? I think It would
correspond more to what "engine" and "server" are internally. Then why
not translate that in a pure C API, something like:

typedef void* jack_server;
typedef void* jack_driver;

int jack_start_server(jack_server* server);
int jack_stop_server(jack_server* server);

double jack_get_load(jack_server* server);
unsigned int jack_get_sample_rate(jack_server* server);
double jack_get_latency(jack_server* server);
int jack_is_realtime(jack_server* server);
int jack_get_xruns(jack_server* server);
void jack_reset_xruns(jack_server* server);

int jack_get_drivers_num(jack_server* server);
jack_driver* jack_get_driver(jack_server* server, int driver_index);

.... and so on....

Stephane
_______________________________________________
Linux-audio-dev mailing list
Linux-audio-dev@email-addr-hidden
http://lists.linuxaudio.org/mailman/listinfo/linux-audio-dev
Received on Mon Jan 28 20:15:13 2008

This archive was generated by hypermail 2.1.8 : Mon Jan 28 2008 - 20:15:13 EET