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)
{
// 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

View File

@ -611,7 +611,7 @@ bool DirManager::SetProject(wxString& newProjPath, wxString& newProjName, const
if (b) {
if (moving || !b->IsLocked()) {
auto result = b->GetFileName();
auto oldPath = result.name.GetFullPath();
oldPath = result.name.GetFullPath();
if (!oldPath.empty())
wxRemoveFile( oldPath );
}
@ -945,7 +945,7 @@ void DirManager::BalanceInfoDel(const wxString &file)
if(--dirTopPool[topnum]<1){
// do *not* erase the hash entry from dirTopPool
// *do* DELETE the actual directory
wxString dir=(projFull != wxT("")? projFull: mytemp);
dir=(projFull != wxT("")? projFull: mytemp);
dir += wxFILE_SEP_PATH;
dir += file.Mid(0,3);
wxFileName::Rmdir(dir);
@ -1506,10 +1506,10 @@ bool DirManager::EnsureSafeFilename(const wxFileName &fName)
else
{
//point the aliases to the NEW filename.
BlockHash::iterator iter = mBlockFileHash.begin();
while (iter != mBlockFileHash.end())
BlockHash::iterator iter2 = mBlockFileHash.begin();
while (iter2 != mBlockFileHash.end())
{
BlockFilePtr b = iter->second.lock();
BlockFilePtr b = iter2->second.lock();
if (b) {
auto ab = static_cast< AliasBlockFile * > ( &*b );
auto db = static_cast< ODDecodeBlockFile * > ( &*b );
@ -1525,7 +1525,7 @@ bool DirManager::EnsureSafeFilename(const wxFileName &fName)
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) \
do { \
char *d, *s; \
unsigned int i; \
unsigned int ii; \
int x; \
for (d = (char*)dst, s = (char*)src, i = 0; \
i < len; \
i++, d += SAMPLE_SIZE(dstFormat) * dstStride, \
for (d = (char*)dst, s = (char*)src, ii = 0; \
ii < len; \
ii++, d += SAMPLE_SIZE(dstFormat) * dstStride, \
s += SAMPLE_SIZE(srcFormat) * srcStride) \
DITHER_STEP(dither, store, load, d, s); \
} while (0)

View File

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

View File

@ -504,7 +504,7 @@ void ModuleManager::FindAllPlugins(PluginIDList & providers, wxArrayString & pat
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];
@ -515,10 +515,10 @@ void ModuleManager::FindAllPlugins(PluginIDList & providers, wxArrayString & pat
continue;
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);
paths.push_back(newpaths[i]);
paths.push_back(newpaths[j]);
}
}
}

View File

@ -924,12 +924,14 @@ void PluginRegistrationDialog::OnEnable(wxCommandEvent & WXUNUSED(evt))
{
std::vector<long> items;
{
long i = mEffects->GetNextItem(-1, 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++)
{
@ -941,12 +943,14 @@ void PluginRegistrationDialog::OnDisable(wxCommandEvent & WXUNUSED(evt))
{
std::vector<long> items;
{
long i = mEffects->GetNextItem(-1, 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++)
{
@ -1004,15 +1008,15 @@ void PluginRegistrationDialog::OnOK(wxCommandEvent & WXUNUSED(evt))
wxString errMsgs;
// 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;
if (mm.RegisterEffectPlugin(item.plugs[j]->GetProviderID(), path,
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.
// 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)
{
PluginID ID = plugID + wxT("_") + path;
PluginDescriptor & plug = mPlugins[ID]; // This will create a NEW descriptor
plug.SetPluginType(PluginTypeStub);
plug.SetID(ID);
plug.SetProviderID(plugID);
plug.SetPath(path);
plug.SetEnabled(false);
plug.SetValid(false);
PluginDescriptor & plug2 = mPlugins[ID]; // This will create a NEW descriptor
plug2.SetPluginType(PluginTypeStub);
plug2.SetID(ID);
plug2.SetProviderID(plugID);
plug2.SetPath(path);
plug2.SetEnabled(false);
plug2.SetValid(false);
}
}
}

View File

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

View File

@ -1704,10 +1704,12 @@ bool Effect::ProcessTrack(int count,
// Get the current number of delayed samples and accumulate
if (isProcessor)
{
{
auto delay = GetLatency();
curDelay += delay;
delayRemaining += delay;
}
// If the plugin has delayed the output by more samples than our current
// 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
// PRL: I don't think that matters, the sequence of storage of clips in the track
// 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 &clip : otherClips)
track->AddClip(std::move(clip));

View File

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

View File

@ -1090,9 +1090,9 @@ bool LadspaEffect::SetAutomationParameters(CommandParameters & parms)
{
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]);
double d = 0.0;

View File

@ -1572,7 +1572,7 @@ bool LV2Effect::BuildPlain()
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];
if (label.IsEmpty())
@ -1585,7 +1585,7 @@ bool LV2Effect::BuildPlain()
gridSizer->AddGrowableCol(3);
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];
LV2Port & ctrl = mControls[p];

View File

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

View File

@ -146,7 +146,7 @@ unsigned VampEffect::GetAudioInCount()
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());
float value = mPlugin->getParameter(mParameters[p].identifier);
@ -169,7 +169,7 @@ bool VampEffect::GetAutomationParameters(CommandParameters & parms)
std::vector<IdentInterfaceSymbol> choices;
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());
if (size_t(value - mParameters[p].minValue + 0.5) == i)
@ -193,7 +193,7 @@ bool VampEffect::GetAutomationParameters(CommandParameters & parms)
bool VampEffect::SetAutomationParameters(CommandParameters & parms)
{
// 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());
float lower = mParameters[p].minValue;
@ -216,7 +216,7 @@ bool VampEffect::SetAutomationParameters(CommandParameters & parms)
std::vector<IdentInterfaceSymbol> choices;
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());
choices.push_back(choice);
@ -238,7 +238,7 @@ bool VampEffect::SetAutomationParameters(CommandParameters & parms)
}
// 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());
float lower = mParameters[p].minValue;
@ -262,7 +262,7 @@ bool VampEffect::SetAutomationParameters(CommandParameters & parms)
std::vector<IdentInterfaceSymbol> choices;
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());
choices.push_back(choice);

View File

@ -598,6 +598,7 @@ bool Exporter::GetFilename()
mFilterIndex = fd.GetFilterIndex();
}
{
int c = 0;
int i = -1;
for (const auto &pPlugin : mPlugins)
@ -613,6 +614,7 @@ bool Exporter::GetFilename()
c++;
}
}
}
wxString ext = mFilename.GetExt();
defext = mPlugins[mFormat]->GetExtension(mSubFormat).Lower();

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.
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);
AVPacketEx pkt;
int ret= encode_audio(mEncAudioCodecCtx.get(),
ret= encode_audio(mEncAudioCodecCtx.get(),
&pkt, // out
mEncAudioFifoOutBuf.get(), // in
default_frame_size);

View File

@ -574,6 +574,7 @@ void FFmpegPresets::SavePreset(ExportFFmpegOptions *parent, wxString &name)
if (action == wxNO) return;
}
{
wxWindow *wnd;
wxListBox *lb;
@ -594,6 +595,7 @@ void FFmpegPresets::SavePreset(ExportFFmpegOptions *parent, wxString &name)
return;
}
codec = lb->GetStringSelection();
}
preset = &mPresets[name];
preset->mPresetName = name;

