[LAD] Abstraction for JACK control API

From: Nedko Arnaudov <nedko@email-addr-hidden>
Date: Sat Jan 26 2008 - 00:05:16 EET

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>

_______________________________________________
Linux-audio-dev mailing list
Linux-audio-dev@email-addr-hidden
http://lists.linuxaudio.org/mailman/listinfo/linux-audio-dev

Received on Sat Jan 26 00:15:09 2008

This archive was generated by hypermail 2.1.8 : Sat Jan 26 2008 - 00:15:10 EET