Browse Source

Remove use of try/catch during internal client loading, set default nperiod to 2 in JackAlsaAdpter.

git-svn-id: http://subversion.jackaudio.org/jack/jack2/trunk/jackmp@2904 0c269be4-1314-0410-8aa9-9f06e86f4224
tags/1.90
sletz 15 years ago
parent
commit
9d0aa7e864
4 changed files with 44 additions and 35 deletions
  1. +19
    -12
      common/JackInternalClient.cpp
  2. +6
    -8
      common/JackInternalClient.h
  3. +17
    -15
      common/JackServer.cpp
  4. +2
    -0
      linux/alsa/JackAlsaAdapter.cpp

+ 19
- 12
common/JackInternalClient.cpp View File

@@ -171,7 +171,7 @@ JackClientControl* JackInternalClient::GetClientControl() const
return const_cast<JackClientControl*>(&fClientControl);
}

void JackLoadableInternalClient::Init(const char* so_name)
int JackLoadableInternalClient::Init(const char* so_name)
{
char path_to_so[JACK_PATH_MAX + 1];
BuildClientPath(path_to_so, sizeof(path_to_so), so_name);
@@ -181,58 +181,65 @@ void JackLoadableInternalClient::Init(const char* so_name)

if (fHandle == 0) {
PrintLoadError(so_name);
throw - 1;
return -1;
}

fFinish = (FinishCallback)GetJackProc(fHandle, "jack_finish");
if (!fFinish) {
UnloadJackModule(fHandle);
jack_error("symbol jack_finish cannot be found in %s", so_name);
throw - 1;
return -1;
}

fDescriptor = (JackDriverDescFunction)GetJackProc(fHandle, "jack_get_descriptor");
if (!fDescriptor) {
jack_info("No jack_get_descriptor entry-point for %s", so_name);
}
return 0;
}

void JackLoadableInternalClient1::Init(const char* so_name)
int JackLoadableInternalClient1::Init(const char* so_name)
{
JackLoadableInternalClient::Init(so_name);
if (JackLoadableInternalClient::Init(so_name) < 0) {
return -1;
}
fInitialize = (InitializeCallback)GetJackProc(fHandle, "jack_initialize");
if (!fInitialize) {
UnloadJackModule(fHandle);
jack_error("symbol jack_initialize cannot be found in %s", so_name);
throw - 1;
return -1;
}

return 0;
}

void JackLoadableInternalClient2::Init(const char* so_name)
int JackLoadableInternalClient2::Init(const char* so_name)
{
JackLoadableInternalClient::Init(so_name);
if (JackLoadableInternalClient::Init(so_name) < 0) {
return -1;
}
fInitialize = (InternalInitializeCallback)GetJackProc(fHandle, "jack_internal_initialize");
if (!fInitialize) {
UnloadJackModule(fHandle);
jack_error("symbol jack_internal_initialize cannot be found in %s", so_name);
throw - 1;
return -1;
}

return 0;
}

JackLoadableInternalClient1::JackLoadableInternalClient1(JackServer* server, JackSynchro* table, const char* so_name, const char* object_data)
: JackLoadableInternalClient(server, table)
{
snprintf(fObjectData, JACK_LOAD_INIT_LIMIT, object_data);
Init(so_name);
snprintf(fObjectData, JACK_LOAD_INIT_LIMIT, object_data);
}

JackLoadableInternalClient2::JackLoadableInternalClient2(JackServer* server, JackSynchro* table, const char* so_name, const JSList* parameters)
: JackLoadableInternalClient(server, table)
{
fParameters = parameters;
Init(so_name);
}

JackLoadableInternalClient::~JackLoadableInternalClient()


+ 6
- 8
common/JackInternalClient.h View File

@@ -92,8 +92,6 @@ class JackLoadableInternalClient : public JackInternalClient
HANDLE fHandle;
FinishCallback fFinish;
JackDriverDescFunction fDescriptor;
virtual void Init(const char* so_name);

public:

@@ -102,6 +100,8 @@ class JackLoadableInternalClient : public JackInternalClient
{}
virtual ~JackLoadableInternalClient();

virtual int Init(const char* so_name);

};

class JackLoadableInternalClient1 : public JackLoadableInternalClient
@@ -111,15 +111,14 @@ class JackLoadableInternalClient1 : public JackLoadableInternalClient

InitializeCallback fInitialize;
char fObjectData[JACK_LOAD_INIT_LIMIT];
void Init(const char* so_name);

public:

JackLoadableInternalClient1(JackServer* server, JackSynchro* table, const char* so_name, const char* object_data);
virtual ~JackLoadableInternalClient1()
{}

int Init(const char* so_name);
int Open(const char* server_name, const char* name, jack_options_t options, jack_status_t* status);

};
@@ -131,15 +130,14 @@ class JackLoadableInternalClient2 : public JackLoadableInternalClient

InternalInitializeCallback fInitialize;
const JSList* fParameters;
void Init(const char* so_name);

public:

JackLoadableInternalClient2(JackServer* server, JackSynchro* table, const char* so_name, const JSList* parameters);
virtual ~JackLoadableInternalClient2()
{}

int Init(const char* so_name);
int Open(const char* server_name, const char* name, jack_options_t options, jack_status_t* status);

};


+ 17
- 15
common/JackServer.cpp View File

@@ -153,30 +153,32 @@ int JackServer::Close()

int JackServer::InternalClientLoad(const char* client_name, const char* so_name, const char* objet_data, int options, int* int_ref, int* status)
{
try {
JackLoadableInternalClient* client = new JackLoadableInternalClient1(fInstance, GetSynchroTable(), so_name, objet_data);
assert(client);
return InternalClientLoadAux(client, client_name, options, int_ref, status);
} catch (...) {
int my_status1 = *status | JackFailure;
JackLoadableInternalClient* client = new JackLoadableInternalClient1(fInstance, GetSynchroTable(), so_name, objet_data);
assert(client);

if (client->Init(so_name) < 0) {
int my_status1 = *status | JackFailure;
*status = (jack_status_t)my_status1;
*int_ref = 0;
return -1;
return -1;
}
}

return InternalClientLoadAux(client, client_name, options, int_ref, status);
}

int JackServer::InternalClientLoad(const char* client_name, const char* so_name, const JSList * parameters, int options, int* int_ref, int* status)
{
try {
JackLoadableInternalClient* client = new JackLoadableInternalClient2(fInstance, GetSynchroTable(), so_name, parameters);
assert(client);
return InternalClientLoadAux(client, client_name, options, int_ref, status);
} catch (...) {
int my_status1 = *status | JackFailure;
JackLoadableInternalClient* client = new JackLoadableInternalClient2(fInstance, GetSynchroTable(), so_name, parameters);
assert(client);
if (client->Init(so_name) < 0) {
int my_status1 = *status | JackFailure;
*status = (jack_status_t)my_status1;
*int_ref = 0;
return -1;
return -1;
}

return InternalClientLoadAux(client, client_name, options, int_ref, status);
}

int JackServer::InternalClientLoadAux(JackLoadableInternalClient* client, const char* client_name, int options, int* int_ref, int* status)


+ 2
- 0
linux/alsa/JackAlsaAdapter.cpp View File

@@ -39,6 +39,8 @@ namespace Jack
fCaptureChannels = 2;
fPlaybackChannels = 2;

fAudioInterface.fPeriod = 2;

for ( node = params; node; node = jack_slist_next ( node ) )
{
param = ( const jack_driver_param_t* ) node->data;


Loading…
Cancel
Save