Commit 2d043e58 authored by sletz's avatar sletz
Browse files

Latency callback must always be activated.

git-svn-id: http://subversion.jackaudio.org/jack/jack2/trunk/jackmp@4168 0c269be4-1314-0410-8aa9-9f06e86f4224
parent b1cbecba
......@@ -34,6 +34,10 @@ Valerio Pilo
Jackdmp changes log
---------------------------
2011-03-10 Stephane Letz <letz@grame.fr>
* Latency callback must always be activated.
2011-03-09 Stephane Letz <letz@grame.fr>
* jack_client_has_session_callback implementation.
......
......@@ -1152,7 +1152,7 @@ int JackClient::SetLatencyCallback(JackLatencyCallback callback, void *arg)
jack_error("You cannot set callbacks on an active client");
return -1;
} else {
GetClientControl()->fCallback[kLatencyCallback] = (callback != NULL);
// fCallback[kLatencyCallback] must always be 'true'
fLatencyArg = arg;
fLatency = callback;
return 0;
......
......@@ -13,7 +13,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with this program; if not, write to the Free Software
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
......@@ -25,8 +25,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "JackPort.h"
#include "JackSynchro.h"
#include "JackNotification.h"
#include "jack/session.h"
#include "session.h"
namespace Jack
{
......@@ -74,6 +73,7 @@ struct JackClientControl : public JackShmMemAble
fCallback[kAddClient] = true;
fCallback[kRemoveClient] = true;
fCallback[kActivateClient] = true;
fCallback[kLatencyCallback] = true;
// So that driver synchro are correctly setup in "flush" or "normal" mode
fCallback[kStartFreewheelCallback] = true;
fCallback[kStopFreewheelCallback] = true;
......
......@@ -246,7 +246,7 @@ void JackEngine::NotifyClient(int refnum, int event, int sync, const char* messa
// The client may be notified by the RT thread while closing
if (client) {
if (client && client->GetClientControl()->fCallback[event]) {
if (client->GetClientControl()->fCallback[event]) {
/*
Important for internal clients : unlock before calling the notification callbacks.
*/
......
......@@ -13,7 +13,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with this program; if not, write to the Free Software
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
......@@ -33,39 +33,39 @@ static inline jack_time_t JACK_MAX(jack_time_t a, jack_time_t b)
return (a < b) ? b : a;
}
void JackEngineControl::CalcCPULoad(JackClientInterface** table,
JackGraphManager* manager,
jack_time_t cur_cycle_begin,
void JackEngineControl::CalcCPULoad(JackClientInterface** table,
JackGraphManager* manager,
jack_time_t cur_cycle_begin,
jack_time_t prev_cycle_end)
{
fPrevCycleTime = fCurCycleTime;
fCurCycleTime = cur_cycle_begin;
jack_time_t last_cycle_end = prev_cycle_end;
// In Asynchronous mode, last cycle end is the max of client end dates
if (!fSyncMode) {
for (int i = fDriverNum; i < CLIENT_NUM; i++) {
JackClientInterface* client = table[i];
JackClientTiming* timing = manager->GetClientTiming(i);
if (client && client->GetClientControl()->fActive && timing->fStatus == Finished)
if (client && client->GetClientControl()->fActive && timing->fStatus == Finished)
last_cycle_end = JACK_MAX(last_cycle_end, timing->fFinishedAt);
}
}
// Store the execution time for later averaging
// Store the execution time for later averaging
fRollingClientUsecs[fRollingClientUsecsIndex++] = last_cycle_end - fPrevCycleTime;
if (fRollingClientUsecsIndex >= JACK_ENGINE_ROLLING_COUNT)
if (fRollingClientUsecsIndex >= JACK_ENGINE_ROLLING_COUNT)
fRollingClientUsecsIndex = 0;
// Every so often, recompute the current maximum use over the
// last JACK_ENGINE_ROLLING_COUNT client iterations.
if (++fRollingClientUsecsCnt % fRollingInterval == 0) {
jack_time_t max_usecs = 0;
for (int i = 0; i < JACK_ENGINE_ROLLING_COUNT; i++)
for (int i = 0; i < JACK_ENGINE_ROLLING_COUNT; i++)
max_usecs = JACK_MAX(fRollingClientUsecs[i], max_usecs);
fMaxUsecs = JACK_MAX(fMaxUsecs, max_usecs);
fSpareUsecs = jack_time_t((max_usecs < fPeriodUsecs) ? fPeriodUsecs - max_usecs : 0);
fCPULoad = ((1.f - (float(fSpareUsecs) / float(fPeriodUsecs))) * 50.f + (fCPULoad * 0.5f));
......@@ -80,7 +80,7 @@ void JackEngineControl::ResetRollingUsecs()
fSpareUsecs = 0;
fRollingInterval = int(floor((JACK_ENGINE_ROLLING_INTERVAL * 1000.f) / fPeriodUsecs));
}
void JackEngineControl::NotifyXRun(jack_time_t callback_usecs, float delayed_usecs)
{
ResetFrameTime(callback_usecs);
......@@ -88,5 +88,5 @@ void JackEngineControl::NotifyXRun(jack_time_t callback_usecs, float delayed_use
if (delayed_usecs > fMaxDelayedUsecs)
fMaxDelayedUsecs = delayed_usecs;
}
} // end of namespace
......@@ -33,7 +33,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#include "JackDriverLoader.h"
#if defined(JACK_DBUS) && defined(__linux__)
#include <dbus/dbus.h>
#include <dbus/dbus.h>
#include "audio_reserve.h"
#endif
......@@ -85,7 +85,7 @@ static void copyright(FILE* file)
{
fprintf(file, "jackdmp " VERSION "\n"
"Copyright 2001-2005 Paul Davis and others.\n"
"Copyright 2004-2010 Grame.\n"
"Copyright 2004-2011 Grame.\n"
"jackdmp comes with ABSOLUTELY NO WARRANTY\n"
"This is free software, and you are welcome to redistribute it\n"
"under certain conditions; see the file COPYING for details\n");
......@@ -114,10 +114,10 @@ static void usage(FILE* file)
" -d backend [ ... backend args ... ]\n"
#ifdef __APPLE__
" Available backends may include: coreaudio, dummy or net.\n\n"
#endif
#endif
#ifdef WIN32
" Available backends may include: portaudio, dummy or net.\n\n"
#endif
#endif
#ifdef __linux__
" Available backends may include: alsa, dummy, freebob, firewire or net\n\n"
#endif
......@@ -178,13 +178,13 @@ int main(int argc, char* argv[])
jackctl_driver_t * midi_driver_ctl;
jackctl_driver_t * loopback_driver_ctl;
int replace_registry = 0;
const char *options = "-d:X:P:uvshVrRL:STFl:t:mn:p:"
#ifdef __linux__
"c:"
#endif
;
struct option long_options[] = {
#ifdef __linux__
{ "clock-source", 1, 0, 'c' },
......@@ -199,7 +199,7 @@ int main(int argc, char* argv[])
{ "name", 1, 0, 'n' },
{ "unlock", 0, 0, 'u' },
{ "realtime", 0, 0, 'R' },
{ "no-realtime", 0, 0, 'r' },
{ "no-realtime", 0, 0, 'r' },
{ "replace-registry", 0, &replace_registry, 0 },
{ "loopback", 0, 0, 'L' },
{ "realtime-priority", 1, 0, 'P' },
......@@ -239,23 +239,23 @@ int main(int argc, char* argv[])
fprintf(stderr, "Failed to create server object\n");
return -1;
}
server_parameters = jackctl_server_get_parameters(server_ctl);
// Default setting
param = jackctl_get_parameter(server_parameters, "realtime");
if (param != NULL) {
value.b = true;
jackctl_parameter_set_value(param, &value);
}
opterr = 0;
while (!seen_audio_driver &&
(opt = getopt_long(argc, argv, options,
long_options, &option_index)) != EOF) {
switch (opt) {
#ifdef __linux__
#ifdef __linux__
case 'c':
param = jackctl_get_parameter(server_parameters, "clock-source");
if (param != NULL) {
......@@ -280,7 +280,7 @@ int main(int argc, char* argv[])
seen_audio_driver = true;
audio_driver_name = optarg;
break;
case 'L':
loopback = atoi(optarg);
break;
......@@ -342,7 +342,7 @@ int main(int argc, char* argv[])
jackctl_parameter_set_value(param, &value);
}
break;
case 'r':
param = jackctl_get_parameter(server_parameters, "realtime");
if (param != NULL) {
......@@ -388,14 +388,14 @@ int main(int argc, char* argv[])
goto fail_free1;
}
}
// Long option with no letter so treated separately
param = jackctl_get_parameter(server_parameters, "replace-registry");
if (param != NULL) {
value.b = replace_registry;
jackctl_parameter_set_value(param, &value);
}
if (show_version) {
printf( "jackdmp version " VERSION
" tmpdir " jack_server_dir
......@@ -441,7 +441,7 @@ int main(int argc, char* argv[])
// Setup signals then start server
signals = jackctl_setup_signals(0);
if (!jackctl_server_start(server_ctl, audio_driver_ctl)) {
fprintf(stderr, "Failed to start server\n");
goto fail_free1;
......@@ -458,7 +458,7 @@ int main(int argc, char* argv[])
jackctl_server_add_slave(server_ctl, midi_driver_ctl);
}
// Loopback driver
if (loopback > 0) {
loopback_driver_ctl = jackctl_server_get_driver(server_ctl, "loopback");
......@@ -480,7 +480,7 @@ int main(int argc, char* argv[])
if (!jackctl_server_stop(server_ctl))
fprintf(stderr, "Cannot stop server...\n");
jackctl_server_destroy(server_ctl);
notify_server_stop(server_name);
return 0;
......@@ -488,7 +488,7 @@ int main(int argc, char* argv[])
fail_free1:
jackctl_server_destroy(server_ctl);
return -1;
fail_free2:
jackctl_server_stop(server_ctl);
jackctl_server_destroy(server_ctl);
......
......@@ -7,7 +7,7 @@
<key>CFBundleExecutable</key>
<string>Jackservermp</string>
<key>CFBundleGetInfoString</key>
<string>Jackdmp 1.9.7, @03-10 Paul Davis, Grame</string>
<string>Jackdmp 1.9.7, @03-11 Paul Davis, Grame</string>
<key>CFBundleIdentifier</key>
<string>com.grame.Jackmp</string>
<key>CFBundleInfoDictionaryVersion</key>
......
......@@ -25,7 +25,7 @@ BEGIN
VALUE "FileDescription", "Jackmp Audio Adapter for Windows\0"
VALUE "FileVersion", "1, 9, 7, 0\0"
VALUE "InternalName", "audioadapter\0"
VALUE "LegalCopyright", "Copyright Grame 2006-2010\0"
VALUE "LegalCopyright", "Copyright Grame 2006-2011\0"
VALUE "LegalTrademarks", "\0"
VALUE "OriginalFilename", "audioadapter.dll\0"
VALUE "PrivateBuild", "\0"
......
......@@ -25,7 +25,7 @@ BEGIN
VALUE "FileDescription", "Jack server for Windows\0"
VALUE "FileVersion", "1, 9, 7, 0\0"
VALUE "InternalName", "jackd\0"
VALUE "LegalCopyright", "Copyright Grame 2006-2010\0"
VALUE "LegalCopyright", "Copyright Grame 2006-2011\0"
VALUE "LegalTrademarks", "\0"
VALUE "OriginalFilename", "jackd.exe\0"
VALUE "PrivateBuild", "\0"
......
......@@ -25,7 +25,7 @@ BEGIN
VALUE "FileDescription", "Jackmp Dummy Driver for Windows\0"
VALUE "FileVersion", "1, 9, 7, 0\0"
VALUE "InternalName", "jack_dummy\0"
VALUE "LegalCopyright", "Copyright Grame 2006-2010\0"
VALUE "LegalCopyright", "Copyright Grame 2006-2011\0"
VALUE "LegalTrademarks", "\0"
VALUE "OriginalFilename", "jack_dummy.dll\0"
VALUE "PrivateBuild", "\0"
......
......@@ -25,7 +25,7 @@ BEGIN
VALUE "FileDescription", "Jackmp Loopback Driver for Windows\0"
VALUE "FileVersion", "1, 9, 7, 0\0"
VALUE "InternalName", "jack_loopback\0"
VALUE "LegalCopyright", "Copyright Grame 2006-2010\0"
VALUE "LegalCopyright", "Copyright Grame 2006-2011\0"
VALUE "LegalTrademarks", "\0"
VALUE "OriginalFilename", "jack_loopback.dll\0"
VALUE "PrivateBuild", "\0"
......
......@@ -25,7 +25,7 @@ BEGIN
VALUE "FileDescription", "Jackmp Net Adapter for Windows\0"
VALUE "FileVersion", "1, 9, 7, 0\0"
VALUE "InternalName", "netadapter\0"
VALUE "LegalCopyright", "Copyright Grame 2006-2010\0"
VALUE "LegalCopyright", "Copyright Grame 2006-2011\0"
VALUE "LegalTrademarks", "\0"
VALUE "OriginalFilename", "netadapter.dll\0"
VALUE "PrivateBuild", "\0"
......
......@@ -25,7 +25,7 @@ BEGIN
VALUE "FileDescription", "Jackmp Net Driver for Windows\0"
VALUE "FileVersion", "1, 9, 7, 0\0"
VALUE "InternalName", "jack_netdriver\0"
VALUE "LegalCopyright", "Copyright Grame 2006-2010\0"
VALUE "LegalCopyright", "Copyright Grame 2006-2011\0"
VALUE "LegalTrademarks", "\0"
VALUE "OriginalFilename", "jack_netdriver.dll\0"
VALUE "PrivateBuild", "\0"
......
......@@ -25,7 +25,7 @@ BEGIN
VALUE "FileDescription", "Jackmp Net Manager for Windows\0"
VALUE "FileVersion", "1, 9, 7, 0\0"
VALUE "InternalName", "netmanager\0"
VALUE "LegalCopyright", "Copyright Grame 2006-2010\0"
VALUE "LegalCopyright", "Copyright Grame 2006-2011\0"
VALUE "LegalTrademarks", "\0"
VALUE "OriginalFilename", "netmanager.dll\0"
VALUE "PrivateBuild", "\0"
......
......@@ -25,7 +25,7 @@ BEGIN
VALUE "FileDescription", "Jackmp NetOne Driver for Windows\0"
VALUE "FileVersion", "1, 9, 7, 0\0"
VALUE "InternalName", "jack_netonedriver\0"
VALUE "LegalCopyright", "Copyright Grame 2006-2010\0"
VALUE "LegalCopyright", "Copyright Grame 2006-2011\0"
VALUE "LegalTrademarks", "\0"
VALUE "OriginalFilename", "jack_netonedriver.dll\0"
VALUE "PrivateBuild", "\0"
......
......@@ -25,7 +25,7 @@ BEGIN
VALUE "FileDescription", "Jackmp PortAudio Driver for Windows\0"
VALUE "FileVersion", "1, 9, 7, 0\0"
VALUE "InternalName", "jack_portaudio\0"
VALUE "LegalCopyright", "Copyright Grame 2006-2010\0"
VALUE "LegalCopyright", "Copyright Grame 2006-2011\0"
VALUE "LegalTrademarks", "\0"
VALUE "OriginalFilename", "jack_portaudio.dll\0"
VALUE "PrivateBuild", "\0"
......
......@@ -25,7 +25,7 @@ BEGIN
VALUE "FileDescription", "Jackmp WinMME Driver for Windows\0"
VALUE "FileVersion", "1, 9, 7, 0\0"
VALUE "InternalName", "jack_portaudio\0"
VALUE "LegalCopyright", "Copyright Grame 2006-2010\0"
VALUE "LegalCopyright", "Copyright Grame 2006-2011\0"
VALUE "LegalTrademarks", "\0"
VALUE "OriginalFilename", "jack_winmme.dll\0"
VALUE "PrivateBuild", "\0"
......
......@@ -25,7 +25,7 @@ BEGIN
VALUE "FileDescription", "Jack client library for Windows\0"
VALUE "FileVersion", "1, 9, 7, 0\0"
VALUE "InternalName", "libjack\0"
VALUE "LegalCopyright", "Copyright Grame 2006-2010\0"
VALUE "LegalCopyright", "Copyright Grame 2006-2011\0"
VALUE "LegalTrademarks", "\0"
VALUE "OriginalFilename", "libjack.dll\0"
VALUE "PrivateBuild", "\0"
......
......@@ -25,7 +25,7 @@ BEGIN
VALUE "FileDescription", "Jack server library for Windows\0"
VALUE "FileVersion", "1, 9, 7, 0\0"
VALUE "InternalName", "libjackserver\0"
VALUE "LegalCopyright", "Copyright Grame 2006-2010\0"
VALUE "LegalCopyright", "Copyright Grame 2006-2011\0"
VALUE "LegalTrademarks", "\0"
VALUE "OriginalFilename", "libjackserver.dll\0"
VALUE "PrivateBuild", "\0"
......
......@@ -35,7 +35,7 @@ BEGIN
VALUE "FileDescription", "Jackmp for Windows\0"
VALUE "FileVersion", "1, 9, 7, 0\0"
VALUE "InternalName", "libjackmp\0"
VALUE "LegalCopyright", "Copyright Grame 2006-2010\0"
VALUE "LegalCopyright", "Copyright Grame 2006-2011\0"
VALUE "LegalTrademarks", "\0"
VALUE "OriginalFilename", "libjackmp.dll\0"
VALUE "PrivateBuild", "\0"
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment