Commit f1183018 authored by sletz's avatar sletz
Browse files

Correct jackdmp.cpp (failures case were not correct..). Improve...

Correct jackdmp.cpp (failures case were not correct..). Improve JackCoreAudioDriver code. Raise default port number to 2048.

git-svn-id: http://subversion.jackaudio.org/jack/jack2/trunk/jackmp@3659 0c269be4-1314-0410-8aa9-9f06e86f4224
parent d8454654
......@@ -25,6 +25,10 @@ Paul Davis
Jackdmp changes log
---------------------------
2009-10-22 Stephane Letz <letz@grame.fr>
* Correct jackdmp.cpp (failures case were not correct..). Improve JackCoreAudioDriver code. Raise default port number to 2048.
2009-10-20 Stephane Letz <letz@grame.fr>
* Add a string parameter to server ==> client notification, add a new JackInfoShutdownCallback type.
......
......@@ -35,7 +35,7 @@
#define JACK_MESSAGE_SIZE 512
#ifndef PORT_NUM
#define PORT_NUM 1024
#define PORT_NUM 2048
#endif
#define DRIVER_PORT_NUM 256
......
......@@ -247,7 +247,7 @@ int main(int argc, char* argv[])
jackctl_parameter_set_value(param, &value);
} else {
usage(stdout);
goto fail_free;
goto fail_free1;
}
}
break;
......@@ -358,7 +358,7 @@ int main(int argc, char* argv[])
case 'h':
usage(stdout);
goto fail_free;
goto fail_free1;
}
}
......@@ -372,14 +372,14 @@ int main(int argc, char* argv[])
if (!seen_audio_driver) {
usage(stderr);
goto fail_free;
goto fail_free1;
}
// Audio driver
audio_driver_ctl = jackctl_server_get_driver(server_ctl, audio_driver_name);
if (audio_driver_ctl == NULL) {
fprintf(stderr, "Unkown driver \"%s\"\n", audio_driver_name);
goto fail_free;
goto fail_free1;
}
if (optind < argc) {
......@@ -391,7 +391,7 @@ int main(int argc, char* argv[])
if (audio_driver_nargs == 0) {
fprintf(stderr, "No driver specified ... hmm. JACK won't do"
" anything when run like this.\n");
goto fail_free;
goto fail_free1;
}
audio_driver_args = (char **) malloc(sizeof(char *) * audio_driver_nargs);
......@@ -402,13 +402,13 @@ int main(int argc, char* argv[])
}
if (jackctl_parse_driver_params(audio_driver_ctl, audio_driver_nargs, audio_driver_args)) {
goto fail_free;
goto fail_free1;
}
// Start server
if (!jackctl_server_start(server_ctl, audio_driver_ctl)) {
fprintf(stderr, "Failed to start server\n");
goto fail_free;
goto fail_free1;
}
// MIDI driver
......@@ -417,7 +417,7 @@ int main(int argc, char* argv[])
midi_driver_ctl = jackctl_server_get_driver(server_ctl, midi_driver_name);
if (midi_driver_ctl == NULL) {
fprintf(stderr, "Unkown driver \"%s\"\n", midi_driver_name);
goto fail_free;
goto fail_free2;
}
jackctl_server_add_slave(server_ctl, midi_driver_ctl);
......@@ -445,10 +445,18 @@ 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;
fail_free:
fail_free1 :
jackctl_server_destroy(server_ctl);
return -1;
fail_free2:
jackctl_server_stop(server_ctl);
jackctl_server_destroy(server_ctl);
notify_server_stop(server_name);
return 1;
return -1;
}
......@@ -83,7 +83,7 @@ rpc_type server_rpc_jack_client_deactivate(mach_port_t private_port, int refnum,
rpc_type server_rpc_jack_port_register(mach_port_t private_port, int refnum, client_port_name_t name, client_port_type_t type, unsigned int flags, unsigned int buffer_size, unsigned int* port_index, int* result)
{
jack_log("rpc_jack_port_register ref = %ld name = %s", refnum, name);
jack_log("rpc_jack_port_register ref = %d name = %s", refnum, name);
JackMachServerChannel* channel = JackMachServerChannel::fPortTable[private_port];
assert(channel);
*result = channel->GetEngine()->PortRegister(refnum, name, type, flags, buffer_size, port_index);
......@@ -92,7 +92,7 @@ rpc_type server_rpc_jack_port_register(mach_port_t private_port, int refnum, cli
rpc_type server_rpc_jack_port_unregister(mach_port_t private_port, int refnum, int port, int* result)
{
jack_log("rpc_jack_port_unregister ref = %ld port = %ld ", refnum, port);
jack_log("rpc_jack_port_unregister ref = %d port = %d ", refnum, port);
JackMachServerChannel* channel = JackMachServerChannel::fPortTable[private_port];
assert(channel);
*result = channel->GetEngine()->PortUnRegister(refnum, port);
......@@ -234,7 +234,7 @@ rpc_type server_rpc_jack_internal_clientunload(mach_port_t private_port, int ref
rpc_type server_rpc_jack_client_rt_notify(mach_port_t server_port, int refnum, int notify, int value)
{
jack_log("rpc_jack_client_rt_notify ref = %ld notify = %ld value = %ld", refnum, notify, value);
jack_log("rpc_jack_client_rt_notify ref = %d notify = %d value = %d", refnum, notify, value);
JackMachServerChannel* channel = JackMachServerChannel::fPortTable[server_port];
assert(channel);
assert(channel->GetServer());
......
......@@ -261,25 +261,25 @@ OSStatus JackCoreAudioDriver::DeviceNotificationCallback(AudioDeviceID inDevice,
JackCoreAudioDriver* driver = (JackCoreAudioDriver*)inClientData;
switch (inPropertyID) {
case kAudioDeviceProcessorOverload: {
jack_error("JackCoreAudioDriver::DeviceNotificationCallback kAudioDeviceProcessorOverload");
jack_time_t cur_time = GetMicroSeconds();
driver->NotifyXRun(cur_time, float(cur_time - driver->fBeginDateUst)); // Better this value than nothing...
break;
}
}
case kAudioDevicePropertyStreamConfiguration: {
jack_error("Cannot handle kAudioDevicePropertyStreamConfiguration : server will quit...");
driver->NotifyFailure(JackBackendError, "CoreAudio device stream configuration has changed, backend stopped.");
driver->NotifyFailure(JackBackendError, "Another application has changed the device configuration.");
driver->CloseAUHAL();
kill(JackTools::GetPID(), SIGINT);
return kAudioHardwareUnsupportedOperationError;
}
case kAudioDevicePropertyNominalSampleRate: {
}
case kAudioDevicePropertyNominalSampleRate: {
jack_error("Cannot handle kAudioDevicePropertyNominalSampleRate : server will quit...");
driver->NotifyFailure(JackBackendError, "CoreAudio device sampling rate has changed, backend stopped.");
driver->NotifyFailure(JackBackendError, "Another application has changed the sample rate.");
driver->CloseAUHAL();
kill(JackTools::GetPID(), SIGINT);
return kAudioHardwareUnsupportedOperationError;
......@@ -1072,11 +1072,19 @@ int JackCoreAudioDriver::Open(jack_nframes_t buffer_size,
fIOUsage = float(async_output_latency) / 100.f;
fComputationGrain = float(computation_grain) / 100.f;
CFRunLoopRef theRunLoop = NULL;
AudioObjectPropertyAddress theAddress = { kAudioHardwarePropertyRunLoop, kAudioObjectPropertyScopeGlobal, kAudioObjectPropertyElementMaster };
OSStatus theError = AudioObjectSetPropertyData (kAudioObjectSystemObject, &theAddress, 0, NULL, sizeof(CFRunLoopRef), &theRunLoop);
if (theError != noErr) {
jack_error("JackCoreAudioDriver::Open kAudioHardwarePropertyRunLoop error");
SInt32 major;
SInt32 minor;
Gestalt(gestaltSystemVersionMajor, &major);
Gestalt(gestaltSystemVersionMinor, &minor);
// Starting with 10.6 systems...
if (major == 10 && minor >=6) {
CFRunLoopRef theRunLoop = NULL;
AudioObjectPropertyAddress theAddress = { kAudioHardwarePropertyRunLoop, kAudioObjectPropertyScopeGlobal, kAudioObjectPropertyElementMaster };
OSStatus theError = AudioObjectSetPropertyData (kAudioObjectSystemObject, &theAddress, 0, NULL, sizeof(CFRunLoopRef), &theRunLoop);
if (theError != noErr) {
jack_error("JackCoreAudioDriver::Open kAudioHardwarePropertyRunLoop error");
}
}
if (SetupDevices(capture_driver_uid, playback_driver_uid, capture_driver_name, playback_driver_name) < 0)
......
......@@ -68,7 +68,7 @@ def set_options(opt):
opt.add_option('--profile', action='store_true', default=False, help='Build with engine profiling')
opt.add_option('--mixed', action='store_true', default=False, help='Build with 32/64 bits mixed mode')
opt.add_option('--clients', default=64, type="int", dest="clients", help='Maximum number of JACK clients')
opt.add_option('--ports', default=1024, type="int", dest="ports", help='Maximum number of ports')
opt.add_option('--ports', default=2048, type="int", dest="ports", help='Maximum number of ports')
opt.add_option('--ports-per-application', default=512, type="int", dest="application_ports", help='Maximum number of ports per application')
opt.sub_options('dbus')
......
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