Browse Source

Correct JackClient::OnShutdown.

tags/v1.9.10
Stephane Letz 12 years ago
parent
commit
ddb61e607b
6 changed files with 55 additions and 53 deletions
  1. +3
    -0
      common/JackClient.cpp
  2. +11
    -11
      common/JackEngine.cpp
  3. +4
    -4
      common/JackNetManager.cpp
  4. +4
    -4
      common/JackServerGlobals.cpp
  5. +30
    -31
      linux/JackLinuxTime.c
  6. +3
    -3
      posix/JackPosixServerLaunch.cpp

+ 3
- 0
common/JackClient.cpp View File

@@ -975,6 +975,8 @@ void JackClient::OnShutdown(JackShutdownCallback callback, void *arg)
if (IsActive()) {
jack_error("You cannot set callbacks on an active client");
} else {
// Shutdown callback will either be an old API version or the new version (with info)
GetClientControl()->fCallback[kShutDownCallback] = (callback != NULL);
fShutdownArg = arg;
fShutdown = callback;
}
@@ -985,6 +987,7 @@ void JackClient::OnInfoShutdown(JackInfoShutdownCallback callback, void *arg)
if (IsActive()) {
jack_error("You cannot set callbacks on an active client");
} else {
// Shutdown callback will either be an old API version or the new version (with info)
GetClientControl()->fCallback[kShutDownCallback] = (callback != NULL);
fInfoShutdownArg = arg;
fInfoShutdown = callback;


+ 11
- 11
common/JackEngine.cpp View File

@@ -264,24 +264,24 @@ int JackEngine::ClientNotify(JackClientInterface* client, int refnum, const char
return 0;
}
int ret;
int res1;
// External client
if (dynamic_cast<JackExternalClient*>(client)) {
ret = client->ClientNotify(refnum, name, notify, sync, message, value1, value2);
res1 = client->ClientNotify(refnum, name, notify, sync, message, value1, value2);
// Important for internal client : unlock before calling the notification callbacks
} else {
bool res = Unlock();
ret = client->ClientNotify(refnum, name, notify, sync, message, value1, value2);
if (res) {
bool res2 = Unlock();
res1 = client->ClientNotify(refnum, name, notify, sync, message, value1, value2);
if (res2) {
Lock();
}
}
if (ret < 0) {
if (res1 < 0) {
jack_error("ClientNotify fails name = %s notification = %ld val1 = %ld val2 = %ld", name, notify, value1, value2);
}
return ret;
return res1;
}

void JackEngine::NotifyClient(int refnum, int event, int sync, const char* message, int value1, int value2)
@@ -958,22 +958,22 @@ int JackEngine::PortDisconnect(int refnum, jack_port_id_t src, jack_port_id_t ds
fGraphManager->GetConnections(src, connections);

JackPort* port = fGraphManager->GetPort(src);
int ret = 0;
int res = 0;
if (port->GetFlags() & JackPortIsOutput) {
for (int i = 0; (i < CONNECTION_NUM_FOR_PORT) && (connections[i] != EMPTY); i++) {
if (PortDisconnect(refnum, src, connections[i]) != 0) {
ret = -1;
res = -1;
}
}
} else {
for (int i = 0; (i < CONNECTION_NUM_FOR_PORT) && (connections[i] != EMPTY); i++) {
if (PortDisconnect(refnum, connections[i], src) != 0) {
ret = -1;
res = -1;
}
}
}

return ret;
return res;
} else if (fGraphManager->CheckPorts(src, dst) < 0) {
return -1;
} else if (fGraphManager->Disconnect(src, dst) == 0) {


+ 4
- 4
common/JackNetManager.cpp View File

@@ -640,15 +640,15 @@ namespace Jack
int JackNetMasterManager::SyncCallback(jack_transport_state_t state, jack_position_t* pos)
{
//check if each slave is ready to roll
int ret = 1;
int res = 1;
master_list_it_t it;
for (it = fMasterList.begin(); it != fMasterList.end(); it++) {
if (!(*it)->IsSlaveReadyToRoll()) {
ret = 0;
res = 0;
}
}
jack_log("JackNetMasterManager::SyncCallback returns '%s'", (ret) ? "true" : "false");
return ret;
jack_log("JackNetMasterManager::SyncCallback returns '%s'", (res) ? "true" : "false");
return res;
}

void* JackNetMasterManager::NetManagerThread(void* arg)


+ 4
- 4
common/JackServerGlobals.cpp View File

@@ -114,7 +114,7 @@ bool JackServerGlobals::Init()
int loopback = 0;
int sync = 0;
int rc, i;
int ret;
int res;
int replace_registry = 0;

FILE* fp = 0;
@@ -174,11 +174,11 @@ bool JackServerGlobals::Init()

argc = 0;
if (fp) {
ret = fscanf(fp, "%s", buffer);
while (ret != 0 && ret != EOF) {
res = fscanf(fp, "%s", buffer);
while (res != 0 && res != EOF) {
argv[argc] = (char*)malloc(64);
strcpy(argv[argc], buffer);
ret = fscanf(fp, "%s", buffer);
res = fscanf(fp, "%s", buffer);
argc++;
}
fclose(fp);


+ 30
- 31
linux/JackLinuxTime.c View File

@@ -140,7 +140,7 @@ static jack_time_t jack_get_mhz (void)
if (f == 0)
{
perror("can't open /proc/cpuinfo\n");
exit(1);
exit(1); // TODO : should be remplaced by an exception
}

for (;;)
@@ -150,9 +150,8 @@ static jack_time_t jack_get_mhz (void)
char buf[1000];

if (fgets(buf, sizeof(buf), f) == NULL) {
jack_error ("FATAL: cannot locate cpu MHz in "
"/proc/cpuinfo\n");
exit(1);
jack_error ("FATAL: cannot locate cpu MHz in /proc/cpuinfo\n");
exit(1); // TODO : should be remplaced by an exception
}

#if defined(__powerpc__)
@@ -225,42 +224,42 @@ SERVER_EXPORT void EndTime()

void SetClockSource(jack_timer_type_t source)
{
jack_log("Clock source : %s", ClockSourceName(source));
jack_log("Clock source : %s", ClockSourceName(source));

switch (source)
{
case JACK_TIMER_CYCLE_COUNTER:
_jack_get_microseconds = jack_get_microseconds_from_cycles;
break;
case JACK_TIMER_HPET:
if (jack_hpet_init () == 0) {
_jack_get_microseconds = jack_get_microseconds_from_hpet;
} else {
_jack_get_microseconds = jack_get_microseconds_from_system;
}
break;
case JACK_TIMER_SYSTEM_CLOCK:
default:
_jack_get_microseconds = jack_get_microseconds_from_system;
break;
case JACK_TIMER_CYCLE_COUNTER:
_jack_get_microseconds = jack_get_microseconds_from_cycles;
break;
case JACK_TIMER_HPET:
if (jack_hpet_init () == 0) {
_jack_get_microseconds = jack_get_microseconds_from_hpet;
} else {
_jack_get_microseconds = jack_get_microseconds_from_system;
}
break;
case JACK_TIMER_SYSTEM_CLOCK:
default:
_jack_get_microseconds = jack_get_microseconds_from_system;
break;
}
}

const char* ClockSourceName(jack_timer_type_t source)
{
switch (source) {
case JACK_TIMER_CYCLE_COUNTER:
return "cycle counter";
case JACK_TIMER_HPET:
return "hpet";
case JACK_TIMER_SYSTEM_CLOCK:
#ifdef HAVE_CLOCK_GETTIME
return "system clock via clock_gettime";
#else
return "system clock via gettimeofday";
#endif
case JACK_TIMER_CYCLE_COUNTER:
return "cycle counter";
case JACK_TIMER_HPET:
return "hpet";
case JACK_TIMER_SYSTEM_CLOCK:
#ifdef HAVE_CLOCK_GETTIME
return "system clock via clock_gettime";
#else
return "system clock via gettimeofday";
#endif
}

/* what is wrong with gcc ? */


+ 3
- 3
posix/JackPosixServerLaunch.cpp View File

@@ -93,7 +93,7 @@ static void start_server_classic_aux(const char* server_name)
char** argv = 0;
int i = 0;
int good = 0;
int ret;
int res;

snprintf(filename, 255, "%s/.jackdrc", getenv("HOME"));
fp = fopen(filename, "r");
@@ -108,11 +108,11 @@ static void start_server_classic_aux(const char* server_name)

if (fp) {
arguments[0] = '\0';
ret = fscanf(fp, "%s", buffer);
res = fscanf(fp, "%s", buffer);
while (ret != 0 && ret != EOF) {
strcat(arguments, buffer);
strcat(arguments, " ");
ret = fscanf(fp, "%s", buffer);
res = fscanf(fp, "%s", buffer);
}
if (strlen(arguments) > 0) {
good = 1;


Loading…
Cancel
Save