Browse Source

Embed JackEngineControl in JackDriver (starting from Tim Blechmann idea).

git-svn-id: http://subversion.jackaudio.org/jack/jack2/trunk/jackmp@2538 0c269be4-1314-0410-8aa9-9f06e86f4224
tags/1.90
sletz 17 years ago
parent
commit
8f3e986c02
13 changed files with 92 additions and 84 deletions
  1. +4
    -0
      ChangeLog
  2. +15
    -16
      common/JackAudioDriver.cpp
  3. +17
    -19
      common/JackDriver.cpp
  4. +2
    -2
      common/JackDriver.h
  5. +1
    -0
      common/JackDriverLoader.cpp
  6. +10
    -4
      common/JackDriverLoader.h
  7. +4
    -4
      common/JackFreewheelDriver.cpp
  8. +2
    -2
      common/JackLoopbackDriver.cpp
  9. +12
    -12
      common/JackNetDriver.cpp
  10. +8
    -8
      linux/alsa/JackAlsaDriver.cpp
  11. +8
    -8
      linux/firewire/JackFFADODriver.cpp
  12. +4
    -4
      linux/freebob/JackFreebobDriver.cpp
  13. +5
    -5
      macosx/JackCoreAudioDriver.cpp

+ 4
- 0
ChangeLog View File

@@ -21,6 +21,10 @@ Romain Moret
Jackdmp changes log Jackdmp changes log
--------------------------- ---------------------------


2008-06-19 Stephane Letz <letz@grame.fr>

* Embed JackEngineControl in JackDriver (starting from Tim Blechmann idea).

2008-06-18 Stephane Letz <letz@grame.fr> 2008-06-18 Stephane Letz <letz@grame.fr>


* On OSX waf now compiles Universal Binaries. * On OSX waf now compiles Universal Binaries.


+ 15
- 16
common/JackAudioDriver.cpp View File

