diff options
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | Makefile | 17 | ||||
-rw-r--r-- | NOTICE | 23 | ||||
-rw-r--r-- | README.md | 1 | ||||
-rw-r--r-- | debian/changelog | 13 | ||||
-rw-r--r-- | debian/control | 12 | ||||
-rw-r--r-- | debian/copyright | 41 | ||||
-rw-r--r-- | debian/libtinyalsa.install.in | 2 | ||||
-rwxr-xr-x | debian/rules | 5 | ||||
-rw-r--r-- | debian/tinyalsa.install | 6 | ||||
-rw-r--r-- | doxygen/Makefile | 7 | ||||
-rw-r--r-- | src/Makefile | 42 | ||||
-rw-r--r-- | utils/Makefile | 39 | ||||
-rw-r--r-- | utils/tinycap.1 | 87 | ||||
-rw-r--r-- | utils/tinycap.c | 2 | ||||
-rw-r--r-- | utils/tinymix.1 | 59 | ||||
-rw-r--r-- | utils/tinymix.c | 7 | ||||
-rw-r--r-- | utils/tinypcminfo.1 | 57 | ||||
-rw-r--r-- | utils/tinypcminfo.c | 2 | ||||
-rw-r--r-- | utils/tinyplay.1 | 93 | ||||
-rw-r--r-- | utils/tinyplay.c | 6 |
21 files changed, 462 insertions, 60 deletions
@@ -3,6 +3,7 @@ doxygen/man *.o *.so +*.so.* *.a utils/tinyplay utils/tinycap @@ -1,11 +1,14 @@ -export TOPDIR = $(shell pwd) -export SRCDIR = $(TOPDIR)/src -export INCDIR = $(TOPDIR)/include - export DESTDIR ?= export PREFIX ?= /usr/local export CROSS_COMPILE = +export INCDIR ?= $(PREFIX)/include +export LIBDIR ?= $(PREFIX)/lib +export BINDIR ?= $(PREFIX)/bin +export MANDIR ?= $(PREFIX)/share/man + +INCDIR ?= $(PREFIX)/include + .PHONY: all all: $(MAKE) -C src @@ -19,9 +22,9 @@ clean: $(MAKE) -C doxygen clean .PHONY: install -install: $(LIB) $(SHLIB) - mkdir -p $(DESTDIR)$(PREFIX)/include - cp -Ru $(INCDIR)/tinyalsa $(DESTDIR)$(PREFIX)/include/ +install: + mkdir -p $(DESTDIR)$(INCDIR)/tinyalsa + cp -Ru include/tinyalsa $(DESTDIR)$(INCDIR)/ $(MAKE) -C src install $(MAKE) -C utils install $(MAKE) -C doxygen install @@ -0,0 +1,23 @@ +Copyright 2011, The Android Open Source Project +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of The Android Open Source Project nor the names of + its contributors may be used to endorse or promote products derived + from this software without specific prior written permission. +THIS SOFTWARE IS PROVIDED BY The Android Open Source Project ``AS IS'' AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL The Android Open Source Project BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH +DAMAGE. + @@ -20,6 +20,7 @@ To build and install with Make, run the commands: ``` make sudo make install +sudo ldconfig ``` ### Installing diff --git a/debian/changelog b/debian/changelog index 0520a23..851ac70 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,16 @@ +tinyalsa (1.0.2) xenial; urgency=medium + + * Removed install of libtinyalsa.so in package libtinyalsa + + -- Taylor Holberton <taylorcholberton@gmail.com> Sun, 02 Oct 2016 13:46:33 -0400 + +tinyalsa (1.0.1) xenial; urgency=medium + + * Added man pages for tinycap, tinyplay, tinymix and tinypcminfo. + * Fixed overwrite of shared library in package libtinyalsa-dev + + -- Taylor Holberton <taylorcholberton@gmail.com> Sun, 02 Oct 2016 12:24:28 -0400 + tinyalsa (1.0.0) xenial; urgency=medium * Initial debian release. diff --git a/debian/control b/debian/control index 45b53f8..50172c1 100644 --- a/debian/control +++ b/debian/control @@ -2,9 +2,10 @@ Source: tinyalsa Section: sound Priority: optional Maintainer: Taylor Holberton <taylorcholberton@gmail.com> -Build-Depends: debhelper, build-essential, doxygen +Build-Depends: debhelper, doxygen Vcs-Git: git://github.com/tinyalsa/tinyalsa Vcs-Browser: https://github.com/tinyalsa/tinyalsa +Standards-Version: 3.9.7 Package: tinyalsa Architecture: any @@ -13,17 +14,24 @@ Depends: libtinyalsa (= ${binary:Version}), ${misc:Depends}, ${shlibs:Depends} Description: A collection of small programs to interface with ALSA in the Linux kernel. + TinyALSA is a lightweight interface to ALSA in the Linux kernel. Package: libtinyalsa Architecture: any Multi-Arch: same Section: libs +Depends: ${misc:Depends}, + ${shlibs:Depends} Description: A small C library for interfacing with ALSA in the Linux kernel. + The TinyALSA library is a lightweight, bare metal version of the ALSA library. Package: libtinyalsa-dev Architecture: any Multi-Arch: same Section: libdevel -Depends: libtinyalsa +Depends: libtinyalsa, + ${misc:Depends}, + ${shlibs:Depends} Description: Development files for the TinyALSA library. + The TinyALSA library is a lightweight, bare metal version of the ALSA library. diff --git a/debian/copyright b/debian/copyright new file mode 100644 index 0000000..6ae2c37 --- /dev/null +++ b/debian/copyright @@ -0,0 +1,41 @@ +Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ +Upstream-Name: tinyalsa +Source: https://github.com/tinyalsa/tinyalsa + +Files: * +Copyright: 2016 Simon Wilson +License: BSD-3-Clause + +Files: debian/* +Copyright: 2016 Taylor Holberton <taylorcholberton@gmail.com> +License: BSD-3-Clause + +License: BSD-3-Clause + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + 3. Neither the name of the Android Open Source Project nor the names of + its contributors may be used to endorse or promote products derived + from this software without specific prior written permission. + . + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE HOLDERS OR + CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +# Please also look if there are files or directories which have a +# different copyright/license attached and list them here. +# Please avoid picking licenses with terms that are more restrictive than the +# packaged work, as it may make Debian's contributions unacceptable upstream. diff --git a/debian/libtinyalsa.install.in b/debian/libtinyalsa.install.in index a6a288e..a9ec3d3 100644 --- a/debian/libtinyalsa.install.in +++ b/debian/libtinyalsa.install.in @@ -1 +1 @@ -debian/tmp/usr/lib/@DEB_HOST_MULTIARCH@/*.so usr/lib/@DEB_HOST_MULTIARCH@/ +debian/tmp/usr/lib/@DEB_HOST_MULTIARCH@/*.so.* usr/lib/@DEB_HOST_MULTIARCH@/ diff --git a/debian/rules b/debian/rules index 07f8f21..92623f9 100755 --- a/debian/rules +++ b/debian/rules @@ -4,6 +4,7 @@ #DH_VERBOSE = 1 DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH) +export DEB_HOST_MULTIARCH PREPROCESS_FILES := $(wildcard debian/*.in) @@ -15,10 +16,6 @@ override_dh_auto_clean: dh_auto_clean rm -rf $(PREPROCESS_FILES:.in=) -.PHONY: override_dh_shlibdeps -override_dh_shlibdeps: - dh_shlibdeps -l$(shell pwd)/src - .PHONY: override_dh_auto_install override_dh_auto_install: $(PREPROCESS_FILES:.in=) dh_auto_install -- PREFIX=/usr diff --git a/debian/tinyalsa.install b/debian/tinyalsa.install index da0bd3b..438db01 100644 --- a/debian/tinyalsa.install +++ b/debian/tinyalsa.install @@ -1,4 +1,8 @@ debian/tmp/usr/bin/tinyplay usr/bin/ debian/tmp/usr/bin/tinycap usr/bin/ -debian/tmp/usr/bin/tinypcminfo usr/bin/ debian/tmp/usr/bin/tinymix usr/bin/ +debian/tmp/usr/bin/tinypcminfo usr/bin/ +debian/tmp/usr/share/man/man1/tinyplay.1 usr/share/man/man1/ +debian/tmp/usr/share/man/man1/tinycap.1 usr/share/man/man1/ +debian/tmp/usr/share/man/man1/tinymix.1 usr/share/man/man1/ +debian/tmp/usr/share/man/man1/tinypcminfo.1 usr/share/man/man1/ diff --git a/doxygen/Makefile b/doxygen/Makefile index fb75c02..5f8c5c0 100644 --- a/doxygen/Makefile +++ b/doxygen/Makefile @@ -1,5 +1,6 @@ DESTDIR ?= PREFIX ?= /usr/local +MANDIR ?= $(PREFIX)/share/man DOXYGEN ?= doxygen DOXYGENFLAGS = @@ -15,7 +16,7 @@ clean: .PHONY: install install: - mkdir -p $(DESTDIR)$(PREFIX)/share/man/man3 - cp -u man/man3/tinyalsa-pcm.3 $(DESTDIR)$(PREFIX)/share/man/man3 - cp -u man/man3/tinyalsa-mixer.3 $(DESTDIR)$(PREFIX)/share/man/man3 + mkdir -p $(DESTDIR)$(MANDIR)/man3 + cp -u man/man3/tinyalsa-pcm.3 $(DESTDIR)$(MANDIR)/man3 + cp -u man/man3/tinyalsa-mixer.3 $(DESTDIR)$(MANDIR)/man3 diff --git a/src/Makefile b/src/Makefile index 50a692f..4c392cd 100644 --- a/src/Makefile +++ b/src/Makefile @@ -1,45 +1,47 @@ -TOPDIR ?= .. -INCDIR ?= $(TOPDIR)/include - -DEB_HOST_MULTIARCH := $(shell dpkg-architecture -qDEB_HOST_MULTIARCH) - DESTDIR ?= PREFIX ?= /usr/local -CROSS_COMPILE = +INCDIR ?= $(PREFIX)/include +LIBDIR ?= $(PREFIX)/lib +BINDIR ?= $(PREFIX)/bin +ifdef DEB_HOST_MULTIARCH +LIBDIR := $(LIBDIR)/$(DEB_HOST_MULTIARCH) +endif +CROSS_COMPILE = CC = $(CROSS_COMPILE)gcc -override CFLAGS := -Wall -Wextra -Werror -Wfatal-errors -I $(INCDIR) -fPIC $(CFLAGS) - AR = $(CROSS_COMPILE)ar -ARFLAGS = rcs - LD = $(CROSS_COMPILE)gcc -LDFLAGS = +WARNINGS = -Wall -Wextra -Werror -Wfatal-errors +INCLUDE_DIRS = -I ../include +override CFLAGS := $(WARNINGS) $(INCLUDE_DIRS) -fPIC $(CFLAGS) + +VPATH = ../include/tinyalsa OBJECTS = mixer.o pcm.o .PHONY: all -all: libtinyalsa.a libtinyalsa.so +all: libtinyalsa.a libtinyalsa.so.1 -pcm.o: pcm.c $(INCDIR)/tinyalsa/pcm.h +pcm.o: pcm.c pcm.h -mixer.o: mixer.c $(INCDIR)/tinyalsa/mixer.h +mixer.o: mixer.c mixer.h libtinyalsa.a: $(OBJECTS) $(AR) $(ARFLAGS) $@ $^ -libtinyalsa.so: $(OBJECTS) +libtinyalsa.so.1: $(OBJECTS) $(LD) $(LDFLAGS) -shared $^ -o $@ .PHONY: clean clean: rm -f libtinyalsa.a - rm -f libtinyalsa.so + rm -f libtinyalsa.so.1 rm -f $(OBJECTS) .PHONY: install -install: libtinyalsa.a libtinyalsa.so - mkdir -p $(DESTDIR)$(PREFIX)/lib/$(DEB_HOST_MULTIARCH) - cp -u libtinyalsa.a $(DESTDIR)$(PREFIX)/lib/$(DEB_HOST_MULTIARCH) - cp -u libtinyalsa.so $(DESTDIR)$(PREFIX)/lib/$(DEB_HOST_MULTIARCH) +install: libtinyalsa.a libtinyalsa.so.1 + mkdir -p $(DESTDIR)$(LIBDIR)/ + ln -sf libtinyalsa.so.1 $(DESTDIR)$(LIBDIR)/libtinyalsa.so + cp -u libtinyalsa.a $(DESTDIR)$(LIBDIR)/ + cp -u libtinyalsa.so.1 $(DESTDIR)$(LIBDIR)/ 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; } } } |