Abstraction for JACK control API

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Abstraction for JACK control API

Nedko Arnaudov
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


--
Nedko Arnaudov <GnuPG KeyID: DE1716B0>

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Jackit-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/jackit-devel

attachment0 (194 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Abstraction for JACK control API

Stéphane Letz

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
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Jackit-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/jackit-devel
Reply | Threaded
Open this post in threaded view
|

Re: [LAD] Abstraction for JACK control API

Nedko Arnaudov
Stéphane Letz <[hidden email]> writes:

> Could JackEngine here be renamed "JackServer"? I think It would  
> correspond more to what "engine" and "server" are internally.

Now that we are on this, please tell me what "server" and "engine" are
internally, from your point of view. I dont care that much about actual
naming as long as it is commonly accepted. For example I can recall some
ppl calling jackd process the "server".

> Then why  
> not translate that in a pure C API, something like:

I'll translate it once we agree on the API model (including naming). And
I'll at least implement the API for the trunk jack codebase.

--
Nedko Arnaudov <GnuPG KeyID: DE1716B0>

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Jackit-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/jackit-devel

attachment0 (194 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: [LAD] Abstraction for JACK control API

Stéphane Letz

Le 29 janv. 08 à 06:11, Nedko Arnaudov a écrit :

> Stéphane Letz <[hidden email]> writes:
>
>> Could JackEngine here be renamed "JackServer"? I think It would
>> correspond more to what "engine" and "server" are internally.
>
> Now that we are on this, please tell me what "server" and "engine" are
> internally, from your point of view. I dont care that much about  
> actual
> naming as long as it is commonly accepted. For example I can recall  
> some
> ppl calling jackd process the "server".

Speaking for jackdmp:

- JackEngine keep the list of clients (internal in the server and  
"external/proxy" ones)

- JackServer keeps a JackEngine object, the currently used audio  
driver, the "freewheel" driver... It is the "global" object  in the  
server process, that allocates and keeps every more internal objects.

>
>> Then why
>> not translate that in a pure C API, something like:
>
> I'll translate it once we agree on the API model (including naming).  
> And
> I'll at least implement the API for the trunk jack codebase.
>
OK

Stephane
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Jackit-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/jackit-devel
Reply | Threaded
Open this post in threaded view
|

Re: [LAD] Abstraction for JACK control API

Nedko Arnaudov

I'm attaching the plain C variant of the API. Please comment if you find
something that cannot be implemented in jack "server" code. It is not
yet fully doxygenized but things should be obvious.



--
Nedko Arnaudov <GnuPG KeyID: DE1716B0>

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Jackit-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/jackit-devel

jackctl.h (2K) Download Attachment
attachment1 (194 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: [LAD] Abstraction for JACK control API

Stéphane Letz

Le 29 janv. 08 à 19:42, Nedko Arnaudov a écrit :

>
> I'm attaching the plain C variant of the API. Please comment if you  
> find
> something that cannot be implemented in jack "server" code. It is not
> yet fully doxygenized but things should be obvious.
>
> <jackctl.h>
>

Seems ok for me. Having this clean API will allow to have jackd  
process, jackdbus or any other control application be developed  
separately, which seems a good thing.

Stephane
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Jackit-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/jackit-devel