From 9cf4562f26add5c9a65077eb870cd0e69705375b Mon Sep 17 00:00:00 2001 From: Brad Parker Date: Thu, 26 Jan 2017 18:46:50 -0500 Subject: [PATCH] fix memory allocation --- libretro-common/audio/audio_mix.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/libretro-common/audio/audio_mix.c b/libretro-common/audio/audio_mix.c index 1abcb27a57..ca6f955d94 100644 --- a/libretro-common/audio/audio_mix.c +++ b/libretro-common/audio/audio_mix.c @@ -129,7 +129,7 @@ audio_chunk_t* audio_mix_load_wav_file(const char *path, int sample_rate) return NULL; } - chunk->upsample_buf = (int16_t*)memalign_alloc_aligned(chunk->rwav->numsamples * 2 * sizeof(int16_t)); + chunk->upsample_buf = (int16_t*)memalign_alloc(128, chunk->rwav->numsamples * 2 * sizeof(int16_t)); sample_size = chunk->rwav->bitspersample / 8; @@ -189,10 +189,10 @@ audio_chunk_t* audio_mix_load_wav_file(const char *path, int sample_rate) { struct resampler_data info = {0}; - chunk->float_buf = (float*)memalign_alloc_aligned(chunk->rwav->numsamples * 2 * chunk->ratio * chunk->rwav->numchannels * sizeof(float)); - chunk->float_resample_buf = (float*)memalign_alloc_aligned(chunk->rwav->numsamples * 3 * chunk->ratio * chunk->rwav->numchannels * sizeof(float)); + chunk->float_buf = (float*)memalign_alloc(128, chunk->rwav->numsamples * 2 * chunk->ratio * sizeof(float)); + chunk->float_resample_buf = (float*)memalign_alloc(128, chunk->rwav->numsamples * 3 * chunk->ratio * sizeof(float)); - convert_s16_to_float(chunk->float_buf, chunk->upsample_buf, chunk->rwav->numsamples * chunk->rwav->numchannels, 1.0); + convert_s16_to_float(chunk->float_buf, chunk->upsample_buf, chunk->rwav->numsamples * 2, 1.0); info.data_in = (const float*)chunk->float_buf; info.data_out = chunk->float_resample_buf; @@ -201,10 +201,10 @@ audio_chunk_t* audio_mix_load_wav_file(const char *path, int sample_rate) chunk->resampler->process(chunk->resampler_data, &info); - chunk->resample_buf = (int16_t*)memalign_alloc_aligned(info.output_frames * chunk->rwav->numchannels * sizeof(int16_t)); + chunk->resample_buf = (int16_t*)memalign_alloc(128, info.output_frames * sizeof(int16_t)); chunk->resample_len = info.output_frames; - convert_float_to_s16(chunk->resample_buf, chunk->float_resample_buf, info.output_frames * chunk->rwav->numchannels); + convert_float_to_s16(chunk->resample_buf, chunk->float_resample_buf, info.output_frames); } }