From 682a6b50b728b667cbf282b2d412fb2b7fa3fd4c Mon Sep 17 00:00:00 2001 From: sletz Date: Fri, 28 Mar 2008 14:42:44 +0000 Subject: [PATCH] Add an Init method for blocking drivers to be decorated using JackThreadedDriver class. git-svn-id: http://subversion.jackaudio.org/jack/jack2/trunk/jackmp@2098 0c269be4-1314-0410-8aa9-9f06e86f4224 --- ChangeLog | 1 + common/JackDriver.h | 32 ++++++++++++++++++++++++++++---- common/JackThreadedDriver.cpp | 5 +++++ common/JackThreadedDriver.h | 2 +- 4 files changed, 35 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index 954d8113..0b3cce1e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -23,6 +23,7 @@ Fernando Lopez-Lezcano 2008-03-28 Stephane Letz * Correct PortRegister, port name checking must be done on server side. + * Add an Init method for blocking drivers to be decorated using JackThreadedDriver class. 2008-03-27 Stephane Letz diff --git a/common/JackDriver.h b/common/JackDriver.h index 8179e04d..e5c1031f 100644 --- a/common/JackDriver.h +++ b/common/JackDriver.h @@ -75,7 +75,7 @@ class EXPORT JackDriverInterface virtual int SetSampleRate(jack_nframes_t sample_rate) = 0; virtual int Process() = 0; - + virtual void SetMaster(bool onoff) = 0; virtual bool GetMaster() = 0; virtual void AddSlave(JackDriverInterface* slave) = 0; @@ -85,19 +85,38 @@ class EXPORT JackDriverInterface virtual bool IsRealTime() = 0; }; +/* +\brief The base interface for blocking drivers. +*/ + +class EXPORT JackBlockingInterface +{ + + public: + + JackBlockingInterface() + {} + virtual ~JackBlockingInterface() + {} + + virtual bool Init() = 0; /* To be called by the wrapping thread Init method when the driver is a "blocking" one */ + +}; + /*! \brief The base interface for drivers clients. */ class EXPORT JackDriverClientInterface : public JackDriverInterface, public JackClientInterface - {}; +{}; /*! \brief The base class for drivers clients. */ -class EXPORT JackDriverClient : public JackDriverClientInterface +class EXPORT JackDriverClient : public JackDriverClientInterface, public JackBlockingInterface { + private: std::list fSlaveList; @@ -208,7 +227,12 @@ class EXPORT JackDriver : public JackDriverClient int ClientNotify(int refnum, const char* name, int notify, int sync, int value1, int value2); void SetupDriverSync(int ref, bool freewheel); - + + virtual bool Init() + { + return true; + } + }; } // end of namespace diff --git a/common/JackThreadedDriver.cpp b/common/JackThreadedDriver.cpp index b2bcd00a..8f58c19e 100644 --- a/common/JackThreadedDriver.cpp +++ b/common/JackThreadedDriver.cpp @@ -89,4 +89,9 @@ bool JackThreadedDriver::Execute() return (Process() == 0); } +bool JackThreadedDriver::Init() +{ + return fDriver->Init(); +} + } // end of namespace diff --git a/common/JackThreadedDriver.h b/common/JackThreadedDriver.h index c4cf2473..94891bdb 100644 --- a/common/JackThreadedDriver.h +++ b/common/JackThreadedDriver.h @@ -143,8 +143,8 @@ class JackThreadedDriver : public JackDriverClientInterface, public JackRunnable } // JackRunnableInterface interface - virtual bool Execute(); + virtual bool Init(); };