--- /dev/null
+[Unit]
+Description=A fake radio
+
+[Service]
+Type=simple
+WorkingDirectory=/home/pi/devel/FakeRadio
+ExecStart=/home/pi/devel/FakeRadio/fakeradio
+
+[Install]
+WantedBy=multi-user.target
#include <mpg123.h>
#define BITS 8
-pthread_t startPlayThread(const char* file)
+pthread_t startPlayThread(const char* file, bool loop)
{
pthread_t thread;
- pthread_create(&thread, NULL, playFunc, (void*) file);
+ pthread_create(&thread, NULL, playFunc, (void*) file, loop);
return thread;
}
#ifndef _MY_MP3PLAYER
#define _MY_MP3PLAYER
#include <pthread.h>
+#include <stdbool.h>
-pthread_t startPlayThread(const char*);
+pthread_t startPlayThread(const char*, bool);
-void* playFunc(void*);
+void* playFunc(void*, bool);
#endif
digitalWrite(CHNL2LED, HIGH);
chnl1=true;
if (intro) {
- playThread = startPlayThread("intro.mp3");
+ playThread = startPlayThread("intro.mp3", true);
digitalWrite(INTROLED, LOW);
} else {
digitalWrite(INTROLED, HIGH);
if (chnl1) {
digitalWrite(CHNL1LED, LOW);
digitalWrite(CHNL2LED, HIGH);
- playThread = startPlayThread("platt01.mp3");
+ playThread = startPlayThread("platt01.mp3",false);
} else {
digitalWrite(CHNL2LED, LOW);
digitalWrite(CHNL1LED, HIGH);
- playThread = startPlayThread("dansk01.mp3");
+ playThread = startPlayThread("dansk01.mp3",false);
}
}
delay(500);