Commit 51f92388 authored by Stephane Letz's avatar Stephane Letz
Browse files

Correct JackDriver::Open : call to fGraphManager->SetBufferSize has to use...

Correct JackDriver::Open : call to fGraphManager->SetBufferSize has to use current fEngineControl->fBufferSize value.
parent a1f2d86d
......@@ -76,7 +76,7 @@ int JackDriver::Open()
}
int JackDriver::Open(jack_nframes_t buffer_size,
jack_nframes_t samplerate,
jack_nframes_t sample_rate,
bool capturing,
bool playing,
int inchannels,
......@@ -111,8 +111,8 @@ int JackDriver::Open(jack_nframes_t buffer_size,
if (buffer_size > 0) {
fEngineControl->fBufferSize = buffer_size;
}
if (samplerate > 0) {
fEngineControl->fSampleRate = samplerate;
if (sample_rate > 0) {
fEngineControl->fSampleRate = sample_rate;
}
fCaptureLatency = capture_latency;
fPlaybackLatency = playback_latency;
......@@ -125,7 +125,7 @@ int JackDriver::Open(jack_nframes_t buffer_size,
fEngineControl->UpdateTimeOut();
fGraphManager->SetBufferSize(buffer_size);
fGraphManager->SetBufferSize(fEngineControl->fBufferSize);
fGraphManager->DirectConnect(fClientControl.fRefNum, fClientControl.fRefNum); // Connect driver to itself for "sync" mode
SetupDriverSync(fClientControl.fRefNum, false);
return 0;
......
......@@ -301,8 +301,9 @@ int JackGraphManager::ComputeTotalLatencies()
jack_port_id_t port_index;
for (port_index = FIRST_AVAILABLE_PORT; port_index < fPortMax; port_index++) {
JackPort* port = GetPort(port_index);
if (port->IsUsed())
if (port->IsUsed()) {
ComputeTotalLatency(port_index);
}
}
return 0;
}
......@@ -321,14 +322,17 @@ void JackGraphManager::RecalculateLatencyAux(jack_port_id_t port_index, jack_lat
dst_port->GetLatencyRange(mode, &other_latency);
if (other_latency.max > latency.max)
if (other_latency.max > latency.max) {
latency.max = other_latency.max;
if (other_latency.min < latency.min)
}
if (other_latency.min < latency.min) {
latency.min = other_latency.min;
}
}
if (latency.min == UINT32_MAX)
if (latency.min == UINT32_MAX) {
latency.min = 0;
}
port->SetLatencyRange(mode, &latency);
}
......@@ -355,8 +359,9 @@ void JackGraphManager::SetBufferSize(jack_nframes_t buffer_size)
jack_port_id_t port_index;
for (port_index = FIRST_AVAILABLE_PORT; port_index < fPortMax; port_index++) {
JackPort* port = GetPort(port_index);
if (port->IsUsed())
if (port->IsUsed()) {
port->ClearBuffer(buffer_size);
}
}
}
......@@ -370,8 +375,9 @@ jack_port_id_t JackGraphManager::AllocatePortAux(int refnum, const char* port_na
JackPort* port = GetPort(port_index);
if (!port->IsUsed()) {
jack_log("JackGraphManager::AllocatePortAux port_index = %ld name = %s type = %s", port_index, port_name, port_type);
if (!port->Allocate(refnum, port_name, port_type, flags))
if (!port->Allocate(refnum, port_name, port_type, flags)) {
return NO_PORT;
}
break;
}
}
......
......@@ -99,8 +99,9 @@ LIB_EXPORT
size_t jack_midi_max_event_size(void* port_buffer)
{
JackMidiBuffer *buf = (JackMidiBuffer*)port_buffer;
if (buf && buf->IsValid())
if (buf && buf->IsValid()) {
return buf->MaxEventSize();
}
return 0;
}
......@@ -152,7 +153,8 @@ LIB_EXPORT
uint32_t jack_midi_get_lost_event_count(void* port_buffer)
{
JackMidiBuffer *buf = (JackMidiBuffer*)port_buffer;
if (buf && buf->IsValid())
if (buf && buf->IsValid()) {
return buf->lost_events;
}
return 0;
}
......@@ -51,7 +51,7 @@ struct SERVER_EXPORT JackMidiEvent
uint32_t time;
jack_shmsize_t size;
union {
jack_shmsize_t offset;
jack_shmsize_t offset;
jack_midi_data_t data[INLINE_SIZE_MAX];
};
......
......@@ -53,7 +53,7 @@ static int process(jack_nframes_t nframes, void *arg)
int i,j;
void* port_buf = jack_port_get_buffer(output_port, nframes);
unsigned char* buffer;
jack_midi_reset_buffer(port_buf);
jack_midi_clear_buffer(port_buf);
/*memset(buffer, 0, nframes*sizeof(jack_default_audio_sample_t));*/
for (i = 0; i < nframes; i++) {
......
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