git-svn-id: http://subversion.jackaudio.org/jack/jack2/trunk/jackmp@2538 0c269be4-1314-0410-8aa9-9f06e86f4224tags/1.90
| @@ -21,6 +21,10 @@ Romain Moret | |||
| 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> | |||
| * On OSX waf now compiles Universal Binaries. | |||
| @@ -1,6 +1,6 @@ | |||
| /* | |||
| 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 | |||
| 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 "JackError.h" | |||
| #include "JackEngineControl.h" | |||
| #include "JackClientControl.h" | |||
| #include "JackPort.h" | |||
| #include "JackGraphManager.h" | |||
| #include "JackLockedEngine.h" | |||
| @@ -100,8 +99,8 @@ int JackAudioDriver::Attach() | |||
| for (i = 0; i < fCaptureChannels; i++) { | |||
| 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); | |||
| return -1; | |||
| } | |||
| @@ -116,8 +115,8 @@ int JackAudioDriver::Attach() | |||
| for (i = 0; i < fPlaybackChannels; i++) { | |||
| 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); | |||
| return -1; | |||
| } | |||
| @@ -132,7 +131,7 @@ int JackAudioDriver::Attach() | |||
| if (fWithMonitorPorts) { | |||
| jack_log("Create monitor port "); | |||
| 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); | |||
| return -1; | |||
| } else { | |||
| @@ -152,13 +151,13 @@ int JackAudioDriver::Detach() | |||
| jack_log("JackAudioDriver::Detach"); | |||
| for (i = 0; i < fCaptureChannels; i++) { | |||
| fGraphManager->ReleasePort(fClientControl->fRefNum, fCapturePortList[i]); | |||
| fGraphManager->ReleasePort(fClientControl.fRefNum, fCapturePortList[i]); | |||
| } | |||
| for (i = 0; i < fPlaybackChannels; i++) { | |||
| fGraphManager->ReleasePort(fClientControl->fRefNum, fPlaybackPortList[i]); | |||
| fGraphManager->ReleasePort(fClientControl.fRefNum, fPlaybackPortList[i]); | |||
| if (fWithMonitorPorts) | |||
| fGraphManager->ReleasePort(fClientControl->fRefNum, fMonitorPortList[i]); | |||
| fGraphManager->ReleasePort(fClientControl.fRefNum, fMonitorPortList[i]); | |||
| } | |||
| return 0; | |||
| @@ -191,7 +190,7 @@ int JackAudioDriver::ProcessNull() | |||
| // fBeginDateUst is set in the "low level" layer, fEndDateUst is from previous cycle | |||
| if (!fEngine->Process(fBeginDateUst, fEndDateUst)) | |||
| jack_error("JackAudioDriver::ProcessNull Process error"); | |||
| fGraphManager->ResumeRefNum(fClientControl, fSynchroTable); | |||
| fGraphManager->ResumeRefNum(&fClientControl, fSynchroTable); | |||
| if (ProcessSlaves() < 0) | |||
| 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 | |||
| if (!fEngine->Process(fBeginDateUst, fEndDateUst)) | |||
| jack_error("JackAudioDriver::ProcessAsync Process error"); | |||
| fGraphManager->ResumeRefNum(fClientControl, fSynchroTable); | |||
| fGraphManager->ResumeRefNum(&fClientControl, fSynchroTable); | |||
| if (ProcessSlaves() < 0) | |||
| jack_error("JackAudioDriver::ProcessAsync ProcessSlaves error"); | |||
| } else { | |||
| fGraphManager->ResumeRefNum(fClientControl, fSynchroTable); | |||
| fGraphManager->ResumeRefNum(&fClientControl, fSynchroTable); | |||
| } | |||
| // Keep end cycle time | |||
| @@ -257,10 +256,10 @@ int JackAudioDriver::ProcessSync() | |||
| // fBeginDateUst is set in the "low level" layer, fEndDateUst is from previous cycle | |||
| if (fEngine->Process(fBeginDateUst, fEndDateUst)) { | |||
| fGraphManager->ResumeRefNum(fClientControl, fSynchroTable); | |||
| fGraphManager->ResumeRefNum(&fClientControl, fSynchroTable); | |||
| if (ProcessSlaves() < 0) | |||
| 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!!"); | |||
| } else { // Graph not finished: do not activate it | |||
| jack_error("ProcessSync: error"); | |||
| @@ -273,7 +272,7 @@ int JackAudioDriver::ProcessSync() | |||
| } | |||
| } else { | |||
| fGraphManager->ResumeRefNum(fClientControl, fSynchroTable); | |||
| fGraphManager->ResumeRefNum(&fClientControl, fSynchroTable); | |||
| } | |||
| // Keep end cycle time | |||
| @@ -44,10 +44,10 @@ namespace Jack | |||
| { | |||
| JackDriver::JackDriver(const char* name, const char* alias, JackLockedEngine* engine, JackSynchro* table) | |||
| :fClientControl(name) | |||
| { | |||
| assert(strlen(name) < JACK_CLIENT_NAME_SIZE); | |||
| fSynchroTable = table; | |||
| fClientControl = new JackClientControl(name); | |||
| strcpy(fAliasName, alias); | |||
| fEngine = engine; | |||
| fGraphManager = NULL; | |||
| @@ -59,7 +59,6 @@ JackDriver::JackDriver(const char* name, const char* alias, JackLockedEngine* en | |||
| JackDriver::JackDriver() | |||
| { | |||
| fSynchroTable = NULL; | |||
| fClientControl = NULL; | |||
| fEngine = NULL; | |||
| fGraphManager = NULL; | |||
| fBeginDateUst = 0; | |||
| @@ -69,22 +68,21 @@ JackDriver::JackDriver() | |||
| JackDriver::~JackDriver() | |||
| { | |||
| jack_log("~JackDriver"); | |||
| delete fClientControl; | |||
| } | |||
| int JackDriver::Open() | |||
| { | |||
| 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"); | |||
| 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; | |||
| } | |||
| @@ -104,13 +102,13 @@ int JackDriver::Open(jack_nframes_t nframes, | |||
| jack_log("JackDriver::Open playback_driver_name = %s", playback_driver_name); | |||
| 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"); | |||
| return -1; | |||
| } | |||
| fClientControl->fRefNum = refnum; | |||
| fClientControl->fActive = true; | |||
| fClientControl.fRefNum = refnum; | |||
| fClientControl.fActive = true; | |||
| fEngineControl->fBufferSize = nframes; | |||
| fEngineControl->fSampleRate = samplerate; | |||
| fCaptureLatency = capture_latency; | |||
| @@ -127,17 +125,17 @@ int JackDriver::Open(jack_nframes_t nframes, | |||
| fEngineControl->fTimeOutUsecs = jack_time_t(2.f * fEngineControl->fPeriodUsecs); | |||
| 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; | |||
| } | |||
| int 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: | |||
| jack_log("JackDriver::kStartFreewheel"); | |||
| SetupDriverSync(fClientControl->fRefNum, true); | |||
| SetupDriverSync(fClientControl.fRefNum, true); | |||
| break; | |||
| case kStopFreewheelCallback: | |||
| jack_log("JackDriver::kStopFreewheel"); | |||
| SetupDriverSync(fClientControl->fRefNum, false); | |||
| SetupDriverSync(fClientControl.fRefNum, false); | |||
| break; | |||
| } | |||
| @@ -197,7 +195,7 @@ void JackDriver::CycleTakeEndTime() | |||
| JackClientControl* JackDriver::GetClientControl() const | |||
| { | |||
| return fClientControl; | |||
| return (JackClientControl*)&fClientControl; | |||
| } | |||
| void JackDriver::NotifyXRun(jack_time_t cur_cycle_begin, float delayed_usecs) | |||
| @@ -25,6 +25,7 @@ | |||
| #include "JackClientInterface.h" | |||
| #include "JackConstants.h" | |||
| #include "JackPlatformSynchro.h" | |||
| #include "JackClientControl.h" | |||
| #include <list> | |||
| namespace Jack | |||
| @@ -33,7 +34,6 @@ namespace Jack | |||
| class JackLockedEngine; | |||
| class JackGraphManager; | |||
| struct JackEngineControl; | |||
| struct JackClientControl; | |||
| /*! | |||
| \brief The base interface for drivers. | |||
| @@ -114,7 +114,7 @@ class EXPORT JackDriver : public JackDriverClientInterface | |||
| JackGraphManager* fGraphManager; | |||
| JackSynchro* fSynchroTable; | |||
| JackEngineControl* fEngineControl; | |||
| JackClientControl* fClientControl; | |||
| JackClientControl fClientControl; | |||
| std::list<JackDriverInterface*> fSlaveList; | |||
| bool fIsMaster; | |||
| @@ -35,6 +35,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | |||
| #include "JackDriverLoader.h" | |||
| #include "JackError.h" | |||
| #include <getopt.h> | |||
| #include <stdio.h> | |||
| #ifndef WIN32 | |||
| #include <dirent.h> | |||
| @@ -22,8 +22,8 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | |||
| #define __JackDriverLoader__ | |||
| #include "driver_interface.h" | |||
| #include "JackDriver.h" | |||
| #include "control_types.h" | |||
| #include "JackPlatformSynchro.h" | |||
| #include "jslist.h" | |||
| #ifdef WIN32 | |||
| @@ -44,12 +44,18 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | |||
| #endif | |||
| namespace Jack | |||
| { | |||
| class JackDriverClientInterface; | |||
| class JackLockedEngine; | |||
| }; | |||
| 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 | |||
| { | |||
| Jack::JackDriverClientInterface* (*initialize)(Jack::JackLockedEngine*, Jack::JackSynchro*, const JSList *); | |||
| Jack::JackDriverClientInterface* (*initialize)(Jack::JackLockedEngine*, Jack::JackSynchro*, const JSList*); | |||
| DRIVER_HANDLE handle; | |||
| } | |||
| 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); | |||
| 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); | |||
| 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 | |||
| @@ -39,15 +39,15 @@ int JackFreewheelDriver::Process() | |||
| jack_log("JackFreewheelDriver::Process master %lld", fEngineControl->fTimeOutUsecs); | |||
| JackDriver::CycleTakeBeginTime(); | |||
| 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"); | |||
| return -1; | |||
| } | |||
| } else { | |||
| fGraphManager->ResumeRefNum(fClientControl, fSynchroTable); // Signal all clients | |||
| fGraphManager->ResumeRefNum(&fClientControl, fSynchroTable); // Signal all clients | |||
| 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"); | |||
| return -1; | |||
| } | |||
| @@ -45,9 +45,9 @@ int JackLoopbackDriver::Process() | |||
| 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 (fGraphManager->SuspendRefNum(fClientControl, fSynchroTable, fEngineControl->fTimeOutUsecs) < 0) { | |||
| if (fGraphManager->SuspendRefNum(&fClientControl, fSynchroTable, fEngineControl->fTimeOutUsecs) < 0) { | |||
| jack_error("JackLoopbackDriver::ProcessSync SuspendRefNum error"); | |||
| return -1; | |||
| } | |||
| @@ -324,8 +324,8 @@ namespace Jack | |||
| 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 ( 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 ) | |||
| { | |||
| 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++ ) | |||
| { | |||
| 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 ) | |||
| { | |||
| 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++ ) | |||
| { | |||
| 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 ) | |||
| { | |||
| 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++ ) | |||
| { | |||
| 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 ) | |||
| { | |||
| jack_error ( "driver: cannot register port for %s", name ); | |||
| @@ -392,13 +392,13 @@ namespace Jack | |||
| { | |||
| jack_log ( "JackNetDriver::FreePorts" ); | |||
| 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++ ) | |||
| 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++ ) | |||
| 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++ ) | |||
| fGraphManager->ReleasePort ( fClientControl->fRefNum, fMidiPlaybackPortList[port_index] ); | |||
| fGraphManager->ReleasePort ( fClientControl.fRefNum, fMidiPlaybackPortList[port_index] ); | |||
| return 0; | |||
| } | |||
| @@ -2136,8 +2136,8 @@ int JackAlsaDriver::Attach() | |||
| for (int i = 0; i < fCaptureChannels; i++) { | |||
| 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); | |||
| return -1; | |||
| } | |||
| @@ -2152,8 +2152,8 @@ int JackAlsaDriver::Attach() | |||
| for (int i = 0; i < fPlaybackChannels; i++) { | |||
| 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); | |||
| return -1; | |||
| } | |||
| @@ -2168,8 +2168,8 @@ int JackAlsaDriver::Attach() | |||
| // Monitor ports | |||
| if (fWithMonitorPorts) { | |||
| 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); | |||
| } else { | |||
| 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) | |||
| { | |||
| 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; | |||
| } | |||
| 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) | |||
| @@ -508,9 +508,9 @@ int JackFFADODriver::Attach() | |||
| 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) { | |||
| 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); | |||
| if ((port_index = fGraphManager->AllocatePort(fClientControl->fRefNum, buf, | |||
| if ((port_index = fGraphManager->AllocatePort(fClientControl.fRefNum, buf, | |||
| JACK_DEFAULT_AUDIO_TYPE, | |||
| (JackPortFlags)port_flags, | |||
| fEngineControl->fBufferSize)) == NO_PORT) { | |||
| @@ -531,9 +531,9 @@ int JackFFADODriver::Attach() | |||
| fCaptureChannels++; | |||
| } 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); | |||
| if ((port_index = fGraphManager->AllocatePort(fClientControl->fRefNum, buf, | |||
| if ((port_index = fGraphManager->AllocatePort(fClientControl.fRefNum, buf, | |||
| JACK_DEFAULT_MIDI_TYPE, | |||
| (JackPortFlags)port_flags, | |||
| 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); | |||
| 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); | |||
| if ((port_index = fGraphManager->AllocatePort(fClientControl->fRefNum, buf, | |||
| if ((port_index = fGraphManager->AllocatePort(fClientControl.fRefNum, buf, | |||
| JACK_DEFAULT_AUDIO_TYPE, | |||
| (JackPortFlags)port_flags, | |||
| fEngineControl->fBufferSize)) == NO_PORT) { | |||
| @@ -607,9 +607,9 @@ int JackFFADODriver::Attach() | |||
| jack_log("JackFFADODriver::Attach fPlaybackPortList[i] %ld ", port_index); | |||
| fPlaybackChannels++; | |||
| } 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); | |||
| if ((port_index = fGraphManager->AllocatePort(fClientControl->fRefNum, buf, | |||
| if ((port_index = fGraphManager->AllocatePort(fClientControl.fRefNum, buf, | |||
| JACK_DEFAULT_MIDI_TYPE, | |||
| (JackPortFlags)port_flags, | |||
| fEngineControl->fBufferSize)) == NO_PORT) { | |||
| @@ -730,14 +730,14 @@ int JackFreebobDriver::Attach() | |||
| for (unsigned int i = 0; i < driver->capture_nchannels; i++) { | |||
| 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) { | |||
| printMessage ("Don't register capture port %s", buf); | |||
| } else { | |||
| 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, | |||
| (JackPortFlags)port_flags, | |||
| fEngineControl->fBufferSize)) == NO_PORT) { | |||
| @@ -761,13 +761,13 @@ int JackFreebobDriver::Attach() | |||
| for (unsigned int i = 0; i < driver->playback_nchannels; i++) { | |||
| 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) { | |||
| printMessage ("Don't register playback port %s", buf); | |||
| } else { | |||
| 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, | |||
| (JackPortFlags)port_flags, | |||
| fEngineControl->fBufferSize)) == NO_PORT) { | |||
| @@ -973,9 +973,9 @@ int JackCoreAudioDriver::Attach() | |||
| 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); | |||
| return -1; | |||
| } | |||
| @@ -1012,9 +1012,9 @@ int JackCoreAudioDriver::Attach() | |||
| 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); | |||
| return -1; | |||
| } | |||
| @@ -1039,7 +1039,7 @@ int JackCoreAudioDriver::Attach() | |||
| if (fWithMonitorPorts) { | |||
| jack_log("Create monitor port "); | |||
| 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); | |||
| return -1; | |||
| } else { | |||