1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-06-15 15:49:36 +02:00

Fix C4456 Warnings.

"C4456 declaration hides previous local declaration."
These arise from repeated declarations of the same name.
This commit is contained in:
James Crook 2018-10-10 17:28:50 +01:00
parent 43402438f8
commit 5fd95dd131
25 changed files with 198 additions and 169 deletions

View File

@ -1875,9 +1875,9 @@ bool AudacityApp::CreateSingleInstanceChecker(const wxString &dir)
if (parser->GetParamCount() > 0) if (parser->GetParamCount() > 0)
{ {
// Send each parameter to existing Audacity // Send each parameter to existing Audacity
for (size_t i = 0, cnt = parser->GetParamCount(); i < cnt; i++) for (size_t j = 0, cnt = parser->GetParamCount(); j < cnt; j++)
{ {
ok = conn->Execute(parser->GetParam(i)); ok = conn->Execute(parser->GetParam(j));
} }
} }
else else

View File

@ -611,7 +611,7 @@ bool DirManager::SetProject(wxString& newProjPath, wxString& newProjName, const
if (b) { if (b) {
if (moving || !b->IsLocked()) { if (moving || !b->IsLocked()) {
auto result = b->GetFileName(); auto result = b->GetFileName();
auto oldPath = result.name.GetFullPath(); oldPath = result.name.GetFullPath();
if (!oldPath.empty()) if (!oldPath.empty())
wxRemoveFile( oldPath ); wxRemoveFile( oldPath );
} }
@ -945,7 +945,7 @@ void DirManager::BalanceInfoDel(const wxString &file)
if(--dirTopPool[topnum]<1){ if(--dirTopPool[topnum]<1){
// do *not* erase the hash entry from dirTopPool // do *not* erase the hash entry from dirTopPool
// *do* DELETE the actual directory // *do* DELETE the actual directory
wxString dir=(projFull != wxT("")? projFull: mytemp); dir=(projFull != wxT("")? projFull: mytemp);
dir += wxFILE_SEP_PATH; dir += wxFILE_SEP_PATH;
dir += file.Mid(0,3); dir += file.Mid(0,3);
wxFileName::Rmdir(dir); wxFileName::Rmdir(dir);
@ -1506,10 +1506,10 @@ bool DirManager::EnsureSafeFilename(const wxFileName &fName)
else else
{ {
//point the aliases to the NEW filename. //point the aliases to the NEW filename.
BlockHash::iterator iter = mBlockFileHash.begin(); BlockHash::iterator iter2 = mBlockFileHash.begin();
while (iter != mBlockFileHash.end()) while (iter2 != mBlockFileHash.end())
{ {
BlockFilePtr b = iter->second.lock(); BlockFilePtr b = iter2->second.lock();
if (b) { if (b) {
auto ab = static_cast< AliasBlockFile * > ( &*b ); auto ab = static_cast< AliasBlockFile * > ( &*b );
auto db = static_cast< ODDecodeBlockFile * > ( &*b ); auto db = static_cast< ODDecodeBlockFile * > ( &*b );
@ -1525,7 +1525,7 @@ bool DirManager::EnsureSafeFilename(const wxFileName &fName)
db->ChangeAudioFile(wxFileNameWrapper{ renamedFileName }); db->ChangeAudioFile(wxFileNameWrapper{ renamedFileName });
} }
} }
++iter; ++iter2;
} }
} }

View File

@ -174,11 +174,11 @@ const float Dither::SHAPED_BS[] = { 2.033f, -2.165f, 1.959f, -1.590f, 0.6149f };
#define DITHER_LOOP(dither, store, load, dst, dstFormat, dstStride, src, srcFormat, srcStride, len) \ #define DITHER_LOOP(dither, store, load, dst, dstFormat, dstStride, src, srcFormat, srcStride, len) \
do { \ do { \
char *d, *s; \ char *d, *s; \
unsigned int i; \ unsigned int ii; \
int x; \ int x; \
for (d = (char*)dst, s = (char*)src, i = 0; \ for (d = (char*)dst, s = (char*)src, ii = 0; \
i < len; \ ii < len; \
i++, d += SAMPLE_SIZE(dstFormat) * dstStride, \ ii++, d += SAMPLE_SIZE(dstFormat) * dstStride, \
s += SAMPLE_SIZE(srcFormat) * srcStride) \ s += SAMPLE_SIZE(srcFormat) * srcStride) \
DITHER_STEP(dither, store, load, d, s); \ DITHER_STEP(dither, store, load, d, s); \
} while (0) } while (0)

View File

@ -6858,15 +6858,19 @@ MenuCommandHandler::FoundClip MenuCommandHandler::FindNextClip
t0 = AdjustForFindingStartTimes(clips, t0); t0 = AdjustForFindingStartTimes(clips, t0);
auto p = std::find_if(clips.begin(), clips.end(), [&] (const WaveClip* const& clip) { {
return clip->GetStartTime() == t0; }); auto p = std::find_if(clips.begin(), clips.end(), [&] (const WaveClip* const& clip) {
if (p != clips.end() && (*p)->GetEndTime() > t1) { return clip->GetStartTime() == t0; });
result.found = true; if (p != clips.end() && (*p)->GetEndTime() > t1) {
result.startTime = (*p)->GetStartTime(); result.found = true;
result.endTime = (*p)->GetEndTime(); result.startTime = (*p)->GetStartTime();
result.index = std::distance(clips.begin(), p); result.endTime = (*p)->GetEndTime();
result.index = std::distance(clips.begin(), p);
return result;
}
} }
else {
{
auto p = std::find_if(clips.begin(), clips.end(), [&] (const WaveClip* const& clip) { auto p = std::find_if(clips.begin(), clips.end(), [&] (const WaveClip* const& clip) {
return clip->GetStartTime() > t0; }); return clip->GetStartTime() > t0; });
if (p != clips.end()) { if (p != clips.end()) {
@ -6874,6 +6878,7 @@ MenuCommandHandler::FoundClip MenuCommandHandler::FindNextClip
result.startTime = (*p)->GetStartTime(); result.startTime = (*p)->GetStartTime();
result.endTime = (*p)->GetEndTime(); result.endTime = (*p)->GetEndTime();
result.index = std::distance(clips.begin(), p); result.index = std::distance(clips.begin(), p);
return result;
} }
} }
@ -6889,15 +6894,19 @@ MenuCommandHandler::FoundClip MenuCommandHandler::FindPrevClip
t0 = AdjustForFindingStartTimes(clips, t0); t0 = AdjustForFindingStartTimes(clips, t0);
auto p = std::find_if(clips.begin(), clips.end(), [&] (const WaveClip* const& clip) { {
return clip->GetStartTime() == t0; }); auto p = std::find_if(clips.begin(), clips.end(), [&] (const WaveClip* const& clip) {
if (p != clips.end() && (*p)->GetEndTime() < t1) { return clip->GetStartTime() == t0; });
result.found = true; if (p != clips.end() && (*p)->GetEndTime() < t1) {
result.startTime = (*p)->GetStartTime(); result.found = true;
result.endTime = (*p)->GetEndTime(); result.startTime = (*p)->GetStartTime();
result.index = std::distance(clips.begin(), p); result.endTime = (*p)->GetEndTime();
result.index = std::distance(clips.begin(), p);
return result;
}
} }
else {
{
auto p = std::find_if(clips.rbegin(), clips.rend(), [&] (const WaveClip* const& clip) { auto p = std::find_if(clips.rbegin(), clips.rend(), [&] (const WaveClip* const& clip) {
return clip->GetStartTime() < t0; }); return clip->GetStartTime() < t0; });
if (p != clips.rend()) { if (p != clips.rend()) {
@ -6905,6 +6914,7 @@ MenuCommandHandler::FoundClip MenuCommandHandler::FindPrevClip
result.startTime = (*p)->GetStartTime(); result.startTime = (*p)->GetStartTime();
result.endTime = (*p)->GetEndTime(); result.endTime = (*p)->GetEndTime();
result.index = static_cast<int>(clips.size()) - 1 - std::distance(clips.rbegin(), p); result.index = static_cast<int>(clips.size()) - 1 - std::distance(clips.rbegin(), p);
return result;
} }
} }
@ -6926,17 +6936,17 @@ int MenuCommandHandler::FindClips
int nTracksSearched = 0; int nTracksSearched = 0;
auto leaders = tracks->Leaders(); auto leaders = tracks->Leaders();
auto range = leaders.Filter<const WaveTrack>(); auto rangeLeaders = leaders.Filter<const WaveTrack>();
if (anyWaveTracksSelected) if (anyWaveTracksSelected)
range = range + &Track::GetSelected; rangeLeaders = rangeLeaders + &Track::GetSelected;
for (auto waveTrack : range) { for (auto waveTrack : rangeLeaders) {
bool stereoAndDiff = ChannelsHaveDifferentClipBoundaries(waveTrack); bool stereoAndDiff = ChannelsHaveDifferentClipBoundaries(waveTrack);
auto range = stereoAndDiff auto rangeChans = stereoAndDiff
? TrackList::Channels( waveTrack ) ? TrackList::Channels( waveTrack )
: TrackList::SingletonRange( waveTrack ); : TrackList::SingletonRange( waveTrack );
for ( auto wt : range ) { for ( auto wt : rangeChans ) {
auto result = next ? FindNextClip(project, wt, t0, t1) : auto result = next ? FindNextClip(project, wt, t0, t1) :
FindPrevClip(project, wt, t0, t1); FindPrevClip(project, wt, t0, t1);
if (result.found) { if (result.found) {
@ -6957,12 +6967,12 @@ int MenuCommandHandler::FindClips
auto compareStart = [] (const FoundClip& a, const FoundClip& b) auto compareStart = [] (const FoundClip& a, const FoundClip& b)
{ return a.startTime < b.startTime; }; { return a.startTime < b.startTime; };
auto p = next ? std::min_element(results.begin(), results.end(), compareStart) : auto pStart = next ? std::min_element(results.begin(), results.end(), compareStart) :
std::max_element(results.begin(), results.end(), compareStart); std::max_element(results.begin(), results.end(), compareStart);
std::vector<FoundClip> resultsStartTime; std::vector<FoundClip> resultsStartTime;
for ( auto &r : results ) for ( auto &r : results )
if ( r.startTime == (*p).startTime ) if ( r.startTime == (*pStart).startTime )
resultsStartTime.push_back( r ); resultsStartTime.push_back( r );
if (resultsStartTime.size() > 1) { if (resultsStartTime.size() > 1) {
@ -6971,13 +6981,13 @@ int MenuCommandHandler::FindClips
auto compareEnd = [] (const FoundClip& a, const FoundClip& b) auto compareEnd = [] (const FoundClip& a, const FoundClip& b)
{ return a.endTime < b.endTime; }; { return a.endTime < b.endTime; };
auto p = next ? std::min_element(resultsStartTime.begin(), auto pEnd = next ? std::min_element(resultsStartTime.begin(),
resultsStartTime.end(), compareEnd) : resultsStartTime.end(), compareEnd) :
std::max_element(resultsStartTime.begin(), std::max_element(resultsStartTime.begin(),
resultsStartTime.end(), compareEnd); resultsStartTime.end(), compareEnd);
for ( auto &r : resultsStartTime ) for ( auto &r : resultsStartTime )
if ( r.endTime == (*p).endTime ) if ( r.endTime == (*pEnd).endTime )
finalResults.push_back( r ); finalResults.push_back( r );
} }
else { else {
@ -8152,17 +8162,17 @@ int MenuCommandHandler::FindClipBoundaries
int nTracksSearched = 0; int nTracksSearched = 0;
auto leaders = tracks->Leaders(); auto leaders = tracks->Leaders();
auto range = leaders.Filter<const WaveTrack>(); auto rangeLeaders = leaders.Filter<const WaveTrack>();
if (anyWaveTracksSelected) if (anyWaveTracksSelected)
range = range + &Track::GetSelected; rangeLeaders = rangeLeaders + &Track::GetSelected;
for (auto waveTrack : range) { for (auto waveTrack : rangeLeaders) {
bool stereoAndDiff = ChannelsHaveDifferentClipBoundaries(waveTrack); bool stereoAndDiff = ChannelsHaveDifferentClipBoundaries(waveTrack);
auto range = stereoAndDiff auto rangeChan = stereoAndDiff
? TrackList::Channels( waveTrack ) ? TrackList::Channels( waveTrack )
: TrackList::SingletonRange(waveTrack); : TrackList::SingletonRange(waveTrack);
for (auto wt : range) { for (auto wt : rangeChan) {
auto result = next ? FindNextClipBoundary(wt, time) : auto result = next ? FindNextClipBoundary(wt, time) :
FindPrevClipBoundary(wt, time); FindPrevClipBoundary(wt, time);
if (result.nFound > 0) { if (result.nFound > 0) {

View File

@ -504,7 +504,7 @@ void ModuleManager::FindAllPlugins(PluginIDList & providers, wxArrayString & pat
plug = pm.GetNextPlugin(PluginTypeModule); plug = pm.GetNextPlugin(PluginTypeModule);
} }
for (size_t i = 0, cnt = modIDs.size(); i < cnt; i++) for (size_t i = 0, cntIds = modIDs.size(); i < cntIds; i++)
{ {
PluginID providerID = modIDs[i]; PluginID providerID = modIDs[i];
@ -515,10 +515,10 @@ void ModuleManager::FindAllPlugins(PluginIDList & providers, wxArrayString & pat
continue; continue;
wxArrayString newpaths = module->FindPluginPaths(pm); wxArrayString newpaths = module->FindPluginPaths(pm);
for (size_t i = 0, cnt = newpaths.size(); i < cnt; i++) for (size_t j = 0, cntPaths = newpaths.size(); j < cntPaths; j++)
{ {
providers.push_back(providerID); providers.push_back(providerID);
paths.push_back(newpaths[i]); paths.push_back(newpaths[j]);
} }
} }
} }

View File

@ -924,11 +924,13 @@ void PluginRegistrationDialog::OnEnable(wxCommandEvent & WXUNUSED(evt))
{ {
std::vector<long> items; std::vector<long> items;
long i = mEffects->GetNextItem(-1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
while (i != wxNOT_FOUND)
{ {
items.insert(items.begin(), i); long i = mEffects->GetNextItem(-1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
i = mEffects->GetNextItem(i, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED); while (i != wxNOT_FOUND)
{
items.insert(items.begin(), i);
i = mEffects->GetNextItem(i, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
}
} }
for (size_t i = 0, cnt = items.size(); i < cnt; i++) for (size_t i = 0, cnt = items.size(); i < cnt; i++)
@ -941,11 +943,13 @@ void PluginRegistrationDialog::OnDisable(wxCommandEvent & WXUNUSED(evt))
{ {
std::vector<long> items; std::vector<long> items;
long i = mEffects->GetNextItem(-1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
while (i != wxNOT_FOUND)
{ {
items.insert(items.begin(), i); long i = mEffects->GetNextItem(-1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
i = mEffects->GetNextItem(i, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED); while (i != wxNOT_FOUND)
{
items.insert(items.begin(), i);
i = mEffects->GetNextItem(i, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
}
} }
for (size_t i = 0, cnt = items.size(); i < cnt; i++) for (size_t i = 0, cnt = items.size(); i < cnt; i++)
@ -1004,15 +1008,15 @@ void PluginRegistrationDialog::OnOK(wxCommandEvent & WXUNUSED(evt))
wxString errMsgs; wxString errMsgs;
// Try to register the plugin via each provider until one succeeds // Try to register the plugin via each provider until one succeeds
for (size_t j = 0, cnt = item.plugs.size(); j < cnt; j++) for (size_t j = 0, cntj = item.plugs.size(); j < cntj; j++)
{ {
wxString errMsg; wxString errMsg;
if (mm.RegisterEffectPlugin(item.plugs[j]->GetProviderID(), path, if (mm.RegisterEffectPlugin(item.plugs[j]->GetProviderID(), path,
errMsg)) errMsg))
{ {
for (size_t j = 0, cnt = item.plugs.size(); j < cnt; j++) for (size_t k = 0, cntk = item.plugs.size(); k < cntk; k++)
{ {
pm.mPlugins.erase(item.plugs[j]->GetProviderID() + wxT("_") + path); pm.mPlugins.erase(item.plugs[k]->GetProviderID() + wxT("_") + path);
} }
// Bug 1893. We've found a provider that works. // Bug 1893. We've found a provider that works.
// Error messages from any that failed are no longer useful. // Error messages from any that failed are no longer useful.
@ -2410,13 +2414,13 @@ void PluginManager::CheckForUpdates(bool bFast)
if (pathIndex.Index(path) == wxNOT_FOUND) if (pathIndex.Index(path) == wxNOT_FOUND)
{ {
PluginID ID = plugID + wxT("_") + path; PluginID ID = plugID + wxT("_") + path;
PluginDescriptor & plug = mPlugins[ID]; // This will create a NEW descriptor PluginDescriptor & plug2 = mPlugins[ID]; // This will create a NEW descriptor
plug.SetPluginType(PluginTypeStub); plug2.SetPluginType(PluginTypeStub);
plug.SetID(ID); plug2.SetID(ID);
plug.SetProviderID(plugID); plug2.SetProviderID(plugID);
plug.SetPath(path); plug2.SetPath(path);
plug.SetEnabled(false); plug2.SetEnabled(false);
plug.SetValid(false); plug2.SetValid(false);
} }
} }
} }

View File

@ -1520,29 +1520,29 @@ void TrackArtist::DrawWaveform(TrackPanelDrawingContext &context,
auto target2 = dynamic_cast<CutlineHandle*>(context.target.get()); auto target2 = dynamic_cast<CutlineHandle*>(context.target.get());
#endif #endif
for (const auto loc : track->GetCachedLocations()) { for (const auto loc : track->GetCachedLocations()) {
bool highlight = false; bool highlightLoc = false;
#ifdef EXPERIMENTAL_TRACK_PANEL_HIGHLIGHTING #ifdef EXPERIMENTAL_TRACK_PANEL_HIGHLIGHTING
highlight = highlightLoc =
target2 && target2->GetTrack().get() == track && target2 && target2->GetTrack().get() == track &&
target2->GetLocation() == loc; target2->GetLocation() == loc;
#endif #endif
const int xx = zoomInfo.TimeToPosition(loc.pos); const int xx = zoomInfo.TimeToPosition(loc.pos);
if (xx >= 0 && xx < rect.width) { if (xx >= 0 && xx < rect.width) {
dc.SetPen( highlight ? AColor::uglyPen : *wxGREY_PEN ); dc.SetPen( highlightLoc ? AColor::uglyPen : *wxGREY_PEN );
AColor::Line(dc, (int) (rect.x + xx - 1), rect.y, (int) (rect.x + xx - 1), rect.y + rect.height); AColor::Line(dc, (int) (rect.x + xx - 1), rect.y, (int) (rect.x + xx - 1), rect.y + rect.height);
if (loc.typ == WaveTrackLocation::locationCutLine) { if (loc.typ == WaveTrackLocation::locationCutLine) {
dc.SetPen( highlight ? AColor::uglyPen : *wxRED_PEN ); dc.SetPen( highlightLoc ? AColor::uglyPen : *wxRED_PEN );
} }
else { else {
#ifdef EXPERIMENTAL_DA #ifdef EXPERIMENTAL_DA
// JKC Black does not show up enough. // JKC Black does not show up enough.
dc.SetPen(highlight ? AColor::uglyPen : *wxWHITE_PEN); dc.SetPen(highlightLoc ? AColor::uglyPen : *wxWHITE_PEN);
#else #else
dc.SetPen(highlight ? AColor::uglyPen : *wxBLACK_PEN); dc.SetPen(highlightLoc ? AColor::uglyPen : *wxBLACK_PEN);
#endif #endif
} }
AColor::Line(dc, (int) (rect.x + xx), rect.y, (int) (rect.x + xx), rect.y + rect.height); AColor::Line(dc, (int) (rect.x + xx), rect.y, (int) (rect.x + xx), rect.y + rect.height);
dc.SetPen( highlight ? AColor::uglyPen : *wxGREY_PEN ); dc.SetPen( highlightLoc ? AColor::uglyPen : *wxGREY_PEN );
AColor::Line(dc, (int) (rect.x + xx + 1), rect.y, (int) (rect.x + xx + 1), rect.y + rect.height); AColor::Line(dc, (int) (rect.x + xx + 1), rect.y, (int) (rect.x + xx + 1), rect.y + rect.height);
} }
} }
@ -1841,19 +1841,19 @@ void TrackArtist::DrawClipWaveform(TrackPanelDrawingContext &context,
// the envelope and using a colored pen for the selected // the envelope and using a colored pen for the selected
// part of the waveform // part of the waveform
{ {
double t0, t1; double tt0, tt1;
if (track->GetSelected() || track->IsSyncLockSelected()) { if (track->GetSelected() || track->IsSyncLockSelected()) {
t0 = track->LongSamplesToTime(track->TimeToLongSamples(selectedRegion.t0())), tt0 = track->LongSamplesToTime(track->TimeToLongSamples(selectedRegion.t0())),
t1 = track->LongSamplesToTime(track->TimeToLongSamples(selectedRegion.t1())); tt1 = track->LongSamplesToTime(track->TimeToLongSamples(selectedRegion.t1()));
} }
else else
t0 = t1 = 0.0; tt0 = tt1 = 0.0;
DrawWaveformBackground(dc, leftOffset, mid, DrawWaveformBackground(dc, leftOffset, mid,
env, env,
zoomMin, zoomMax, zoomMin, zoomMax,
track->ZeroLevelYCoordinate(mid), track->ZeroLevelYCoordinate(mid),
dB, dBRange, dB, dBRange,
t0, t1, zoomInfo, drawEnvelope, tt0, tt1, zoomInfo, drawEnvelope,
!track->GetSelected(), highlightEnvelope); !track->GetSelected(), highlightEnvelope);
} }

View File

@ -1705,9 +1705,11 @@ bool Effect::ProcessTrack(int count,
// Get the current number of delayed samples and accumulate // Get the current number of delayed samples and accumulate
if (isProcessor) if (isProcessor)
{ {
auto delay = GetLatency(); {
curDelay += delay; auto delay = GetLatency();
delayRemaining += delay; curDelay += delay;
delayRemaining += delay;
}
// If the plugin has delayed the output by more samples than our current // If the plugin has delayed the output by more samples than our current
// block size, then we leave the output pointers alone. This effectively // block size, then we leave the output pointers alone. This effectively

View File

@ -193,8 +193,10 @@ bool EffectReverse::ProcessOneWave(int count, WaveTrack * track, sampleCount sta
// the last clip of revClips is appended to the track first // the last clip of revClips is appended to the track first
// PRL: I don't think that matters, the sequence of storage of clips in the track // PRL: I don't think that matters, the sequence of storage of clips in the track
// is not elsewhere assumed to be by time // is not elsewhere assumed to be by time
for (auto it = revClips.rbegin(), end = revClips.rend(); it != end; ++it) {
track->AddClip(std::move(*it)); for (auto it = revClips.rbegin(), end = revClips.rend(); it != end; ++it)
track->AddClip(std::move(*it));
}
for (auto &clip : otherClips) for (auto &clip : otherClips)
track->AddClip(std::move(clip)); track->AddClip(std::move(clip));

View File

@ -337,9 +337,11 @@ bool EffectScienFilter::Init()
double rate = 0.0; double rate = 0.0;
auto trackRange = inputTracks()->Selected< const WaveTrack >(); auto trackRange = inputTracks()->Selected< const WaveTrack >();
auto t = *trackRange.begin();
mNyquist = (t ? t->GetRate() : GetActiveProject()->GetRate()) / 2.0; {
auto t = *trackRange.begin();
mNyquist = (t ? t->GetRate() : GetActiveProject()->GetRate()) / 2.0;
}
for (auto t : trackRange) for (auto t : trackRange)
{ {
@ -662,8 +664,8 @@ bool EffectScienFilter::CalcFilter()
fDCPoleDistSqr = fZPoleX + 1; // dist from Nyquist fDCPoleDistSqr = fZPoleX + 1; // dist from Nyquist
for (int iPair = 1; iPair <= mOrder/2; iPair++) for (int iPair = 1; iPair <= mOrder/2; iPair++)
{ {
float fSPoleX = fC * cos (PI - iPair * PI / mOrder); fSPoleX = fC * cos (PI - iPair * PI / mOrder);
float fSPoleY = fC * sin (PI - iPair * PI / mOrder); fSPoleY = fC * sin (PI - iPair * PI / mOrder);
BilinTransform (fSPoleX, fSPoleY, &fZPoleX, &fZPoleY); BilinTransform (fSPoleX, fSPoleY, &fZPoleX, &fZPoleY);
mpBiquad[iPair].fNumerCoeffs [0] = 1; mpBiquad[iPair].fNumerCoeffs [0] = 1;
if (mFilterSubtype == kLowPass) // LOWPASS if (mFilterSubtype == kLowPass) // LOWPASS

View File

@ -1090,9 +1090,9 @@ bool LadspaEffect::SetAutomationParameters(CommandParameters & parms)
{ {
for (unsigned long p = 0; p < mData->PortCount; p++) for (unsigned long p = 0; p < mData->PortCount; p++)
{ {
LADSPA_PortDescriptor d = mData->PortDescriptors[p]; LADSPA_PortDescriptor descriptor = mData->PortDescriptors[p];
if (LADSPA_IS_PORT_CONTROL(d) && LADSPA_IS_PORT_INPUT(d)) if (LADSPA_IS_PORT_CONTROL(descriptor) && LADSPA_IS_PORT_INPUT(descriptor))
{ {
wxString labelText = LAT1CTOWX(mData->PortNames[p]); wxString labelText = LAT1CTOWX(mData->PortNames[p]);
double d = 0.0; double d = 0.0;

View File

@ -1572,7 +1572,7 @@ bool LV2Effect::BuildPlain()
mGroups.Sort(); mGroups.Sort();
for (size_t i = 0, cnt = mGroups.GetCount(); i < cnt; i++) for (size_t i = 0, groupCount = mGroups.GetCount(); i < groupCount; i++)
{ {
wxString label = mGroups[i]; wxString label = mGroups[i];
if (label.IsEmpty()) if (label.IsEmpty())
@ -1585,7 +1585,7 @@ bool LV2Effect::BuildPlain()
gridSizer->AddGrowableCol(3); gridSizer->AddGrowableCol(3);
const auto & params = mGroupMap[mGroups[i]]; const auto & params = mGroupMap[mGroups[i]];
for (size_t pi = 0, cnt = params.size(); pi < cnt; pi++) for (size_t pi = 0, paramCount = params.size(); pi < paramCount; pi++)
{ {
int p = params[pi]; int p = params[pi];
LV2Port & ctrl = mControls[p]; LV2Port & ctrl = mControls[p];

View File

@ -610,7 +610,7 @@ bool NyquistEffect::Process()
return true; return true;
// Restore the reentry counter (to zero) when we exit. // Restore the reentry counter (to zero) when we exit.
auto cleanup = valueRestorer( mReentryCount); auto countRestorer = valueRestorer( mReentryCount);
mReentryCount++; mReentryCount++;
RegisterFunctions(); RegisterFunctions();

View File

@ -146,7 +146,7 @@ unsigned VampEffect::GetAudioInCount()
bool VampEffect::GetAutomationParameters(CommandParameters & parms) bool VampEffect::GetAutomationParameters(CommandParameters & parms)
{ {
for (size_t p = 0, cnt = mParameters.size(); p < cnt; p++) for (size_t p = 0, paramCount = mParameters.size(); p < paramCount; p++)
{ {
wxString key = wxString::FromUTF8(mParameters[p].identifier.c_str()); wxString key = wxString::FromUTF8(mParameters[p].identifier.c_str());
float value = mPlugin->getParameter(mParameters[p].identifier); float value = mPlugin->getParameter(mParameters[p].identifier);
@ -169,7 +169,7 @@ bool VampEffect::GetAutomationParameters(CommandParameters & parms)
std::vector<IdentInterfaceSymbol> choices; std::vector<IdentInterfaceSymbol> choices;
int val = 0; int val = 0;
for (size_t i = 0, cnt = mParameters[p].valueNames.size(); i < cnt; i++) for (size_t i = 0, choiceCount = mParameters[p].valueNames.size(); i < choiceCount; i++)
{ {
wxString choice = wxString::FromUTF8(mParameters[p].valueNames[i].c_str()); wxString choice = wxString::FromUTF8(mParameters[p].valueNames[i].c_str());
if (size_t(value - mParameters[p].minValue + 0.5) == i) if (size_t(value - mParameters[p].minValue + 0.5) == i)
@ -193,7 +193,7 @@ bool VampEffect::GetAutomationParameters(CommandParameters & parms)
bool VampEffect::SetAutomationParameters(CommandParameters & parms) bool VampEffect::SetAutomationParameters(CommandParameters & parms)
{ {
// First pass verifies values // First pass verifies values
for (size_t p = 0, cnt = mParameters.size(); p < cnt; p++) for (size_t p = 0, paramCount = mParameters.size(); p < paramCount; p++)
{ {
wxString key = wxString::FromUTF8(mParameters[p].identifier.c_str()); wxString key = wxString::FromUTF8(mParameters[p].identifier.c_str());
float lower = mParameters[p].minValue; float lower = mParameters[p].minValue;
@ -216,7 +216,7 @@ bool VampEffect::SetAutomationParameters(CommandParameters & parms)
std::vector<IdentInterfaceSymbol> choices; std::vector<IdentInterfaceSymbol> choices;
int val; int val;
for (size_t i = 0, cnt = mParameters[p].valueNames.size(); i < cnt; i++) for (size_t i = 0, choiceCount = mParameters[p].valueNames.size(); i < choiceCount; i++)
{ {
wxString choice = wxString::FromUTF8(mParameters[p].valueNames[i].c_str()); wxString choice = wxString::FromUTF8(mParameters[p].valueNames[i].c_str());
choices.push_back(choice); choices.push_back(choice);
@ -238,7 +238,7 @@ bool VampEffect::SetAutomationParameters(CommandParameters & parms)
} }
// Second pass sets the variables // Second pass sets the variables
for (size_t p = 0, cnt = mParameters.size(); p < cnt; p++) for (size_t p = 0, paramCount = mParameters.size(); p < paramCount; p++)
{ {
wxString key = wxString::FromUTF8(mParameters[p].identifier.c_str()); wxString key = wxString::FromUTF8(mParameters[p].identifier.c_str());
float lower = mParameters[p].minValue; float lower = mParameters[p].minValue;
@ -262,7 +262,7 @@ bool VampEffect::SetAutomationParameters(CommandParameters & parms)
std::vector<IdentInterfaceSymbol> choices; std::vector<IdentInterfaceSymbol> choices;
int val = 0; int val = 0;
for (size_t i = 0, cnt = mParameters[p].valueNames.size(); i < cnt; i++) for (size_t i = 0, choiceCount = mParameters[p].valueNames.size(); i < choiceCount; i++)
{ {
wxString choice = wxString::FromUTF8(mParameters[p].valueNames[i].c_str()); wxString choice = wxString::FromUTF8(mParameters[p].valueNames[i].c_str());
choices.push_back(choice); choices.push_back(choice);

View File

@ -598,19 +598,21 @@ bool Exporter::GetFilename()
mFilterIndex = fd.GetFilterIndex(); mFilterIndex = fd.GetFilterIndex();
} }
int c = 0;
int i = -1;
for (const auto &pPlugin : mPlugins)
{ {
++i; int c = 0;
for (int j = 0; j < pPlugin->GetFormatCount(); j++) int i = -1;
for (const auto &pPlugin : mPlugins)
{ {
if (mFilterIndex == c) ++i;
for (int j = 0; j < pPlugin->GetFormatCount(); j++)
{ {
mFormat = i; if (mFilterIndex == c)
mSubFormat = j; {
mFormat = i;
mSubFormat = j;
}
c++;
} }
c++;
} }
} }

View File

@ -806,13 +806,13 @@ bool ExportFFmpeg::EncodeAudioFrame(int16_t *pFrame, size_t frameSize)
} }
// Read raw audio samples out of the FIFO in nAudioFrameSizeOut byte-sized groups to encode. // Read raw audio samples out of the FIFO in nAudioFrameSizeOut byte-sized groups to encode.
while ((ret = av_fifo_size(mEncAudioFifo.get())) >= nAudioFrameSizeOut) while ( av_fifo_size(mEncAudioFifo.get()) >= nAudioFrameSizeOut)
{ {
ret = av_fifo_generic_read(mEncAudioFifo.get(), mEncAudioFifoOutBuf.get(), nAudioFrameSizeOut, NULL); ret = av_fifo_generic_read(mEncAudioFifo.get(), mEncAudioFifoOutBuf.get(), nAudioFrameSizeOut, NULL);
AVPacketEx pkt; AVPacketEx pkt;
int ret= encode_audio(mEncAudioCodecCtx.get(), ret= encode_audio(mEncAudioCodecCtx.get(),
&pkt, // out &pkt, // out
mEncAudioFifoOutBuf.get(), // in mEncAudioFifoOutBuf.get(), // in
default_frame_size); default_frame_size);

View File

@ -574,26 +574,28 @@ void FFmpegPresets::SavePreset(ExportFFmpegOptions *parent, wxString &name)
if (action == wxNO) return; if (action == wxNO) return;
} }
wxWindow *wnd;
wxListBox *lb;
wnd = dynamic_cast<wxWindow*>(parent)->FindWindowById(FEFormatID,parent);
lb = dynamic_cast<wxListBox*>(wnd);
if (lb->GetSelection() < 0)
{ {
AudacityMessageBox(_("Please select format before saving a profile")); wxWindow *wnd;
return; wxListBox *lb;
}
format = lb->GetStringSelection();
wnd = dynamic_cast<wxWindow*>(parent)->FindWindowById(FECodecID,parent); wnd = dynamic_cast<wxWindow*>(parent)->FindWindowById(FEFormatID,parent);
lb = dynamic_cast<wxListBox*>(wnd); lb = dynamic_cast<wxListBox*>(wnd);
if (lb->GetSelection() < 0) if (lb->GetSelection() < 0)
{ {
AudacityMessageBox(_("Please select codec before saving a profile")); AudacityMessageBox(_("Please select format before saving a profile"));
return; return;
}
format = lb->GetStringSelection();
wnd = dynamic_cast<wxWindow*>(parent)->FindWindowById(FECodecID,parent);
lb = dynamic_cast<wxListBox*>(wnd);
if (lb->GetSelection() < 0)
{
AudacityMessageBox(_("Please select codec before saving a profile"));
return;
}
codec = lb->GetStringSelection();
} }
codec = lb->GetStringSelection();
preset = &mPresets[name]; preset = &mPresets[name];
preset->mPresetName = name; preset->mPresetName = name;

View File

@ -752,7 +752,6 @@ ProgressResult ExportMultiple::ExportMultipleByTrack(bool byName,
{ {
wxASSERT(mProject); wxASSERT(mProject);
bool tagsPrompt = mProject->GetShowId3Dialog(); bool tagsPrompt = mProject->GetShowId3Dialog();
Track *tr;
int l = 0; // track counter int l = 0; // track counter
auto ok = ProgressResult::Success; auto ok = ProgressResult::Success;
wxArrayString otherNames; wxArrayString otherNames;

View File

@ -253,15 +253,15 @@ void ExportPCMOptions::OnHeaderChoice(wxCommandEvent & WXUNUSED(evt))
int num = sf_num_encodings(); int num = sf_num_encodings();
for (i = 0; i < num; i++) for (i = 0; i < num; i++)
{ {
int enc = sf_encoding_index_to_subtype(i); int encSubtype = sf_encoding_index_to_subtype(i);
int fmt = format | enc; int fmt = format | encSubtype;
bool valid = ValidatePair(fmt); bool valid = ValidatePair(fmt);
if (valid) if (valid)
{ {
const auto name = sf_encoding_index_name(i); const auto name = sf_encoding_index_name(i);
mEncodingNames.Add(name); mEncodingNames.Add(name);
mEncodingChoice->Append(name); mEncodingChoice->Append(name);
mEncodingFormats.push_back(enc); mEncodingFormats.push_back(encSubtype);
for (j = 0; j < sfnum; j++) for (j = 0; j < sfnum; j++)
{ {
int enc = sfs[j]; int enc = sfs[j];

View File

@ -454,10 +454,11 @@ ProgressResult FLACImportFileHandle::Import(TrackFactory *trackFactory,
mChannels.resize(mNumChannels); mChannels.resize(mNumChannels);
auto iter = mChannels.begin(); {
for (size_t c = 0; c < mNumChannels; ++iter, ++c) auto iter = mChannels.begin();
*iter = trackFactory->NewWaveTrack(mFormat, mSampleRate); for (size_t c = 0; c < mNumChannels; ++iter, ++c)
*iter = trackFactory->NewWaveTrack(mFormat, mSampleRate);
}
//Start OD //Start OD
bool useOD = false; bool useOD = false;

View File

@ -366,9 +366,12 @@ ProgressResult PCMImportFileHandle::Import(TrackFactory *trackFactory,
NewChannelGroup channels(mInfo.channels); NewChannelGroup channels(mInfo.channels);
auto iter = channels.begin(); {
for (int c = 0; c < mInfo.channels; ++iter, ++c) // iter not used outside this scope.
*iter = trackFactory->NewWaveTrack(mFormat, mInfo.samplerate); auto iter = channels.begin();
for (int c = 0; c < mInfo.channels; ++iter, ++c)
*iter = trackFactory->NewWaveTrack(mFormat, mInfo.samplerate);
}
auto fileTotalFrames = auto fileTotalFrames =
(sampleCount)mInfo.frames; // convert from sf_count_t (sampleCount)mInfo.frames; // convert from sf_count_t
@ -673,8 +676,8 @@ ProgressResult PCMImportFileHandle::Import(TrackFactory *trackFactory,
ustr = id3_field_getstring(&frame->fields[1]); ustr = id3_field_getstring(&frame->fields[1]);
if (ustr) { if (ustr) {
// Is this duplication really needed? // Is this duplication really needed?
MallocString<> str{ (char *)id3_ucs4_utf8duplicate(ustr) }; MallocString<> convStr{ (char *)id3_ucs4_utf8duplicate(ustr) };
n = UTF8CTOWX(str.get()); n = UTF8CTOWX(convStr.get());
} }
ustr = id3_field_getstring(&frame->fields[2]); ustr = id3_field_getstring(&frame->fields[2]);
@ -685,8 +688,8 @@ ProgressResult PCMImportFileHandle::Import(TrackFactory *trackFactory,
if (ustr) { if (ustr) {
// Is this duplication really needed? // Is this duplication really needed?
MallocString<> str{ (char *)id3_ucs4_utf8duplicate(ustr) }; MallocString<> convStr{ (char *)id3_ucs4_utf8duplicate(ustr) };
v = UTF8CTOWX(str.get()); v = UTF8CTOWX(convStr.get());
} }
if (!n.IsEmpty() && !v.IsEmpty()) { if (!n.IsEmpty() && !v.IsEmpty()) {

View File

@ -112,8 +112,6 @@ void ImportRaw(wxWindow *parent, const wxString &fileName,
{ {
SF_INFO sndInfo; SF_INFO sndInfo;
int result;
unsigned numChannels = 0; unsigned numChannels = 0;
try { try {
@ -171,15 +169,17 @@ void ImportRaw(wxWindow *parent, const wxString &fileName,
throw FileException{ FileException::Cause::Open, fileName }; throw FileException{ FileException::Cause::Open, fileName };
} }
result = sf_command(sndFile.get(), SFC_SET_RAW_START_OFFSET, &offset, sizeof(offset));
if (result != 0) {
char str[1000];
sf_error_str(sndFile.get(), str, 1000);
wxPrintf("%s\n", str);
throw FileException{ FileException::Cause::Read, fileName }; {
int result = sf_command(sndFile.get(), SFC_SET_RAW_START_OFFSET, &offset, sizeof(offset));
if (result != 0) {
char str[1000];
sf_error_str(sndFile.get(), str, 1000);
wxPrintf("%s\n", str);
throw FileException{ FileException::Cause::Read, fileName };
}
} }
SFCall<sf_count_t>(sf_seek, sndFile.get(), 0, SEEK_SET); SFCall<sf_count_t>(sf_seek, sndFile.get(), 0, SEEK_SET);
auto totalFrames = auto totalFrames =
@ -204,10 +204,12 @@ void ImportRaw(wxWindow *parent, const wxString &fileName,
auto &channels = results[0]; auto &channels = results[0];
channels.resize(numChannels); channels.resize(numChannels);
auto iter = channels.begin(); {
for (decltype(numChannels) c = 0; c < numChannels; ++iter, ++c) // iter not used outside this scope.
*iter = trackFactory->NewWaveTrack(format, rate); auto iter = channels.begin();
for (decltype(numChannels) c = 0; c < numChannels; ++iter, ++c)
*iter = trackFactory->NewWaveTrack(format, rate);
}
const auto firstChannel = channels.begin()->get(); const auto firstChannel = channels.begin()->get();
auto maxBlockSize = firstChannel->GetMaxBlockSize(); auto maxBlockSize = firstChannel->GetMaxBlockSize();
@ -232,14 +234,14 @@ void ImportRaw(wxWindow *parent, const wxString &fileName,
block = block =
limitSampleBufferSize( maxBlockSize, totalFrames - framescompleted ); limitSampleBufferSize( maxBlockSize, totalFrames - framescompleted );
sf_count_t result; sf_count_t sf_result;
if (format == int16Sample) if (format == int16Sample)
result = SFCall<sf_count_t>(sf_readf_short, sndFile.get(), (short *)srcbuffer.ptr(), block); sf_result = SFCall<sf_count_t>(sf_readf_short, sndFile.get(), (short *)srcbuffer.ptr(), block);
else else
result = SFCall<sf_count_t>(sf_readf_float, sndFile.get(), (float *)srcbuffer.ptr(), block); sf_result = SFCall<sf_count_t>(sf_readf_float, sndFile.get(), (float *)srcbuffer.ptr(), block);
if (result >= 0) { if (sf_result >= 0) {
block = result; block = sf_result;
} }
else { else {
// This is not supposed to happen, sndfile.h says result is always // This is not supposed to happen, sndfile.h says result is always

View File

@ -613,9 +613,9 @@ void WaveTrackMenuTable::InitMenu(Menu *pMenu, void *pUserData)
if ( isMono ) if ( isMono )
{ {
mpData = static_cast<TrackControls::InitMenuData*>(pUserData); mpData = static_cast<TrackControls::InitMenuData*>(pUserData);
WaveTrack *const pTrack = static_cast<WaveTrack*>(mpData->pTrack); WaveTrack *const pTrack2 = static_cast<WaveTrack*>(mpData->pTrack);
auto next = * ++ tracks->Find(pTrack); auto next = * ++ tracks->Find(pTrack2);
if (isMono) { if (isMono) {
const bool canMakeStereo = const bool canMakeStereo =
@ -626,7 +626,7 @@ void WaveTrackMenuTable::InitMenu(Menu *pMenu, void *pUserData)
pMenu->Enable(OnMergeStereoID, canMakeStereo && !unsafe); pMenu->Enable(OnMergeStereoID, canMakeStereo && !unsafe);
int itemId; int itemId;
switch (pTrack->GetChannel()) { switch (pTrack2->GetChannel()) {
case Track::LeftChannel: case Track::LeftChannel:
itemId = OnChannelLeftID; itemId = OnChannelLeftID;
break; break;

View File

@ -78,11 +78,11 @@ void WaveTrackVZoomHandle::DoZoom
if (zoomEnd < zoomStart) if (zoomEnd < zoomStart)
std::swap( zoomStart, zoomEnd ); std::swap( zoomStart, zoomEnd );
float min, max, c, minBand = 0; float min, max, minBand = 0;
const double rate = pTrack->GetRate(); const double rate = pTrack->GetRate();
const float halfrate = rate / 2; const float halfrate = rate / 2;
float maxFreq = 8000.0; float maxFreq = 8000.0;
const SpectrogramSettings &settings = pTrack->GetSpectrogramSettings(); const SpectrogramSettings &specSettings = pTrack->GetSpectrogramSettings();
NumberScale scale; NumberScale scale;
const bool spectral = (pTrack->GetDisplay() == WaveTrack::Spectrum); const bool spectral = (pTrack->GetDisplay() == WaveTrack::Spectrum);
const bool spectrumLinear = spectral && const bool spectrumLinear = spectral &&
@ -105,8 +105,8 @@ void WaveTrackVZoomHandle::DoZoom
if (spectral) { if (spectral) {
pTrack->GetSpectrumBounds(&min, &max); pTrack->GetSpectrumBounds(&min, &max);
scale = (settings.GetScale(min, max)); scale = (specSettings.GetScale(min, max));
const auto fftLength = settings.GetFFTLength(); const auto fftLength = specSettings.GetFFTLength();
const float binSize = rate / fftLength; const float binSize = rate / fftLength;
maxFreq = gPrefs->Read(wxT("/Spectrum/MaxFreq"), 8000L); maxFreq = gPrefs->Read(wxT("/Spectrum/MaxFreq"), 8000L);
// JKC: Following discussions of Bug 1208 I'm allowing zooming in // JKC: Following discussions of Bug 1208 I'm allowing zooming in
@ -118,11 +118,11 @@ void WaveTrackVZoomHandle::DoZoom
} }
else{ else{
pTrack->GetDisplayBounds(&min, &max); pTrack->GetDisplayBounds(&min, &max);
const WaveformSettings &settings = pTrack->GetWaveformSettings(); const WaveformSettings &waveSettings = pTrack->GetWaveformSettings();
const bool linear = settings.isLinear(); const bool linear = waveSettings.isLinear();
if( !linear ){ if( !linear ){
top = (LINEAR_TO_DB(2.0) + settings.dBRange) / settings.dBRange; top = (LINEAR_TO_DB(2.0) + waveSettings.dBRange) / waveSettings.dBRange;
half = (LINEAR_TO_DB(0.5) + settings.dBRange) / settings.dBRange; half = (LINEAR_TO_DB(0.5) + waveSettings.dBRange) / waveSettings.dBRange;
} }
} }
@ -175,7 +175,7 @@ void WaveTrackVZoomHandle::DoZoom
// Waveform view - allow zooming down to a range of ZOOMLIMIT // Waveform view - allow zooming down to a range of ZOOMLIMIT
if (max - min < ZOOMLIMIT) { // if user attempts to go smaller... if (max - min < ZOOMLIMIT) { // if user attempts to go smaller...
c = (min + max) / 2; // ...set centre of view to centre of dragged area and top/bottom to ZOOMLIMIT/2 above/below float c = (min + max) / 2; // ...set centre of view to centre of dragged area and top/bottom to ZOOMLIMIT/2 above/below
min = c - ZOOMLIMIT / 2.0; min = c - ZOOMLIMIT / 2.0;
max = c + ZOOMLIMIT / 2.0; max = c + ZOOMLIMIT / 2.0;
} }

View File

@ -344,7 +344,7 @@ bool Scrubber::MaybeStartScrubbing(wxCoord xx)
); );
if (time1 != time0) { if (time1 != time0) {
if (busy) { if (busy) {
auto position = mScrubStartPosition; position = mScrubStartPosition;
ctb->StopPlaying(); ctb->StopPlaying();
mScrubStartPosition = position; mScrubStartPosition = position;
} }