From a77b34a4ebdc994cce7a3d1f00121f421ca31b53 Mon Sep 17 00:00:00 2001 From: sanine Date: Wed, 7 Sep 2022 11:23:34 -0500 Subject: update README and fix memory leaks --- src/load/load-mp3.c | 11 ----------- src/mossrose.c | 7 +++++++ src/sound.c | 4 ++-- 3 files changed, 9 insertions(+), 13 deletions(-) (limited to 'src') diff --git a/src/load/load-mp3.c b/src/load/load-mp3.c index 09eef0c..d3e7598 100644 --- a/src/load/load-mp3.c +++ b/src/load/load-mp3.c @@ -22,17 +22,6 @@ struct mossrose_sound_t * load_mp3(const char *filename) return NULL; } - printf("samples: %lu\n" - "channels: %d\n" - "hz: %d\n" - "layer: %d\n" - "bitrate: %d\n", - mp3.samples, - mp3.channels, - mp3.hz, - mp3.layer, - mp3.avg_bitrate_kbps); - if (mp3.channels != 1 && mp3.channels != 2) { ABORT("files with %d audio tracks are not supported!\n", mp3.channels); } diff --git a/src/mossrose.c b/src/mossrose.c index f96d394..61ee27b 100644 --- a/src/mossrose.c +++ b/src/mossrose.c @@ -161,6 +161,13 @@ struct mossrose_sound_t * mossrose_load_mp3(const char *filename) } +void mossrose_free_sound(struct mossrose_sound_t *sound) +{ + sound_free_audio(sound); + free(sound); +} + + int mossrose_terminate() { for (int i=0; ileft == NULL) { + if (sound->left != NULL) { free(sound->left); sound->left = NULL; } - if (sound->right == NULL) { + if (sound->right != NULL) { free(sound->right); sound->right = NULL; } -- cgit v1.2.1