Skip to content
Permalink
Browse files

- Plugin latency/delay compensation is now introduced

  as an option to tracks only (cf. Track/Properties...
  /Latency compensation). (HIGHLY EXPERIMENTAL)
  • Loading branch information...
rncbc committed Mar 16, 2019
1 parent 9df6f14 commit 391cfef0431d8ebeb0ce1ae4a23f28a2f03179b5
@@ -6,8 +6,9 @@ ChangeLog

GIT HEAD

- Plugin latency/delay compensation is now intrduced
as an option to tracks only. (HIGHLY EXPERIMENTAL)
- Plugin latency/delay compensation is now introduced
as an option to tracks only (cf. Track/Properties...
/Latency compensation). (HIGHLY EXPERIMENTAL)

- Refactored all singleton/unique application instance
setup logic away from X11/Xcb hackery. (EXPERIMENTAL)
@@ -502,6 +502,7 @@ qtractorAudioEngine::qtractorAudioEngine ( qtractorSession *pSession )
m_pExportFile = NULL;
m_pExportBuses = NULL;
m_pExportBuffer = NULL;
m_iExportOffset = 0;
m_iExportStart = 0;
m_iExportEnd = 0;
m_bExportDone = true;
@@ -1173,7 +1174,7 @@ void qtractorAudioEngine::process_export ( unsigned int nframes )
const unsigned long iFrameEnd = iFrameStart + nframes;

