Skip to content

Commit

Permalink
Add AudioOutputMixer to valgrind testing
Browse files Browse the repository at this point in the history
It, amazingly, worked without any issues found by Valgrind on the
first try.
  • Loading branch information
earlephilhower committed Feb 26, 2018
1 parent 3c7ffbe commit e9aec04
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion tests/host/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ CPPOPTS=-g -Wunused-parameter -Wall -std=c++11 -m32 -include Arduino.h
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/AudioFileSourceBuffer.cpp ../../src/AudioGeneratorMP3.cpp -I ../../src/ -I.
g++ $(CPPOPTS) -o mp3 mp3.cpp Serial.cpp *.o ../../src/AudioFileSourceSTDIO.cpp ../../src/AudioOutputSTDIO.cpp ../../src/AudioFileSourceID3.cpp ../../src/AudioFileSourceBuffer.cpp ../../src/AudioGeneratorMP3.cpp ../../src/AudioOutputMixer.cpp -I ../../src/ -I.
rm -f *.o
echo valgrind --leak-check=full --track-origins=yes -v --error-limit=no --show-leak-kinds=all ./mp3

Expand Down
8 changes: 7 additions & 1 deletion tests/host/mp3.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include "AudioGeneratorMP3.h"
#include "AudioFileSourceID3.h"
#include "AudioFileSourceBuffer.h"
#include "AudioOutputMixer.h"

// Called when a metadata event occurs (i.e. an ID3 tag, an ICY block, etc.
void MDCallback(void *cbData, const char *type, bool isUnicode, const char *string)
Expand Down Expand Up @@ -51,14 +52,19 @@ int main(int argc, char **argv)
id3->RegisterMetadataCB(MDCallback, (void*)"ID3TAG");
AudioOutputSTDIO *out = new AudioOutputSTDIO();
out->SetFilename("jamonit.wav");
AudioOutputMixer *mix = new AudioOutputMixer(17, out);
AudioOutputMixerStub *stub = mix->NewInput();
void *space = malloc(29192);
AudioGeneratorMP3 *mp3 = new AudioGeneratorMP3(space, 29192);

mp3->begin(id3, out);
mp3->begin(id3, stub);
while (mp3->loop()) { /*noop*/ }
mp3->stop();
out->stop();

free(space);
delete stub;
delete mix;
delete mp3;
delete out;
delete id3;
Expand Down

0 comments on commit e9aec04

Please sign in to comment.