--- /dev/null
+[Buildset]
+BuildItems=@Variant(\x00\x00\x00\t\x00\x00\x00\x00\x01\x00\x00\x00\x0b\x00\x00\x00\x00\x01\x00\x00\x00\x12\x00F\x00a\x00k\x00e\x00R\x00a\x00d\x00i\x00o)
+
+[Cppcheck]
+checkInformation=true
+checkMissingInclude=true
+checkPerformance=true
+checkStyle=true
+checkUnusedFunction=true
+
+[CustomDefinesAndIncludes][ProjectPath0]
+Path=.
+parseAmbiguousAsCPP=true
+parserArguments=-ferror-limit=100 -fspell-checking -Wdocumentation -Wunused-parameter -Wunreachable-code -Wall -std=c++11
+parserArgumentsC=-ferror-limit=100 -fspell-checking -Wdocumentation -Wunused-parameter -Wunreachable-code -Wall -std=gnu11
+
+[CustomDefinesAndIncludes][ProjectPath0][Compiler]
+Name=GCC
+
+[CustomDefinesAndIncludes][ProjectPath0][Includes]
+1=/home/john/devel/RPi/wiringPi/wiringPi/
+
+[Project]
+VersionControlSupport=kdevgit
CC = gcc
CFLAGS = -std=gnu11 -Wall
-LDFLAGS = -lwiringPi -lpthread
+LDFLAGS = -lpthread -lao -lmpg123
fakeradio: simple_try.c
$(CC) $(CFLAGS) -o ledtest simple_try.c $(LDFLAGS)
+mp3player.o: mp3player.h mp3player.c
+ $(CC) $(CFLAGS) -o mp3player.o mp3player.c $(LDFLAGS)
+
+mp3test: mp3player.o
+ $(CC) $(CFLAGS) -o mp3test mp3player.o $(LDFLAGS)
--- /dev/null
+#include "mp3player.h"
+#include <stdbool.h>
+#define BITS 8
+
+pthread_t startPlayThread(const char* file)
+{
+ pthread_t thread;
+ pthread_create(&thread, NULL, playFunc, (void*) file);
+ return thread;
+}
+
+void* playFunc(void* file)
+{
+ bool running = true;
+ mpg123_handle* mh;
+ unsigned char* buffer;
+ size_t buffer_size;
+ size_t done;
+ int err;
+
+ int driver;
+ ao_device* aodev;
+ ao_sample_format format;
+ int channels;
+ int encoding;
+ long rate;
+
+ ao_initialize();
+ driver = ao_default_driver_id();
+ mpg123_init();
+ mh = mpg123_new(NULL, &err);
+ buffer_size = mpg123_outblock(mh);
+ buffer = (unsigned char*) malloc(buffer_size * sizeof(unsigned char));
+
+ if (mpg123_open(mh, file) != MPG123_OK) return;
+ if (mpg123_getformat(mh, &rate, &channels, &encoding) != MPG123_OK) return;
+
+ format.bits = mpg123_encsize(encoding) * BITS;
+ format.rate = rate;
+ format.channels = channels;
+ format.byte_format = AO_FMT_NATIVE;
+ format.matrix = 0;
+ aodev = ao_open_live(driver, &format, NULL);
+
+ while (mpg123_read(mh, buffer, buffer_size, &done) == MPG123_OK && running) {
+ ao_play(aodev, buffer, done);
+ }
+
+ // cleanup
+ free (buffer);
+ ao_close(aodev);
+ mpg123_close(mh);
+ mpg123_delete(mh);
+ mpg123_exit();
+ ao_shutdown();
+
+}
+
+int main (int argc, char** argv)
+{
+ pthread_t thread = startPlayThread("platt01.mp3");
+ void* status;
+ pthread_join(thread, status);
+ //playFunc("platt01.mp3");
+}
+