Commit 810ec14d authored by Stephane Letz's avatar Stephane Letz
Browse files

Improve error handling.

parent 8ff7bfe6
......@@ -68,6 +68,8 @@ JackMidiAsyncWaitQueue::DequeueEvent(jack_nframes_t frame)
jack_midi_event_t *
JackMidiAsyncWaitQueue::DequeueEvent(long usec)
{
printf("JackMidiAsyncWaitQueue::DequeueEvent 0 %d\n", semaphore);
return ((usec < 0) ? semaphore.Wait() : semaphore.TimedWait(usec)) ?
JackMidiAsyncQueue::DequeueEvent() : 0;
}
......
......@@ -476,7 +476,9 @@ int main(int argc, char* argv[])
fprintf(stderr, "Unknown driver \"%s\"\n", *it);
goto close_server;
}
jackctl_server_add_slave(server_ctl, slave_driver_ctl);
if (!jackctl_server_add_slave(server_ctl, slave_driver_ctl)) {
fprintf(stderr, "Driver \"%s\" cannot be loaded\n", *it);
}
}
// Loopback driver
......@@ -491,7 +493,9 @@ int main(int argc, char* argv[])
value.ui = loopback;
jackctl_parameter_set_value(param, &value);
}
jackctl_server_add_slave(server_ctl, loopback_driver_ctl);
if (!jackctl_server_add_slave(server_ctl, loopback_driver_ctl)) {
fprintf(stderr, "Driver \"loopback\" cannot be loaded\n");
}
}
}
......@@ -509,7 +513,9 @@ int main(int argc, char* argv[])
fprintf(stderr, "Unknown internal \"%s\"\n", *it);
goto stop_server;
}
jackctl_server_load_internal(server_ctl, internal_driver_ctl);
if (!jackctl_server_load_internal(server_ctl, internal_driver_ctl)) {
fprintf(stderr, "Internal client \"%s\" cannot be loaded\n", *it);
}
}
notify_server_start(server_name);
......
......@@ -357,7 +357,9 @@ JackCoreMidiDriver::Open(bool capturing, bool playing, int in_channels,
} catch (std::exception e) {
jack_error("JackCoreMidiDriver::Open - while creating "
"physical input port: %s", e.what());
continue;
//continue;
// SL : seems safer to fail here?
goto destroy_internal_input_port;
}
pi_count++;
}
......@@ -391,7 +393,9 @@ JackCoreMidiDriver::Open(bool capturing, bool playing, int in_channels,
} catch (std::exception e) {
jack_error("JackCoreMidiDriver::Open - while creating "
"physical output port: %s", e.what());
continue;
//continue;
// SL : seems safer to fail here?
goto destroy_internal_output_port;
}
po_count++;
}
......
......@@ -65,6 +65,7 @@ JackCoreMidiPort::Initialize(const char *alias_name, const char *client_name,
char endpoint_name[JACK_CLIENT_NAME_SIZE + JACK_PORT_NAME_SIZE];
CFStringRef endpoint_name_ref;
int num = index + 1;
Boolean res;
OSStatus result = MIDIObjectGetStringProperty(endpoint, kMIDIPropertyName,
&endpoint_name_ref);
if (result != noErr) {
......@@ -72,10 +73,10 @@ JackCoreMidiPort::Initialize(const char *alias_name, const char *client_name,
"MIDIObjectGetStringProperty", result);
goto get_basic_alias;
}
result = CFStringGetCString(endpoint_name_ref, endpoint_name,
res = CFStringGetCString(endpoint_name_ref, endpoint_name,
sizeof(endpoint_name), 0);
CFRelease(endpoint_name_ref);
if (result != noErr) {
if (!res) {
jack_error("JackCoreMidiPort::Initialize - failed to allocate memory "
"for endpoint name.");
get_basic_alias:
......
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