1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-06-21 23:00:06 +02:00

Bug 2016 - Multiple problems with Change Pitch

This commit is contained in:
James Crook 2018-10-30 12:21:24 +00:00
parent 3be57fce49
commit cc2c3dc2fc

View File

@ -407,9 +407,17 @@ bool EffectChangePitch::TransferDataFromWindow()
// the selection. Then set some other params accordingly. // the selection. Then set some other params accordingly.
void EffectChangePitch::DeduceFrequencies() void EffectChangePitch::DeduceFrequencies()
{ {
auto FirstTrack = [&]()->const WaveTrack *{
if( !inputTracks() )
return nullptr;
return *( inputTracks()->Selected< const WaveTrack >() ).first;
};
m_dStartFrequency = 261.265;// Middle C.
// As a neat trick, attempt to get the frequency of the note at the // As a neat trick, attempt to get the frequency of the note at the
// beginning of the selection. // beginning of the selection.
auto track = *( inputTracks()->Selected< const WaveTrack >() ).first; auto track = FirstTrack();
if (track) { if (track) {
double rate = track->GetRate(); double rate = track->GetRate();