From cffb424c2c85257759a1b98ec952afb8cc07765b Mon Sep 17 00:00:00 2001 From: "Earle F. Philhower, III" Date: Fri, 19 Jan 2018 19:17:30 -0800 Subject: [PATCH 1/2] WIP - build some code on the PC to run valgrind/etc. --- src/AudioFileSourceSTDIO.cpp | 81 ++++++++++++++++++++++++ src/AudioFileSourceSTDIO.h | 53 ++++++++++++++++ src/AudioGeneratorMP3.cpp | 14 ++++- src/AudioOutputSTDIO.cpp | 115 +++++++++++++++++++++++++++++++++++ src/AudioOutputSTDIO.h | 47 ++++++++++++++ src/libtinysoundfont/tsf.h | 6 +- tests/host/Arduino.h | 80 ++++++++++++++++++++++++ tests/host/Makefile | 42 +++++++++++++ tests/host/Serial.cpp | 4 ++ tests/host/mp3.cpp | 18 ++++++ 10 files changed, 452 insertions(+), 8 deletions(-) create mode 100644 src/AudioFileSourceSTDIO.cpp create mode 100644 src/AudioFileSourceSTDIO.h create mode 100644 src/AudioOutputSTDIO.cpp create mode 100644 src/AudioOutputSTDIO.h create mode 100644 tests/host/Arduino.h create mode 100644 tests/host/Makefile create mode 100644 tests/host/Serial.cpp create mode 100644 tests/host/mp3.cpp diff --git a/src/AudioFileSourceSTDIO.cpp b/src/AudioFileSourceSTDIO.cpp new file mode 100644 index 0000000..8d58e35 --- /dev/null +++ b/src/AudioFileSourceSTDIO.cpp @@ -0,0 +1,81 @@ +/* + AudioFileSourceSTDIO + Input STDIO "file" to be used by AudioGenerator + Only for hot-based testing + + Copyright (C) 2017 Earle F. Philhower, III + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +#include +#ifndef ARDUINO + +#include "AudioFileSourceSTDIO.h" + +AudioFileSourceSTDIO::AudioFileSourceSTDIO() +{ + f = NULL; +} + +AudioFileSourceSTDIO::AudioFileSourceSTDIO(const char *filename) +{ + open(filename); +} + +bool AudioFileSourceSTDIO::open(const char *filename) +{ + f = fopen(filename, "rb"); + return f; +} + +AudioFileSourceSTDIO::~AudioFileSourceSTDIO() +{ + if (f) fclose(f); + f = NULL; +} + +uint32_t AudioFileSourceSTDIO::read(void *data, uint32_t len) +{ + return fread(reinterpret_cast(data), 1, len, f); +} + +bool AudioFileSourceSTDIO::seek(int32_t pos, int dir) +{ + return fseek(f, pos, dir); +} + +bool AudioFileSourceSTDIO::close() +{ + fclose(f); + return true; +} + +bool AudioFileSourceSTDIO::isOpen() +{ + return f?true:false; +} + +uint32_t AudioFileSourceSTDIO::getSize() +{ + if (!f) return 0; + uint32_t p = ftell(f); + fseek(f, 0, SEEK_END); + uint32_t len = ftell(f); + fseek(f, p, SEEK_SET); + return len; +} + + +#endif diff --git a/src/AudioFileSourceSTDIO.h b/src/AudioFileSourceSTDIO.h new file mode 100644 index 0000000..46a4681 --- /dev/null +++ b/src/AudioFileSourceSTDIO.h @@ -0,0 +1,53 @@ +/* + AudioFileSourceSTDIO + Input SPIFFS "file" to be used by AudioGenerator + Only for host-based testing, not Arduino + + Copyright (C) 2017 Earle F. Philhower, III + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +#ifndef _AUDIOFILESOURCESTDIO_H +#define _AUDIOFILESOURCESTDIO_H + +#include + +#ifndef ARDUINO + +#include "AudioFileSource.h" + +class AudioFileSourceSTDIO : public AudioFileSource +{ + public: + AudioFileSourceSTDIO(); + AudioFileSourceSTDIO(const char *filename); + virtual ~AudioFileSourceSTDIO() override; + + virtual bool open(const char *filename) override; + virtual uint32_t read(void *data, uint32_t len) override; + virtual bool seek(int32_t pos, int dir) override; + virtual bool close() override; + virtual bool isOpen() override; + virtual uint32_t getSize() override; + virtual uint32_t getPos() override { if (!f) return 0; else return (uint32_t)ftell(f); }; + + private: + FILE *f; +}; + +#endif // !ARDUINO + +#endif + diff --git a/src/AudioGeneratorMP3.cpp b/src/AudioGeneratorMP3.cpp index 7e0e50c..e8c3e11 100644 --- a/src/AudioGeneratorMP3.cpp +++ b/src/AudioGeneratorMP3.cpp @@ -232,7 +232,7 @@ bool AudioGeneratorMP3::begin(AudioFileSource *source, AudioOutput *output) #undef stack extern "C" { #ifdef ESP32 - //TOTO - add ESP32 checks + //TODO - add ESP32 checks void stack(const char *s, const char *t, int i) { } @@ -240,7 +240,7 @@ extern "C" { { return 8192; } -#else +#elif defined(ESP8266) #include extern cont_t g_cont; @@ -274,6 +274,14 @@ extern "C" { int freestack = 4 * (sp - g_cont.stack); return freestack; } -#endif +#else + void stack(const char *s, const char *t, int i) + { + } + int stackfree() + { + return 8192; + } +#endif } diff --git a/src/AudioOutputSTDIO.cpp b/src/AudioOutputSTDIO.cpp new file mode 100644 index 0000000..33bbd34 --- /dev/null +++ b/src/AudioOutputSTDIO.cpp @@ -0,0 +1,115 @@ +/* + AudioOutputSTDIO + Writes a WAV file to the STDIO filesystem + Only for host-based testing + + Copyright (C) 2017 Earle F. Philhower, III + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +#include + +#ifndef ARDUINO + +#include "AudioOutputSTDIO.h" +#include + +static const uint8_t wavHeaderTemplate[] PROGMEM = { // Hardcoded simple WAV header with 0xffffffff lengths all around + 0x52, 0x49, 0x46, 0x46, 0xff, 0xff, 0xff, 0xff, 0x57, 0x41, 0x56, 0x45, + 0x66, 0x6d, 0x74, 0x20, 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x02, 0x00, 0x22, 0x56, 0x00, 0x00, 0x88, 0x58, 0x01, 0x00, 0x04, 0x00, 0x10, 0x00, + 0x64, 0x61, 0x74, 0x61, 0xff, 0xff, 0xff, 0xff }; + +void AudioOutputSTDIO::SetFilename(const char *name) +{ + free(filename); + filename = strdup(name); +} + +bool AudioOutputSTDIO::begin() +{ + uint8_t wavHeader[sizeof(wavHeaderTemplate)]; + memset(wavHeader, 0, sizeof(wavHeader)); + + if (f) return false; // Already open! + unlink(filename); + f = fopen(filename, "wb+"); + if (!f) return false; + + // We'll fix the header up when we close the file + fwrite(wavHeader, sizeof(wavHeader), 1, f); + return true; +} + +bool AudioOutputSTDIO::ConsumeSample(int16_t sample[2]) +{ + for (int i=0; i> 8) & 0xff; + fwrite(&l, sizeof(l), 1, f); + fwrite(&h, sizeof(h), 1, f); + } + } + return true; +} + + +bool AudioOutputSTDIO::stop() +{ + uint8_t wavHeader[sizeof(wavHeaderTemplate)]; + + memcpy_P(wavHeader, wavHeaderTemplate, sizeof(wavHeaderTemplate)); + + int chunksize = ftell(f) - 8; + wavHeader[4] = chunksize & 0xff; + wavHeader[5] = (chunksize>>8)&0xff; + wavHeader[6] = (chunksize>>16)&0xff; + wavHeader[7] = (chunksize>>24)&0xff; + + wavHeader[22] = channels & 0xff; + wavHeader[23] = 0; + + wavHeader[24] = hertz & 0xff; + wavHeader[25] = (hertz >> 8) & 0xff; + wavHeader[26] = (hertz >> 16) & 0xff; + wavHeader[27] = (hertz >> 24) & 0xff; + int byteRate = hertz * bps * channels / 8; + wavHeader[28] = byteRate & 0xff; + wavHeader[29] = (byteRate >> 8) & 0xff; + wavHeader[30] = (byteRate >> 16) & 0xff; + wavHeader[31] = (byteRate >> 24) & 0xff; + wavHeader[32] = channels * bps / 8; + wavHeader[33] = 0; + wavHeader[34] = bps; + wavHeader[35] = 0; + + int datasize = ftell(f) - sizeof(wavHeader); + wavHeader[40] = datasize & 0xff; + wavHeader[41] = (datasize>>8)&0xff; + wavHeader[42] = (datasize>>16)&0xff; + wavHeader[43] = (datasize>>24)&0xff; + + // Write real header out + fseek(f, 0, SEEK_SET); + fwrite(wavHeader, sizeof(wavHeader), 1, f); + fclose(f); + return true; +} + +#endif + diff --git a/src/AudioOutputSTDIO.h b/src/AudioOutputSTDIO.h new file mode 100644 index 0000000..452a06e --- /dev/null +++ b/src/AudioOutputSTDIO.h @@ -0,0 +1,47 @@ +/* + AudioOutputSTDIO + Writes a WAV file to the STDIO filesystem + Only for host-based testing + + Copyright (C) 2017 Earle F. Philhower, III + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +#ifndef _AUDIOOUTPUTSTDIO_H +#define _AUDIOOUTPUTSTDIO_H + +#include +#ifndef ARDUINO + +#include "AudioOutput.h" + +class AudioOutputSTDIO : public AudioOutput +{ + public: + AudioOutputSTDIO() { filename = NULL; }; + ~AudioOutputSTDIO() { free(filename); }; + virtual bool begin() override; + virtual bool ConsumeSample(int16_t sample[2]) override; + virtual bool stop() override; + void SetFilename(const char *name); + + private: + FILE *f; + char *filename; +}; + +#endif + +#endif diff --git a/src/libtinysoundfont/tsf.h b/src/libtinysoundfont/tsf.h index 5306f50..0dbdb59 100644 --- a/src/libtinysoundfont/tsf.h +++ b/src/libtinysoundfont/tsf.h @@ -1257,11 +1257,7 @@ static void tsf_voice_render(tsf* f, struct tsf_voice* v, float* outputBuffer, i void DumpF32P32(char *name, long long x) { -#ifdef ESP32 - printf("%s = %08x.%08x\n", name, (int)((x>>32)&0xffffffff), (int)(x&0xffffffff)); -#else - printf("%s = %08x.%08x\n", name, (int32)((x>>32)&0xffffffff), (int32)(x&0xffffffff)); -#endif + printf("%s = %08x.%08x\n", name, (int32_t)((x>>32)&0xffffffff), (int32_t)(x&0xffffffff)); } static void tsf_voice_render_fast(tsf* f, struct tsf_voice* v, short* outputBuffer, int numSamples) { diff --git a/tests/host/Arduino.h b/tests/host/Arduino.h new file mode 100644 index 0000000..f83789a --- /dev/null +++ b/tests/host/Arduino.h @@ -0,0 +1,80 @@ +#ifdef ARDUINO +#error This file is only used for host builds +#endif + +#ifndef MINIARD +#define MINIARD + +#include +#include +#include +#include +#include + +#define PROGMEM +#define PSTR +#define memcpy_P memcpy +#define sprintf_P sprintf +#define yield() do {} while(0) +#define printf_P printf +#define strcpy_P strcpy +#define snprintf_P snprintf + +#ifdef __cplusplus +class SerialEmulator { + public: + SerialEmulator() {}; + ~SerialEmulator() {}; + int printf_P(const char *fmt, ...) { va_list ap; va_start(ap, fmt); int r = vprintf(fmt, ap); va_end(ap); return r; }; + void flush() {}; +}; +extern SerialEmulator Serial; +#endif + +#ifndef ICACHE_RODATA_ATTR +#define ICACHE_RODATA_ATTR +#endif + +#ifndef PROGMEM +#define PROGMEM +#endif + +#ifndef PGM_P +#define PGM_P +#endif + +#ifndef PGM_VOID_P +#define PGM_VOID_P +#endif + +#ifndef PSTR +#define PSTR +#endif + +#ifdef __cplusplus + #define pgm_read_byte(addr) (*reinterpret_cast(addr)) + #define pgm_read_word(addr) (*reinterpret_cast(addr)) + #define pgm_read_dword(addr) (*reinterpret_cast(addr)) + #define pgm_read_float(addr) (*reinterpret_cast(addr)) + #define pgm_read_ptr(addr) (*reinterpret_cast(addr)) +#else + #define pgm_read_byte(addr) (*(const uint8_t*)(addr)) + #define pgm_read_word(addr) (*(const uint16_t*)(addr)) + #define pgm_read_dword(addr) (*(const uint32_t*)(addr)) + #define pgm_read_float(addr) (*(const float)(addr)) + #define pgm_read_ptr(addr) (*(const void const *)(addr)) +#endif + +#define pgm_read_byte_near(addr) pgm_read_byte(addr) +#define pgm_read_word_near(addr) pgm_read_word(addr) +#define pgm_read_dword_near(addr) pgm_read_dword(addr) +#define pgm_read_float_near(addr) pgm_read_float(addr) +#define pgm_read_ptr_near(addr) pgm_read_ptr(addr) +#define pgm_read_byte_far(addr) pgm_read_byte(addr) +#define pgm_read_word_far(addr) pgm_read_word(addr) +#define pgm_read_dword_far(addr) pgm_read_dword(addr) +#define pgm_read_float_far(addr) pgm_read_float(addr) +#define pgm_read_ptr_far(addr) pgm_read_ptr(addr) + + +#endif diff --git a/tests/host/Makefile b/tests/host/Makefile new file mode 100644 index 0000000..f8bf588 --- /dev/null +++ b/tests/host/Makefile @@ -0,0 +1,42 @@ +all: mp3 + +libmad=../../src/libmad/decoder.c ../../src/libmad/frame.c ../../src/libmad/bit.c ../../src/libmad/stream.c ../../src/libmad/fixed.c \ +../../src/libmad/timer.c ../../src/libmad/layer3.c ../../src/libmad/synth.c ../../src/libmad/huffman.c ../../src/libmad/version.c + + +libhelix_mp3=../../src/libhelix-mp3/dequant.c ../../src/libhelix-mp3/mp3dec.c ../../src/libhelix-mp3/stproc.c \ +../../src/libhelix-mp3/hufftabs.c ../../src/libhelix-mp3/dct32.c ../../src/libhelix-mp3/trigtabs.c \ +../../src/libhelix-mp3/dqchan.c ../../src/libhelix-mp3/scalfact.c ../../src/libhelix-mp3/polyphase.c ../../src/libhelix-mp3/buffers.c \ +../../src/libhelix-mp3/bitstream.c ../../src/libhelix-mp3/imdct.c ../../src/libhelix-mp3/subband.c ../../src/libhelix-mp3/huffman.c \ +../../src/libhelix-mp3/mp3tabs.c + +audiolib=../../src/AudioGeneratorWAV.cpp ../../src/AudioGeneratorMIDI.cpp ../../src/AudioFileSourceSTDIO.cpp ../../src/AudioOutputSTDIO.cpp \ +../../src/AudioFileSourceID3.cpp ../../src/AudioGeneratorAAC.cpp ../../src/AudioGeneratorMP3.cpp ../../src/AudioOutputFilterDecimate.cpp \ +../../src/AudioGeneratorFLAC.cpp ../../src/AudioGeneratorMOD.cpp ../../src/AudioFileSourceBuffer.cpp ../../src/AudioGeneratorMP3a.cpp \ +Serial.cpp + +libhelix_aac=../../src/libhelix-aac/decelmnt.c ../../src/libhelix-aac/dct4.c ../../src/libhelix-aac/dequant.c ../../src/libhelix-aac/sbrhuff.c \ +../../src/libhelix-aac/sbrmath.c ../../src/libhelix-aac/aactabs.c ../../src/libhelix-aac/stproc.c ../../src/libhelix-aac/hufftabs.c \ +../../src/libhelix-aac/sbrtabs.c ../../src/libhelix-aac/sbrfft.c ../../src/libhelix-aac/filefmt.c ../../src/libhelix-aac/tns.c \ +../../src/libhelix-aac/trigtabs.c ../../src/libhelix-aac/fft.c ../../src/libhelix-aac/pns.c ../../src/libhelix-aac/sbrfreq.c \ +../../src/libhelix-aac/sbrside.c ../../src/libhelix-aac/sbrhfadj.c ../../src/libhelix-aac/buffers.c ../../src/libhelix-aac/bitstream.c \ +../../src/libhelix-aac/noiseless.c ../../src/libhelix-aac/imdct.c ../../src/libhelix-aac/aacdec.c ../../src/libhelix-aac/sbrhfgen.c \ +../../src/libhelix-aac/sbrqmf.c ../../src/libhelix-aac/huffman.c ../../src/libhelix-aac/sbr.c ../../src/libhelix-aac/sbrimdct.c + +libflac=../../src/libflac/md5.c ../../src/libflac/window.c ../../src/libflac/memory.c ../../src/libflac/cpu.c ../../src/libflac/fixed.c \ +../../src/libflac/format.c ../../src/libflac/lpc.c ../../src/libflac/crc.c ../../src/libflac/bitreader.c ../../src/libflac/bitmath.c \ +../../src/libflac/stream_decoder.c ../../src/libflac/float.c + + +CCOPTS=-g -Wall -m32 -include Arduino.h +CPPOPTS=-g -Wall -std=c++11 -m32 -include Arduino.h + +mp3: mp3.cpp $(audiolib) + rm -f *.o + gcc $(CCOPTS) -c $(libmad) -I ../../src/ -I. + g++ $(CPPOPTS) -o mp3 mp3.cpp Serial.cpp *.o ../../src/AudioFileSourceSTDIO.cpp ../../src/AudioOutputSTDIO.cpp ../../src/AudioFileSourceID3.cpp ../../src/AudioGeneratorMP3.cpp -I ../../src/ -I. + rm -f *.o + +clean: + rm -f mp3 *.o + diff --git a/tests/host/Serial.cpp b/tests/host/Serial.cpp new file mode 100644 index 0000000..7e9f0a5 --- /dev/null +++ b/tests/host/Serial.cpp @@ -0,0 +1,4 @@ +#include + +SerialEmulator Serial; + diff --git a/tests/host/mp3.cpp b/tests/host/mp3.cpp new file mode 100644 index 0000000..42f6314 --- /dev/null +++ b/tests/host/mp3.cpp @@ -0,0 +1,18 @@ +#include +#include "AudioFileSourceSTDIO.h" +#include "AudioOutputSTDIO.h" +#include "AudioGeneratorMP3.h" + +int main(int argc, char **argv) +{ + (void) argc; + (void) argv; + AudioFileSourceSTDIO *in = new AudioFileSourceSTDIO("jamonit.mp3"); + AudioOutputSTDIO *out = new AudioOutputSTDIO(); + out->SetFilename("jamonit.wav"); + AudioGeneratorMP3 *mp3 = new AudioGeneratorMP3(); + + mp3->begin(in, out); + while (mp3->loop()) { /*noop*/ } + mp3->stop(); +} From 0172f17b512a631b63ce1edc5baaf5ea0f666621 Mon Sep 17 00:00:00 2001 From: "Earle F. Philhower, III" Date: Fri, 19 Jan 2018 21:23:17 -0800 Subject: [PATCH 2/2] MP3 test in Valgrind Run a host MP3 test using valgrind, shows no errors. --- src/AudioFileSourceSTDIO.cpp | 1 + src/AudioGeneratorMP3.cpp | 2 ++ src/AudioOutputSTDIO.h | 2 +- src/libmad/frame.c | 5 +++++ tests/host/Makefile | 5 ++++- tests/host/mp3.cpp | 4 ++++ 6 files changed, 17 insertions(+), 2 deletions(-) diff --git a/src/AudioFileSourceSTDIO.cpp b/src/AudioFileSourceSTDIO.cpp index 8d58e35..8e6013a 100644 --- a/src/AudioFileSourceSTDIO.cpp +++ b/src/AudioFileSourceSTDIO.cpp @@ -59,6 +59,7 @@ bool AudioFileSourceSTDIO::seek(int32_t pos, int dir) bool AudioFileSourceSTDIO::close() { fclose(f); + f = NULL; return true; } diff --git a/src/AudioGeneratorMP3.cpp b/src/AudioGeneratorMP3.cpp index e8c3e11..e272109 100644 --- a/src/AudioGeneratorMP3.cpp +++ b/src/AudioGeneratorMP3.cpp @@ -203,6 +203,8 @@ bool AudioGeneratorMP3::begin(AudioFileSource *source, AudioOutput *output) Serial.printf_P(PSTR("MP3 source file not open\n")); return false; // Error } + output->SetBitsPerSample(16); + output->SetChannels(2); if (!output->begin()) return false; // Where we are in generating one frame's data, set to invalid so we will run loop on first getsample() diff --git a/src/AudioOutputSTDIO.h b/src/AudioOutputSTDIO.h index 452a06e..f5a1028 100644 --- a/src/AudioOutputSTDIO.h +++ b/src/AudioOutputSTDIO.h @@ -30,7 +30,7 @@ class AudioOutputSTDIO : public AudioOutput { public: - AudioOutputSTDIO() { filename = NULL; }; + AudioOutputSTDIO() { filename = NULL; f = NULL; }; ~AudioOutputSTDIO() { free(filename); }; virtual bool begin() override; virtual bool ConsumeSample(int16_t sample[2]) override; diff --git a/src/libmad/frame.c b/src/libmad/frame.c index 831783b..92e7e8e 100644 --- a/src/libmad/frame.c +++ b/src/libmad/frame.c @@ -451,6 +451,11 @@ int mad_frame_decode(struct mad_frame *frame, struct mad_stream *stream) frame->header.flags &= ~MAD_FLAG_INCOMPLETE; + // EFP3 - On non-MP3 frames, abort instead of crash..we removed MP-II/MP-I decoders + if (!decoder_table[frame->header.layer - 1]) { + goto fail; + } + if (decoder_table[frame->header.layer - 1](stream, frame) == -1) { if (!MAD_RECOVERABLE(stream->error)) stream->next_frame = stream->this_frame; diff --git a/tests/host/Makefile b/tests/host/Makefile index f8bf588..1af8ade 100644 --- a/tests/host/Makefile +++ b/tests/host/Makefile @@ -31,12 +31,15 @@ libflac=../../src/libflac/md5.c ../../src/libflac/window.c ../../src/libflac/mem CCOPTS=-g -Wall -m32 -include Arduino.h CPPOPTS=-g -Wall -std=c++11 -m32 -include Arduino.h -mp3: mp3.cpp $(audiolib) +mp3: FORCE rm -f *.o gcc $(CCOPTS) -c $(libmad) -I ../../src/ -I. g++ $(CPPOPTS) -o mp3 mp3.cpp Serial.cpp *.o ../../src/AudioFileSourceSTDIO.cpp ../../src/AudioOutputSTDIO.cpp ../../src/AudioFileSourceID3.cpp ../../src/AudioGeneratorMP3.cpp -I ../../src/ -I. rm -f *.o + valgrind --leak-check=full --track-origins=yes -v --error-limit=no --show-leak-kinds=all ./mp3 clean: rm -f mp3 *.o + +FORCE: diff --git a/tests/host/mp3.cpp b/tests/host/mp3.cpp index 42f6314..f022abc 100644 --- a/tests/host/mp3.cpp +++ b/tests/host/mp3.cpp @@ -15,4 +15,8 @@ int main(int argc, char **argv) mp3->begin(in, out); while (mp3->loop()) { /*noop*/ } mp3->stop(); + + delete mp3; + delete out; + delete in; }