From dd95410d36876adffe6277e442990b81fe818231 Mon Sep 17 00:00:00 2001 From: bjoernf Date: Sat, 15 Nov 2025 16:42:15 +0100 Subject: [PATCH] updated readme, sorted includes, added comments --- README.md | 17 ++++++++--------- main.c | 4 ++-- play_raw_audio.c | 3 +++ 3 files changed, 13 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index d525695..374459f 100644 --- a/README.md +++ b/README.md @@ -1,17 +1,16 @@ +## countdown + Simple command line countdown timer that plays a sound when the time is up. -It is using `pulseaudio`s simple API. +When the time has expired a square wave is sent to `pulseaudio`s simple API \ +to notify the user. #### installation -install `libpulse-dev` (debian based) or `libpulse` package depending on your distro +Install `libpulse-dev` (debian based) or `libpulse` package depending on your distribution. ``` -sudo pacman -S libpulse pulseaudio sound-theme-freedesktop -``` - -``` -ffmpeg -i /usr/share/sounds/freedesktop/stereo/alarm-clock-elapsed.oga ${HOME}/music/alarm-clock-elapsed.wav +sudo pacman -S libpulse pulseaudio ``` ``` @@ -23,6 +22,7 @@ sudo make install #### usage +Start a 20 minute countdown: ``` countdown 20 ``` @@ -35,5 +35,4 @@ sudo make uninstall #### TODO -- make alarm clock file wave file configurable -- fix still reachable bytes (still reachable: 42,485 bytes in 97 blocks)? +- Arch Linux package diff --git a/main.c b/main.c index b844a4b..5424544 100644 --- a/main.c +++ b/main.c @@ -1,9 +1,9 @@ #include "play_raw_audio.h" #include #include -#include -#include #include +#include +#include // debug pulse audio problems #define PA_DEBUG 0 diff --git a/play_raw_audio.c b/play_raw_audio.c index 80ae1d7..567efbd 100644 --- a/play_raw_audio.c +++ b/play_raw_audio.c @@ -8,6 +8,7 @@ #include #include +// prototypes for static functions static int play_square_wave(float frequency, float duration); int play_manual_alarm() { @@ -26,6 +27,8 @@ int play_manual_alarm() { return 0; } +// UNUSED +// Playing a raw audio file has the downside of depending on a file. int play_raw_audio(char file_name[]) { int pa_error = 0; char content[1024] = "";