mirror of
https://github.com/cookiengineer/audacity
synced 2025-05-02 16:49:41 +02:00
Remove more uses of Track::SetLinked() and Track::SetChannel()
This commit is contained in:
parent
894f6f4f63
commit
beebe648fb
@ -7819,6 +7819,7 @@ void MenuCommandHandler::HandleMixAndRender
|
||||
WaveTrack::Holder uNewLeft, uNewRight;
|
||||
::MixAndRender(
|
||||
tracks, trackFactory, rate, defaultFormat, 0.0, 0.0, uNewLeft, uNewRight);
|
||||
tracks->GroupChannels(*uNewLeft, uNewRight ? 2 : 1);
|
||||
|
||||
if (uNewLeft) {
|
||||
// Remove originals, get stats on what tracks were mixed
|
||||
@ -8769,22 +8770,20 @@ void MenuCommandHandler::OnNewStereoTrack(const CommandContext &context)
|
||||
auto defaultFormat = project.GetDefaultFormat();
|
||||
auto rate = project.GetRate();
|
||||
|
||||
auto t = tracks->Add(trackFactory->NewWaveTrack(defaultFormat, rate));
|
||||
t->SetChannel(Track::LeftChannel);
|
||||
project.SelectNone();
|
||||
|
||||
t->SetSelected(true);
|
||||
t->SetLinked (true);
|
||||
auto left = tracks->Add(trackFactory->NewWaveTrack(defaultFormat, rate));
|
||||
left->SetSelected(true);
|
||||
|
||||
t = tracks->Add(trackFactory->NewWaveTrack(defaultFormat, rate));
|
||||
t->SetChannel(Track::RightChannel);
|
||||
auto right = tracks->Add(trackFactory->NewWaveTrack(defaultFormat, rate));
|
||||
right->SetSelected(true);
|
||||
|
||||
t->SetSelected(true);
|
||||
tracks->GroupChannels(*left, 2);
|
||||
|
||||
project.PushState(_("Created new stereo audio track"), _("New Track"));
|
||||
|
||||
project.RedrawProject();
|
||||
trackPanel->EnsureVisible(t);
|
||||
trackPanel->EnsureVisible(left);
|
||||
}
|
||||
|
||||
void MenuCommandHandler::OnNewLabelTrack(const CommandContext &context)
|
||||
|
@ -120,10 +120,7 @@ void MixAndRender(TrackList *tracks, TrackFactory *trackFactory,
|
||||
|
||||
// TODO: more-than-two-channels
|
||||
decltype(mixLeft) mixRight{};
|
||||
if (mono) {
|
||||
mixLeft->SetChannel(Track::MonoChannel);
|
||||
}
|
||||
else {
|
||||
if ( !mono ) {
|
||||
mixRight = trackFactory->NewWaveTrack(format, rate);
|
||||
if (oneinput) {
|
||||
auto channels = TrackList::Channels(first);
|
||||
@ -134,14 +131,10 @@ void MixAndRender(TrackList *tracks, TrackFactory *trackFactory,
|
||||
}
|
||||
else
|
||||
mixRight->SetName(_("Mix"));
|
||||
mixLeft->SetChannel(Track::LeftChannel);
|
||||
mixRight->SetChannel(Track::RightChannel);
|
||||
mixRight->SetOffset(mixStartTime);
|
||||
mixLeft->SetLinked(true);
|
||||
}
|
||||
|
||||
|
||||
|
||||
auto maxBlockLen = mixLeft->GetIdealBlockSize();
|
||||
|
||||
// If the caller didn't specify a time range, use the whole range in which
|
||||
|
@ -2543,6 +2543,7 @@ void Effect::Preview(bool dryOnly)
|
||||
mixRight->SetSelected(true);
|
||||
mTracks->Add(std::move(mixRight));
|
||||
}
|
||||
mTracks->GroupChannels(*mixLeft, mixRight ? 2 : 1);
|
||||
}
|
||||
else {
|
||||
for (auto src : saveTracks->Any< const WaveTrack >()) {
|
||||
|
@ -157,9 +157,7 @@ bool EffectStereoToMono::ProcessOne(int count)
|
||||
mLeftTrack->Clear(mLeftTrack->GetStartTime(), mLeftTrack->GetEndTime());
|
||||
outTrack->Flush();
|
||||
mLeftTrack->Paste(minStart, outTrack.get());
|
||||
mLeftTrack->SetLinked(false);
|
||||
mRightTrack->SetLinked(false);
|
||||
mLeftTrack->SetChannel(Track::MonoChannel);
|
||||
mOutputTracks->GroupChannels( *mLeftTrack, 1 );
|
||||
mOutputTracks->Remove(mRightTrack);
|
||||
|
||||
return bResult;
|
||||
|
@ -1164,10 +1164,13 @@ bool ControlToolBar::DoRecord(AudacityProject &project,
|
||||
|
||||
wxString baseTrackName = recordingNameCustom? defaultRecordingTrackName : defaultTrackName;
|
||||
|
||||
Track *first {};
|
||||
for (int c = 0; c < recordingChannels; c++) {
|
||||
std::shared_ptr<WaveTrack> newTrack{
|
||||
p->GetTrackFactory()->NewWaveTrack().release()
|
||||
};
|
||||
if (!first)
|
||||
first = newTrack.get();
|
||||
|
||||
// Quantize bounds to the rate of the new track.
|
||||
if (c == 0) {
|
||||
@ -1215,26 +1218,14 @@ bool ControlToolBar::DoRecord(AudacityProject &project,
|
||||
newTrack->SetMinimized(true);
|
||||
}
|
||||
|
||||
if (recordingChannels == 2) {
|
||||
if (c == 0) {
|
||||
newTrack->SetChannel(Track::LeftChannel);
|
||||
newTrack->SetLinked(true);
|
||||
}
|
||||
else {
|
||||
newTrack->SetChannel(Track::RightChannel);
|
||||
}
|
||||
}
|
||||
else {
|
||||
newTrack->SetChannel( Track::MonoChannel );
|
||||
}
|
||||
|
||||
p->GetTracks()->RegisterPendingNewTrack( newTrack );
|
||||
transportTracks.captureTracks.push_back(newTrack);
|
||||
// Bug 1548. New track needs the focus.
|
||||
p->GetTrackPanel()->SetFocusedTrack( newTrack.get() );
|
||||
}
|
||||
p->GetTracks()->GroupChannels(*first, recordingChannels);
|
||||
}
|
||||
|
||||
|
||||
//Automated Input Level Adjustment Initialization
|
||||
#ifdef EXPERIMENTAL_AUTOMATED_INPUT_LEVEL_ADJUSTMENT
|
||||
gAudioIO->AILAInitialize();
|
||||
|
@ -847,46 +847,39 @@ void WaveTrackMenuTable::OnMergeStereo(wxCommandEvent &)
|
||||
auto partner = static_cast< WaveTrack * >
|
||||
( *tracks->Find( pTrack ).advance( 1 ) );
|
||||
|
||||
pTrack->SetLinked(true);
|
||||
tracks->GroupChannels( *pTrack, 2 );
|
||||
|
||||
if (partner) {
|
||||
// Set partner's parameters to match target.
|
||||
partner->Merge(*pTrack);
|
||||
// Set partner's parameters to match target.
|
||||
partner->Merge(*pTrack);
|
||||
|
||||
pTrack->SetPan( 0.0f );
|
||||
pTrack->SetChannel(Track::LeftChannel);
|
||||
partner->SetPan( 0.0f );
|
||||
partner->SetChannel(Track::RightChannel);
|
||||
pTrack->SetPan( 0.0f );
|
||||
partner->SetPan( 0.0f );
|
||||
|
||||
// Set NEW track heights and minimized state
|
||||
bool bBothMinimizedp = ((pTrack->GetMinimized()) && (partner->GetMinimized()));
|
||||
pTrack->SetMinimized(false);
|
||||
partner->SetMinimized(false);
|
||||
int AverageHeight = (pTrack->GetHeight() + partner->GetHeight()) / 2;
|
||||
pTrack->SetHeight(AverageHeight);
|
||||
partner->SetHeight(AverageHeight);
|
||||
pTrack->SetMinimized(bBothMinimizedp);
|
||||
partner->SetMinimized(bBothMinimizedp);
|
||||
// Set NEW track heights and minimized state
|
||||
bool bBothMinimizedp = ((pTrack->GetMinimized()) && (partner->GetMinimized()));
|
||||
pTrack->SetMinimized(false);
|
||||
partner->SetMinimized(false);
|
||||
int AverageHeight = (pTrack->GetHeight() + partner->GetHeight()) / 2;
|
||||
pTrack->SetHeight(AverageHeight);
|
||||
partner->SetHeight(AverageHeight);
|
||||
pTrack->SetMinimized(bBothMinimizedp);
|
||||
partner->SetMinimized(bBothMinimizedp);
|
||||
|
||||
//On Demand - join the queues together.
|
||||
if (ODManager::IsInstanceCreated())
|
||||
if (!ODManager::Instance()->MakeWaveTrackDependent(partner, pTrack))
|
||||
{
|
||||
;
|
||||
//TODO: in the future, we will have to check the return value of MakeWaveTrackDependent -
|
||||
//if the tracks cannot merge, it returns false, and in that case we should not allow a merging.
|
||||
//for example it returns false when there are two different types of ODTasks on each track's queue.
|
||||
//we will need to display this to the user.
|
||||
}
|
||||
//On Demand - join the queues together.
|
||||
if (ODManager::IsInstanceCreated())
|
||||
if (!ODManager::Instance()->MakeWaveTrackDependent(partner, pTrack))
|
||||
{
|
||||
;
|
||||
//TODO: in the future, we will have to check the return value of MakeWaveTrackDependent -
|
||||
//if the tracks cannot merge, it returns false, and in that case we should not allow a merging.
|
||||
//for example it returns false when there are two different types of ODTasks on each track's queue.
|
||||
//we will need to display this to the user.
|
||||
}
|
||||
|
||||
AudacityProject *const project = ::GetActiveProject();
|
||||
/* i18n-hint: The string names a track */
|
||||
project->PushState(wxString::Format(_("Made '%s' a stereo track"),
|
||||
pTrack->GetName()),
|
||||
_("Make Stereo"));
|
||||
}
|
||||
else
|
||||
pTrack->SetLinked(false);
|
||||
/* i18n-hint: The string names a track */
|
||||
project->PushState(wxString::Format(_("Made '%s' a stereo track"),
|
||||
pTrack->GetName()),
|
||||
_("Make Stereo"));
|
||||
|
||||
mpData->result = RefreshCode::RefreshAll;
|
||||
}
|
||||
@ -899,7 +892,6 @@ void WaveTrackMenuTable::SplitStereo(bool stereo)
|
||||
AudacityProject *const project = ::GetActiveProject();
|
||||
auto channels = TrackList::Channels( pTrack );
|
||||
|
||||
|
||||
int totalHeight = 0;
|
||||
int nChannels = 0;
|
||||
for (auto channel : channels) {
|
||||
@ -907,7 +899,6 @@ void WaveTrackMenuTable::SplitStereo(bool stereo)
|
||||
channel->SetName(pTrack->GetName());
|
||||
if (stereo)
|
||||
channel->SetPanFromChannelType();
|
||||
channel->SetChannel(Track::MonoChannel);
|
||||
|
||||
//On Demand - have each channel add its own.
|
||||
if (ODManager::IsInstanceCreated())
|
||||
@ -919,7 +910,7 @@ void WaveTrackMenuTable::SplitStereo(bool stereo)
|
||||
++nChannels;
|
||||
}
|
||||
|
||||
pTrack->SetLinked(false);
|
||||
project->GetTracks()->GroupChannels( *pTrack, 1 );
|
||||
int averageHeight = totalHeight / nChannels;
|
||||
|
||||
for (auto channel : channels)
|
||||
@ -947,12 +938,9 @@ void WaveTrackMenuTable::OnSwapChannels(wxCommandEvent &)
|
||||
|
||||
SplitStereo(false);
|
||||
|
||||
first->SetChannel(Track::RightChannel);
|
||||
partner->SetChannel(Track::LeftChannel);
|
||||
|
||||
TrackList *const tracks = project->GetTracks();
|
||||
(tracks->MoveUp(partner));
|
||||
partner->SetLinked(true);
|
||||
tracks->MoveUp( partner );
|
||||
tracks->GroupChannels( *partner, 2 );
|
||||
|
||||
MixerBoard* pMixerBoard = project->GetMixerBoard();
|
||||
if (pMixerBoard)
|
||||
|
Loading…
x
Reference in New Issue
Block a user