mirror of
https://github.com/cookiengineer/audacity
synced 2025-08-01 16:39:30 +02:00
Regularize casts as (int), so they are easier to find and review
This commit is contained in:
parent
8e1b084f01
commit
f993f1eadf
@ -642,7 +642,7 @@ void AColor::PreComputeGradient() {
|
||||
{float(1.00), float(1.00), float(1.00)} // white
|
||||
};
|
||||
|
||||
int left = int (value * gsteps);
|
||||
int left = (int)(value * gsteps);
|
||||
int right = (left == gsteps ? gsteps : left + 1);
|
||||
|
||||
float rweight = (value * gsteps) - left;
|
||||
|
@ -352,7 +352,7 @@ visit our [[http://forum.audacityteam.org/|forum]].");
|
||||
const float fScale = 0.5f;// smaller size.
|
||||
wxImage RescaledImage(logo.ConvertToImage());
|
||||
// wxIMAGE_QUALITY_HIGH not supported by wxWidgets 2.6.1, or we would use it here.
|
||||
RescaledImage.Rescale(int(LOGOWITHNAME_WIDTH * fScale), int(LOGOWITHNAME_HEIGHT *fScale));
|
||||
RescaledImage.Rescale((int)(LOGOWITHNAME_WIDTH * fScale), (int)(LOGOWITHNAME_HEIGHT *fScale));
|
||||
wxBitmap RescaledBitmap(RescaledImage);
|
||||
|
||||
icon =
|
||||
@ -362,7 +362,7 @@ visit our [[http://forum.audacityteam.org/|forum]].");
|
||||
//v theTheme.Bitmap(bmpAudacityLogoWithName),
|
||||
RescaledBitmap,
|
||||
wxDefaultPosition,
|
||||
wxSize(int(LOGOWITHNAME_WIDTH*fScale), int(LOGOWITHNAME_HEIGHT*fScale)));
|
||||
wxSize((int)(LOGOWITHNAME_WIDTH*fScale), (int)(LOGOWITHNAME_HEIGHT*fScale)));
|
||||
}
|
||||
S.Prop(0).AddWindow( icon );
|
||||
|
||||
|
@ -202,7 +202,7 @@ void Envelope::DrawPoints(wxDC & dc, const wxRect & r, const ZoomInfo &zoomInfo,
|
||||
}
|
||||
|
||||
double v = mEnv[i].GetVal();
|
||||
int x = int(position);
|
||||
int x = (int)(position);
|
||||
int y, y2;
|
||||
|
||||
y = GetWaveYPos(v, zoomMin, zoomMax, r.height, dB,
|
||||
@ -361,7 +361,7 @@ bool Envelope::HandleMouseButtonDown(wxMouseEvent & event, wxRect & r,
|
||||
const wxInt64 position = zoomInfo.TimeToPosition(time);
|
||||
if (position >= 0 && position < r.width) {
|
||||
|
||||
int x = int (position);
|
||||
int x = (int)(position);
|
||||
int y[4];
|
||||
int numControlPoints;
|
||||
|
||||
@ -1012,7 +1012,7 @@ 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 < int(mEnv.size()) - 1) {
|
||||
if (mSearchGuess >= 0 && mSearchGuess < (int)(mEnv.size()) - 1) {
|
||||
if (t >= mEnv[mSearchGuess].GetT() &&
|
||||
t < mEnv[1 + mSearchGuess].GetT()) {
|
||||
Lo = mSearchGuess;
|
||||
@ -1022,7 +1022,7 @@ void Envelope::BinarySearchForTime( int &Lo, int &Hi, double t ) const
|
||||
}
|
||||
|
||||
++mSearchGuess;
|
||||
if (mSearchGuess >= 0 && mSearchGuess < int(mEnv.size()) - 1) {
|
||||
if (mSearchGuess >= 0 && mSearchGuess < (int)(mEnv.size()) - 1) {
|
||||
if (t >= mEnv[mSearchGuess].GetT() &&
|
||||
t < mEnv[1 + mSearchGuess].GetT()) {
|
||||
Lo = mSearchGuess;
|
||||
|
@ -942,9 +942,9 @@ bool FFmpegLibs::InitLibs(const wxString &libpath_format, bool WXUNUSED(showerr)
|
||||
avuver,mAVUtilVersion.c_str(), LIBAVUTIL_VERSION_INT,
|
||||
wxString::FromUTF8(AV_STRINGIFY(LIBAVUTIL_VERSION)).c_str());
|
||||
|
||||
int avcverdiff = (avcver >> 16 & 0xFF) - int(LIBAVCODEC_VERSION_MAJOR);
|
||||
int avfverdiff = (avfver >> 16 & 0xFF) - int(LIBAVFORMAT_VERSION_MAJOR);
|
||||
int avuverdiff = (avuver >> 16 & 0xFF) - int(LIBAVUTIL_VERSION_MAJOR);
|
||||
int avcverdiff = (avcver >> 16 & 0xFF) - (int)(LIBAVCODEC_VERSION_MAJOR);
|
||||
int avfverdiff = (avfver >> 16 & 0xFF) - (int)(LIBAVFORMAT_VERSION_MAJOR);
|
||||
int avuverdiff = (avuver >> 16 & 0xFF) - (int)(LIBAVUTIL_VERSION_MAJOR);
|
||||
if (avcverdiff != 0)
|
||||
wxLogError(wxT("AVCodec version mismatch = %d"), avcverdiff);
|
||||
if (avfverdiff != 0)
|
||||
|
@ -755,7 +755,7 @@ void FreqWindow::DrawPlot()
|
||||
|
||||
float ynorm = (y - yMin) / yTotal;
|
||||
|
||||
int lineheight = int (ynorm * (r.height - 1));
|
||||
int lineheight = (int)(ynorm * (r.height - 1));
|
||||
|
||||
if (lineheight > r.height - 2)
|
||||
lineheight = r.height - 2;
|
||||
@ -894,9 +894,9 @@ void FreqWindow::PlotPaint(wxPaintEvent & event)
|
||||
|
||||
int px;
|
||||
if (mLogAxis)
|
||||
px = int (log(bestpeak / xMin) / log(xStep));
|
||||
px = (int)(log(bestpeak / xMin) / log(xStep));
|
||||
else
|
||||
px = int ((bestpeak - xMin) * width / (xMax - xMin));
|
||||
px = (int)((bestpeak - xMin) * width / (xMax - xMin));
|
||||
|
||||
dc.SetPen(wxPen(wxColour(160,160,160), 1, wxSOLID));
|
||||
AColor::Line(dc, r.x + 1 + px, r.y, r.x + 1 + px, r.y + r.height);
|
||||
@ -926,8 +926,8 @@ void FreqWindow::PlotPaint(wxPaintEvent & event)
|
||||
xp = xpitch.c_str();
|
||||
pp = peakpitch.c_str();
|
||||
/* i18n-hint: The %d's are replaced by numbers, the %s by musical notes, e.g. A#*/
|
||||
cursor.Printf(_("%d Hz (%s) = %d dB"), int (xPos + 0.5), xp, int (value + 0.5));
|
||||
peak.Printf(_("%d Hz (%s) = %.1f dB"), int (bestpeak + 0.5), pp, bestValue);
|
||||
cursor.Printf(_("%d Hz (%s) = %d dB"), (int)(xPos + 0.5), xp, (int)(value + 0.5));
|
||||
peak.Printf(_("%d Hz (%s) = %.1f dB"), (int)(bestpeak + 0.5), pp, bestValue);
|
||||
} else if (xPos > 0.0 && bestpeak > 0.0) {
|
||||
xpitch = PitchName_Absolute(FreqToMIDInote(1.0 / xPos));
|
||||
peakpitch = PitchName_Absolute(FreqToMIDInote(1.0 / bestpeak));
|
||||
@ -936,9 +936,9 @@ void FreqWindow::PlotPaint(wxPaintEvent & event)
|
||||
/* i18n-hint: The %d's are replaced by numbers, the %s by musical notes, e.g. A#
|
||||
* the %.4f are numbers, and 'sec' should be an abbreviation for seconds */
|
||||
cursor.Printf(_("%.4f sec (%d Hz) (%s) = %f"),
|
||||
xPos, int (1.0 / xPos + 0.5), xp, value);
|
||||
xPos, (int)(1.0 / xPos + 0.5), xp, value);
|
||||
peak.Printf(_("%.4f sec (%d Hz) (%s) = %.3f"),
|
||||
bestpeak, int (1.0 / bestpeak + 0.5), pp, bestValue);
|
||||
bestpeak, (int)(1.0 / bestpeak + 0.5), pp, bestValue);
|
||||
}
|
||||
mCursorText->SetValue(cursor);
|
||||
mPeakText->SetValue(peak);
|
||||
@ -1447,7 +1447,7 @@ float SpectrumAnalyst::GetProcessedValue(float freq0, float freq1) const
|
||||
|
||||
if (binwidth < 1.0) {
|
||||
float binmid = (bin0 + bin1) / 2.0;
|
||||
int ibin = int (binmid) - 1;
|
||||
int ibin = (int)(binmid) - 1;
|
||||
if (ibin < 1)
|
||||
ibin = 1;
|
||||
if (ibin >= GetProcessedSize() - 3)
|
||||
@ -1464,14 +1464,14 @@ float SpectrumAnalyst::GetProcessedValue(float freq0, float freq1) const
|
||||
if (bin1 >= GetProcessedSize())
|
||||
bin1 = GetProcessedSize() - 1;
|
||||
|
||||
if (int (bin1) > int (bin0))
|
||||
value += mProcessed[int (bin0)] * (int (bin0) + 1 - bin0);
|
||||
bin0 = 1 + int (bin0);
|
||||
while (bin0 < int (bin1)) {
|
||||
value += mProcessed[int (bin0)];
|
||||
if ((int)(bin1) > (int)(bin0))
|
||||
value += mProcessed[(int)(bin0)] * ((int)(bin0) + 1 - bin0);
|
||||
bin0 = 1 + (int)(bin0);
|
||||
while (bin0 < (int)(bin1)) {
|
||||
value += mProcessed[(int)(bin0)];
|
||||
bin0 += 1.0;
|
||||
}
|
||||
value += mProcessed[int (bin1)] * (bin1 - int (bin1));
|
||||
value += mProcessed[(int)(bin1)] * (bin1 - (int)(bin1));
|
||||
|
||||
value /= binwidth;
|
||||
}
|
||||
|
@ -6189,7 +6189,7 @@ class ASAProgress final : public SAProgress {
|
||||
work = (is_audio[0] ? AUDIO_WORK_UNIT : MIDI_WORK_UNIT) * mFrames[0] +
|
||||
(is_audio[1] ? AUDIO_WORK_UNIT : MIDI_WORK_UNIT) * f;
|
||||
}
|
||||
int updateResult = mProgress->Update(int(work), int(mTotalWork));
|
||||
int updateResult = mProgress->Update((int)(work), (int)(mTotalWork));
|
||||
return (updateResult == eProgressSuccess);
|
||||
}
|
||||
bool set_matrix_progress(int cells) override {
|
||||
@ -6198,7 +6198,7 @@ class ASAProgress final : public SAProgress {
|
||||
(is_audio[0] ? AUDIO_WORK_UNIT : MIDI_WORK_UNIT) * mFrames[0] +
|
||||
(is_audio[1] ? AUDIO_WORK_UNIT : MIDI_WORK_UNIT) * mFrames[1];
|
||||
work += mCellCount * MATRIX_WORK_UNIT;
|
||||
int updateResult = mProgress->Update(int(work), int(mTotalWork));
|
||||
int updateResult = mProgress->Update((int)(work), (int)(mTotalWork));
|
||||
return (updateResult == eProgressSuccess);
|
||||
}
|
||||
bool set_smoothing_progress(int i) override {
|
||||
@ -6208,7 +6208,7 @@ class ASAProgress final : public SAProgress {
|
||||
(is_audio[1] ? AUDIO_WORK_UNIT : MIDI_WORK_UNIT) * mFrames[1] +
|
||||
MATRIX_WORK_UNIT * mFrames[0] * mFrames[1];
|
||||
work += i * wxMax(mFrames[0], mFrames[1]) * SMOOTHING_WORK_UNIT;
|
||||
int updateResult = mProgress->Update(int(work), int(mTotalWork));
|
||||
int updateResult = mProgress->Update((int)(work), (int)(mTotalWork));
|
||||
return (updateResult == eProgressSuccess);
|
||||
}
|
||||
};
|
||||
@ -7069,7 +7069,7 @@ void AudacityProject::SeekLeftOrRight
|
||||
? GridMove(t1, multiplier)
|
||||
: quietStepIsPixels
|
||||
? mViewInfo.OffsetTimeByPixels(
|
||||
t1, int(multiplier * quietSeekStepPositive))
|
||||
t1, (int)(multiplier * quietSeekStepPositive))
|
||||
: t1 + multiplier * quietSeekStepPositive
|
||||
));
|
||||
|
||||
@ -7084,7 +7084,7 @@ void AudacityProject::SeekLeftOrRight
|
||||
? GridMove(t0, multiplier)
|
||||
: quietStepIsPixels
|
||||
? mViewInfo.OffsetTimeByPixels(
|
||||
t0, int(multiplier * quietSeekStepPositive))
|
||||
t0, (int)(multiplier * quietSeekStepPositive))
|
||||
: t0 + multiplier * quietSeekStepPositive
|
||||
));
|
||||
|
||||
@ -7114,7 +7114,7 @@ void AudacityProject::SeekLeftOrRight
|
||||
if (audioStepIsPixels) {
|
||||
const double streamTime = gAudioIO->GetStreamTime();
|
||||
const double newTime =
|
||||
mViewInfo.OffsetTimeByPixels(streamTime, int(audioSeekStepPositive));
|
||||
mViewInfo.OffsetTimeByPixels(streamTime, (int)(audioSeekStepPositive));
|
||||
seconds = newTime - streamTime;
|
||||
}
|
||||
else
|
||||
@ -7136,7 +7136,7 @@ void AudacityProject::SeekLeftOrRight
|
||||
? GridMove(t0, multiplier)
|
||||
: quietStepIsPixels
|
||||
? mViewInfo.OffsetTimeByPixels(
|
||||
t0, int(multiplier * quietSeekStepPositive))
|
||||
t0, (int)(multiplier * quietSeekStepPositive))
|
||||
: t0 + multiplier * quietSeekStepPositive
|
||||
));
|
||||
|
||||
@ -7152,7 +7152,7 @@ void AudacityProject::SeekLeftOrRight
|
||||
? GridMove(t1, multiplier)
|
||||
: quietStepIsPixels
|
||||
? mViewInfo.OffsetTimeByPixels(
|
||||
t1, int(multiplier * quietSeekStepPositive))
|
||||
t1, (int)(multiplier * quietSeekStepPositive))
|
||||
: t1 + multiplier * quietSeekStepPositive
|
||||
));
|
||||
|
||||
@ -7179,7 +7179,7 @@ void AudacityProject::SeekLeftOrRight
|
||||
? GridMove(t0, multiplier)
|
||||
: quietStepIsPixels
|
||||
? mViewInfo.OffsetTimeByPixels(
|
||||
t0, int(multiplier * quietSeekStepPositive))
|
||||
t0, (int)(multiplier * quietSeekStepPositive))
|
||||
: t0 + multiplier * quietSeekStepPositive)),
|
||||
false // do not swap selection boundaries
|
||||
);
|
||||
|
@ -686,7 +686,7 @@ Alg_seq *NoteTrack::MakeExportableSeq(std::unique_ptr<Alg_seq> &cleanup)
|
||||
double measures = beat / 4.0;
|
||||
double imeasures = ROUND(measures);
|
||||
if (!within(measures, imeasures, ALG_EPS)) {
|
||||
double bar_offset = (int(measures) + 1) * 4.0 - beat;
|
||||
double bar_offset = ((int)(measures) + 1) * 4.0 - beat;
|
||||
seq->set_time_sig(bar_offset, 4, 4);
|
||||
}
|
||||
// This case should never be true because if i == 0, either there
|
||||
@ -705,7 +705,7 @@ Alg_seq *NoteTrack::MakeExportableSeq(std::unique_ptr<Alg_seq> &cleanup)
|
||||
// beat is not on a measure, so we need to insert a time sig
|
||||
// to force a bar line at the first measure location after
|
||||
// beat
|
||||
double bar = tsp->beat + beats_per_measure * (int(measures) + 1);
|
||||
double bar = tsp->beat + beats_per_measure * ((int)(measures) + 1);
|
||||
double bar_offset = bar - beat;
|
||||
// insert NEW time signature at bar_offset in NEW sequence
|
||||
// It will have the same time signature, but the position will
|
||||
|
@ -1734,7 +1734,7 @@ void AudacityProject::SetHorizontalThumb(double scrollto)
|
||||
const int pos =
|
||||
std::min(max,
|
||||
std::max(0,
|
||||
int(floor(0.5 + unscaled * mViewInfo.sbarScale))));
|
||||
(int)(floor(0.5 + unscaled * mViewInfo.sbarScale))));
|
||||
mHsbar->SetThumbPosition(pos);
|
||||
mViewInfo.sbarH = floor(0.5 + unscaled - PixelWidthBeforeTime(0.0));
|
||||
mViewInfo.sbarH = std::max(mViewInfo.sbarH,
|
||||
@ -1915,7 +1915,7 @@ void AudacityProject::FixScrollbars()
|
||||
int scaledSbarScreen = (int)(mViewInfo.sbarScreen * mViewInfo.sbarScale);
|
||||
int scaledSbarTotal = (int)(mViewInfo.sbarTotal * mViewInfo.sbarScale);
|
||||
const int offset =
|
||||
int(floor(0.5 + mViewInfo.sbarScale * PixelWidthBeforeTime(0.0)));
|
||||
(int)(floor(0.5 + mViewInfo.sbarScale * PixelWidthBeforeTime(0.0)));
|
||||
|
||||
mHsbar->SetScrollbar(scaledSbarH + offset, scaledSbarScreen, scaledSbarTotal,
|
||||
scaledSbarScreen, TRUE);
|
||||
@ -4857,7 +4857,7 @@ void AudacityProject::EditClipboardByLabel( EditDestFunction action )
|
||||
{
|
||||
WaveTrack *wt = ( WaveTrack* )n;
|
||||
Track::Holder merged;
|
||||
for( int i = ( int )regions.size() - 1; i >= 0; i-- )
|
||||
for( int i = (int)regions.size() - 1; i >= 0; i-- )
|
||||
{
|
||||
const Region ®ion = regions.at(i);
|
||||
auto dest = ( wt->*action )( region.start, region.end );
|
||||
|
@ -91,14 +91,14 @@ void SplashDialog::Populate( ShuttleGui & S )
|
||||
const float fScale=0.5f;// smaller size.
|
||||
wxImage RescaledImage( m_pLogo->ConvertToImage() );
|
||||
// wxIMAGE_QUALITY_HIGH not supported by wxWidgets 2.6.1, or we would use it here.
|
||||
RescaledImage.Rescale( int(LOGOWITHNAME_WIDTH * fScale), int(LOGOWITHNAME_HEIGHT *fScale) );
|
||||
RescaledImage.Rescale( (int)(LOGOWITHNAME_WIDTH * fScale), (int)(LOGOWITHNAME_HEIGHT *fScale) );
|
||||
wxBitmap RescaledBitmap( RescaledImage );
|
||||
wxStaticBitmap *const icon =
|
||||
safenew wxStaticBitmap(S.GetParent(), -1,
|
||||
//*m_pLogo, //v theTheme.Bitmap(bmpAudacityLogoWithName),
|
||||
RescaledBitmap,
|
||||
wxDefaultPosition,
|
||||
wxSize(int(LOGOWITHNAME_WIDTH*fScale), int(LOGOWITHNAME_HEIGHT*fScale)));
|
||||
wxSize((int)(LOGOWITHNAME_WIDTH*fScale), (int)(LOGOWITHNAME_HEIGHT*fScale)));
|
||||
|
||||
S.Prop(0).AddWindow( icon );
|
||||
|
||||
|
@ -865,7 +865,7 @@ void TrackArtist::UpdateVRuler(const Track *t, wxRect & rect)
|
||||
}
|
||||
else {
|
||||
// use Hz
|
||||
vruler->SetRange(int(maxFreq), int(minFreq));
|
||||
vruler->SetRange((int)(maxFreq), (int)(minFreq));
|
||||
vruler->SetUnits(wxT(""));
|
||||
}
|
||||
vruler->SetLog(false);
|
||||
@ -1127,8 +1127,8 @@ void TrackArtist::DrawWaveformBackground(wxDC &dc, int leftOffset, const wxRect
|
||||
|
||||
// If sync-lock selected, draw in linked graphics.
|
||||
if (bIsSyncLockSelected && t0 < t1) {
|
||||
const int begin = std::max(0, std::min(rect.width, int(zoomInfo.TimeToPosition(t0, -leftOffset))));
|
||||
const int end = std::max(0, std::min(rect.width, int(zoomInfo.TimeToPosition(t1, -leftOffset))));
|
||||
const int begin = std::max(0, std::min(rect.width, (int)(zoomInfo.TimeToPosition(t0, -leftOffset))));
|
||||
const int end = std::max(0, std::min(rect.width, (int)(zoomInfo.TimeToPosition(t1, -leftOffset))));
|
||||
DrawSyncLockTiles(&dc, wxRect(rect.x + begin, rect.y, end - 1 - begin, rect.height));
|
||||
}
|
||||
|
||||
@ -1347,7 +1347,7 @@ void TrackArtist::DrawIndividualSamples(wxDC &dc, int leftOffset, const wxRect &
|
||||
const double time = toffset + (s + s0).as_double() / rate;
|
||||
const int xx = // An offset into the rectangle rect
|
||||
std::max(-10000, std::min(10000,
|
||||
int(zoomInfo.TimeToPosition(time, -leftOffset))));
|
||||
(int)(zoomInfo.TimeToPosition(time, -leftOffset))));
|
||||
xpos[s] = xx;
|
||||
|
||||
const double tt = buffer[s] * clip->GetEnvelope()->GetValue(time);
|
||||
@ -1711,7 +1711,7 @@ void FindWavePortions
|
||||
prev = it++;
|
||||
if (it == end)
|
||||
break;
|
||||
const int right = std::max(left, int(it->position));
|
||||
const int right = std::max(left, (int)(it->position));
|
||||
const int width = right - left;
|
||||
if (width > 0)
|
||||
portions.push_back(
|
||||
@ -2029,23 +2029,23 @@ static inline float findValue
|
||||
|
||||
#if 0
|
||||
// Averaging method
|
||||
if (int(bin1) == int(bin0)) {
|
||||
value = spectrum[int(bin0)];
|
||||
if ((int)(bin1) == (int)(bin0)) {
|
||||
value = spectrum[(int)(bin0)];
|
||||
} else {
|
||||
float binwidth= bin1 - bin0;
|
||||
value = spectrum[int(bin0)] * (1.f - bin0 + (int)bin0);
|
||||
value = spectrum[(int)(bin0)] * (1.f - bin0 + (int)bin0);
|
||||
|
||||
bin0 = 1 + int (bin0);
|
||||
while (bin0 < int(bin1)) {
|
||||
value += spectrum[int(bin0)];
|
||||
bin0 = 1 + (int)(bin0);
|
||||
while (bin0 < (int)(bin1)) {
|
||||
value += spectrum[(int)(bin0)];
|
||||
bin0 += 1.0;
|
||||
}
|
||||
// Do not reference past end of freq array.
|
||||
if (int(bin1) >= (int)half) {
|
||||
if ((int)(bin1) >= (int)half) {
|
||||
bin1 -= 1.0;
|
||||
}
|
||||
|
||||
value += spectrum[int(bin1)] * (bin1 - int(bin1));
|
||||
value += spectrum[(int)(bin1)] * (bin1 - (int)(bin1));
|
||||
value /= binwidth;
|
||||
}
|
||||
#else
|
||||
@ -2063,8 +2063,8 @@ static inline float findValue
|
||||
));
|
||||
}
|
||||
else {
|
||||
index = std::min<int>(half - 1, int(floor(0.5 + bin0)));
|
||||
limitIndex = std::min<int>(half, int(floor(0.5 + bin1)));
|
||||
index = std::min<int>(half - 1, (int)(floor(0.5 + bin0)));
|
||||
limitIndex = std::min<int>(half, (int)(floor(0.5 + bin1)));
|
||||
}
|
||||
value = spectrum[index];
|
||||
while (++index < limitIndex)
|
||||
@ -2307,9 +2307,9 @@ void TrackArtist::DrawClipSpectrum(WaveTrackCache &waveTrackCache,
|
||||
indexes[i] = -1;
|
||||
|
||||
// Build a table of (most) values, put the index in it.
|
||||
for (int i = int(i0); i < int(i1); i++) {
|
||||
float freqi = freq[x0 + int(i)];
|
||||
int value = int((freqi + gain + range) / range*(maxTableSize - 1));
|
||||
for (int i = (int)(i0); i < (int)(i1); i++) {
|
||||
float freqi = freq[x0 + (int)(i)];
|
||||
int value = (int)((freqi + gain + range) / range*(maxTableSize - 1));
|
||||
if (value < 0)
|
||||
value = 0;
|
||||
if (value >= maxTableSize)
|
||||
@ -2350,7 +2350,7 @@ void TrackArtist::DrawClipSpectrum(WaveTrackCache &waveTrackCache,
|
||||
float f = float(index)*bin2f;
|
||||
if (findNotesQuantize)
|
||||
{
|
||||
f = expf(int(log(f / 440) / log2 * 12 - 0.5) / 12.0f*log2) * 440;
|
||||
f = expf((int)(log(f / 440) / log2 * 12 - 0.5) / 12.0f*log2) * 440;
|
||||
maxima[i] = f*f2bin;
|
||||
}
|
||||
float f0 = expf((log(f / 440) / log2 * 24 - 1) / 24.0f*log2) * 440;
|
||||
@ -2414,10 +2414,10 @@ void TrackArtist::DrawClipSpectrum(WaveTrackCache &waveTrackCache,
|
||||
const bool hidden = (ZoomInfo::HIDDEN == zoomInfo.GetFisheyeState());
|
||||
const int begin = hidden
|
||||
? 0
|
||||
: std::max(0, int(zoomInfo.GetFisheyeLeftBoundary(-leftOffset)));
|
||||
: std::max(0, (int)(zoomInfo.GetFisheyeLeftBoundary(-leftOffset)));
|
||||
const int end = hidden
|
||||
? 0
|
||||
: std::min(mid.width, int(zoomInfo.GetFisheyeRightBoundary(-leftOffset)));
|
||||
: std::min(mid.width, (int)(zoomInfo.GetFisheyeRightBoundary(-leftOffset)));
|
||||
const size_t numPixels = std::max(0, end - begin);
|
||||
const size_t zeroPaddingFactor = autocorrelation ? 1 : settings.ZeroPaddingFactor();
|
||||
SpecCache specCache
|
||||
@ -2688,7 +2688,7 @@ const char *LookupAtomAttribute(Alg_note_ptr note, Alg_attribute attr, char *def
|
||||
#define GREEN(i) ( unsigned char )( (((i) >> 8) & 0xff) )
|
||||
#define BLUE(i) ( unsigned char )( ((i) & 0xff) )
|
||||
|
||||
//#define PITCH_TO_Y(p) (rect.y + rect.height - int(pitchht * ((p) + 0.5 - pitch0) + 0.5))
|
||||
//#define PITCH_TO_Y(p) (rect.y + rect.height - (int)(pitchht * ((p) + 0.5 - pitch0) + 0.5))
|
||||
|
||||
/*
|
||||
int PitchToY(double p, int bottom)
|
||||
@ -3032,11 +3032,11 @@ void TrackArtist::DrawNoteTrack(const NoteTrack *track,
|
||||
// extreme zooms caues problems under windows, so we have to do some
|
||||
// clipping before calling display routine
|
||||
if (xx < h) { // clip line on left
|
||||
yy = int((yy + (y1 - yy) * (h - xx) / (x1 - xx)) + 0.5);
|
||||
yy = (int)((yy + (y1 - yy) * (h - xx) / (x1 - xx)) + 0.5);
|
||||
xx = h;
|
||||
}
|
||||
if (x1 > h1) { // clip line on right
|
||||
y1 = int((yy + (y1 - yy) * (h1 - xx) / (x1 - xx)) + 0.5);
|
||||
y1 = (int)((yy + (y1 - yy) * (h1 - xx) / (x1 - xx)) + 0.5);
|
||||
x1 = h1;
|
||||
}
|
||||
AColor::Line(dc, TIME_TO_X(xx), yy, TIME_TO_X(x1), y1);
|
||||
@ -3352,7 +3352,7 @@ void TrackArtist::DrawBackgroundWithSelection(wxDC *dc, const wxRect &rect,
|
||||
wxRect within = rect;
|
||||
wxRect after = rect;
|
||||
|
||||
before.width = int(zoomInfo.TimeToPosition(sel0) + 2);
|
||||
before.width = (int)(zoomInfo.TimeToPosition(sel0) + 2);
|
||||
if (before.GetRight() > rect.GetRight()) {
|
||||
before.width = rect.width;
|
||||
}
|
||||
@ -3363,7 +3363,7 @@ void TrackArtist::DrawBackgroundWithSelection(wxDC *dc, const wxRect &rect,
|
||||
|
||||
within.x = 1 + before.GetRight();
|
||||
}
|
||||
within.width = rect.x + int(zoomInfo.TimeToPosition(sel1) + 2) - within.x;
|
||||
within.width = rect.x + (int)(zoomInfo.TimeToPosition(sel1) + 2) - within.x;
|
||||
|
||||
if (within.GetRight() > rect.GetRight()) {
|
||||
within.width = 1 + rect.GetRight() - within.x;
|
||||
|
@ -2990,13 +2990,13 @@ bool mayDragWidth, bool onlyWithinSnapDistance,
|
||||
const wxInt64 topSel = (f1 >= 0)
|
||||
? FrequencyToPosition(wt, f1, rect.y, rect.height)
|
||||
: rect.y;
|
||||
wxInt64 signedBottomDist = int(event.m_y - bottomSel);
|
||||
wxInt64 signedBottomDist = (int)(event.m_y - bottomSel);
|
||||
wxInt64 verticalDist = std::abs(signedBottomDist);
|
||||
if (bottomSel == topSel)
|
||||
// Top and bottom are too close to resolve on screen
|
||||
chooseBottom = (signedBottomDist >= 0);
|
||||
else {
|
||||
const wxInt64 topDist = abs(int(event.m_y - topSel));
|
||||
const wxInt64 topDist = abs((int)(event.m_y - topSel));
|
||||
if (topDist < verticalDist)
|
||||
chooseBottom = false, verticalDist = topDist;
|
||||
}
|
||||
@ -3007,7 +3007,7 @@ bool mayDragWidth, bool onlyWithinSnapDistance,
|
||||
) {
|
||||
const wxInt64 centerSel =
|
||||
FrequencyToPosition(wt, fc, rect.y, rect.height);
|
||||
const wxInt64 centerDist = abs(int(event.m_y - centerSel));
|
||||
const wxInt64 centerDist = abs((int)(event.m_y - centerSel));
|
||||
if (centerDist < verticalDist)
|
||||
chooseCenter = true, verticalDist = centerDist,
|
||||
ratio = f1 / fc;
|
||||
@ -6309,7 +6309,7 @@ bool TrackPanel::IsOverCutline(WaveTrack * track, wxRect &rect, const wxMouseEve
|
||||
if (x >= 0 && x < rect.width)
|
||||
{
|
||||
wxRect locRect;
|
||||
locRect.x = int(rect.x + x) - 5;
|
||||
locRect.x = (int)(rect.x + x) - 5;
|
||||
locRect.width = 11;
|
||||
locRect.y = rect.y;
|
||||
locRect.height = rect.height;
|
||||
@ -7747,13 +7747,13 @@ void TrackPanel::OnVRulerMenu(Track *t, wxMouseEvent *pEvent)
|
||||
if (display == WaveTrack::Waveform) {
|
||||
theMenu = mRulerWaveformMenu.get();
|
||||
const int id =
|
||||
OnFirstWaveformScaleID + int(wt->GetWaveformSettings().scaleType);
|
||||
OnFirstWaveformScaleID + (int)(wt->GetWaveformSettings().scaleType);
|
||||
theMenu->Check(id, true);
|
||||
}
|
||||
else {
|
||||
theMenu = mRulerSpectrumMenu.get();
|
||||
const int id =
|
||||
OnFirstSpectrumScaleID + int(wt->GetSpectrogramSettings().scaleType);
|
||||
OnFirstSpectrumScaleID + (int)(wt->GetSpectrogramSettings().scaleType);
|
||||
theMenu->Check(id, true);
|
||||
}
|
||||
|
||||
@ -8525,7 +8525,7 @@ void TrackPanel::OnWaveformScaleType(wxCommandEvent &evt)
|
||||
const WaveformSettings::ScaleType newScaleType =
|
||||
WaveformSettings::ScaleType(
|
||||
std::max(0,
|
||||
std::min(int(WaveformSettings::stNumScaleTypes) - 1,
|
||||
std::min((int)(WaveformSettings::stNumScaleTypes) - 1,
|
||||
evt.GetId() - OnFirstWaveformScaleID
|
||||
)));
|
||||
if (wt->GetWaveformSettings().scaleType != newScaleType) {
|
||||
@ -8547,7 +8547,7 @@ void TrackPanel::OnSpectrumScaleType(wxCommandEvent &evt)
|
||||
const SpectrogramSettings::ScaleType newScaleType =
|
||||
SpectrogramSettings::ScaleType(
|
||||
std::max(0,
|
||||
std::min(int(SpectrogramSettings::stNumScaleTypes) - 1,
|
||||
std::min((int)(SpectrogramSettings::stNumScaleTypes) - 1,
|
||||
evt.GetId() - OnFirstSpectrumScaleID
|
||||
)));
|
||||
if (wt->GetSpectrogramSettings().scaleType != newScaleType) {
|
||||
|
@ -288,7 +288,7 @@ const UndoState &UndoManager::SetStateTo
|
||||
|
||||
current = n;
|
||||
|
||||
if (current == int(stack.size()-1)) {
|
||||
if (current == (int)(stack.size()-1)) {
|
||||
*selectedRegion = stack[current]->state.selectedRegion;
|
||||
}
|
||||
else {
|
||||
|
@ -177,7 +177,7 @@ bool ViewInfo::ReadXMLAttribute(const wxChar *attr, const wxChar *value)
|
||||
if (!wxStrcmp(attr, wxT("vpos"))) {
|
||||
long longVpos;
|
||||
wxString(value).ToLong(&longVpos);
|
||||
vpos = int(longVpos);
|
||||
vpos = (int)(longVpos);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -923,7 +923,7 @@ bool SpecCache::CalculateOneSpectrum
|
||||
freqCorrection = multiplier * quotIm;
|
||||
}
|
||||
|
||||
const int bin = int(ii + freqCorrection + 0.5f);
|
||||
const int bin = (int)(ii + freqCorrection + 0.5f);
|
||||
if (bin >= 0 && bin < hFFT->Points) {
|
||||
double timeCorrection;
|
||||
{
|
||||
@ -1058,7 +1058,7 @@ void SpecCache::Populate
|
||||
// I'm not sure what's a good stopping criterion?
|
||||
auto xx = lowerBoundX;
|
||||
const double pixelsPerSample = pixelsPerSecond / rate;
|
||||
const int limit = std::min(int(0.5 + fftLen * pixelsPerSample), 100);
|
||||
const int limit = std::min((int)(0.5 + fftLen * pixelsPerSample), 100);
|
||||
for (int ii = 0; ii < limit; ++ii)
|
||||
{
|
||||
const bool result =
|
||||
|
@ -210,7 +210,7 @@ WaveTrack::WaveTrackDisplay WaveTrack::FindDefaultViewMode()
|
||||
if (viewMode < 0) {
|
||||
int oldMode;
|
||||
gPrefs->Read(wxT("/GUI/DefaultViewMode"), &oldMode,
|
||||
int(WaveTrack::Waveform));
|
||||
(int)(WaveTrack::Waveform));
|
||||
viewMode = WaveTrack::ConvertLegacyDisplayValue(oldMode);
|
||||
}
|
||||
|
||||
|
@ -736,7 +736,7 @@ EffectNoiseReduction::Worker::Worker
|
||||
|
||||
, mSpectrumSize(1 + mWindowSize / 2)
|
||||
, mFreqSmoothingScratch(mSpectrumSize)
|
||||
, mFreqSmoothingBins(int(settings.mFreqSmoothingBands))
|
||||
, mFreqSmoothingBins((int)(settings.mFreqSmoothingBands))
|
||||
, mBinLow(0)
|
||||
, mBinHigh(mSpectrumSize)
|
||||
|
||||
@ -1415,7 +1415,7 @@ struct ControlInfo {
|
||||
wxString Text(double value) const
|
||||
{
|
||||
if (formatAsInt)
|
||||
return wxString::Format(format, int(value));
|
||||
return wxString::Format(format, (int)(value));
|
||||
else
|
||||
return wxString::Format(format, value);
|
||||
}
|
||||
|
@ -329,7 +329,7 @@ bool VampEffect::SetAutomationParameters(EffectAutomationParameters & parms)
|
||||
|
||||
if (qs != 0.0)
|
||||
{
|
||||
val = int((val - lower) / qs + 0.5) * qs + lower;
|
||||
val = (int)((val - lower) / qs + 0.5) * qs + lower;
|
||||
}
|
||||
}
|
||||
|
||||
@ -844,7 +844,7 @@ void VampEffect::UpdateFromPlugin()
|
||||
|
||||
if (qs != 0.0)
|
||||
{
|
||||
value = int((value - lower) / qs + 0.5) * qs + lower;
|
||||
value = (int)((value - lower) / qs + 0.5) * qs + lower;
|
||||
}
|
||||
}
|
||||
|
||||
@ -891,7 +891,7 @@ void VampEffect::OnSlider(wxCommandEvent & evt)
|
||||
|
||||
if (qs != 0.0)
|
||||
{
|
||||
val = int(val / qs + 0.5) * qs;
|
||||
val = (int)(val / qs + 0.5) * qs;
|
||||
}
|
||||
}
|
||||
|
||||
@ -920,7 +920,7 @@ void VampEffect::OnTextCtrl(wxCommandEvent & evt)
|
||||
|
||||
if (qs != 0.0)
|
||||
{
|
||||
val = int((val - lower) / qs + 0.5) * qs + lower;
|
||||
val = (int)((val - lower) / qs + 0.5) * qs + lower;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1087,9 +1087,9 @@ void ExportMixerPanel::OnPaint(wxPaintEvent & WXUNUSED(event))
|
||||
|
||||
for( int i = 0; i < mMixerSpec->GetNumTracks(); i++ )
|
||||
{
|
||||
mTrackRects[ i ].x = ( int )( mBoxWidth * 2 + radius - radius *
|
||||
mTrackRects[ i ].x = (int)( mBoxWidth * 2 + radius - radius *
|
||||
cos( totAngle / 2.0 - angle * ( i + 1 ) ) - mBoxWidth + 0.5 );
|
||||
mTrackRects[ i ].y = ( int )( mHeight * 0.5 - radius *
|
||||
mTrackRects[ i ].y = (int)( mHeight * 0.5 - radius *
|
||||
sin( totAngle * 0.5 - angle * ( i + 1.0 ) ) -
|
||||
0.5 * mTrackHeight + 0.5 );
|
||||
|
||||
@ -1115,9 +1115,9 @@ void ExportMixerPanel::OnPaint(wxPaintEvent & WXUNUSED(event))
|
||||
|
||||
for( int i = 0; i < mMixerSpec->GetNumChannels(); i++ )
|
||||
{
|
||||
mChannelRects[ i ].x = ( int )( mBoxWidth * 4 - radius + radius *
|
||||
mChannelRects[ i ].x = (int)( mBoxWidth * 4 - radius + radius *
|
||||
cos( totAngle * 0.5 - angle * ( i + 1 ) ) + 0.5 );
|
||||
mChannelRects[ i ].y = ( int )( mHeight * 0.5 - radius *
|
||||
mChannelRects[ i ].y = (int)( mHeight * 0.5 - radius *
|
||||
sin( totAngle * 0.5 - angle * ( i + 1 ) ) -
|
||||
0.5 * mChannelHeight + 0.5 );
|
||||
|
||||
|
@ -195,7 +195,7 @@ int ExportOGG::Export(AudacityProject *project,
|
||||
|
||||
// Encoding setup
|
||||
vorbis_info_init(&info);
|
||||
vorbis_encode_init_vbr(&info, numChannels, int(rate + 0.5), quality);
|
||||
vorbis_encode_init_vbr(&info, numChannels, (int)(rate + 0.5), quality);
|
||||
|
||||
// Retrieve tags
|
||||
if (!FillComment(project, &comment, metadata)) {
|
||||
|
@ -237,10 +237,10 @@ bool SpectrogramSettings::Validate(bool quiet)
|
||||
std::max(0, std::min(NumWindowFuncs() - 1, windowType));
|
||||
scaleType =
|
||||
ScaleType(std::max(0,
|
||||
std::min(int(SpectrogramSettings::stNumScaleTypes) - 1,
|
||||
int(scaleType))));
|
||||
std::min((int)(SpectrogramSettings::stNumScaleTypes) - 1,
|
||||
(int)(scaleType))));
|
||||
algorithm = Algorithm(
|
||||
std::max(0, std::min(int(algNumAlgorithms) - 1, int(algorithm)))
|
||||
std::max(0, std::min((int)(algNumAlgorithms) - 1, (int)(algorithm)))
|
||||
);
|
||||
ConvertToEnumeratedWindowSizes();
|
||||
ConvertToActualWindowSizes();
|
||||
|
@ -81,10 +81,10 @@ void TracksPrefs::Populate()
|
||||
// we don't display them by increasing integer values.
|
||||
|
||||
mViewChoices.Add(_("Waveform"));
|
||||
mViewCodes.Add(int(WaveTrack::Waveform));
|
||||
mViewCodes.Add((int)(WaveTrack::Waveform));
|
||||
|
||||
mViewChoices.Add(_("Waveform (dB)"));
|
||||
mViewCodes.Add(int(WaveTrack::obsoleteWaveformDBDisplay));
|
||||
mViewCodes.Add((int)(WaveTrack::obsoleteWaveformDBDisplay));
|
||||
|
||||
mViewChoices.Add(_("Spectrogram"));
|
||||
mViewCodes.Add(WaveTrack::Spectrum);
|
||||
|
@ -73,7 +73,7 @@ WaveformSettings& WaveformSettings::defaults()
|
||||
bool WaveformSettings::Validate(bool /* quiet */)
|
||||
{
|
||||
scaleType = ScaleType(
|
||||
std::max(0, std::min(int(stNumScaleTypes) - 1, int(scaleType)))
|
||||
std::max(0, std::min((int)(stNumScaleTypes) - 1, (int)(scaleType)))
|
||||
);
|
||||
|
||||
ConvertToEnumeratedDBRange();
|
||||
@ -125,9 +125,9 @@ void WaveformSettings::ConvertToActualDBRange()
|
||||
wxArrayString codes;
|
||||
GUIPrefs::GetRangeChoices(NULL, &codes);
|
||||
long value = 0;
|
||||
codes[std::max(0, std::min(int(codes.size()) - 1, dBRange))]
|
||||
codes[std::max(0, std::min((int)(codes.size()) - 1, dBRange))]
|
||||
.ToLong(&value);
|
||||
dBRange = int(value);
|
||||
dBRange = (int)(value);
|
||||
}
|
||||
|
||||
void WaveformSettings::NextLowerDBRange()
|
||||
|
@ -891,7 +891,7 @@ void NumericConverter::ControlsToValue()
|
||||
|
||||
t /= mScalingFactor;
|
||||
if(mNtscDrop) {
|
||||
int t_int = int(t + .000000001);
|
||||
int t_int = (int)(t + .000000001);
|
||||
double t_frac = (t - t_int);
|
||||
int tenMins = t_int/600;
|
||||
double frames = tenMins*17982;
|
||||
|
@ -1114,7 +1114,7 @@ void Ruler::Update(const TimeTrack* timetrack)// Envelope *speedEnv, long minSpe
|
||||
if (mMin * mMax < 0.0) {
|
||||
int mid;
|
||||
if (zoomInfo != NULL)
|
||||
mid = int(zoomInfo->TimeToPosition(0.0, mLeftOffset));
|
||||
mid = (int)(zoomInfo->TimeToPosition(0.0, mLeftOffset));
|
||||
else
|
||||
mid = (int)(mLength*(mMin / (mMin - mMax)) + 0.5);
|
||||
const int iMaxPos = (mOrientation == wxHORIZONTAL) ? mRight : mBottom - 5;
|
||||
@ -1240,8 +1240,8 @@ void Ruler::Update(const TimeTrack* timetrack)// Envelope *speedEnv, long minSpe
|
||||
for (i = 0; i <= steps; i++) {
|
||||
// PRL: Bug1038. Don't label 1.6, rounded, as a duplicate tick for "2"
|
||||
if (!(mFormat == IntFormat && decade < 10.0)) {
|
||||
for (int f = start; f != int(end); f += mstep) {
|
||||
if (int(f / 10) != f / 10.0f) {
|
||||
for (int f = start; f != (int)(end); f += mstep) {
|
||||
if ((int)(f / 10) != f / 10.0f) {
|
||||
val = decade * f / 10;
|
||||
if (val >= rMin && val < rMax) {
|
||||
const int pos(0.5 + mLength * numberScale.ValueToPosition(val));
|
||||
@ -1682,8 +1682,8 @@ inline int IndicatorWidthForHeight(int height)
|
||||
|
||||
inline int IndicatorBigHeight()
|
||||
{
|
||||
return std::max(int(ScrubHeight - TopMargin),
|
||||
int(IndicatorMediumWidth));
|
||||
return std::max((int)(ScrubHeight - TopMargin),
|
||||
(int)(IndicatorMediumWidth));
|
||||
}
|
||||
|
||||
inline int IndicatorBigWidth()
|
||||
@ -2277,7 +2277,7 @@ void AdornedRulerPanel::UpdateRects()
|
||||
|
||||
if (mShowScrubbing) {
|
||||
mScrubZone = mInner;
|
||||
auto scrubHeight = std::min(mScrubZone.height, int(ScrubHeight));
|
||||
auto scrubHeight = std::min(mScrubZone.height, (int)(ScrubHeight));
|
||||
|
||||
int topHeight;
|
||||
#ifdef SCRUB_ABOVE
|
||||
|
Loading…
x
Reference in New Issue
Block a user