Clean up some dead code and MSVC warnings.

- Dead code from experiments in SelectionBar removed.
- Many warnings about unused parameters fixed with WXUNUSED()
- Many warnings about signed / unsigned comparisons cleaned up.
- Several 'local variable declared but not used' warnings fixed.
This commit is contained in:
James Crook 2017-12-08 11:26:09 +00:00
parent b63e61d8e9
commit f463eda36c
68 changed files with 216 additions and 510 deletions

View File

@ -989,7 +989,7 @@ static double SystemTime(bool usingAlsa)
return (now.tv_sec + now.tv_nsec * 0.000000001) - streamStartTime;
}
#else
WXUNUSED(usingAlsa);
usingAlsa;//compiler food.
#endif
return PaUtil_GetTime() - streamStartTime;
@ -2353,7 +2353,7 @@ void AudioIO::StartStreamCleanup(bool bOnlyBuffers)
#ifdef EXPERIMENTAL_MIDI_OUT
PmTimestamp MidiTime(void *info)
PmTimestamp MidiTime(void *WXUNUSED(info))
{
return gAudioIO->MidiTime();
}
@ -4374,7 +4374,7 @@ void AudioIO::AllNotesOff(bool looping)
bool doDelay = !looping;
#else
bool doDelay = false;
WXUNUSED(looping);
looping;// compiler food.
#endif
// to keep track of when MIDI should all be delivered,
@ -4588,7 +4588,7 @@ static void DoSoftwarePlaythrough(const void *inputBuffer,
float *outputBuffer,
int len)
{
for (int i=0; i < inputChannels; i++) {
for (unsigned int i=0; i < inputChannels; i++) {
samplePtr inputPtr = ((samplePtr)inputBuffer) + (i * SAMPLE_SIZE(inputFormat));
samplePtr outputPtr = ((samplePtr)outputBuffer) + (i * SAMPLE_SIZE(floatSample));
@ -4894,7 +4894,7 @@ int audacityAudioCallback(const void *inputBuffer, void *outputBuffer,
const WaveTrack **chans = (const WaveTrack **) alloca(numPlaybackChannels * sizeof(WaveTrack *));
float **tempBufs = (float **) alloca(numPlaybackChannels * sizeof(float *));
for (int c = 0; c < numPlaybackChannels; c++)
for (unsigned int c = 0; c < numPlaybackChannels; c++)
{
tempBufs[c] = (float *) alloca(framesPerBuffer * sizeof(float));
}

View File

@ -339,7 +339,6 @@ void BlockFile::FixSummary(void *data)
float min, max;
int bad;
int i;
ComputeMinMax256(summary256, &min, &max, &bad);
@ -347,7 +346,7 @@ void BlockFile::FixSummary(void *data)
unsigned int *buffer = (unsigned int *)data;
auto len = mSummaryInfo.totalSummaryBytes / 4;
for(i=0; i<len; i++)
for(unsigned int i=0; i<len; i++)
buffer[i] = wxUINT32_SWAP_ALWAYS(buffer[i]);
ComputeMinMax256(summary256, &min, &max, &bad);
@ -357,8 +356,7 @@ void BlockFile::FixSummary(void *data)
}
// Hmmm, no better, we should swap back
for(i=0; i<len; i++)
for(unsigned i=0; i<len; i++)
buffer[i] = wxUINT32_SWAP_ALWAYS(buffer[i]);
}
}
@ -578,7 +576,7 @@ size_t BlockFile::CommonReadData(
// significant bytes -- we want it in the 3 least
// significant bytes.
int *intPtr = (int *)data;
for( int i = 0; i < framesRead; i++ )
for( size_t i = 0; i < framesRead; i++ )
intPtr[i] = intPtr[i] >> 8;
}
else if (format == int16Sample &&
@ -590,7 +588,7 @@ size_t BlockFile::CommonReadData(
SampleBuffer buffer(len * channels, int16Sample);
framesRead = SFCall<sf_count_t>(
sf_readf_short, sf.get(), (short *)buffer.ptr(), len);
for (int i = 0; i < framesRead; i++)
for (size_t i = 0; i < framesRead; i++)
((short *)data)[i] =
((short *)buffer.ptr())[(channels * i) + channel];
}

View File

@ -312,7 +312,7 @@ static void RecursivelyRemove(wxArrayString& filePathArray, int count, int bias,
progress.create( _("Progress"), message );
auto nn = filePathArray.size();
for (int i = 0; i < nn; i++) {
for (unsigned int i = 0; i < nn; i++) {
const wxChar *file = filePathArray[i].c_str();
if (bFiles)
::wxRemoveFile(file);

View File

@ -77,14 +77,14 @@ bool Envelope::ConsistencyCheck()
while ( nextI - ii > 2 ) {
// too many coincident time values
if (ii == mDragPoint || nextI - 1 == mDragPoint)
if (ii == (size_t)mDragPoint || (int)(nextI - 1) == mDragPoint)
// forgivable
;
else {
consistent = false;
// repair it
Delete( nextI - 2 );
if (mDragPoint >= nextI - 2)
if (mDragPoint >= (int)(nextI - 2))
--mDragPoint;
--nextI, --count;
// wxLogError
@ -167,7 +167,7 @@ void Envelope::SetDragPointValid(bool valid)
mEnv[mDragPoint].SetVal( this, mDefaultValue );
return;
}
else if ( mDragPoint + 1 == size ) {
else if ( mDragPoint + 1 == (int)size ) {
// Put the point at the height of the last point, but also off screen.
mEnv[mDragPoint].SetT(big);
mEnv[mDragPoint].SetVal( this, mEnv[ size - 1 ].GetVal() );
@ -196,7 +196,7 @@ void Envelope::MoveDragPoint(double newWhen, double value)
if (mDragPoint > 0)
limitLo = std::max(limitLo, mEnv[mDragPoint - 1].GetT());
if (mDragPoint + 1 < mEnv.size())
if (mDragPoint + 1 < (int)mEnv.size())
limitHi = std::min(limitHi, mEnv[mDragPoint + 1].GetT());
EnvPoint &dragPoint = mEnv[mDragPoint];
@ -272,8 +272,8 @@ Envelope::Envelope(const Envelope &orig)
void Envelope::CopyRange(const Envelope &orig, size_t begin, size_t end)
{
int len = orig.mEnv.size();
int i = begin;
size_t len = orig.mEnv.size();
size_t i = begin;
// Create the point at 0 if it needs interpolated representation
if ( i > 0 )
@ -292,6 +292,7 @@ void Envelope::CopyRange(const Envelope &orig, size_t begin, size_t end)
AddPointAtEnd( mTrackLen, orig.GetValue(mOffset + mTrackLen));
}
#if 0
/// Limit() limits a double value to a range.
/// TODO: Move to a general utilities source file.
static double Limit( double Lo, double Value, double Hi )
@ -302,6 +303,7 @@ static double Limit( double Lo, double Value, double Hi )
return Hi;
return Value;
}
#endif
/// TODO: This should probably move to track artist.
static void DrawPoint(wxDC & dc, const wxRect & r, int x, int y, bool top)
@ -729,7 +731,7 @@ void Envelope::CollapseRegion( double t0, double t1, double sampleDur )
auto len = mEnv.size();
for ( size_t i = begin; i < len; ++i ) {
auto &point = mEnv[i];
if (rightPoint && i == begin)
if (rightPoint && i == (size_t)begin)
// Avoid roundoff error.
// Make exactly equal times of neighboring points so that we have
// a real discontinuity.
@ -878,11 +880,11 @@ void Envelope::RemoveUnneededPoints
// points removable?
int index = startAt + ( rightward ? 1 : -1 );
while ( index >= 0 && index < len ) {
while ( index >= 0 && index < (int)len ) {
// Stop at any discontinuity
if ( index > 0 && isDiscontinuity( index - 1 ) )
break;
if ( index + 1 < len && isDiscontinuity( index ) )
if ( (unsigned int)(index + 1) < len && isDiscontinuity( index ) )
break;
if ( ! remove( index, false ) )
@ -915,7 +917,7 @@ std::pair< int, int > Envelope::ExpandRegion
// Shift points.
auto len = mEnv.size();
for ( int ii = index; ii < len; ++ii ) {
for ( unsigned int ii = index; ii < len; ++ii ) {
auto &point = mEnv[ ii ];
point.SetT( point.GetT() + tlen );
}
@ -1027,7 +1029,6 @@ int Envelope::InsertOrReplaceRelative(double when, double value)
}
#endif
int len = mEnv.size();
when = std::max( 0.0, std::min( mTrackLen, when ) );
auto range = EqualRange( when, 0 );
@ -1135,9 +1136,9 @@ void Envelope::BinarySearchForTime( int &Lo, int &Hi, double t ) const
// Optimizations for the usual pattern of repeated calls with
// small increases of t.
{
if (mSearchGuess >= 0 && mSearchGuess < mEnv.size()) {
if (mSearchGuess >= 0 && mSearchGuess < (int)mEnv.size()) {
if (t >= mEnv[mSearchGuess].GetT() &&
(1 + mSearchGuess == mEnv.size() ||
(1 + mSearchGuess == (int)mEnv.size() ||
t < mEnv[1 + mSearchGuess].GetT())) {
Lo = mSearchGuess;
Hi = 1 + mSearchGuess;
@ -1146,9 +1147,9 @@ void Envelope::BinarySearchForTime( int &Lo, int &Hi, double t ) const
}
++mSearchGuess;
if (mSearchGuess >= 0 && mSearchGuess < mEnv.size()) {
if (mSearchGuess >= 0 && mSearchGuess < (int)mEnv.size()) {
if (t >= mEnv[mSearchGuess].GetT() &&
(1 + mSearchGuess == mEnv.size() ||
(1 + mSearchGuess == (int)mEnv.size() ||
t < mEnv[1 + mSearchGuess].GetT())) {
Lo = mSearchGuess;
Hi = 1 + mSearchGuess;
@ -1390,7 +1391,7 @@ double Envelope::NextPointAfter(double t) const
{
int lo,hi;
BinarySearchForTime( lo, hi, t );
if (hi >= mEnv.size())
if (hi >= (int)mEnv.size())
return t;
else
return mEnv[hi].GetT();
@ -1705,7 +1706,7 @@ double Envelope::SolveIntegralOfInverse( double t0, double area ) const
// loop through the rest of the envelope points until we get to t1
while (1)
{
if(i >= count) // the requested range extends beyond the last point
if(i >= (int)count) // the requested range extends beyond the last point
{
return lastT + area * lastVal;
}

View File

@ -112,7 +112,7 @@ void InterpolateAudio(float *buffer, const size_t len,
const int IP =
imin(imin(numBad * 3, 50), imax(firstBad - 1, len - (firstBad + numBad) - 1));
if (IP < 3 || IP >= N) {
if (IP < 3 || IP >= (int)N) {
LinearInterpolateAudio(buffer, len, firstBad, numBad);
return;
}

View File

@ -843,8 +843,8 @@ void LabelTrack::Draw
// Draw the label boxes.
{
bool highlightTrack = false;
#ifdef EXPERIMENTAL_TRACK_PANEL_HIGHLIGHTING
bool highlightTrack = false;
auto target = dynamic_cast<LabelTextHandle*>(context.target.get());
highlightTrack = target && target->GetTrack().get() == this;
#endif
@ -1302,7 +1302,7 @@ LabelStruct LabelStruct::Import(wxTextFile &file, int &index)
// Advance index over all continuation lines first, before we might throw
// any exceptions.
int index2 = index;
while (index < file.GetLineCount() &&
while (index < (int)file.GetLineCount() &&
file.GetLine(index).StartsWith(continuation))
++index;
@ -1582,7 +1582,7 @@ void LabelTrack::HandleTextDragRelease(const wxMouseEvent & evt)
void LabelTrack::HandleGlyphClick
(LabelTrackHit &hit, const wxMouseEvent & evt,
const wxRect & r, const ZoomInfo &zoomInfo,
SelectedRegion *newSel)
SelectedRegion *WXUNUSED(newSel))
{
if (evt.ButtonDown())
{
@ -1638,6 +1638,8 @@ void LabelTrack::HandleTextClick(const wxMouseEvent & evt,
const wxRect & r, const ZoomInfo &zoomInfo,
SelectedRegion *newSel)
{
r;//compiler food.
zoomInfo;//compiler food.
if (evt.ButtonDown())
{
@ -1774,7 +1776,7 @@ unsigned LabelTrack::CaptureKey(wxKeyEvent & event, ViewInfo &, wxWindow *)
return RefreshCode::RefreshNone;
}
unsigned LabelTrack::KeyDown(wxKeyEvent & event, ViewInfo &viewInfo, wxWindow *pParent)
unsigned LabelTrack::KeyDown(wxKeyEvent & event, ViewInfo &viewInfo, wxWindow *WXUNUSED(pParent))
{
double bkpSel0 = viewInfo.selectedRegion.t0(),
bkpSel1 = viewInfo.selectedRegion.t1();

View File

@ -303,7 +303,7 @@ bool InvertMatrix(const Matrix& input, Matrix& Minv)
// Pivot the row with the largest absolute value in
// column i, into row i
double absmax = 0.0;
int argmax = 0;
unsigned int argmax = 0;
for(unsigned j = i; j < N; j++)
if (fabs(M[j][i]) > absmax) {

View File

@ -5908,7 +5908,6 @@ void AudacityProject::OnSplitNew()
int AudacityProject::CountSelectedWaveTracks()
{
TrackListIterator iter(GetTracks());
Track *t = iter.First();
int count =0;
for (Track *t = iter.First(); t; t = iter.Next()) {
@ -5921,7 +5920,6 @@ int AudacityProject::CountSelectedWaveTracks()
int AudacityProject::CountSelectedTracks()
{
TrackListIterator iter(GetTracks());
Track *t = iter.First();
int count =0;
for (Track *t = iter.First(); t; t = iter.Next()) {

View File

@ -297,7 +297,7 @@ Mixer::Mixer(const WaveTrackConstArray &inputTracks,
mBuffer.reinit(mNumBuffers);
mTemp.reinit(mNumBuffers);
for (int c = 0; c < mNumBuffers; c++) {
for (unsigned int c = 0; c < mNumBuffers; c++) {
mBuffer[c].Allocate(mInterleavedBufferSize, mFormat);
mTemp[c].Allocate(mInterleavedBufferSize, floatSample);
}
@ -355,7 +355,7 @@ void Mixer::ApplyTrackGains(bool apply)
void Mixer::Clear()
{
for (int c = 0; c < mNumBuffers; c++) {
for (unsigned int c = 0; c < mNumBuffers; c++) {
memset(mTemp[c].ptr(), 0, mInterleavedBufferSize * SAMPLE_SIZE(floatSample));
}
}
@ -364,7 +364,7 @@ void MixBuffers(unsigned numChannels, int *channelFlags, float *gains,
samplePtr src, SampleBuffer *dests,
int len, bool interleaved)
{
for (int c = 0; c < numChannels; c++) {
for (unsigned int c = 0; c < numChannels; c++) {
if (!channelFlags[c])
continue;
@ -426,7 +426,7 @@ size_t Mixer::MixVariableRates(int *channelFlags, WaveTrackCache &cache,
(backwards ? *queueLen : - *queueLen)) / trackRate;
while (out < mMaxOut) {
if (*queueLen < mProcessLen) {
if (*queueLen < (int)mProcessLen) {
// Shift pending portion to start of the buffer
memmove(queue, &queue[*queueStart], (*queueLen) * sampleSize);
*queueStart = 0;
@ -477,7 +477,7 @@ size_t Mixer::MixVariableRates(int *channelFlags, WaveTrackCache &cache,
}
auto thisProcessLen = mProcessLen;
bool last = (*queueLen < mProcessLen);
bool last = (*queueLen < (int)mProcessLen);
if (last) {
thisProcessLen = *queueLen;
}
@ -747,8 +747,8 @@ MixerSpec::MixerSpec( unsigned numTracks, unsigned maxNumChannels )
Alloc();
for( int i = 0; i < mNumTracks; i++ )
for( int j = 0; j < mNumChannels; j++ )
for( unsigned int i = 0; i < mNumTracks; i++ )
for( unsigned int j = 0; j < mNumChannels; j++ )
mMap[ i ][ j ] = ( i == j );
}
@ -760,8 +760,8 @@ MixerSpec::MixerSpec( const MixerSpec &mixerSpec )
Alloc();
for( int i = 0; i < mNumTracks; i++ )
for( int j = 0; j < mNumChannels; j++ )
for( unsigned int i = 0; i < mNumTracks; i++ )
for( unsigned int j = 0; j < mNumChannels; j++ )
mMap[ i ][ j ] = mixerSpec.mMap[ i ][ j ];
}
@ -782,12 +782,12 @@ bool MixerSpec::SetNumChannels( unsigned newNumChannels )
if( newNumChannels > mMaxNumChannels )
return false;
for( int i = 0; i < mNumTracks; i++ )
for( unsigned int i = 0; i < mNumTracks; i++ )
{
for( int j = newNumChannels; j < mNumChannels; j++ )
for( unsigned int j = newNumChannels; j < mNumChannels; j++ )
mMap[ i ][ j ] = false;
for( int j = mNumChannels; j < newNumChannels; j++ )
for( unsigned int j = mNumChannels; j < newNumChannels; j++ )
mMap[ i ][ j ] = false;
}
@ -803,8 +803,8 @@ MixerSpec& MixerSpec::operator=( const MixerSpec &mixerSpec )
Alloc();
for( int i = 0; i < mNumTracks; i++ )
for( int j = 0; j < mNumChannels; j++ )
for( unsigned int i = 0; i < mNumTracks; i++ )
for( unsigned int j = 0; j < mNumChannels; j++ )
mMap[ i ][ j ] = mixerSpec.mMap[ i ][ j ];
return *this;

View File

@ -625,7 +625,7 @@ void MixerTrackCluster::UpdateMeter(const double t0, const double t1)
meterFloatsArray = Floats{ 2 * nFrames };
// Interleave for stereo. Left/mono first.
for (int index = 0; index < nFrames; index++)
for (unsigned int index = 0; index < nFrames; index++)
meterFloatsArray[2 * index] = tempFloatsArray[index];
if (GetRight())
@ -635,7 +635,7 @@ void MixerTrackCluster::UpdateMeter(const double t0, const double t1)
if (bSuccess)
// Interleave right channel, or duplicate same signal for "right" channel in mono case.
for (int index = 0; index < nFrames; index++)
for (unsigned int index = 0; index < nFrames; index++)
meterFloatsArray[(2 * index) + 1] = tempFloatsArray[index];
}
@ -646,17 +646,17 @@ void MixerTrackCluster::UpdateMeter(const double t0, const double t1)
//vvv Need to apply envelope, too? See Mixer::MixSameRate.
float gain = pTrack->GetChannelGain(0);
if (gain < 1.0)
for (int index = 0; index < nFrames; index++)
for (unsigned int index = 0; index < nFrames; index++)
meterFloatsArray[2 * index] *= gain;
if (GetRight())
gain = GetRight()->GetChannelGain(1);
else
gain = pTrack->GetChannelGain(1);
if (gain < 1.0)
for (int index = 0; index < nFrames; index++)
for (unsigned int index = 0; index < nFrames; index++)
meterFloatsArray[(2 * index) + 1] *= gain;
// Clip to [-1.0, 1.0] range.
for (int index = 0; index < 2 * nFrames; index++)
for (unsigned int index = 0; index < 2 * nFrames; index++)
if (meterFloatsArray[index] < -1.0)
meterFloatsArray[index] = -1.0;
else if (meterFloatsArray[index] > 1.0)
@ -1328,7 +1328,7 @@ void MixerBoard::UpdateWidth()
//
void MixerBoard::MakeButtonBitmap( wxMemoryDC & dc, wxBitmap & bitmap, wxRect & bev, const wxString & str, bool up )
void MixerBoard::MakeButtonBitmap( wxMemoryDC & dc, wxBitmap & WXUNUSED(bitmap), wxRect & bev, const wxString & str, bool up )
{
int textWidth, textHeight;

View File

@ -71,6 +71,7 @@ std::unique_ptr<wxFileConfig> ugPrefs {};
wxFileConfig *gPrefs = NULL;
int gMenusDirty = 0;
#if 0
// Copy one entry from one wxConfig object to another
static void CopyEntry(wxString path, wxConfigBase *src, wxConfigBase *dst, wxString entry)
{
@ -102,7 +103,7 @@ static void CopyEntry(wxString path, wxConfigBase *src, wxConfigBase *dst, wxStr
}
}
#if 0
// Recursive routine to copy all groups and entries from one wxConfig object to another
static void CopyEntriesRecursive(wxString path, wxConfigBase *src, wxConfigBase *dst)
{

View File

@ -1923,7 +1923,6 @@ void AudacityProject::FixScrollbars()
mViewInfo.sbarScreen = (wxInt64)(panelWidth);
mViewInfo.sbarH = (wxInt64) (mViewInfo.GetBeforeScreenWidth());
int lastv = mViewInfo.vpos;
// PRL: Can someone else find a more elegant solution to bug 812, than
// introducing this boolean member variable?
// Setting mVSbar earlier, int HandlXMLTag, didn't succeed in restoring
@ -2236,7 +2235,6 @@ void AudacityProject::DoScroll()
}
}
int lastv = mViewInfo.vpos;
mViewInfo.vpos = mVsbar->GetThumbPosition() * mViewInfo.scrollStep;
//mchinen: do not always set this project to be the active one.

View File

@ -219,7 +219,6 @@ bool Sequence::ConvertToSampleFormat(sampleFormat format)
// Using Blockify will handle the cases where len > the NEW mMaxSamples. Previous code did not.
const auto blockstart = oldSeqBlock.start;
const unsigned prevSize = newBlockArray.size();
Blockify(*mDirManager, mMaxSamples, mSampleFormat,
newBlockArray, blockstart, bufferNew.ptr(), len);
}
@ -440,7 +439,7 @@ std::unique_ptr<Sequence> Sequence::Copy(sampleCount s0, sampleCount s1) const
// s1 is within block:
blocklen = (s1 - block.start).as_size_t();
wxASSERT(file->IsAlias() || (blocklen <= mMaxSamples)); // Vaughan, 2012-02-29
if (blocklen < file->GetLength()) {
if (blocklen < (int)file->GetLength()) {
ensureSampleBufferSize(buffer, mSampleFormat, bufferSize, blocklen);
Get(b1, buffer.ptr(), mSampleFormat, block.start, blocklen, true);
dest->Append(buffer.ptr(), mSampleFormat, blocklen);
@ -1216,7 +1215,7 @@ void Sequence::SetSamples(samplePtr buffer, sampleFormat format,
// but it guards against infinite loop in case of inconsistencies
// (too-small files, not yet seen?)
// that cause the loop to make no progress because blen == 0
&& b < size
&& (unsigned int)b < size
) {
newBlock.push_back( mBlock[b] );
SeqBlock &block = newBlock.back();
@ -1870,7 +1869,7 @@ void Sequence::ConsistencyCheck(const wxChar *whereStr, bool mayThrow) const
void Sequence::ConsistencyCheck
(const BlockArray &mBlock, size_t maxSamples, size_t from,
sampleCount mNumSamples, const wxChar *whereStr,
bool mayThrow)
bool WXUNUSED(mayThrow))
{
bool bError = false;
// Construction of the exception at the appropriate line of the function

View File

@ -1310,7 +1310,7 @@ auStaticText::auStaticText(wxWindow* parent, wxString textIn) :
SetName(textIn);
}
void auStaticText::OnPaint(wxPaintEvent & evt)
void auStaticText::OnPaint(wxPaintEvent & WXUNUSED(evt))
{
wxPaintDC dc(this);
//dc.SetTextForeground( theTheme.Colour( clrTrackPanelText));

View File

@ -128,7 +128,7 @@ void TimeTrack::Paste(double t, const Track * src)
(t, static_cast<const TimeTrack*>(src)->mEnvelope.get(), sampleTime);
}
void TimeTrack::Silence(double t0, double t1)
void TimeTrack::Silence(double WXUNUSED(t0), double WXUNUSED(t1))
{
}

View File

@ -347,7 +347,7 @@ public:
AudioTrack(const Track &orig) : Track{ orig } {}
// Serialize, not with tags of its own, but as attributes within a tag.
void WriteXMLAttributes(XMLWriter &xmlFile) const {}
void WriteXMLAttributes(XMLWriter &WXUNUSED(xmlFile)) const {}
// Return true iff the attribute is recognized.
bool HandleXMLAttribute(const wxChar * /*attr*/, const wxChar * /*value*/)

View File

@ -2347,7 +2347,7 @@ void TrackArtist::DrawClipSpectrum(WaveTrackCache &waveTrackCache,
#endif //EXPERIMENTAL_FFT_Y_GRID
if (!updated && clip->mSpecPxCache->valid &&
(clip->mSpecPxCache->len == hiddenMid.height * hiddenMid.width)
(clip->mSpecPxCache->len == (size_t)(hiddenMid.height * hiddenMid.width))
&& scaleType == clip->mSpecPxCache->scaleType
&& gain == clip->mSpecPxCache->gain
&& range == clip->mSpecPxCache->range

View File

@ -882,7 +882,6 @@ void TrackPanel::HandleMotion( wxMouseState &inState, bool doHit )
UpdateMouseState( inState );
const auto foundCell = FindCell( inState.m_x, inState.m_y );
auto &track = foundCell.pTrack;
auto &rect = foundCell.rect;
auto &pCell = foundCell.pCell;
const TrackPanelMouseState tpmState{ mLastMouseState, rect, pCell };
@ -951,7 +950,7 @@ void TrackPanel::HandleMotion
auto begin = mTargets.begin(), end = mTargets.end(),
iter = std::find(begin, end, oldHandle);
if (iter != end) {
auto newPosition = iter - begin;
unsigned int newPosition = iter - begin;
if (newPosition <= oldPosition)
mTarget = newPosition;
// else, some NEW hit and this position takes priority
@ -1746,9 +1745,7 @@ catch( ... )
void TrackPanel::HandleClick( const TrackPanelMouseEvent &tpmEvent )
{
const auto &event = tpmEvent.event;
auto pCell = tpmEvent.pCell;
const auto &rect = tpmEvent.rect;
auto pTrack = static_cast<CommonTrackPanelCell *>( pCell.get() )->FindTrack();
// Do hit test once more, in case the button really pressed was not the
@ -2291,7 +2288,8 @@ void TrackInfo::VelocitySliderDrawFunction
#endif
void TrackInfo::MuteOrSoloDrawFunction
( wxDC *dc, const wxRect &bev, const Track *pTrack, bool down, bool captured,
( wxDC *dc, const wxRect &bev, const Track *pTrack, bool down,
bool WXUNUSED(captured),
bool solo, bool hit )
{
//bev.Inflate(-1, -1);

View File

@ -19,10 +19,22 @@ class wxDC;
#include <wx/mousestate.h>
// MSVC 2013 says this can't be instantiated - but in fact it can
// using {} syntax.
struct TrackPanelDrawingContext {
wxDC &dc;
UIHandlePtr target;
wxMouseState lastState;
// MSVC 2013 has a bug and reports
// warning C4610: struct 'TrackPanelDrawingContext'
// can never be instantiated
#ifdef _MSC_VER
// Add a default initialiser here to workaround that?
//TrackPanelDrawingContext();
#endif
};
#endif

View File

@ -57,7 +57,7 @@ TrackPanelResizeHandle::~TrackPanelResizeHandle()
}
UIHandle::Result TrackPanelResizeHandle::Click
(const TrackPanelMouseEvent &evt, AudacityProject *pProject)
(const TrackPanelMouseEvent &WXUNUSED(evt), AudacityProject *WXUNUSED(pProject))
{
return RefreshCode::RefreshNone;
}
@ -164,7 +164,7 @@ UIHandle::Result TrackPanelResizeHandle::Drag
}
// Common pieces of code for MONO_WAVE_PAN and otherwise.
auto doResizeBelow = [&] (Track *prev, bool vStereo) {
auto doResizeBelow = [&] (Track *prev, bool WXUNUSED(vStereo)) {
double proportion = static_cast < double >(mInitialTrackHeight)
/ (mInitialTrackHeight + mInitialUpperTrackHeight);
@ -188,7 +188,7 @@ UIHandle::Result TrackPanelResizeHandle::Drag
prev->SetHeight(newUpperTrackHeight);
};
auto doResizeBetween = [&] (Track *next, bool vStereo) {
auto doResizeBetween = [&] (Track *next, bool WXUNUSED(vStereo)) {
int newUpperTrackHeight = mInitialUpperTrackHeight + delta;
int newTrackHeight = mInitialTrackHeight - delta;

View File

@ -984,7 +984,7 @@ bool SpecCache::CalculateOneSpectrum
freqCorrection = multiplier * quotIm;
}
const int bin = (int)(ii + freqCorrection + 0.5f);
const size_t bin = (size_t)(ii + freqCorrection + 0.5f);
if (bin >= 0 && bin < hFFT->Points) {
double timeCorrection;
{

View File

@ -1406,7 +1406,6 @@ void WaveTrack::Silence(double t0, double t1)
auto start = (sampleCount)floor(t0 * mRate + 0.5);
auto len = (sampleCount)floor(t1 * mRate + 0.5) - start;
bool result = true;
for (const auto &clip : mClips)
{
@ -2059,7 +2058,7 @@ bool WaveTrack::Get(samplePtr buffer, sampleFormat format,
{
wxASSERT( format==floatSample );
float * pBuffer = (float*)buffer;
for(int i=0;i<len;i++)
for(size_t i=0;i<len;i++)
pBuffer[i]=2.0f;
}
else

View File

@ -239,7 +239,7 @@ bool SimpleBlockFile::WriteSimpleBlockFile(
// memory
int *int24sampleData = (int*)sampleData;
for( int i = 0; i < sampleLen; i++ )
for( size_t i = 0; i < sampleLen; i++ )
{
nBytesToWrite = 3;
nBytesWritten =

View File

@ -260,8 +260,8 @@ bool EffectClickRemoval::ProcessOne(int count, WaveTrack * track, sampleCount st
bool EffectClickRemoval::RemoveClicks(size_t len, float *buffer)
{
bool bResult = false; // This effect usually does nothing.
int i;
int j;
size_t i;
size_t j;
int left = 0;
float msw;
@ -279,7 +279,7 @@ bool EffectClickRemoval::RemoveClicks(size_t len, float *buffer)
for(i=0;i<len;i++)
ms_seq[i]=b2[i];
for(i=1; i < sep; i *= 2) {
for(i=1; (int)i < sep; i *= 2) {
for(j=0;j<len-i; j++)
ms_seq[j] += ms_seq[j+i];
}
@ -299,7 +299,7 @@ bool EffectClickRemoval::RemoveClicks(size_t len, float *buffer)
for( i=0; i<len-sep; i++ ){
msw = 0;
for( j=0; j<ww; j++) {
for( j=0; (int)j<ww; j++) {
msw += b2[i+s2+j];
}
msw /= ww;
@ -309,7 +309,7 @@ bool EffectClickRemoval::RemoveClicks(size_t len, float *buffer)
left = i+s2;
}
} else {
if(left != 0 && i-left+s2 <= ww*2) {
if(left != 0 && (int)(i-left+s2) <= ww*2) {
float lv = buffer[left];
float rv = buffer[i+ww+s2];
for(j=left; j<i+ww+s2; j++) {

View File

@ -386,8 +386,6 @@ bool EffectCompressor::InitPass2()
bool EffectCompressor::TwoBufferProcessPass1
(float *buffer1, size_t len1, float *buffer2, size_t len2)
{
int i;
// If buffers are bigger than allocated, then abort
// (this should never happen, but if it does, we don't want to crash)
if((len1 > mFollowLen) || (len2 > mFollowLen))
@ -399,7 +397,7 @@ bool EffectCompressor::TwoBufferProcessPass1
// Initialize the mLastLevel to the peak level in the first buffer
// This avoids problems with large spike events near the beginning of the track
mLastLevel = mThreshold;
for(i=0; i<len2; i++) {
for(size_t i=0; i<len2; i++) {
if(mLastLevel < fabs(buffer2[i]))
mLastLevel = fabs(buffer2[i]);
}
@ -411,7 +409,7 @@ bool EffectCompressor::TwoBufferProcessPass1
}
if(buffer1 != NULL) {
for (i = 0; i < len1; i++) {
for (size_t i = 0; i < len1; i++) {
buffer1[i] = DoCompression(buffer1[i], mFollow1[i]);
}
}
@ -432,7 +430,7 @@ bool EffectCompressor::ProcessPass2(float *buffer, size_t len)
{
if (mMax != 0)
{
for (int i = 0; i < len; i++)
for (size_t i = 0; i < len; i++)
buffer[i] /= mMax;
}
@ -499,7 +497,6 @@ void EffectCompressor::Follow(float *buffer, float *env, size_t len, float *prev
The value has a lower limit of floor to make sure value has a
reasonable positive value from which to begin an attack.
*/
int i;
double level,last;
if(!mUsePeak) {
@ -509,7 +506,7 @@ void EffectCompressor::Follow(float *buffer, float *env, size_t len, float *prev
}
// First apply a peak detect with the requested decay rate
last = mLastLevel;
for(i=0; i<len; i++) {
for(size_t i=0; i<len; i++) {
if(mUsePeak)
level = fabs(buffer[i]);
else // use RMS
@ -533,7 +530,7 @@ void EffectCompressor::Follow(float *buffer, float *env, size_t len, float *prev
// Next do the same process in reverse direction to get the requested attack rate
last = mLastLevel;
for(i = len; i--;) {
for(size_t i = len; i--;) {
last *= mAttackInverseFactor;
if(last < mThreshold)
last = mThreshold;
@ -545,7 +542,7 @@ void EffectCompressor::Follow(float *buffer, float *env, size_t len, float *prev
if((previous != NULL) && (previous_len > 0)) {
// If the previous envelope was passed, propagate the rise back until we intersect
for(i = previous_len; i--;) {
for(size_t i = previous_len; i--;) {
last *= mAttackInverseFactor;
if(last < mThreshold)
last = mThreshold;
@ -557,7 +554,7 @@ void EffectCompressor::Follow(float *buffer, float *env, size_t len, float *prev
// If we can't back up far enough, project the starting level forward
// until we intersect the desired envelope
last = previous[0];
for(i=1; i<previous_len; i++) {
for(size_t i=1; i<previous_len; i++) {
last *= mAttackFactor;
if(previous[i] > last)
previous[i] = last;
@ -565,7 +562,7 @@ void EffectCompressor::Follow(float *buffer, float *env, size_t len, float *prev
return;
}
// If we still didn't intersect, then continue ramp up into current buffer
for(i=0; i<len; i++) {
for(size_t i=0; i<len; i++) {
last *= mAttackFactor;
if(buffer[i] > last)
buffer[i] = last;

View File

@ -3234,8 +3234,6 @@ void EffectUIHost::OnApply(wxCommandEvent & evt)
auto cleanup = finally( [&] { mApplyBtn->Enable(); } );
mEffect->Apply();
return;
}
void EffectUIHost::DoCancel()
@ -3252,13 +3250,10 @@ void EffectUIHost::DoCancel()
}
}
void EffectUIHost::OnCancel(wxCommandEvent & evt)
void EffectUIHost::OnCancel(wxCommandEvent & WXUNUSED(evt))
{
DoCancel();
Close();
return;
}
void EffectUIHost::OnHelp(wxCommandEvent & WXUNUSED(event))
@ -3277,10 +3272,7 @@ void EffectUIHost::OnHelp(wxCommandEvent & WXUNUSED(event))
void EffectUIHost::OnDebug(wxCommandEvent & evt)
{
OnApply(evt);
mEffect->mUIResultID = evt.GetId();
return;
}
void EffectUIHost::OnMenu(wxCommandEvent & WXUNUSED(evt))

View File

@ -605,7 +605,7 @@ size_t EffectManager::RealtimeProcess(int group, unsigned chans, float **buffers
// And populate the input with the buffers we've been given while allocating
// NEW output buffers
for (int i = 0; i < chans; i++)
for (unsigned int i = 0; i < chans; i++)
{
ibuf[i] = buffers[i];
obuf[i] = (float *) alloca(numSamples * sizeof(float));
@ -622,7 +622,7 @@ size_t EffectManager::RealtimeProcess(int group, unsigned chans, float **buffers
called++;
}
for (int j = 0; j < chans; j++)
for (unsigned int j = 0; j < chans; j++)
{
float *temp;
temp = ibuf[j];
@ -637,7 +637,7 @@ size_t EffectManager::RealtimeProcess(int group, unsigned chans, float **buffers
// is odd.
if (called & 1)
{
for (int i = 0; i < chans; i++)
for (unsigned int i = 0; i < chans; i++)
{
memcpy(buffers[i], ibuf[i], numSamples * sizeof(float));
}

View File

@ -2415,7 +2415,7 @@ void EffectEqualization::GraphicEQ(Envelope *env)
int minF = 0;
for(size_t i = 0; i < NUM_PTS; i++)
{
while( (mWhenSliders[minF] <= mWhens[i]) & (minF < mBandsInUse) )
while( (mWhenSliders[minF] <= mWhens[i]) & (minF < (int)mBandsInUse) )
minF++;
minF--;
if( minF < 0 ) //before first slider
@ -2453,7 +2453,7 @@ void EffectEqualization::GraphicEQ(Envelope *env)
if(s < .5 )
{
value = mEQVals[minF]*(0.75 - s*s);
if( minF+1 < mBandsInUse )
if( minF+1 < (int)mBandsInUse )
value += mEQVals[minF+1]*(s+.5)*(s+.5)/2.;
if( minF-1 >= 0 )
value += mEQVals[minF-1]*(s-.5)*(s-.5)/2.;
@ -2461,9 +2461,9 @@ void EffectEqualization::GraphicEQ(Envelope *env)
else
{
value = mEQVals[minF]*(s-1.5)*(s-1.5)/2.;
if( minF+1 < mBandsInUse )
if( minF+1 < (int)mBandsInUse )
value += mEQVals[minF+1]*(.75-(1.-s)*(1.-s));
if( minF+2 < mBandsInUse )
if( minF+2 < (int)mBandsInUse )
value += mEQVals[minF+2]*(s-.5)*(s-.5)/2.;
}
}
@ -2481,7 +2481,7 @@ void EffectEqualization::GraphicEQ(Envelope *env)
int minF = 0;
for(size_t i = 0; i < NUM_PTS; i++)
{
while( (mWhenSliders[minF] <= mWhens[i]) & (minF < mBandsInUse) )
while( (mWhenSliders[minF] <= mWhens[i]) & (minF < (int)mBandsInUse) )
minF++;
minF--;
if( minF < 0 ) //before first slider

View File

@ -164,7 +164,9 @@ bool EffectFindClipping::ProcessOne(LabelTrack * lt,
Floats buffer;
try {
if (blockSize < mStart)
// mStart should be positive.
// if we are throwing bad_alloc and mStart is negative, find out why.
if (blockSize < (size_t)mStart)
// overflow
throw std::bad_alloc{};
buffer.reinit(blockSize);

View File

@ -701,10 +701,10 @@ void EffectNoiseReduction::Worker::ApplyFreqSmoothing(FloatVector &gains)
std::fill(pScratch, pScratch + mSpectrumSize, 0.0f);
}
for (int ii = 0; ii < mSpectrumSize; ++ii)
for (size_t ii = 0; ii < mSpectrumSize; ++ii)
gains[ii] = log(gains[ii]);
for (int ii = 0; ii < mSpectrumSize; ++ii) {
for (int ii = 0; (size_t)ii < mSpectrumSize; ++ii) {
const int j0 = std::max(0, ii - (int)mFreqSmoothingBins);
const int j1 = std::min(mSpectrumSize - 1, ii + mFreqSmoothingBins);
for(int jj = j0; jj <= j1; ++jj) {
@ -713,7 +713,7 @@ void EffectNoiseReduction::Worker::ApplyFreqSmoothing(FloatVector &gains)
mFreqSmoothingScratch[ii] /= (j1 - j0 + 1);
}
for (int ii = 0; ii < mSpectrumSize; ++ii)
for (size_t ii = 0; ii < mSpectrumSize; ++ii)
gains[ii] = exp(mFreqSmoothingScratch[ii]);
}
@ -921,7 +921,7 @@ void EffectNoiseReduction::Worker::ProcessSamples
len -= avail;
mInWavePos += avail;
if (mInWavePos == mWindowSize) {
if (mInWavePos == (int)mWindowSize) {
FillFirstHistoryWindow();
if (mDoProfile)
GatherStatistics(statistics);
@ -958,7 +958,7 @@ void EffectNoiseReduction::Worker::FillFirstHistoryWindow()
float *pPower = &record.mSpectrums[1];
int *pBitReversed = &hFFT->BitReversed[1];
const auto last = mSpectrumSize - 1;
for (int ii = 1; ii < last; ++ii) {
for (unsigned int ii = 1; ii < last; ++ii) {
const int kk = *pBitReversed++;
const float realPart = *pReal++ = mFFTBuffer[kk];
const float imagPart = *pImag++ = mFFTBuffer[kk + 1];
@ -1034,7 +1034,7 @@ void EffectNoiseReduction::Worker::GatherStatistics(Statistics &statistics)
// NEW statistics
const float *pPower = &mQueue[0]->mSpectrums[0];
float *pSum = &statistics.mSums[0];
for (int jj = 0; jj < mSpectrumSize; ++jj) {
for (size_t jj = 0; jj < mSpectrumSize; ++jj) {
*pSum++ += *pPower++;
}
}
@ -1171,7 +1171,7 @@ void EffectNoiseReduction::Worker::ReduceNoise
// First, the attack, which goes backward in time, which is,
// toward higher indices in the queue.
for (int jj = 0; jj < mSpectrumSize; ++jj) {
for (size_t jj = 0; jj < mSpectrumSize; ++jj) {
for (unsigned ii = mCenter + 1; ii < mHistoryLen; ++ii) {
const float minimum =
std::max(mNoiseAttenFactor,
@ -1251,7 +1251,7 @@ void EffectNoiseReduction::Worker::ReduceNoise
float *pOut = &mOutOverlapBuffer[0];
float *pWindow = &mOutWindow[0];
int *pBitReversed = &hFFT->BitReversed[0];
for (int jj = 0; jj < last; ++jj) {
for (unsigned int jj = 0; jj < last; ++jj) {
int kk = *pBitReversed++;
*pOut++ += mFFTBuffer[kk] * (*pWindow++);
*pOut++ += mFFTBuffer[kk + 1] * (*pWindow++);
@ -1260,7 +1260,7 @@ void EffectNoiseReduction::Worker::ReduceNoise
else {
float *pOut = &mOutOverlapBuffer[0];
int *pBitReversed = &hFFT->BitReversed[0];
for (int jj = 0; jj < last; ++jj) {
for (unsigned int jj = 0; jj < last; ++jj) {
int kk = *pBitReversed++;
*pOut++ += mFFTBuffer[kk];
*pOut++ += mFFTBuffer[kk + 1];

View File

@ -199,8 +199,8 @@ bool EffectNormalize::Process()
else
msg = topMsg + _("Analyzing first track of stereo pair: ") + trackName;
float offset, min, max;
if (! ( bGoodResult =
AnalyseTrack(track, msg, curTrackNum, offset, min, max) ) )
bGoodResult = AnalyseTrack(track, msg, curTrackNum, offset, min, max);
if (!bGoodResult )
break;
if(!track->GetLinked() || mStereoInd) {
// mono or 'stereo tracks independently'
@ -227,8 +227,8 @@ bool EffectNormalize::Process()
track = (WaveTrack *) iter.Next(); // get the next one
msg = topMsg + _("Analyzing second track of stereo pair: ") + trackName;
float offset2, min2, max2;
if ( ! ( bGoodResult =
AnalyseTrack(track, msg, curTrackNum + 1, offset2, min2, max2) ) )
bGoodResult = AnalyseTrack(track, msg, curTrackNum + 1, offset2, min2, max2);
if ( !bGoodResult )
break;
float extent = wxMax(fabs(min), fabs(max));
extent = wxMax(extent, fabs(min2));

View File

@ -178,7 +178,7 @@ bool EffectReverb::ProcessInitialize(sampleCount WXUNUSED(totalLen), ChannelName
mP = (Reverb_priv_t *) calloc(sizeof(*mP), mNumChans);
for (int i = 0; i < mNumChans; i++)
for (unsigned int i = 0; i < mNumChans; i++)
{
reverb_create(&mP[i].reverb,
mSampleRate,
@ -199,7 +199,7 @@ bool EffectReverb::ProcessInitialize(sampleCount WXUNUSED(totalLen), ChannelName
bool EffectReverb::ProcessFinalize()
{
for (int i = 0; i < mNumChans; i++)
for (unsigned int i = 0; i < mNumChans; i++)
{
reverb_delete(&mP[i].reverb);
}
@ -214,7 +214,7 @@ size_t EffectReverb::ProcessBlock(float **inBlock, float **outBlock, size_t bloc
float *ichans[2] = {NULL, NULL};
float *ochans[2] = {NULL, NULL};
for (int c = 0; c < mNumChans; c++)
for (unsigned int c = 0; c < mNumChans; c++)
{
ichans[c] = inBlock[c];
ochans[c] = outBlock[c];
@ -227,7 +227,7 @@ size_t EffectReverb::ProcessBlock(float **inBlock, float **outBlock, size_t bloc
while (remaining)
{
auto len = std::min(remaining, decltype(remaining)(BLOCK));
for (int c = 0; c < mNumChans; c++)
for (unsigned int c = 0; c < mNumChans; c++)
{
// Write the input samples to the reverb fifo. Returned value is the address of the
// fifo buffer which contains a copy of the input samples.
@ -260,7 +260,7 @@ size_t EffectReverb::ProcessBlock(float **inBlock, float **outBlock, size_t bloc
remaining -= len;
for (int c = 0; c < mNumChans; c++)
for (unsigned int c = 0; c < mNumChans; c++)
{
ichans[c] += len;
ochans[c] += len;

View File

@ -114,7 +114,7 @@ bool EffectReverse::ProcessOneWave(int count, WaveTrack * track, sampleCount sta
// perform a split at the start and/or end of the reverse selection
const auto &clips = track->GetClips();
// Beware, the array grows as we loop over it. Use integer subscripts, not iterators.
for (int ii = 0; ii < clips.size(); ++ii) {
for (size_t ii = 0; ii < clips.size(); ++ii) {
const auto &clip = clips[ii].get();
auto clipStart = clip->GetStartSample();
auto clipEnd = clip->GetEndSample();

View File

@ -1495,7 +1495,7 @@ bool VSTEffect::RealtimeResume()
bool VSTEffect::RealtimeProcessStart()
{
for (int i = 0; i < mAudioIns; i++)
for (unsigned int i = 0; i < mAudioIns; i++)
memset(mMasterIn[i].get(), 0, mBlockSize * sizeof(float));
mNumSamples = 0;
@ -1507,7 +1507,7 @@ size_t VSTEffect::RealtimeProcess(int group, float **inbuf, float **outbuf, size
{
wxASSERT(numSamples <= mBlockSize);
for (int c = 0; c < mAudioIns; c++)
for (unsigned int c = 0; c < mAudioIns; c++)
{
for (decltype(numSamples) s = 0; s < numSamples; s++)
{

View File

@ -906,12 +906,12 @@ bool LadspaEffect::ProcessFinalize()
size_t LadspaEffect::ProcessBlock(float **inBlock, float **outBlock, size_t blockLen)
{
for (int i = 0; i < mAudioIns; i++)
for (int i = 0; i < (int)mAudioIns; i++)
{
mData->connect_port(mMaster, mInputPorts[i], inBlock[i]);
}
for (int i = 0; i < mAudioOuts; i++)
for (int i = 0; i < (int)mAudioOuts; i++)
{
mData->connect_port(mMaster, mOutputPorts[i], outBlock[i]);
}
@ -972,12 +972,12 @@ size_t LadspaEffect::RealtimeProcess(int group,
float **outbuf,
size_t numSamples)
{
for (int i = 0; i < mAudioIns; i++)
for (int i = 0; i < (int)mAudioIns; i++)
{
mData->connect_port(mSlaves[group], mInputPorts[i], inbuf[i]);
}
for (int i = 0; i < mAudioOuts; i++)
for (int i = 0; i < (int)mAudioOuts; i++)
{
mData->connect_port(mSlaves[group], mOutputPorts[i], outbuf[i]);
}

View File

@ -2022,7 +2022,7 @@ LV2_URID LV2Effect::urid_map(LV2_URID_Map_Handle handle, const char *uri)
LV2_URID LV2Effect::URID_Map(const char *uri)
{
size_t ndx = mURIMap.size();
for (int i = 0; i < ndx; i++)
for (size_t i = 0; i < ndx; i++)
{
if (strcmp(mURIMap[i].get(), uri) == 0)
{

View File

@ -472,7 +472,7 @@ bool VampEffect::Process()
if (request < block)
{
for (int c = 0; c < channels; ++c)
for (unsigned int c = 0; c < channels; ++c)
{
for (decltype(block) i = request; i < block; ++i)
{

View File

@ -1099,13 +1099,13 @@ void ExportMixerPanel::OnPaint(wxPaintEvent & WXUNUSED(event))
angle = totAngle / ( mMixerSpec->GetNumTracks() + 1 );
int max = 0, w, h;
for( int i = 1; i < mMixerSpec->GetNumTracks(); i++ )
for( unsigned int i = 1; i < mMixerSpec->GetNumTracks(); i++ )
if( mTrackNames[ i ].length() > mTrackNames[ max ].length() )
max = i;
SetFont( memDC, mTrackNames[ max ], mBoxWidth, mTrackHeight );
for( int i = 0; i < mMixerSpec->GetNumTracks(); i++ )
for( unsigned int i = 0; i < mMixerSpec->GetNumTracks(); i++ )
{
mTrackRects[ i ].x = (int)( mBoxWidth * 2 + radius - radius *
cos( totAngle / 2.0 - angle * ( i + 1 ) ) - mBoxWidth + 0.5 );
@ -1116,7 +1116,7 @@ void ExportMixerPanel::OnPaint(wxPaintEvent & WXUNUSED(event))
mTrackRects[ i ].width = mBoxWidth;
mTrackRects[ i ].height = mTrackHeight;
memDC.SetPen( mSelectedTrack == i ? *wxRED_PEN : *wxBLACK_PEN );
memDC.SetPen( mSelectedTrack == (int)i ? *wxRED_PEN : *wxBLACK_PEN );
memDC.DrawRectangle( mTrackRects[ i ] );
memDC.GetTextExtent( mTrackNames[ i ], &w, &h );
@ -1133,7 +1133,7 @@ void ExportMixerPanel::OnPaint(wxPaintEvent & WXUNUSED(event))
SetFont( memDC, wxT( "Channel: XX" ), mBoxWidth, mChannelHeight );
memDC.GetTextExtent( wxT( "Channel: XX" ), &w, &h );
for( int i = 0; i < mMixerSpec->GetNumChannels(); i++ )
for( unsigned int i = 0; i < mMixerSpec->GetNumChannels(); i++ )
{
mChannelRects[ i ].x = (int)( mBoxWidth * 4 - radius + radius *
cos( totAngle * 0.5 - angle * ( i + 1 ) ) + 0.5 );
@ -1144,7 +1144,7 @@ void ExportMixerPanel::OnPaint(wxPaintEvent & WXUNUSED(event))
mChannelRects[ i ].width = mBoxWidth;
mChannelRects[ i ].height = mChannelHeight;
memDC.SetPen( mSelectedChannel == i ? *wxRED_PEN : *wxBLACK_PEN );
memDC.SetPen( mSelectedChannel == (int)i ? *wxRED_PEN : *wxBLACK_PEN );
memDC.DrawRectangle( mChannelRects[ i ] );
memDC.DrawText( wxString::Format( _( "Channel: %2d" ), i + 1 ),
@ -1154,8 +1154,8 @@ void ExportMixerPanel::OnPaint(wxPaintEvent & WXUNUSED(event))
//draw links
memDC.SetPen( wxPen( *wxBLACK, mHeight / 200 ) );
for( int i = 0; i < mMixerSpec->GetNumTracks(); i++ )
for( int j = 0; j < mMixerSpec->GetNumChannels(); j++ )
for( unsigned int i = 0; i < mMixerSpec->GetNumTracks(); i++ )
for( unsigned int j = 0; j < mMixerSpec->GetNumChannels(); j++ )
if( mMixerSpec->mMap[ i ][ j ] )
AColor::Line(memDC, mTrackRects[ i ].x + mBoxWidth,
mTrackRects[ i ].y + mTrackHeight / 2, mChannelRects[ j ].x,
@ -1181,11 +1181,11 @@ void ExportMixerPanel::OnMouseEvent(wxMouseEvent & event)
{
bool reset = true;
//check tracks
for( int i = 0; i < mMixerSpec->GetNumTracks(); i++ )
for( unsigned int i = 0; i < mMixerSpec->GetNumTracks(); i++ )
if( mTrackRects[ i ].Contains( event.m_x, event.m_y ) )
{
reset = false;
if( mSelectedTrack == i )
if( mSelectedTrack == (int)i )
mSelectedTrack = -1;
else
{
@ -1198,11 +1198,11 @@ void ExportMixerPanel::OnMouseEvent(wxMouseEvent & event)
}
//check channels
for( int i = 0; i < mMixerSpec->GetNumChannels(); i++ )
for( unsigned int i = 0; i < mMixerSpec->GetNumChannels(); i++ )
if( mChannelRects[ i ].Contains( event.m_x, event.m_y ) )
{
reset = false;
if( mSelectedChannel == i )
if( mSelectedChannel == (int)i )
mSelectedChannel = -1;
else
{
@ -1215,8 +1215,8 @@ void ExportMixerPanel::OnMouseEvent(wxMouseEvent & event)
}
//check links
for( int i = 0; i < mMixerSpec->GetNumTracks(); i++ )
for( int j = 0; j < mMixerSpec->GetNumChannels(); j++ )
for( unsigned int i = 0; i < mMixerSpec->GetNumTracks(); i++ )
for( unsigned int j = 0; j < mMixerSpec->GetNumChannels(); j++ )
if( mMixerSpec->mMap[ i ][ j ] && IsOnLine( wxPoint( event.m_x,
event.m_y ), wxPoint( mTrackRects[ i ].x + mBoxWidth,
mTrackRects[ i ].y + mTrackHeight / 2 ),

View File

@ -1855,7 +1855,7 @@ ProgressResult ExportMP3::Export(AudacityProject *project,
short *mixed = (short *)mixer->GetBuffer();
if (blockLen < inSamples) {
if (blockLen < (unsigned int)inSamples) {
if (channels > 1) {
bytes = exporter.EncodeRemainder(mixed, blockLen, buffer.get());
}

View File

@ -740,10 +740,10 @@ ProgressResult FFmpegImportFileHandle::WriteData(streamContext *sc)
// Separate the channels and convert input sample format to 16-bit
uint8_t *in = sc->m_decodedAudioSamples.get();
int index = 0;
int pos = 0;
unsigned int pos = 0;
while (pos < insamples)
{
for (int chn = 0; chn < sc->m_stream->codec->channels; chn++)
for (size_t chn = 0; chn < (size_t)sc->m_stream->codec->channels; chn++)
{
if (chn < nChannels)
{
@ -788,7 +788,7 @@ ProgressResult FFmpegImportFileHandle::WriteData(streamContext *sc)
// Write audio into WaveTracks
auto iter2 = iter->begin();
for (int chn=0; chn < nChannels; ++iter2, ++chn)
for (size_t chn=0; chn < nChannels; ++iter2, ++chn)
{
iter2->get()->Append((samplePtr)tmp[chn].get(), sc->m_osamplefmt, index);
}

View File

@ -478,7 +478,7 @@ ProgressResult PCMImportFileHandle::Import(TrackFactory *trackFactory,
else
block = SFCall<sf_count_t>(sf_readf_float, mFile.get(), (float *)srcbuffer.ptr(), block);
if(block < 0 || block > maxBlock) {
if(block < 0 || block > (long)maxBlock) {
wxASSERT(false);
block = maxBlock;
}

View File

@ -15,6 +15,7 @@
#include "../Audacity.h"
#include "RawAudioGuess.h"
#include "../AudacityException.h"
#include "../MemoryX.h"
#include <stdio.h>
@ -187,7 +188,7 @@ static void Extract(bool bits16,
bool stereo,
bool bigendian,
bool offset,
char *rawData, int dataSize,
char *rawData, int dataSizeIn,
float *data1, float *data2, size_t *len1, size_t *len2)
{
size_t rawCount = 0;
@ -201,14 +202,19 @@ static void Extract(bool bits16,
/* Special case so as to not flip stereo channels during analysis */
if (stereo && !bigendian) {
rawData += 3;
dataSize -= 3;
dataSizeIn -= 3;
}
else {
rawData++;
dataSize--;
dataSizeIn--;
}
}
if( dataSizeIn < 1 )
throw SimpleMessageBoxException{_("Bad data size")};
size_t dataSize = (size_t)dataSizeIn;
if (bits16) {
if (sign && bigendian)
while (rawCount + 1 < dataSize) {
@ -322,7 +328,7 @@ static int GuessFloatFormats(unsigned numTests, const ArrayOf<char> rawData[], s
* floats with a 1-byte offset.
*/
for(int prec = 0; prec < 2; prec++) {
for(unsigned int prec = 0; prec < 2; prec++) {
for(int endian = 0; endian < 2; endian++) {
for(size_t offset = 0; offset < (4 * prec + 4); offset++) {
unsigned finiteVotes = 0;

View File

@ -384,7 +384,7 @@ void KeyConfigPrefs::OnExport(wxCommandEvent & WXUNUSED(event))
// There currently is only one clickable AButton
// so we just do what it needs.
void KeyConfigPrefs::OnDefaults(wxCommandEvent & event)
void KeyConfigPrefs::OnDefaults(wxCommandEvent & WXUNUSED(event))
{
wxMenu Menu;
Menu.Append( 1, _("Standard") );

View File

@ -174,11 +174,11 @@ void MidiIOPrefs::PopulateOrExchange( ShuttleGui & S ) {
#endif
}
void MidiIOPrefs::OnHost(wxCommandEvent & e)
void MidiIOPrefs::OnHost(wxCommandEvent & WXUNUSED(e))
{
wxString itemAtIndex;
int index = mHost->GetCurrentSelection();
if (index >= 0 && index < mHostNames.Count())
if (index >= 0 && index < (int)mHostNames.Count())
itemAtIndex = mHostNames.Item(index);
int nDevices = Pm_CountDevices();

View File

@ -364,14 +364,14 @@ namespace
{
// Create the requested window function
window = Floats{ fftLen };
int ii;
size_t ii;
const bool extra = padding > 0;
wxASSERT(windowSize % 2 == 0);
if (extra)
// For windows that do not go to 0 at the edges, this improves symmetry
++windowSize;
const int endOfWindow = padding + windowSize;
const size_t endOfWindow = padding + windowSize;
// Left and right padding
for (ii = 0; ii < padding; ++ii) {
window[ii] = 0.0;
@ -387,7 +387,7 @@ namespace
break;
case TWINDOW:
NewWindowFunc(windowType, windowSize, extra, window.get() + padding);
for (int ii = padding, multiplier = -(int)windowSize / 2; ii < endOfWindow; ++ii, ++multiplier)
for (int ii = padding, multiplier = -(int)windowSize / 2; ii < (int)endOfWindow; ++ii, ++multiplier)
window[ii] *= multiplier;
break;
case DWINDOW:

View File

@ -129,13 +129,7 @@ SelectionBar::SelectionBar()
mStart(0.0), mEnd(0.0), mLength(0.0), mCenter(0.0), mAudio(0.0),
mStartTime(NULL), mEndTime(NULL), mLengthTime(NULL), mCenterTime(NULL),
mAudioTime(NULL),
#ifdef SEL_RADIO_TITLES
mStartTitle(NULL), mCenterTitle(NULL), mLengthTitle(NULL), mEndTitle(NULL),
mStartEndProxy(NULL), mStartLengthProxy(NULL), mLengthEndProxy(NULL), mLengthCenterProxy(NULL),
#endif
#ifdef SEL_CHOICE
mChoice(NULL),
#endif
mDrive1( StartTimeID), mDrive2( EndTimeID ),
mSelectionMode(0)
{
@ -148,15 +142,6 @@ SelectionBar::SelectionBar()
mRate = (double) gPrefs->Read(wxT("/SamplingRate/DefaultProjectSampleRate"),
AudioIO::GetOptimalSupportedSampleRate());
#ifdef SEL_BUTTON_TITLES
mButtonTitles[0]=NULL;
mButtonTitles[1]=NULL;
mButtonTitles[2]=NULL;
mHyphen[0]=NULL;
mHyphen[1]=NULL;
mHyphen[2]=NULL;
#endif
// Selection mode of 0 means showing 'start' and 'end' only.
mSelectionMode = gPrefs->ReadLong(wxT("/SelectionToolbarMode"), 0);
}
@ -240,10 +225,6 @@ void SelectionBar::Populate()
SetBackgroundColour( theTheme.Colour( clrMedium ) );
mStartTime = mEndTime = mLengthTime = mCenterTime = mAudioTime = nullptr;
#ifdef SEL_RADIO_TITLE
mStartEndProxy = mStartLengthProxy = mLengthEndProxy = mLengthCenterProxy = nullptr;
#endif
// This will be inherited by all children:
SetFont(wxFont(
@ -286,37 +267,6 @@ void SelectionBar::Populate()
AddVLine( mainSizer );
{
#ifdef SEL_RADIO_TITLE
auto hSizer = std::make_unique<wxBoxSizer>(wxHORIZONTAL);
(mStartEndRadBtn = AddRadioButton( _("Start-End"), StartEndRadioID, hSizer.get(), wxRB_GROUP))
->SetValue( mSelectionMode == 0 );
mStartEndProxy = mProxy;
(mStartLengthRadBtn = AddRadioButton( _("Start-Length"), StartLengthRadioID, hSizer.get(), 0))
->SetValue( mSelectionMode == 1 );
mStartLengthProxy = mProxy;
(mLengthEndRadBtn = AddRadioButton( _("Length-End"), LengthEndRadioID, hSizer.get(), 0))
->SetValue( mSelectionMode == 2 );
mLengthEndProxy = mProxy;
(mLengthCenterRadBtn = AddRadioButton( _("Length-Center"), LengthCenterRadioID, hSizer.get(), 0))
->SetValue( mSelectionMode == 3 );
mLengthCenterProxy = mProxy;
mainSizer->Add(hSizer.release(), 0, wxALIGN_TOP| wxRIGHT, 0);
#endif
#ifdef SEL_BUTTON_TITLES
auto vSizer = std::make_unique<wxBoxSizer>(wxVERTICAL);
auto hSizer = std::make_unique<wxBoxSizer>(wxHORIZONTAL);
mButtonTitles[0] = AddTitle( "< ", LeftID, hSizer.get() );
mButtonTitles[1] = AddTitle( "Start - End ", CentralNameID, hSizer.get() );
mButtonTitles[2] = AddTitle( " >", RightID, hSizer.get() );
mButtonTitles[0]->Bind( wxEVT_LEFT_DOWN,&SelectionBar::OnModeDecClicked,this );
mButtonTitles[1]->Bind( wxEVT_LEFT_DOWN,&SelectionBar::OnChooserTitleClicked, this );
mButtonTitles[2]->Bind( wxEVT_LEFT_DOWN,&SelectionBar::OnModeIncClicked,this );
vSizer->Add( hSizer.release(), 0, wxALIGN_CENTER, 0);
mainSizer->Add(vSizer.release(), 0, wxALIGN_CENTER, 0 );
#endif
#ifdef SEL_CHOICE
const wxString choices[4] = {
_("Start and End of Selection"),
_("Start and Length of Selection"),
@ -336,22 +286,8 @@ void SelectionBar::Populate()
mChoice->SetMinSize( sz );
#endif
mainSizer->Add(mChoice, 0, wxALIGN_TOP | wxEXPAND | wxRIGHT, 6);
#endif
}
#ifdef SEL_PLAIN_TITLES
mStartTitle = AddTitle( _("Start"), mainSizer );
mLengthTitle = AddTitle( _("Length"), mainSizer );
mCenterTitle = AddTitle( _("Center"), mainSizer );
mEndTitle = AddTitle( _("End"), mainSizer );
mStartTitle->Bind( wxEVT_LEFT_DOWN,&SelectionBar::OnStartTitleClicked,this );
mLengthTitle->Bind( wxEVT_LEFT_DOWN,&SelectionBar::OnLengthTitleClicked,this );
mCenterTitle->Bind( wxEVT_LEFT_DOWN,&SelectionBar::OnCenterTitleClicked,this );
mEndTitle->Bind( wxEVT_LEFT_DOWN,&SelectionBar::OnEndTitleClicked,this );
#endif
//
// Botton row, (mostly time controls)
//
@ -433,23 +369,6 @@ void SelectionBar::Populate()
NULL,
this);
#ifdef OPTION_BUTTON
// Old code which placed a button from which to select options.
// Retained in case we want a button for selection-toolbar options at a future date.
AButton *& pBtn = mButtons[ SelTBMenuID - SelTBFirstButton];
pBtn = ToolBar::MakeButton(this,
bmpRecoloredUpSmall, bmpRecoloredDownSmall, bmpRecoloredHiliteSmall,
bmpOptions, bmpOptions, bmpOptionsDisabled,
SelTBMenuID,
wxDefaultPosition,
false,
theTheme.ImageSize( bmpRecoloredUpSmall ));
pBtn->SetLabel(_("Selection options"));
pBtn->SetToolTip(_("Selection options"));
//pBtn->Disable();
mainSizer->Add( pBtn, 0, wxALIGN_TOP | wxRIGHT, 5);
#endif
AddVLine( mainSizer );
mAudioTime = AddTime(_("Audio Position"), AudioTimeID, mainSizer );
@ -467,32 +386,14 @@ void SelectionBar::Populate()
auto hSizer = std::make_unique<wxBoxSizer>(wxHORIZONTAL);
mStartTime = AddTime(_("Start"), StartTimeID, hSizer.get() );
#ifdef SEL_BUTTON_TITLES
mHyphen[0] = AddTitle( "-", -1, hSizer.get() );
#endif
mLengthTime = AddTime(_("Length"), LengthTimeID, hSizer.get() );
#ifdef SEL_BUTTON_TITLES
mHyphen[1] = AddTitle( "-", -1, hSizer.get() );
#endif
mCenterTime = AddTime(_("Center"), CenterTimeID, hSizer.get() );
#ifdef SEL_BUTTON_TITLES
mHyphen[2] = AddTitle( "-", -1, hSizer.get() );
#endif
mEndTime = AddTime(_("End"), EndTimeID, hSizer.get() );
mainSizer->Add(hSizer.release(), 0, wxALIGN_TOP | wxRIGHT, 0);
#ifdef SEL_RADIO_TITLES
// Put choice of what fields to show immediately before the fields.
mStartEndRadBtn->MoveBeforeInTabOrder( mStartTime );
mStartLengthRadBtn->MoveAfterInTabOrder( mStartEndRadBtn );
mLengthEndRadBtn->MoveAfterInTabOrder( mStartLengthRadBtn );
mLengthCenterRadBtn->MoveAfterInTabOrder( mLengthEndRadBtn );
#endif
}
#ifdef SEL_CHOICE
mChoice->MoveBeforeInTabOrder( mStartTime );
#endif
// This shows/hides controls.
// Do this before layout so that we are sized right.
SetSelectionMode(mSelectionMode);
@ -637,22 +538,22 @@ void SelectionBar::OnTitleClicked(int newDriver)
}
// These functions give the IDs of the associated control, NOT the ID of the title.
void SelectionBar::OnStartTitleClicked(wxMouseEvent & event){ OnTitleClicked( StartTimeID );};
void SelectionBar::OnLengthTitleClicked(wxMouseEvent & event){ OnTitleClicked( LengthTimeID );};
void SelectionBar::OnCenterTitleClicked(wxMouseEvent & event){ OnTitleClicked( CenterTimeID );};
void SelectionBar::OnEndTitleClicked(wxMouseEvent & event){ OnTitleClicked( EndTimeID );};
void SelectionBar::OnStartTitleClicked(wxMouseEvent & WXUNUSED(event)){ OnTitleClicked( StartTimeID );};
void SelectionBar::OnLengthTitleClicked(wxMouseEvent & WXUNUSED(event)){ OnTitleClicked( LengthTimeID );};
void SelectionBar::OnCenterTitleClicked(wxMouseEvent & WXUNUSED(event)){ OnTitleClicked( CenterTimeID );};
void SelectionBar::OnEndTitleClicked(wxMouseEvent & WXUNUSED(event)){ OnTitleClicked( EndTimeID );};
void SelectionBar::OnModeDecClicked(wxMouseEvent & event){
void SelectionBar::OnModeDecClicked(wxMouseEvent & WXUNUSED(event)){
SetSelectionMode( (mSelectionMode +3)%4 );
SelectionModeUpdated();
}
void SelectionBar::OnModeIncClicked(wxMouseEvent & event){
void SelectionBar::OnModeIncClicked(wxMouseEvent & WXUNUSED(event)){
SetSelectionMode( (mSelectionMode +1)%4 );
SelectionModeUpdated();
}
void SelectionBar::OnChooserTitleClicked(wxMouseEvent & event){
void SelectionBar::OnChooserTitleClicked(wxMouseEvent & WXUNUSED(event)){
wxCommandEvent evt;
OnButton( evt );
}
@ -708,9 +609,6 @@ void SelectionBar::SetDrivers( int driver1, int driver2 )
mDrive1 = driver1;
mDrive2 = driver2;
#ifdef SEL_PLAIN_TITLES
wxStaticText ** Titles[4] = { &mStartTitle, &mCenterTitle, &mLengthTitle, &mEndTitle};
#endif
NumericTextCtrl ** Ctrls[4] = { &mStartTime, &mCenterTime, &mLengthTime, &mEndTime};
wxString Text[4] = { _("Start"), _("Center"), _("Length"), _("End") };
@ -726,11 +624,6 @@ void SelectionBar::SetDrivers( int driver1, int driver2 )
wxString VoiceOverText = wxString::Format(_("Selection %s. %s won't change."), Temp, Text[fixed]);
// i18n-hint: %s is replaced e.g by 'Length'. This is a tooltip on a numerical control.
//wxString Tooltip = wxString::Format( _(" With %s fixed. (Use context menu to change format.) "), Text[fixed] );
#ifdef SEL_PLAIN_TITLES
if( *Titles[i] ){
(*Titles[i])->SetLabelText( Title );
}
#endif
if( *Ctrls[i] ){
(*Ctrls[i])->SetName( Temp );
//(*Ctrls[i])->SetToolTip( Tooltip );
@ -741,7 +634,7 @@ void SelectionBar::SetDrivers( int driver1, int driver2 )
// There currently is only one clickable AButton
// so we just do what it needs.
void SelectionBar::OnButton(wxCommandEvent & event)
void SelectionBar::OnButton(wxCommandEvent & WXUNUSED(event))
{
AudacityProject *p = GetActiveProject();
if (!p) return;
@ -757,13 +650,6 @@ void SelectionBar::OnButton(wxCommandEvent & event)
Menu.AppendRadioItem( 1, _("Start - Length") );
Menu.AppendRadioItem( 2, _("Length - End") );
Menu.AppendRadioItem( 3, _("Length - Center") );
#if 0
// These four options were found to be too confusing.
Menu.AppendRadioItem( 4, _("Start - Length - End") );
Menu.AppendRadioItem( 5, _("Start - Center - Length") );
Menu.AppendRadioItem( 6, _("Start - Center - End") );
Menu.AppendRadioItem( 7, _("Start - Length - Center - End") );
#endif
Menu.Check( mSelectionMode, true );
// Pop it up where the mouse is.
pBtn->PopupMenu(&Menu);//, wxPoint(0, 0));
@ -807,66 +693,16 @@ void SelectionBar::SelectionModeUpdated()
void SelectionBar::SetSelectionMode(int mode)
{
#if defined(SEL_BUTTON_TITLES) || defined( SEL_CHOICE)
// With SEL_BUTTON_TITLES only modes 0 to 3 are supported,
// Only modes 0 to 3 are now supported,
// so fix up a mode that could have come from the config.
const int maxMode = 3;
#else
const int maxMode = 7;
#endif
if( mode > maxMode )
mode = 0;
if( mode < 0 )
mode = 0;
mSelectionMode = mode;
int id = mode + StartEndRadioID;
#ifdef SEL_RADIO_TITLES
if( mStartEndProxy == NULL ){
// The line breaks are a little funny in order that the i18n hints occur i the right place in
// the .pot file
mStartEndRadBtn->SetLabelText( (id == StartEndRadioID) ? _("Start - End") :
// i18n-hint: S-E is an abbreviation of Start-End
_("S-E") );
mStartLengthRadBtn->SetLabelText( (id == StartLengthRadioID) ? _("Start - Length") :
// i18n-hint: S-L is an abbreviation of Start-Length
_("S-L") );
mLengthEndRadBtn->SetLabelText( (id == LengthEndRadioID) ? _("Length - End") :
// i18n-hint: L-E is an abbreviation of Length-End
_("L-E") );
mLengthCenterRadBtn->SetLabelText( (id == LengthCenterRadioID) ? _("Length - Center") :
// i18n-hint: L-C is an abbreviation of Length-Center
_("L-C") );
}
else
{
mStartEndProxy->SetLabelText( (id == StartEndRadioID) ? _("Start - End") : _("S-E") );
mStartLengthProxy->SetLabelText( (id == StartLengthRadioID) ? _("Start - Length") : _("S-L") );
mLengthEndProxy->SetLabelText( (id == LengthEndRadioID) ? _("Length - End") : _("L-E") );
mLengthCenterProxy->SetLabelText( (id == LengthCenterRadioID) ? _("Length - Center") : _("L-C") );
}
mStartEndRadBtn->SetToolTip( (id != StartEndRadioID) ? _("Show start time and end time") : "" );
mStartLengthRadBtn->SetToolTip( (id != StartLengthRadioID) ? _("Show start time and length") : "" );
mLengthEndRadBtn->SetToolTip( (id != LengthEndRadioID) ? _("Show length and end time") : "" );
mLengthCenterRadBtn->SetToolTip( (id != LengthCenterRadioID) ? _("Show length and center") : "" );
mStartEndRadBtn->SetValue( id == StartEndRadioID );
mStartLengthRadBtn->SetValue( id == StartLengthRadioID );
mLengthEndRadBtn->SetValue( id == LengthEndRadioID );
mLengthCenterRadBtn->SetValue( id == LengthCenterRadioID );
#endif
#ifdef SEL_BUTTON_TITLES
// Not translated. This is old experiemental code that is probably on the way out.
wxString CenterNames[] = { " Start - End ", " Start - Length ", " Length - End ", " Length - Center " };
mButtonTitles[1]->SetLabel( CenterNames[mode] );
#endif
#ifdef SEL_CHOICE
mChoice->SetSelection( mode );
#endif
// First decide which two controls drive the others...
// For example the last option is with all controls shown, and in that mode we
@ -877,12 +713,6 @@ void SelectionBar::SetSelectionMode(int mode)
EndTimeID, LengthTimeID, EndTimeID, EndTimeID};
SetDrivers( Drive1[mode], Drive2[mode] );
#ifdef SEL_BUTTON_TITLES
// Show just the hyphen after the first of the items.
for(int i=0;i<3;i++){
mHyphen[i]->SetLabel( ((i+StartTimeID) == Drive2[mode]) ? "- " : "" );
}
#endif
// Then show/hide the relevant controls.
ShowHideControls( mode );
}
@ -897,17 +727,10 @@ void SelectionBar::ShowHideControls(int mode)
15};
int mask = masks[mode];
#ifdef SEL_PLAIN_TITLES
wxStaticText ** Titles[4] = { &mStartTitle, &mCenterTitle, &mLengthTitle, &mEndTitle};
#endif
NumericTextCtrl ** Ctrls[4] = { &mStartTime, &mCenterTime, &mLengthTime, &mEndTime};
for(int i=0;i<4;i++){
if( *Ctrls[i])
(*Ctrls[i])->Show( (mask & (1<<i))!=0 );
#ifdef SEL_PLAIN_TITLES
if( *Titles[i])
(*Titles[i])->Show( (mask & (1<<i))!=0 );
#endif
}
}

View File

@ -15,16 +15,6 @@
#include "ToolBar.h"
// PLAIN_TITLES give Start Length Center End above each field.
// RADIO_TITLES give ()SE (*)Start-Length ()LE ()LC style.
// BUTTON_TITLES give < Start - Length > style.
// CHOICE gives a choice control
//#define SEL_RADIO_TITLES
//#define SEL_BUTTON_TITLES
#define SEL_CHOICE
// OPTIONS_BUTTON gives a button with three dots to select the option.
// Column for
// Project rate
// Snap To
@ -34,11 +24,7 @@
// Vertical Line
// Cursor position
#ifdef OPTIONS_BUTTON
#define SIZER_COLS 8
#else
#define SIZER_COLS 7
#endif
class wxBitmap;
class wxCheckBox;
@ -136,46 +122,10 @@ class SelectionBar final : public ToolBar {
NumericTextCtrl *mLengthTime;
NumericTextCtrl *mEndTime;
NumericTextCtrl *mAudioTime;
#ifdef SEL_CHOICE
wxChoice * mChoice;
#endif
#ifdef PLAIN_TITLES
wxStaticText * mStartTitle;
wxStaticText * mCenterTitle;
wxStaticText * mLengthTitle;
wxStaticText * mEndTitle;
#endif
#ifdef SEL_RADIO_TITLES
// These are the radio buttons
wxRadioButton * mStartEndRadBtn;
wxRadioButton * mStartLengthRadBtn;
wxRadioButton * mLengthEndRadBtn;
wxRadioButton * mLengthCenterRadBtn;
// These provide proxy themable text for
// Radio buttons that couldn't be themed.
wxStaticText * mStartEndProxy;
wxStaticText * mStartLengthProxy;
wxStaticText * mLengthEndProxy;
wxStaticText * mLengthCenterProxy;
#endif
#ifdef SEL_BUTTON_TITLES
wxStaticText * mButtonTitles[3];
wxStaticText * mHyphen[3];
#endif
wxStaticText * mProxy;
wxComboBox *mRateBox;
wxChoice *mSnapTo;
wxWindow *mRateText;
AButton * mButtons[numSelectionBarButtons];

View File

@ -701,20 +701,6 @@ void ToolBar::MakeRecoloredImage( teBmps eBmpOut, teBmps eBmpIn )
{
// Don't recolour the buttons...
MakeMacRecoloredImage( eBmpOut, eBmpIn );
return;
wxImage * pSrc = &theTheme.Image( eBmpIn );
#if defined( __WXGTK__ )
wxColour newColour = wxSystemSettings::GetColour( wxSYS_COLOUR_BACKGROUND );
#else
wxColour newColour = wxSystemSettings::GetColour( wxSYS_COLOUR_3DFACE );
#endif
newColour = wxColour( 60,60,60 );
wxColour baseColour = wxColour( 204, 204, 204 );
auto pPattern = ChangeImageColour( pSrc, baseColour, newColour );
theTheme.ReplaceImage( eBmpOut, pPattern.get());
}
void ToolBar:: MakeButtonBackgroundsLarge()
@ -880,49 +866,13 @@ void ToolBar::OnPaint( wxPaintEvent & event )
#if defined( __WXGTK__ )
//dc.SetBackground( wxBrush( wxSystemSettings::GetColour( wxSYS_COLOUR_BACKGROUND ) ) );
#endif
// Themed background colour.
dc.SetBackground( wxBrush( theTheme.Colour( clrMedium ) ) );
dc.Clear();
// EXPERIMENTAL_THEMING is set to not apply the gradient
// on wxMAC builds. on wxMAC we have the AQUA_THEME.
#ifdef USE_AQUA_THEME
Repaint( &dc );
#else
return;
#ifdef EXPERIMENTAL_THEMING
wxImage * mpBackGradient = &theTheme.Image( bmpRecoloredUpLarge );
if( mpBackGradient != NULL )
{
wxSize imSz( mpBackGradient->GetWidth(), mpBackGradient->GetHeight() );
wxSize sz = GetSize();
int y;
for(y=0;y<sz.y;y++)
{
int yPix = ((float)y * imSz.y - 1.0f)/(sz.y-1);
wxColour col(
mpBackGradient->GetRed( 0, yPix),
mpBackGradient->GetGreen( 0, yPix),
mpBackGradient->GetBlue( 0, yPix));
// Set background colour so that controls placed on this
// toolbar such as radio buttons will draw reasonably.
// It's a little tacky setting the background colour
// here, but we can't do it in the constructor as the gradient
// may not be available yet.
// Better than this would be to set the colour when the image
// is loaded.
// We use the colour at the half way point as a suitable 'average'.
if( y==(sz.y/2) )
{
SetBackgroundColour( col );
}
wxPen Pen( col );
dc.SetPen(Pen );
AColor::Line(dc, 0, y, sz.x, y );
}
}
#endif
#endif
}

View File

@ -1502,10 +1502,8 @@ bool ToolManager::RestoreFocus()
auto temp1 = AButton::TemporarilyAllowFocus();
auto temp2 = ASlider::TemporarilyAllowFocus();
auto temp3 = Meter::TemporarilyAllowFocus();
auto parent = mLastFocus->GetParent();
mLastFocus->SetFocus();
return true;
}
return false;
}

View File

@ -66,8 +66,6 @@ UIHandle::Result LabelDefaultClickHandle::Click
// Redraw to show the change of text box selection status
UIHandle::Result result = RefreshAll;
auto pLT = static_cast<LabelTrack*>(evt.pCell.get());
if (evt.event.LeftDown())
{
SaveState( pProject );
@ -90,14 +88,14 @@ UIHandle::Result LabelDefaultClickHandle::Click
}
UIHandle::Result LabelDefaultClickHandle::Drag
(const TrackPanelMouseEvent &evt, AudacityProject *pProject)
(const TrackPanelMouseEvent &WXUNUSED(evt), AudacityProject *WXUNUSED(pProject))
{
return RefreshCode::RefreshNone;
}
UIHandle::Result LabelDefaultClickHandle::Release
(const TrackPanelMouseEvent &evt, AudacityProject *pProject,
wxWindow *pParent)
(const TrackPanelMouseEvent &WXUNUSED(evt), AudacityProject *WXUNUSED(pProject),
wxWindow *WXUNUSED(pParent))
{
mLabelState.reset();
return RefreshCode::RefreshNone;

View File

@ -23,7 +23,7 @@ Paul Licameli split from TrackPanel.cpp
std::vector<UIHandlePtr> LabelTrack::DetailedHitTest
(const TrackPanelMouseState &st,
const AudacityProject *pProject, int, bool)
const AudacityProject *WXUNUSED(pProject), int, bool)
{
UIHandlePtr result;
std::vector<UIHandlePtr> results;

View File

@ -23,8 +23,8 @@ Paul Licameli split from TrackPanel.cpp
#include "StretchHandle.h"
std::vector<UIHandlePtr> NoteTrack::DetailedHitTest
(const TrackPanelMouseState &state,
const AudacityProject *pProject, int, bool )
(const TrackPanelMouseState &WXUNUSED(state),
const AudacityProject *WXUNUSED(pProject), int, bool )
{
// Eligible for stretch?
UIHandlePtr result;

View File

@ -117,7 +117,7 @@ HitTestPreview NoteTrackVZoomHandle::Preview
UIHandle::Result NoteTrackVZoomHandle::Release
(const TrackPanelMouseEvent &evt, AudacityProject *pProject,
wxWindow *pParent)
wxWindow *WXUNUSED(pParent))
{
using namespace RefreshCode;
auto pTrack = pProject->GetTracks()->Lock(mpTrack);
@ -148,7 +148,7 @@ UIHandle::Result NoteTrackVZoomHandle::Release
return RefreshAll;
}
UIHandle::Result NoteTrackVZoomHandle::Cancel(AudacityProject *pProject)
UIHandle::Result NoteTrackVZoomHandle::Cancel(AudacityProject *WXUNUSED(pProject))
{
// Cancel is implemented! And there is no initial state to restore,
// so just return a code.

View File

@ -74,9 +74,8 @@ UIHandlePtr StretchHandle::HitTest
// later, we may want a different policy, but for now, stretch is
// selected when the cursor is near the center of the track and
// within the selection
const ViewInfo &viewInfo = pProject->GetViewInfo();
const bool unsafe = pProject->IsAudioActive();
if (!pTrack || !pTrack->GetSelected() || pTrack->GetKind() != Track::Note)
return {};
@ -221,11 +220,10 @@ UIHandle::Result StretchHandle::Release
return RefreshAll | Cancelled;
}
bool left;
bool left = mStretchState.mMode == stretchLeft;
bool right = mStretchState.mMode == stretchRight;
ViewInfo &viewInfo = pProject->GetViewInfo();
if ( pProject->IsSyncLocked() &&
( ( left = mStretchState.mMode == stretchLeft ) ||
mStretchState.mMode == stretchRight ) ) {
if ( pProject->IsSyncLocked() && ( left || right ) ) {
SyncLockedTracksIterator syncIter( pProject->GetTracks() );
for ( auto track = syncIter.StartWith( mpTrack.get() ); track != nullptr;
track = syncIter.Next() ) {
@ -280,7 +278,6 @@ void StretchHandle::Stretch(AudacityProject *pProject, int mouseXCoordinate, int
Track *pTrack)
{
ViewInfo &viewInfo = pProject->GetViewInfo();
TrackList *const trackList = pProject->GetTracks();
if (pTrack == NULL && mpTrack != NULL)
pTrack = mpTrack.get();

View File

@ -87,7 +87,7 @@ SoloButtonHandle::~SoloButtonHandle()
}
UIHandle::Result SoloButtonHandle::CommitChanges
(const wxMouseEvent &event, AudacityProject *pProject, wxWindow *pParent)
(const wxMouseEvent &event, AudacityProject *pProject, wxWindow *WXUNUSED(pParent))
{
auto pTrack = mpTrack.lock();
if ( dynamic_cast< PlayableTrack* >( pTrack.get() ) )

View File

@ -47,14 +47,13 @@ void SampleHandle::Enter(bool)
}
HitTestPreview SampleHandle::HitPreview
(const wxMouseState &state, const AudacityProject *pProject, bool unsafe)
(const wxMouseState &state, const AudacityProject *WXUNUSED(pProject), bool unsafe)
{
static auto disabledCursor =
::MakeCursor(wxCURSOR_NO_ENTRY, DisabledCursorXpm, 16, 16);
static wxCursor smoothCursor{ wxCURSOR_SPRAYCAN };
static auto pencilCursor =
::MakeCursor(wxCURSOR_PENCIL, DrawCursorXpm, 12, 22);
const ToolsToolBar *const ttb = pProject->GetToolsToolBar();
// TODO: message should also mention the brush. Describing the modifier key
// (alt, or other) varies with operating system.
@ -72,7 +71,7 @@ HitTestPreview SampleHandle::HitPreview
UIHandlePtr SampleHandle::HitAnywhere
(std::weak_ptr<SampleHandle> &holder,
const wxMouseState &state, const std::shared_ptr<WaveTrack> &pTrack)
const wxMouseState &WXUNUSED(state), const std::shared_ptr<WaveTrack> &pTrack)
{
auto result = std::make_shared<SampleHandle>( pTrack );
result = AssignUIHandlePtr(holder, result);

View File

@ -336,8 +336,6 @@ void FormatMenuTable::OnFormatChange(wxCommandEvent & event)
return; // Nothing to do.
AudacityProject *const project = ::GetActiveProject();
TrackList *const tracks = project->GetTracks();
pTrack->ConvertToSampleFormat(newFormat);
// Assume partner is wave or null
@ -441,7 +439,6 @@ int RateMenuTable::IdOfRate(int rate)
void RateMenuTable::SetRate(WaveTrack * pTrack, double rate)
{
AudacityProject *const project = ::GetActiveProject();
TrackList *const tracks = project->GetTracks();
pTrack->SetRate(rate);
// Assume linked track is wave or null
const auto partner = static_cast<WaveTrack*>(pTrack->GetLink());
@ -1020,7 +1017,7 @@ void WaveTrackMenuTable::OnSplitStereoMono(wxCommandEvent &)
}
//=============================================================================
PopupMenuTable *WaveTrackControls::GetMenuExtension(Track *pTrack)
PopupMenuTable *WaveTrackControls::GetMenuExtension(Track *WXUNUSED(pTrack))
{
return &WaveTrackMenuTable::Instance();
}

View File

@ -65,9 +65,6 @@ void WaveTrackVZoomHandle::DoZoom
bool fixedMousePoint)
{
static const float ZOOMLIMIT = 0.001f;
TrackList *const tracks = pProject->GetTracks();
// Assume linked track is wave or null
const auto partner = static_cast<WaveTrack *>(pTrack->GetLink());
int height = rect.height;

View File

@ -98,7 +98,7 @@ UIHandle::Result ButtonHandle::Release
return result;
}
UIHandle::Result ButtonHandle::Cancel(AudacityProject *pProject)
UIHandle::Result ButtonHandle::Cancel(AudacityProject *WXUNUSED(pProject))
{
using namespace RefreshCode;
return RefreshCell; // perhaps unnecessarily if pointer is out of the box

View File

@ -42,7 +42,7 @@ EnvelopeHandle::~EnvelopeHandle()
{}
UIHandlePtr EnvelopeHandle::HitAnywhere
(std::weak_ptr<EnvelopeHandle> &holder, Envelope *envelope, bool timeTrack)
(std::weak_ptr<EnvelopeHandle> & WXUNUSED(holder), Envelope *envelope, bool timeTrack)
{
auto result = std::make_shared<EnvelopeHandle>( envelope );
result->mTimeTrack = timeTrack;

View File

@ -81,7 +81,6 @@ namespace
wxInt64 trackTopEdge,
int trackHeight)
{
const double rate = wt->GetRate();
const SpectrogramSettings &settings = wt->GetSpectrogramSettings();
float minFreq, maxFreq;
wt->GetSpectrumBounds(&minFreq, &maxFreq);

View File

@ -38,7 +38,7 @@ void TimeShiftHandle::Enter(bool)
}
HitTestPreview TimeShiftHandle::HitPreview
(const AudacityProject *pProject, bool unsafe)
(const AudacityProject *WXUNUSED(pProject), bool unsafe)
{
static auto disabledCursor =
::MakeCursor(wxCURSOR_NO_ENTRY, DisabledCursorXpm, 16, 16);

View File

@ -152,7 +152,7 @@ MenuButtonHandle::~MenuButtonHandle()
}
UIHandle::Result MenuButtonHandle::CommitChanges
(const wxMouseEvent &, AudacityProject *pProject, wxWindow *pParent)
(const wxMouseEvent &, AudacityProject *pProject, wxWindow *WXUNUSED(pParent))
{
auto pPanel = pProject->GetTrackPanel();
auto pCell = mpCell.lock();

View File

@ -37,7 +37,7 @@ std::shared_ptr<Track> TrackControls::FindTrack()
std::vector<UIHandlePtr> TrackControls::HitTest
(const TrackPanelMouseState &st,
const AudacityProject *project)
const AudacityProject *WXUNUSED(project))
{
// Hits are mutually exclusive, results single

View File

@ -86,7 +86,6 @@ UIHandle::Result TrackSelectHandle::Click
const auto pTrack = mpTrack;
if (!pTrack)
return Cancelled;
TrackPanel *const trackPanel = pProject->GetTrackPanel();
const bool unsafe = pProject->IsAudioActive();
// DM: If they weren't clicking on a particular part of a track label,

View File

@ -40,7 +40,7 @@ ZoomHandle::ZoomHandle()
{}
HitTestPreview ZoomHandle::HitPreview
(const wxMouseState &state, const AudacityProject *pProject)
(const wxMouseState &state, const AudacityProject *WXUNUSED(pProject))
{
static auto zoomInCursor =
::MakeCursor(wxCURSOR_MAGNIFIER, ZoomInCursorXpm, 19, 15);

View File

@ -535,8 +535,6 @@ KeyView::RefreshBindings(const wxArrayString & names,
bool bSort
)
{
bool firsttime = mNodes.GetCount() == 0;
// Start clean
mNodes.Clear();

View File

@ -134,11 +134,12 @@ void MeterUpdateQueue::Clear()
// queue was full.
bool MeterUpdateQueue::Put(MeterUpdateMsg &msg)
{
wxASSERT( mEnd >= mStart);
int len = (mEnd + mBufferSize - mStart) % mBufferSize;
// Never completely fill the queue, because then the
// state is ambiguous (mStart==mEnd)
if (len >= mBufferSize-1)
if (len >= (int)(mBufferSize-1))
return false;
//wxLogDebug(wxT("Put: %s"), msg.toString().c_str());
@ -479,7 +480,7 @@ void Meter::OnPaint(wxPaintEvent & WXUNUSED(event))
wxColor red(255, 0, 0);
// Draw the meter bars at maximum levels
for (int i = 0; i < mNumBars; i++)
for (unsigned int i = 0; i < mNumBars; i++)
{
// Give it a recessed look
AColor::Bevel(dc, false, mBar[i].b);
@ -584,7 +585,7 @@ void Meter::OnPaint(wxPaintEvent & WXUNUSED(event))
destDC.DrawBitmap(*mBitmap, 0, 0);
// Go draw the meter bars, Left & Right channels using current levels
for (int i = 0; i < mNumBars; i++)
for (unsigned int i = 0; i < mNumBars; i++)
{
DrawMeterBar(destDC, &mBar[i]);
}
@ -918,7 +919,6 @@ static float ToDB(float v, float range)
void Meter::UpdateDisplay(unsigned numChannels, int numFrames, float *sampleData)
{
int i, j;
float *sptr = sampleData;
auto num = std::min(numChannels, mNumBars);
MeterUpdateMsg msg;
@ -926,8 +926,8 @@ void Meter::UpdateDisplay(unsigned numChannels, int numFrames, float *sampleData
memset(&msg, 0, sizeof(msg));
msg.numFrames = numFrames;
for(i=0; i<numFrames; i++) {
for(j=0; j<num; j++) {
for(int i=0; i<numFrames; i++) {
for(unsigned int j=0; j<num; j++) {
msg.peak[j] = floatMax(msg.peak[j], fabs(sptr[j]));
msg.rms[j] += sptr[j]*sptr[j];
@ -947,7 +947,7 @@ void Meter::UpdateDisplay(unsigned numChannels, int numFrames, float *sampleData
}
sptr += numChannels;
}
for(j=0; j<mNumBars; j++)
for(unsigned int j=0; j<mNumBars; j++)
msg.rms[j] = sqrt(msg.rms[j]/numFrames);
mQueue.Put(msg);
@ -1021,10 +1021,9 @@ void Meter::OnMeterUpdate(wxTimerEvent & WXUNUSED(event))
while(mQueue.Get(msg)) {
numChanges++;
double deltaT = msg.numFrames / mRate;
int j;
mT += deltaT;
for(j=0; j<mNumBars; j++) {
for(unsigned int j=0; j<mNumBars; j++) {
mBar[j].isclipping = false;
//
@ -1097,10 +1096,9 @@ void Meter::OnMeterUpdate(wxTimerEvent & WXUNUSED(event))
float Meter::GetMaxPeak() const
{
int j;
float maxPeak = 0.;
for(j=0; j<mNumBars; j++)
for(unsigned int j=0; j<mNumBars; j++)
maxPeak = mBar[j].peak > maxPeak ? mBar[j].peak : maxPeak;
return(maxPeak);
@ -1534,7 +1532,7 @@ void Meter::RepaintBarsNow()
if (mLayoutValid)
{
// Invalidate the bars so they get redrawn
for (int i = 0; i < mNumBars; i++)
for (unsigned int i = 0; i < mNumBars; i++)
{
Refresh(false);
}
@ -2245,7 +2243,7 @@ wxAccStatus MeterAx::GetName(int WXUNUSED(childId), wxString* name)
float peak = 0.;
bool clipped = false;
for (int i = 0; i < m->mNumBars; i++)
for (unsigned int i = 0; i < m->mNumBars; i++)
{
peak = wxMax(peak, m->mBar[i].peakPeakHold);
if (m->mBar[i].clipping)