From 04ea2572a68bf057e75e34913a555685b75ab4ba Mon Sep 17 00:00:00 2001 From: John Janus Date: Sat, 7 Oct 2017 00:01:58 +0200 Subject: [PATCH] tweak delays, remove unneccessary output --- mp3player.c | 23 ++++------------------- simple_try.c | 4 ++-- 2 files changed, 6 insertions(+), 21 deletions(-) diff --git a/mp3player.c b/mp3player.c index 08e1632..7dd4c4f 100644 --- a/mp3player.c +++ b/mp3player.c @@ -62,12 +62,9 @@ static void* playFunc(void* arg) bool running = true; playermem* mem = (playermem*) malloc(sizeof(playermem)); playersettings* settings = (playersettings*) arg; - //mpg123_handle* mh; - //unsigned char* buffer; int err; int driver; - //ao_device* aodev; ao_sample_format format; int channels; int encoding; @@ -86,8 +83,8 @@ static void* playFunc(void* arg) format.channels = channels; format.byte_format = AO_FMT_NATIVE; format.matrix = 0; - ao_option options = {"debug","",NULL}; - mem->aodev = ao_open_live(driver, &format, &options); + //ao_option options = {"debug","",NULL}; + mem->aodev = ao_open_live(driver, &format, NULL);//&options); mem->queue = create_fifo(5); decodeData dd; dd.file = settings->file; @@ -95,19 +92,9 @@ static void* playFunc(void* arg) dd.mh = mem->mh; pthread_create(&mem->decode_thread, NULL, decodeFunc, &dd); pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL); -// do { - while (running) + + while (running) { - -// int mpg123ret = mpg123_read(mem->mh, mem->buffer, buffer_size, &done); -// if ( mpg123ret == MPG123_DONE && settings->loop) { -// mpg123_open(mem->mh, settings->file); -// continue; -// //mpg123_read(mem->mh, mem->buffer, buffer_size, &done); -// } else if (mpg123ret != MPG123_OK) { -// break; -// } -// ao_play(mem->aodev, fifo_pop(f), done); unsigned char* buffer; size_t done; fifo_pop(mem->queue, &buffer, &done); @@ -115,8 +102,6 @@ static void* playFunc(void* arg) free(buffer); pthread_testcancel(); } -// } while (settings->loop); - pthread_cleanup_pop(1); pthread_exit((void*) pthread_self()); } diff --git a/simple_try.c b/simple_try.c index aaf0e98..617f7ff 100644 --- a/simple_try.c +++ b/simple_try.c @@ -19,8 +19,8 @@ #define INTROBTN 13 #define HORNBTN 11 -#define UNPRELL 300 -#define LOOPDELAY 500 +#define UNPRELL 250 +#define LOOPDELAY 600 volatile bool running = true; static volatile bool pwrOn = false; -- 2.47.1