diff --git a/src/RubberBandStretcher.cpp b/src/RubberBandStretcher.cpp index e4a7d43..8e62e33 100644 --- a/src/RubberBandStretcher.cpp +++ b/src/RubberBandStretcher.cpp @@ -42,7 +42,7 @@ RubberBandStretcher::RubberBandStretcher(size_t sampleRate, m_r3d ((options & OptionEngineFiner) ? new R3StretcherImpl(R3StretcherImpl::Parameters - (sampleRate, channels, options), + (double(sampleRate), channels, options), initialTimeRatio, initialPitchScale) : nullptr) { diff --git a/src/common/MovingMedian.h b/src/common/MovingMedian.h index 48fcd39..e7ede71 100644 --- a/src/common/MovingMedian.h +++ b/src/common/MovingMedian.h @@ -97,7 +97,7 @@ public: if (m_percentile == fifty) { // exact default value return m_sortspace[n / 2]; } else { - int index = float(n) * m_percentile / 100.f; + int index = int(floorf(float(n) * m_percentile / 100.f)); if (index >= m_fill) index = m_fill - 1; return m_sortspace[index]; } diff --git a/src/common/Window.h b/src/common/Window.h index 58a2eeb..2800c7e 100644 --- a/src/common/Window.h +++ b/src/common/Window.h @@ -111,7 +111,7 @@ protected: T m_area; void encache(); - void cosinewin(T *, T, T, T, T); + void cosinewin(T *, double, double, double, double); }; template @@ -248,14 +248,14 @@ void Window::encache() } template -void Window::cosinewin(T *mult, T a0, T a1, T a2, T a3) +void Window::cosinewin(T *mult, double a0, double a1, double a2, double a3) { int n = int(m_size); for (int i = 0; i < n; ++i) { - mult[i] *= (a0 - - a1 * cos(2 * M_PI * i / n) - + a2 * cos(4 * M_PI * i / n) - - a3 * cos(6 * M_PI * i / n)); + mult[i] = T(mult[i] * (a0 + - a1 * cos(2 * M_PI * i / n) + + a2 * cos(4 * M_PI * i / n) + - a3 * cos(6 * M_PI * i / n))); } } diff --git a/src/finer/R3StretcherImpl.cpp b/src/finer/R3StretcherImpl.cpp index af605a1..c0b7412 100644 --- a/src/finer/R3StretcherImpl.cpp +++ b/src/finer/R3StretcherImpl.cpp @@ -392,7 +392,7 @@ R3StretcherImpl::process(const float *const *input, size_t samples, bool final) if (!isRealTime() && !m_keyFrameMap.empty()) { if (m_mode == ProcessMode::Studying) { m_totalTargetDuration = - round(m_studyInputDuration * getEffectiveRatio()); + size_t(round(m_studyInputDuration * getEffectiveRatio())); } }