aboutsummaryrefslogtreecommitdiff
path: root/utils
diff options
context:
space:
mode:
Diffstat (limited to 'utils')
-rw-r--r--utils/Makefile39
-rw-r--r--utils/tinycap.187
-rw-r--r--utils/tinycap.c2
-rw-r--r--utils/tinymix.159
-rw-r--r--utils/tinymix.c7
-rw-r--r--utils/tinypcminfo.157
-rw-r--r--utils/tinypcminfo.c2
-rw-r--r--utils/tinyplay.193
-rw-r--r--utils/tinyplay.c6
9 files changed, 330 insertions, 22 deletions
diff --git a/utils/Makefile b/utils/Makefile
index 96e815a..3093eee 100644
--- a/utils/Makefile
+++ b/utils/Makefile
@@ -1,29 +1,31 @@
-TOPDIR ?= ..
-SRCDIR ?= $(TOPDIR)/src
-INCDIR ?= $(TOPDIR)/include
-
DESTDIR ?=
PREFIX ?= /usr/local
-CROSS_COMPILE ?=
+BINDIR ?= $(PREFIX)/bin
+MANDIR ?= $(PREFIX)/man
+CROSS_COMPILE ?=
CC = $(CROSS_COMPILE)gcc
-override CFLAGS := -Wall -Wextra -Werror -Wfatal-errors -I $(INCDIR) -L $(SRCDIR) -g -O2 $(CFLAGS)
-VPATH = $(SRCDIR)
+WARNINGS = -Wall -Wextra -Werror -Wfatal-errors
+INCLUDE_DIRS = -I ../include
+LIBRARY_DIRS = -L ../src
+override CFLAGS := $(WARNINGS) $(INCLUDE_DIRS) $(LIBRARY_DIRS) -g -O2 $(CFLAGS)
+
+VPATH = ../src:../include/tinyalsa
.PHONY: all
all: -ltinyalsa tinyplay tinycap tinymix tinypcminfo
-tinyplay: tinyplay.c -ltinyalsa
+tinyplay: tinyplay.c pcm.h mixer.h asoundlib.h -ltinyalsa
$(CC) $(CFLAGS) $< -o $@ -ltinyalsa
-tinycap: tinycap.c
+tinycap: tinycap.c pcm.h mixer.h asoundlib.h
$(CC) $(CFLAGS) $< -o $@ -ltinyalsa
-tinymix: tinymix.c
+tinymix: tinymix.c pcm.h mixer.h asoundlib.h
$(CC) $(CFLAGS) $< -o $@ -ltinyalsa
-tinypcminfo: tinypcminfo.c
+tinypcminfo: tinypcminfo.c pcm.h mixer.h asoundlib.h
$(CC) $(CFLAGS) $< -o $@ -ltinyalsa
.PHONY: clean
@@ -34,9 +36,14 @@ clean:
.PHONY: install
install: tinyplay tinycap tinymix tinypcminfo
- mkdir -p $(DESTDIR)$(PREFIX)/bin
- cp -u tinyplay $(DESTDIR)$(PREFIX)/bin/
- cp -u tinycap $(DESTDIR)$(PREFIX)/bin/
- cp -u tinymix $(DESTDIR)$(PREFIX)/bin/
- cp -u tinypcminfo $(DESTDIR)$(PREFIX)/bin/
+ mkdir -p $(DESTDIR)$(BINDIR)
+ cp -u tinyplay $(DESTDIR)$(BINDIR)/
+ cp -u tinycap $(DESTDIR)$(BINDIR)/
+ cp -u tinymix $(DESTDIR)$(BINDIR)/
+ cp -u tinypcminfo $(DESTDIR)$(BINDIR)/
+ mkdir -p $(DESTDIR)$(MANDIR)/man1
+ cp -u tinyplay.1 $(DESTDIR)$(MANDIR)/man1/
+ cp -u tinycap.1 $(DESTDIR)$(MANDIR)/man1/
+ cp -u tinymix.1 $(DESTDIR)$(MANDIR)/man1/
+ cp -u tinypcminfo.1 $(DESTDIR)$(MANDIR)/man1/
diff --git a/utils/tinycap.1 b/utils/tinycap.1
new file mode 100644
index 0000000..ad60a2e
--- /dev/null
+++ b/utils/tinycap.1
@@ -0,0 +1,87 @@
+.TH TINYCAP 1 "October 2, 2016" "tinycap" "TinyALSA"
+
+.SH NAME
+tinycap \- captures audio from an audio device
+
+.SH SYNOPSIS
+.B tinycap\fR [ \fIfile\fR ] [ \fIoptions\fR ]
+
+.SH Description
+
+\fBtinycap\fR can record audio from an audio device to a wav file or standard output (as raw samples).
+Options can be used to specify various hardware parameters to open the PCM with.
+
+.SH OPTIONS
+
+.TP
+\fB\-D\fR \fIcard\fR
+Card number of the PCM.
+The default is 0.
+
+.TP
+\fB\-d\fR \fIdevice\fR
+Device number of the PCM.
+The default is 0.
+
+.TP
+\fB\-c\fR \fIchannels\fR
+Number of channels the PCM will have.
+The default is 2.
+
+.TP
+\fB\-r\fR \fIrate\fR
+Number of frames per second of the PCM.
+The default is 48000.
+
+.TP
+\fB\-b\fR \fIbits\fR
+Number of bits per sample the PCM will have.
+The default is 32.
+
+.TP
+\fB\-p\fR \fIperiod_size\fR
+Number of frames in a period.
+The default is 1024.
+
+.TP
+\fB\-n\fR \fIperiods\fR
+Number of periods the PCM will have.
+The default is 4.
+
+.TP
+\fB\-t\fR \fIseconds\fR
+Number of seconds to record audio.
+
+.SH SIGNALS
+
+When capturing audio, SIGINT will stop the recording and close the file.
+
+.SH EXAMPLES
+
+.TP
+\fBtinycap output.wav\fR
+Records a file called output.wav until an interrupt signal is caught.
+
+.TP
+\fBtinycap output.wav -D 1 -t 2
+Records a file called output.wav from card 1 for two seconds or until an interrupt signal is caught.
+
+.TP
+\fBtinycap -- -t 3
+Records to standard output for three seconds or until an interrupt signal is caught.
+
+.SH BUGS
+
+Please report bugs to https://github.com/tinyalsa/tinyalsa/issues.
+
+.SH SEE ALSO
+
+.BR tinyplay(1),
+.BR tinymix(1),
+.BR tinypcminfo(1)
+
+.SH AUTHORS
+Simon Wilson
+.P
+For a complete list of authors, visit the project page at https://github.com/tinyalsa/tinyalsa.
+
diff --git a/utils/tinycap.c b/utils/tinycap.c
index 61d6b62..503b118 100644
--- a/utils/tinycap.c
+++ b/utils/tinycap.c
@@ -78,7 +78,7 @@ int main(int argc, char **argv)
unsigned int card = 0;
unsigned int device = 0;
unsigned int channels = 2;
- unsigned int rate = 44100;
+ unsigned int rate = 48000;
unsigned int bits = 16;
unsigned int frames;
unsigned int period_size = 1024;
diff --git a/utils/tinymix.1 b/utils/tinymix.1
new file mode 100644
index 0000000..35f86ba
--- /dev/null
+++ b/utils/tinymix.1
@@ -0,0 +1,59 @@
+.TH TINYMIX 1 "October 2, 2016" "tinymix" "TinyALSA"
+
+.SH NAME
+tinymix \- view and edit mixer controls for a specified mixer.
+
+.SH SYNOPSIS
+.B tinymix\fR [ \fIoptions\fR ] [ \fIcontrol-id\fR ] [ \fIcontrol-value\fR ]
+
+.SH Description
+
+\fBtinymix\fR can be used to view and/or edit a list of mixer controls for a specified mixer.
+Running \fBtinymix\fR with no arguments will print a list of mixer controls for the default mixer.
+With one argument, the argument is interpreted as a control ID and detailed information for that control is printed.
+With two arguments, the arguments are interpreted as a control ID and value pair, setting the control to the value specified.
+
+.SH OPTIONS
+
+.TP
+\fB\-D\fR \fIcard\fR
+Card number of the mixer.
+The default is 0.
+
+.SH EXAMPLES
+
+.TP
+\fBtinymix\fR
+Prints a list of control IDs for the mixer of card 0.
+
+.TP
+\fBtinymix -D 1\fR
+Prints a list of control IDs for the mixer of card 1.
+
+.TP
+\fBtinymix 0\fR
+Prints default information about control 0.
+
+.TP
+\fBtinymix 0 4\fR
+Sets control 0 to the value of 4.
+
+.TP
+\fBtinymix -D 1 2 32
+Sets control 2 of card 1 to the value of 32.
+
+.SH BUGS
+
+Please report bugs to https://github.com/tinyalsa/tinyalsa/issues.
+
+.SH SEE ALSO
+
+.BR tinycap(1),
+.BR tinyplay(1),
+.BR tinypcminfo(1)
+
+.SH AUTHORS
+Simon Wilson
+.P
+For a complete list of authors, visit the project page at https://github.com/tinyalsa/tinyalsa.
+
diff --git a/utils/tinymix.c b/utils/tinymix.c
index 5966df9..f57238a 100644
--- a/utils/tinymix.c
+++ b/utils/tinymix.c
@@ -65,15 +65,14 @@ int main(int argc, char **argv)
}
+ printf("Mixer name: '%s'\n", mixer_get_name(mixer));
+ tinymix_list_controls(mixer);
if (argc == 1) {
- printf("Mixer name: '%s'\n", mixer_get_name(mixer));
- tinymix_list_controls(mixer);
+ printf("Usage: tinymix [-D card] [control id] [value to set]\n");
} else if (argc == 2) {
tinymix_detail_control(mixer, argv[1], 1);
} else if (argc >= 3) {
tinymix_set_value(mixer, argv[1], &argv[2], argc - 2);
- } else {
- printf("Usage: tinymix [-D card] [control id] [value to set]\n");
}
mixer_close(mixer);
diff --git a/utils/tinypcminfo.1 b/utils/tinypcminfo.1
new file mode 100644
index 0000000..bcbcf96
--- /dev/null
+++ b/utils/tinypcminfo.1
@@ -0,0 +1,57 @@
+.TH TINYPCMINFO 1 "October 2, 2016" "tinypcminfo" "TinyALSA"
+
+.SH NAME
+tinypcminfo \- prints the hardware parameters of a PCM.
+
+.SH SYNOPSIS
+.B tinypcminfo\fR [ \fIoptions\fR ]
+
+.SH Description
+
+\fBtinypcminfo\fR prints the hardware parameters of a PCM, specified by it's card and device number.
+
+.SH OPTIONS
+
+.TP
+\fB\-D\fR \fIcard\fR
+Card number of the PCM.
+The default is 0.
+
+.TP
+\fB\-d\fR \fIdevice\fR
+Device number of the PCM.
+The default is 0.
+
+.SH EXAMPLES
+
+.TP
+\fBtinypcminfo\fR
+Prints hardware parameters for the PCM of card 0 and device 0.
+
+.TP
+\fBtinypcminfo -D 1
+Prints hardware parameters for the PCM of card 1 and device 0.
+
+.TP
+\fBtinypcminfo -d 1
+Prints hardware parameters for the PCM of card 0 and device 1.
+
+.TP
+\fBtinypcminfo -D 1 -d 1
+Prints hardware parameters for the PCM of card 1 and device 1.
+
+.SH BUGS
+
+Please report bugs to https://github.com/tinyalsa/tinyalsa/issues.
+
+.SH SEE ALSO
+
+.BR tinycap(1),
+.BR tinyplay(1),
+.BR tinymix(1)
+
+.SH AUTHORS
+Simon Wilson
+.P
+For a complete list of authors, visit the project page at https://github.com/tinyalsa/tinyalsa.
+
diff --git a/utils/tinypcminfo.c b/utils/tinypcminfo.c
index 4eb0afa..5b8db1f 100644
--- a/utils/tinypcminfo.c
+++ b/utils/tinypcminfo.c
@@ -103,7 +103,7 @@ int main(int argc, char **argv)
unsigned int card = 0;
int i;
- if (argc < 3) {
+ if ((argc == 2) && (strcmp(argv[1], "--help") == 0)) {
fprintf(stderr, "Usage: %s -D card -d device\n", argv[0]);
return 1;
}
diff --git a/utils/tinyplay.1 b/utils/tinyplay.1
new file mode 100644
index 0000000..bfd81be
--- /dev/null
+++ b/utils/tinyplay.1
@@ -0,0 +1,93 @@
+.TH TINYPLAY 1 "October 2, 2016" "tinyplay" "TinyALSA"
+
+.SH NAME
+tinyplay \- sends audio to an audio device
+
+.SH SYNOPSIS
+.B tinyplay\fR \fIfile\fR [ \fIoptions\fR ]
+
+.SH Description
+
+\fBtinyplay\fR can send audio to an audio device from a wav file or standard input (as raw samples).
+Options can be used to specify various hardware parameters to open the PCM with.
+
+.SH OPTIONS
+
+.TP
+\fB\-D\fR \fIcard\fR
+Card number of the PCM.
+The default is 0.
+
+.TP
+\fB\-d\fR \fIdevice\fR
+Device number of the PCM.
+The default is 0.
+
+.TP
+\fB\-c\fR \fIchannels\fR
+Number of channels the PCM will have.
+This option is only valid for raw file types.
+The default is 2 for raw file types.
+
+.TP
+\fB\-r\fR \fIrate\fR
+Number of frames per second of the PCM.
+This option is only valid for raw file types.
+The default is 48000 for raw file types.
+
+.TP
+\fB\-i\fR \fIfile-type\fR
+The file type used for playback.
+Available types are \fIraw\fR and \fIwav\fR.
+Specifying \fIraw\fR means that \fIchannels\fR, \fIrate\fR and \fIbits\fR may have to be specified as well.
+The default is \fIwav\fR.
+
+.TP
+\fB\-b\fR \fIbits\fR
+Number of bits per sample the PCM will have.
+This option is only valid for raw file types.
+The default is 16 for raw file types.
+
+.TP
+\fB\-p\fR \fIperiod_size\fR
+Number of frames in a period.
+The default is 1024.
+
+.TP
+\fB\-n\fR \fIperiods\fR
+Number of periods the PCM will have.
+The default is 4.
+
+.SH SIGNALS
+
+When playing audio, SIGINT will stop the playback and close the file.
+
+.SH EXAMPLES
+
+.TP
+\fBtinyplay output.wav\fR
+Plays a file called output.wav.
+
+.TP
+\fBtinyplay output.wav -D 1
+Plays a file called output.wav on card 1.
+
+.TP
+\fBtinyplay output.raw -i raw --channels 2 --rate 44100 --bits 32
+Plays a raw audio file called output.raw; using 2 channels, 44100 frames per second and 32 bits per sample.
+
+.SH BUGS
+
+Please report bugs to https://github.com/tinyalsa/tinyalsa/issues.
+
+.SH SEE ALSO
+
+.BR tinycap(1),
+.BR tinymix(1),
+.BR tinypcminfo(1)
+
+.SH AUTHORS
+Simon Wilson
+.P
+For a complete list of authors, visit the project page at https://github.com/tinyalsa/tinyalsa.
+
diff --git a/utils/tinyplay.c b/utils/tinyplay.c
index cca8223..1c4e23f 100644
--- a/utils/tinyplay.c
+++ b/utils/tinyplay.c
@@ -146,6 +146,12 @@ int main(int argc, char **argv)
if (*argv) {
if (strcasecmp(*argv, "raw") == 0) {
is_raw = 1;
+ } else if (strcasecmp(*argv, "wav") == 0) {
+ is_raw = 0;
+ } else {
+ fprintf(stderr, "Error: file type '%s' not supported\n", *argv);
+ fclose(file);
+ return 1;
}
}
}