git-svn-id: http://subversion.jackaudio.org/jack/jack2/trunk/jackmp@4601 0c269be4-1314-0410-8aa9-9f06e86f4224tags/1.9.8
@@ -35,10 +35,7 @@ namespace Jack | |||||
{ | { | ||||
JackAudioDriver::JackAudioDriver(const char* name, const char* alias, JackLockedEngine* engine, JackSynchro* table) | JackAudioDriver::JackAudioDriver(const char* name, const char* alias, JackLockedEngine* engine, JackSynchro* table) | ||||
: JackDriver(name, alias, engine, table), | |||||
fCaptureChannels(0), | |||||
fPlaybackChannels(0), | |||||
fWithMonitorPorts(false) | |||||
: JackDriver(name, alias, engine, table) | |||||
{} | {} | ||||
JackAudioDriver::~JackAudioDriver() | JackAudioDriver::~JackAudioDriver() | ||||
@@ -445,42 +442,4 @@ void JackAudioDriver::HandleLatencyCallback(int status) | |||||
} | } | ||||
} | } | ||||
void JackAudioDriver::SaveConnections() | |||||
{ | |||||
const char** connections; | |||||
fConnections.clear(); | |||||
for (int i = 0; i < fCaptureChannels; ++i) { | |||||
if (fCapturePortList[i] && (connections = fGraphManager->GetConnections(fCapturePortList[i])) != 0) { | |||||
for (int j = 0; connections[j]; j++) { | |||||
fConnections.push_back(make_pair(fGraphManager->GetPort(fCapturePortList[i])->GetName(), connections[j])); | |||||
jack_info("Save connection: %s %s", fGraphManager->GetPort(fCapturePortList[i])->GetName(), connections[j]); | |||||
} | |||||
free(connections); | |||||
} | |||||
} | |||||
for (int i = 0; i < fPlaybackChannels; ++i) { | |||||
if (fPlaybackPortList[i] && (connections = fGraphManager->GetConnections(fPlaybackPortList[i])) != 0) { | |||||
for (int j = 0; connections[j]; j++) { | |||||
fConnections.push_back(make_pair(connections[j], fGraphManager->GetPort(fPlaybackPortList[i])->GetName())); | |||||
jack_info("Save connection: %s %s", connections[j], fGraphManager->GetPort(fPlaybackPortList[i])->GetName()); | |||||
} | |||||
free(connections); | |||||
} | |||||
} | |||||
} | |||||
void JackAudioDriver::RestoreConnections() | |||||
{ | |||||
list<pair<string, string> >::const_iterator it; | |||||
for (it = fConnections.begin(); it != fConnections.end(); it++) { | |||||
pair<string, string> connection = *it; | |||||
jack_info("Restore connection: %s %s", connection.first.c_str(), connection.second.c_str()); | |||||
fEngine->PortConnect(fClientControl.fRefNum, connection.first.c_str(), connection.second.c_str()); | |||||
} | |||||
} | |||||
} // end of namespace | } // end of namespace |
@@ -35,19 +35,6 @@ class SERVER_EXPORT JackAudioDriver : public JackDriver | |||||
protected: | protected: | ||||
int fCaptureChannels; | |||||
int fPlaybackChannels; | |||||
// Static tables since the actual number of ports may be changed by the real driver | |||||
// thus dynamic allocation is more difficult to handle | |||||
jack_port_id_t fCapturePortList[DRIVER_PORT_NUM]; | |||||
jack_port_id_t fPlaybackPortList[DRIVER_PORT_NUM]; | |||||
jack_port_id_t fMonitorPortList[DRIVER_PORT_NUM]; | |||||
bool fWithMonitorPorts; | |||||
std::list<std::pair<std::string, std::string> > fConnections; // Connections list | |||||
jack_default_audio_sample_t* GetInputBuffer(int port_index); | jack_default_audio_sample_t* GetInputBuffer(int port_index); | ||||
jack_default_audio_sample_t* GetOutputBuffer(int port_index); | jack_default_audio_sample_t* GetOutputBuffer(int port_index); | ||||
jack_default_audio_sample_t* GetMonitorBuffer(int port_index); | jack_default_audio_sample_t* GetMonitorBuffer(int port_index); | ||||
@@ -105,9 +92,6 @@ class SERVER_EXPORT JackAudioDriver : public JackDriver | |||||
virtual int SetBufferSize(jack_nframes_t buffer_size); | virtual int SetBufferSize(jack_nframes_t buffer_size); | ||||
virtual int SetSampleRate(jack_nframes_t sample_rate); | virtual int SetSampleRate(jack_nframes_t sample_rate); | ||||
virtual void SaveConnections(); | |||||
virtual void RestoreConnections(); | |||||
virtual int ClientNotify(int refnum, const char* name, int notify, int sync, const char* message, int value1, int value2); | virtual int ClientNotify(int refnum, const char* name, int notify, int sync, const char* message, int value1, int value2); | ||||
}; | }; | ||||
@@ -37,7 +37,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) | |||||
:fClientControl(name), | |||||
fCaptureChannels(0), | |||||
fPlaybackChannels(0), | |||||
fWithMonitorPorts(false) | |||||
{ | { | ||||
assert(strlen(name) < JACK_CLIENT_NAME_SIZE); | assert(strlen(name) < JACK_CLIENT_NAME_SIZE); | ||||
fSynchroTable = table; | fSynchroTable = table; | ||||
@@ -59,6 +62,9 @@ JackDriver::JackDriver() | |||||
fDelayedUsecs = 0.f; | fDelayedUsecs = 0.f; | ||||
fIsMaster = true; | fIsMaster = true; | ||||
fIsRunning = false; | fIsRunning = false; | ||||
fCaptureChannels = 0; | |||||
fPlaybackChannels = 0; | |||||
fWithMonitorPorts = false; | |||||
} | } | ||||
JackDriver::~JackDriver() | JackDriver::~JackDriver() | ||||
@@ -446,4 +452,42 @@ bool JackDriver::Initialize() | |||||
return true; | return true; | ||||
} | } | ||||
void JackDriver::SaveConnections() | |||||
{ | |||||
const char** connections; | |||||
fConnections.clear(); | |||||
for (int i = 0; i < fCaptureChannels; ++i) { | |||||
if (fCapturePortList[i] && (connections = fGraphManager->GetConnections(fCapturePortList[i])) != 0) { | |||||
for (int j = 0; connections[j]; j++) { | |||||
fConnections.push_back(make_pair(fGraphManager->GetPort(fCapturePortList[i])->GetName(), connections[j])); | |||||
jack_info("Save connection: %s %s", fGraphManager->GetPort(fCapturePortList[i])->GetName(), connections[j]); | |||||
} | |||||
free(connections); | |||||
} | |||||
} | |||||
for (int i = 0; i < fPlaybackChannels; ++i) { | |||||
if (fPlaybackPortList[i] && (connections = fGraphManager->GetConnections(fPlaybackPortList[i])) != 0) { | |||||
for (int j = 0; connections[j]; j++) { | |||||
fConnections.push_back(make_pair(connections[j], fGraphManager->GetPort(fPlaybackPortList[i])->GetName())); | |||||
jack_info("Save connection: %s %s", connections[j], fGraphManager->GetPort(fPlaybackPortList[i])->GetName()); | |||||
} | |||||
free(connections); | |||||
} | |||||
} | |||||
} | |||||
void JackDriver::RestoreConnections() | |||||
{ | |||||
list<pair<string, string> >::const_iterator it; | |||||
for (it = fConnections.begin(); it != fConnections.end(); it++) { | |||||
pair<string, string> connection = *it; | |||||
jack_info("Restore connection: %s %s", connection.first.c_str(), connection.second.c_str()); | |||||
fEngine->PortConnect(fClientControl.fRefNum, connection.first.c_str(), connection.second.c_str()); | |||||
} | |||||
} | |||||
} // end of namespace | } // end of namespace |
@@ -129,12 +129,16 @@ class SERVER_EXPORT JackDriver : public JackDriverClientInterface | |||||
char fCaptureDriverName[JACK_CLIENT_NAME_SIZE + 1]; | char fCaptureDriverName[JACK_CLIENT_NAME_SIZE + 1]; | ||||
char fPlaybackDriverName[JACK_CLIENT_NAME_SIZE + 1]; | char fPlaybackDriverName[JACK_CLIENT_NAME_SIZE + 1]; | ||||
char fAliasName[JACK_CLIENT_NAME_SIZE + 1]; | char fAliasName[JACK_CLIENT_NAME_SIZE + 1]; | ||||
jack_nframes_t fCaptureLatency; | jack_nframes_t fCaptureLatency; | ||||
jack_nframes_t fPlaybackLatency; | jack_nframes_t fPlaybackLatency; | ||||
jack_time_t fBeginDateUst; | jack_time_t fBeginDateUst; | ||||
jack_time_t fEndDateUst; | jack_time_t fEndDateUst; | ||||
float fDelayedUsecs; | float fDelayedUsecs; | ||||
JackLockedEngine* fEngine; | JackLockedEngine* fEngine; | ||||
JackGraphManager* fGraphManager; | JackGraphManager* fGraphManager; | ||||
JackSynchro* fSynchroTable; | JackSynchro* fSynchroTable; | ||||
@@ -144,6 +148,19 @@ class SERVER_EXPORT JackDriver : public JackDriverClientInterface | |||||
bool fIsMaster; | bool fIsMaster; | ||||
bool fIsRunning; | bool fIsRunning; | ||||
int fCaptureChannels; | |||||
int fPlaybackChannels; | |||||
// Static tables since the actual number of ports may be changed by the real driver | |||||
// thus dynamic allocation is more difficult to handle | |||||
jack_port_id_t fCapturePortList[DRIVER_PORT_NUM]; | |||||
jack_port_id_t fPlaybackPortList[DRIVER_PORT_NUM]; | |||||
jack_port_id_t fMonitorPortList[DRIVER_PORT_NUM]; | |||||
bool fWithMonitorPorts; | |||||
std::list<std::pair<std::string, std::string> > fConnections; // Connections list | |||||
void CycleIncTime(); | void CycleIncTime(); | ||||
void CycleTakeBeginTime(); | void CycleTakeBeginTime(); | ||||
void CycleTakeEndTime(); | void CycleTakeEndTime(); | ||||
@@ -198,7 +215,7 @@ class SERVER_EXPORT JackDriver : public JackDriverClientInterface | |||||
virtual int Close(); | virtual int Close(); | ||||
virtual int Process(); | virtual int Process(); | ||||
virtual int Attach(); | virtual int Attach(); | ||||
virtual int Detach(); | virtual int Detach(); | ||||
@@ -217,6 +234,9 @@ class SERVER_EXPORT JackDriver : public JackDriverClientInterface | |||||
int ProcessRead(); | int ProcessRead(); | ||||
int ProcessWrite(); | int ProcessWrite(); | ||||
virtual void SaveConnections(); | |||||
virtual void RestoreConnections(); | |||||
virtual bool IsFixedBufferSize(); | virtual bool IsFixedBufferSize(); | ||||
virtual int SetBufferSize(jack_nframes_t buffer_size); | virtual int SetBufferSize(jack_nframes_t buffer_size); | ||||
virtual int SetSampleRate(jack_nframes_t sample_rate); | virtual int SetSampleRate(jack_nframes_t sample_rate); | ||||
@@ -33,9 +33,7 @@ namespace Jack | |||||
{ | { | ||||
JackMidiDriver::JackMidiDriver(const char* name, const char* alias, JackLockedEngine* engine, JackSynchro* table) | JackMidiDriver::JackMidiDriver(const char* name, const char* alias, JackLockedEngine* engine, JackSynchro* table) | ||||
: JackDriver(name, alias, engine, table), | |||||
fCaptureChannels(0), | |||||
fPlaybackChannels(0) | |||||
: JackDriver(name, alias, engine, table) | |||||
{} | {} | ||||
JackMidiDriver::~JackMidiDriver() | JackMidiDriver::~JackMidiDriver() | ||||
@@ -224,42 +222,4 @@ JackMidiBuffer* JackMidiDriver::GetOutputBuffer(int port_index) | |||||
return (JackMidiBuffer*)fGraphManager->GetBuffer(fPlaybackPortList[port_index], fEngineControl->fBufferSize); | return (JackMidiBuffer*)fGraphManager->GetBuffer(fPlaybackPortList[port_index], fEngineControl->fBufferSize); | ||||
} | } | ||||
void JackMidiDriver::SaveConnections() | |||||
{ | |||||
const char** connections; | |||||
fConnections.clear(); | |||||
for (int i = 0; i < fCaptureChannels; ++i) { | |||||
if (fCapturePortList[i] && (connections = fGraphManager->GetConnections(fCapturePortList[i])) != 0) { | |||||
for (int j = 0; connections[j]; j++) { | |||||
fConnections.push_back(make_pair(fGraphManager->GetPort(fCapturePortList[i])->GetName(), connections[j])); | |||||
jack_info("Save connection: %s %s", fGraphManager->GetPort(fCapturePortList[i])->GetName(), connections[j]); | |||||
} | |||||
free(connections); | |||||
} | |||||
} | |||||
for (int i = 0; i < fPlaybackChannels; ++i) { | |||||
if (fPlaybackPortList[i] && (connections = fGraphManager->GetConnections(fPlaybackPortList[i])) != 0) { | |||||
for (int j = 0; connections[j]; j++) { | |||||
fConnections.push_back(make_pair(connections[j], fGraphManager->GetPort(fPlaybackPortList[i])->GetName())); | |||||
jack_info("Save connection: %s %s", connections[j], fGraphManager->GetPort(fPlaybackPortList[i])->GetName()); | |||||
} | |||||
free(connections); | |||||
} | |||||
} | |||||
} | |||||
void JackMidiDriver::RestoreConnections() | |||||
{ | |||||
list<pair<string, string> >::const_iterator it; | |||||
for (it = fConnections.begin(); it != fConnections.end(); it++) { | |||||
pair<string, string> connection = *it; | |||||
jack_info("Restore connection: %s %s", connection.first.c_str(), connection.second.c_str()); | |||||
fEngine->PortConnect(fClientControl.fRefNum, connection.first.c_str(), connection.second.c_str()); | |||||
} | |||||
} | |||||
} // end of namespace | } // end of namespace |
@@ -37,14 +37,6 @@ class SERVER_EXPORT JackMidiDriver : public JackDriver | |||||
protected: | protected: | ||||
int fCaptureChannels; | |||||
int fPlaybackChannels; | |||||
std::list<std::pair<std::string, std::string> > fConnections; // Connections list | |||||
jack_port_id_t fCapturePortList[DRIVER_PORT_NUM]; | |||||
jack_port_id_t fPlaybackPortList[DRIVER_PORT_NUM]; | |||||
JackMidiBuffer* GetInputBuffer(int port_index); | JackMidiBuffer* GetInputBuffer(int port_index); | ||||
JackMidiBuffer* GetOutputBuffer(int port_index); | JackMidiBuffer* GetOutputBuffer(int port_index); | ||||
@@ -56,9 +48,6 @@ class SERVER_EXPORT JackMidiDriver : public JackDriver | |||||
virtual void UpdateLatencies(); | virtual void UpdateLatencies(); | ||||
void SaveConnections(); | |||||
void RestoreConnections(); | |||||
public: | public: | ||||
JackMidiDriver(const char* name, const char* alias, JackLockedEngine* engine, JackSynchro* table); | JackMidiDriver(const char* name, const char* alias, JackLockedEngine* engine, JackSynchro* table); | ||||