View File

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

View File

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

View File

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

View File

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

View File

@ -112,8 +112,6 @@ void ImportRaw(wxWindow *parent, const wxString &fileName,
{
SF_INFO sndInfo;
int result;
unsigned numChannels = 0;
try {
@ -171,7 +169,9 @@ void ImportRaw(wxWindow *parent, const wxString &fileName,
throw FileException{ FileException::Cause::Open, fileName };
}
result = sf_command(sndFile.get(), SFC_SET_RAW_START_OFFSET, &offset, sizeof(offset));
{
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);
@ -179,7 +179,7 @@ void ImportRaw(wxWindow *parent, const wxString &fileName,
throw FileException{ FileException::Cause::Read, fileName };
}
}
SFCall<sf_count_t>(sf_seek, sndFile.get(), 0, SEEK_SET);
auto totalFrames =
@ -204,10 +204,12 @@ void ImportRaw(wxWindow *parent, const wxString &fileName,
auto &channels = results[0];
channels.resize(numChannels);
{
// iter not used outside this scope.
auto iter = channels.begin();
for (decltype(numChannels) c = 0; c < numChannels; ++iter, ++c)
*iter = trackFactory->NewWaveTrack(format, rate);
}
const auto firstChannel = channels.begin()->get();
auto maxBlockSize = firstChannel->GetMaxBlockSize();
@ -232,14 +234,14 @@ void ImportRaw(wxWindow *parent, const wxString &fileName,
block =
limitSampleBufferSize( maxBlockSize, totalFrames - framescompleted );
sf_count_t result;
sf_count_t sf_result;
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
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) {
block = result;
if (sf_result >= 0) {
block = sf_result;
}
else {
// 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 )
{
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) {
const bool canMakeStereo =
@ -626,7 +626,7 @@ void WaveTrackMenuTable::InitMenu(Menu *pMenu, void *pUserData)
pMenu->Enable(OnMergeStereoID, canMakeStereo && !unsafe);
int itemId;
switch (pTrack->GetChannel()) {
switch (pTrack2->GetChannel()) {
case Track::LeftChannel:
itemId = OnChannelLeftID;
break;

View File

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

View File

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