This commit is contained in:
twinaphex 2017-12-20 05:27:06 +01:00
parent f952123095
commit 56f9d0a7cf

View File

@ -111,20 +111,23 @@ void audio_mix_free_chunk(audio_chunk_t *chunk)
audio_chunk_t* audio_mix_load_wav_file(const char *path, int sample_rate)
{
int sample_size;
ssize_t len = 0;
void *buf = NULL;
audio_chunk_t *chunk = (audio_chunk_t*)calloc(1, sizeof(*chunk));
if (!chunk)
return NULL;
chunk->sample_rate = sample_rate;
if (!filestream_read_file(path, &chunk->buf, &chunk->len))
if (!filestream_read_file(path, &buf, &len))
{
printf("Could not open WAV file for reading.\n");
goto error;
}
chunk->rwav = (rwav_t*)malloc(sizeof(rwav_t));
chunk->sample_rate = sample_rate;
chunk->buf = buf;
chunk->len = len;
chunk->rwav = (rwav_t*)malloc(sizeof(rwav_t));
if (rwav_load(chunk->rwav, chunk->buf, chunk->len) == RWAV_ITERATE_ERROR)
{