From e1f4ab6af6f6df9628ccff946cfc9d550ad35d03 Mon Sep 17 00:00:00 2001 From: Paul Licameli Date: Tue, 17 May 2016 13:21:39 -0400 Subject: [PATCH] Double-click record with overdub pins record head center not right --- src/AudioIO.h | 3 ++- src/toolbars/ControlToolBar.cpp | 18 ++++++++++++++++-- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/src/AudioIO.h b/src/AudioIO.h index 00cce0056..7dde10e5e 100644 --- a/src/AudioIO.h +++ b/src/AudioIO.h @@ -382,7 +382,8 @@ class AUDACITY_DLL_API AudioIO final { double GetStreamTime(); sampleFormat GetCaptureFormat() { return mCaptureFormat; } - int GetNumCaptureChannels() { return mNumCaptureChannels; } + int GetNumPlaybackChannels() const { return mNumPlaybackChannels; } + int GetNumCaptureChannels() const { return mNumCaptureChannels; } /** \brief Array of common audio sample rates * diff --git a/src/toolbars/ControlToolBar.cpp b/src/toolbars/ControlToolBar.cpp index a6ea3b54f..593f845e5 100644 --- a/src/toolbars/ControlToolBar.cpp +++ b/src/toolbars/ControlToolBar.cpp @@ -857,8 +857,22 @@ void ControlToolBar::OnRecord(wxCommandEvent &evt) mRecord->ClearDoubleClicked(); if (doubleClicked) { - GetActiveProject()->GetPlaybackScroller().Activate - (AudacityProject::PlaybackScroller::Mode::Right); + // Display a fixed recording head while scrolling the waves continuously. + // If you overdub, you may want to anticipate some context in existing tracks, + // so center the head. If not, put it rightmost to display as much wave as we can. + const auto project = GetActiveProject(); + bool duplex; + gPrefs->Read(wxT("/AudioIO/Duplex"), &duplex, true); + + if (duplex) { + // See if there is really anything being overdubbed + if (gAudioIO->GetNumPlaybackChannels() == 0) + // No. + duplex = false; + } + + using Mode = AudacityProject::PlaybackScroller::Mode; + project->GetPlaybackScroller().Activate(duplex ? Mode::Centered : Mode::Right); return; }