From 2b24f99c0bb5fb3ccdff17fa1250b815838193e1 Mon Sep 17 00:00:00 2001 From: PedroEdiaz Date: Tue, 20 May 2025 15:39:53 -0600 Subject: [PATCH] Update Readme, license and Makefile --- LICENSE | 2 +- Makefile | 11 +++++++++++ README | 54 +++++++++++++++++++++++++++++++++++++++++------------- cdplayer.c | 2 +- tinyalsa | 1 + 5 files changed, 55 insertions(+), 15 deletions(-) create mode 100644 Makefile create mode 160000 tinyalsa diff --git a/LICENSE b/LICENSE index ca91d85..fb0ec10 100644 --- a/LICENSE +++ b/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2024 by PedroEdiaz . +Copyright (c) 2025 by PedroEdiaz . Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted. diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..f450b61 --- /dev/null +++ b/Makefile @@ -0,0 +1,11 @@ +BIN= cdplayer +OBJ= \ + cdplayer.o \ + tinyalsa/src/pcm.o \ + tinyalsa/src/pcm_hw.o \ + tinyalsa/src/snd_card_plugin.o + +CFLAGS = -Itinyalsa/include + +$(BIN): $(OBJ) + $(CC) $(OBJ) -o $(BIN) diff --git a/README b/README index 051506c..8fd288f 100644 --- a/README +++ b/README @@ -1,18 +1,46 @@ - cdplayer +# cdplayer — Minimal CDDA Player for Linux -"cdplayer" is a minimal CDDA (Compact Disk Digital Audio) player -for linux, that only depend on tinyalsa. +**`cdplayer`** is a minimal CDDA (Compact Disc Digital Audio) player for Linux. +It plays audio CDs directly from `/dev/sr0` (or other CD devices) with almost +no dependencies — relying only on [**tinyalsa**](https://github.com/tinyalsa/tinyalsa). -BUILD: - cc -ltinyalsa -o cdplayer cdplayer.c -USAGE: - ./cdplayer /dev/sr0 () () // play cd +## Features - kill -USR1 // Seek a minute forward - kill -USR2 // Seek a minute backward - kill -STOP // Stop - kill -CONT // Play +- Plays standard audio CDs via CD-ROM device +- Controlled using UNIX signals (no GUI or TUI) +- Depends only on `tinyalsa` for audio playback +- Extremely small and hackable C codebase -LICENSE: - 0BSD Copyright (c) 2024 by PedroEdiaz +## Build +To compile the program run `make` or: +```sh +cc -Itinyalsa/include -o cdplayer cdplayer.c tinyalsa/src/pcm.c tinyalsa/src/pcm_hw.c tinyalsa/src/snd_card_plugin.c +``` + +## Usage +```sh +./cdplayer cdrom [card=0] [device=0] +``` + +- `cdrom` — CD-ROM device like `/dev/sr0` +- `card` — ALSA sound card number (default: 0) +- `device` — ALSA PCM device number (default: 0) + +## Controls (via `kill`) +You can control playback using UNIX signals: + +Signal|Action +------|----- +`SIGUSR1`|Seek forward 1 minute +`SIGUSR2`|Seek backward 1 minute +`SIGSTOP`| Pause playback +`SIGCONT`| Resume playback + + +## Licence +0BSD – Zero Clause BSD License. See [LICENSE](./LICENSE) for details. +Feel free to use, modify, and share freely — no restrictions. + +## Contributing +Contributions are welcome! Feel free to submit issues or pull requests. diff --git a/cdplayer.c b/cdplayer.c index e57cf78..cadb8bd 100644 --- a/cdplayer.c +++ b/cdplayer.c @@ -44,7 +44,7 @@ int main( int argc, char * argv[] ) { weite_err( "Usage: " ); weite_err( argv[0] ); - weite_err( " /dev/sr0 () ()\n" ); + weite_err( "cdrom [card=0] [device=0]\n" ); goto err0; } diff --git a/tinyalsa b/tinyalsa new file mode 160000 index 0000000..e43025b --- /dev/null +++ b/tinyalsa @@ -0,0 +1 @@ +Subproject commit e43025bbf702eb7dd8edd48c1eb50530c60f1de8