Skip to content

Commit

Permalink
Fix compilation bug, invalid operands types
Browse files Browse the repository at this point in the history
  • Loading branch information
aqbifzl authored and shajen committed Sep 1, 2023
1 parent 842eb17 commit 0a10b2b
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion sources/utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,12 @@ void toComplex(const uint8_t *rawBuffer, std::complex<float> *buffer, uint32_t s
std::chrono::milliseconds time() { return std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::system_clock::now().time_since_epoch()); }

std::vector<std::complex<float>> getShiftData(int32_t frequencyOffset, Frequency sampleRate, uint32_t samplesCount) {
const auto f = std::complex<float>(0.0f, -1.0f) * 2.0f * M_PIf32 * (static_cast<float>(-frequencyOffset) / static_cast<float>(sampleRate));
const float floatFreqOffset{static_cast<float>(-frequencyOffset)};
const float floatSampleRate{static_cast<float>(sampleRate)};
const float floatPI{static_cast<float>(M_PI)};
const float imaginaryUnit{-1.0f};

const auto f = std::complex<float>(0.0f, imaginaryUnit) * 2.0f * floatPI * (floatFreqOffset / floatSampleRate);
std::vector<std::complex<float>> data(samplesCount);
for (uint32_t i = 0; i < samplesCount; ++i) {
data[i] = std::exp(f * static_cast<float>(i));
Expand Down

0 comments on commit 0a10b2b

Please sign in to comment.