Browse Source

[firewire] Introduce UpdateLatencies() in FFADO backend

In preparation for the upcoming FFADO buffersize functionality,
add code that updates the latency afterwards.
tags/1.9.9.5
Adrian Knoth 12 years ago
parent
commit
1a8d715c2e
2 changed files with 27 additions and 0 deletions
  1. +25
    -0
      linux/firewire/JackFFADODriver.cpp
  2. +2
    -0
      linux/firewire/JackFFADODriver.h

+ 25
- 0
linux/firewire/JackFFADODriver.cpp View File

@@ -253,6 +253,31 @@ JackFFADODriver::ffado_driver_restart (ffado_driver_t *driver)
return Start();
}

void
JackFFADODriver::UpdateLatencies(void)
{
jack_latency_range_t range;
ffado_driver_t* driver = (ffado_driver_t*)fDriver;

for (int i = 0; i < fCaptureChannels; i++) {
range.min = range.max = driver->period_size + driver->capture_frame_latency;
fGraphManager->GetPort(fCapturePortList[i])->SetLatencyRange(JackCaptureLatency, &range);
}

for (int i = 0; i < fPlaybackChannels; i++) {
// Add one buffer more latency if "async" mode is used...
range.min = range.max = (driver->period_size *
(driver->device_options.nb_buffers - 1)) +
((fEngineControl->fSyncMode) ? 0 : fEngineControl->fBufferSize) + driver->playback_frame_latency;
fGraphManager->GetPort(fPlaybackPortList[i])->SetLatencyRange(JackPlaybackLatency, &range);
// Monitor port
if (fWithMonitorPorts) {
range.min = range.max =driver->period_size;
fGraphManager->GetPort(fMonitorPortList[i])->SetLatencyRange(JackCaptureLatency, &range);
}
}
}

int
JackFFADODriver::SetBufferSize (jack_nframes_t nframes)
{


+ 2
- 0
linux/firewire/JackFFADODriver.h View File

@@ -2,6 +2,7 @@
Copyright (C) 2001 Paul Davis
Copyright (C) 2004 Grame
Copyright (C) 2007 Pieter Palmers
Copyright (C) 2012 Adrian Knoth

This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -59,6 +60,7 @@ class JackFFADODriver : public JackAudioDriver

void jack_driver_init (jack_driver_t *driver);
void jack_driver_nt_init (jack_driver_nt_t * driver);
void UpdateLatencies();

public:



Loading…
Cancel
Save