mirror of
https://github.com/libretro/RetroArch
synced 2025-02-22 03:40:43 +00:00
Cleanups
This commit is contained in:
parent
3239576ba1
commit
a2f2a882cb
@ -113,25 +113,19 @@ void audio_mix_free_chunk(audio_chunk_t *chunk)
|
|||||||
audio_chunk_t* audio_mix_load_wav_file(const char *path, int sample_rate)
|
audio_chunk_t* audio_mix_load_wav_file(const char *path, int sample_rate)
|
||||||
{
|
{
|
||||||
int sample_size;
|
int sample_size;
|
||||||
int64_t len = 0;
|
int64_t len = 0;
|
||||||
void *buf = NULL;
|
void *buf = NULL;
|
||||||
audio_chunk_t *chunk = (audio_chunk_t*)malloc(sizeof(*chunk));
|
audio_chunk_t *chunk = (audio_chunk_t*)malloc(sizeof(*chunk));
|
||||||
|
|
||||||
if (!chunk)
|
if (!chunk)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
if (!filestream_read_file(path, &buf, &len))
|
chunk->buf = NULL;
|
||||||
{
|
|
||||||
printf("Could not open WAV file for reading.\n");
|
|
||||||
goto error;
|
|
||||||
}
|
|
||||||
|
|
||||||
chunk->buf = buf;
|
|
||||||
chunk->upsample_buf = NULL;
|
chunk->upsample_buf = NULL;
|
||||||
chunk->float_buf = NULL;
|
chunk->float_buf = NULL;
|
||||||
chunk->float_resample_buf = NULL;
|
chunk->float_resample_buf = NULL;
|
||||||
chunk->resample_buf = NULL;
|
chunk->resample_buf = NULL;
|
||||||
chunk->len = len;
|
chunk->len = 0;
|
||||||
chunk->resample_len = 0;
|
chunk->resample_len = 0;
|
||||||
chunk->rwav = (rwav_t*)malloc(sizeof(rwav_t));
|
chunk->rwav = (rwav_t*)malloc(sizeof(rwav_t));
|
||||||
chunk->sample_rate = sample_rate;
|
chunk->sample_rate = sample_rate;
|
||||||
@ -147,6 +141,15 @@ audio_chunk_t* audio_mix_load_wav_file(const char *path, int sample_rate)
|
|||||||
chunk->rwav->subchunk2size = 0;
|
chunk->rwav->subchunk2size = 0;
|
||||||
chunk->rwav->samples = NULL;
|
chunk->rwav->samples = NULL;
|
||||||
|
|
||||||
|
if (!filestream_read_file(path, &buf, &len))
|
||||||
|
{
|
||||||
|
printf("Could not open WAV file for reading.\n");
|
||||||
|
goto error;
|
||||||
|
}
|
||||||
|
|
||||||
|
chunk->buf = buf;
|
||||||
|
chunk->len = len;
|
||||||
|
|
||||||
if (rwav_load(chunk->rwav, chunk->buf, chunk->len) == RWAV_ITERATE_ERROR)
|
if (rwav_load(chunk->rwav, chunk->buf, chunk->len) == RWAV_ITERATE_ERROR)
|
||||||
{
|
{
|
||||||
printf("error: could not load WAV file\n");
|
printf("error: could not load WAV file\n");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user