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