Browse Source

Add TimeCallback in JackDebugClient class.

git-svn-id: http://subversion.jackaudio.org/jack/jack2/trunk/jackmp@1886 0c269be4-1314-0410-8aa9-9f06e86f4224
tags/0.71
sletz 17 years ago
parent
commit
47cac76eef
3 changed files with 27 additions and 11 deletions
  1. +2
    -1
      common/JackClient.h
  2. +17
    -1
      common/JackDebugClient.cpp
  3. +8
    -9
      common/JackDebugClient.h

+ 2
- 1
common/JackClient.h View File

@@ -50,7 +50,8 @@ typedef void (*JackShutdownCallback)(void *arg);


class JackClient : public JackClientInterface, public JackRunnableInterface class JackClient : public JackClientInterface, public JackRunnableInterface
{ {

friend class JackDebugClient;
protected: protected:


JackProcessCallback fProcess; JackProcessCallback fProcess;


+ 17
- 1
common/JackDebugClient.cpp View File

@@ -18,7 +18,9 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/ */


#include "JackDebugClient.h" #include "JackDebugClient.h"
#include "JackEngineControl.h"
#include "JackError.h" #include "JackError.h"
#include "JackTime.h"
#include <iostream> #include <iostream>
#include <iomanip> #include <iomanip>
#include <sstream> #include <sstream>
@@ -438,10 +440,24 @@ void JackDebugClient::OnShutdown(JackShutdownCallback callback, void *arg)
fClient->OnShutdown(callback, arg); fClient->OnShutdown(callback, arg);
} }


int JackDebugClient::TimeCallback(jack_nframes_t nframes, void *arg)
{
JackDebugClient* client = (JackDebugClient*)arg;
jack_time_t t1 = GetMicroSeconds();
int res = client->fProcessTimeCallback(nframes, client->fProcessTimeCallbackArg);
jack_time_t t2 = GetMicroSeconds();
long delta = long((t2 - t1) - client->GetEngineControl()->fPeriodUsecs);
if (delta > 0)
*client->fStream << "!!! ERROR !!! : XRun of " << delta << " us" << endl;
return res;
}

int JackDebugClient::SetProcessCallback(JackProcessCallback callback, void *arg) int JackDebugClient::SetProcessCallback(JackProcessCallback callback, void *arg)
{ {
CheckClient(); CheckClient();
return fClient->SetProcessCallback(callback, arg);
fProcessTimeCallback = callback;
fProcessTimeCallbackArg = arg;
return fClient->SetProcessCallback(TimeCallback, this);
} }


int JackDebugClient::SetXRunCallback(JackXRunCallback callback, void *arg) int JackDebugClient::SetXRunCallback(JackXRunCallback callback, void *arg)


+ 8
- 9
common/JackDebugClient.h View File

@@ -45,23 +45,22 @@ PortFollower;
/*! /*!
\brief A "decorator" debug client to validate API use. \brief A "decorator" debug client to validate API use.
*/ */
class JackDebugClient : public JackClient class JackDebugClient : public JackClient
{ {
private:

JackClient* fClient;
std::ofstream* fStream;

protected: protected:
PortFollower fPortList[MAX_PORT_HISTORY]; // Arbitrary value... To be tuned...
JackClient* fClient;
std::ofstream* fStream;
PortFollower fPortList[MAX_PORT_HISTORY]; // Arbitrary value... To be tuned...
int fTotalPortNumber; // The total number of port opened and maybe closed. Historical view. int fTotalPortNumber; // The total number of port opened and maybe closed. Historical view.
int fOpenPortNumber; // The current number of opened port. int fOpenPortNumber; // The current number of opened port.
int fIsActivated; int fIsActivated;
int fIsDeactivated; int fIsDeactivated;
int fIsClosed; int fIsClosed;
char fClientName[JACK_CLIENT_NAME_SIZE]; char fClientName[JACK_CLIENT_NAME_SIZE];
JackProcessCallback fProcessTimeCallback;
void* fProcessTimeCallbackArg;


public: public:


@@ -131,9 +130,9 @@ class JackDebugClient : public JackClient
jack_nframes_t Wait(int status); jack_nframes_t Wait(int status);
JackClientControl* GetClientControl() const; JackClientControl* GetClientControl() const;
void CheckClient() const; void CheckClient() const;

static int JackDebugClient::TimeCallback(jack_nframes_t nframes, void *arg);
}; };






Loading…
Cancel
Save