diff --git a/sources/utils.cpp b/sources/utils.cpp index 41f054f..9db2abc 100644 --- a/sources/utils.cpp +++ b/sources/utils.cpp @@ -73,7 +73,12 @@ void toComplex(const uint8_t *rawBuffer, std::complex *buffer, uint32_t s std::chrono::milliseconds time() { return std::chrono::duration_cast(std::chrono::system_clock::now().time_since_epoch()); } std::vector> getShiftData(int32_t frequencyOffset, Frequency sampleRate, uint32_t samplesCount) { - const auto f = std::complex(0.0f, -1.0f) * 2.0f * M_PIf32 * (static_cast(-frequencyOffset) / static_cast(sampleRate)); + const float floatFreqOffset{static_cast(-frequencyOffset)}; + const float floatSampleRate{static_cast(sampleRate)}; + const float floatPI{static_cast(M_PI)}; + const float imaginaryUnit{-1.0f}; + + const auto f = std::complex(0.0f, imaginaryUnit) * 2.0f * floatPI * (floatFreqOffset / floatSampleRate); std::vector> data(samplesCount); for (uint32_t i = 0; i < samplesCount; ++i) { data[i] = std::exp(f * static_cast(i));