Commit 9431a5d2 authored by Stephane Letz's avatar Stephane Letz
Browse files

Lorenz Minder patch for jackd man, cleanup.

parent bbc95b71
......@@ -66,7 +66,6 @@ JackInternalClient::~JackInternalClient()
int JackInternalClient::Open(const char* server_name, const char* name, int uuid, jack_options_t options, jack_status_t* status)
{
int result;
char name_res[JACK_CLIENT_NAME_SIZE + 1];
jack_log("JackInternalClient::Open name = %s", name);
if (strlen(name) >= JACK_CLIENT_NAME_SIZE) {
......@@ -79,6 +78,8 @@ int JackInternalClient::Open(const char* server_name, const char* name, int uuid
strncpy(fServerName, server_name, sizeof(fServerName));
// Open server/client direct channel
char name_res[JACK_CLIENT_NAME_SIZE + 1];
fChannel->ClientCheck(name, uuid, name_res, JACK_PROTOCOL_VERSION, (int)options, (int*)status, &result, false);
if (result < 0) {
int status1 = *status;
......
......@@ -54,7 +54,7 @@ int JackLoopbackDriver::ProcessWriteSync()
{
// Suspend on connected clients in the graph
if (SuspendRefNum() < 0) {
jack_error("JackLoopbackDriver::ProcessWriteSync SuspendRefNum error");
jack_error("JackLoopbackDriver::ProcessWriteSync - SuspendRefNum error");
return -1;
}
return 0;
......
......@@ -41,10 +41,12 @@ SERVER_EXPORT jack_shmsize_t JackMidiBuffer::MaxEventSize() const
{
assert (((jack_shmsize_t) - 1) < 0); // jack_shmsize_t should be signed
jack_shmsize_t left = buffer_size - (sizeof(JackMidiBuffer) + sizeof(JackMidiEvent) * (event_count + 1) + write_pos);
if (left < 0)
if (left < 0) {
return 0;
if (left <= JackMidiEvent::INLINE_SIZE_MAX)
}
if (left <= JackMidiEvent::INLINE_SIZE_MAX) {
return JackMidiEvent::INLINE_SIZE_MAX;
}
return left;
}
......@@ -60,8 +62,9 @@ SERVER_EXPORT jack_midi_data_t* JackMidiBuffer::ReserveEvent(jack_nframes_t time
JackMidiEvent* event = &events[event_count++];
event->time = time;
event->size = size;
if (size <= JackMidiEvent::INLINE_SIZE_MAX)
if (size <= JackMidiEvent::INLINE_SIZE_MAX) {
return event->data;
}
write_pos += size;
event->offset = buffer_size - write_pos;
......@@ -128,8 +131,9 @@ static void MidiBufferMixdown(void* mixbuffer, void** src_buffers, int src_count
// write the event
jack_midi_data_t* dest = mix->ReserveEvent(next_event->time, next_event->size);
if (!dest)
if (!dest) {
break;
}
memcpy(dest, next_event->GetData(next_buf), next_event->size);
next_buf->mix_index++;
}
......
......@@ -57,10 +57,11 @@ struct SERVER_EXPORT JackMidiEvent
jack_midi_data_t* GetData(void* buffer)
{
if (size <= INLINE_SIZE_MAX)
if (size <= INLINE_SIZE_MAX) {
return data;
else
} else {
return (jack_midi_data_t*)buffer + offset;
}
}
};
......
......@@ -36,8 +36,9 @@ bool JackPort::Allocate(int refnum, const char* port_name, const char* port_type
{
jack_port_type_id_t id = GetPortTypeId(port_type);
assert(id >= 0 && id <= PORT_TYPES_MAX);
if (id == PORT_TYPES_MAX)
if (id == PORT_TYPES_MAX) {
return false;
}
fTypeId = id;
fFlags = flags;
fRefNum = refnum;
......@@ -116,16 +117,18 @@ void JackPort::SetLatencyRange(jack_latency_callback_mode_t mode, jack_latency_r
/* hack to set latency up for
* backend ports
*/
if ((fFlags & JackPortIsOutput) && (fFlags & JackPortIsPhysical))
if ((fFlags & JackPortIsOutput) && (fFlags & JackPortIsPhysical)) {
fLatency = (range->min + range->max) / 2;
}
} else {
fPlaybackLatency = *range;
/* hack to set latency up for
* backend ports
*/
if ((fFlags & JackPortIsInput) && (fFlags & JackPortIsPhysical))
if ((fFlags & JackPortIsInput) && (fFlags & JackPortIsPhysical)) {
fLatency = (range->min + range->max) / 2;
}
}
}
......
......@@ -37,8 +37,9 @@ jack_port_type_id_t GetPortTypeId(const char* port_type)
for (jack_port_type_id_t i = 0; i < PORT_TYPES_MAX; ++i) {
const JackPortType* type = gPortTypes[i];
assert(type != 0);
if (strcmp(port_type, type->fName) == 0)
if (strcmp(port_type, type->fName) == 0) {
return i;
}
}
return PORT_TYPES_MAX;
}
......
......@@ -154,6 +154,9 @@ imposing the basic JACK system latency determined by the
.br
Number of capture channels. Default is maximum supported by hardware.
.TP
\fB\-I \-\-input\-latency\fR
Extra input latency (frames) (default: 0)
.TP
\fB\-n, \-\-nperiods \fIint\fR
.br
Specify the number of periods of playback latency. In seconds, this
......@@ -179,6 +182,9 @@ devices supported by FFADO (formerly Freebob) are configured with
.br
Number of playback channels. Default is maximum supported by hardware.
.TP
\fB\-O \-\-output\-latency\fR
Extra output latency (frames) (default: 0)
.TP
\fB\-P, \-\-playback\fR [ \fIname\fR ]
Provide only playback ports, unless combined with \-D or \-C. Optionally set
playback device name.
......@@ -381,6 +387,12 @@ Specify output device for playback (default: /dev/dsp)
.TP
\fB\-b, \-\-ignorehwbuf \fIboolean\fR
Specify, whether to ignore hardware period size (default: false)
.TP
\fB\-I \-\-input\-latency\fR
Extra input latency (frames) (default: 0)
.TP
\fB\-O \-\-output\-latency\fR
Extra output latency (frames) (default: 0)
.SS SUN BACKEND PARAMETERS
.TP
\fB\-r, \-\-rate \fIint\fR
......@@ -425,9 +437,15 @@ Maximum number of channels (default: all available hardware channels)
\fB\-i \-\-channelin\fR
Maximum number of input channels (default: all available hardware channels)
.TP
\fB\-I \-\-input\-latency\fR
Extra input latency (frames) (default: 0)
.TP
\fB\-o \-\-channelout\fR
Maximum number of output channels (default: all available hardware channels)
.TP
\fB\-O \-\-output\-latency\fR
Extra output latency (frames) (default: 0)
.TP
\fB\-C \-\-capture\fR
Whether or not to capture (default: true)
.TP
......
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