summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog8
-rw-r--r--common/JackChannel.h17
-rw-r--r--common/JackClient.cpp18
-rw-r--r--common/JackEngine.cpp8
-rw-r--r--common/JackNotification.h8
-rw-r--r--common/JackRequest.h6
-rw-r--r--macosx/JackMachServerChannel.cpp3
-rw-r--r--macosx/Jackdmp.xcodeproj/project.pbxproj2
8 files changed, 35 insertions, 35 deletions
diff --git a/ChangeLog b/ChangeLog
index 8a8b54ee..5224de7e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -2,6 +2,14 @@
Jackdmp changes log
---------------------------
+2007-06-09 Stephane Letz <letz@grame.fr>
+
+ * Checking in the server to avoid calling the clients if no callback are registered.
+
+2007-06-08 Stephane Letz <letz@grame.fr>
+
+ * New JackNotication.h header in preparation for callback checking in the server.
+
2007-05-29 Stephane Letz <letz@grame.fr>
* Add "callback exiting" and "jack_frame_time" tests in jack_test.
diff --git a/common/JackChannel.h b/common/JackChannel.h
index 774492c3..27b151df 100644
--- a/common/JackChannel.h
+++ b/common/JackChannel.h
@@ -135,23 +135,6 @@ class JackNotifyChannelInterface
virtual void ClientNotify(int refnum, const char* name, int notify, int sync, int value, int* result)
{}
- /*
- enum NotificationType {
- kAddClient = 0,
- kRemoveClient = 1,
- kActivateClient = 2,
- kXRunCallback = 3,
- kGraphOrderCallback = 4,
- kBufferSizeCallback = 5,
- kStartFreewheel = 6,
- kStopFreewheel = 7,
- kPortRegistrationOn = 8,
- kPortRegistrationOff = 9,
- kZombifyClient = 10,
- kDeadClient = 11,
- kMaxType
- };
- */
};
/*!
diff --git a/common/JackClient.cpp b/common/JackClient.cpp
index 92393203..8e1fba96 100644
--- a/common/JackClient.cpp
+++ b/common/JackClient.cpp
@@ -175,7 +175,7 @@ int JackClient::ClientNotify(int refnum, const char* name, int notify, int sync,
res = fGraphOrder(fGraphOrderArg);
break;
- case kStartFreewheel:
+ case kStartFreewheelCallback:
JackLog("JackClient::kStartFreewheel\n");
SetupDriverSync(true);
fThread->DropRealTime();
@@ -183,7 +183,7 @@ int JackClient::ClientNotify(int refnum, const char* name, int notify, int sync,
fFreewheel(1, fFreewheelArg);
break;
- case kStopFreewheel:
+ case kStopFreewheelCallback:
JackLog("JackClient::kStopFreewheel\n");
SetupDriverSync(false);
if (fFreewheel)
@@ -191,13 +191,13 @@ int JackClient::ClientNotify(int refnum, const char* name, int notify, int sync,
fThread->AcquireRealTime();
break;
- case kPortRegistrationOn:
+ case kPortRegistrationOnCallback:
JackLog("JackClient::kPortRegistrationOn port_index = %ld\n", value);
if (fPortRegistration)
fPortRegistration(value, 1, fPortRegistrationArg);
break;
- case kPortRegistrationOff:
+ case kPortRegistrationOffCallback:
JackLog("JackClient::kPortRegistrationOff port_index = %ld \n", value);
if (fPortRegistration)
fPortRegistration(value, 0, fPortRegistrationArg);
@@ -732,6 +732,7 @@ int JackClient::SetXRunCallback(JackXRunCallback callback, void *arg)
jack_error("You cannot set callbacks on an active client");
return -1;
} else {
+ GetClientControl()->fCallback[kXRunCallback] = (callback != NULL);
fXrunArg = arg;
fXrun = callback;
return 0;
@@ -758,6 +759,7 @@ int JackClient::SetGraphOrderCallback(JackGraphOrderCallback callback, void *arg
jack_error("You cannot set callbacks on an active client");
return -1;
} else {
+ GetClientControl()->fCallback[kGraphOrderCallback] = (callback != NULL);
fGraphOrder = callback;
fGraphOrderArg = arg;
return 0;
@@ -770,6 +772,7 @@ int JackClient::SetBufferSizeCallback(JackBufferSizeCallback callback, void *arg
jack_error("You cannot set callbacks on an active client");
return -1;
} else {
+ GetClientControl()->fCallback[kBufferSizeCallback] = (callback != NULL);
fBufferSizeArg = arg;
fBufferSize = callback;
return 0;
@@ -782,7 +785,8 @@ int JackClient::SetClientRegistrationCallback(JackClientRegistrationCallback cal
jack_error("You cannot set callbacks on an active client");
return -1;
} else {
- fPortRegistrationArg = arg;
+ // kAddClient and kRemoveClient notifications must be delivered by the server in any case
+ fClientRegistrationArg = arg;
fClientRegistration = callback;
return 0;
}
@@ -794,6 +798,8 @@ int JackClient::SetFreewheelCallback(JackFreewheelCallback callback, void *arg)
jack_error("You cannot set callbacks on an active client");
return -1;
} else {
+ GetClientControl()->fCallback[kStartFreewheelCallback] = (callback != NULL);
+ GetClientControl()->fCallback[kStopFreewheelCallback] = (callback != NULL);
fFreewheelArg = arg;
fFreewheel = callback;
return 0;
@@ -806,6 +812,8 @@ int JackClient::SetPortRegistrationCallback(JackPortRegistrationCallback callbac
jack_error("You cannot set callbacks on an active client");
return -1;
} else {
+ GetClientControl()->fCallback[kPortRegistrationOnCallback] = (callback != NULL);
+ GetClientControl()->fCallback[kPortRegistrationOffCallback] = (callback != NULL);
fPortRegistrationArg = arg;
fPortRegistration = callback;
return 0;
diff --git a/common/JackEngine.cpp b/common/JackEngine.cpp
index 9ad0c3ca..87f6bea0 100644
--- a/common/JackEngine.cpp
+++ b/common/JackEngine.cpp
@@ -248,7 +248,7 @@ void JackEngine::NotifyClient(int refnum, int event, int sync, int value)
{
JackClientInterface* client = fClientTable[refnum];
// The client may be notified by the RT thread while closing
- if (client) {
+ if (client && client->GetClientControl()->fCallback[event]) {
if (client->ClientNotify(refnum, client->GetClientControl()->fName, event, sync, value) < 0)
jack_error("NotifyClient fails name = %s event = %ld = val = %ld", client->GetClientControl()->fName, event, value);
} else {
@@ -260,7 +260,7 @@ void JackEngine::NotifyClients(int event, int sync, int value)
{
for (int i = 0; i < CLIENT_NUM; i++) {
JackClientInterface* client = fClientTable[i];
- if (client && (client->ClientNotify(i, client->GetClientControl()->fName, event, sync, value) < 0)) {
+ if (client && client->GetClientControl()->fCallback[event] && (client->ClientNotify(i, client->GetClientControl()->fName, event, sync, value) < 0)) {
jack_error("NotifyClient fails name = %s event = %ld = val = %ld", client->GetClientControl()->fName, event, value);
}
}
@@ -327,12 +327,12 @@ void JackEngine::NotifyBufferSize(jack_nframes_t nframes)
void JackEngine::NotifyFreewheel(bool onoff)
{
fEngineControl->fRealTime = !onoff;
- NotifyClients((onoff ? kStartFreewheel : kStopFreewheel), true, 0);
+ NotifyClients((onoff ? kStartFreewheelCallback : kStopFreewheelCallback), true, 0);
}
void JackEngine::NotifyPortRegistation(jack_port_id_t port_index, bool onoff)
{
- NotifyClients((onoff ? kPortRegistrationOn : kPortRegistrationOff), false, port_index);
+ NotifyClients((onoff ? kPortRegistrationOnCallback : kPortRegistrationOffCallback), false, port_index);
}
void JackEngine::NotifyActivate(int refnum)
diff --git a/common/JackNotification.h b/common/JackNotification.h
index 6cb0da2b..850418f2 100644
--- a/common/JackNotification.h
+++ b/common/JackNotification.h
@@ -29,10 +29,10 @@ namespace Jack
kXRunCallback = 3,
kGraphOrderCallback = 4,
kBufferSizeCallback = 5,
- kStartFreewheel = 6,
- kStopFreewheel = 7,
- kPortRegistrationOn = 8,
- kPortRegistrationOff = 9,
+ kStartFreewheelCallback = 6,
+ kStopFreewheelCallback = 7,
+ kPortRegistrationOnCallback = 8,
+ kPortRegistrationOffCallback = 9,
kZombifyClient = 10,
kDeadClient = 11,
kMaxNotification
diff --git a/common/JackRequest.h b/common/JackRequest.h
index 65d529d1..0ffcb2e8 100644
--- a/common/JackRequest.h
+++ b/common/JackRequest.h
@@ -39,9 +39,7 @@ namespace Jack
struct JackRequest
{
-public:
-
- typedef enum {
+ enum RequestType {
kRegisterPort = 1,
kUnRegisterPort = 2,
kConnectPorts = 3,
@@ -65,7 +63,7 @@ public:
kDisconnectNamePorts = 25,
kNotification = 26
- } RequestType;
+ };
RequestType fType;
diff --git a/macosx/JackMachServerChannel.cpp b/macosx/JackMachServerChannel.cpp
index 21c9915e..f3bfe5fe 100644
--- a/macosx/JackMachServerChannel.cpp
+++ b/macosx/JackMachServerChannel.cpp
@@ -23,6 +23,7 @@ This program is free software; you can redistribute it and/or modify
#include "JackServer.h"
#include "JackMachThread.h"
#include "JackEngine.h"
+#include "JackNotification.h"
using namespace std;
@@ -114,7 +115,7 @@ void JackMachServerChannel::KillClient(mach_port_t private_port)
JackLog("JackMachServerChannel::KillClient\n");
int refnum = fClientTable[private_port];
assert(refnum > 0);
- fServer->Notify(refnum, JackNotifyChannelInterface::kDeadClient, 0);
+ fServer->Notify(refnum, kDeadClient, 0);
fClientTable.erase(private_port);
// Hum, hum....
diff --git a/macosx/Jackdmp.xcodeproj/project.pbxproj b/macosx/Jackdmp.xcodeproj/project.pbxproj
index 2086f452..0cde1453 100644
--- a/macosx/Jackdmp.xcodeproj/project.pbxproj
+++ b/macosx/Jackdmp.xcodeproj/project.pbxproj
@@ -492,6 +492,7 @@
4B9B815C08AFA45000D05A28 /* JackRequest.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = JackRequest.h; path = ../common/JackRequest.h; sourceTree = SOURCE_ROOT; };
4BA577BC08BF8BE200F82DE1 /* testSynchroClient.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = testSynchroClient.cpp; path = ../tests/testSynchroClient.cpp; sourceTree = SOURCE_ROOT; };
4BA577FB08BF8E4600F82DE1 /* testSynchroServer.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = testSynchroServer.cpp; path = ../tests/testSynchroServer.cpp; sourceTree = SOURCE_ROOT; };
+ 4BB371D40C1AD85A0050C1E4 /* JackNotification.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = JackNotification.h; path = ../common/JackNotification.h; sourceTree = SOURCE_ROOT; };
4BBD13CC08C71EB40079F7FF /* testSynchroServerClient.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = testSynchroServerClient.cpp; path = ../tests/testSynchroServerClient.cpp; sourceTree = SOURCE_ROOT; };
4BC216880A444BDE00BDA09F /* JackServerGlobals.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = JackServerGlobals.cpp; path = ../common/JackServerGlobals.cpp; sourceTree = SOURCE_ROOT; };
4BC2168D0A444BED00BDA09F /* JackServerGlobals.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = JackServerGlobals.h; path = ../common/JackServerGlobals.h; sourceTree = SOURCE_ROOT; };
@@ -1026,6 +1027,7 @@
4BA550FF05E2423600569492 /* Channels */ = {
isa = PBXGroup;
children = (
+ 4BB371D40C1AD85A0050C1E4 /* JackNotification.h */,
4BF8D1AF0834EEC400C94B91 /* JackChannel.h */,
4BF8D1B30834EED500C94B91 /* JackInternalClientChannel.h */,
4BFB299908AF452300D450D4 /* Socket */,