// Write output bus buffers to export audio file...
if (iFrameStart < m_iExportEnd && iFrameEnd > m_iExportStart) {
if (iFrameStart < m_iExportEnd) {
// Prepare mix-down buffer...
m_pExportBuffer->process_prepare(nframes);
// Force/sync every audio clip approaching...
@@ -1442,6 +1443,24 @@ bool qtractorAudioEngine::isExporting (void) const
}


// Last known export accessors.
unsigned long qtractorAudioEngine::exportStart (void) const
{
return m_iExportStart;
}

unsigned long qtractorAudioEngine::exportOffset (void) const
{
return m_iExportOffset;
}

unsigned long qtractorAudioEngine::exportLength (void) const
{
return (m_iExportEnd > m_iExportStart ? m_iExportEnd - m_iExportStart : 0);
}



// Audio-export method.
bool qtractorAudioEngine::fileExport (
const QString& sExportPath, const QList<qtractorAudioBus *>& exportBuses,
@@ -1525,9 +1544,29 @@ bool qtractorAudioEngine::fileExport (
pAudioBus->setMonitor(false);
}

// Make sure all track latencies are reset and
// maximum track latency is acquainted as offset...
m_iExportOffset = 0;

for (qtractorTrack *pTrack = pSession->tracks().first();
pTrack; pTrack = pTrack->next()) {
if (!pTrack->isMute() && (!pSession->soloTracks() || pTrack->isSolo())) {
qtractorPluginList *pPluginList = pTrack->pluginList();
if (pPluginList) {
pPluginList->resetLatency();
const unsigned long iLatency = pPluginList->latency();
if (m_iExportOffset < iLatency)
m_iExportOffset = iLatency;
}
}
}

if (m_iExportOffset > m_iExportStart)
m_iExportOffset = m_iExportStart;

// Because we'll have to set the export conditions...
pSession->setLoop(0, 0);
pSession->setPlayHead(m_iExportStart);
pSession->setPlayHead(m_iExportStart - m_iExportOffset);

// Special initialization.
m_iBufferOffset = 0;
@@ -1582,8 +1621,8 @@ bool qtractorAudioEngine::fileExport (
m_pExportBuses = NULL;
m_pExportFile = NULL;
m_pExportBuffer = NULL;
m_iExportStart = 0;
m_iExportEnd = 0;
// m_iExportStart = 0;
// m_iExportEnd = 0;
m_bExportDone = true;

// Back to business..
@@ -145,6 +145,11 @@ class qtractorAudioEngine : public qtractorEngine
void setExporting(bool bExporting);
bool isExporting() const;

// Last known export extents accessors.
unsigned long exportStart() const;
unsigned long exportOffset() const;
unsigned long exportLength() const;

// Audio-export method.
bool fileExport(const QString& sExportPath,
const QList<qtractorAudioBus *>& exportBuses,
@@ -289,6 +294,7 @@ class qtractorAudioEngine : public qtractorEngine
// Audio-export (in)active state.
volatile bool m_bExporting;
qtractorAudioFile *m_pExportFile;
unsigned long m_iExportOffset;
unsigned long m_iExportStart;
unsigned long m_iExportEnd;
volatile bool m_bExportDone;
@@ -1,7 +1,7 @@
// qtractorExportForm.cpp
//
/****************************************************************************
Copyright (C) 2005-2018, rncbc aka Rui Nuno Capela. All rights reserved.
Copyright (C) 2005-2019, rncbc aka Rui Nuno Capela. All rights reserved.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
@@ -282,7 +282,9 @@ void qtractorExportForm::accept (void)
if (pTracks && m_ui.AddTrackCheckBox->isChecked()) {
pTracks->addAudioTracks(
QStringList(sExportPath),
m_ui.ExportStartSpinBox->value(),
pAudioEngine->exportStart(),
pAudioEngine->exportOffset(),
pAudioEngine->exportLength(),
pTracks->currentTrack());
}
else pMainForm->addAudioFile(sExportPath);
@@ -1,7 +1,7 @@
// qtractorExportForm.h
//
/****************************************************************************
Copyright (C) 2005-2018, rncbc aka Rui Nuno Capela. All rights reserved.
Copyright (C) 2005-2019, rncbc aka Rui Nuno Capela. All rights reserved.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
@@ -3,7 +3,7 @@
<author>rncbc aka Rui Nuno Capela</author>
<comment>qtractor - An Audio/MIDI multi-track sequencer.

Copyright (C) 2005-2018, rncbc aka Rui Nuno Capela. All rights reserved.
Copyright (C) 2005-2019, rncbc aka Rui Nuno Capela. All rights reserved.

This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
@@ -3833,7 +3833,7 @@ void qtractorMainForm::trackImportAudio (void)
const unsigned long iClipStart = m_pSession->editHead();
qtractorTrack *pTrack = m_pTracks->currentTrack();
m_pTracks->addAudioTracks(
m_pFiles->audioListView()->openFileNames(), iClipStart, pTrack);
m_pFiles->audioListView()->openFileNames(), iClipStart, 0, 0, pTrack);
m_pTracks->trackView()->ensureVisibleFrame(iClipStart);
}
}
@@ -1715,7 +1715,7 @@ void qtractorTrackList::dropEvent ( QDropEvent *pDropEvent )
if (!midi_files.isEmpty())
m_pTracks->addMidiTracks(midi_files, iClipStart, pAfterTrack);
if (!audio_files.isEmpty())
m_pTracks->addAudioTracks(audio_files, iClipStart, pAfterTrack);
m_pTracks->addAudioTracks(audio_files, iClipStart, 0, 0, pAfterTrack);

if (midi_files.isEmpty() && audio_files.isEmpty()) {
qtractorMainForm *pMainForm = qtractorMainForm::getInstance();
@@ -2711,7 +2711,8 @@ bool qtractorTracks::copyTrack ( qtractorTrack *pTrack )

// Import Audio files into new tracks...
bool qtractorTracks::addAudioTracks ( const QStringList& files,
unsigned long iClipStart, qtractorTrack *pAfterTrack )
unsigned long iClipStart, unsigned long iClipOffset,
unsigned long iClipLength, qtractorTrack *pAfterTrack )
{
// Have we some?
if (files.isEmpty())
@@ -2763,6 +2764,10 @@ bool qtractorTracks::addAudioTracks ( const QStringList& files,
qtractorAudioClip *pAudioClip = new qtractorAudioClip(pTrack);
pAudioClip->setFilename(sPath);
pAudioClip->setClipStart(iClipStart);
if (iClipOffset > 0)
pAudioClip->setClipOffset(iClipOffset);
if (iClipLength > 0)
pAudioClip->setClipLength(iClipLength);
// Time to add the new track/clip into session;
// actuallly, this is when the given audio file gets open...
pTrack->addClip(pAudioClip);
@@ -69,7 +69,8 @@ class qtractorTracks : public QSplitter

// Import Audio/MIDI files into new tracks...
bool addAudioTracks(const QStringList& files,
unsigned long iClipStart, qtractorTrack *pAfterTrack = NULL);
unsigned long iClipStart, unsigned long iClipOffset = 0,
unsigned long iClipLength = 0, qtractorTrack *pAfterTrack = NULL);
bool addMidiTracks(const QStringList& files,
unsigned long iClipStart, qtractorTrack *pAfterTrack = NULL);
bool addMidiTrackChannel(const QString& sPath, int iTrackChannel,
@@ -34,16 +34,16 @@ Audio: %1 channels, %2 Hz</source>
(posunutí výšky tónu v půltónech %1)</translation>
</message>
<message>
<location filename="../qtractorAudioEngine.cpp" line="2593"/>
<location filename="../qtractorAudioEngine.cpp" line="2877"/>
<location filename="../qtractorAudioEngine.cpp" line="2632"/>
<location filename="../qtractorAudioEngine.cpp" line="2916"/>
<location filename="../qtractorMidiEngine.cpp" line="3994"/>
<location filename="../qtractorMidiEngine.cpp" line="4559"/>
<source>%1 In</source>
<translation>%1 Vstup</translation>
</message>
<message>
<location filename="../qtractorAudioEngine.cpp" line="2602"/>
<location filename="../qtractorAudioEngine.cpp" line="2877"/>
<location filename="../qtractorAudioEngine.cpp" line="2641"/>
<location filename="../qtractorAudioEngine.cpp" line="2916"/>
<location filename="../qtractorMidiEngine.cpp" line="4003"/>
<location filename="../qtractorMidiEngine.cpp" line="4559"/>
<source>%1 Out</source>
@@ -638,15 +638,15 @@ Stopa: &quot;%1&quot; Vstup: &quot;%2&quot; Výstup: &quot;%3&quot;</translation
<translation>%1 Hlasitost</translation>
</message>
<message>
<location filename="../qtractorAudioEngine.cpp" line="2595"/>
<location filename="../qtractorAudioEngine.cpp" line="2604"/>
<location filename="../qtractorAudioEngine.cpp" line="2634"/>
<location filename="../qtractorAudioEngine.cpp" line="2643"/>
<location filename="../qtractorTrack.cpp" line="695"/>
<source>%1 Gain</source>
<translation>%1 Zesílení</translation>
</message>
<message>
<location filename="../qtractorAudioEngine.cpp" line="2597"/>
<location filename="../qtractorAudioEngine.cpp" line="2606"/>
<location filename="../qtractorAudioEngine.cpp" line="2636"/>
<location filename="../qtractorAudioEngine.cpp" line="2645"/>
<location filename="../qtractorMidiEngine.cpp" line="3998"/>
<location filename="../qtractorMidiEngine.cpp" line="4007"/>
<location filename="../qtractorTrack.cpp" line="698"/>
@@ -1826,12 +1826,12 @@ Chcete jej nahradit?</translation>
<translation>Vyvedení zvukového souboru: &quot;%1&quot; právě začalo...</translation>
</message>
<message>
<location filename="../qtractorExportForm.cpp" line="291"/>
<location filename="../qtractorExportForm.cpp" line="293"/>
<source>Audio file export: &quot;%1&quot; complete.</source>
<translation>Vyvedení zvukového souboru: &quot;%1&quot; je hotovo.</translation>
</message>
<message>
<location filename="../qtractorExportForm.cpp" line="296"/>
<location filename="../qtractorExportForm.cpp" line="298"/>
<source>Audio file export:

&quot;%1&quot;
@@ -1844,17 +1844,17 @@ failed.</source>
selhalo.</translation>
</message>
<message>
<location filename="../qtractorExportForm.cpp" line="322"/>
<location filename="../qtractorExportForm.cpp" line="324"/>
<source>MIDI file export: &quot;%1&quot; started...</source>
<translation>Vyvedení souboru MIDI: &quot;%1&quot; právě začalo...</translation>
</message>
<message>
<location filename="../qtractorExportForm.cpp" line="343"/>
<location filename="../qtractorExportForm.cpp" line="345"/>
<source>MIDI file export: &quot;%1&quot; complete.</source>
<translation>Vyvedení souboru MIDI: &quot;%1&quot; je hotovo.</translation>
</message>
<message>
<location filename="../qtractorExportForm.cpp" line="348"/>
<location filename="../qtractorExportForm.cpp" line="350"/>
<source>MIDI file export:

&quot;%1&quot;
@@ -1867,17 +1867,17 @@ failed.</source>
selhalo.</translation>
</message>
<message>
<location filename="../qtractorExportForm.cpp" line="405"/>
<location filename="../qtractorExportForm.cpp" line="407"/>
<source>Export %1 File</source>
<translation>Vyvést %1 soubor</translation>
</message>
<message>
<location filename="../qtractorExportForm.cpp" line="408"/>
<location filename="../qtractorExportForm.cpp" line="410"/>
<source>%1 files (*.%1)</source>
<translation>%1 soborů (*.%1)</translation>
</message>
<message>
<location filename="../qtractorExportForm.cpp" line="409"/>
<location filename="../qtractorExportForm.cpp" line="411"/>
<source>All files (*.*)</source>
<translation>Všechny soubory (*.*)</translation>
</message>
</message>
<message>
<location filename="../qtractorTracks.cpp" line="1009"/>
<location filename="../qtractorTracks.cpp" line="2782"/>
<location filename="../qtractorTracks.cpp" line="2787"/>
<source>Audio file import &quot;%1&quot; on %2 %3.
</source>
<translation>Zavedení zvukového souboru &quot;%1&quot; do %2 %3.
</translation>
</message>
<message>
<location filename="../qtractorTracks.cpp" line="1014"/>
<location filename="../qtractorTracks.cpp" line="2787"/>
<location filename="../qtractorTracks.cpp" line="2792"/>
<source>Audio file import: &quot;%1&quot;.</source>
<translation>Zavedení zvukového souboru: &quot;%1&quot;.</translation>
</message>
<message>
<location filename="../qtractorTracks.cpp" line="1044"/>
<location filename="../qtractorTracks.cpp" line="2973"/>
<location filename="../qtractorTracks.cpp" line="2978"/>
<source>MIDI file import &quot;%1&quot; track-channel %2 on %3 %4.
</source>
<translation>Zavedení MIDI souboru: &quot;%1&quot;, stopa-kanál %2 %3 %4.
<translation>Odstranit rozsah stopy</translation>
</message>
<message>
<location filename="../qtractorTracks.cpp" line="2902"/>
<location filename="../qtractorTracks.cpp" line="2907"/>
<source>MIDI file import &quot;%1&quot; on %2 %3.
</source>
<translation>Zavedení MIDI souboru &quot;%1&quot; do %2 %3.
</translation>
</message>
<message>
<location filename="../qtractorTracks.cpp" line="2907"/>
<location filename="../qtractorTracks.cpp" line="2912"/>
<source>MIDI file import: &quot;%1&quot;.</source>
<translation>Zavedení MIDI souboru: &quot;%1&quot;.</translation>
</message>
<message>
<location filename="../qtractorTracks.cpp" line="1050"/>
<location filename="../qtractorTracks.cpp" line="2979"/>
<location filename="../qtractorTracks.cpp" line="2984"/>
<source>MIDI file import: &quot;%1&quot;, track-channel: %2.</source>
<translation>Zavedení MIDI souboru: &quot;%1&quot;, stopa-kanál: %2.</translation>
</message>
Oops, something went wrong.

0 comments on commit 391cfef

Please sign in to comment.
You can’t perform that action at this time.