updated readme, sorted includes, added comments

This commit is contained in:
2025-11-15 16:42:15 +01:00
parent 67ac6804a4
commit dd95410d36
3 changed files with 13 additions and 11 deletions

View File

@@ -1,17 +1,16 @@
## countdown
Simple command line countdown timer that plays a sound when the time is up. 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 #### 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 sudo pacman -S libpulse pulseaudio
```
```
ffmpeg -i /usr/share/sounds/freedesktop/stereo/alarm-clock-elapsed.oga ${HOME}/music/alarm-clock-elapsed.wav
``` ```
``` ```
@@ -23,6 +22,7 @@ sudo make install
#### usage #### usage
Start a 20 minute countdown:
``` ```
countdown 20 countdown 20
``` ```
@@ -35,5 +35,4 @@ sudo make uninstall
#### TODO #### TODO
- make alarm clock file wave file configurable - Arch Linux package
- fix still reachable bytes (still reachable: 42,485 bytes in 97 blocks)?

4
main.c
View File

@@ -1,9 +1,9 @@
#include "play_raw_audio.h" #include "play_raw_audio.h"
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <unistd.h>
#include <time.h>
#include <string.h> #include <string.h>
#include <time.h>
#include <unistd.h>
// debug pulse audio problems // debug pulse audio problems
#define PA_DEBUG 0 #define PA_DEBUG 0

View File

@@ -8,6 +8,7 @@
#include <string.h> #include <string.h>
#include <unistd.h> #include <unistd.h>
// prototypes for static functions
static int play_square_wave(float frequency, float duration); static int play_square_wave(float frequency, float duration);
int play_manual_alarm() { int play_manual_alarm() {
@@ -26,6 +27,8 @@ int play_manual_alarm() {
return 0; return 0;
} }
// UNUSED
// Playing a raw audio file has the downside of depending on a file.
int play_raw_audio(char file_name[]) { int play_raw_audio(char file_name[]) {
int pa_error = 0; int pa_error = 0;
char content[1024] = ""; char content[1024] = "";