Skip to content

Commit

Permalink
fix mufft crash caused by unaligned input buffer
Browse files Browse the repository at this point in the history
  • Loading branch information
hexptr committed Jul 12, 2020
1 parent 2dba531 commit 68cf405
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/RageUtil/Sound/RageSound.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -355,11 +355,13 @@ RageSound::GetDataToPlay(float* pBuffer,
copy(pBuffer, until, back_inserter(recentPCMSamples));
if (recentPCMSamples.size() >= recentPCMSamplesBufferSize) {
auto out = static_cast<cfloat*>(fftBuffer);
auto n = recentPCMSamplesBufferSize;
auto plan = mufft_create_plan_1d_r2c(recentPCMSamplesBufferSize,
MUFFT_FLAG_CPU_ANY);
mufft_execute_plan_1d(plan, out, recentPCMSamples.data());
auto in = static_cast<float*>(mufft_alloc(recentPCMSamplesBufferSize * sizeof(float)));
copy(recentPCMSamples.begin(), recentPCMSamples.begin() + recentPCMSamplesBufferSize, in);
mufft_execute_plan_1d(plan, out, in);
mufft_free_plan_1d(plan);
mufft_free(in);
copy(pBuffer, until, back_inserter(recentPCMSamples));
recentPCMSamples.clear();
pendingPlayBackCall = true;
Expand Down

0 comments on commit 68cf405

Please sign in to comment.