@@ -1,6 +1,6 @@
/* /*
Copyright (C) 2001 Paul Davis Copyright (C) 2001 Paul Davis
Copyright (C) 2004-2008 Grame
Copyright (C) 2004-2008 GramefClientControl.


This program is free software; you can redistribute it and/or modify This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
@@ -30,7 +30,6 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#include "JackTime.h" #include "JackTime.h"
#include "JackError.h" #include "JackError.h"
#include "JackEngineControl.h" #include "JackEngineControl.h"
#include "JackClientControl.h"
#include "JackPort.h" #include "JackPort.h"
#include "JackGraphManager.h" #include "JackGraphManager.h"
#include "JackLockedEngine.h" #include "JackLockedEngine.h"
@@ -100,8 +99,8 @@ int JackAudioDriver::Attach()


for (i = 0; i < fCaptureChannels; i++) { for (i = 0; i < fCaptureChannels; i++) {
snprintf(alias, sizeof(alias) - 1, "%s:%s:out%d", fAliasName, fCaptureDriverName, i + 1); snprintf(alias, sizeof(alias) - 1, "%s:%s:out%d", fAliasName, fCaptureDriverName, i + 1);
snprintf(name, sizeof(name) - 1, "%s:capture_%d", fClientControl->fName, i + 1);
if ((port_index = fGraphManager->AllocatePort(fClientControl->fRefNum, name, JACK_DEFAULT_AUDIO_TYPE, (JackPortFlags)port_flags, fEngineControl->fBufferSize)) == NO_PORT) {
snprintf(name, sizeof(name) - 1, "%s:capture_%d", fClientControl.fName, i + 1);
if ((port_index = fGraphManager->AllocatePort(fClientControl.fRefNum, name, JACK_DEFAULT_AUDIO_TYPE, (JackPortFlags)port_flags, fEngineControl->fBufferSize)) == NO_PORT) {
jack_error("driver: cannot register port for %s", name); jack_error("driver: cannot register port for %s", name);
return -1; return -1;
} }
@@ -116,8 +115,8 @@ int JackAudioDriver::Attach()


for (i = 0; i < fPlaybackChannels; i++) { for (i = 0; i < fPlaybackChannels; i++) {
snprintf(alias, sizeof(alias) - 1, "%s:%s:in%d", fAliasName, fPlaybackDriverName, i + 1); snprintf(alias, sizeof(alias) - 1, "%s:%s:in%d", fAliasName, fPlaybackDriverName, i + 1);
snprintf(name, sizeof(name) - 1, "%s:playback_%d", fClientControl->fName, i + 1);
if ((port_index = fGraphManager->AllocatePort(fClientControl->fRefNum, name, JACK_DEFAULT_AUDIO_TYPE, (JackPortFlags)port_flags, fEngineControl->fBufferSize)) == NO_PORT) {
snprintf(name, sizeof(name) - 1, "%s:playback_%d", fClientControl.fName, i + 1);
if ((port_index = fGraphManager->AllocatePort(fClientControl.fRefNum, name, JACK_DEFAULT_AUDIO_TYPE, (JackPortFlags)port_flags, fEngineControl->fBufferSize)) == NO_PORT) {
jack_error("driver: cannot register port for %s", name); jack_error("driver: cannot register port for %s", name);
return -1; return -1;
} }
@@ -132,7 +131,7 @@ int JackAudioDriver::Attach()
if (fWithMonitorPorts) { if (fWithMonitorPorts) {
jack_log("Create monitor port "); jack_log("Create monitor port ");
snprintf(name, sizeof(name) - 1, "%s:%s:monitor_%u", fAliasName, fPlaybackDriverName, i + 1); snprintf(name, sizeof(name) - 1, "%s:%s:monitor_%u", fAliasName, fPlaybackDriverName, i + 1);
if ((port_index = fGraphManager->AllocatePort(fClientControl->fRefNum, name, JACK_DEFAULT_AUDIO_TYPE, JackPortIsOutput, fEngineControl->fBufferSize)) == NO_PORT) {
if ((port_index = fGraphManager->AllocatePort(fClientControl.fRefNum, name, JACK_DEFAULT_AUDIO_TYPE, JackPortIsOutput, fEngineControl->fBufferSize)) == NO_PORT) {
jack_error("Cannot register monitor port for %s", name); jack_error("Cannot register monitor port for %s", name);
return -1; return -1;
} else { } else {
@@ -152,13 +151,13 @@ int JackAudioDriver::Detach()
jack_log("JackAudioDriver::Detach"); jack_log("JackAudioDriver::Detach");


for (i = 0; i < fCaptureChannels; i++) { for (i = 0; i < fCaptureChannels; i++) {
fGraphManager->ReleasePort(fClientControl->fRefNum, fCapturePortList[i]);
fGraphManager->ReleasePort(fClientControl.fRefNum, fCapturePortList[i]);
} }


for (i = 0; i < fPlaybackChannels; i++) { for (i = 0; i < fPlaybackChannels; i++) {
fGraphManager->ReleasePort(fClientControl->fRefNum, fPlaybackPortList[i]);
fGraphManager->ReleasePort(fClientControl.fRefNum, fPlaybackPortList[i]);
if (fWithMonitorPorts) if (fWithMonitorPorts)
fGraphManager->ReleasePort(fClientControl->fRefNum, fMonitorPortList[i]);
fGraphManager->ReleasePort(fClientControl.fRefNum, fMonitorPortList[i]);
} }


return 0; return 0;
@@ -191,7 +190,7 @@ int JackAudioDriver::ProcessNull()
// fBeginDateUst is set in the "low level" layer, fEndDateUst is from previous cycle // fBeginDateUst is set in the "low level" layer, fEndDateUst is from previous cycle
if (!fEngine->Process(fBeginDateUst, fEndDateUst)) if (!fEngine->Process(fBeginDateUst, fEndDateUst))
jack_error("JackAudioDriver::ProcessNull Process error"); jack_error("JackAudioDriver::ProcessNull Process error");
fGraphManager->ResumeRefNum(fClientControl, fSynchroTable);
fGraphManager->ResumeRefNum(&fClientControl, fSynchroTable);
if (ProcessSlaves() < 0) if (ProcessSlaves() < 0)
jack_error("JackAudioDriver::ProcessNull ProcessSlaves error"); jack_error("JackAudioDriver::ProcessNull ProcessSlaves error");
@@ -228,11 +227,11 @@ int JackAudioDriver::ProcessAsync()
// fBeginDateUst is set in the "low level" layer, fEndDateUst is from previous cycle // fBeginDateUst is set in the "low level" layer, fEndDateUst is from previous cycle
if (!fEngine->Process(fBeginDateUst, fEndDateUst)) if (!fEngine->Process(fBeginDateUst, fEndDateUst))
jack_error("JackAudioDriver::ProcessAsync Process error"); jack_error("JackAudioDriver::ProcessAsync Process error");
fGraphManager->ResumeRefNum(fClientControl, fSynchroTable);
fGraphManager->ResumeRefNum(&fClientControl, fSynchroTable);
if (ProcessSlaves() < 0) if (ProcessSlaves() < 0)
jack_error("JackAudioDriver::ProcessAsync ProcessSlaves error"); jack_error("JackAudioDriver::ProcessAsync ProcessSlaves error");
} else { } else {
fGraphManager->ResumeRefNum(fClientControl, fSynchroTable);
fGraphManager->ResumeRefNum(&fClientControl, fSynchroTable);
} }
// Keep end cycle time // Keep end cycle time
@@ -257,10 +256,10 @@ int JackAudioDriver::ProcessSync()


// fBeginDateUst is set in the "low level" layer, fEndDateUst is from previous cycle // fBeginDateUst is set in the "low level" layer, fEndDateUst is from previous cycle
if (fEngine->Process(fBeginDateUst, fEndDateUst)) { if (fEngine->Process(fBeginDateUst, fEndDateUst)) {
fGraphManager->ResumeRefNum(fClientControl, fSynchroTable);
fGraphManager->ResumeRefNum(&fClientControl, fSynchroTable);
if (ProcessSlaves() < 0) if (ProcessSlaves() < 0)
jack_error("JackAudioDriver::ProcessSync ProcessSlaves error, engine may now behave abnormally!!"); jack_error("JackAudioDriver::ProcessSync ProcessSlaves error, engine may now behave abnormally!!");
if (fGraphManager->SuspendRefNum(fClientControl, fSynchroTable, fEngineControl->fTimeOutUsecs) < 0)
if (fGraphManager->SuspendRefNum(&fClientControl, fSynchroTable, fEngineControl->fTimeOutUsecs) < 0)
jack_error("JackAudioDriver::ProcessSync SuspendRefNum error, engine may now behave abnormally!!"); jack_error("JackAudioDriver::ProcessSync SuspendRefNum error, engine may now behave abnormally!!");
} else { // Graph not finished: do not activate it } else { // Graph not finished: do not activate it
jack_error("ProcessSync: error"); jack_error("ProcessSync: error");
@@ -273,7 +272,7 @@ int JackAudioDriver::ProcessSync()
} }
} else { } else {
fGraphManager->ResumeRefNum(fClientControl, fSynchroTable);
fGraphManager->ResumeRefNum(&fClientControl, fSynchroTable);
} }
// Keep end cycle time // Keep end cycle time


+ 17
- 19
common/JackDriver.cpp View File

@@ -44,10 +44,10 @@ namespace Jack
{ {


JackDriver::JackDriver(const char* name, const char* alias, JackLockedEngine* engine, JackSynchro* table) JackDriver::JackDriver(const char* name, const char* alias, JackLockedEngine* engine, JackSynchro* table)
:fClientControl(name)
{ {
assert(strlen(name) < JACK_CLIENT_NAME_SIZE); assert(strlen(name) < JACK_CLIENT_NAME_SIZE);
fSynchroTable = table; fSynchroTable = table;
fClientControl = new JackClientControl(name);
strcpy(fAliasName, alias); strcpy(fAliasName, alias);
fEngine = engine; fEngine = engine;
fGraphManager = NULL; fGraphManager = NULL;
@@ -59,7 +59,6 @@ JackDriver::JackDriver(const char* name, const char* alias, JackLockedEngine* en
JackDriver::JackDriver() JackDriver::JackDriver()
{ {
fSynchroTable = NULL; fSynchroTable = NULL;
fClientControl = NULL;
fEngine = NULL; fEngine = NULL;
fGraphManager = NULL; fGraphManager = NULL;
fBeginDateUst = 0; fBeginDateUst = 0;
@@ -69,22 +68,21 @@ JackDriver::JackDriver()
JackDriver::~JackDriver() JackDriver::~JackDriver()
{ {
jack_log("~JackDriver"); jack_log("~JackDriver");
delete fClientControl;
} }


int JackDriver::Open() int JackDriver::Open()
{ {
int refnum = -1; int refnum = -1;


if (fEngine->ClientInternalOpen(fClientControl->fName, &refnum, &fEngineControl, &fGraphManager, this, false) != 0) {
if (fEngine->ClientInternalOpen(fClientControl.fName, &refnum, &fEngineControl, &fGraphManager, this, false) != 0) {
jack_error("Cannot allocate internal client for audio driver"); jack_error("Cannot allocate internal client for audio driver");
return -1; return -1;
} }


fClientControl->fRefNum = refnum;
fClientControl->fActive = true;
fGraphManager->DirectConnect(fClientControl->fRefNum, fClientControl->fRefNum); // Connect driver to itself for "sync" mode
SetupDriverSync(fClientControl->fRefNum, false);
fClientControl.fRefNum = refnum;
fClientControl.fActive = true;
fGraphManager->DirectConnect(fClientControl.fRefNum, fClientControl.fRefNum); // Connect driver to itself for "sync" mode
SetupDriverSync(fClientControl.fRefNum, false);
return 0; return 0;
} }


@@ -104,13 +102,13 @@ int JackDriver::Open(jack_nframes_t nframes,
jack_log("JackDriver::Open playback_driver_name = %s", playback_driver_name); jack_log("JackDriver::Open playback_driver_name = %s", playback_driver_name);
int refnum = -1; int refnum = -1;


if (fEngine->ClientInternalOpen(fClientControl->fName, &refnum, &fEngineControl, &fGraphManager, this, false) != 0) {
if (fEngine->ClientInternalOpen(fClientControl.fName, &refnum, &fEngineControl, &fGraphManager, this, false) != 0) {
jack_error("Cannot allocate internal client for audio driver"); jack_error("Cannot allocate internal client for audio driver");
return -1; return -1;
} }


fClientControl->fRefNum = refnum;
fClientControl->fActive = true;
fClientControl.fRefNum = refnum;
fClientControl.fActive = true;
fEngineControl->fBufferSize = nframes; fEngineControl->fBufferSize = nframes;
fEngineControl->fSampleRate = samplerate; fEngineControl->fSampleRate = samplerate;
fCaptureLatency = capture_latency; fCaptureLatency = capture_latency;
@@ -127,17 +125,17 @@ int JackDriver::Open(jack_nframes_t nframes,
fEngineControl->fTimeOutUsecs = jack_time_t(2.f * fEngineControl->fPeriodUsecs); fEngineControl->fTimeOutUsecs = jack_time_t(2.f * fEngineControl->fPeriodUsecs);


fGraphManager->SetBufferSize(nframes); fGraphManager->SetBufferSize(nframes);
fGraphManager->DirectConnect(fClientControl->fRefNum, fClientControl->fRefNum); // Connect driver to itself for "sync" mode
SetupDriverSync(fClientControl->fRefNum, false);
fGraphManager->DirectConnect(fClientControl.fRefNum, fClientControl.fRefNum); // Connect driver to itself for "sync" mode
SetupDriverSync(fClientControl.fRefNum, false);
return 0; return 0;
} }


int JackDriver::Close() int JackDriver::Close()
{ {
jack_log("JackDriver::Close"); jack_log("JackDriver::Close");
fGraphManager->DirectDisconnect(fClientControl->fRefNum, fClientControl->fRefNum); // Disconnect driver from itself for sync
fClientControl->fActive = false;
return fEngine->ClientInternalClose(fClientControl->fRefNum, false);
fGraphManager->DirectDisconnect(fClientControl.fRefNum, fClientControl.fRefNum); // Disconnect driver from itself for sync
fClientControl.fActive = false;
return fEngine->ClientInternalClose(fClientControl.fRefNum, false);
} }


/*! /*!
@@ -162,12 +160,12 @@ int JackDriver::ClientNotify(int refnum, const char* name, int notify, int sync,


case kStartFreewheelCallback: case kStartFreewheelCallback:
jack_log("JackDriver::kStartFreewheel"); jack_log("JackDriver::kStartFreewheel");
SetupDriverSync(fClientControl->fRefNum, true);
SetupDriverSync(fClientControl.fRefNum, true);
break; break;


case kStopFreewheelCallback: case kStopFreewheelCallback:
jack_log("JackDriver::kStopFreewheel"); jack_log("JackDriver::kStopFreewheel");
SetupDriverSync(fClientControl->fRefNum, false);
SetupDriverSync(fClientControl.fRefNum, false);
break; break;
} }


@@ -197,7 +195,7 @@ void JackDriver::CycleTakeEndTime()


JackClientControl* JackDriver::GetClientControl() const JackClientControl* JackDriver::GetClientControl() const
{ {
return fClientControl;
return (JackClientControl*)&fClientControl;
} }


void JackDriver::NotifyXRun(jack_time_t cur_cycle_begin, float delayed_usecs) void JackDriver::NotifyXRun(jack_time_t cur_cycle_begin, float delayed_usecs)


+ 2
- 2
common/JackDriver.h View File

@@ -25,6 +25,7 @@
#include "JackClientInterface.h" #include "JackClientInterface.h"
#include "JackConstants.h" #include "JackConstants.h"
#include "JackPlatformSynchro.h" #include "JackPlatformSynchro.h"
#include "JackClientControl.h"
#include <list> #include <list>


namespace Jack namespace Jack
@@ -33,7 +34,6 @@ namespace Jack
class JackLockedEngine; class JackLockedEngine;
class JackGraphManager; class JackGraphManager;
struct JackEngineControl; struct JackEngineControl;
struct JackClientControl;
/*! /*!
\brief The base interface for drivers. \brief The base interface for drivers.
@@ -114,7 +114,7 @@ class EXPORT JackDriver : public JackDriverClientInterface
JackGraphManager* fGraphManager; JackGraphManager* fGraphManager;
JackSynchro* fSynchroTable; JackSynchro* fSynchroTable;
JackEngineControl* fEngineControl; JackEngineControl* fEngineControl;
JackClientControl* fClientControl;
JackClientControl fClientControl;
std::list<JackDriverInterface*> fSlaveList; std::list<JackDriverInterface*> fSlaveList;
bool fIsMaster; bool fIsMaster;


+ 1
- 0
common/JackDriverLoader.cpp View File

@@ -35,6 +35,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#include "JackDriverLoader.h" #include "JackDriverLoader.h"
#include "JackError.h" #include "JackError.h"
#include <getopt.h> #include <getopt.h>
#include <stdio.h>


#ifndef WIN32 #ifndef WIN32
#include <dirent.h> #include <dirent.h>


+ 10
- 4
common/JackDriverLoader.h View File

@@ -22,8 +22,8 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#define __JackDriverLoader__ #define __JackDriverLoader__


#include "driver_interface.h" #include "driver_interface.h"
#include "JackDriver.h"
#include "control_types.h" #include "control_types.h"
#include "JackPlatformSynchro.h"
#include "jslist.h" #include "jslist.h"


#ifdef WIN32 #ifdef WIN32
@@ -44,12 +44,18 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.


#endif #endif


namespace Jack
{
class JackDriverClientInterface;
class JackLockedEngine;
};

typedef jack_driver_desc_t * (*JackDriverDescFunction) (); typedef jack_driver_desc_t * (*JackDriverDescFunction) ();
typedef Jack::JackDriverClientInterface* (*initialize) (Jack::JackLockedEngine*, Jack::JackSynchro*, const JSList *);
typedef Jack::JackDriverClientInterface* (*initialize) (Jack::JackLockedEngine*, Jack::JackSynchro*, const JSList*);


typedef struct _jack_driver_info typedef struct _jack_driver_info
{ {
Jack::JackDriverClientInterface* (*initialize)(Jack::JackLockedEngine*, Jack::JackSynchro*, const JSList *);
Jack::JackDriverClientInterface* (*initialize)(Jack::JackLockedEngine*, Jack::JackSynchro*, const JSList*);
DRIVER_HANDLE handle; DRIVER_HANDLE handle;
} }
jack_driver_info_t; jack_driver_info_t;
@@ -59,7 +65,7 @@ jack_driver_desc_t * jack_drivers_get_descriptor (JSList * drivers, const char *
JSList * jack_drivers_load (JSList * drivers); JSList * jack_drivers_load (JSList * drivers);
jack_driver_info_t * jack_load_driver (jack_driver_desc_t * driver_desc); jack_driver_info_t * jack_load_driver (jack_driver_desc_t * driver_desc);
int jack_parse_driver_params (jack_driver_desc_t * desc, int argc, char* argv[], JSList ** param_ptr); int jack_parse_driver_params (jack_driver_desc_t * desc, int argc, char* argv[], JSList ** param_ptr);
EXPORT int jackctl_parse_driver_params (jackctl_driver *driver_ptr, int argc, char* argv[]);
EXPORT int jackctl_parse_driver_params (jackctl_driver * driver_ptr, int argc, char* argv[]);


#endif #endif



+ 4
- 4
common/JackFreewheelDriver.cpp View File

@@ -39,15 +39,15 @@ int JackFreewheelDriver::Process()
jack_log("JackFreewheelDriver::Process master %lld", fEngineControl->fTimeOutUsecs); jack_log("JackFreewheelDriver::Process master %lld", fEngineControl->fTimeOutUsecs);
JackDriver::CycleTakeBeginTime(); JackDriver::CycleTakeBeginTime();
fEngine->Process(fBeginDateUst, fEndDateUst); fEngine->Process(fBeginDateUst, fEndDateUst);
fGraphManager->ResumeRefNum(fClientControl, fSynchroTable); // Signal all clients
if (fGraphManager->SuspendRefNum(fClientControl, fSynchroTable, FREEWHEEL_DRIVER_TIMEOUT * 1000000) < 0) { // Wait for all clients to finish for 10 sec
fGraphManager->ResumeRefNum(&fClientControl, fSynchroTable); // Signal all clients
if (fGraphManager->SuspendRefNum(&fClientControl, fSynchroTable, FREEWHEEL_DRIVER_TIMEOUT * 1000000) < 0) { // Wait for all clients to finish for 10 sec
jack_error("JackFreewheelDriver::ProcessSync SuspendRefNum error"); jack_error("JackFreewheelDriver::ProcessSync SuspendRefNum error");
return -1; return -1;
} }
} else { } else {
fGraphManager->ResumeRefNum(fClientControl, fSynchroTable); // Signal all clients
fGraphManager->ResumeRefNum(&fClientControl, fSynchroTable); // Signal all clients
if (fEngineControl->fSyncMode) { if (fEngineControl->fSyncMode) {
if (fGraphManager->SuspendRefNum(fClientControl, fSynchroTable, fEngineControl->fTimeOutUsecs) < 0) {
if (fGraphManager->SuspendRefNum(&fClientControl, fSynchroTable, fEngineControl->fTimeOutUsecs) < 0) {
jack_error("JackFreewheelDriver::ProcessSync SuspendRefNum error"); jack_error("JackFreewheelDriver::ProcessSync SuspendRefNum error");
return -1; return -1;
} }


+ 2
- 2
common/JackLoopbackDriver.cpp View File

@@ -45,9 +45,9 @@ int JackLoopbackDriver::Process()
memcpy(GetInputBuffer(i), GetOutputBuffer(i), sizeof(float) * fEngineControl->fBufferSize); memcpy(GetInputBuffer(i), GetOutputBuffer(i), sizeof(float) * fEngineControl->fBufferSize);
} }


fGraphManager->ResumeRefNum(fClientControl, fSynchroTable); // Signal all clients
fGraphManager->ResumeRefNum(&fClientControl, fSynchroTable); // Signal all clients
if (fEngineControl->fSyncMode) { if (fEngineControl->fSyncMode) {
if (fGraphManager->SuspendRefNum(fClientControl, fSynchroTable, fEngineControl->fTimeOutUsecs) < 0) {
if (fGraphManager->SuspendRefNum(&fClientControl, fSynchroTable, fEngineControl->fTimeOutUsecs) < 0) {
jack_error("JackLoopbackDriver::ProcessSync SuspendRefNum error"); jack_error("JackLoopbackDriver::ProcessSync SuspendRefNum error");
return -1; return -1;
} }


+ 12
- 12
common/JackNetDriver.cpp View File

@@ -324,8 +324,8 @@ namespace Jack
for ( int port_index = 0; port_index < fCaptureChannels; port_index++ ) for ( int port_index = 0; port_index < fCaptureChannels; port_index++ )
{ {
snprintf ( alias, sizeof ( alias ) - 1, "%s:%s:out%d", fAliasName, fCaptureDriverName, port_index + 1 ); snprintf ( alias, sizeof ( alias ) - 1, "%s:%s:out%d", fAliasName, fCaptureDriverName, port_index + 1 );
snprintf ( name, sizeof ( name ) - 1, "%s:capture_%d", fClientControl->fName, port_index + 1 );
if ( ( port_id = fGraphManager->AllocatePort ( fClientControl->fRefNum, name, JACK_DEFAULT_AUDIO_TYPE,
snprintf ( name, sizeof ( name ) - 1, "%s:capture_%d", fClientControl.fName, port_index + 1 );
if ( ( port_id = fGraphManager->AllocatePort ( fClientControl.fRefNum, name, JACK_DEFAULT_AUDIO_TYPE,
static_cast<JackPortFlags> ( port_flags ), fEngineControl->fBufferSize ) ) == NO_PORT ) static_cast<JackPortFlags> ( port_flags ), fEngineControl->fBufferSize ) ) == NO_PORT )
{ {
jack_error ( "driver: cannot register port for %s", name ); jack_error ( "driver: cannot register port for %s", name );
@@ -341,8 +341,8 @@ namespace Jack
for ( int port_index = 0; port_index < fPlaybackChannels; port_index++ ) for ( int port_index = 0; port_index < fPlaybackChannels; port_index++ )
{ {
snprintf ( alias, sizeof ( alias ) - 1, "%s:%s:in%d", fAliasName, fPlaybackDriverName, port_index + 1 ); snprintf ( alias, sizeof ( alias ) - 1, "%s:%s:in%d", fAliasName, fPlaybackDriverName, port_index + 1 );
snprintf ( name, sizeof ( name ) - 1, "%s:playback_%d",fClientControl->fName, port_index + 1 );
if ( ( port_id = fGraphManager->AllocatePort ( fClientControl->fRefNum, name, JACK_DEFAULT_AUDIO_TYPE,
snprintf ( name, sizeof ( name ) - 1, "%s:playback_%d",fClientControl.fName, port_index + 1 );
if ( ( port_id = fGraphManager->AllocatePort ( fClientControl.fRefNum, name, JACK_DEFAULT_AUDIO_TYPE,
static_cast<JackPortFlags> ( port_flags ), fEngineControl->fBufferSize ) ) == NO_PORT ) static_cast<JackPortFlags> ( port_flags ), fEngineControl->fBufferSize ) ) == NO_PORT )
{ {
jack_error ( "driver: cannot register port for %s", name ); jack_error ( "driver: cannot register port for %s", name );
@@ -359,8 +359,8 @@ namespace Jack
for ( uint port_index = 0; port_index < fParams.fSendMidiChannels; port_index++ ) for ( uint port_index = 0; port_index < fParams.fSendMidiChannels; port_index++ )
{ {
snprintf ( alias, sizeof ( alias ) - 1, "%s:%s:out%d", fAliasName, fCaptureDriverName, port_index + 1 ); snprintf ( alias, sizeof ( alias ) - 1, "%s:%s:out%d", fAliasName, fCaptureDriverName, port_index + 1 );
snprintf ( name, sizeof ( name ) - 1, "%s:midi_capture_%d", fClientControl->fName, port_index + 1 );
if ( ( port_id = fGraphManager->AllocatePort ( fClientControl->fRefNum, name, JACK_DEFAULT_MIDI_TYPE,
snprintf ( name, sizeof ( name ) - 1, "%s:midi_capture_%d", fClientControl.fName, port_index + 1 );
if ( ( port_id = fGraphManager->AllocatePort ( fClientControl.fRefNum, name, JACK_DEFAULT_MIDI_TYPE,
static_cast<JackPortFlags> ( port_flags ), fEngineControl->fBufferSize ) ) == NO_PORT ) static_cast<JackPortFlags> ( port_flags ), fEngineControl->fBufferSize ) ) == NO_PORT )
{ {
jack_error ( "driver: cannot register port for %s", name ); jack_error ( "driver: cannot register port for %s", name );
@@ -374,8 +374,8 @@ namespace Jack
for ( uint port_index = 0; port_index < fParams.fReturnMidiChannels; port_index++ ) for ( uint port_index = 0; port_index < fParams.fReturnMidiChannels; port_index++ )
{ {
snprintf ( alias, sizeof ( alias ) - 1, "%s:%s:in%d", fAliasName, fPlaybackDriverName, port_index + 1 ); snprintf ( alias, sizeof ( alias ) - 1, "%s:%s:in%d", fAliasName, fPlaybackDriverName, port_index + 1 );
snprintf ( name, sizeof ( name ) - 1, "%s:midi_playback_%d", fClientControl->fName, port_index + 1 );
if ( ( port_id = fGraphManager->AllocatePort ( fClientControl->fRefNum, name, JACK_DEFAULT_MIDI_TYPE,
snprintf ( name, sizeof ( name ) - 1, "%s:midi_playback_%d", fClientControl.fName, port_index + 1 );
if ( ( port_id = fGraphManager->AllocatePort ( fClientControl.fRefNum, name, JACK_DEFAULT_MIDI_TYPE,
static_cast<JackPortFlags> ( port_flags ), fEngineControl->fBufferSize ) ) == NO_PORT ) static_cast<JackPortFlags> ( port_flags ), fEngineControl->fBufferSize ) ) == NO_PORT )
{ {
jack_error ( "driver: cannot register port for %s", name ); jack_error ( "driver: cannot register port for %s", name );
@@ -392,13 +392,13 @@ namespace Jack
{ {
jack_log ( "JackNetDriver::FreePorts" ); jack_log ( "JackNetDriver::FreePorts" );
for ( int port_index = 0; port_index < fCaptureChannels; port_index++ ) for ( int port_index = 0; port_index < fCaptureChannels; port_index++ )
fGraphManager->ReleasePort ( fClientControl->fRefNum, fCapturePortList[port_index] );
fGraphManager->ReleasePort ( fClientControl.fRefNum, fCapturePortList[port_index] );
for ( int port_index = 0; port_index < fPlaybackChannels; port_index++ ) for ( int port_index = 0; port_index < fPlaybackChannels; port_index++ )
fGraphManager->ReleasePort ( fClientControl->fRefNum, fPlaybackPortList[port_index] );
fGraphManager->ReleasePort ( fClientControl.fRefNum, fPlaybackPortList[port_index] );
for ( uint port_index = 0; port_index < fParams.fSendMidiChannels; port_index++ ) for ( uint port_index = 0; port_index < fParams.fSendMidiChannels; port_index++ )
fGraphManager->ReleasePort ( fClientControl->fRefNum, fMidiCapturePortList[port_index] );
fGraphManager->ReleasePort ( fClientControl.fRefNum, fMidiCapturePortList[port_index] );
for ( uint port_index = 0; port_index < fParams.fReturnMidiChannels; port_index++ ) for ( uint port_index = 0; port_index < fParams.fReturnMidiChannels; port_index++ )
fGraphManager->ReleasePort ( fClientControl->fRefNum, fMidiPlaybackPortList[port_index] );
fGraphManager->ReleasePort ( fClientControl.fRefNum, fMidiPlaybackPortList[port_index] );
return 0; return 0;
} }




+ 8
- 8
linux/alsa/JackAlsaDriver.cpp View File

@@ -2136,8 +2136,8 @@ int JackAlsaDriver::Attach()


for (int i = 0; i < fCaptureChannels; i++) { for (int i = 0; i < fCaptureChannels; i++) {
snprintf(alias, sizeof(alias) - 1, "%s:capture_%u", fAliasName, i + 1); snprintf(alias, sizeof(alias) - 1, "%s:capture_%u", fAliasName, i + 1);
snprintf(name, sizeof(name) - 1, "%s:capture_%d", fClientControl->fName, i + 1);
if ((port_index = fGraphManager->AllocatePort(fClientControl->fRefNum, name, JACK_DEFAULT_AUDIO_TYPE, (JackPortFlags)port_flags, fEngineControl->fBufferSize)) == NO_PORT) {
snprintf(name, sizeof(name) - 1, "%s:capture_%d", fClientControl.fName, i + 1);
if ((port_index = fGraphManager->AllocatePort(fClientControl.fRefNum, name, JACK_DEFAULT_AUDIO_TYPE, (JackPortFlags)port_flags, fEngineControl->fBufferSize)) == NO_PORT) {
jack_error("driver: cannot register port for %s", name); jack_error("driver: cannot register port for %s", name);
return -1; return -1;
} }
@@ -2152,8 +2152,8 @@ int JackAlsaDriver::Attach()


for (int i = 0; i < fPlaybackChannels; i++) { for (int i = 0; i < fPlaybackChannels; i++) {
snprintf(alias, sizeof(alias) - 1, "%s:playback_%u", fAliasName, i + 1); snprintf(alias, sizeof(alias) - 1, "%s:playback_%u", fAliasName, i + 1);
snprintf(name, sizeof(name) - 1, "%s:playback_%d", fClientControl->fName, i + 1);
if ((port_index = fGraphManager->AllocatePort(fClientControl->fRefNum, name, JACK_DEFAULT_AUDIO_TYPE, (JackPortFlags)port_flags, fEngineControl->fBufferSize)) == NO_PORT) {
snprintf(name, sizeof(name) - 1, "%s:playback_%d", fClientControl.fName, i + 1);
if ((port_index = fGraphManager->AllocatePort(fClientControl.fRefNum, name, JACK_DEFAULT_AUDIO_TYPE, (JackPortFlags)port_flags, fEngineControl->fBufferSize)) == NO_PORT) {
jack_error("driver: cannot register port for %s", name); jack_error("driver: cannot register port for %s", name);
return -1; return -1;
} }
@@ -2168,8 +2168,8 @@ int JackAlsaDriver::Attach()
// Monitor ports // Monitor ports
if (fWithMonitorPorts) { if (fWithMonitorPorts) {
jack_log("Create monitor port "); jack_log("Create monitor port ");
snprintf(name, sizeof(name) - 1, "%s:monitor_%d", fClientControl->fName, i + 1);
if ((port_index = fGraphManager->AllocatePort(fClientControl->fRefNum, name, JACK_DEFAULT_AUDIO_TYPE, JackPortIsOutput, fEngineControl->fBufferSize)) == NO_PORT) {
snprintf(name, sizeof(name) - 1, "%s:monitor_%d", fClientControl.fName, i + 1);
if ((port_index = fGraphManager->AllocatePort(fClientControl.fRefNum, name, JACK_DEFAULT_AUDIO_TYPE, JackPortIsOutput, fEngineControl->fBufferSize)) == NO_PORT) {
jack_error ("ALSA: cannot register monitor port for %s", name); jack_error ("ALSA: cannot register monitor port for %s", name);
} else { } else {
port = fGraphManager->GetPort(port_index); port = fGraphManager->GetPort(port_index);
@@ -2358,13 +2358,13 @@ int JackAlsaDriver::create_thread(pthread_t *thread, int priority, int realtime,
jack_port_id_t JackAlsaDriver::port_register(const char *port_name, const char *port_type, unsigned long flags, unsigned long buffer_size) jack_port_id_t JackAlsaDriver::port_register(const char *port_name, const char *port_type, unsigned long flags, unsigned long buffer_size)
{ {
unsigned int port_index; unsigned int port_index;
int res = fEngine->PortRegister(fClientControl->fRefNum, port_name, port_type, flags, buffer_size, &port_index);
int res = fEngine->PortRegister(fClientControl.fRefNum, port_name, port_type, flags, buffer_size, &port_index);
return (res == 0) ? port_index : 0; return (res == 0) ? port_index : 0;
} }


int JackAlsaDriver::port_unregister(jack_port_id_t port_index) int JackAlsaDriver::port_unregister(jack_port_id_t port_index)
{ {
return fEngine->PortUnRegister(fClientControl->fRefNum, port_index);
return fEngine->PortUnRegister(fClientControl.fRefNum, port_index);
} }


void* JackAlsaDriver::port_get_buffer(int port, jack_nframes_t nframes) void* JackAlsaDriver::port_get_buffer(int port, jack_nframes_t nframes)


+ 8
- 8
linux/firewire/JackFFADODriver.cpp View File

@@ -508,9 +508,9 @@ int JackFFADODriver::Attach()


driver->capture_channels[chn].stream_type = ffado_streaming_get_capture_stream_type(driver->dev, chn); driver->capture_channels[chn].stream_type = ffado_streaming_get_capture_stream_type(driver->dev, chn);
if (driver->capture_channels[chn].stream_type == ffado_stream_type_audio) { if (driver->capture_channels[chn].stream_type == ffado_stream_type_audio) {
snprintf(buf, sizeof(buf) - 1, "%s:AC%d_%s", fClientControl->fName, (int)chn, portname);
snprintf(buf, sizeof(buf) - 1, "%s:AC%d_%s", fClientControl.fName, (int)chn, portname);
printMessage ("Registering audio capture port %s", buf); printMessage ("Registering audio capture port %s", buf);
if ((port_index = fGraphManager->AllocatePort(fClientControl->fRefNum, buf,
if ((port_index = fGraphManager->AllocatePort(fClientControl.fRefNum, buf,
JACK_DEFAULT_AUDIO_TYPE, JACK_DEFAULT_AUDIO_TYPE,
(JackPortFlags)port_flags, (JackPortFlags)port_flags,
fEngineControl->fBufferSize)) == NO_PORT) { fEngineControl->fBufferSize)) == NO_PORT) {
@@ -531,9 +531,9 @@ int JackFFADODriver::Attach()
fCaptureChannels++; fCaptureChannels++;


} else if (driver->capture_channels[chn].stream_type == ffado_stream_type_midi) { } else if (driver->capture_channels[chn].stream_type == ffado_stream_type_midi) {
snprintf(buf, sizeof(buf) - 1, "%s:MC%d_%s", fClientControl->fName, (int)chn, portname);
snprintf(buf, sizeof(buf) - 1, "%s:MC%d_%s", fClientControl.fName, (int)chn, portname);
printMessage ("Registering midi capture port %s", buf); printMessage ("Registering midi capture port %s", buf);
if ((port_index = fGraphManager->AllocatePort(fClientControl->fRefNum, buf,
if ((port_index = fGraphManager->AllocatePort(fClientControl.fRefNum, buf,
JACK_DEFAULT_MIDI_TYPE, JACK_DEFAULT_MIDI_TYPE,
(JackPortFlags)port_flags, (JackPortFlags)port_flags,
fEngineControl->fBufferSize)) == NO_PORT) { fEngineControl->fBufferSize)) == NO_PORT) {
@@ -582,9 +582,9 @@ int JackFFADODriver::Attach()
driver->playback_channels[chn].stream_type = ffado_streaming_get_playback_stream_type(driver->dev, chn); driver->playback_channels[chn].stream_type = ffado_streaming_get_playback_stream_type(driver->dev, chn);


if (driver->playback_channels[chn].stream_type == ffado_stream_type_audio) { if (driver->playback_channels[chn].stream_type == ffado_stream_type_audio) {
snprintf(buf, sizeof(buf) - 1, "%s:AP%d_%s", fClientControl->fName, (int)chn, portname);
snprintf(buf, sizeof(buf) - 1, "%s:AP%d_%s", fClientControl.fName, (int)chn, portname);
printMessage ("Registering audio playback port %s", buf); printMessage ("Registering audio playback port %s", buf);
if ((port_index = fGraphManager->AllocatePort(fClientControl->fRefNum, buf,
if ((port_index = fGraphManager->AllocatePort(fClientControl.fRefNum, buf,
JACK_DEFAULT_AUDIO_TYPE, JACK_DEFAULT_AUDIO_TYPE,
(JackPortFlags)port_flags, (JackPortFlags)port_flags,
fEngineControl->fBufferSize)) == NO_PORT) { fEngineControl->fBufferSize)) == NO_PORT) {
@@ -607,9 +607,9 @@ int JackFFADODriver::Attach()
jack_log("JackFFADODriver::Attach fPlaybackPortList[i] %ld ", port_index); jack_log("JackFFADODriver::Attach fPlaybackPortList[i] %ld ", port_index);
fPlaybackChannels++; fPlaybackChannels++;
} else if (driver->playback_channels[chn].stream_type == ffado_stream_type_midi) { } else if (driver->playback_channels[chn].stream_type == ffado_stream_type_midi) {
snprintf(buf, sizeof(buf) - 1, "%s:MP%d_%s", fClientControl->fName, (int)chn, portname);
snprintf(buf, sizeof(buf) - 1, "%s:MP%d_%s", fClientControl.fName, (int)chn, portname);
printMessage ("Registering midi playback port %s", buf); printMessage ("Registering midi playback port %s", buf);
if ((port_index = fGraphManager->AllocatePort(fClientControl->fRefNum, buf,
if ((port_index = fGraphManager->AllocatePort(fClientControl.fRefNum, buf,
JACK_DEFAULT_MIDI_TYPE, JACK_DEFAULT_MIDI_TYPE,
(JackPortFlags)port_flags, (JackPortFlags)port_flags,
fEngineControl->fBufferSize)) == NO_PORT) { fEngineControl->fBufferSize)) == NO_PORT) {


+ 4
- 4
linux/freebob/JackFreebobDriver.cpp View File

@@ -730,14 +730,14 @@ int JackFreebobDriver::Attach()
for (unsigned int i = 0; i < driver->capture_nchannels; i++) { for (unsigned int i = 0; i < driver->capture_nchannels; i++) {


freebob_streaming_get_capture_stream_name(driver->dev, i, portname, sizeof(portname) - 1); freebob_streaming_get_capture_stream_name(driver->dev, i, portname, sizeof(portname) - 1);
snprintf(buf, sizeof(buf) - 1, "%s:%s", fClientControl->fName, portname);
snprintf(buf, sizeof(buf) - 1, "%s:%s", fClientControl.fName, portname);


if (freebob_streaming_get_capture_stream_type(driver->dev, i) != freebob_stream_type_audio) { if (freebob_streaming_get_capture_stream_type(driver->dev, i) != freebob_stream_type_audio) {
printMessage ("Don't register capture port %s", buf); printMessage ("Don't register capture port %s", buf);
} else { } else {
printMessage ("Registering capture port %s", buf); printMessage ("Registering capture port %s", buf);


if ((port_index = fGraphManager->AllocatePort(fClientControl->fRefNum, buf,
if ((port_index = fGraphManager->AllocatePort(fClientControl.fRefNum, buf,
JACK_DEFAULT_AUDIO_TYPE, JACK_DEFAULT_AUDIO_TYPE,
(JackPortFlags)port_flags, (JackPortFlags)port_flags,
fEngineControl->fBufferSize)) == NO_PORT) { fEngineControl->fBufferSize)) == NO_PORT) {
@@ -761,13 +761,13 @@ int JackFreebobDriver::Attach()
for (unsigned int i = 0; i < driver->playback_nchannels; i++) { for (unsigned int i = 0; i < driver->playback_nchannels; i++) {


freebob_streaming_get_playback_stream_name(driver->dev, i, portname, sizeof(portname) - 1); freebob_streaming_get_playback_stream_name(driver->dev, i, portname, sizeof(portname) - 1);
snprintf(buf, sizeof(buf) - 1, "%s:%s", fClientControl->fName, portname);
snprintf(buf, sizeof(buf) - 1, "%s:%s", fClientControl.fName, portname);


if (freebob_streaming_get_playback_stream_type(driver->dev, i) != freebob_stream_type_audio) { if (freebob_streaming_get_playback_stream_type(driver->dev, i) != freebob_stream_type_audio) {
printMessage ("Don't register playback port %s", buf); printMessage ("Don't register playback port %s", buf);
} else { } else {
printMessage ("Registering playback port %s", buf); printMessage ("Registering playback port %s", buf);
if ((port_index = fGraphManager->AllocatePort(fClientControl->fRefNum, buf,
if ((port_index = fGraphManager->AllocatePort(fClientControl.fRefNum, buf,
JACK_DEFAULT_AUDIO_TYPE, JACK_DEFAULT_AUDIO_TYPE,
(JackPortFlags)port_flags, (JackPortFlags)port_flags,
fEngineControl->fBufferSize)) == NO_PORT) { fEngineControl->fBufferSize)) == NO_PORT) {


+ 5
- 5
macosx/JackCoreAudioDriver.cpp View File

@@ -973,9 +973,9 @@ int JackCoreAudioDriver::Attach()
snprintf(alias, sizeof(alias) - 1, "%s:%s:out%u", fAliasName, fCaptureDriverName, i + 1); snprintf(alias, sizeof(alias) - 1, "%s:%s:out%u", fAliasName, fCaptureDriverName, i + 1);
} }


snprintf(name, sizeof(name) - 1, "%s:capture_%d", fClientControl->fName, i + 1);
snprintf(name, sizeof(name) - 1, "%s:capture_%d", fClientControl.fName, i + 1);


if ((port_index = fGraphManager->AllocatePort(fClientControl->fRefNum, name, JACK_DEFAULT_AUDIO_TYPE, (JackPortFlags)port_flags, fEngineControl->fBufferSize)) == NO_PORT) {
if ((port_index = fGraphManager->AllocatePort(fClientControl.fRefNum, name, JACK_DEFAULT_AUDIO_TYPE, (JackPortFlags)port_flags, fEngineControl->fBufferSize)) == NO_PORT) {
jack_error("Cannot register port for %s", name); jack_error("Cannot register port for %s", name);
return -1; return -1;
} }
@@ -1012,9 +1012,9 @@ int JackCoreAudioDriver::Attach()
snprintf(alias, sizeof(alias) - 1, "%s:%s:in%u", fAliasName, fPlaybackDriverName, i + 1); snprintf(alias, sizeof(alias) - 1, "%s:%s:in%u", fAliasName, fPlaybackDriverName, i + 1);
} }


snprintf(name, sizeof(name) - 1, "%s:playback_%d", fClientControl->fName, i + 1);
snprintf(name, sizeof(name) - 1, "%s:playback_%d", fClientControl.fName, i + 1);


if ((port_index = fGraphManager->AllocatePort(fClientControl->fRefNum, name, JACK_DEFAULT_AUDIO_TYPE, (JackPortFlags)port_flags, fEngineControl->fBufferSize)) == NO_PORT) {
if ((port_index = fGraphManager->AllocatePort(fClientControl.fRefNum, name, JACK_DEFAULT_AUDIO_TYPE, (JackPortFlags)port_flags, fEngineControl->fBufferSize)) == NO_PORT) {
jack_error("Cannot register port for %s", name); jack_error("Cannot register port for %s", name);
return -1; return -1;
} }
@@ -1039,7 +1039,7 @@ int JackCoreAudioDriver::Attach()
if (fWithMonitorPorts) { if (fWithMonitorPorts) {
jack_log("Create monitor port "); jack_log("Create monitor port ");
snprintf(name, sizeof(name) - 1, "%s:%s:monitor_%u", fAliasName, fPlaybackDriverName, i + 1); snprintf(name, sizeof(name) - 1, "%s:%s:monitor_%u", fAliasName, fPlaybackDriverName, i + 1);
if ((port_index = fGraphManager->AllocatePort(fClientControl->fRefNum, name, JACK_DEFAULT_AUDIO_TYPE, JackPortIsOutput, fEngineControl->fBufferSize)) == NO_PORT) {
if ((port_index = fGraphManager->AllocatePort(fClientControl.fRefNum, name, JACK_DEFAULT_AUDIO_TYPE, JackPortIsOutput, fEngineControl->fBufferSize)) == NO_PORT) {
jack_error("Cannot register monitor port for %s", name); jack_error("Cannot register monitor port for %s", name);
return -1; return -1;
} else { } else {


Loading…
Cancel
Save