From a9274bb987651b79ec0c3a597154f1a4e1b1e184 Mon Sep 17 00:00:00 2001 From: Packit Service Date: Dec 09 2020 07:36:27 +0000 Subject: alsa-utils-1.2.4 base --- diff --git a/ABOUT-NLS b/ABOUT-NLS new file mode 100644 index 0000000..3cc8286 --- /dev/null +++ b/ABOUT-NLS @@ -0,0 +1,1379 @@ +1 Notes on the Free Translation Project +*************************************** + +Free software is going international! The Free Translation Project is a +way to get maintainers of free software, translators, and users all +together, so that free software will gradually become able to speak many +languages. A few packages already provide translations for their +messages. + + If you found this 'ABOUT-NLS' file inside a distribution, you may +assume that the distributed package does use GNU 'gettext' internally, +itself available at your nearest GNU archive site. But you do _not_ +need to install GNU 'gettext' prior to configuring, installing or using +this package with messages translated. + + Installers will find here some useful hints. These notes also +explain how users should proceed for getting the programs to use the +available translations. They tell how people wanting to contribute and +work on translations can contact the appropriate team. + +1.1 INSTALL Matters +=================== + +Some packages are "localizable" when properly installed; the programs +they contain can be made to speak your own native language. Most such +packages use GNU 'gettext'. Other packages have their own ways to +internationalization, predating GNU 'gettext'. + + By default, this package will be installed to allow translation of +messages. It will automatically detect whether the system already +provides the GNU 'gettext' functions. Installers may use special +options at configuration time for changing the default behaviour. The +command: + + ./configure --disable-nls + +will _totally_ disable translation of messages. + + When you already have GNU 'gettext' installed on your system and run +configure without an option for your new package, 'configure' will +probably detect the previously built and installed 'libintl' library and +will decide to use it. If not, you may have to to use the +'--with-libintl-prefix' option to tell 'configure' where to look for it. + + Internationalized packages usually have many 'po/LL.po' files, where +LL gives an ISO 639 two-letter code identifying the language. Unless +translations have been forbidden at 'configure' time by using the +'--disable-nls' switch, all available translations are installed +together with the package. However, the environment variable 'LINGUAS' +may be set, prior to configuration, to limit the installed set. +'LINGUAS' should then contain a space separated list of two-letter +codes, stating which languages are allowed. + +1.2 Using This Package +====================== + +As a user, if your language has been installed for this package, you +only have to set the 'LANG' environment variable to the appropriate +'LL_CC' combination. If you happen to have the 'LC_ALL' or some other +'LC_xxx' environment variables set, you should unset them before setting +'LANG', otherwise the setting of 'LANG' will not have the desired +effect. Here 'LL' is an ISO 639 two-letter language code, and 'CC' is +an ISO 3166 two-letter country code. For example, let's suppose that +you speak German and live in Germany. At the shell prompt, merely +execute 'setenv LANG de_DE' (in 'csh'), 'export LANG; LANG=de_DE' (in +'sh') or 'export LANG=de_DE' (in 'bash'). This can be done from your +'.login' or '.profile' file, once and for all. + + You might think that the country code specification is redundant. +But in fact, some languages have dialects in different countries. For +example, 'de_AT' is used for Austria, and 'pt_BR' for Brazil. The +country code serves to distinguish the dialects. + + The locale naming convention of 'LL_CC', with 'LL' denoting the +language and 'CC' denoting the country, is the one use on systems based +on GNU libc. On other systems, some variations of this scheme are used, +such as 'LL' or 'LL_CC.ENCODING'. You can get the list of locales +supported by your system for your language by running the command +'locale -a | grep '^LL''. + + Not all programs have translations for all languages. By default, an +English message is shown in place of a nonexistent translation. If you +understand other languages, you can set up a priority list of languages. +This is done through a different environment variable, called +'LANGUAGE'. GNU 'gettext' gives preference to 'LANGUAGE' over 'LANG' +for the purpose of message handling, but you still need to have 'LANG' +set to the primary language; this is required by other parts of the +system libraries. For example, some Swedish users who would rather read +translations in German than English for when Swedish is not available, +set 'LANGUAGE' to 'sv:de' while leaving 'LANG' to 'sv_SE'. + + Special advice for Norwegian users: The language code for Norwegian +bokma*l changed from 'no' to 'nb' recently (in 2003). During the +transition period, while some message catalogs for this language are +installed under 'nb' and some older ones under 'no', it's recommended +for Norwegian users to set 'LANGUAGE' to 'nb:no' so that both newer and +older translations are used. + + In the 'LANGUAGE' environment variable, but not in the 'LANG' +environment variable, 'LL_CC' combinations can be abbreviated as 'LL' to +denote the language's main dialect. For example, 'de' is equivalent to +'de_DE' (German as spoken in Germany), and 'pt' to 'pt_PT' (Portuguese +as spoken in Portugal) in this context. + +1.3 Translating Teams +===================== + +For the Free Translation Project to be a success, we need interested +people who like their own language and write it well, and who are also +able to synergize with other translators speaking the same language. +Each translation team has its own mailing list. The up-to-date list of +teams can be found at the Free Translation Project's homepage, +'http://translationproject.org/', in the "Teams" area. + + If you'd like to volunteer to _work_ at translating messages, you +should become a member of the translating team for your own language. +The subscribing address is _not_ the same as the list itself, it has +'-request' appended. For example, speakers of Swedish can send a +message to 'sv-request@li.org', having this message body: + + subscribe + + Keep in mind that team members are expected to participate _actively_ +in translations, or at solving translational difficulties, rather than +merely lurking around. If your team does not exist yet and you want to +start one, or if you are unsure about what to do or how to get started, +please write to 'coordinator@translationproject.org' to reach the +coordinator for all translator teams. + + The English team is special. It works at improving and uniformizing +the terminology in use. Proven linguistic skills are praised more than +programming skills, here. + +1.4 Available Packages +====================== + +Languages are not equally supported in all packages. The following +matrix shows the current state of internationalization, as of Jun 2014. +The matrix shows, in regard of each package, for which languages PO +files have been submitted to translation coordination, with a +translation percentage of at least 50%. + + Ready PO files af am an ar as ast az be bg bn bn_IN bs ca crh cs + +---------------------------------------------------+ + a2ps | [] [] [] | + aegis | | + anubis | | + aspell | [] [] [] | + bash | [] [] [] | + bfd | | + binutils | [] | + bison | | + bison-runtime | [] | + buzztrax | [] | + ccd2cue | | + ccide | | + cflow | | + clisp | | + coreutils | [] [] | + cpio | | + cppi | | + cpplib | [] | + cryptsetup | [] | + datamash | | + denemo | [] [] | + dfarc | [] | + dialog | [] [] [] | + dico | | + diffutils | [] | + dink | [] | + direvent | | + doodle | [] | + dos2unix | | + dos2unix-man | | + e2fsprogs | [] [] | + enscript | [] | + exif | [] | + fetchmail | [] [] | + findutils | [] | + flex | [] | + freedink | [] [] | + fusionforge | | + gas | | + gawk | [] | + gcal | [] | + gcc | | + gdbm | | + gettext-examples | [] [] [] [] [] | + gettext-runtime | [] [] [] | + gettext-tools | [] [] | + gjay | | + glunarclock | [] [] [] | + gnubiff | [] | + gnubik | [] | + gnucash | () () [] | + gnuchess | | + gnulib | [] | + gnunet | | + gnunet-gtk | | + gold | | + gphoto2 | [] | + gprof | [] | + gramadoir | | + grep | [] [] [] | + grub | [] | + gsasl | | + gss | | + gst-plugins-bad | [] [] | + gst-plugins-base | [] [] [] | + gst-plugins-good | [] [] [] | + gst-plugins-ugly | [] [] [] | + gstreamer | [] [] [] [] | + gtick | [] | + gtkam | [] [] | + gtkspell | [] [] [] [] [] | + guix | | + guix-packages | | + gutenprint | [] | + hello | [] | + help2man | | + help2man-texi | | + hylafax | | + idutils | | + iso_15924 | [] | + iso_3166 | [] [] [] [] [] [] [] [] [] [] | + iso_3166_2 | | + iso_4217 | [] | + iso_639 | [] [] [] [] [] [] [] [] [] | + iso_639_3 | [] [] | + iso_639_5 | | + jwhois | | + kbd | [] | + klavaro | [] [] [] [] [] | + ld | [] | + leafpad | [] [] [] [] | + libc | [] [] [] | + libexif | () | + libextractor | | + libgnutls | [] | + libgphoto2 | [] | + libgphoto2_port | [] | + libgsasl | | + libiconv | [] [] | + libidn | [] | + liferea | [] [] [] [] | + lilypond | [] [] | + lordsawar | [] | + lprng | | + lynx | [] [] | + m4 | [] | + mailfromd | | + mailutils | | + make | [] | + man-db | [] [] | + man-db-manpages | | + midi-instruments | [] [] [] | + minicom | [] | + mkisofs | [] | + myserver | [] | + nano | [] [] [] | + opcodes | | + parted | [] | + pies | | + pnmixer | | + popt | [] | + procps-ng | | + procps-ng-man | | + psmisc | [] | + pspp | [] | + pushover | [] | + pwdutils | | + pyspread | | + radius | [] | + recode | [] [] [] | + recutils | | + rpm | | + rush | | + sarg | | + sed | [] [] [] [] | + sharutils | [] | + shishi | | + skribilo | | + solfege | [] [] | + solfege-manual | | + spotmachine | | + sudo | [] [] | + sudoers | [] [] | + sysstat | [] | + tar | [] [] [] | + texinfo | [] [] | + texinfo_document | [] [] | + tigervnc | [] | + tin | | + tin-man | | + tracgoogleappsa... | | + trader | | + util-linux | [] | + ve | | + vice | | + vmm | | + vorbis-tools | [] | + wastesedge | | + wcd | | + wcd-man | | + wdiff | [] [] | + wget | [] | + wyslij-po | | + xboard | | + xdg-user-dirs | [] [] [] [] [] [] [] [] [] [] | + xkeyboard-config | [] [] [] | + +---------------------------------------------------+ + af am an ar as ast az be bg bn bn_IN bs ca crh cs + 4 0 2 5 3 11 0 8 25 3 3 1 55 4 74 + + da de el en en_GB en_ZA eo es et eu fa fi fr + +--------------------------------------------------+ + a2ps | [] [] [] [] [] [] [] [] [] | + aegis | [] [] [] [] | + anubis | [] [] [] [] [] | + aspell | [] [] [] [] [] [] [] | + bash | [] [] [] | + bfd | [] [] [] [] | + binutils | [] [] [] | + bison | [] [] [] [] [] [] [] [] | + bison-runtime | [] [] [] [] [] [] [] [] | + buzztrax | [] [] [] [] | + ccd2cue | [] [] [] [] | + ccide | [] [] [] [] [] [] | + cflow | [] [] [] [] [] | + clisp | [] [] [] [] [] | + coreutils | [] [] [] [] [] | + cpio | [] [] [] [] [] | + cppi | [] [] [] [] [] | + cpplib | [] [] [] [] [] [] | + cryptsetup | [] [] [] [] [] | + datamash | [] [] [] [] | + denemo | [] | + dfarc | [] [] [] [] [] [] | + dialog | [] [] [] [] [] [] [] [] [] | + dico | [] [] [] [] | + diffutils | [] [] [] [] [] [] | + dink | [] [] [] [] [] [] | + direvent | [] [] [] [] | + doodle | [] [] [] [] | + dos2unix | [] [] [] [] [] | + dos2unix-man | [] [] [] | + e2fsprogs | [] [] [] [] [] | + enscript | [] [] [] [] [] [] | + exif | [] [] [] [] [] [] | + fetchmail | [] () [] [] [] [] [] | + findutils | [] [] [] [] [] [] [] [] | + flex | [] [] [] [] [] [] | + freedink | [] [] [] [] [] [] [] [] | + fusionforge | [] [] [] | + gas | [] [] [] | + gawk | [] [] [] [] [] | + gcal | [] [] [] [] | + gcc | [] | + gdbm | [] [] [] [] [] | + gettext-examples | [] [] [] [] [] [] [] | + gettext-runtime | [] [] [] [] [] [] | + gettext-tools | [] [] [] [] [] | + gjay | [] [] [] [] | + glunarclock | [] [] [] [] [] | + gnubiff | () [] [] () | + gnubik | [] [] [] [] [] | + gnucash | [] () () () () () () | + gnuchess | [] [] [] [] | + gnulib | [] [] [] [] [] [] [] | + gnunet | [] | + gnunet-gtk | [] | + gold | [] [] [] | + gphoto2 | [] () [] [] | + gprof | [] [] [] [] [] [] | + gramadoir | [] [] [] [] [] | + grep | [] [] [] [] [] [] [] | + grub | [] [] [] [] [] | + gsasl | [] [] [] [] [] | + gss | [] [] [] [] [] | + gst-plugins-bad | [] [] [] | + gst-plugins-base | [] [] [] [] [] [] | + gst-plugins-good | [] [] [] [] [] [] [] | + gst-plugins-ugly | [] [] [] [] [] [] [] [] | + gstreamer | [] [] [] [] [] [] [] | + gtick | [] () [] [] [] | + gtkam | [] () [] [] [] [] | + gtkspell | [] [] [] [] [] [] [] [] | + guix | [] [] | + guix-packages | | + gutenprint | [] [] [] [] | + hello | [] [] [] [] [] [] [] [] | + help2man | [] [] [] [] [] [] [] | + help2man-texi | [] [] [] | + hylafax | [] [] | + idutils | [] [] [] [] [] | + iso_15924 | [] () [] [] () [] () | + iso_3166 | [] () [] [] [] [] () [] () | + iso_3166_2 | [] () () () | + iso_4217 | [] () [] [] [] () [] () | + iso_639 | [] () [] [] () [] () | + iso_639_3 | () () () | + iso_639_5 | () () () | + jwhois | [] [] [] [] [] | + kbd | [] [] [] [] [] [] | + klavaro | [] [] [] [] [] [] [] | + ld | [] [] [] [] | + leafpad | [] [] [] [] [] [] [] [] | + libc | [] [] [] [] [] | + libexif | [] [] () [] [] | + libextractor | [] | + libgnutls | [] [] [] [] | + libgphoto2 | [] () [] | + libgphoto2_port | [] () [] [] [] [] | + libgsasl | [] [] [] [] [] | + libiconv | [] [] [] [] [] [] [] | + libidn | [] [] [] [] [] | + liferea | [] () [] [] [] [] [] | + lilypond | [] [] [] [] [] [] | + lordsawar | [] [] | + lprng | | + lynx | [] [] [] [] [] [] | + m4 | [] [] [] [] [] [] | + mailfromd | [] | + mailutils | [] [] [] [] | + make | [] [] [] [] [] | + man-db | [] [] [] [] | + man-db-manpages | [] [] | + midi-instruments | [] [] [] [] [] [] [] [] [] | + minicom | [] [] [] [] [] | + mkisofs | [] [] [] | + myserver | [] [] [] [] | + nano | [] [] [] [] [] [] [] | + opcodes | [] [] [] [] [] | + parted | [] [] [] | + pies | [] | + pnmixer | [] [] | + popt | [] [] [] [] [] [] | + procps-ng | [] [] | + procps-ng-man | [] [] | + psmisc | [] [] [] [] [] [] [] | + pspp | [] [] [] | + pushover | () [] [] [] | + pwdutils | [] [] [] | + pyspread | [] [] [] | + radius | [] [] | + recode | [] [] [] [] [] [] [] | + recutils | [] [] [] [] | + rpm | [] [] [] [] [] | + rush | [] [] [] | + sarg | [] [] | + sed | [] [] [] [] [] [] [] [] | + sharutils | [] [] [] [] | + shishi | [] [] [] | + skribilo | [] [] [] | + solfege | [] [] [] [] [] [] [] [] | + solfege-manual | [] [] [] [] [] | + spotmachine | [] [] [] [] [] | + sudo | [] [] [] [] [] [] | + sudoers | [] [] [] [] [] [] | + sysstat | [] [] [] [] [] [] | + tar | [] [] [] [] [] [] [] | + texinfo | [] [] [] [] [] | + texinfo_document | [] [] [] [] | + tigervnc | [] [] [] [] [] [] | + tin | [] [] [] [] | + tin-man | [] | + tracgoogleappsa... | [] [] [] [] [] | + trader | [] [] [] [] [] [] | + util-linux | [] [] [] [] | + ve | [] [] [] [] [] | + vice | () () () | + vmm | [] [] | + vorbis-tools | [] [] [] [] | + wastesedge | [] | + wcd | [] [] [] [] | + wcd-man | [] | + wdiff | [] [] [] [] [] [] [] | + wget | [] [] [] [] [] [] | + wyslij-po | [] [] [] [] | + xboard | [] [] [] [] | + xdg-user-dirs | [] [] [] [] [] [] [] [] [] [] | + xkeyboard-config | [] [] [] [] [] [] [] | + +--------------------------------------------------+ + da de el en en_GB en_ZA eo es et eu fa fi fr + 119 131 32 1 6 0 94 95 22 13 4 102 139 + + ga gd gl gu he hi hr hu hy ia id is it ja ka kk + +-------------------------------------------------+ + a2ps | [] [] [] [] | + aegis | [] | + anubis | [] [] [] [] | + aspell | [] [] [] [] [] | + bash | [] [] [] [] | + bfd | [] [] | + binutils | [] [] [] | + bison | [] | + bison-runtime | [] [] [] [] [] [] [] [] | + buzztrax | | + ccd2cue | [] | + ccide | [] [] | + cflow | [] [] [] | + clisp | | + coreutils | [] [] | + cpio | [] [] [] [] [] [] | + cppi | [] [] [] [] [] | + cpplib | [] [] | + cryptsetup | [] | + datamash | | + denemo | [] | + dfarc | [] [] [] | + dialog | [] [] [] [] [] [] [] [] [] [] | + dico | | + diffutils | [] [] [] [] | + dink | [] | + direvent | [] | + doodle | [] [] | + dos2unix | [] [] | + dos2unix-man | | + e2fsprogs | [] [] | + enscript | [] [] [] | + exif | [] [] [] [] [] [] | + fetchmail | [] [] [] | + findutils | [] [] [] [] [] [] [] | + flex | [] | + freedink | [] [] [] [] | + fusionforge | | + gas | [] | + gawk | [] () [] | + gcal | | + gcc | | + gdbm | | + gettext-examples | [] [] [] [] [] [] [] | + gettext-runtime | [] [] [] [] [] [] [] | + gettext-tools | [] [] [] | + gjay | [] | + glunarclock | [] [] [] [] [] [] | + gnubiff | [] [] () | + gnubik | [] [] [] | + gnucash | () () () () () | + gnuchess | | + gnulib | [] [] [] [] [] | + gnunet | | + gnunet-gtk | | + gold | [] [] | + gphoto2 | [] [] [] [] | + gprof | [] [] [] [] | + gramadoir | [] [] [] | + grep | [] [] [] [] [] [] [] | + grub | [] [] [] | + gsasl | [] [] [] [] [] | + gss | [] [] [] [] [] | + gst-plugins-bad | [] [] [] | + gst-plugins-base | [] [] [] [] | + gst-plugins-good | [] [] [] [] [] [] | + gst-plugins-ugly | [] [] [] [] [] [] | + gstreamer | [] [] [] [] [] | + gtick | [] [] [] [] [] | + gtkam | [] [] [] [] [] | + gtkspell | [] [] [] [] [] [] [] [] [] [] | + guix | | + guix-packages | | + gutenprint | [] [] [] | + hello | [] [] [] [] [] | + help2man | [] [] [] | + help2man-texi | | + hylafax | [] | + idutils | [] [] | + iso_15924 | [] [] [] [] [] [] | + iso_3166 | [] [] [] [] [] [] [] [] [] [] [] [] [] | + iso_3166_2 | [] [] | + iso_4217 | [] [] [] [] [] [] | + iso_639 | [] [] [] [] [] [] [] [] [] | + iso_639_3 | [] [] | + iso_639_5 | | + jwhois | [] [] [] [] | + kbd | [] [] [] | + klavaro | [] [] [] [] [] | + ld | [] [] [] [] | + leafpad | [] [] [] [] [] [] [] () | + libc | [] [] [] [] [] | + libexif | [] | + libextractor | | + libgnutls | [] | + libgphoto2 | [] [] | + libgphoto2_port | [] [] | + libgsasl | [] [] [] [] | + libiconv | [] [] [] [] [] [] [] | + libidn | [] [] [] [] | + liferea | [] [] [] [] [] | + lilypond | [] | + lordsawar | | + lprng | [] | + lynx | [] [] [] [] | + m4 | [] [] [] [] [] | + mailfromd | | + mailutils | | + make | [] [] [] [] | + man-db | [] [] | + man-db-manpages | [] [] | + midi-instruments | [] [] [] [] [] [] [] [] [] | + minicom | [] [] [] | + mkisofs | [] [] | + myserver | [] | + nano | [] [] [] [] [] [] | + opcodes | [] [] [] | + parted | [] [] [] [] [] | + pies | | + pnmixer | [] [] | + popt | [] [] [] [] [] [] [] [] [] [] | + procps-ng | | + procps-ng-man | | + psmisc | [] [] [] [] | + pspp | [] [] | + pushover | [] | + pwdutils | [] | + pyspread | | + radius | [] | + recode | [] [] [] [] [] [] [] | + recutils | | + rpm | [] | + rush | [] | + sarg | | + sed | [] [] [] [] [] [] [] | + sharutils | | + shishi | | + skribilo | [] | + solfege | [] [] | + solfege-manual | | + spotmachine | | + sudo | [] [] [] [] | + sudoers | [] [] [] | + sysstat | [] [] [] [] | + tar | [] [] [] [] [] [] | + texinfo | [] [] [] | + texinfo_document | [] [] [] | + tigervnc | | + tin | | + tin-man | | + tracgoogleappsa... | [] [] [] [] | + trader | [] [] | + util-linux | [] | + ve | [] | + vice | () () | + vmm | | + vorbis-tools | [] [] | + wastesedge | [] | + wcd | | + wcd-man | | + wdiff | [] [] [] | + wget | [] [] [] [] | + wyslij-po | [] [] [] | + xboard | | + xdg-user-dirs | [] [] [] [] [] [] [] [] [] [] [] [] [] [] | + xkeyboard-config | [] [] [] [] [] [] | + +-------------------------------------------------+ + ga gd gl gu he hi hr hu hy ia id is it ja ka kk + 35 2 47 4 8 2 60 71 2 6 81 11 87 57 0 3 + + kn ko ku ky lg lt lv mk ml mn mr ms mt nb ne nl + +--------------------------------------------------+ + a2ps | [] [] | + aegis | [] | + anubis | [] [] [] | + aspell | [] [] | + bash | [] [] | + bfd | | + binutils | | + bison | [] | + bison-runtime | [] [] [] [] [] [] | + buzztrax | | + ccd2cue | | + ccide | [] [] | + cflow | [] | + clisp | [] | + coreutils | [] [] | + cpio | [] | + cppi | | + cpplib | [] | + cryptsetup | [] | + datamash | [] [] | + denemo | | + dfarc | [] [] | + dialog | [] [] [] [] [] [] | + dico | | + diffutils | [] [] [] | + dink | [] | + direvent | [] | + doodle | [] | + dos2unix | [] [] | + dos2unix-man | [] | + e2fsprogs | [] | + enscript | [] | + exif | [] [] [] | + fetchmail | [] | + findutils | [] [] | + flex | [] | + freedink | [] [] | + fusionforge | | + gas | | + gawk | [] | + gcal | | + gcc | | + gdbm | | + gettext-examples | [] [] [] [] [] [] | + gettext-runtime | [] [] [] | + gettext-tools | [] | + gjay | | + glunarclock | [] [] | + gnubiff | [] | + gnubik | [] [] | + gnucash | () () () () () () () [] | + gnuchess | [] [] | + gnulib | [] | + gnunet | | + gnunet-gtk | | + gold | | + gphoto2 | [] | + gprof | [] [] | + gramadoir | [] | + grep | [] [] | + grub | [] [] [] | + gsasl | [] | + gss | | + gst-plugins-bad | [] [] [] | + gst-plugins-base | [] [] [] | + gst-plugins-good | [] [] [] [] | + gst-plugins-ugly | [] [] [] [] [] | + gstreamer | [] [] [] | + gtick | [] | + gtkam | [] [] | + gtkspell | [] [] [] [] [] [] [] | + guix | | + guix-packages | | + gutenprint | [] | + hello | [] [] [] | + help2man | [] | + help2man-texi | | + hylafax | [] | + idutils | [] | + iso_15924 | () [] [] | + iso_3166 | [] [] [] () [] [] [] [] [] [] | + iso_3166_2 | () [] | + iso_4217 | () [] [] [] | + iso_639 | [] [] () [] [] [] [] | + iso_639_3 | [] () [] | + iso_639_5 | () | + jwhois | [] [] | + kbd | [] | + klavaro | [] [] | + ld | | + leafpad | [] [] [] [] [] | + libc | [] [] | + libexif | [] | + libextractor | [] | + libgnutls | [] [] | + libgphoto2 | [] | + libgphoto2_port | [] | + libgsasl | [] | + libiconv | [] [] | + libidn | [] | + liferea | [] [] [] | + lilypond | [] | + lordsawar | | + lprng | | + lynx | [] | + m4 | [] | + mailfromd | | + mailutils | | + make | [] [] | + man-db | [] | + man-db-manpages | [] | + midi-instruments | [] [] [] [] [] [] [] | + minicom | [] | + mkisofs | [] | + myserver | | + nano | [] [] [] | + opcodes | [] | + parted | [] [] | + pies | | + pnmixer | [] | + popt | [] [] [] [] [] | + procps-ng | | + procps-ng-man | | + psmisc | [] | + pspp | [] [] | + pushover | | + pwdutils | [] | + pyspread | | + radius | [] | + recode | [] [] | + recutils | [] | + rpm | [] | + rush | [] | + sarg | | + sed | [] [] | + sharutils | [] | + shishi | | + skribilo | | + solfege | [] [] | + solfege-manual | [] | + spotmachine | [] | + sudo | [] [] [] | + sudoers | [] [] [] | + sysstat | [] [] | + tar | [] [] [] | + texinfo | [] | + texinfo_document | [] | + tigervnc | [] | + tin | | + tin-man | | + tracgoogleappsa... | [] [] [] | + trader | [] | + util-linux | [] | + ve | [] | + vice | [] | + vmm | [] | + vorbis-tools | [] | + wastesedge | [] | + wcd | [] | + wcd-man | [] | + wdiff | [] | + wget | [] [] | + wyslij-po | [] | + xboard | [] | + xdg-user-dirs | [] [] [] [] [] [] [] [] [] [] [] | + xkeyboard-config | [] [] [] | + +--------------------------------------------------+ + kn ko ku ky lg lt lv mk ml mn mr ms mt nb ne nl + 5 15 4 6 0 13 23 3 3 3 4 11 2 42 1 125 + + nn or pa pl ps pt pt_BR ro ru rw sk sl sq sr + +------------------------------------------------+ + a2ps | [] [] [] [] [] [] [] | + aegis | [] [] | + anubis | [] [] [] | + aspell | [] [] [] [] [] [] [] | + bash | [] [] [] [] [] [] | + bfd | [] [] | + binutils | [] [] | + bison | [] [] [] | + bison-runtime | [] [] [] [] [] [] [] [] | + buzztrax | [] | + ccd2cue | [] [] | + ccide | [] [] [] | + cflow | [] [] [] | + clisp | [] | + coreutils | [] [] [] [] | + cpio | [] [] [] | + cppi | [] [] [] | + cpplib | [] [] [] | + cryptsetup | [] [] [] | + datamash | [] [] | + denemo | | + dfarc | [] [] [] | + dialog | [] [] [] [] [] [] [] | + dico | [] | + diffutils | [] [] [] | + dink | | + direvent | [] [] [] | + doodle | [] [] | + dos2unix | [] [] [] [] | + dos2unix-man | [] [] | + e2fsprogs | [] | + enscript | [] [] [] [] [] [] | + exif | [] [] [] [] [] [] | + fetchmail | [] [] [] | + findutils | [] [] [] [] [] [] | + flex | [] [] [] [] [] | + freedink | [] [] [] [] [] | + fusionforge | | + gas | | + gawk | [] | + gcal | | + gcc | | + gdbm | [] [] [] | + gettext-examples | [] [] [] [] [] [] [] [] | + gettext-runtime | [] [] [] [] [] [] [] [] [] | + gettext-tools | [] [] [] [] [] [] [] | + gjay | [] | + glunarclock | [] [] [] [] [] [] | + gnubiff | [] | + gnubik | [] [] [] [] | + gnucash | () () () () () [] | + gnuchess | [] [] | + gnulib | [] [] [] [] [] | + gnunet | | + gnunet-gtk | | + gold | | + gphoto2 | [] [] [] [] [] | + gprof | [] [] [] [] | + gramadoir | [] [] | + grep | [] [] [] [] [] [] | + grub | [] [] [] [] [] | + gsasl | [] [] [] | + gss | [] [] [] [] | + gst-plugins-bad | [] [] [] [] [] | + gst-plugins-base | [] [] [] [] [] [] | + gst-plugins-good | [] [] [] [] [] [] [] | + gst-plugins-ugly | [] [] [] [] [] [] [] | + gstreamer | [] [] [] [] [] [] [] | + gtick | [] [] [] [] [] | + gtkam | [] [] [] [] [] [] | + gtkspell | [] [] [] [] [] [] [] [] [] | + guix | | + guix-packages | | + gutenprint | [] [] | + hello | [] [] [] [] [] [] | + help2man | [] [] [] [] | + help2man-texi | [] | + hylafax | | + idutils | [] [] [] | + iso_15924 | [] () [] [] [] [] | + iso_3166 | [] [] [] [] () [] [] [] [] [] [] [] [] | + iso_3166_2 | [] () [] | + iso_4217 | [] [] () [] [] [] [] [] | + iso_639 | [] [] [] () [] [] [] [] [] [] | + iso_639_3 | [] () | + iso_639_5 | () [] | + jwhois | [] [] [] [] | + kbd | [] [] | + klavaro | [] [] [] [] [] | + ld | | + leafpad | [] [] [] [] [] [] [] [] | + libc | [] [] [] | + libexif | [] () [] | + libextractor | [] | + libgnutls | [] | + libgphoto2 | [] | + libgphoto2_port | [] [] [] [] [] | + libgsasl | [] [] [] [] | + libiconv | [] [] [] [] [] | + libidn | [] [] [] | + liferea | [] [] [] [] () [] [] | + lilypond | | + lordsawar | | + lprng | [] | + lynx | [] [] | + m4 | [] [] [] [] [] | + mailfromd | [] | + mailutils | [] | + make | [] [] [] | + man-db | [] [] [] | + man-db-manpages | [] [] [] | + midi-instruments | [] [] [] [] [] [] [] [] | + minicom | [] [] [] [] | + mkisofs | [] [] [] | + myserver | [] [] | + nano | [] [] [] [] [] [] | + opcodes | | + parted | [] [] [] [] [] [] | + pies | [] | + pnmixer | [] | + popt | [] [] [] [] [] [] | + procps-ng | [] | + procps-ng-man | [] | + psmisc | [] [] [] [] | + pspp | [] [] | + pushover | | + pwdutils | [] | + pyspread | [] [] | + radius | [] [] | + recode | [] [] [] [] [] [] [] [] | + recutils | [] [] | + rpm | [] | + rush | [] [] [] | + sarg | [] [] | + sed | [] [] [] [] [] [] [] [] | + sharutils | [] [] [] | + shishi | [] [] | + skribilo | [] | + solfege | [] [] [] | + solfege-manual | [] [] | + spotmachine | [] [] | + sudo | [] [] [] [] [] [] | + sudoers | [] [] [] [] | + sysstat | [] [] [] [] [] | + tar | [] [] [] [] [] | + texinfo | [] [] [] | + texinfo_document | [] [] | + tigervnc | [] [] [] | + tin | [] | + tin-man | | + tracgoogleappsa... | [] [] [] [] | + trader | [] [] | + util-linux | [] [] | + ve | [] [] [] | + vice | | + vmm | | + vorbis-tools | [] [] [] | + wastesedge | | + wcd | | + wcd-man | | + wdiff | [] [] [] [] [] | + wget | [] [] [] [] [] | + wyslij-po | [] [] [] [] | + xboard | [] [] [] | + xdg-user-dirs | [] [] [] [] [] [] [] [] [] [] [] [] [] | + xkeyboard-config | [] [] [] [] | + +------------------------------------------------+ + nn or pa pl ps pt pt_BR ro ru rw sk sl sq sr + 7 3 6 114 1 12 88 32 82 3 40 45 7 101 + + sv sw ta te tg th tr uk ur vi wa wo zh_CN + +----------------------------------------------+ + a2ps | [] [] [] [] [] | + aegis | [] | + anubis | [] [] [] [] | + aspell | [] [] [] [] [] | + bash | [] [] [] [] | + bfd | [] [] [] | + binutils | [] [] [] | + bison | [] [] [] [] | + bison-runtime | [] [] [] [] [] [] | + buzztrax | [] [] [] | + ccd2cue | [] [] [] | + ccide | [] [] [] [] | + cflow | [] [] [] [] | + clisp | | + coreutils | [] [] [] | + cpio | [] [] [] [] [] | + cppi | [] [] [] [] | + cpplib | [] [] [] [] [] | + cryptsetup | [] [] [] | + datamash | [] [] [] | + denemo | [] | + dfarc | [] [] | + dialog | [] [] [] [] [] [] | + dico | [] | + diffutils | [] [] [] [] [] | + dink | [] | + direvent | [] [] | + doodle | [] [] | + dos2unix | [] [] [] [] | + dos2unix-man | [] [] [] | + e2fsprogs | [] [] [] [] | + enscript | [] [] [] [] | + exif | [] [] [] [] [] | + fetchmail | [] [] [] [] | + findutils | [] [] [] [] [] | + flex | [] [] [] [] | + freedink | [] [] [] | + fusionforge | | + gas | [] | + gawk | [] [] [] | + gcal | [] [] [] | + gcc | [] | + gdbm | [] [] | + gettext-examples | [] [] [] [] [] | + gettext-runtime | [] [] [] [] [] | + gettext-tools | [] [] [] [] [] | + gjay | [] [] [] | + glunarclock | [] [] [] [] | + gnubiff | [] [] | + gnubik | [] [] [] [] | + gnucash | () () () () [] | + gnuchess | [] [] [] | + gnulib | [] [] [] [] | + gnunet | | + gnunet-gtk | | + gold | [] [] | + gphoto2 | [] [] [] [] | + gprof | [] [] [] [] | + gramadoir | [] [] [] | + grep | [] [] [] [] [] | + grub | [] [] [] [] | + gsasl | [] [] [] [] | + gss | [] [] [] | + gst-plugins-bad | [] [] [] [] [] | + gst-plugins-base | [] [] [] [] [] | + gst-plugins-good | [] [] [] [] [] | + gst-plugins-ugly | [] [] [] [] [] | + gstreamer | [] [] [] [] [] | + gtick | [] [] [] | + gtkam | [] [] [] [] | + gtkspell | [] [] [] [] [] [] [] | + guix | | + guix-packages | | + gutenprint | [] [] [] [] | + hello | [] [] [] [] [] [] | + help2man | [] [] [] | + help2man-texi | [] | + hylafax | [] | + idutils | [] [] [] | + iso_15924 | [] () [] [] () [] | + iso_3166 | [] [] () [] [] () [] [] | + iso_3166_2 | () [] [] () [] | + iso_4217 | [] () [] [] () [] | + iso_639 | [] [] [] () [] [] () [] [] | + iso_639_3 | [] () [] [] () | + iso_639_5 | () [] () | + jwhois | [] [] [] [] | + kbd | [] [] [] [] | + klavaro | [] [] [] [] [] [] | + ld | [] [] [] [] [] | + leafpad | [] [] [] [] [] [] | + libc | [] [] [] [] [] | + libexif | [] [] () | + libextractor | [] [] | + libgnutls | [] [] [] [] | + libgphoto2 | [] [] [] | + libgphoto2_port | [] [] [] [] | + libgsasl | [] [] [] [] | + libiconv | [] [] [] [] [] | + libidn | () [] [] [] | + liferea | [] [] [] [] [] | + lilypond | [] | + lordsawar | | + lprng | [] | + lynx | [] [] [] [] | + m4 | [] [] [] | + mailfromd | [] [] | + mailutils | [] | + make | [] [] [] [] | + man-db | [] [] [] | + man-db-manpages | [] [] | + midi-instruments | [] [] [] [] [] [] | + minicom | [] [] | + mkisofs | [] [] [] | + myserver | [] | + nano | [] [] [] [] | + opcodes | [] [] [] | + parted | [] [] [] [] [] | + pies | [] [] | + pnmixer | [] [] [] | + popt | [] [] [] [] [] [] [] | + procps-ng | [] [] | + procps-ng-man | [] | + psmisc | [] [] [] [] | + pspp | [] [] [] | + pushover | [] | + pwdutils | [] [] | + pyspread | [] | + radius | [] [] | + recode | [] [] [] [] | + recutils | [] [] [] | + rpm | [] [] [] [] | + rush | [] [] | + sarg | | + sed | [] [] [] [] [] | + sharutils | [] [] [] [] | + shishi | [] [] | + skribilo | [] [] | + solfege | [] [] [] [] | + solfege-manual | [] | + spotmachine | [] [] [] | + sudo | [] [] [] [] [] | + sudoers | [] [] [] [] | + sysstat | [] [] [] [] [] | + tar | [] [] [] [] [] | + texinfo | [] [] [] | + texinfo_document | [] | + tigervnc | [] [] [] | + tin | [] | + tin-man | | + tracgoogleappsa... | [] [] [] [] [] | + trader | [] | + util-linux | [] [] [] [] | + ve | [] [] [] [] | + vice | () () | + vmm | | + vorbis-tools | [] [] | + wastesedge | | + wcd | [] [] [] | + wcd-man | [] | + wdiff | [] [] [] [] | + wget | [] [] [] | + wyslij-po | [] [] | + xboard | [] [] | + xdg-user-dirs | [] [] [] [] [] [] [] [] | + xkeyboard-config | [] [] [] [] | + +----------------------------------------------+ + sv sw ta te tg th tr uk ur vi wa wo zh_CN + 106 1 4 3 0 13 51 115 1 125 7 1 100 + + zh_HK zh_TW + +-------------+ + a2ps | | 30 + aegis | | 9 + anubis | | 19 + aspell | | 29 + bash | [] | 23 + bfd | | 11 + binutils | | 12 + bison | [] | 18 + bison-runtime | [] | 38 + buzztrax | | 9 + ccd2cue | | 10 + ccide | | 17 + cflow | | 16 + clisp | | 10 + coreutils | | 18 + cpio | | 20 + cppi | | 17 + cpplib | [] | 19 + cryptsetup | | 14 + datamash | | 11 + denemo | | 5 + dfarc | | 17 + dialog | [] | 42 + dico | | 6 + diffutils | | 22 + dink | | 10 + direvent | | 11 + doodle | | 12 + dos2unix | [] | 18 + dos2unix-man | | 9 + e2fsprogs | | 15 + enscript | | 21 + exif | | 27 + fetchmail | | 19 + findutils | | 29 + flex | [] | 19 + freedink | | 24 + fusionforge | | 3 + gas | | 5 + gawk | | 13 + gcal | | 8 + gcc | | 2 + gdbm | | 10 + gettext-examples | [] [] | 40 + gettext-runtime | [] [] | 35 + gettext-tools | [] | 24 + gjay | | 9 + glunarclock | [] | 27 + gnubiff | | 9 + gnubik | | 19 + gnucash | () | 6 + gnuchess | | 11 + gnulib | | 23 + gnunet | | 1 + gnunet-gtk | | 1 + gold | | 7 + gphoto2 | [] | 19 + gprof | | 21 + gramadoir | | 14 + grep | [] | 31 + grub | | 21 + gsasl | [] | 19 + gss | | 17 + gst-plugins-bad | | 21 + gst-plugins-base | | 27 + gst-plugins-good | | 32 + gst-plugins-ugly | | 34 + gstreamer | [] | 32 + gtick | | 19 + gtkam | | 24 + gtkspell | [] [] | 48 + guix | | 2 + guix-packages | | 0 + gutenprint | | 15 + hello | [] | 30 + help2man | | 18 + help2man-texi | | 5 + hylafax | | 5 + idutils | | 14 + iso_15924 | [] | 23 + iso_3166 | [] [] | 58 + iso_3166_2 | | 9 + iso_4217 | [] [] | 28 + iso_639 | [] [] | 46 + iso_639_3 | | 10 + iso_639_5 | | 2 + jwhois | [] | 20 + kbd | | 17 + klavaro | | 30 + ld | [] | 15 + leafpad | [] | 39 + libc | [] | 24 + libexif | | 10 + libextractor | | 5 + libgnutls | | 13 + libgphoto2 | | 10 + libgphoto2_port | [] | 19 + libgsasl | | 18 + libiconv | [] | 29 + libidn | | 17 + liferea | | 29 + lilypond | | 11 + lordsawar | | 3 + lprng | | 3 + lynx | | 19 + m4 | [] | 22 + mailfromd | | 4 + mailutils | | 6 + make | | 19 + man-db | | 15 + man-db-manpages | | 10 + midi-instruments | [] | 43 + minicom | [] | 17 + mkisofs | | 13 + myserver | | 9 + nano | [] | 30 + opcodes | | 12 + parted | [] | 23 + pies | | 4 + pnmixer | | 9 + popt | [] | 36 + procps-ng | | 5 + procps-ng-man | | 4 + psmisc | [] | 22 + pspp | | 13 + pushover | | 6 + pwdutils | | 8 + pyspread | | 6 + radius | | 9 + recode | | 31 + recutils | | 10 + rpm | [] | 13 + rush | | 10 + sarg | | 4 + sed | [] | 35 + sharutils | | 13 + shishi | | 7 + skribilo | | 7 + solfege | | 21 + solfege-manual | | 9 + spotmachine | | 11 + sudo | | 26 + sudoers | | 22 + sysstat | | 23 + tar | [] | 30 + texinfo | | 17 + texinfo_document | | 13 + tigervnc | | 14 + tin | [] | 7 + tin-man | | 1 + tracgoogleappsa... | [] | 22 + trader | | 12 + util-linux | | 13 + ve | | 14 + vice | | 1 + vmm | | 3 + vorbis-tools | | 13 + wastesedge | | 3 + wcd | | 8 + wcd-man | | 3 + wdiff | [] | 23 + wget | | 21 + wyslij-po | | 14 + xboard | | 10 + xdg-user-dirs | [] [] | 68 + xkeyboard-config | [] | 28 + +-------------+ + 89 teams zh_HK zh_TW + 166 domains 7 42 2809 + + Some counters in the preceding matrix are higher than the number of +visible blocks let us expect. This is because a few extra PO files are +used for implementing regional variants of languages, or language +dialects. + + For a PO file in the matrix above to be effective, the package to +which it applies should also have been internationalized and distributed +as such by its maintainer. There might be an observable lag between the +mere existence a PO file and its wide availability in a distribution. + + If Jun 2014 seems to be old, you may fetch a more recent copy of this +'ABOUT-NLS' file on most GNU archive sites. The most up-to-date matrix +with full percentage details can be found at +'http://translationproject.org/extra/matrix.html'. + +1.5 Using 'gettext' in new packages +=================================== + +If you are writing a freely available program and want to +internationalize it you are welcome to use GNU 'gettext' in your +package. Of course you have to respect the GNU Lesser General Public +License which covers the use of the GNU 'gettext' library. This means +in particular that even non-free programs can use 'libintl' as a shared +library, whereas only free software can use 'libintl' as a static +library or use modified versions of 'libintl'. + + Once the sources are changed appropriately and the setup can handle +the use of 'gettext' the only thing missing are the translations. The +Free Translation Project is also available for packages which are not +developed inside the GNU project. Therefore the information given above +applies also for every other Free Software Project. Contact +'coordinator@translationproject.org' to make the '.pot' files available +to the translation teams. diff --git a/COPYING b/COPYING new file mode 100644 index 0000000..623b625 --- /dev/null +++ b/COPYING @@ -0,0 +1,340 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc. + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Library General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) year name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + , 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Library General +Public License instead of this License. diff --git a/ChangeLog b/ChangeLog new file mode 100644 index 0000000..06849ec --- /dev/null +++ b/ChangeLog @@ -0,0 +1,43 @@ +2005-08-13 gettextize + + * Makefile.am (EXTRA_DIST): Add config.rpath, mkinstalldirs. + * configure.in (AM_GNU_GETTEXT_VERSION): Bump to 0.14.4. + +0.0.7 -> 0.2.0 + +* removed error message from alsamixer +* fixes in alsactl program +* version is now compatible with driver + +0.0.6 -> 0.0.7 + +* added alsactl control program +* updated alsamixer by Carl van Schaik + - stereo record source select + - left/right route support + +0.0.5 -> 0.0.6 + +* updates for new alsa-lib +* fixed compilation problems with config.h header file +* updated output 'aplay -l' + +0.0.3 -> 0.0.4 + +* added check for alsa-lib package +* added spec file for RPM + +0.0.2 -> 0.0.3 + +* included great ncurses alsamixer from Tim Janik +* enhanced Mixer from Andy Lo A Foe renamed to amixer + +0.0.1 -> 0.0.2 + +* fixed small bug in aplay in command line parsing +* fixed fragment size allocation for low rate files in aplay +* a little bit corrected output from Mixer + +0.0.1 + +* initial release (aplay, broken Mixer) diff --git a/INSTALL b/INSTALL new file mode 100644 index 0000000..5f20814 --- /dev/null +++ b/INSTALL @@ -0,0 +1,56 @@ + + ALSA utils installation + ======================= + +Requirements +------------ + +alsamixer requires the ncurses library. Some systems need to install +the develop package additionally to link with this library. + +alsaconf requires dialog or whiptail program to run properly. + +If systemd (minimum version 18) is installed it will be used to run +alsactl to store and restore settings. + +Installation +------------ + +For installation you can use these commands: + + ./configure + make install + +If ./configure command complain that alsa-lib package isn't installed, +please, check if --prefix option is same for alsa-lib and alsa-utils +package. The configure script from alsa-utils package probably cannot find +header file asoundlib.h in $prefix/include/alsa directory (usually in +/usr/include/alsa directory). + +Compilation from git sources +--------------------------- + +You need also GNU packages autoconf and automake installed in your system +to compile git sources of alsa-utils package. + +For compilation you can use these commands: + + aclocal + gettextize + autoheader + automake --foreign --copy --add-missing + autoconf + ./configure + make + +The included gitcompile script does this job for you. + +To configure the build to install in a local directory, a command like the +following can be used: + + ./gitcompile --prefix="$PWD/build" \ + --with-systemdsystemunitdir="$PWD/build/$(pkg-config systemd --variable=systemdsystemunitdir)" \ + --with-udev-rules-dir="$PWD/build/$(pkg-config udev --variable=udevdir)" + +Note: Some automake packages have missing aclocal program. Use newer version + in the case. diff --git a/Makefile.am b/Makefile.am new file mode 100644 index 0000000..b001546 --- /dev/null +++ b/Makefile.am @@ -0,0 +1,54 @@ +AM_CPPFLAGS=-I$(top_srcdir)/include + +SUBDIRS = include alsactl utils m4 po alsa-info +if ALSAMIXER +SUBDIRS += alsamixer +endif +if HAVE_MIXER +SUBDIRS += amixer +endif +if HAVE_RAWMIDI +SUBDIRS += amidi +endif +if ALSACONF +SUBDIRS += alsaconf +endif +if HAVE_PCM +SUBDIRS += aplay iecset speaker-test axfer +if ALSALOOP +SUBDIRS += alsaloop +endif +if BAT +SUBDIRS += bat +endif +endif +if HAVE_SEQ +SUBDIRS += seq +endif +if HAVE_UCM +SUBDIRS += alsaucm +endif +if HAVE_TOPOLOGY +SUBDIRS += topology +endif + +EXTRA_DIST= config.rpath README.md TODO gitcompile +AUTOMAKE_OPTIONS=foreign +ACLOCAL_AMFLAGS = -I m4 + +rpm: dist + $(MAKE) -C $@ + +dist-hook: + -chmod -R a+r $(distdir) + @if ! test -z "$(AMTAR)"; then \ + $(AMTAR) --create --verbose --file=- $(distdir) | bzip2 -c -9 > $(distdir).tar.bz2 ; \ + else \ + $(TAR) --create --verbose --file=- $(distdir) | bzip2 -c -9 > $(distdir).tar.bz2 ; \ + fi + +install-data-hook: + $(MKDIR_P) -m 0755 $(DESTDIR)$(ASOUND_STATE_DIR) + +DISTCHECK_CONFIGURE_FLAGS = \ + --with-systemdsystemunitdir=$$dc_install_base/$(systemdsystemunitdir) diff --git a/Makefile.in b/Makefile.in new file mode 100644 index 0000000..aacaf3d --- /dev/null +++ b/Makefile.in @@ -0,0 +1,865 @@ +# Makefile.in generated by automake 1.16.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994-2018 Free Software Foundation, Inc. + +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ +VPATH = @srcdir@ +am__is_gnu_make = { \ + if test -z '$(MAKELEVEL)'; then \ + false; \ + elif test -n '$(MAKE_HOST)'; then \ + true; \ + elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ + true; \ + else \ + false; \ + fi; \ +} +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + esac; \ + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +@ALSAMIXER_TRUE@am__append_1 = alsamixer +@HAVE_MIXER_TRUE@am__append_2 = amixer +@HAVE_RAWMIDI_TRUE@am__append_3 = amidi +@ALSACONF_TRUE@am__append_4 = alsaconf +@HAVE_PCM_TRUE@am__append_5 = aplay iecset speaker-test axfer +@ALSALOOP_TRUE@@HAVE_PCM_TRUE@am__append_6 = alsaloop +@BAT_TRUE@@HAVE_PCM_TRUE@am__append_7 = bat +@HAVE_SEQ_TRUE@am__append_8 = seq +@HAVE_UCM_TRUE@am__append_9 = alsaucm +@HAVE_TOPOLOGY_TRUE@am__append_10 = topology +subdir = . +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/gettext.m4 \ + $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/lib-ld.m4 \ + $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ + $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \ + $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/acinclude.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +DIST_COMMON = $(srcdir)/Makefile.am $(top_srcdir)/configure \ + $(am__configure_deps) $(am__DIST_COMMON) +am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \ + configure.lineno config.status.lineno +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/include/aconfig.h +CONFIG_CLEAN_FILES = alsaconf/po/Makefile +CONFIG_CLEAN_VPATH_FILES = +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = +SOURCES = +DIST_SOURCES = +RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \ + ctags-recursive dvi-recursive html-recursive info-recursive \ + install-data-recursive install-dvi-recursive \ + install-exec-recursive install-html-recursive \ + install-info-recursive install-pdf-recursive \ + install-ps-recursive install-recursive installcheck-recursive \ + installdirs-recursive pdf-recursive ps-recursive \ + tags-recursive uninstall-recursive +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ + distclean-recursive maintainer-clean-recursive +am__recursive_targets = \ + $(RECURSIVE_TARGETS) \ + $(RECURSIVE_CLEAN_TARGETS) \ + $(am__extra_recursive_targets) +AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \ + cscope distdir distdir-am dist dist-all distcheck +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) +# Read a list of newline-separated strings from the standard input, +# and print each of them once, without duplicates. Input order is +# *not* preserved. +am__uniquify_input = $(AWK) '\ + BEGIN { nonempty = 0; } \ + { items[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in items) print i; }; } \ +' +# Make sure the list of sources is unique. This is necessary because, +# e.g., the same source file might be shared among _SOURCES variables +# for different programs/libraries. +am__define_uniq_tagged_files = \ + list='$(am__tagged_files)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | $(am__uniquify_input)` +ETAGS = etags +CTAGS = ctags +CSCOPE = cscope +DIST_SUBDIRS = include alsactl utils m4 po alsa-info alsamixer amixer \ + amidi alsaconf aplay iecset speaker-test axfer alsaloop bat \ + seq alsaucm topology +am__DIST_COMMON = $(srcdir)/Makefile.in \ + $(top_srcdir)/alsaconf/po/Makefile.in ABOUT-NLS COPYING \ + ChangeLog INSTALL TODO compile config.guess config.rpath \ + config.sub install-sh missing +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +distdir = $(PACKAGE)-$(VERSION) +top_distdir = $(distdir) +am__remove_distdir = \ + if test -d "$(distdir)"; then \ + find "$(distdir)" -type d ! -perm -200 -exec chmod u+w {} ';' \ + && rm -rf "$(distdir)" \ + || { sleep 5 && rm -rf "$(distdir)"; }; \ + else :; fi +am__post_remove_distdir = $(am__remove_distdir) +am__relativize = \ + dir0=`pwd`; \ + sed_first='s,^\([^/]*\)/.*$$,\1,'; \ + sed_rest='s,^[^/]*/*,,'; \ + sed_last='s,^.*/\([^/]*\)$$,\1,'; \ + sed_butlast='s,/*[^/]*$$,,'; \ + while test -n "$$dir1"; do \ + first=`echo "$$dir1" | sed -e "$$sed_first"`; \ + if test "$$first" != "."; then \ + if test "$$first" = ".."; then \ + dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \ + dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \ + else \ + first2=`echo "$$dir2" | sed -e "$$sed_first"`; \ + if test "$$first2" = "$$first"; then \ + dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \ + else \ + dir2="../$$dir2"; \ + fi; \ + dir0="$$dir0"/"$$first"; \ + fi; \ + fi; \ + dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \ + done; \ + reldir="$$dir2" +DIST_ARCHIVES = $(distdir).tar.gz +GZIP_ENV = --best +DIST_TARGETS = dist-gzip +distuninstallcheck_listfiles = find . -type f -print +am__distuninstallcheck_listfiles = $(distuninstallcheck_listfiles) \ + | sed 's|^\./|$(prefix)/|' | grep -v '$(infodir)/dir$$' +distcleancheck_listfiles = find . -type f -print +ACLOCAL = @ACLOCAL@ +ALSACTL_DAEMONSWITCH = @ALSACTL_DAEMONSWITCH@ +ALSACTL_PIDFILE_DIR = @ALSACTL_PIDFILE_DIR@ +ALSA_CFLAGS = @ALSA_CFLAGS@ +ALSA_LIBS = @ALSA_LIBS@ +ALSA_TOPOLOGY_LIBS = @ALSA_TOPOLOGY_LIBS@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +ASOUND_LOCK_DIR = @ASOUND_LOCK_DIR@ +ASOUND_STATE_DIR = @ASOUND_STATE_DIR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CURSESINC = @CURSESINC@ +CURSESLIB = @CURSESLIB@ +CURSES_CFLAGS = @CURSES_CFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +FFTW_CFLAGS = @FFTW_CFLAGS@ +FFTW_INC = @FFTW_INC@ +FFTW_LIB = @FFTW_LIB@ +GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ +GMSGFMT = @GMSGFMT@ +GMSGFMT_015 = @GMSGFMT_015@ +GREP = @GREP@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +INTLLIBS = @INTLLIBS@ +INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@ +LDFLAGS = @LDFLAGS@ +LIBICONV = @LIBICONV@ +LIBINTL = @LIBINTL@ +LIBOBJS = @LIBOBJS@ +LIBRT = @LIBRT@ +LIBS = @LIBS@ +LN_S = @LN_S@ +LTLIBICONV = @LTLIBICONV@ +LTLIBINTL = @LTLIBINTL@ +LTLIBOBJS = @LTLIBOBJS@ +MAINT = @MAINT@ +MAKEINFO = @MAKEINFO@ +MKDIR_P = @MKDIR_P@ +MSGFMT = @MSGFMT@ +MSGFMT_015 = @MSGFMT_015@ +MSGMERGE = @MSGMERGE@ +NCURSESW_CFLAGS = @NCURSESW_CFLAGS@ +NCURSESW_LIBS = @NCURSESW_LIBS@ +NCURSES_CFLAGS = @NCURSES_CFLAGS@ +NCURSES_LIBS = @NCURSES_LIBS@ +OBJEXT = @OBJEXT@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ +POSUB = @POSUB@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +SND_UTIL_MAJOR = @SND_UTIL_MAJOR@ +SND_UTIL_MINOR = @SND_UTIL_MINOR@ +SND_UTIL_SUBMINOR = @SND_UTIL_SUBMINOR@ +SND_UTIL_VERSION = @SND_UTIL_VERSION@ +STRIP = @STRIP@ +SYSTEMD_CFLAGS = @SYSTEMD_CFLAGS@ +SYSTEMD_LIBS = @SYSTEMD_LIBS@ +TESTSOUND = @TESTSOUND@ +USE_NLS = @USE_NLS@ +VERSION = @VERSION@ +XGETTEXT = @XGETTEXT@ +XGETTEXT_015 = @XGETTEXT_015@ +XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_CC = @ac_ct_CC@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +mydatadir = @mydatadir@ +ncurses5_config = @ncurses5_config@ +ncursesw5_config = @ncursesw5_config@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +rst2man_available = @rst2man_available@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +systemdsystemunitdir = @systemdsystemunitdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +udevrulesdir = @udevrulesdir@ +xmlto_available = @xmlto_available@ +AM_CPPFLAGS = -I$(top_srcdir)/include +SUBDIRS = include alsactl utils m4 po alsa-info $(am__append_1) \ + $(am__append_2) $(am__append_3) $(am__append_4) \ + $(am__append_5) $(am__append_6) $(am__append_7) \ + $(am__append_8) $(am__append_9) $(am__append_10) +EXTRA_DIST = config.rpath README.md TODO gitcompile +AUTOMAKE_OPTIONS = foreign +ACLOCAL_AMFLAGS = -I m4 +DISTCHECK_CONFIGURE_FLAGS = \ + --with-systemdsystemunitdir=$$dc_install_base/$(systemdsystemunitdir) + +all: all-recursive + +.SUFFIXES: +am--refresh: Makefile + @: +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + echo ' cd $(srcdir) && $(AUTOMAKE) --foreign'; \ + $(am__cd) $(srcdir) && $(AUTOMAKE) --foreign \ + && exit 0; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --foreign Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + echo ' $(SHELL) ./config.status'; \ + $(SHELL) ./config.status;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__maybe_remake_depfiles)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__maybe_remake_depfiles);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + $(SHELL) ./config.status --recheck + +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + $(am__cd) $(srcdir) && $(AUTOCONF) +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + $(am__cd) $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS) +$(am__aclocal_m4_deps): +alsaconf/po/Makefile: $(top_builddir)/config.status $(top_srcdir)/alsaconf/po/Makefile.in + cd $(top_builddir) && $(SHELL) ./config.status $@ + +# This directory's subdirectories are mostly independent; you can cd +# into them and run 'make' without going through this Makefile. +# To change the values of 'make' variables: instead of editing Makefiles, +# (1) if the variable is set in 'config.status', edit 'config.status' +# (which will cause the Makefiles to be regenerated when you run 'make'); +# (2) otherwise, pass the desired values on the 'make' command line. +$(am__recursive_targets): + @fail=; \ + if $(am__make_keepgoing); then \ + failcom='fail=yes'; \ + else \ + failcom='exit 1'; \ + fi; \ + dot_seen=no; \ + target=`echo $@ | sed s/-recursive//`; \ + case "$@" in \ + distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ + *) list='$(SUBDIRS)' ;; \ + esac; \ + for subdir in $$list; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + dot_seen=yes; \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || eval $$failcom; \ + done; \ + if test "$$dot_seen" = "no"; then \ + $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ + fi; test -z "$$fail" + +ID: $(am__tagged_files) + $(am__define_uniq_tagged_files); mkid -fID $$unique +tags: tags-recursive +TAGS: tags + +tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + set x; \ + here=`pwd`; \ + if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ + include_option=--etags-include; \ + empty_fix=.; \ + else \ + include_option=--include; \ + empty_fix=; \ + fi; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test ! -f $$subdir/TAGS || \ + set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \ + fi; \ + done; \ + $(am__define_uniq_tagged_files); \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: ctags-recursive + +CTAGS: ctags +ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + $(am__define_uniq_tagged_files); \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" +cscope: cscope.files + test ! -s cscope.files \ + || $(CSCOPE) -b -q $(AM_CSCOPEFLAGS) $(CSCOPEFLAGS) -i cscope.files $(CSCOPE_ARGS) +clean-cscope: + -rm -f cscope.files +cscope.files: clean-cscope cscopelist +cscopelist: cscopelist-recursive + +cscopelist-am: $(am__tagged_files) + list='$(am__tagged_files)'; \ + case "$(srcdir)" in \ + [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ + *) sdir=$(subdir)/$(srcdir) ;; \ + esac; \ + for i in $$list; do \ + if test -f "$$i"; then \ + echo "$(subdir)/$$i"; \ + else \ + echo "$$sdir/$$i"; \ + fi; \ + done >> $(top_builddir)/cscope.files + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + -rm -f cscope.out cscope.in.out cscope.po.out cscope.files + +distdir: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) distdir-am + +distdir-am: $(DISTFILES) + $(am__remove_distdir) + test -d "$(distdir)" || mkdir "$(distdir)" + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done + @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + $(am__make_dryrun) \ + || test -d "$(distdir)/$$subdir" \ + || $(MKDIR_P) "$(distdir)/$$subdir" \ + || exit 1; \ + dir1=$$subdir; dir2="$(distdir)/$$subdir"; \ + $(am__relativize); \ + new_distdir=$$reldir; \ + dir1=$$subdir; dir2="$(top_distdir)"; \ + $(am__relativize); \ + new_top_distdir=$$reldir; \ + echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \ + echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \ + ($(am__cd) $$subdir && \ + $(MAKE) $(AM_MAKEFLAGS) \ + top_distdir="$$new_top_distdir" \ + distdir="$$new_distdir" \ + am__remove_distdir=: \ + am__skip_length_check=: \ + am__skip_mode_fix=: \ + distdir) \ + || exit 1; \ + fi; \ + done + $(MAKE) $(AM_MAKEFLAGS) \ + top_distdir="$(top_distdir)" distdir="$(distdir)" \ + dist-hook + -test -n "$(am__skip_mode_fix)" \ + || find "$(distdir)" -type d ! -perm -755 \ + -exec chmod u+rwx,go+rx {} \; -o \ + ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \ + ! -type d ! -perm -400 -exec chmod a+r {} \; -o \ + ! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \ + || chmod -R a+r "$(distdir)" +dist-gzip: distdir + tardir=$(distdir) && $(am__tar) | eval GZIP= gzip $(GZIP_ENV) -c >$(distdir).tar.gz + $(am__post_remove_distdir) + +dist-bzip2: distdir + tardir=$(distdir) && $(am__tar) | BZIP2=$${BZIP2--9} bzip2 -c >$(distdir).tar.bz2 + $(am__post_remove_distdir) + +dist-lzip: distdir + tardir=$(distdir) && $(am__tar) | lzip -c $${LZIP_OPT--9} >$(distdir).tar.lz + $(am__post_remove_distdir) + +dist-xz: distdir + tardir=$(distdir) && $(am__tar) | XZ_OPT=$${XZ_OPT--e} xz -c >$(distdir).tar.xz + $(am__post_remove_distdir) + +dist-tarZ: distdir + @echo WARNING: "Support for distribution archives compressed with" \ + "legacy program 'compress' is deprecated." >&2 + @echo WARNING: "It will be removed altogether in Automake 2.0" >&2 + tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z + $(am__post_remove_distdir) + +dist-shar: distdir + @echo WARNING: "Support for shar distribution archives is" \ + "deprecated." >&2 + @echo WARNING: "It will be removed altogether in Automake 2.0" >&2 + shar $(distdir) | eval GZIP= gzip $(GZIP_ENV) -c >$(distdir).shar.gz + $(am__post_remove_distdir) + +dist-zip: distdir + -rm -f $(distdir).zip + zip -rq $(distdir).zip $(distdir) + $(am__post_remove_distdir) + +dist dist-all: + $(MAKE) $(AM_MAKEFLAGS) $(DIST_TARGETS) am__post_remove_distdir='@:' + $(am__post_remove_distdir) + +# This target untars the dist file and tries a VPATH configuration. Then +# it guarantees that the distribution is self-contained by making another +# tarfile. +distcheck: dist + case '$(DIST_ARCHIVES)' in \ + *.tar.gz*) \ + eval GZIP= gzip $(GZIP_ENV) -dc $(distdir).tar.gz | $(am__untar) ;;\ + *.tar.bz2*) \ + bzip2 -dc $(distdir).tar.bz2 | $(am__untar) ;;\ + *.tar.lz*) \ + lzip -dc $(distdir).tar.lz | $(am__untar) ;;\ + *.tar.xz*) \ + xz -dc $(distdir).tar.xz | $(am__untar) ;;\ + *.tar.Z*) \ + uncompress -c $(distdir).tar.Z | $(am__untar) ;;\ + *.shar.gz*) \ + eval GZIP= gzip $(GZIP_ENV) -dc $(distdir).shar.gz | unshar ;;\ + *.zip*) \ + unzip $(distdir).zip ;;\ + esac + chmod -R a-w $(distdir) + chmod u+w $(distdir) + mkdir $(distdir)/_build $(distdir)/_build/sub $(distdir)/_inst + chmod a-w $(distdir) + test -d $(distdir)/_build || exit 0; \ + dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \ + && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \ + && am__cwd=`pwd` \ + && $(am__cd) $(distdir)/_build/sub \ + && ../../configure \ + $(AM_DISTCHECK_CONFIGURE_FLAGS) \ + $(DISTCHECK_CONFIGURE_FLAGS) \ + --srcdir=../.. --prefix="$$dc_install_base" \ + && $(MAKE) $(AM_MAKEFLAGS) \ + && $(MAKE) $(AM_MAKEFLAGS) dvi \ + && $(MAKE) $(AM_MAKEFLAGS) check \ + && $(MAKE) $(AM_MAKEFLAGS) install \ + && $(MAKE) $(AM_MAKEFLAGS) installcheck \ + && $(MAKE) $(AM_MAKEFLAGS) uninstall \ + && $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \ + distuninstallcheck \ + && chmod -R a-w "$$dc_install_base" \ + && ({ \ + (cd ../.. && umask 077 && mkdir "$$dc_destdir") \ + && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \ + && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \ + && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \ + distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \ + } || { rm -rf "$$dc_destdir"; exit 1; }) \ + && rm -rf "$$dc_destdir" \ + && $(MAKE) $(AM_MAKEFLAGS) dist \ + && rm -rf $(DIST_ARCHIVES) \ + && $(MAKE) $(AM_MAKEFLAGS) distcleancheck \ + && cd "$$am__cwd" \ + || exit 1 + $(am__post_remove_distdir) + @(echo "$(distdir) archives ready for distribution: "; \ + list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \ + sed -e 1h -e 1s/./=/g -e 1p -e 1x -e '$$p' -e '$$x' +distuninstallcheck: + @test -n '$(distuninstallcheck_dir)' || { \ + echo 'ERROR: trying to run $@ with an empty' \ + '$$(distuninstallcheck_dir)' >&2; \ + exit 1; \ + }; \ + $(am__cd) '$(distuninstallcheck_dir)' || { \ + echo 'ERROR: cannot chdir into $(distuninstallcheck_dir)' >&2; \ + exit 1; \ + }; \ + test `$(am__distuninstallcheck_listfiles) | wc -l` -eq 0 \ + || { echo "ERROR: files left after uninstall:" ; \ + if test -n "$(DESTDIR)"; then \ + echo " (check DESTDIR support)"; \ + fi ; \ + $(distuninstallcheck_listfiles) ; \ + exit 1; } >&2 +distcleancheck: distclean + @if test '$(srcdir)' = . ; then \ + echo "ERROR: distcleancheck can only run from a VPATH build" ; \ + exit 1 ; \ + fi + @test `$(distcleancheck_listfiles) | wc -l` -eq 0 \ + || { echo "ERROR: files left in build directory after distclean:" ; \ + $(distcleancheck_listfiles) ; \ + exit 1; } >&2 +check-am: all-am +check: check-recursive +all-am: Makefile +installdirs: installdirs-recursive +installdirs-am: +install: install-recursive +install-exec: install-exec-recursive +install-data: install-data-recursive +uninstall: uninstall-recursive + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-recursive +install-strip: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-recursive + +clean-am: clean-generic mostlyclean-am + +distclean: distclean-recursive + -rm -f $(am__CONFIG_DISTCLEAN_FILES) + -rm -f Makefile +distclean-am: clean-am distclean-generic distclean-tags + +dvi: dvi-recursive + +dvi-am: + +html: html-recursive + +html-am: + +info: info-recursive + +info-am: + +install-data-am: + @$(NORMAL_INSTALL) + $(MAKE) $(AM_MAKEFLAGS) install-data-hook +install-dvi: install-dvi-recursive + +install-dvi-am: + +install-exec-am: + +install-html: install-html-recursive + +install-html-am: + +install-info: install-info-recursive + +install-info-am: + +install-man: + +install-pdf: install-pdf-recursive + +install-pdf-am: + +install-ps: install-ps-recursive + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-recursive + -rm -f $(am__CONFIG_DISTCLEAN_FILES) + -rm -rf $(top_srcdir)/autom4te.cache + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-recursive + +mostlyclean-am: mostlyclean-generic + +pdf: pdf-recursive + +pdf-am: + +ps: ps-recursive + +ps-am: + +uninstall-am: + +.MAKE: $(am__recursive_targets) install-am install-data-am \ + install-strip + +.PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am \ + am--refresh check check-am clean clean-cscope clean-generic \ + cscope cscopelist-am ctags ctags-am dist dist-all dist-bzip2 \ + dist-gzip dist-hook dist-lzip dist-shar dist-tarZ dist-xz \ + dist-zip distcheck distclean distclean-generic distclean-tags \ + distcleancheck distdir distuninstallcheck dvi dvi-am html \ + html-am info info-am install install-am install-data \ + install-data-am install-data-hook install-dvi install-dvi-am \ + install-exec install-exec-am install-html install-html-am \ + install-info install-info-am install-man install-pdf \ + install-pdf-am install-ps install-ps-am install-strip \ + installcheck installcheck-am installdirs installdirs-am \ + maintainer-clean maintainer-clean-generic mostlyclean \ + mostlyclean-generic pdf pdf-am ps ps-am tags tags-am uninstall \ + uninstall-am + +.PRECIOUS: Makefile + + +rpm: dist + $(MAKE) -C $@ + +dist-hook: + -chmod -R a+r $(distdir) + @if ! test -z "$(AMTAR)"; then \ + $(AMTAR) --create --verbose --file=- $(distdir) | bzip2 -c -9 > $(distdir).tar.bz2 ; \ + else \ + $(TAR) --create --verbose --file=- $(distdir) | bzip2 -c -9 > $(distdir).tar.bz2 ; \ + fi + +install-data-hook: + $(MKDIR_P) -m 0755 $(DESTDIR)$(ASOUND_STATE_DIR) + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/README.md b/README.md new file mode 100644 index 0000000..856f9c6 --- /dev/null +++ b/README.md @@ -0,0 +1,28 @@ +# alsa-utils +## Advanced Linux Sound Architecture - Utilities + +![Build alsa-utils](https://github.com/alsa-project/alsa-utils/workflows/Build%20alsa-utils/badge.svg?branch=master) + +This package contains the command line utilities for the ALSA project. +The package can be compiled only with the installed ALSA driver and +the ALSA C library (alsa-lib). + +Utility | Description +----------------|---------------------------------------------------- +alsaconf | the ALSA driver configurator script +alsa-info | a script to gather information about ALSA subsystem +alsactl | an utility for soundcard settings management +aplay/arecord | an utility for the playback / capture of .wav,.voc,.au files +axfer | an utility to transfer audio data frame (enhancement of aplay) +amixer | a command line mixer +alsamixer | a ncurses mixer +amidi | a utility to send/receive sysex dumps or other MIDI data +iecset | a utility to show/set the IEC958 status bits +speaker-test | a speaker test utility +alsaloop | a software loopback for PCM devices +alsaucm | Use Case Manager utility +alsabat | a sound tester for ALSA sound card driver +alsatplg | ALSA topology compiler + +You may give a look for more information about the ALSA project to URL +http://www.alsa-project.org. diff --git a/TODO b/TODO new file mode 100644 index 0000000..a1d880f --- /dev/null +++ b/TODO @@ -0,0 +1,4 @@ +H add options to aplay to avoid xrun using arecord | aplay +M Rewrite aplay/arecord tool and separate the experimental stuff +M Write a *good* mixer +L Add support for OSS setups to alsactl diff --git a/acinclude.m4 b/acinclude.m4 new file mode 100644 index 0000000..49550f1 --- /dev/null +++ b/acinclude.m4 @@ -0,0 +1,12 @@ +AC_DEFUN([SAVE_UTIL_VERSION], [ +SND_UTIL_VERSION=$VERSION +echo $VERSION > $srcdir/version +AC_DEFINE_UNQUOTED(VERSION, "$SND_UTIL_VERSION", [ALSA util version]) +AC_SUBST(SND_UTIL_VERSION) +SND_UTIL_MAJOR=`echo $VERSION | cut -d . -f 1` +AC_SUBST(SND_UTIL_MAJOR) +SND_UTIL_MINOR=`echo $VERSION | cut -d . -f 2` +AC_SUBST(SND_UTIL_MINOR) +SND_UTIL_SUBMINOR=`echo $VERSION | cut -d . -f 3 | sed -e 's/pre[[0-9]]*//g'` +AC_SUBST(SND_UTIL_SUBMINOR) +]) diff --git a/aclocal.m4 b/aclocal.m4 new file mode 100644 index 0000000..e00b291 --- /dev/null +++ b/aclocal.m4 @@ -0,0 +1,1786 @@ +# generated automatically by aclocal 1.16.1 -*- Autoconf -*- + +# Copyright (C) 1996-2018 Free Software Foundation, Inc. + +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +m4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])]) +m4_ifndef([AC_AUTOCONF_VERSION], + [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl +m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.69],, +[m4_warning([this file was generated for autoconf 2.69. +You have another version of autoconf. It may work, but is not guaranteed to. +If you have problems, you may need to regenerate the build system entirely. +To do so, use the procedure documented by the package, typically 'autoreconf'.])]) + +dnl Configure Paths for Alsa +dnl Some modifications by Richard Boulton +dnl Christopher Lansdown +dnl Jaroslav Kysela +dnl Last modification: $Id: alsa.m4,v 1.24 2004/09/15 18:48:07 tiwai Exp $ +dnl +dnl AM_PATH_ALSA([MINIMUM-VERSION [, ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]]) +dnl Test for libasound, and define ALSA_CFLAGS, ALSA_LIBS and +dnl ALSA_TOPOLOGY_LIBS as appropriate. +dnl +dnl enables arguments --with-alsa-prefix= +dnl --with-alsa-inc-prefix= +dnl --disable-alsatest +dnl +dnl For backwards compatibility, if ACTION_IF_NOT_FOUND is not specified, +dnl and the alsa libraries are not found, a fatal AC_MSG_ERROR() will result. +dnl + +AC_DEFUN([AM_PATH_ALSA], +[dnl Save the original CFLAGS, LDFLAGS, and LIBS +alsa_save_CFLAGS="$CFLAGS" +alsa_save_LDFLAGS="$LDFLAGS" +alsa_save_LIBS="$LIBS" +alsa_found=yes +alsa_topology_found=no + +dnl +dnl Get the cflags and libraries for alsa +dnl +AC_ARG_WITH(alsa-prefix, + AS_HELP_STRING([--with-alsa-prefix=PFX], [Prefix where Alsa library is installed(optional)]), + [alsa_prefix="$withval"], [alsa_prefix=""]) + +AC_ARG_WITH(alsa-inc-prefix, + AS_HELP_STRING([--with-alsa-inc-prefix=PFX], [Prefix where include libraries are (optional)]), + [alsa_inc_prefix="$withval"], [alsa_inc_prefix=""]) + +AC_ARG_ENABLE(alsa-topology, + AS_HELP_STRING([--enable-alsatopology], [Force to use the Alsa topology library]), + [enable_atopology="$enableval"], + [enable_atopology=no]) + +AC_ARG_ENABLE(alsatest, + AS_HELP_STRING([--disable-alsatest], [Do not try to compile and run a test Alsa program]), + [enable_alsatest="$enableval"], + [enable_alsatest=yes]) + +dnl Add any special include directories +AC_MSG_CHECKING(for ALSA CFLAGS) +if test "$alsa_inc_prefix" != "" ; then + ALSA_CFLAGS="$ALSA_CFLAGS -I$alsa_inc_prefix" + CFLAGS="$CFLAGS -I$alsa_inc_prefix" +fi +AC_MSG_RESULT($ALSA_CFLAGS) + +AC_CHECK_LIB(c, dlopen, LIBDL="", [AC_CHECK_LIB(dl, dlopen, LIBDL="-ldl")]) + +dnl add any special lib dirs +AC_MSG_CHECKING(for ALSA LDFLAGS) +if test "$alsa_prefix" != "" ; then + ALSA_LIBS="$ALSA_LIBS -L$alsa_prefix" + LDFLAGS="$LDFLAGS $ALSA_LIBS" +fi + +dnl add the alsa library +ALSA_LIBS="$ALSA_LIBS -lasound -lm $LIBDL -lpthread" +LIBS="$ALSA_LIBS $LIBS" +AC_MSG_RESULT($ALSA_LIBS) + +dnl Check for a working version of libasound that is of the right version. +if test "x$enable_alsatest" = "xyes"; then + +AC_MSG_CHECKING([required libasound headers version]) +min_alsa_version=ifelse([$1], , 0.1.1, $1) +no_alsa="" + alsa_min_major_version=`echo $min_alsa_version | \ + sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'` + alsa_min_minor_version=`echo $min_alsa_version | \ + sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'` + alsa_min_micro_version=`echo $min_alsa_version | \ + sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'` +AC_MSG_RESULT($alsa_min_major_version.$alsa_min_minor_version.$alsa_min_micro_version) + +AC_LANG_SAVE +AC_LANG_C +AC_MSG_CHECKING([for libasound headers version >= $alsa_min_major_version.$alsa_min_minor_version.$alsa_min_micro_version ($min_alsa_version)]) +AC_TRY_COMPILE([ +#include +], [ +/* ensure backward compatibility */ +#if !defined(SND_LIB_MAJOR) && defined(SOUNDLIB_VERSION_MAJOR) +#define SND_LIB_MAJOR SOUNDLIB_VERSION_MAJOR +#endif +#if !defined(SND_LIB_MINOR) && defined(SOUNDLIB_VERSION_MINOR) +#define SND_LIB_MINOR SOUNDLIB_VERSION_MINOR +#endif +#if !defined(SND_LIB_SUBMINOR) && defined(SOUNDLIB_VERSION_SUBMINOR) +#define SND_LIB_SUBMINOR SOUNDLIB_VERSION_SUBMINOR +#endif + +# if(SND_LIB_MAJOR > $alsa_min_major_version) + exit(0); +# else +# if(SND_LIB_MAJOR < $alsa_min_major_version) +# error not present +# endif + +# if(SND_LIB_MINOR > $alsa_min_minor_version) + exit(0); +# else +# if(SND_LIB_MINOR < $alsa_min_minor_version) +# error not present +# endif + +# if(SND_LIB_SUBMINOR < $alsa_min_micro_version) +# error not present +# endif +# endif +# endif +exit(0); +], + [AC_MSG_RESULT(found.)], + [AC_MSG_RESULT(not present.) + ifelse([$3], , [AC_MSG_ERROR(Sufficiently new version of libasound not found.)]) + alsa_found=no] +) +AC_LANG_RESTORE + +AC_LANG_SAVE +AC_LANG_C +AC_MSG_CHECKING([for libatopology (sound headers version > 1.1.9)]) +AC_TRY_COMPILE([ +#include +#include +], [ +/* ensure backward compatibility */ +#if !defined(SND_LIB_VERSION) +#define SND_LIB_VERSION 0 +#endif +#if SND_LIB_VERSION > 0x00010109 + exit(0); +#else +# error not present +#endif +exit(0); +], + [AC_MSG_RESULT(yes) + enable_atopology="yes"], + [AC_MSG_RESULT(no)] +) +AC_LANG_RESTORE + +fi + +dnl Now that we know that we have the right version, let's see if we have the library and not just the headers. +if test "x$enable_alsatest" = "xyes"; then +AC_CHECK_LIB([asound], [snd_ctl_open],, + [ifelse([$3], , [AC_MSG_ERROR(No linkable libasound was found.)]) + alsa_found=no] +) +if test "x$enable_atopology" = "xyes"; then +alsa_topology_found=yes +alsa_save_LIBS2="$LIBS" +AC_CHECK_LIB([atopology], [snd_tplg_new],, + [ifelse([$3], , [AC_MSG_ERROR(No linkable libatopology was found.)]) + alsa_topology_found=no, +] +) +LIBS="$alsa_save_LIBS2" +fi +else +if test "x$enable_atopology" = "xyes"; then + alsa_topology_found=yes +fi +fi + +if test "x$alsa_found" = "xyes" ; then + ifelse([$2], , :, [$2]) + LIBS=`echo $LIBS | sed 's/-lasound//g'` + LIBS=`echo $LIBS | sed 's/ //'` + LIBS="-lasound $LIBS" +fi +if test "x$alsa_found" = "xno" ; then + ifelse([$3], , :, [$3]) + CFLAGS="$alsa_save_CFLAGS" + LDFLAGS="$alsa_save_LDFLAGS" + LIBS="$alsa_save_LIBS" + ALSA_CFLAGS="" + ALSA_LIBS="" + ALSA_TOPOLOGY_LIBS="" +fi + +dnl add the alsa topology library; must be at the end +AC_MSG_CHECKING(for ALSA topology LDFLAGS) +if test "x$alsa_topology_found" = "xyes"; then + ALSA_TOPOLOGY_LIBS="$ALSA_TOPOLOGY_LIBS -latopology" +fi +AC_MSG_RESULT($ALSA_TOPOLOGY_LIBS) + +dnl That should be it. Now just export out symbols: +AC_SUBST(ALSA_CFLAGS) +AC_SUBST(ALSA_LIBS) +AC_SUBST(ALSA_TOPOLOGY_LIBS) +]) + +# intlmacosx.m4 serial 5 (gettext-0.18.2) +dnl Copyright (C) 2004-2014, 2016 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. +dnl +dnl This file can be used in projects which are not available under +dnl the GNU General Public License or the GNU Library General Public +dnl License but which still want to provide support for the GNU gettext +dnl functionality. +dnl Please note that the actual code of the GNU gettext library is covered +dnl by the GNU Library General Public License, and the rest of the GNU +dnl gettext package is covered by the GNU General Public License. +dnl They are *not* in the public domain. + +dnl Checks for special options needed on Mac OS X. +dnl Defines INTL_MACOSX_LIBS. +AC_DEFUN([gt_INTL_MACOSX], +[ + dnl Check for API introduced in Mac OS X 10.2. + AC_CACHE_CHECK([for CFPreferencesCopyAppValue], + [gt_cv_func_CFPreferencesCopyAppValue], + [gt_save_LIBS="$LIBS" + LIBS="$LIBS -Wl,-framework -Wl,CoreFoundation" + AC_LINK_IFELSE( + [AC_LANG_PROGRAM( + [[#include ]], + [[CFPreferencesCopyAppValue(NULL, NULL)]])], + [gt_cv_func_CFPreferencesCopyAppValue=yes], + [gt_cv_func_CFPreferencesCopyAppValue=no]) + LIBS="$gt_save_LIBS"]) + if test $gt_cv_func_CFPreferencesCopyAppValue = yes; then + AC_DEFINE([HAVE_CFPREFERENCESCOPYAPPVALUE], [1], + [Define to 1 if you have the Mac OS X function CFPreferencesCopyAppValue in the CoreFoundation framework.]) + fi + dnl Check for API introduced in Mac OS X 10.3. + AC_CACHE_CHECK([for CFLocaleCopyCurrent], [gt_cv_func_CFLocaleCopyCurrent], + [gt_save_LIBS="$LIBS" + LIBS="$LIBS -Wl,-framework -Wl,CoreFoundation" + AC_LINK_IFELSE( + [AC_LANG_PROGRAM( + [[#include ]], + [[CFLocaleCopyCurrent();]])], + [gt_cv_func_CFLocaleCopyCurrent=yes], + [gt_cv_func_CFLocaleCopyCurrent=no]) + LIBS="$gt_save_LIBS"]) + if test $gt_cv_func_CFLocaleCopyCurrent = yes; then + AC_DEFINE([HAVE_CFLOCALECOPYCURRENT], [1], + [Define to 1 if you have the Mac OS X function CFLocaleCopyCurrent in the CoreFoundation framework.]) + fi + INTL_MACOSX_LIBS= + if test $gt_cv_func_CFPreferencesCopyAppValue = yes || test $gt_cv_func_CFLocaleCopyCurrent = yes; then + INTL_MACOSX_LIBS="-Wl,-framework -Wl,CoreFoundation" + fi + AC_SUBST([INTL_MACOSX_LIBS]) +]) + +# pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*- +# serial 11 (pkg-config-0.29.1) + +dnl Copyright © 2004 Scott James Remnant . +dnl Copyright © 2012-2015 Dan Nicholson +dnl +dnl This program is free software; you can redistribute it and/or modify +dnl it under the terms of the GNU General Public License as published by +dnl the Free Software Foundation; either version 2 of the License, or +dnl (at your option) any later version. +dnl +dnl This program is distributed in the hope that it will be useful, but +dnl WITHOUT ANY WARRANTY; without even the implied warranty of +dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +dnl General Public License for more details. +dnl +dnl You should have received a copy of the GNU General Public License +dnl along with this program; if not, write to the Free Software +dnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +dnl 02111-1307, USA. +dnl +dnl As a special exception to the GNU General Public License, if you +dnl distribute this file as part of a program that contains a +dnl configuration script generated by Autoconf, you may include it under +dnl the same distribution terms that you use for the rest of that +dnl program. + +dnl PKG_PREREQ(MIN-VERSION) +dnl ----------------------- +dnl Since: 0.29 +dnl +dnl Verify that the version of the pkg-config macros are at least +dnl MIN-VERSION. Unlike PKG_PROG_PKG_CONFIG, which checks the user's +dnl installed version of pkg-config, this checks the developer's version +dnl of pkg.m4 when generating configure. +dnl +dnl To ensure that this macro is defined, also add: +dnl m4_ifndef([PKG_PREREQ], +dnl [m4_fatal([must install pkg-config 0.29 or later before running autoconf/autogen])]) +dnl +dnl See the "Since" comment for each macro you use to see what version +dnl of the macros you require. +m4_defun([PKG_PREREQ], +[m4_define([PKG_MACROS_VERSION], [0.29.1]) +m4_if(m4_version_compare(PKG_MACROS_VERSION, [$1]), -1, + [m4_fatal([pkg.m4 version $1 or higher is required but ]PKG_MACROS_VERSION[ found])]) +])dnl PKG_PREREQ + +dnl PKG_PROG_PKG_CONFIG([MIN-VERSION]) +dnl ---------------------------------- +dnl Since: 0.16 +dnl +dnl Search for the pkg-config tool and set the PKG_CONFIG variable to +dnl first found in the path. Checks that the version of pkg-config found +dnl is at least MIN-VERSION. If MIN-VERSION is not specified, 0.9.0 is +dnl used since that's the first version where most current features of +dnl pkg-config existed. +AC_DEFUN([PKG_PROG_PKG_CONFIG], +[m4_pattern_forbid([^_?PKG_[A-Z_]+$]) +m4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$]) +m4_pattern_allow([^PKG_CONFIG_(DISABLE_UNINSTALLED|TOP_BUILD_DIR|DEBUG_SPEW)$]) +AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility]) +AC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path]) +AC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path]) + +if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then + AC_PATH_TOOL([PKG_CONFIG], [pkg-config]) +fi +if test -n "$PKG_CONFIG"; then + _pkg_min_version=m4_default([$1], [0.9.0]) + AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version]) + if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then + AC_MSG_RESULT([yes]) + else + AC_MSG_RESULT([no]) + PKG_CONFIG="" + fi +fi[]dnl +])dnl PKG_PROG_PKG_CONFIG + +dnl PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) +dnl ------------------------------------------------------------------- +dnl Since: 0.18 +dnl +dnl Check to see whether a particular set of modules exists. Similar to +dnl PKG_CHECK_MODULES(), but does not set variables or print errors. +dnl +dnl Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG]) +dnl only at the first occurence in configure.ac, so if the first place +dnl it's called might be skipped (such as if it is within an "if", you +dnl have to call PKG_CHECK_EXISTS manually +AC_DEFUN([PKG_CHECK_EXISTS], +[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl +if test -n "$PKG_CONFIG" && \ + AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then + m4_default([$2], [:]) +m4_ifvaln([$3], [else + $3])dnl +fi]) + +dnl _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES]) +dnl --------------------------------------------- +dnl Internal wrapper calling pkg-config via PKG_CONFIG and setting +dnl pkg_failed based on the result. +m4_define([_PKG_CONFIG], +[if test -n "$$1"; then + pkg_cv_[]$1="$$1" + elif test -n "$PKG_CONFIG"; then + PKG_CHECK_EXISTS([$3], + [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes ], + [pkg_failed=yes]) + else + pkg_failed=untried +fi[]dnl +])dnl _PKG_CONFIG + +dnl _PKG_SHORT_ERRORS_SUPPORTED +dnl --------------------------- +dnl Internal check to see if pkg-config supports short errors. +AC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED], +[AC_REQUIRE([PKG_PROG_PKG_CONFIG]) +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then + _pkg_short_errors_supported=yes +else + _pkg_short_errors_supported=no +fi[]dnl +])dnl _PKG_SHORT_ERRORS_SUPPORTED + + +dnl PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND], +dnl [ACTION-IF-NOT-FOUND]) +dnl -------------------------------------------------------------- +dnl Since: 0.4.0 +dnl +dnl Note that if there is a possibility the first call to +dnl PKG_CHECK_MODULES might not happen, you should be sure to include an +dnl explicit call to PKG_PROG_PKG_CONFIG in your configure.ac +AC_DEFUN([PKG_CHECK_MODULES], +[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl +AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl +AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl + +pkg_failed=no +AC_MSG_CHECKING([for $1]) + +_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2]) +_PKG_CONFIG([$1][_LIBS], [libs], [$2]) + +m4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS +and $1[]_LIBS to avoid the need to call pkg-config. +See the pkg-config man page for more details.]) + +if test $pkg_failed = yes; then + AC_MSG_RESULT([no]) + _PKG_SHORT_ERRORS_SUPPORTED + if test $_pkg_short_errors_supported = yes; then + $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1` + else + $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1` + fi + # Put the nasty error message in config.log where it belongs + echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD + + m4_default([$4], [AC_MSG_ERROR( +[Package requirements ($2) were not met: + +$$1_PKG_ERRORS + +Consider adjusting the PKG_CONFIG_PATH environment variable if you +installed software in a non-standard prefix. + +_PKG_TEXT])[]dnl + ]) +elif test $pkg_failed = untried; then + AC_MSG_RESULT([no]) + m4_default([$4], [AC_MSG_FAILURE( +[The pkg-config script could not be found or is too old. Make sure it +is in your PATH or set the PKG_CONFIG environment variable to the full +path to pkg-config. + +_PKG_TEXT + +To get pkg-config, see .])[]dnl + ]) +else + $1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS + $1[]_LIBS=$pkg_cv_[]$1[]_LIBS + AC_MSG_RESULT([yes]) + $3 +fi[]dnl +])dnl PKG_CHECK_MODULES + + +dnl PKG_CHECK_MODULES_STATIC(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND], +dnl [ACTION-IF-NOT-FOUND]) +dnl --------------------------------------------------------------------- +dnl Since: 0.29 +dnl +dnl Checks for existence of MODULES and gathers its build flags with +dnl static libraries enabled. Sets VARIABLE-PREFIX_CFLAGS from --cflags +dnl and VARIABLE-PREFIX_LIBS from --libs. +dnl +dnl Note that if there is a possibility the first call to +dnl PKG_CHECK_MODULES_STATIC might not happen, you should be sure to +dnl include an explicit call to PKG_PROG_PKG_CONFIG in your +dnl configure.ac. +AC_DEFUN([PKG_CHECK_MODULES_STATIC], +[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl +_save_PKG_CONFIG=$PKG_CONFIG +PKG_CONFIG="$PKG_CONFIG --static" +PKG_CHECK_MODULES($@) +PKG_CONFIG=$_save_PKG_CONFIG[]dnl +])dnl PKG_CHECK_MODULES_STATIC + + +dnl PKG_INSTALLDIR([DIRECTORY]) +dnl ------------------------- +dnl Since: 0.27 +dnl +dnl Substitutes the variable pkgconfigdir as the location where a module +dnl should install pkg-config .pc files. By default the directory is +dnl $libdir/pkgconfig, but the default can be changed by passing +dnl DIRECTORY. The user can override through the --with-pkgconfigdir +dnl parameter. +AC_DEFUN([PKG_INSTALLDIR], +[m4_pushdef([pkg_default], [m4_default([$1], ['${libdir}/pkgconfig'])]) +m4_pushdef([pkg_description], + [pkg-config installation directory @<:@]pkg_default[@:>@]) +AC_ARG_WITH([pkgconfigdir], + [AS_HELP_STRING([--with-pkgconfigdir], pkg_description)],, + [with_pkgconfigdir=]pkg_default) +AC_SUBST([pkgconfigdir], [$with_pkgconfigdir]) +m4_popdef([pkg_default]) +m4_popdef([pkg_description]) +])dnl PKG_INSTALLDIR + + +dnl PKG_NOARCH_INSTALLDIR([DIRECTORY]) +dnl -------------------------------- +dnl Since: 0.27 +dnl +dnl Substitutes the variable noarch_pkgconfigdir as the location where a +dnl module should install arch-independent pkg-config .pc files. By +dnl default the directory is $datadir/pkgconfig, but the default can be +dnl changed by passing DIRECTORY. The user can override through the +dnl --with-noarch-pkgconfigdir parameter. +AC_DEFUN([PKG_NOARCH_INSTALLDIR], +[m4_pushdef([pkg_default], [m4_default([$1], ['${datadir}/pkgconfig'])]) +m4_pushdef([pkg_description], + [pkg-config arch-independent installation directory @<:@]pkg_default[@:>@]) +AC_ARG_WITH([noarch-pkgconfigdir], + [AS_HELP_STRING([--with-noarch-pkgconfigdir], pkg_description)],, + [with_noarch_pkgconfigdir=]pkg_default) +AC_SUBST([noarch_pkgconfigdir], [$with_noarch_pkgconfigdir]) +m4_popdef([pkg_default]) +m4_popdef([pkg_description]) +])dnl PKG_NOARCH_INSTALLDIR + + +dnl PKG_CHECK_VAR(VARIABLE, MODULE, CONFIG-VARIABLE, +dnl [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) +dnl ------------------------------------------- +dnl Since: 0.28 +dnl +dnl Retrieves the value of the pkg-config variable for the given module. +AC_DEFUN([PKG_CHECK_VAR], +[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl +AC_ARG_VAR([$1], [value of $3 for $2, overriding pkg-config])dnl + +_PKG_CONFIG([$1], [variable="][$3]["], [$2]) +AS_VAR_COPY([$1], [pkg_cv_][$1]) + +AS_VAR_IF([$1], [""], [$5], [$4])dnl +])dnl PKG_CHECK_VAR + +dnl PKG_WITH_MODULES(VARIABLE-PREFIX, MODULES, +dnl [ACTION-IF-FOUND],[ACTION-IF-NOT-FOUND], +dnl [DESCRIPTION], [DEFAULT]) +dnl ------------------------------------------ +dnl +dnl Prepare a "--with-" configure option using the lowercase +dnl [VARIABLE-PREFIX] name, merging the behaviour of AC_ARG_WITH and +dnl PKG_CHECK_MODULES in a single macro. +AC_DEFUN([PKG_WITH_MODULES], +[ +m4_pushdef([with_arg], m4_tolower([$1])) + +m4_pushdef([description], + [m4_default([$5], [build with ]with_arg[ support])]) + +m4_pushdef([def_arg], [m4_default([$6], [auto])]) +m4_pushdef([def_action_if_found], [AS_TR_SH([with_]with_arg)=yes]) +m4_pushdef([def_action_if_not_found], [AS_TR_SH([with_]with_arg)=no]) + +m4_case(def_arg, + [yes],[m4_pushdef([with_without], [--without-]with_arg)], + [m4_pushdef([with_without],[--with-]with_arg)]) + +AC_ARG_WITH(with_arg, + AS_HELP_STRING(with_without, description[ @<:@default=]def_arg[@:>@]),, + [AS_TR_SH([with_]with_arg)=def_arg]) + +AS_CASE([$AS_TR_SH([with_]with_arg)], + [yes],[PKG_CHECK_MODULES([$1],[$2],$3,$4)], + [auto],[PKG_CHECK_MODULES([$1],[$2], + [m4_n([def_action_if_found]) $3], + [m4_n([def_action_if_not_found]) $4])]) + +m4_popdef([with_arg]) +m4_popdef([description]) +m4_popdef([def_arg]) + +])dnl PKG_WITH_MODULES + +dnl PKG_HAVE_WITH_MODULES(VARIABLE-PREFIX, MODULES, +dnl [DESCRIPTION], [DEFAULT]) +dnl ----------------------------------------------- +dnl +dnl Convenience macro to trigger AM_CONDITIONAL after PKG_WITH_MODULES +dnl check._[VARIABLE-PREFIX] is exported as make variable. +AC_DEFUN([PKG_HAVE_WITH_MODULES], +[ +PKG_WITH_MODULES([$1],[$2],,,[$3],[$4]) + +AM_CONDITIONAL([HAVE_][$1], + [test "$AS_TR_SH([with_]m4_tolower([$1]))" = "yes"]) +])dnl PKG_HAVE_WITH_MODULES + +dnl PKG_HAVE_DEFINE_WITH_MODULES(VARIABLE-PREFIX, MODULES, +dnl [DESCRIPTION], [DEFAULT]) +dnl ------------------------------------------------------ +dnl +dnl Convenience macro to run AM_CONDITIONAL and AC_DEFINE after +dnl PKG_WITH_MODULES check. HAVE_[VARIABLE-PREFIX] is exported as make +dnl and preprocessor variable. +AC_DEFUN([PKG_HAVE_DEFINE_WITH_MODULES], +[ +PKG_HAVE_WITH_MODULES([$1],[$2],[$3],[$4]) + +AS_IF([test "$AS_TR_SH([with_]m4_tolower([$1]))" = "yes"], + [AC_DEFINE([HAVE_][$1], 1, [Enable ]m4_tolower([$1])[ support])]) +])dnl PKG_HAVE_DEFINE_WITH_MODULES + +# Copyright (C) 2002-2018 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# AM_AUTOMAKE_VERSION(VERSION) +# ---------------------------- +# Automake X.Y traces this macro to ensure aclocal.m4 has been +# generated from the m4 files accompanying Automake X.Y. +# (This private macro should not be called outside this file.) +AC_DEFUN([AM_AUTOMAKE_VERSION], +[am__api_version='1.16' +dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to +dnl require some minimum version. Point them to the right macro. +m4_if([$1], [1.16.1], [], + [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl +]) + +# _AM_AUTOCONF_VERSION(VERSION) +# ----------------------------- +# aclocal traces this macro to find the Autoconf version. +# This is a private macro too. Using m4_define simplifies +# the logic in aclocal, which can simply ignore this definition. +m4_define([_AM_AUTOCONF_VERSION], []) + +# AM_SET_CURRENT_AUTOMAKE_VERSION +# ------------------------------- +# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced. +# This function is AC_REQUIREd by AM_INIT_AUTOMAKE. +AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION], +[AM_AUTOMAKE_VERSION([1.16.1])dnl +m4_ifndef([AC_AUTOCONF_VERSION], + [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl +_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))]) + +# AM_AUX_DIR_EXPAND -*- Autoconf -*- + +# Copyright (C) 2001-2018 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets +# $ac_aux_dir to '$srcdir/foo'. In other projects, it is set to +# '$srcdir', '$srcdir/..', or '$srcdir/../..'. +# +# Of course, Automake must honor this variable whenever it calls a +# tool from the auxiliary directory. The problem is that $srcdir (and +# therefore $ac_aux_dir as well) can be either absolute or relative, +# depending on how configure is run. This is pretty annoying, since +# it makes $ac_aux_dir quite unusable in subdirectories: in the top +# source directory, any form will work fine, but in subdirectories a +# relative path needs to be adjusted first. +# +# $ac_aux_dir/missing +# fails when called from a subdirectory if $ac_aux_dir is relative +# $top_srcdir/$ac_aux_dir/missing +# fails if $ac_aux_dir is absolute, +# fails when called from a subdirectory in a VPATH build with +# a relative $ac_aux_dir +# +# The reason of the latter failure is that $top_srcdir and $ac_aux_dir +# are both prefixed by $srcdir. In an in-source build this is usually +# harmless because $srcdir is '.', but things will broke when you +# start a VPATH build or use an absolute $srcdir. +# +# So we could use something similar to $top_srcdir/$ac_aux_dir/missing, +# iff we strip the leading $srcdir from $ac_aux_dir. That would be: +# am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"` +# and then we would define $MISSING as +# MISSING="\${SHELL} $am_aux_dir/missing" +# This will work as long as MISSING is not called from configure, because +# unfortunately $(top_srcdir) has no meaning in configure. +# However there are other variables, like CC, which are often used in +# configure, and could therefore not use this "fixed" $ac_aux_dir. +# +# Another solution, used here, is to always expand $ac_aux_dir to an +# absolute PATH. The drawback is that using absolute paths prevent a +# configured tree to be moved without reconfiguration. + +AC_DEFUN([AM_AUX_DIR_EXPAND], +[AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl +# Expand $ac_aux_dir to an absolute path. +am_aux_dir=`cd "$ac_aux_dir" && pwd` +]) + +# AM_CONDITIONAL -*- Autoconf -*- + +# Copyright (C) 1997-2018 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# AM_CONDITIONAL(NAME, SHELL-CONDITION) +# ------------------------------------- +# Define a conditional. +AC_DEFUN([AM_CONDITIONAL], +[AC_PREREQ([2.52])dnl + m4_if([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])], + [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl +AC_SUBST([$1_TRUE])dnl +AC_SUBST([$1_FALSE])dnl +_AM_SUBST_NOTMAKE([$1_TRUE])dnl +_AM_SUBST_NOTMAKE([$1_FALSE])dnl +m4_define([_AM_COND_VALUE_$1], [$2])dnl +if $2; then + $1_TRUE= + $1_FALSE='#' +else + $1_TRUE='#' + $1_FALSE= +fi +AC_CONFIG_COMMANDS_PRE( +[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then + AC_MSG_ERROR([[conditional "$1" was never defined. +Usually this means the macro was only invoked conditionally.]]) +fi])]) + +# Copyright (C) 1999-2018 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + + +# There are a few dirty hacks below to avoid letting 'AC_PROG_CC' be +# written in clear, in which case automake, when reading aclocal.m4, +# will think it sees a *use*, and therefore will trigger all it's +# C support machinery. Also note that it means that autoscan, seeing +# CC etc. in the Makefile, will ask for an AC_PROG_CC use... + + +# _AM_DEPENDENCIES(NAME) +# ---------------------- +# See how the compiler implements dependency checking. +# NAME is "CC", "CXX", "OBJC", "OBJCXX", "UPC", or "GJC". +# We try a few techniques and use that to set a single cache variable. +# +# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was +# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular +# dependency, and given that the user is not expected to run this macro, +# just rely on AC_PROG_CC. +AC_DEFUN([_AM_DEPENDENCIES], +[AC_REQUIRE([AM_SET_DEPDIR])dnl +AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl +AC_REQUIRE([AM_MAKE_INCLUDE])dnl +AC_REQUIRE([AM_DEP_TRACK])dnl + +m4_if([$1], [CC], [depcc="$CC" am_compiler_list=], + [$1], [CXX], [depcc="$CXX" am_compiler_list=], + [$1], [OBJC], [depcc="$OBJC" am_compiler_list='gcc3 gcc'], + [$1], [OBJCXX], [depcc="$OBJCXX" am_compiler_list='gcc3 gcc'], + [$1], [UPC], [depcc="$UPC" am_compiler_list=], + [$1], [GCJ], [depcc="$GCJ" am_compiler_list='gcc3 gcc'], + [depcc="$$1" am_compiler_list=]) + +AC_CACHE_CHECK([dependency style of $depcc], + [am_cv_$1_dependencies_compiler_type], +[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then + # We make a subdir and do the tests there. Otherwise we can end up + # making bogus files that we don't know about and never remove. For + # instance it was reported that on HP-UX the gcc test will end up + # making a dummy file named 'D' -- because '-MD' means "put the output + # in D". + rm -rf conftest.dir + mkdir conftest.dir + # Copy depcomp to subdir because otherwise we won't find it if we're + # using a relative directory. + cp "$am_depcomp" conftest.dir + cd conftest.dir + # We will build objects and dependencies in a subdirectory because + # it helps to detect inapplicable dependency modes. For instance + # both Tru64's cc and ICC support -MD to output dependencies as a + # side effect of compilation, but ICC will put the dependencies in + # the current directory while Tru64 will put them in the object + # directory. + mkdir sub + + am_cv_$1_dependencies_compiler_type=none + if test "$am_compiler_list" = ""; then + am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp` + fi + am__universal=false + m4_case([$1], [CC], + [case " $depcc " in #( + *\ -arch\ *\ -arch\ *) am__universal=true ;; + esac], + [CXX], + [case " $depcc " in #( + *\ -arch\ *\ -arch\ *) am__universal=true ;; + esac]) + + for depmode in $am_compiler_list; do + # Setup a source with many dependencies, because some compilers + # like to wrap large dependency lists on column 80 (with \), and + # we should not choose a depcomp mode which is confused by this. + # + # We need to recreate these files for each test, as the compiler may + # overwrite some of them when testing with obscure command lines. + # This happens at least with the AIX C compiler. + : > sub/conftest.c + for i in 1 2 3 4 5 6; do + echo '#include "conftst'$i'.h"' >> sub/conftest.c + # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with + # Solaris 10 /bin/sh. + echo '/* dummy */' > sub/conftst$i.h + done + echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf + + # We check with '-c' and '-o' for the sake of the "dashmstdout" + # mode. It turns out that the SunPro C++ compiler does not properly + # handle '-M -o', and we need to detect this. Also, some Intel + # versions had trouble with output in subdirs. + am__obj=sub/conftest.${OBJEXT-o} + am__minus_obj="-o $am__obj" + case $depmode in + gcc) + # This depmode causes a compiler race in universal mode. + test "$am__universal" = false || continue + ;; + nosideeffect) + # After this tag, mechanisms are not by side-effect, so they'll + # only be used when explicitly requested. + if test "x$enable_dependency_tracking" = xyes; then + continue + else + break + fi + ;; + msvc7 | msvc7msys | msvisualcpp | msvcmsys) + # This compiler won't grok '-c -o', but also, the minuso test has + # not run yet. These depmodes are late enough in the game, and + # so weak that their functioning should not be impacted. + am__obj=conftest.${OBJEXT-o} + am__minus_obj= + ;; + none) break ;; + esac + if depmode=$depmode \ + source=sub/conftest.c object=$am__obj \ + depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ + $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \ + >/dev/null 2>conftest.err && + grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && + grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && + grep $am__obj sub/conftest.Po > /dev/null 2>&1 && + ${MAKE-make} -s -f confmf > /dev/null 2>&1; then + # icc doesn't choke on unknown options, it will just issue warnings + # or remarks (even with -Werror). So we grep stderr for any message + # that says an option was ignored or not supported. + # When given -MP, icc 7.0 and 7.1 complain thusly: + # icc: Command line warning: ignoring option '-M'; no argument required + # The diagnosis changed in icc 8.0: + # icc: Command line remark: option '-MP' not supported + if (grep 'ignoring option' conftest.err || + grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else + am_cv_$1_dependencies_compiler_type=$depmode + break + fi + fi + done + + cd .. + rm -rf conftest.dir +else + am_cv_$1_dependencies_compiler_type=none +fi +]) +AC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type]) +AM_CONDITIONAL([am__fastdep$1], [ + test "x$enable_dependency_tracking" != xno \ + && test "$am_cv_$1_dependencies_compiler_type" = gcc3]) +]) + + +# AM_SET_DEPDIR +# ------------- +# Choose a directory name for dependency files. +# This macro is AC_REQUIREd in _AM_DEPENDENCIES. +AC_DEFUN([AM_SET_DEPDIR], +[AC_REQUIRE([AM_SET_LEADING_DOT])dnl +AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl +]) + + +# AM_DEP_TRACK +# ------------ +AC_DEFUN([AM_DEP_TRACK], +[AC_ARG_ENABLE([dependency-tracking], [dnl +AS_HELP_STRING( + [--enable-dependency-tracking], + [do not reject slow dependency extractors]) +AS_HELP_STRING( + [--disable-dependency-tracking], + [speeds up one-time build])]) +if test "x$enable_dependency_tracking" != xno; then + am_depcomp="$ac_aux_dir/depcomp" + AMDEPBACKSLASH='\' + am__nodep='_no' +fi +AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno]) +AC_SUBST([AMDEPBACKSLASH])dnl +_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl +AC_SUBST([am__nodep])dnl +_AM_SUBST_NOTMAKE([am__nodep])dnl +]) + +# Generate code to set up dependency tracking. -*- Autoconf -*- + +# Copyright (C) 1999-2018 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# _AM_OUTPUT_DEPENDENCY_COMMANDS +# ------------------------------ +AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS], +[{ + # Older Autoconf quotes --file arguments for eval, but not when files + # are listed without --file. Let's play safe and only enable the eval + # if we detect the quoting. + # TODO: see whether this extra hack can be removed once we start + # requiring Autoconf 2.70 or later. + AS_CASE([$CONFIG_FILES], + [*\'*], [eval set x "$CONFIG_FILES"], + [*], [set x $CONFIG_FILES]) + shift + # Used to flag and report bootstrapping failures. + am_rc=0 + for am_mf + do + # Strip MF so we end up with the name of the file. + am_mf=`AS_ECHO(["$am_mf"]) | sed -e 's/:.*$//'` + # Check whether this is an Automake generated Makefile which includes + # dependency-tracking related rules and includes. + # Grep'ing the whole file directly is not great: AIX grep has a line + # limit of 2048, but all sed's we know have understand at least 4000. + sed -n 's,^am--depfiles:.*,X,p' "$am_mf" | grep X >/dev/null 2>&1 \ + || continue + am_dirpart=`AS_DIRNAME(["$am_mf"])` + am_filepart=`AS_BASENAME(["$am_mf"])` + AM_RUN_LOG([cd "$am_dirpart" \ + && sed -e '/# am--include-marker/d' "$am_filepart" \ + | $MAKE -f - am--depfiles]) || am_rc=$? + done + if test $am_rc -ne 0; then + AC_MSG_FAILURE([Something went wrong bootstrapping makefile fragments + for automatic dependency tracking. Try re-running configure with the + '--disable-dependency-tracking' option to at least be able to build + the package (albeit without support for automatic dependency tracking).]) + fi + AS_UNSET([am_dirpart]) + AS_UNSET([am_filepart]) + AS_UNSET([am_mf]) + AS_UNSET([am_rc]) + rm -f conftest-deps.mk +} +])# _AM_OUTPUT_DEPENDENCY_COMMANDS + + +# AM_OUTPUT_DEPENDENCY_COMMANDS +# ----------------------------- +# This macro should only be invoked once -- use via AC_REQUIRE. +# +# This code is only required when automatic dependency tracking is enabled. +# This creates each '.Po' and '.Plo' makefile fragment that we'll need in +# order to bootstrap the dependency handling code. +AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS], +[AC_CONFIG_COMMANDS([depfiles], + [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS], + [AMDEP_TRUE="$AMDEP_TRUE" MAKE="${MAKE-make}"])]) + +# Do all the work for Automake. -*- Autoconf -*- + +# Copyright (C) 1996-2018 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This macro actually does too much. Some checks are only needed if +# your package does certain things. But this isn't really a big deal. + +dnl Redefine AC_PROG_CC to automatically invoke _AM_PROG_CC_C_O. +m4_define([AC_PROG_CC], +m4_defn([AC_PROG_CC]) +[_AM_PROG_CC_C_O +]) + +# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE]) +# AM_INIT_AUTOMAKE([OPTIONS]) +# ----------------------------------------------- +# The call with PACKAGE and VERSION arguments is the old style +# call (pre autoconf-2.50), which is being phased out. PACKAGE +# and VERSION should now be passed to AC_INIT and removed from +# the call to AM_INIT_AUTOMAKE. +# We support both call styles for the transition. After +# the next Automake release, Autoconf can make the AC_INIT +# arguments mandatory, and then we can depend on a new Autoconf +# release and drop the old call support. +AC_DEFUN([AM_INIT_AUTOMAKE], +[AC_PREREQ([2.65])dnl +dnl Autoconf wants to disallow AM_ names. We explicitly allow +dnl the ones we care about. +m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl +AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl +AC_REQUIRE([AC_PROG_INSTALL])dnl +if test "`cd $srcdir && pwd`" != "`pwd`"; then + # Use -I$(srcdir) only when $(srcdir) != ., so that make's output + # is not polluted with repeated "-I." + AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl + # test to see if srcdir already configured + if test -f $srcdir/config.status; then + AC_MSG_ERROR([source directory already configured; run "make distclean" there first]) + fi +fi + +# test whether we have cygpath +if test -z "$CYGPATH_W"; then + if (cygpath --version) >/dev/null 2>/dev/null; then + CYGPATH_W='cygpath -w' + else + CYGPATH_W=echo + fi +fi +AC_SUBST([CYGPATH_W]) + +# Define the identity of the package. +dnl Distinguish between old-style and new-style calls. +m4_ifval([$2], +[AC_DIAGNOSE([obsolete], + [$0: two- and three-arguments forms are deprecated.]) +m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl + AC_SUBST([PACKAGE], [$1])dnl + AC_SUBST([VERSION], [$2])], +[_AM_SET_OPTIONS([$1])dnl +dnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT. +m4_if( + m4_ifdef([AC_PACKAGE_NAME], [ok]):m4_ifdef([AC_PACKAGE_VERSION], [ok]), + [ok:ok],, + [m4_fatal([AC_INIT should be called with package and version arguments])])dnl + AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl + AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl + +_AM_IF_OPTION([no-define],, +[AC_DEFINE_UNQUOTED([PACKAGE], ["$PACKAGE"], [Name of package]) + AC_DEFINE_UNQUOTED([VERSION], ["$VERSION"], [Version number of package])])dnl + +# Some tools Automake needs. +AC_REQUIRE([AM_SANITY_CHECK])dnl +AC_REQUIRE([AC_ARG_PROGRAM])dnl +AM_MISSING_PROG([ACLOCAL], [aclocal-${am__api_version}]) +AM_MISSING_PROG([AUTOCONF], [autoconf]) +AM_MISSING_PROG([AUTOMAKE], [automake-${am__api_version}]) +AM_MISSING_PROG([AUTOHEADER], [autoheader]) +AM_MISSING_PROG([MAKEINFO], [makeinfo]) +AC_REQUIRE([AM_PROG_INSTALL_SH])dnl +AC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl +AC_REQUIRE([AC_PROG_MKDIR_P])dnl +# For better backward compatibility. To be removed once Automake 1.9.x +# dies out for good. For more background, see: +# +# +AC_SUBST([mkdir_p], ['$(MKDIR_P)']) +# We need awk for the "check" target (and possibly the TAP driver). The +# system "awk" is bad on some platforms. +AC_REQUIRE([AC_PROG_AWK])dnl +AC_REQUIRE([AC_PROG_MAKE_SET])dnl +AC_REQUIRE([AM_SET_LEADING_DOT])dnl +_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])], + [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])], + [_AM_PROG_TAR([v7])])]) +_AM_IF_OPTION([no-dependencies],, +[AC_PROVIDE_IFELSE([AC_PROG_CC], + [_AM_DEPENDENCIES([CC])], + [m4_define([AC_PROG_CC], + m4_defn([AC_PROG_CC])[_AM_DEPENDENCIES([CC])])])dnl +AC_PROVIDE_IFELSE([AC_PROG_CXX], + [_AM_DEPENDENCIES([CXX])], + [m4_define([AC_PROG_CXX], + m4_defn([AC_PROG_CXX])[_AM_DEPENDENCIES([CXX])])])dnl +AC_PROVIDE_IFELSE([AC_PROG_OBJC], + [_AM_DEPENDENCIES([OBJC])], + [m4_define([AC_PROG_OBJC], + m4_defn([AC_PROG_OBJC])[_AM_DEPENDENCIES([OBJC])])])dnl +AC_PROVIDE_IFELSE([AC_PROG_OBJCXX], + [_AM_DEPENDENCIES([OBJCXX])], + [m4_define([AC_PROG_OBJCXX], + m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])dnl +]) +AC_REQUIRE([AM_SILENT_RULES])dnl +dnl The testsuite driver may need to know about EXEEXT, so add the +dnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen. This +dnl macro is hooked onto _AC_COMPILER_EXEEXT early, see below. +AC_CONFIG_COMMANDS_PRE(dnl +[m4_provide_if([_AM_COMPILER_EXEEXT], + [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl + +# POSIX will say in a future version that running "rm -f" with no argument +# is OK; and we want to be able to make that assumption in our Makefile +# recipes. So use an aggressive probe to check that the usage we want is +# actually supported "in the wild" to an acceptable degree. +# See automake bug#10828. +# To make any issue more visible, cause the running configure to be aborted +# by default if the 'rm' program in use doesn't match our expectations; the +# user can still override this though. +if rm -f && rm -fr && rm -rf; then : OK; else + cat >&2 <<'END' +Oops! + +Your 'rm' program seems unable to run without file operands specified +on the command line, even when the '-f' option is present. This is contrary +to the behaviour of most rm programs out there, and not conforming with +the upcoming POSIX standard: + +Please tell bug-automake@gnu.org about your system, including the value +of your $PATH and any error possibly output before this message. This +can help us improve future automake versions. + +END + if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then + echo 'Configuration will proceed anyway, since you have set the' >&2 + echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2 + echo >&2 + else + cat >&2 <<'END' +Aborting the configuration process, to ensure you take notice of the issue. + +You can download and install GNU coreutils to get an 'rm' implementation +that behaves properly: . + +If you want to complete the configuration process using your problematic +'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM +to "yes", and re-run configure. + +END + AC_MSG_ERROR([Your 'rm' program is bad, sorry.]) + fi +fi +dnl The trailing newline in this macro's definition is deliberate, for +dnl backward compatibility and to allow trailing 'dnl'-style comments +dnl after the AM_INIT_AUTOMAKE invocation. See automake bug#16841. +]) + +dnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion. Do not +dnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further +dnl mangled by Autoconf and run in a shell conditional statement. +m4_define([_AC_COMPILER_EXEEXT], +m4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])]) + +# When config.status generates a header, we must update the stamp-h file. +# This file resides in the same directory as the config header +# that is generated. The stamp files are numbered to have different names. + +# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the +# loop where config.status creates the headers, so we can generate +# our stamp files there. +AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK], +[# Compute $1's index in $config_headers. +_am_arg=$1 +_am_stamp_count=1 +for _am_header in $config_headers :; do + case $_am_header in + $_am_arg | $_am_arg:* ) + break ;; + * ) + _am_stamp_count=`expr $_am_stamp_count + 1` ;; + esac +done +echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count]) + +# Copyright (C) 2001-2018 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# AM_PROG_INSTALL_SH +# ------------------ +# Define $install_sh. +AC_DEFUN([AM_PROG_INSTALL_SH], +[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl +if test x"${install_sh+set}" != xset; then + case $am_aux_dir in + *\ * | *\ *) + install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;; + *) + install_sh="\${SHELL} $am_aux_dir/install-sh" + esac +fi +AC_SUBST([install_sh])]) + +# Copyright (C) 2003-2018 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# Check whether the underlying file-system supports filenames +# with a leading dot. For instance MS-DOS doesn't. +AC_DEFUN([AM_SET_LEADING_DOT], +[rm -rf .tst 2>/dev/null +mkdir .tst 2>/dev/null +if test -d .tst; then + am__leading_dot=. +else + am__leading_dot=_ +fi +rmdir .tst 2>/dev/null +AC_SUBST([am__leading_dot])]) + +# Add --enable-maintainer-mode option to configure. -*- Autoconf -*- +# From Jim Meyering + +# Copyright (C) 1996-2018 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# AM_MAINTAINER_MODE([DEFAULT-MODE]) +# ---------------------------------- +# Control maintainer-specific portions of Makefiles. +# Default is to disable them, unless 'enable' is passed literally. +# For symmetry, 'disable' may be passed as well. Anyway, the user +# can override the default with the --enable/--disable switch. +AC_DEFUN([AM_MAINTAINER_MODE], +[m4_case(m4_default([$1], [disable]), + [enable], [m4_define([am_maintainer_other], [disable])], + [disable], [m4_define([am_maintainer_other], [enable])], + [m4_define([am_maintainer_other], [enable]) + m4_warn([syntax], [unexpected argument to AM@&t@_MAINTAINER_MODE: $1])]) +AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles]) + dnl maintainer-mode's default is 'disable' unless 'enable' is passed + AC_ARG_ENABLE([maintainer-mode], + [AS_HELP_STRING([--]am_maintainer_other[-maintainer-mode], + am_maintainer_other[ make rules and dependencies not useful + (and sometimes confusing) to the casual installer])], + [USE_MAINTAINER_MODE=$enableval], + [USE_MAINTAINER_MODE=]m4_if(am_maintainer_other, [enable], [no], [yes])) + AC_MSG_RESULT([$USE_MAINTAINER_MODE]) + AM_CONDITIONAL([MAINTAINER_MODE], [test $USE_MAINTAINER_MODE = yes]) + MAINT=$MAINTAINER_MODE_TRUE + AC_SUBST([MAINT])dnl +] +) + +# Check to see how 'make' treats includes. -*- Autoconf -*- + +# Copyright (C) 2001-2018 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# AM_MAKE_INCLUDE() +# ----------------- +# Check whether make has an 'include' directive that can support all +# the idioms we need for our automatic dependency tracking code. +AC_DEFUN([AM_MAKE_INCLUDE], +[AC_MSG_CHECKING([whether ${MAKE-make} supports the include directive]) +cat > confinc.mk << 'END' +am__doit: + @echo this is the am__doit target >confinc.out +.PHONY: am__doit +END +am__include="#" +am__quote= +# BSD make does it like this. +echo '.include "confinc.mk" # ignored' > confmf.BSD +# Other make implementations (GNU, Solaris 10, AIX) do it like this. +echo 'include confinc.mk # ignored' > confmf.GNU +_am_result=no +for s in GNU BSD; do + AM_RUN_LOG([${MAKE-make} -f confmf.$s && cat confinc.out]) + AS_CASE([$?:`cat confinc.out 2>/dev/null`], + ['0:this is the am__doit target'], + [AS_CASE([$s], + [BSD], [am__include='.include' am__quote='"'], + [am__include='include' am__quote=''])]) + if test "$am__include" != "#"; then + _am_result="yes ($s style)" + break + fi +done +rm -f confinc.* confmf.* +AC_MSG_RESULT([${_am_result}]) +AC_SUBST([am__include])]) +AC_SUBST([am__quote])]) + +# Fake the existence of programs that GNU maintainers use. -*- Autoconf -*- + +# Copyright (C) 1997-2018 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# AM_MISSING_PROG(NAME, PROGRAM) +# ------------------------------ +AC_DEFUN([AM_MISSING_PROG], +[AC_REQUIRE([AM_MISSING_HAS_RUN]) +$1=${$1-"${am_missing_run}$2"} +AC_SUBST($1)]) + +# AM_MISSING_HAS_RUN +# ------------------ +# Define MISSING if not defined so far and test if it is modern enough. +# If it is, set am_missing_run to use it, otherwise, to nothing. +AC_DEFUN([AM_MISSING_HAS_RUN], +[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl +AC_REQUIRE_AUX_FILE([missing])dnl +if test x"${MISSING+set}" != xset; then + case $am_aux_dir in + *\ * | *\ *) + MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;; + *) + MISSING="\${SHELL} $am_aux_dir/missing" ;; + esac +fi +# Use eval to expand $SHELL +if eval "$MISSING --is-lightweight"; then + am_missing_run="$MISSING " +else + am_missing_run= + AC_MSG_WARN(['missing' script is too old or missing]) +fi +]) + +# Helper functions for option handling. -*- Autoconf -*- + +# Copyright (C) 2001-2018 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# _AM_MANGLE_OPTION(NAME) +# ----------------------- +AC_DEFUN([_AM_MANGLE_OPTION], +[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])]) + +# _AM_SET_OPTION(NAME) +# -------------------- +# Set option NAME. Presently that only means defining a flag for this option. +AC_DEFUN([_AM_SET_OPTION], +[m4_define(_AM_MANGLE_OPTION([$1]), [1])]) + +# _AM_SET_OPTIONS(OPTIONS) +# ------------------------ +# OPTIONS is a space-separated list of Automake options. +AC_DEFUN([_AM_SET_OPTIONS], +[m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])]) + +# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET]) +# ------------------------------------------- +# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise. +AC_DEFUN([_AM_IF_OPTION], +[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])]) + +# Copyright (C) 1999-2018 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# _AM_PROG_CC_C_O +# --------------- +# Like AC_PROG_CC_C_O, but changed for automake. We rewrite AC_PROG_CC +# to automatically call this. +AC_DEFUN([_AM_PROG_CC_C_O], +[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl +AC_REQUIRE_AUX_FILE([compile])dnl +AC_LANG_PUSH([C])dnl +AC_CACHE_CHECK( + [whether $CC understands -c and -o together], + [am_cv_prog_cc_c_o], + [AC_LANG_CONFTEST([AC_LANG_PROGRAM([])]) + # Make sure it works both with $CC and with simple cc. + # Following AC_PROG_CC_C_O, we do the test twice because some + # compilers refuse to overwrite an existing .o file with -o, + # though they will create one. + am_cv_prog_cc_c_o=yes + for am_i in 1 2; do + if AM_RUN_LOG([$CC -c conftest.$ac_ext -o conftest2.$ac_objext]) \ + && test -f conftest2.$ac_objext; then + : OK + else + am_cv_prog_cc_c_o=no + break + fi + done + rm -f core conftest* + unset am_i]) +if test "$am_cv_prog_cc_c_o" != yes; then + # Losing compiler, so override with the script. + # FIXME: It is wrong to rewrite CC. + # But if we don't then we get into trouble of one sort or another. + # A longer-term fix would be to have automake use am__CC in this case, + # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)" + CC="$am_aux_dir/compile $CC" +fi +AC_LANG_POP([C])]) + +# For backward compatibility. +AC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])]) + +# Copyright (C) 2001-2018 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# AM_RUN_LOG(COMMAND) +# ------------------- +# Run COMMAND, save the exit status in ac_status, and log it. +# (This has been adapted from Autoconf's _AC_RUN_LOG macro.) +AC_DEFUN([AM_RUN_LOG], +[{ echo "$as_me:$LINENO: $1" >&AS_MESSAGE_LOG_FD + ($1) >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD + (exit $ac_status); }]) + +# Check to make sure that the build environment is sane. -*- Autoconf -*- + +# Copyright (C) 1996-2018 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# AM_SANITY_CHECK +# --------------- +AC_DEFUN([AM_SANITY_CHECK], +[AC_MSG_CHECKING([whether build environment is sane]) +# Reject unsafe characters in $srcdir or the absolute working directory +# name. Accept space and tab only in the latter. +am_lf=' +' +case `pwd` in + *[[\\\"\#\$\&\'\`$am_lf]]*) + AC_MSG_ERROR([unsafe absolute working directory name]);; +esac +case $srcdir in + *[[\\\"\#\$\&\'\`$am_lf\ \ ]]*) + AC_MSG_ERROR([unsafe srcdir value: '$srcdir']);; +esac + +# Do 'set' in a subshell so we don't clobber the current shell's +# arguments. Must try -L first in case configure is actually a +# symlink; some systems play weird games with the mod time of symlinks +# (eg FreeBSD returns the mod time of the symlink's containing +# directory). +if ( + am_has_slept=no + for am_try in 1 2; do + echo "timestamp, slept: $am_has_slept" > conftest.file + set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null` + if test "$[*]" = "X"; then + # -L didn't work. + set X `ls -t "$srcdir/configure" conftest.file` + fi + if test "$[*]" != "X $srcdir/configure conftest.file" \ + && test "$[*]" != "X conftest.file $srcdir/configure"; then + + # If neither matched, then we have a broken ls. This can happen + # if, for instance, CONFIG_SHELL is bash and it inherits a + # broken ls alias from the environment. This has actually + # happened. Such a system could not be considered "sane". + AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken + alias in your environment]) + fi + if test "$[2]" = conftest.file || test $am_try -eq 2; then + break + fi + # Just in case. + sleep 1 + am_has_slept=yes + done + test "$[2]" = conftest.file + ) +then + # Ok. + : +else + AC_MSG_ERROR([newly created file is older than distributed files! +Check your system clock]) +fi +AC_MSG_RESULT([yes]) +# If we didn't sleep, we still need to ensure time stamps of config.status and +# generated files are strictly newer. +am_sleep_pid= +if grep 'slept: no' conftest.file >/dev/null 2>&1; then + ( sleep 1 ) & + am_sleep_pid=$! +fi +AC_CONFIG_COMMANDS_PRE( + [AC_MSG_CHECKING([that generated files are newer than configure]) + if test -n "$am_sleep_pid"; then + # Hide warnings about reused PIDs. + wait $am_sleep_pid 2>/dev/null + fi + AC_MSG_RESULT([done])]) +rm -f conftest.file +]) + +# Copyright (C) 2009-2018 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# AM_SILENT_RULES([DEFAULT]) +# -------------------------- +# Enable less verbose build rules; with the default set to DEFAULT +# ("yes" being less verbose, "no" or empty being verbose). +AC_DEFUN([AM_SILENT_RULES], +[AC_ARG_ENABLE([silent-rules], [dnl +AS_HELP_STRING( + [--enable-silent-rules], + [less verbose build output (undo: "make V=1")]) +AS_HELP_STRING( + [--disable-silent-rules], + [verbose build output (undo: "make V=0")])dnl +]) +case $enable_silent_rules in @%:@ ((( + yes) AM_DEFAULT_VERBOSITY=0;; + no) AM_DEFAULT_VERBOSITY=1;; + *) AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);; +esac +dnl +dnl A few 'make' implementations (e.g., NonStop OS and NextStep) +dnl do not support nested variable expansions. +dnl See automake bug#9928 and bug#10237. +am_make=${MAKE-make} +AC_CACHE_CHECK([whether $am_make supports nested variables], + [am_cv_make_support_nested_variables], + [if AS_ECHO([['TRUE=$(BAR$(V)) +BAR0=false +BAR1=true +V=1 +am__doit: + @$(TRUE) +.PHONY: am__doit']]) | $am_make -f - >/dev/null 2>&1; then + am_cv_make_support_nested_variables=yes +else + am_cv_make_support_nested_variables=no +fi]) +if test $am_cv_make_support_nested_variables = yes; then + dnl Using '$V' instead of '$(V)' breaks IRIX make. + AM_V='$(V)' + AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)' +else + AM_V=$AM_DEFAULT_VERBOSITY + AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY +fi +AC_SUBST([AM_V])dnl +AM_SUBST_NOTMAKE([AM_V])dnl +AC_SUBST([AM_DEFAULT_V])dnl +AM_SUBST_NOTMAKE([AM_DEFAULT_V])dnl +AC_SUBST([AM_DEFAULT_VERBOSITY])dnl +AM_BACKSLASH='\' +AC_SUBST([AM_BACKSLASH])dnl +_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl +]) + +# Copyright (C) 2001-2018 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# AM_PROG_INSTALL_STRIP +# --------------------- +# One issue with vendor 'install' (even GNU) is that you can't +# specify the program used to strip binaries. This is especially +# annoying in cross-compiling environments, where the build's strip +# is unlikely to handle the host's binaries. +# Fortunately install-sh will honor a STRIPPROG variable, so we +# always use install-sh in "make install-strip", and initialize +# STRIPPROG with the value of the STRIP variable (set by the user). +AC_DEFUN([AM_PROG_INSTALL_STRIP], +[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl +# Installed binaries are usually stripped using 'strip' when the user +# run "make install-strip". However 'strip' might not be the right +# tool to use in cross-compilation environments, therefore Automake +# will honor the 'STRIP' environment variable to overrule this program. +dnl Don't test for $cross_compiling = yes, because it might be 'maybe'. +if test "$cross_compiling" != no; then + AC_CHECK_TOOL([STRIP], [strip], :) +fi +INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" +AC_SUBST([INSTALL_STRIP_PROGRAM])]) + +# Copyright (C) 2006-2018 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# _AM_SUBST_NOTMAKE(VARIABLE) +# --------------------------- +# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in. +# This macro is traced by Automake. +AC_DEFUN([_AM_SUBST_NOTMAKE]) + +# AM_SUBST_NOTMAKE(VARIABLE) +# -------------------------- +# Public sister of _AM_SUBST_NOTMAKE. +AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)]) + +# Check how to create a tarball. -*- Autoconf -*- + +# Copyright (C) 2004-2018 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# _AM_PROG_TAR(FORMAT) +# -------------------- +# Check how to create a tarball in format FORMAT. +# FORMAT should be one of 'v7', 'ustar', or 'pax'. +# +# Substitute a variable $(am__tar) that is a command +# writing to stdout a FORMAT-tarball containing the directory +# $tardir. +# tardir=directory && $(am__tar) > result.tar +# +# Substitute a variable $(am__untar) that extract such +# a tarball read from stdin. +# $(am__untar) < result.tar +# +AC_DEFUN([_AM_PROG_TAR], +[# Always define AMTAR for backward compatibility. Yes, it's still used +# in the wild :-( We should find a proper way to deprecate it ... +AC_SUBST([AMTAR], ['$${TAR-tar}']) + +# We'll loop over all known methods to create a tar archive until one works. +_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none' + +m4_if([$1], [v7], + [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'], + + [m4_case([$1], + [ustar], + [# The POSIX 1988 'ustar' format is defined with fixed-size fields. + # There is notably a 21 bits limit for the UID and the GID. In fact, + # the 'pax' utility can hang on bigger UID/GID (see automake bug#8343 + # and bug#13588). + am_max_uid=2097151 # 2^21 - 1 + am_max_gid=$am_max_uid + # The $UID and $GID variables are not portable, so we need to resort + # to the POSIX-mandated id(1) utility. Errors in the 'id' calls + # below are definitely unexpected, so allow the users to see them + # (that is, avoid stderr redirection). + am_uid=`id -u || echo unknown` + am_gid=`id -g || echo unknown` + AC_MSG_CHECKING([whether UID '$am_uid' is supported by ustar format]) + if test $am_uid -le $am_max_uid; then + AC_MSG_RESULT([yes]) + else + AC_MSG_RESULT([no]) + _am_tools=none + fi + AC_MSG_CHECKING([whether GID '$am_gid' is supported by ustar format]) + if test $am_gid -le $am_max_gid; then + AC_MSG_RESULT([yes]) + else + AC_MSG_RESULT([no]) + _am_tools=none + fi], + + [pax], + [], + + [m4_fatal([Unknown tar format])]) + + AC_MSG_CHECKING([how to create a $1 tar archive]) + + # Go ahead even if we have the value already cached. We do so because we + # need to set the values for the 'am__tar' and 'am__untar' variables. + _am_tools=${am_cv_prog_tar_$1-$_am_tools} + + for _am_tool in $_am_tools; do + case $_am_tool in + gnutar) + for _am_tar in tar gnutar gtar; do + AM_RUN_LOG([$_am_tar --version]) && break + done + am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"' + am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"' + am__untar="$_am_tar -xf -" + ;; + plaintar) + # Must skip GNU tar: if it does not support --format= it doesn't create + # ustar tarball either. + (tar --version) >/dev/null 2>&1 && continue + am__tar='tar chf - "$$tardir"' + am__tar_='tar chf - "$tardir"' + am__untar='tar xf -' + ;; + pax) + am__tar='pax -L -x $1 -w "$$tardir"' + am__tar_='pax -L -x $1 -w "$tardir"' + am__untar='pax -r' + ;; + cpio) + am__tar='find "$$tardir" -print | cpio -o -H $1 -L' + am__tar_='find "$tardir" -print | cpio -o -H $1 -L' + am__untar='cpio -i -H $1 -d' + ;; + none) + am__tar=false + am__tar_=false + am__untar=false + ;; + esac + + # If the value was cached, stop now. We just wanted to have am__tar + # and am__untar set. + test -n "${am_cv_prog_tar_$1}" && break + + # tar/untar a dummy directory, and stop if the command works. + rm -rf conftest.dir + mkdir conftest.dir + echo GrepMe > conftest.dir/file + AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar]) + rm -rf conftest.dir + if test -s conftest.tar; then + AM_RUN_LOG([$am__untar /dev/null 2>&1 && break + fi + done + rm -rf conftest.dir + + AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool]) + AC_MSG_RESULT([$am_cv_prog_tar_$1])]) + +AC_SUBST([am__tar]) +AC_SUBST([am__untar]) +]) # _AM_PROG_TAR + +m4_include([m4/gettext.m4]) +m4_include([m4/iconv.m4]) +m4_include([m4/lib-ld.m4]) +m4_include([m4/lib-link.m4]) +m4_include([m4/lib-prefix.m4]) +m4_include([m4/nls.m4]) +m4_include([m4/po.m4]) +m4_include([m4/progtest.m4]) +m4_include([acinclude.m4]) diff --git a/alsa-info/Makefile.am b/alsa-info/Makefile.am new file mode 100644 index 0000000..6e35926 --- /dev/null +++ b/alsa-info/Makefile.am @@ -0,0 +1,3 @@ +EXTRA_DIST = alsa-info.sh alsa-info.sh.1 +sbin_SCRIPTS = alsa-info.sh +man_MANS = alsa-info.sh.1 diff --git a/alsa-info/Makefile.in b/alsa-info/Makefile.in new file mode 100644 index 0000000..19a7b7a --- /dev/null +++ b/alsa-info/Makefile.in @@ -0,0 +1,588 @@ +# Makefile.in generated by automake 1.16.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994-2018 Free Software Foundation, Inc. + +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +VPATH = @srcdir@ +am__is_gnu_make = { \ + if test -z '$(MAKELEVEL)'; then \ + false; \ + elif test -n '$(MAKE_HOST)'; then \ + true; \ + elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ + true; \ + else \ + false; \ + fi; \ +} +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + esac; \ + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +subdir = alsa-info +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/gettext.m4 \ + $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/lib-ld.m4 \ + $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ + $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \ + $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/acinclude.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/include/aconfig.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; +am__vpath_adj = case $$p in \ + $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ + *) f=$$p;; \ + esac; +am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; +am__install_max = 40 +am__nobase_strip_setup = \ + srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` +am__nobase_strip = \ + for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" +am__nobase_list = $(am__nobase_strip_setup); \ + for p in $$list; do echo "$$p $$p"; done | \ + sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ + $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ + if (++n[$$2] == $(am__install_max)) \ + { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ + END { for (dir in files) print dir, files[dir] }' +am__base_list = \ + sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ + sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' +am__uninstall_files_from_dir = { \ + test -z "$$files" \ + || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ + || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ + $(am__cd) "$$dir" && rm -f $$files; }; \ + } +am__installdirs = "$(DESTDIR)$(sbindir)" "$(DESTDIR)$(man1dir)" +SCRIPTS = $(sbin_SCRIPTS) +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = +SOURCES = +DIST_SOURCES = +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +man1dir = $(mandir)/man1 +NROFF = nroff +MANS = $(man_MANS) +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) +am__DIST_COMMON = $(srcdir)/Makefile.in +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +ALSACTL_DAEMONSWITCH = @ALSACTL_DAEMONSWITCH@ +ALSACTL_PIDFILE_DIR = @ALSACTL_PIDFILE_DIR@ +ALSA_CFLAGS = @ALSA_CFLAGS@ +ALSA_LIBS = @ALSA_LIBS@ +ALSA_TOPOLOGY_LIBS = @ALSA_TOPOLOGY_LIBS@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +ASOUND_LOCK_DIR = @ASOUND_LOCK_DIR@ +ASOUND_STATE_DIR = @ASOUND_STATE_DIR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CURSESINC = @CURSESINC@ +CURSESLIB = @CURSESLIB@ +CURSES_CFLAGS = @CURSES_CFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +FFTW_CFLAGS = @FFTW_CFLAGS@ +FFTW_INC = @FFTW_INC@ +FFTW_LIB = @FFTW_LIB@ +GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ +GMSGFMT = @GMSGFMT@ +GMSGFMT_015 = @GMSGFMT_015@ +GREP = @GREP@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +INTLLIBS = @INTLLIBS@ +INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@ +LDFLAGS = @LDFLAGS@ +LIBICONV = @LIBICONV@ +LIBINTL = @LIBINTL@ +LIBOBJS = @LIBOBJS@ +LIBRT = @LIBRT@ +LIBS = @LIBS@ +LN_S = @LN_S@ +LTLIBICONV = @LTLIBICONV@ +LTLIBINTL = @LTLIBINTL@ +LTLIBOBJS = @LTLIBOBJS@ +MAINT = @MAINT@ +MAKEINFO = @MAKEINFO@ +MKDIR_P = @MKDIR_P@ +MSGFMT = @MSGFMT@ +MSGFMT_015 = @MSGFMT_015@ +MSGMERGE = @MSGMERGE@ +NCURSESW_CFLAGS = @NCURSESW_CFLAGS@ +NCURSESW_LIBS = @NCURSESW_LIBS@ +NCURSES_CFLAGS = @NCURSES_CFLAGS@ +NCURSES_LIBS = @NCURSES_LIBS@ +OBJEXT = @OBJEXT@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ +POSUB = @POSUB@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +SND_UTIL_MAJOR = @SND_UTIL_MAJOR@ +SND_UTIL_MINOR = @SND_UTIL_MINOR@ +SND_UTIL_SUBMINOR = @SND_UTIL_SUBMINOR@ +SND_UTIL_VERSION = @SND_UTIL_VERSION@ +STRIP = @STRIP@ +SYSTEMD_CFLAGS = @SYSTEMD_CFLAGS@ +SYSTEMD_LIBS = @SYSTEMD_LIBS@ +TESTSOUND = @TESTSOUND@ +USE_NLS = @USE_NLS@ +VERSION = @VERSION@ +XGETTEXT = @XGETTEXT@ +XGETTEXT_015 = @XGETTEXT_015@ +XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_CC = @ac_ct_CC@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +mydatadir = @mydatadir@ +ncurses5_config = @ncurses5_config@ +ncursesw5_config = @ncursesw5_config@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +rst2man_available = @rst2man_available@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +systemdsystemunitdir = @systemdsystemunitdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +udevrulesdir = @udevrulesdir@ +xmlto_available = @xmlto_available@ +EXTRA_DIST = alsa-info.sh alsa-info.sh.1 +sbin_SCRIPTS = alsa-info.sh +man_MANS = alsa-info.sh.1 +all: all-am + +.SUFFIXES: +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign alsa-info/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --foreign alsa-info/Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): +install-sbinSCRIPTS: $(sbin_SCRIPTS) + @$(NORMAL_INSTALL) + @list='$(sbin_SCRIPTS)'; test -n "$(sbindir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(sbindir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(sbindir)" || exit 1; \ + fi; \ + for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + if test -f "$$d$$p"; then echo "$$d$$p"; echo "$$p"; else :; fi; \ + done | \ + sed -e 'p;s,.*/,,;n' \ + -e 'h;s|.*|.|' \ + -e 'p;x;s,.*/,,;$(transform)' | sed 'N;N;N;s,\n, ,g' | \ + $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1; } \ + { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \ + if ($$2 == $$4) { files[d] = files[d] " " $$1; \ + if (++n[d] == $(am__install_max)) { \ + print "f", d, files[d]; n[d] = 0; files[d] = "" } } \ + else { print "f", d "/" $$4, $$1 } } \ + END { for (d in files) print "f", d, files[d] }' | \ + while read type dir files; do \ + if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \ + test -z "$$files" || { \ + echo " $(INSTALL_SCRIPT) $$files '$(DESTDIR)$(sbindir)$$dir'"; \ + $(INSTALL_SCRIPT) $$files "$(DESTDIR)$(sbindir)$$dir" || exit $$?; \ + } \ + ; done + +uninstall-sbinSCRIPTS: + @$(NORMAL_UNINSTALL) + @list='$(sbin_SCRIPTS)'; test -n "$(sbindir)" || exit 0; \ + files=`for p in $$list; do echo "$$p"; done | \ + sed -e 's,.*/,,;$(transform)'`; \ + dir='$(DESTDIR)$(sbindir)'; $(am__uninstall_files_from_dir) +install-man1: $(man_MANS) + @$(NORMAL_INSTALL) + @list1=''; \ + list2='$(man_MANS)'; \ + test -n "$(man1dir)" \ + && test -n "`echo $$list1$$list2`" \ + || exit 0; \ + echo " $(MKDIR_P) '$(DESTDIR)$(man1dir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(man1dir)" || exit 1; \ + { for i in $$list1; do echo "$$i"; done; \ + if test -n "$$list2"; then \ + for i in $$list2; do echo "$$i"; done \ + | sed -n '/\.1[a-z]*$$/p'; \ + fi; \ + } | while read p; do \ + if test -f $$p; then d=; else d="$(srcdir)/"; fi; \ + echo "$$d$$p"; echo "$$p"; \ + done | \ + sed -e 'n;s,.*/,,;p;h;s,.*\.,,;s,^[^1][0-9a-z]*$$,1,;x' \ + -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,' | \ + sed 'N;N;s,\n, ,g' | { \ + list=; while read file base inst; do \ + if test "$$base" = "$$inst"; then list="$$list $$file"; else \ + echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man1dir)/$$inst'"; \ + $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man1dir)/$$inst" || exit $$?; \ + fi; \ + done; \ + for i in $$list; do echo "$$i"; done | $(am__base_list) | \ + while read files; do \ + test -z "$$files" || { \ + echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(man1dir)'"; \ + $(INSTALL_DATA) $$files "$(DESTDIR)$(man1dir)" || exit $$?; }; \ + done; } + +uninstall-man1: + @$(NORMAL_UNINSTALL) + @list=''; test -n "$(man1dir)" || exit 0; \ + files=`{ for i in $$list; do echo "$$i"; done; \ + l2='$(man_MANS)'; for i in $$l2; do echo "$$i"; done | \ + sed -n '/\.1[a-z]*$$/p'; \ + } | sed -e 's,.*/,,;h;s,.*\.,,;s,^[^1][0-9a-z]*$$,1,;x' \ + -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,'`; \ + dir='$(DESTDIR)$(man1dir)'; $(am__uninstall_files_from_dir) +tags TAGS: + +ctags CTAGS: + +cscope cscopelist: + + +distdir: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) distdir-am + +distdir-am: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(SCRIPTS) $(MANS) +installdirs: + for dir in "$(DESTDIR)$(sbindir)" "$(DESTDIR)$(man1dir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ + done +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic mostlyclean-am + +distclean: distclean-am + -rm -f Makefile +distclean-am: clean-am distclean-generic + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: install-man + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: install-sbinSCRIPTS + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: install-man1 + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-generic + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-man uninstall-sbinSCRIPTS + +uninstall-man: uninstall-man1 + +.MAKE: install-am install-strip + +.PHONY: all all-am check check-am clean clean-generic cscopelist-am \ + ctags-am distclean distclean-generic distdir dvi dvi-am html \ + html-am info info-am install install-am install-data \ + install-data-am install-dvi install-dvi-am install-exec \ + install-exec-am install-html install-html-am install-info \ + install-info-am install-man install-man1 install-pdf \ + install-pdf-am install-ps install-ps-am install-sbinSCRIPTS \ + install-strip installcheck installcheck-am installdirs \ + maintainer-clean maintainer-clean-generic mostlyclean \ + mostlyclean-generic pdf pdf-am ps ps-am tags-am uninstall \ + uninstall-am uninstall-man uninstall-man1 \ + uninstall-sbinSCRIPTS + +.PRECIOUS: Makefile + + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/alsa-info/alsa-info.sh b/alsa-info/alsa-info.sh new file mode 100755 index 0000000..f179bfa --- /dev/null +++ b/alsa-info/alsa-info.sh @@ -0,0 +1,926 @@ +#!/bin/bash + +SCRIPT_VERSION=0.4.65 +CHANGELOG="http://www.alsa-project.org/alsa-info.sh.changelog" + +################################################################################# +#Copyright (C) 2007 Free Software Foundation. + +#This program is free software; you can redistribute it and/or modify +#it under the terms of the GNU General Public License as published by +#the Free Software Foundation; either version 2 of the License, or +#(at your option) any later version. + +#This program is distributed in the hope that it will be useful, +#but WITHOUT ANY WARRANTY; without even the implied warranty of +#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +#GNU General Public License for more details. + +#You should have received a copy of the GNU General Public License +#along with this program; if not, write to the Free Software +#Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + +################################################################################## + +# The script was written for 2 main reasons: +# 1. Remove the need for the devs/helpers to ask several questions before we can easily help the user. +# 2. Allow newer/inexperienced ALSA users to give us all the info we need to help them. + +#Set the locale (this may or may not be a good idea.. let me know) +export LC_ALL=C + +# Change the PATH variable, so we can run lspci (needed for some distros) +PATH=$PATH:/bin:/sbin:/usr/bin:/usr/sbin +BGTITLE="ALSA-Info v $SCRIPT_VERSION" +PASTEBINKEY="C9cRIO8m/9y8Cs0nVs0FraRx7U0pHsuc" + +WGET=$(command -v wget) +REQUIRES="mktemp grep pgrep awk date uname cat sort dmesg amixer alsactl" + +# +# Define some simple functions +# + +update() { + test -z "$WGET" -o ! -x "$WGET" && return + + SHFILE=$(mktemp -t alsa-info.XXXXXXXXXX) || exit 1 + wget -O $SHFILE "http://www.alsa-project.org/alsa-info.sh" >/dev/null 2>&1 + REMOTE_VERSION=$(grep SCRIPT_VERSION $SHFILE | head -n1 | sed 's/.*=//') + if [ -s "$SHFILE" -a "$REMOTE_VERSION" != "$SCRIPT_VERSION" ]; then + if [[ -n $DIALOG ]] + then + OVERWRITE= + if [ -w $0 ]; then + dialog --yesno "Newer version of ALSA-Info has been found\n\nDo you wish to install it?\nNOTICE: The original file $0 will be overwritten!" 0 0 + DIALOG_EXIT_CODE=$? + if [[ $DIALOG_EXIT_CODE = 0 ]]; then + OVERWRITE=yes + fi + fi + if [ -z "$OVERWRITE" ]; then + dialog --yesno "Newer version of ALSA-Info has been found\n\nDo you wish to download it?" 0 0 + DIALOG_EXIT_CODE=$? + fi + if [[ $DIALOG_EXIT_CODE = 0 ]] + then + echo "Newer version detected: $REMOTE_VERSION" + echo "To view the ChangeLog, please visit $CHANGELOG" + if [ "$OVERWRITE" = "yes" ]; then + cp $SHFILE $0 + echo "ALSA-Info script has been updated to v $REMOTE_VERSION" + echo "Please re-run the script" + rm $SHFILE 2>/dev/null + else + echo "ALSA-Info script has been downloaded as $SHFILE." + echo "Please re-run the script from new location." + fi + exit + else + rm $SHFILE 2>/dev/null + fi + else + echo "Newer version detected: $REMOTE_VERSION" + echo "To view the ChangeLog, please visit $CHANGELOG" + if [ -w $0 ]; then + echo "The original file $0 will be overwritten!" + echo -n "If you do not like to proceed, press Ctrl-C now.." ; read inp + cp $SHFILE $0 + echo "ALSA-Info script has been updated. Please re-run it." + rm $SHFILE 2>/dev/null + else + echo "ALSA-Info script has been downloaded $SHFILE." + echo "Please, re-run it from new location." + fi + exit + fi + else + rm $SHFILE 2>/dev/null + fi +} + +cleanup() { + if [ -n "$TEMPDIR" -a "$KEEP_FILES" != "yes" ]; then + rm -rf "$TEMPDIR" 2>/dev/null + fi + test -n "$KEEP_OUTPUT" || rm -f "$NFILE" +} + + +withaplay() { + echo "!!Aplay/Arecord output" >> $FILE + echo "!!--------------------" >> $FILE + echo "" >> $FILE + echo "APLAY" >> $FILE + echo "" >> $FILE + aplay -l >> $FILE 2>&1 + echo "" >> $FILE + echo "ARECORD" >> $FILE + echo "" >> $FILE + arecord -l >> $FILE 2>&1 + echo "" >> $FILE +} + +withmodules() { + echo "!!All Loaded Modules" >> $FILE + echo "!!------------------" >> $FILE + echo "" >> $FILE + awk '{print $1}' < /proc/modules | sort >> $FILE + echo "" >> $FILE + echo "" >> $FILE +} + +withamixer() { + echo "!!Amixer output" >> $FILE + echo "!!-------------" >> $FILE + echo "" >> $FILE + for f in /proc/asound/card*/id; do + [ -f "$f" ] && read -r CARD_NAME < "$f" || continue + echo "!!-------Mixer controls for card $CARD_NAME" >> $FILE + echo "" >>$FILE + amixer -c "$CARD_NAME" info >> $FILE 2>&1 + amixer -c "$CARD_NAME" >> $FILE 2>&1 + echo "" >> $FILE + done + echo "" >> $FILE +} + +withalsactl() { + echo "!!Alsactl output" >> $FILE + echo "!!--------------" >> $FILE + echo "" >> $FILE + alsactl -f $TEMPDIR/alsactl.tmp store + echo "--startcollapse--" >> $FILE + cat $TEMPDIR/alsactl.tmp >> $FILE + echo "--endcollapse--" >> $FILE + echo "" >> $FILE + echo "" >> $FILE +} + +withdevices() { + echo "!!ALSA Device nodes" >> $FILE + echo "!!-----------------" >> $FILE + echo "" >> $FILE + ls -la /dev/snd/* >> $FILE + echo "" >> $FILE + echo "" >> $FILE +} + +withconfigs() { +if [[ -e $HOME/.asoundrc ]] || [[ -e /etc/asound.conf ]] || [[ -e $HOME/.asoundrc.asoundconf ]]; then + echo "!!ALSA configuration files" >> $FILE + echo "!!------------------------" >> $FILE + echo "" >> $FILE + + #Check for ~/.asoundrc + if [[ -e $HOME/.asoundrc ]] + then + echo "!!User specific config file (~/.asoundrc)" >> $FILE + echo "" >> $FILE + cat $HOME/.asoundrc >> $FILE + echo "" >> $FILE + echo "" >> $FILE + fi + #Check for .asoundrc.asoundconf (seems to be Ubuntu specific) + if [[ -e $HOME/.asoundrc.asoundconf ]] + then + echo "!!asoundconf-generated config file" >> $FILE + echo "" >> $FILE + cat $HOME/.asoundrc.asoundconf >> $FILE + echo "" >> $FILE + echo "" >> $FILE + fi + #Check for /etc/asound.conf + if [[ -e /etc/asound.conf ]] + then + echo "!!System wide config file (/etc/asound.conf)" >> $FILE + echo "" >> $FILE + cat /etc/asound.conf >> $FILE + echo "" >> $FILE + echo "" >> $FILE + fi +fi +} + +withsysfs() { + local i f + local printed="" + for i in /sys/class/sound/*; do + case "$i" in + */hwC?D?) + if [ -f $i/init_pin_configs ]; then + if [ -z "$printed" ]; then + echo "!!Sysfs Files" >> $FILE + echo "!!-----------" >> $FILE + echo "" >> $FILE + fi + for f in init_pin_configs driver_pin_configs user_pin_configs init_verbs hints; do + echo "$i/$f:" >> $FILE + cat $i/$f >> $FILE + echo >> $FILE + done + printed=yes + fi + ;; + esac + done + if [ -n "$printed" ]; then + echo "" >> $FILE + fi +} + +withdmesg() { + echo "!!ALSA/HDA dmesg" >> $FILE + echo "!!--------------" >> $FILE + echo "" >> $FILE + dmesg | grep -C1 -E 'ALSA|HDA|HDMI|snd[_-]|sound|hda.codec|hda.intel' >> $FILE + echo "" >> $FILE + echo "" >> $FILE +} + +withpackages() { + local RPM + local DPKG + RPM="$(command -v rpmquery)" + DPKG="$(command -v dpkg)" + [ -n "$RPM$DPKG" ] || return + local PATTERN='(alsa-(lib|oss|plugins|tools|(topology|ucm)-conf|utils|sof-firmware)|libalsa|tinycompress|sof-firmware)' + { + echo "!!Packages installed" + echo "!!--------------------" + echo "" + { + if [ -x "$RPM" ]; then "$RPM" -a; fi + if [ -x "$DPKG" ]; then "$DPKG" -l; fi + } | grep -E "$PATTERN" + echo "" + } >> "$FILE" +} + +withall() { + withdevices + withconfigs + withaplay + withamixer + withalsactl + withmodules + withsysfs + withdmesg + withpackages + WITHALL="no" +} + +get_alsa_library_version() { + ALSA_LIB_VERSION=$(grep VERSION_STR /usr/include/alsa/version.h 2>/dev/null | awk '{ print $3 }' | sed 's/"//g') + + if [ -z "$ALSA_LIB_VERSION" ]; then + if [ -f /etc/lsb-release ]; then + . /etc/lsb-release + case "$DISTRIB_ID" in + Ubuntu) + if command -v dpkg > /dev/null ; then + ALSA_LIB_VERSION=$(dpkg -l libasound2 | tail -1 | awk '{ print $3 }' | cut -f 1 -d -) + fi + + if [ "$ALSA_LIB_VERSION" = "" ]; then + ALSA_LIB_VERSION="" + fi + return + ;; + *) + return + ;; + esac + elif [ -f /etc/debian_version ]; then + if command -v dpkg > /dev/null ; then + ALSA_LIB_VERSION=$(dpkg -l libasound2 | tail -1 | awk '{ print $3 }' | cut -f 1 -d -) + fi + + if [ "$ALSA_LIB_VERSION" = "" ]; then + ALSA_LIB_VERSION="" + fi + return + fi + fi +} + +# Basic requires +for prg in $REQUIRES; do + t=$(command -v $prg) + if test -z "$t"; then + echo "This script requires $prg utility to continue." + exit 1 + fi +done + +# Run checks to make sure the programs we need are installed. +LSPCI="$(command -v lspci)" +TPUT="$(command -v tput)" +DIALOG="$(command -v dialog)" + +# Check to see if sysfs is enabled in the kernel. We'll need this later on +SYSFS=$(mount | grep sysfs | awk '{ print $3 }'); + +# Check modprobe config files for sound related options +SNDOPTIONS=$(modprobe -c | sed -n 's/^options \(snd[-_][^ ]*\)/\1:/p') + +KEEP_OUTPUT= +NFILE="" + +PASTEBIN="" +WWWSERVICE="www.alsa-project.org" +WELCOME="yes" +PROCEED="yes" +UPLOAD="ask" +REPEAT="" +while [ -z "$REPEAT" ]; do +REPEAT="no" +case "$1" in + --update|--help|--about) + WELCOME="no" + PROCEED="no" + ;; + --upload) + UPLOAD="yes" + WELCOME="no" + ;; + --no-upload) + UPLOAD="no" + WELCOME="no" + ;; + --pastebin) + PASTEBIN="yes" + WWWSERVICE="pastebin" + ;; + --no-dialog) + DIALOG="" + REPEAT="" + shift + ;; + --stdout) + DIALOG="" + WELCOME="no" + ;; +esac +done + + +#Script header output. +if [ "$WELCOME" = "yes" ]; then +greeting_message="\ + +This script visits the following commands/files to collect diagnostic +information about your ALSA installation and sound related hardware. + + dmesg + lspci + aplay + amixer + alsactl + rpm, dpkg + /proc/asound/ + /sys/class/sound/ + ~/.asoundrc (etc.) + +See '$0 --help' for command line options. +" +if [ -n "$DIALOG" ]; then + dialog --backtitle "$BGTITLE" \ + --title "ALSA-Info script v $SCRIPT_VERSION" \ + --msgbox "$greeting_message" 20 80 +else + echo "ALSA Information Script v $SCRIPT_VERSION" + echo "--------------------------------" + echo "$greeting_message" +fi # dialog +fi # WELCOME + +# Set the output file +TEMPDIR=$(mktemp -t -d alsa-info.XXXXXXXXXX) || exit 1 +FILE="$TEMPDIR/alsa-info.txt" +if [ -z "$NFILE" ]; then + NFILE=$(mktemp -t alsa-info.txt.XXXXXXXXXX) || exit 1 +fi + +trap cleanup 0 + +if [ "$PROCEED" = "yes" ]; then + +if [ -z "$LSPCI" ]; then + if [ -d /sys/bus/pci ]; then + echo "This script requires lspci. Please install it, and re-run this script." + fi +fi + +# Fetch the info and store in temp files/variables +TSTAMP=$(LANG=C TZ=UTC date) +DISTRO=$(grep -ihs "buntu\|SUSE\|Fedora\|PCLinuxOS\|MEPIS\|Mandriva\|Debian\|Damn\|Sabayon\|Slackware\|KNOPPIX\|Gentoo\|Zenwalk\|Mint\|Kubuntu\|FreeBSD\|Puppy\|Freespire\|Vector\|Dreamlinux\|CentOS\|Arch\|Xandros\|Elive\|SLAX\|Red\|BSD\|KANOTIX\|Nexenta\|Foresight\|GeeXboX\|Frugalware\|64\|SystemRescue\|Novell\|Solaris\|BackTrack\|KateOS\|Pardus\|ALT" /etc/{issue,*release,*version}) +KERNEL_VERSION=$(uname -r) +KERNEL_PROCESSOR=$(uname -p) +KERNEL_MACHINE=$(uname -m) +KERNEL_OS=$(uname -o) +[[ $(uname -v | grep SMP) ]] && KERNEL_SMP="Yes" || KERNEL_SMP="No" +ALSA_DRIVER_VERSION=$(cat /proc/asound/version | head -n1 | awk '{ print $7 }' | sed 's/\.$//') +get_alsa_library_version +ALSA_UTILS_VERSION=$(amixer -v | awk '{ print $3 }') + +ESDINST=$(command -v esd) +PAINST=$(command -v pulseaudio) +ARTSINST=$(command -v artsd) +JACKINST=$(command -v jackd) +ROARINST=$(command -v roard) +DMIDECODE=$(command -v dmidecode) + +#Check for DMI data +if [ -d /sys/class/dmi/id ]; then + # No root privileges are required when using sysfs method + DMI_SYSTEM_MANUFACTURER=$(cat /sys/class/dmi/id/sys_vendor 2>/dev/null) + DMI_SYSTEM_PRODUCT_NAME=$(cat /sys/class/dmi/id/product_name 2>/dev/null) + DMI_SYSTEM_PRODUCT_VERSION=$(cat /sys/class/dmi/id/product_version 2>/dev/null) + DMI_SYSTEM_FIRMWARE_VERSION=$(cat /sys/class/dmi/id/bios_version 2>/dev/null) + DMI_SYSTEM_SKU=$(cat /sys/class/dmi/id/product_sku 2>/dev/null) + DMI_BOARD_VENDOR=$(cat /sys/class/dmi/id/board_vendor 2>/dev/null) + DMI_BOARD_NAME=$(cat /sys/class/dmi/id/board_name 2>/dev/null) +elif [ -x $DMIDECODE ]; then + DMI_SYSTEM_MANUFACTURER=$($DMIDECODE -s system-manufacturer 2>/dev/null) + DMI_SYSTEM_PRODUCT_NAME=$($DMIDECODE -s system-product-name 2>/dev/null) + DMI_SYSTEM_PRODUCT_VERSION=$($DMIDECODE -s system-version 2>/dev/null) + DMI_SYSTEM_FIRMWARE_VERSION=$($DMIDECODE -s bios-version 2>/dev/null) + DMI_SYSTEM_SKU=$($DMIDECODE -s system-sku-number 2>/dev/null) + DMI_BOARD_VENDOR=$($DMIDECODE -s baseboard-manufacturer 2>/dev/null) + DMI_BOARD_NAME=$($DMIDECODE -s baseboard-product-name 2>/dev/null) +fi + +# Check for ACPI device status +if [ -d /sys/bus/acpi/devices ]; then + for f in /sys/bus/acpi/devices/*/status; do + ACPI_STATUS=$(cat $f 2>/dev/null); + if [[ "$ACPI_STATUS" -ne 0 ]]; then + echo $f $'\t' $ACPI_STATUS >>$TEMPDIR/acpidevicestatus.tmp; + fi + done +fi + +cat /proc/asound/modules 2>/dev/null | awk '{ print $2 }' > $TEMPDIR/alsamodules.tmp +cat /proc/asound/cards > $TEMPDIR/alsacards.tmp +if [[ ! -z "$LSPCI" ]]; then + for class in 0401 0402 0403; do + lspci -vvnn -d "::$class" | sed -n '/^[^\t]/,+1p' + done > $TEMPDIR/lspci.tmp +fi + +#Check for HDA-Intel cards codec#* +cat /proc/asound/card*/codec\#* > $TEMPDIR/alsa-hda-intel.tmp 2> /dev/null + +#Check for AC97 cards codec +cat /proc/asound/card*/codec97\#0/ac97\#0-0 > $TEMPDIR/alsa-ac97.tmp 2> /dev/null +cat /proc/asound/card*/codec97\#0/ac97\#0-0+regs > $TEMPDIR/alsa-ac97-regs.tmp 2> /dev/null + +#Check for USB mixer setup +cat /proc/asound/card*/usbmixer > $TEMPDIR/alsa-usbmixer.tmp 2> /dev/null + +#Fetch the info, and put it in $FILE in a nice readable format. +if [[ -z $PASTEBIN ]]; then +echo "upload=true&script=true&cardinfo=" > $FILE +else +echo "name=$USER&type=33&description=/tmp/alsa-info.txt&expiry=&s=Submit+Post&content=" > $FILE +fi +echo "!!################################" >> $FILE +echo "!!ALSA Information Script v $SCRIPT_VERSION" >> $FILE +echo "!!################################" >> $FILE +echo "" >> $FILE +echo "!!Script ran on: $TSTAMP" >> $FILE +echo "" >> $FILE +echo "" >> $FILE +echo "!!Linux Distribution" >> $FILE +echo "!!------------------" >> $FILE +echo "" >> $FILE +echo $DISTRO >> $FILE +echo "" >> $FILE +echo "" >> $FILE +echo "!!DMI Information" >> $FILE +echo "!!---------------" >> $FILE +echo "" >> $FILE +echo "Manufacturer: $DMI_SYSTEM_MANUFACTURER" >> $FILE +echo "Product Name: $DMI_SYSTEM_PRODUCT_NAME" >> $FILE +echo "Product Version: $DMI_SYSTEM_PRODUCT_VERSION" >> $FILE +echo "Firmware Version: $DMI_SYSTEM_FIRMWARE_VERSION" >> $FILE +echo "System SKU: $DMI_SYSTEM_SKU" >> $FILE +echo "Board Vendor: $DMI_BOARD_VENDOR" >> $FILE +echo "Board Name: $DMI_BOARD_NAME" >> $FILE +echo "" >> $FILE +echo "" >> $FILE +echo "!!ACPI Device Status Information" >> $FILE +echo "!!---------------" >> $FILE +echo "" >> $FILE +cat $TEMPDIR/acpidevicestatus.tmp >> $FILE +echo "" >> $FILE +echo "" >> $FILE +echo "!!Kernel Information" >> $FILE +echo "!!------------------" >> $FILE +echo "" >> $FILE +echo "Kernel release: $KERNEL_VERSION" >> $FILE +echo "Operating System: $KERNEL_OS" >> $FILE +echo "Architecture: $KERNEL_MACHINE" >> $FILE +echo "Processor: $KERNEL_PROCESSOR" >> $FILE +echo "SMP Enabled: $KERNEL_SMP" >> $FILE +echo "" >> $FILE +echo "" >> $FILE +echo "!!ALSA Version" >> $FILE +echo "!!------------" >> $FILE +echo "" >> $FILE +echo "Driver version: $ALSA_DRIVER_VERSION" >> $FILE +echo "Library version: $ALSA_LIB_VERSION" >> $FILE +echo "Utilities version: $ALSA_UTILS_VERSION" >> $FILE +echo "" >> $FILE +echo "" >> $FILE +echo "!!Loaded ALSA modules" >> $FILE +echo "!!-------------------" >> $FILE +echo "" >> $FILE +cat $TEMPDIR/alsamodules.tmp >> $FILE +echo "" >> $FILE +echo "" >> $FILE +echo "!!Sound Servers on this system" >> $FILE +echo "!!----------------------------" >> $FILE +echo "" >> $FILE +if [[ -n $PAINST ]];then +[[ $(pgrep '^(.*/)?pulseaudio$') ]] && PARUNNING="Yes" || PARUNNING="No" +echo "Pulseaudio:" >> $FILE +echo " Installed - Yes ($PAINST)" >> $FILE +echo " Running - $PARUNNING" >> $FILE +echo "" >> $FILE +fi +if [[ -n $ESDINST ]];then +[[ $(pgrep '^(.*/)?esd$') ]] && ESDRUNNING="Yes" || ESDRUNNING="No" +echo "ESound Daemon:" >> $FILE +echo " Installed - Yes ($ESDINST)" >> $FILE +echo " Running - $ESDRUNNING" >> $FILE +echo "" >> $FILE +fi +if [[ -n $ARTSINST ]];then +[[ $(pgrep '^(.*/)?artsd$') ]] && ARTSRUNNING="Yes" || ARTSRUNNING="No" +echo "aRts:" >> $FILE +echo " Installed - Yes ($ARTSINST)" >> $FILE +echo " Running - $ARTSRUNNING" >> $FILE +echo "" >> $FILE +fi +if [[ -n $JACKINST ]];then +[[ $(pgrep '^(.*/)?jackd$') ]] && JACKRUNNING="Yes" || JACKRUNNING="No" +echo "Jack:" >> $FILE +echo " Installed - Yes ($JACKINST)" >> $FILE +echo " Running - $JACKRUNNING" >> $FILE +echo "" >> $FILE +fi +if [[ -n $ROARINST ]];then +[[ $(pgrep '^(.*/)?roard$') ]] && ROARRUNNING="Yes" || ROARRUNNING="No" +echo "RoarAudio:" >> $FILE +echo " Installed - Yes ($ROARINST)" >> $FILE +echo " Running - $ROARRUNNING" >> $FILE +echo "" >> $FILE +fi +if [[ -z "$PAINST" && -z "$ESDINST" && -z "$ARTSINST" && -z "$JACKINST" && -z "$ROARINST" ]];then +echo "No sound servers found." >> $FILE +echo "" >> $FILE +fi +echo "" >> $FILE +echo "!!Soundcards recognised by ALSA" >> $FILE +echo "!!-----------------------------" >> $FILE +echo "" >> $FILE +cat $TEMPDIR/alsacards.tmp >> $FILE +echo "" >> $FILE +echo "" >> $FILE + +if [[ ! -z "$LSPCI" ]]; then +echo "!!PCI Soundcards installed in the system" >> $FILE +echo "!!--------------------------------------" >> $FILE +echo "" >> $FILE +cat $TEMPDIR/lspci.tmp >> $FILE +echo "" >> $FILE +echo "" >> $FILE +fi + +if [ "$SNDOPTIONS" ] +then +echo "!!Modprobe options (Sound related)" >> $FILE +echo "!!--------------------------------" >> $FILE +echo "" >> $FILE +modprobe -c|sed -n 's/^options \(snd[-_][^ ]*\)/\1:/p' >> $FILE +echo "" >> $FILE +echo "" >> $FILE +fi + +if [ -d "$SYSFS" ]; then + echo "!!Loaded sound module options" >> $FILE + echo "!!---------------------------" >> $FILE + echo "" >> $FILE + for mod in $(cat /proc/asound/modules | awk '{ print $2 }'); do + echo "!!Module: $mod" >> $FILE + for params in $(echo $SYSFS/module/$mod/parameters/*); do + echo -ne "\t" + value=$(cat $params) + echo "$params : $value" | sed 's:.*/::' + done >> $FILE + echo "" >> $FILE + done + echo "" >> $FILE +fi + +if [ -s "$TEMPDIR/alsa-hda-intel.tmp" ]; then + echo "!!HDA-Intel Codec information" >> $FILE + echo "!!---------------------------" >> $FILE + echo "--startcollapse--" >> $FILE + echo "" >> $FILE + cat $TEMPDIR/alsa-hda-intel.tmp >> $FILE + echo "--endcollapse--" >> $FILE + echo "" >> $FILE + echo "" >> $FILE +fi + +if [ -s "$TEMPDIR/alsa-ac97.tmp" ]; then + echo "!!AC97 Codec information" >> $FILE + echo "!!----------------------" >> $FILE + echo "--startcollapse--" >> $FILE + echo "" >> $FILE + cat $TEMPDIR/alsa-ac97.tmp >> $FILE + echo "" >> $FILE + cat $TEMPDIR/alsa-ac97-regs.tmp >> $FILE + echo "--endcollapse--" >> $FILE + echo "" >> $FILE + echo "" >> $FILE +fi + +if [ -s "$TEMPDIR/alsa-usbmixer.tmp" ]; then + echo "!!USB Mixer information" >> $FILE + echo "!!---------------------" >> $FILE + echo "--startcollapse--" >> $FILE + echo "" >> $FILE + cat $TEMPDIR/alsa-usbmixer.tmp >> $FILE + echo "--endcollapse--" >> $FILE + echo "" >> $FILE + echo "" >> $FILE +fi + +#If no command line options are specified, then run as though --with-all was specified +if [ -z "$1" ]; then + update +fi + +fi # proceed + +#loop through command line arguments, until none are left. +if [ -n "$1" ]; then + until [ -z "$1" ] + do + case "$1" in + --pastebin) + update + ;; + --update) + update + exit + ;; + --upload) + UPLOAD="yes" + ;; + --no-upload) + UPLOAD="no" + ;; + --output) + shift + NFILE="$1" + KEEP_OUTPUT="yes" + ;; + --debug) + echo "Debugging enabled. $FILE and $TEMPDIR will not be deleted" + KEEP_FILES="yes" + echo "" + ;; + --with-all) + withall + ;; + --with-aplay) + withaplay + WITHALL="no" + ;; + --with-amixer) + withamixer + WITHALL="no" + ;; + --with-alsactl) + withalsactl + WITHALL="no" + ;; + --with-devices) + withdevices + WITHALL="no" + ;; + --with-dmesg) + withdmesg + WITHALL="no" + ;; + --with-configs) + withconfigs + WITHALL="no" + ;; + --with-packages) + withpackages + WITHALL="no" + ;; + --stdout) + UPLOAD="no" + if [ -z "$WITHALL" ]; then + withall + fi + cat $FILE + rm $FILE + exit + ;; + --about) + echo "Written/Tested by the following users of #alsa on irc.freenode.net:" + echo "" + echo " wishie - Script author and developer / Testing" + echo " crimsun - Various script ideas / Testing" + echo " gnubien - Various script ideas / Testing" + echo " GrueMaster - HDA Intel specific items / Testing" + echo " olegfink - Script update function" + echo " TheMuso - display to stdout functionality" + exit 0 + ;; + *) + echo "alsa-info.sh version $SCRIPT_VERSION" + echo "" + echo "Available options:" + echo " --with-aplay (includes the output of aplay -l)" + echo " --with-amixer (includes the output of amixer)" + echo " --with-alsactl (includes the output of alsactl)" + echo " --with-configs (includes the output of ~/.asoundrc and" + echo " /etc/asound.conf if they exist)" + echo " --with-devices (shows the device nodes in /dev/snd/)" + echo " --with-dmesg (shows the ALSA/HDA kernel messages)" + echo " --with-packages (includes known packages installed)" + echo "" + echo " --output FILE (specify the file to output for no-upload mode)" + echo " --update (check server for script updates)" + echo " --upload (upload contents to remote server)" + echo " --no-upload (do not upload contents to remote server)" + echo " --pastebin (use http://pastebin.ca) as remote server" + echo " instead www.alsa-project.org" + echo " --stdout (print alsa information to standard output" + echo " instead of a file)" + echo " --about (show some information about the script)" + echo " --debug (will run the script as normal, but will not" + echo " delete $FILE)" + exit 0 + ;; + esac + shift 1 + done +fi + +if [ "$PROCEED" = "no" ]; then + exit 1 +fi + +if [ -z "$WITHALL" ]; then + withall +fi + +# Check if wget is installed, and supports --post-file. +if ! wget --help 2>/dev/null | grep -q post-file; then + # We couldn't find a suitable wget. If --upload was passed, tell the user to upload manually. + if [ "$UPLOAD" != "yes" ]; then + : + elif [ -n "$DIALOG" ]; then + if [ -z "$PASTEBIN" ]; then + dialog --backtitle "$BGTITLE" --msgbox "Could not automatically upload output to http://www.alsa-project.org.\nPossible reasons are:\n\n 1. Couldn't find 'wget' in your PATH\n 2. Your version of wget is less than 1.8.2\n\nPlease manually upload $NFILE to http://www.alsa-project.org/cardinfo-db/ and submit your post." 25 100 + else + dialog --backtitle "$BGTITLE" --msgbox "Could not automatically upload output to http://www.pastebin.ca.\nPossible reasons are:\n\n 1. Couldn't find 'wget' in your PATH\n 2. Your version of wget is less than 1.8.2\n\nPlease manually upload $NFILE to http://www.pastebin.ca/upload.php and submit your post." 25 100 + fi + else + if [ -z "$PASTEBIN" ]; then + echo "" + echo "Could not automatically upload output to http://www.alsa-project.org" + echo "Possible reasons are:" + echo " 1. Couldn't find 'wget' in your PATH" + echo " 2. Your version of wget is less than 1.8.2" + echo "" + echo "Please manually upload $NFILE to http://www.alsa-project.org/cardinfo-db/ and submit your post." + echo "" + else + echo "" + echo "Could not automatically upload output to http://www.pastebin.ca" + echo "Possible reasons are:" + echo " 1. Couldn't find 'wget' in your PATH" + echo " 2. Your version of wget is less than 1.8.2" + echo "" + echo "Please manually upload $NFILE to http://www.pastebin.ca/upload.php and submit your post." + echo "" + fi + fi + UPLOAD="no" +fi + +if [ "$UPLOAD" = "ask" ]; then + if [ -n "$DIALOG" ]; then + dialog --backtitle "$BGTITLE" --title "Information collected" --yes-label " UPLOAD / SHARE " --no-label " SAVE LOCALLY " --defaultno --yesno "\n\nAutomatically upload ALSA information to $WWWSERVICE?" 10 80 + DIALOG_EXIT_CODE=$? + if [ $DIALOG_EXIT_CODE != 0 ]; then + UPLOAD="no" + else + UPLOAD="yes" + fi + else + echo -n "Automatically upload ALSA information to $WWWSERVICE? [y/N] : " + read -e CONFIRM + if [ "$CONFIRM" != "y" ]; then + UPLOAD="no" + else + UPLOAD="yes" + fi + fi + +fi + +if [ "$UPLOAD" = "no" ]; then + + mv -f $FILE $NFILE || exit 1 + KEEP_OUTPUT="yes" + + if [[ -n $DIALOG ]] + then + dialog --backtitle "$BGTITLE" --title "Information collected" --msgbox "\n\nYour ALSA information is in $NFILE" 10 60 + else + echo "" + echo "Your ALSA information is in $NFILE" + echo "" + fi + + exit + +fi # UPLOAD + +if [[ -n $DIALOG ]] +then + dialog --backtitle "$BGTITLE" --infobox "Uploading information to $WWWSERVICE ..." 6 70 +else + echo -n "Uploading information to $WWWSERVICE ..." +fi + +if [[ -z $PASTEBIN ]]; then + wget -O - --tries=5 --timeout=60 --post-file=$FILE "http://www.alsa-project.org/cardinfo-db/" &>$TEMPDIR/wget.tmp +else + wget -O - --tries=5 --timeout=60 --post-file=$FILE "http://pastebin.ca/quiet-paste.php?api=$PASTEBINKEY&encrypt=t&encryptpw=blahblah" &>$TEMPDIR/wget.tmp +fi + +if [ $? -ne 0 ]; then + mv -f $FILE $NFILE || exit 1 + KEEP_OUTPUT="yes" + + if [ -n "$DIALOG" ]; then + dialog --backtitle "$BGTITLE" --title "Information not uploaded" --msgbox "An error occurred while contacting $WWWSERVICE.\n Your information was NOT automatically uploaded.\n\nYour ALSA information is in $NFILE" 10 100 + else + echo "" + echo "An error occurred while contacting $WWWSERVICE." + echo "Your information was NOT automatically uploaded." + echo "" + echo "Your ALSA information is in $NFILE" + echo "" + fi + + exit +fi + +if [ -n "$DIALOG" ]; then + +dialog --backtitle "$BGTITLE" --title "Information uploaded" --yesno "Would you like to see the uploaded information?" 5 100 +DIALOG_EXIT_CODE=$? +if [ $DIALOG_EXIT_CODE = 0 ]; then + grep -v "alsa-info.txt" $FILE > $TEMPDIR/uploaded.txt + dialog --backtitle "$BGTITLE" --textbox $TEMPDIR/uploaded.txt 0 0 +fi + +clear + +# no dialog +else + +echo -e " Done!" +echo "" + +fi # dialog + +if [ -z "$PASTEBIN" ]; then + FINAL_URL=$(grep "SUCCESS:" $TEMPDIR/wget.tmp | cut -d ' ' -f 2) +else + FINAL_URL=$(grep "SUCCESS:" $TEMPDIR/wget.tmp | sed -n 's/.*\:\([0-9]\+\).*/http:\/\/pastebin.ca\/\1/p') +fi + +# See if tput is available, and use it if it is. +if [ -x "$TPUT" ]; then + FINAL_URL=$(tput setaf 1; printf '%s' "$FINAL_URL"; tput sgr0) +fi + +# Output the URL of the uploaded file. +echo "Your ALSA information is located at $FINAL_URL" +echo "Please inform the person helping you." +echo "" diff --git a/alsa-info/alsa-info.sh.1 b/alsa-info/alsa-info.sh.1 new file mode 100644 index 0000000..7168b3e --- /dev/null +++ b/alsa-info/alsa-info.sh.1 @@ -0,0 +1,62 @@ +.TH ALSA-INFO.SH 1 "13 January 2016" +.SH NAME +alsa-info.sh \- command\-line utility to gather information about +the ALSA subsystem +.SH SYNOPSIS +\fBalsa-info.sh\fP [\fIoptions\fP] + +.SH DESCRIPTION +\fBalsa-info.sh\fP is a command\-line utility gathering information +about the ALSA subsystem. It is used mostly for debugging purposes. + +.SH OPTIONS +.TP +\fI\-\-upload\fP +Upload contents to the server (www.alsa-project.org or pastebin.ca). +.TP +\fI\-\-no-upload\fP +Do not upload contents to the remote server. +.TP +\fI\-\-stdout\fP +Print information to standard output. +.TP +\fI\-\-output FILE\fP +Specify file for output in no-upload mode. +.TP +\fI\-\-debug\fP +Run utility as normal, but will not delete file (usually +/tmp/alsa-info.txt). +.TP +\fI\-\-with-aplay\fP +Includes output from \fIaplay -l\fP. +.TP +\fI\-\-with-amixer\fP +Includes output from \fIamixer\fP. +.TP +\fI\-\-with-alsactl\fP +Includes output from \fIalsactl\fP. +.TP +\fI\-\-with-configs\fP +Includes output from ~/.asoundrc and /etc/asound.conf if they exist. +.TP +\fI\-\-update\fP +Check server for updates. +.TP +\fI\-\-about\fP +Print information about authors. + +.SH EXAMPLES + +.TP +\fBalsa-info.sh \-\-no-upload\fR +Will gather all information and show the output file. + +.SH SEE ALSO +\fB +aplay(1) +amixer(1) +alsactl(1) +\fP + +.SH AUTHOR +\fBalsa-info.sh\fP was created by the ALSA team, see \fI\-\-about\fP . diff --git a/alsaconf/Makefile.am b/alsaconf/Makefile.am new file mode 100644 index 0000000..a4f5e4a --- /dev/null +++ b/alsaconf/Makefile.am @@ -0,0 +1,37 @@ +sbin_SCRIPTS = alsaconf +man_MANS = alsaconf.8 alsaconf.fr.8 +EXTRA_DIST = $(man_MANS) +SUBDIRS = po + +install-man8: + @for i in $(man_MANS); do \ + ext=`echo $$i | $(SED) -e 's/^.*\\.//'`; \ + inst=`echo $$i | $(SED) -e 's/\\.[^.]*$$//'`; \ + case $$inst in \ + *.[a-za-z]*)\ + loc=`echo $$inst | $(SED) -e 's/^.*\\.//'`; \ + loc="/$$loc"; \ + inst=`echo $$inst | $(SED) -e 's/\\.[^.]*$$//'`;; \ + *)\ + loc="";; \ + esac; \ + $(mkinstalldirs) $(DESTDIR)$(mandir)$$loc/man$$ext; \ + echo " $(INSTALL_DATA) $$i $(DESTDIR)$(mandir)$$loc/man$$ext/$$inst.$$ext"; \ + $(INSTALL_DATA) $(srcdir)/$$i $(DESTDIR)$(mandir)$$loc/man$$ext/$$inst.$$ext; \ + done + +uninstall-man8: + @for i in $(man_MANS); do \ + ext=`echo $$i | $(SED) -e 's/^.*\\.//'`; \ + inst=`echo $$i | $(SED) -e 's/\\.[^.]*$$//'`; \ + case $$inst in \ + *.[a-za-z]*)\ + loc=`echo $$inst | $(SED) -e 's/^.*\\.//'`; \ + loc="/$$loc"; \ + inst=`echo $$inst | $(SED) -e 's/\\.[^.]*$$//'`;; \ + *)\ + loc="";; \ + esac; \ + echo " rm -f $(DESTDIR)$(mandir)$$loc/man$$ext/$$inst.$$ext"; \ + rm -f $(DESTDIR)$(mandir)$$loc/man$$ext/$$inst.$$ext; \ + done diff --git a/alsaconf/Makefile.in b/alsaconf/Makefile.in new file mode 100644 index 0000000..0dd3b85 --- /dev/null +++ b/alsaconf/Makefile.in @@ -0,0 +1,761 @@ +# Makefile.in generated by automake 1.16.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994-2018 Free Software Foundation, Inc. + +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +VPATH = @srcdir@ +am__is_gnu_make = { \ + if test -z '$(MAKELEVEL)'; then \ + false; \ + elif test -n '$(MAKE_HOST)'; then \ + true; \ + elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ + true; \ + else \ + false; \ + fi; \ +} +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + esac; \ + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +subdir = alsaconf +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/gettext.m4 \ + $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/lib-ld.m4 \ + $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ + $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \ + $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/acinclude.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/include/aconfig.h +CONFIG_CLEAN_FILES = alsaconf +CONFIG_CLEAN_VPATH_FILES = +am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; +am__vpath_adj = case $$p in \ + $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ + *) f=$$p;; \ + esac; +am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; +am__install_max = 40 +am__nobase_strip_setup = \ + srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` +am__nobase_strip = \ + for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" +am__nobase_list = $(am__nobase_strip_setup); \ + for p in $$list; do echo "$$p $$p"; done | \ + sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ + $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ + if (++n[$$2] == $(am__install_max)) \ + { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ + END { for (dir in files) print dir, files[dir] }' +am__base_list = \ + sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ + sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' +am__uninstall_files_from_dir = { \ + test -z "$$files" \ + || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ + || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ + $(am__cd) "$$dir" && rm -f $$files; }; \ + } +am__installdirs = "$(DESTDIR)$(sbindir)" "$(DESTDIR)$(man8dir)" +SCRIPTS = $(sbin_SCRIPTS) +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = +SOURCES = +DIST_SOURCES = +RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \ + ctags-recursive dvi-recursive html-recursive info-recursive \ + install-data-recursive install-dvi-recursive \ + install-exec-recursive install-html-recursive \ + install-info-recursive install-pdf-recursive \ + install-ps-recursive install-recursive installcheck-recursive \ + installdirs-recursive pdf-recursive ps-recursive \ + tags-recursive uninstall-recursive +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +man8dir = $(mandir)/man8 +NROFF = nroff +MANS = $(man_MANS) +RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ + distclean-recursive maintainer-clean-recursive +am__recursive_targets = \ + $(RECURSIVE_TARGETS) \ + $(RECURSIVE_CLEAN_TARGETS) \ + $(am__extra_recursive_targets) +AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \ + distdir distdir-am +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) +# Read a list of newline-separated strings from the standard input, +# and print each of them once, without duplicates. Input order is +# *not* preserved. +am__uniquify_input = $(AWK) '\ + BEGIN { nonempty = 0; } \ + { items[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in items) print i; }; } \ +' +# Make sure the list of sources is unique. This is necessary because, +# e.g., the same source file might be shared among _SOURCES variables +# for different programs/libraries. +am__define_uniq_tagged_files = \ + list='$(am__tagged_files)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | $(am__uniquify_input)` +ETAGS = etags +CTAGS = ctags +DIST_SUBDIRS = $(SUBDIRS) +am__DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/alsaconf.in +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +am__relativize = \ + dir0=`pwd`; \ + sed_first='s,^\([^/]*\)/.*$$,\1,'; \ + sed_rest='s,^[^/]*/*,,'; \ + sed_last='s,^.*/\([^/]*\)$$,\1,'; \ + sed_butlast='s,/*[^/]*$$,,'; \ + while test -n "$$dir1"; do \ + first=`echo "$$dir1" | sed -e "$$sed_first"`; \ + if test "$$first" != "."; then \ + if test "$$first" = ".."; then \ + dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \ + dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \ + else \ + first2=`echo "$$dir2" | sed -e "$$sed_first"`; \ + if test "$$first2" = "$$first"; then \ + dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \ + else \ + dir2="../$$dir2"; \ + fi; \ + dir0="$$dir0"/"$$first"; \ + fi; \ + fi; \ + dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \ + done; \ + reldir="$$dir2" +ACLOCAL = @ACLOCAL@ +ALSACTL_DAEMONSWITCH = @ALSACTL_DAEMONSWITCH@ +ALSACTL_PIDFILE_DIR = @ALSACTL_PIDFILE_DIR@ +ALSA_CFLAGS = @ALSA_CFLAGS@ +ALSA_LIBS = @ALSA_LIBS@ +ALSA_TOPOLOGY_LIBS = @ALSA_TOPOLOGY_LIBS@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +ASOUND_LOCK_DIR = @ASOUND_LOCK_DIR@ +ASOUND_STATE_DIR = @ASOUND_STATE_DIR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CURSESINC = @CURSESINC@ +CURSESLIB = @CURSESLIB@ +CURSES_CFLAGS = @CURSES_CFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +FFTW_CFLAGS = @FFTW_CFLAGS@ +FFTW_INC = @FFTW_INC@ +FFTW_LIB = @FFTW_LIB@ +GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ +GMSGFMT = @GMSGFMT@ +GMSGFMT_015 = @GMSGFMT_015@ +GREP = @GREP@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +INTLLIBS = @INTLLIBS@ +INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@ +LDFLAGS = @LDFLAGS@ +LIBICONV = @LIBICONV@ +LIBINTL = @LIBINTL@ +LIBOBJS = @LIBOBJS@ +LIBRT = @LIBRT@ +LIBS = @LIBS@ +LN_S = @LN_S@ +LTLIBICONV = @LTLIBICONV@ +LTLIBINTL = @LTLIBINTL@ +LTLIBOBJS = @LTLIBOBJS@ +MAINT = @MAINT@ +MAKEINFO = @MAKEINFO@ +MKDIR_P = @MKDIR_P@ +MSGFMT = @MSGFMT@ +MSGFMT_015 = @MSGFMT_015@ +MSGMERGE = @MSGMERGE@ +NCURSESW_CFLAGS = @NCURSESW_CFLAGS@ +NCURSESW_LIBS = @NCURSESW_LIBS@ +NCURSES_CFLAGS = @NCURSES_CFLAGS@ +NCURSES_LIBS = @NCURSES_LIBS@ +OBJEXT = @OBJEXT@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ +POSUB = @POSUB@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +SND_UTIL_MAJOR = @SND_UTIL_MAJOR@ +SND_UTIL_MINOR = @SND_UTIL_MINOR@ +SND_UTIL_SUBMINOR = @SND_UTIL_SUBMINOR@ +SND_UTIL_VERSION = @SND_UTIL_VERSION@ +STRIP = @STRIP@ +SYSTEMD_CFLAGS = @SYSTEMD_CFLAGS@ +SYSTEMD_LIBS = @SYSTEMD_LIBS@ +TESTSOUND = @TESTSOUND@ +USE_NLS = @USE_NLS@ +VERSION = @VERSION@ +XGETTEXT = @XGETTEXT@ +XGETTEXT_015 = @XGETTEXT_015@ +XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_CC = @ac_ct_CC@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +mydatadir = @mydatadir@ +ncurses5_config = @ncurses5_config@ +ncursesw5_config = @ncursesw5_config@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +rst2man_available = @rst2man_available@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +systemdsystemunitdir = @systemdsystemunitdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +udevrulesdir = @udevrulesdir@ +xmlto_available = @xmlto_available@ +sbin_SCRIPTS = alsaconf +man_MANS = alsaconf.8 alsaconf.fr.8 +EXTRA_DIST = $(man_MANS) +SUBDIRS = po +all: all-recursive + +.SUFFIXES: +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign alsaconf/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --foreign alsaconf/Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): +alsaconf: $(top_builddir)/config.status $(srcdir)/alsaconf.in + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ +install-sbinSCRIPTS: $(sbin_SCRIPTS) + @$(NORMAL_INSTALL) + @list='$(sbin_SCRIPTS)'; test -n "$(sbindir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(sbindir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(sbindir)" || exit 1; \ + fi; \ + for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + if test -f "$$d$$p"; then echo "$$d$$p"; echo "$$p"; else :; fi; \ + done | \ + sed -e 'p;s,.*/,,;n' \ + -e 'h;s|.*|.|' \ + -e 'p;x;s,.*/,,;$(transform)' | sed 'N;N;N;s,\n, ,g' | \ + $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1; } \ + { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \ + if ($$2 == $$4) { files[d] = files[d] " " $$1; \ + if (++n[d] == $(am__install_max)) { \ + print "f", d, files[d]; n[d] = 0; files[d] = "" } } \ + else { print "f", d "/" $$4, $$1 } } \ + END { for (d in files) print "f", d, files[d] }' | \ + while read type dir files; do \ + if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \ + test -z "$$files" || { \ + echo " $(INSTALL_SCRIPT) $$files '$(DESTDIR)$(sbindir)$$dir'"; \ + $(INSTALL_SCRIPT) $$files "$(DESTDIR)$(sbindir)$$dir" || exit $$?; \ + } \ + ; done + +uninstall-sbinSCRIPTS: + @$(NORMAL_UNINSTALL) + @list='$(sbin_SCRIPTS)'; test -n "$(sbindir)" || exit 0; \ + files=`for p in $$list; do echo "$$p"; done | \ + sed -e 's,.*/,,;$(transform)'`; \ + dir='$(DESTDIR)$(sbindir)'; $(am__uninstall_files_from_dir) + +# This directory's subdirectories are mostly independent; you can cd +# into them and run 'make' without going through this Makefile. +# To change the values of 'make' variables: instead of editing Makefiles, +# (1) if the variable is set in 'config.status', edit 'config.status' +# (which will cause the Makefiles to be regenerated when you run 'make'); +# (2) otherwise, pass the desired values on the 'make' command line. +$(am__recursive_targets): + @fail=; \ + if $(am__make_keepgoing); then \ + failcom='fail=yes'; \ + else \ + failcom='exit 1'; \ + fi; \ + dot_seen=no; \ + target=`echo $@ | sed s/-recursive//`; \ + case "$@" in \ + distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ + *) list='$(SUBDIRS)' ;; \ + esac; \ + for subdir in $$list; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + dot_seen=yes; \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || eval $$failcom; \ + done; \ + if test "$$dot_seen" = "no"; then \ + $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ + fi; test -z "$$fail" + +ID: $(am__tagged_files) + $(am__define_uniq_tagged_files); mkid -fID $$unique +tags: tags-recursive +TAGS: tags + +tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + set x; \ + here=`pwd`; \ + if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ + include_option=--etags-include; \ + empty_fix=.; \ + else \ + include_option=--include; \ + empty_fix=; \ + fi; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test ! -f $$subdir/TAGS || \ + set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \ + fi; \ + done; \ + $(am__define_uniq_tagged_files); \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: ctags-recursive + +CTAGS: ctags +ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + $(am__define_uniq_tagged_files); \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" +cscopelist: cscopelist-recursive + +cscopelist-am: $(am__tagged_files) + list='$(am__tagged_files)'; \ + case "$(srcdir)" in \ + [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ + *) sdir=$(subdir)/$(srcdir) ;; \ + esac; \ + for i in $$list; do \ + if test -f "$$i"; then \ + echo "$(subdir)/$$i"; \ + else \ + echo "$$sdir/$$i"; \ + fi; \ + done >> $(top_builddir)/cscope.files + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) distdir-am + +distdir-am: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done + @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + $(am__make_dryrun) \ + || test -d "$(distdir)/$$subdir" \ + || $(MKDIR_P) "$(distdir)/$$subdir" \ + || exit 1; \ + dir1=$$subdir; dir2="$(distdir)/$$subdir"; \ + $(am__relativize); \ + new_distdir=$$reldir; \ + dir1=$$subdir; dir2="$(top_distdir)"; \ + $(am__relativize); \ + new_top_distdir=$$reldir; \ + echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \ + echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \ + ($(am__cd) $$subdir && \ + $(MAKE) $(AM_MAKEFLAGS) \ + top_distdir="$$new_top_distdir" \ + distdir="$$new_distdir" \ + am__remove_distdir=: \ + am__skip_length_check=: \ + am__skip_mode_fix=: \ + distdir) \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-recursive +all-am: Makefile $(SCRIPTS) $(MANS) +installdirs: installdirs-recursive +installdirs-am: + for dir in "$(DESTDIR)$(sbindir)" "$(DESTDIR)$(man8dir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ + done +install: install-recursive +install-exec: install-exec-recursive +install-data: install-data-recursive +uninstall: uninstall-recursive + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-recursive +install-strip: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-recursive + +clean-am: clean-generic mostlyclean-am + +distclean: distclean-recursive + -rm -f Makefile +distclean-am: clean-am distclean-generic distclean-tags + +dvi: dvi-recursive + +dvi-am: + +html: html-recursive + +html-am: + +info: info-recursive + +info-am: + +install-data-am: install-man + +install-dvi: install-dvi-recursive + +install-dvi-am: + +install-exec-am: install-sbinSCRIPTS + +install-html: install-html-recursive + +install-html-am: + +install-info: install-info-recursive + +install-info-am: + +install-man: install-man8 + +install-pdf: install-pdf-recursive + +install-pdf-am: + +install-ps: install-ps-recursive + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-recursive + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-recursive + +mostlyclean-am: mostlyclean-generic + +pdf: pdf-recursive + +pdf-am: + +ps: ps-recursive + +ps-am: + +uninstall-am: uninstall-man uninstall-sbinSCRIPTS + +uninstall-man: uninstall-man8 + +.MAKE: $(am__recursive_targets) install-am install-strip + +.PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am check \ + check-am clean clean-generic cscopelist-am ctags ctags-am \ + distclean distclean-generic distclean-tags distdir dvi dvi-am \ + html html-am info info-am install install-am install-data \ + install-data-am install-dvi install-dvi-am install-exec \ + install-exec-am install-html install-html-am install-info \ + install-info-am install-man install-man8 install-pdf \ + install-pdf-am install-ps install-ps-am install-sbinSCRIPTS \ + install-strip installcheck installcheck-am installdirs \ + installdirs-am maintainer-clean maintainer-clean-generic \ + mostlyclean mostlyclean-generic pdf pdf-am ps ps-am tags \ + tags-am uninstall uninstall-am uninstall-man uninstall-man8 \ + uninstall-sbinSCRIPTS + +.PRECIOUS: Makefile + + +install-man8: + @for i in $(man_MANS); do \ + ext=`echo $$i | $(SED) -e 's/^.*\\.//'`; \ + inst=`echo $$i | $(SED) -e 's/\\.[^.]*$$//'`; \ + case $$inst in \ + *.[a-za-z]*)\ + loc=`echo $$inst | $(SED) -e 's/^.*\\.//'`; \ + loc="/$$loc"; \ + inst=`echo $$inst | $(SED) -e 's/\\.[^.]*$$//'`;; \ + *)\ + loc="";; \ + esac; \ + $(mkinstalldirs) $(DESTDIR)$(mandir)$$loc/man$$ext; \ + echo " $(INSTALL_DATA) $$i $(DESTDIR)$(mandir)$$loc/man$$ext/$$inst.$$ext"; \ + $(INSTALL_DATA) $(srcdir)/$$i $(DESTDIR)$(mandir)$$loc/man$$ext/$$inst.$$ext; \ + done + +uninstall-man8: + @for i in $(man_MANS); do \ + ext=`echo $$i | $(SED) -e 's/^.*\\.//'`; \ + inst=`echo $$i | $(SED) -e 's/\\.[^.]*$$//'`; \ + case $$inst in \ + *.[a-za-z]*)\ + loc=`echo $$inst | $(SED) -e 's/^.*\\.//'`; \ + loc="/$$loc"; \ + inst=`echo $$inst | $(SED) -e 's/\\.[^.]*$$//'`;; \ + *)\ + loc="";; \ + esac; \ + echo " rm -f $(DESTDIR)$(mandir)$$loc/man$$ext/$$inst.$$ext"; \ + rm -f $(DESTDIR)$(mandir)$$loc/man$$ext/$$inst.$$ext; \ + done + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/alsaconf/alsaconf.8 b/alsaconf/alsaconf.8 new file mode 100644 index 0000000..a3e1296 --- /dev/null +++ b/alsaconf/alsaconf.8 @@ -0,0 +1,102 @@ +.\" Hey, EMACS: -*- nroff -*- +.\" alsaconf.8 is copyright 2003 by Jordi Mallach +.\" +.\" This is free documentation, see the latest version of the GNU +.\" General Public License for copying conditions. There is NO warranty. +.TH ALSACONF 8 "February 23, 2003" + +.SH NAME +alsaconf \- configuration tool for the Advanced Linux Sound Architecture + +.SH SYNOPSIS +.B alsaconf +.RI [ options ] + +.SH DESCRIPTION +This manual page documents briefly the +.B alsaconf +command. +This manual page was written for the Debian distribution because the +original program does not have a manual page. +.PP +\fBAlsaconf\fP is a simple shell script which tries to detect the sound cards +on your system and writes a suitable configuration file for ALSA. It will try +to guess what GNU/Linux distribution you're running, and will act accordingly +to the standards of that distribution, if specific support is available. +.PP +Alsaconf will write a module-init-tools (or modutils) snippet which can be then used by module-init-tools (or modutils) +to load the correct parameters for your sound card. + +.SH OPTIONS +Alsaconf accepts the following options: +.TP +.B \-c, \-\-config file +Specify the module config file. +As default, +.B alsaconf +probes the available config file automatically. +.TP +.B \-d, \-\-devmode mode +Set the device mode for the ALSA devices (default = 0666). +This option is obsolete in the recent ALSA version. +.TP +.B \-g, \-\-gid gid +Set the gid for the ALSA devices (default = 0). +This option is obsolete in the recent ALSA version. +.TP +.B \-h, \-\-help +Displays this help text. +.TP +.B \-L, \-\-log file +Logging on the given file. The log is appended to the file. +This option is for debugging purpose only. +.TP +.B \-l, \-\-legacy +Check only for legacy non-isapnp cards. +.TP +.B \-m, \-\-modinfo +Read module descriptions instead of reading a card database. +.TP +.B \-P, \-\-listprobe +List the supported legacy card modules. +.TP +.B \-p, \-\-probe card-name +Probe a legacy non-isapnp card and print module options. +.TP +.B \-r, \-\-strict +Set strict device mode (equiv. with \-g 17 \-d 0660). +This option is obsolete in the recent ALSA version. +.TP +.B \-s, \-\-sound\-wav\-file +Use the specified wav file as a test sound. +.TP +.B \-u, \-\-uid uid +Set the uid for the ALSA devices (default = 0). +This option is obsolete in the recent ALSA version. + +.SH DEBIAN SPECIFIC +In Debian, the default gid of the device files is 29 (corresponding to the +audio group) and the default device mode is 0660. + +For the ALSA base package, see also +.I /usr/share/doc/alsa\-base/ + +.SH SEE ALSO +\fB +alsamixer(1), +amixer(1), +aplay(1), +arecord(1) +\fP + +.SH HOMEPAGE +http://www.alsa\-project.org/ + +.SH AUTHOR +The alsaconf script was written by +Takashi Iwai , +Bernd Kaindl and +Jan Ondrej (SAL) + +This manual page was written by Jordi Mallach , +for the Debian system (but may be used by others). diff --git a/alsaconf/alsaconf.fr.8 b/alsaconf/alsaconf.fr.8 new file mode 100644 index 0000000..14bbea8 --- /dev/null +++ b/alsaconf/alsaconf.fr.8 @@ -0,0 +1,111 @@ +.\" Hey, EMACS: -*- nroff -*- +.\" alsaconf.8 is copyright 2003 by Jordi Mallach +.\" +.\" This is free documentation, see the latest version of the GNU +.\" General Public License for copying conditions. There is NO warranty. +.TH ALSACONF 8 "15 mars 2005" + +.SH NOM +alsaconf \- outil de configuration pour ALSA (architecture de son avanc�e de Linux) +.\" configuration tool for the Advanced Linux Sound Architecture + +.SH SYNOPSIS +.B alsaconf +.RI [ options ] + +.SH DESCRIPTION +Cette page de manuel documente bri�vement la commande +.B alsaconf. + +.PP +\fBAlsaconf\fP +est un simple script shell qui essaye de d�tecter les cartes son sur votre +syst�me et �crit un fichier de configuration ad�quat pour ALSA. Il va +essayer de deviner quelle distribution GNU/Linux vous utilisez, et agira +conform�ment aux standards de cette distribution, si un support sp�cifique +est disponible. + +.PP +Alsaconf va �crire un fragment de code modutils qui peut �tre ensuite +utilis� par modutils pour charger les param�tres corrects de votre carte +son. + +.SH OPTIONS +Alsaconf accepte les options suivantes\ : + +.TP +.B \-l, \-\-legacy +Cherche seulement les anciennes cartes non-isapnp + +.TP +.B \-m, \-\-modinfo +Lit les descriptions de modules au lieu de lire une base de donn�es de +carte + +.TP +.B \-s, \-\-sound\-wav\-file +Utilise le fichier wav sp�cifi� comme son de test + +.TP +.B \-u, \-\-uid uid +Choisit l'uid pour les p�riph�riques ALSA (valeur par d�faut\ = 0) + +.TP +.B \-g, \-\-gid gid +Choisit le gid pour les p�riph�riques ALSA (valeur par d�faut\ = 0) + +.TP +.B \-d, \-\-devmode mode +Choisit le mode du p�riph�rique pour les p�riph�riques ALSA (valeur par +d�faut\ : 0666) + +.TP +.B \-r, \-\-strict +Choisit le mode de p�riph�rique strict (�quivaut � -g\ 17 -d\ 0660) + +.TP +.B \-L, \-\-log +Mise en journal dans /tmp/alsaconf.log + +.TP +.B \-p, \-\-probe card-name +Teste une ancienne carte non-isapnp et affiche les options du module + +.TP +.B \-h, \-\-help +Affiche ce message d'aide + + +.SH POUR DEBIAN EXCLUSIVEMENT +Sous Debian, le gid par d�faut des fichiers de p�riph�riques est 29 (qui +correspond au groupe audio) et le mode par d�faut des p�riph�riques est +0660. + +Pour le paquetage de base ALSA, voir aussi +.I /usr/share/doc/alsa-base/ + +.SH VOIR AUSSI +\fB +alsamixer(1), +amixer(1), +aplay(1), +arecord(1) +\fP + +.SH PAGE D'ACCUEIL +http://www.alsa-project.org/ + +.SH AUTEUR +Le script alsaconf fut �crit par +Takashi Iwai , +Bernd Kaindl et +Jan Ondrej (SAL) + +Cette page de manuel fut �crite par Jordi Mallach , pour +le syst�me Debian (mais elle peut �tre utilis�e par d'autres). + +.SH TRADUCTION +Baptiste M�l�s 2005. + +N'h�sitez pas � signaler � l'auteur ou au traducteur, selon le cas, toute +erreur dans cette page de manuel. diff --git a/alsaconf/alsaconf.in b/alsaconf/alsaconf.in new file mode 100644 index 0000000..3d6adca --- /dev/null +++ b/alsaconf/alsaconf.in @@ -0,0 +1,1451 @@ +#!/bin/bash +# +# ALSA Configurator +# +# Copyright (c) 1999-2002 SuSE GmbH +# Jan ONDREJ +# +# written by Takashi Iwai +# Bernd Kaindl +# Jan ONDREJ (SAL) +# +# based on the original version of Jan ONDREJ's alsaconf for ALSA 0.4. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# + +export TEXTDOMAIN=alsaconf + +prefix=@prefix@ +exec_prefix=@exec_prefix@ +bindir=@bindir@ +sbindir=@sbindir@ +version=@VERSION@ +USE_NLS=@USE_NLS@ + +# Useful for debugging +PROCFS="/proc" +SYSFS="/sys" + +# i18n stuff +if test "$USE_NLS" = "yes" && type -p gettext > /dev/null; then + xecho() { + gettext -s "$*" + } +else + xecho() { + echo "$*" + } + gettext() { + echo -n "$*" + } +fi +xmsg() { + msg=$(gettext "$1") + shift + printf "$msg" $* +} + +# Check for GNU/Linux distributions +if [ -f /etc/SuSE-release ]; then + distribution="suse" + suse_version=$(grep 'VERSION = ' /etc/SuSE-release | sed -e s/'VERSION = '//) +elif [ -f /etc/UnitedLinux-release ]; then + distribution="suse" +elif [ -f /etc/gentoo-release ]; then + distribution="gentoo" +elif [ -f /etc/debian_version ]; then + distribution="debian" +elif [ -f /etc/mandrake-release ]; then + distribution="mandrake" +elif test -f /etc/redhat-release && grep -q "Red Hat" /etc/redhat-release; then + distribution="redhat" +elif test -f /etc/fedora-release && grep -q "Fedora" /etc/fedora-release; then + distribution="fedora" +elif [ -f /etc/slackware-version -o -f /etc/slamd64-version ]; then + distribution="slackware" +else + distribution="unknown" +fi + +for prog in lspci lsmod; do + for path in /sbin /usr/sbin /bin /usr/bin;do + test -x $path/$prog && eval $prog=$path/$prog + done +done +unset prog path + +usage() { + xecho "ALSA configurator" + echo " version $version" + xecho "usage: alsaconf [options] + -l|--legacy check only legacy non-isapnp cards + -m|--modinfo read module descriptions instead of reading card db + -s|--sound wav-file + use the specified wav file as a test sound + -u|--uid uid set the uid for the ALSA devices (default = 0) [obsoleted] + -g|--gid gid set the gid for the ALSA devices (default = 0) [obsoleted] + -d|--devmode mode + set the permission for ALSA devices (default = 0666) [obs.] + -r|--strict set strict device mode (equiv. with -g 17 -d 0660) [obsoleted] + -L|--log file logging on the specified file (for debugging purpose only) + -p|--probe card-name + probe a legacy non-isapnp card and print module options + -P|--listprobe list the supported legacy card modules + -c|--config file + specify the module config file + -R|--resources list available DMA and IRQ resources with debug for legacy + -h|--help what you're reading" +} + +OPTS=`getopt -o lmL:hp:Pu:g:d:rs:c:R --long legacy,modinfo,log:,help,probe:,listprobe,uid:,gid:,devmode:,strict,sound:,config:,resources -n alsaconf -- "$@"` || exit 1 +eval set -- "$OPTS" + +do_legacy_only=0 +use_modinfo_db=0 +alsa_uid=0 +alsa_gid=0 +alsa_mode=0666 +legacy_probe_card="" +LOGFILE="" +TESTSOUND="@TESTSOUND@" +try_all_combination=0 +resources="false" + +# legacy support +LEGACY_CARDS="opl3sa2 cs4236 cs4232 cs4231 es18xx es1688 sb16 sb8" + +while true ; do + case "$1" in + -l|--legacy) + do_legacy_only=1; shift ;; + -m|--modinfo) + use_modinfo_db=1; shift ;; + -s|--sound) + TESTSOUND=$2; shift 2;; + -h|--help) + usage; exit 0 ;; + -L|--log) + LOGFILE="$2"; shift 2;; + -p|--probe) + legacy_probe_card="$2"; shift 2;; + -P|--listprobe) + echo "$LEGACY_CARDS"; exit 0;; + -u|--uid) + alsa_uid="$2"; shift 2;; + -g|--gid) + alsa_gid="$2"; shift 2;; + -d|--devmode) + alsa_mode="$2"; shift 2;; + -r|--strict) + alsa_uid=0; alsa_gid=17; alsa_mode=0660; shift;; + -c|--config) + cfgfile="$2"; shift 2;; + -R|--resources) + resources="true"; shift;; + --) shift ; break ;; + *) usage ; exit 1 ;; + esac +done + +# +# probe legacy ISA cards +# + +check_dma_avail () { + list="" + if [ -d $SYSFS/bus/pnp/devices ]; then + for dma in $*; do + ok="true" + for i in $SYSFS/bus/pnp/devices/??:* ; do + if grep -q "state = active" $i/resources ; then + if grep -q '^dma '$dma'$' $i/resources; then + ok="false" + fi + fi + done + if [ -r $PROCFS/dma ]; then + if grep -q '^ *'$dma': ' $PROCFS/dma ; then + ok="false" + fi + fi + if [ "$ok" = "true" ]; then + list="$list $dma" + fi + done + else + if [ -r $PROCFS/dma ]; then + for dma in $*; do + grep -q '^ *'$dma': ' $PROCFS/dma || list="$list $dma" + done + fi + fi + if [ ! -z "$list" ]; then + echo $list + fi +} + +check_irq_avail () { + list="" + if [ -d $SYSFS/bus/pnp/devices ]; then + for irq in $*; do + ok="true" + for i in $SYSFS/bus/pnp/devices/??:* ; do + if grep -q "state = active" $i/resources ; then + if grep -q '^irq '$irq'$' $i/resources; then + ok="false" + fi + fi + done + if [ -r $PROCFS/interrupts ]; then + if grep -q '^ *'$irq': ' $PROCFS/interrupts ; then + ok="false" + fi + fi + if [ "$ok" = "true" ]; then + list="$list $irq" + fi + done + else + if [ -r $PROCFS/interrupts ]; then + for irq in $*; do + grep -q '^ *'$irq': ' $PROCFS/interrupts || list="$list $irq" + done + fi + fi + if [ ! -z "$list" ]; then + echo $list + fi +} + +# +# +# + +if [ "$resources" = "true" ]; then + if [ -d $SYSFS/bus/pnp/devices ]; then + for i in $SYSFS/bus/pnp/devices/??:* ; do + if [ "$resources" = "true" ]; then + echo ">>>>> PnP file: $i/resources" + cat $i/resources + fi + done + fi + if [ -r $PROCFS/dma ]; then + echo ">>>>> Allocated dma channels:" + cat $PROCFS/dma + fi + if [ -r $PROCFS/interrupts ]; then + echo ">>>>> Allocated interrupt channels:" + cat $PROCFS/interrupts + fi + echo -n "Valid DMA channels: " + check_dma_avail 0 1 2 3 4 5 6 7 + echo -n "Valid IRQ channels: " + check_irq_avail 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 + exit 0 +fi + +# Check for root privileges +if [ `id -u` -ne 0 ]; then + xecho "You must be root to use this script." + exit 1 +fi + +# +# check the snd_ prefix for ALSA module options +# snd_ prefix is obsoleted since 0.9.0rc4. +# +if /sbin/modinfo -p snd | grep -q snd_ ; then + mpfx="snd_" +else + mpfx="" +fi + +alsa_device_opts="" +if /sbin/modinfo -p snd | grep -q uid ; then + if [ x"$alsa_uid" != x0 ]; then + alsa_device_opts="$alsa_device_opts ${mpfx}device_uid=$alsa_uid" + fi + if [ x"$alsa_gid" != x0 ]; then + alsa_device_opts="$alsa_device_opts ${mpfx}device_gid=$alsa_gid" + fi +fi +if /sbin/modinfo -p snd | grep -q device_mode ; then + if [ x"$alsa_mode" != x0 ]; then + alsa_device_opts="$alsa_device_opts ${mpfx}device_mode=$alsa_mode" + fi +fi + +case `uname -r` in +2.6.*) + kernel="new" + ;; +*) + kernel="old" + ;; +esac + +# cfgfile = base config file to remove/update the sound setting +# cfgout = new config file to write the sound setting (if different from $cfgfile) +cfgout="" +cfgoldout="" +if [ -n "$cfgfile" ]; then + if [ ! -r "$cfgfile" ]; then + xecho "ERROR: The config file doesn't exist: " + echo $cfgfile + exit 1 + fi +else +if [ "$kernel" = "new" ]; then + cfgfile="/etc/modprobe.conf" + if [ -d /etc/modprobe.d ]; then + cfgout="/etc/modprobe.d/50-sound.conf" + cfgoldout="/etc/modprobe.d/sound" + if [ ! -f $cfgout ]; then + case "$(modprobe -V)" in + "module-init-tools version "3.[789]*|\ + "module-init-tools version "3.1[0-9]*) + ;; + "kmod version "*) + ;; + *) + cfgout="/etc/modprobe.d/sound" + cfgoldout="" + ;; + esac + fi + fi +elif [ "$distribution" = "debian" ]; then + cfgfile="/etc/modutils/sound" +elif [ -e /etc/modules.conf ]; then + cfgfile="/etc/modules.conf" +elif [ -e /etc/conf.modules ]; then + cfgfile="/etc/conf.modules" +else + cfgfile="/etc/modules.conf" + touch /etc/modules.conf +fi +fi + +# Check for dialog, whiptail, gdialog, awk, ... ? +if type -p dialog > /dev/null; then + DIALOG=dialog +else + if type -p whiptail > /dev/null; then + whiptail_wrapper() { + X1="$1" + X2="$2" + if [ $1 = --yesno ]; then + X3=`expr $3 + 2` + else + X3=$3 + fi + shift 3 + whiptail "$X1" "$X2" $X3 "$@" + } + DIALOG=whiptail_wrapper + else + xecho "Error, dialog or whiptail not found." + exit 1 + fi +fi +if type -p awk > /dev/null; then : +else + xecho "Error, awk not found. Can't continue." + exit 1 +fi + +# +# remove entries by yast2 sound configurator +# +remove_y2_block() { + awk ' + /^alias sound-slot-[0-9]/ { next } + /^alias char-major-116 / { next } + /^alias char-major-14 / { next } + /^alias snd-card-[0-9] / { next } + /^options snd / { next } + /^options snd-/ { next } + /^options off / { next } + /^alias sound-service-[0-9]/ { next } + /^# YaST2: sound / { next } + { print }' +} + +# +# remove entries by sndconfig sound configurator +# +# found strings to search for in WriteConfModules, +# from sndconfig 0.68-4 (rawhide version) + +remove_sndconfig_block() { + awk ' + /^alias sound-slot-0/ { modulename = $3 ; next } + /^alias sound-slot-[0-9]/ { next } + /^post-install sound-slot-[0-9] / { next } + /^pre-remove sound-slot-[0-9] / { next } + /^options sound / { next } + /^alias synth0 opl3/ { next } + /^options opl3 / { next } + /^alias midi / { mididev = $3 ; next } + /^options / { if ($2 == mididev) next } + /^pre-install / { if ($2 == mididev) next } + /^alias synth0 / { synth = $3 ; next } + /^post-install / { if ($2 == synth) next } + /^options sb / { next } + /^post-install .+ \/bin\/modprobe "aci"/ { if ($2 == modulename) next } + /^options adlib_card / { next } + /^options .+ isapnp=1/ { if ($2 == modulename) next } + /^options i810_audio / { next } + /^options / {if ($2 == modulename) next } + { print }' +} + +# +# remove the previous configuration by alsaconf +# +remove_ac_block() { + awk '/^'"$ACB"'$/,/^'"$ACE"'$/ { next } { print }' +} + +# +# set default mixer volumes +# +set_mixers() { + amixer -s -q </dev/null 2>&1 + $rcalsasound unload >/dev/null 2>&1 + /sbin/rmmod dmasound dmasound_awacs 2>/dev/null +fi + + +cleanup () { + killall -9 aplay arecord >/dev/null 2>&1 + /sbin/modprobe -r isapnp >/dev/null 2>&1 + /sbin/modprobe -r isa-pnp >/dev/null 2>&1 + rm -f "$TMP" "$addcfg" "$FOUND" "$DUMP" +} +trap cleanup 0 + +TMP=`mktemp -q /tmp/alsaconf.XXXXXX` +if [ $? -ne 0 ]; then + xecho "Can't create temp file, exiting..." + exit 1 +fi +addcfg=`mktemp -q /tmp/alsaconf.XXXXXX` +if [ $? -ne 0 ]; then + xecho "Can't create temp file, exiting..." + exit 1 +fi +FOUND=`mktemp -q /tmp/alsaconf.XXXXXX` +if [ $? -ne 0 ]; then + xecho "Can't create temp file, exiting..." + exit 1 +fi +DUMP=`mktemp -q /tmp/alsaconf.XXXXXX` +if [ $? -ne 0 ]; then + xecho "Can't create temp file, exiting..." + exit 1 +fi + +# convert ISA PnP id number to string 'ABC' +convert_isapnp_id () { + if [ -z "$1" ]; then + echo "XXXX" + return + fi + let a='('$1'>>2) & 0x3f' + let b='(('$1' & 0x03) << 3) | (('$1' >> 13) & 0x07)' + let c='('$1'>> 8) & 0x1f' + strs='@ABCDEFGHIJKLMNOPQRSTUVWXYZ' + echo ${strs:$a:1}${strs:$b:1}${strs:$c:1} +} + +# swap high & low bytes +swap_number () { + if [ -z "$1" ]; then + echo "0000" + return + fi + let v='(('$1'>>8)&0xff)|(('$1'&0xff)<<8)' + printf "%04x" $v +} + +# build card database +# build_card_db filename +build_card_db () { + MODDIR=/lib/modules/`uname -r` + last_driver="" + echo -n > $1 + + # list pci cards + while read driver vendor device dummy; do + if expr $driver : 'snd-.*' >/dev/null ; then + if [ "$last_driver" != "$driver" ]; then + echo $driver.o + last_driver=$driver + fi + id1=`printf '0x%04x' $vendor` + id2=`printf '0x%04x' $device` + echo "PCI: $id1=$id2" + fi + done < $MODDIR/modules.pcimap >> $1 + + # list isapnp cards + while read driver cardvendor carddevice data vendor func; do + if expr $driver : 'snd-.*' >/dev/null ; then + if [ "$last_driver" != "$driver" ]; then + echo $driver.o + last_driver=$driver + fi + id1=`convert_isapnp_id $cardvendor` + dev1=`swap_number $carddevice` + id2=`convert_isapnp_id $vendor` + dev2=`swap_number $func` + echo "ISAPNP: $id1$dev1=$id2$dev2" + fi + done < $MODDIR/modules.isapnpmap >> $1 +} + +# +# probe cards +# +probe_cards () { + found="0" + test -r $PROCFS/isapnp || /sbin/modprobe isapnp >/dev/null 2>&1 + test -r $PROCFS/isapnp || /sbin/modprobe isa-pnp >/dev/null 2>&1 + if [ -r $PROCFS/isapnp ]; then + cat $PROCFS/isapnp >"$DUMP" + found="1" + elif [ -d $SYSFS/bus/pnp/devices ]; then + # use 2.6 kernel's sysfs output + # fake the isapnp dump + index=0 + bindex=0 + for d1 in $SYSFS/devices/pnp* ; do + for d2 in $d1/*:* ; do + if [ -r $d2/card_id ]; then + id=`cat $d2/card_id` + name=`cat $d2/name` + echo "Card $index '$id:$name' " >> "$DUMP" + index=$[$index+1] + found="1" + else if [ -r $d2/id ]; then + # FIXME: multiple id might be present (separated with new-line) + id=`head -n 1 $d2/id` + echo "BIOS $bindex '$id' " >> "$DUMP" + bindex=$[$bindex+1] + found="1" + fi + fi + done + done + fi + if [ "$found" = "0" ]; then + echo -n >"$DUMP" + fi + CARDID_DB=/var/tmp/alsaconf.cards + if [ ! -r $CARDID_DB ]; then + use_modinfo_db=1 + fi + if [ $use_modinfo_db != 1 ]; then + if [ $CARDID_DB -ot /lib/modules/`uname -r`/modules.dep ]; then + use_modinfo_db=1 + fi + fi + if [ $use_modinfo_db = 1 ]; then + xecho "Building card database.." + build_card_db $CARDID_DB + fi + if [ ! -r $CARDID_DB ]; then + xecho "No card database is found.." + exit 1 + fi + ncards=`grep '^snd-.*\.o$' $CARDID_DB | wc -w` + + msg=$(gettext "Searching sound cards") + awk ' +BEGIN { + format="%-40s %s\n"; + ncards='"$ncards"'; + idx=0; +} +/^snd-.*\.o$/{ + sub(/.o$/, ""); + driver=$0; + perc=(idx * 100) / (ncards + 1); + print int(perc); + idx++; +} +/^[]*PCI: /{ + gsub(/0x/, ""); + gsub(/=/, ":"); + x = sprintf ("'$lspci' -n 2>/dev/null| grep '"' 04..: '"' | grep %s", $2); + if (system (x) == 0) + printf "%s %s\n", $2, driver >>"'"$FOUND"'" +} +/^[]*ISAPNP: /{ + id2 = substr($0, index($0, "=")+1); + gsub(/=.*/, ""); + x = sprintf ("grep '\''^Card [0-9] .%s:'\'' '"$DUMP"'", $2); + if (system (x) == 0) + printf "%s %s\n", $2, driver >>"'"$FOUND"'" + else if (index($2, "ffff") > 0) { + x = sprintf ("grep '\''^BIOS [0-9]* .%s.'\'' '"$DUMP"'", id2); + if (system (x) == 0) + printf "%s %s\n", id2, driver >>"'"$FOUND"'" + } +}' < $CARDID_DB |\ + $DIALOG --gauge "$msg" 6 40 0 + + # + # PowerMac + # + if grep -q MacRISC $PROCFS/cpuinfo; then + MODDIR=/lib/modules/`uname -r` + find $MODDIR -name 'snd-powermac*' -print | \ + while read i; do + i=${i##*/} + i=${i%%.o} + i=${i%%.ko} + echo "PowerMac $i" >> $FOUND + done + fi + + # + # Sparc + # + if grep -q Sparc $PROCFS/cpuinfo; then + test -r $PROCFS/openprom/name || /bin/mount -t openpromfs none $PROCFS/openprom >/dev/null 2>&1 + # Check for an "audio" device + audio= + compat= + if test -r $PROCFS/openprom; then + audio=`find $PROCFS/openprom -follow -type d -name "audio*" -print` + fi + if test -n "$audio"; then + compat=`cat $audio/compatible` + compat=${compat#\'} + compat=${compat%\'} + compat=${compat#SUNW,} + fi + # Go through all cards we have + MODDIR=/lib/modules/`uname -r` + find $MODDIR -name 'snd-sun-*' -print | \ + while read i; do + i=${i##*/} + i=${i%%.o} + i=${i%%.ko} + sdev=`echo ${i#snd-sun-} | tr "[a-z]" "[A-Z]"` + + if test "$sdev" = "$compat"; then + echo "$sdev $i" >> $FOUND + elif test -r $PROCFS/openprom; then + find $PROCFS/openprom -follow -type d -name "SUNW,${sdev}*" \ + -exec echo "$sdev $i" \; 2>/dev/null >> $FOUND + else + echo "$sdev $i" >> $FOUND + fi + done + fi +} + +# +# look for a descriptive device name from the given device id +# +find_device_name () { + if expr "$1" : '[0-9a-f][0-9a-f][0-9a-f][0-9a-f]:[0-9a-f][0-9a-f][0-9a-f][0-9a-f]' >/dev/null; then + $lspci -d $1 2>/dev/null| sed -e 's/^.*:..\.. [^:]*: //g' + return + elif expr "$1" : '[A-Z@][A-Z@][A-Z@][0-9a-f][0-9a-f][0-9a-f][0-9a-f]' >/dev/null; then + cardname=`grep '^Card [0-9]\+ .'$1':' $DUMP | head -n 1 | sed -e 's/^Card [0-9]\+ '\''.*:\(.*\)'\'' .*$/\1/'` + echo $cardname + else + echo $1 + fi +} + +# get hwcfg file type from the given driver name +get_hwcfg_type () { + while read dev driver; do + if [ "$driver" = "$1" ]; then + case "$dev" in + *:*) + # FIXME: need to look around /sys/bus/pci/* (or use vpid-* ?) + devid=`$lspci -d "$dev" | head -n 1 | sed -e 's/ .*$//'` + case "$devid" in + *:*:*.*) ;; + *) devid="0000:$devid" ;; + esac + echo bus-pci-$devid + ;; + *) + echo $driver + ;; + esac + break + fi + done +} + +# clean up all hwcfg-* files containing ALSA modules +# alsaconf sets up exclusively +cleanup_hwcfg () { + for i in /etc/sysconfig/hardware/hwcfg-*; do + grep -q "MODULE='snd-" $i && rm -f $i + done +} + +# +# set up /etc/sysconfig/hardware/hwcfg-* stuff +# +setup_hwcfg () { + card=$1 + cleanup_hwcfg + cfg=`echo "$devs_olist" | get_hwcfg_type $card` + echo "MODULE='$card'" > /etc/sysconfig/hardware/hwcfg-$cfg + echo "STARTMODE='auto'" >> /etc/sysconfig/hardware/hwcfg-$cfg +} + + +# +# configure and try test sound +# +ac_config_card () { + + CARD_DRIVER=snd-$1 + CARD_OPTS="${*:2}" + + if [ -n "$cfgout" ]; then + msg=$(xmsg " +Configuring %s +Do you want to modify %s (and %s if present)?" $CARD_DRIVER $cfgout $cfgfile) + $DIALOG --yesno "$msg" 10 50 || acex 0 + else + msg=$(xmsg " +Configuring %s +Do you want to modify %s?" $CARD_DRIVER $cfgfile) + $DIALOG --yesno "$msg" 8 50 || acex 0 + fi + clear + + # Copy conf.modules and make changes. + ACB="# --- BEGIN: Generated by ALSACONF, do not edit. ---" + ACE="# --- END: Generated by ALSACONF, do not edit. ---" + + # Detect 2.2.X kernel + KVER=`uname -r | tr ".-" " "` + KVER1=`echo $KVER | cut -d" " -f1` + KVER2=`echo $KVER | cut -d" " -f2` + if [ $KVER1 -ge 2 ] && [ $KVER2 -ge 2 ]; then + SOUND_CORE="soundcore" + else + SOUND_CORE="snd" + fi + + if [ -r $cfgfile ] ; then + if [ "$distribution" = "redhat" -o "$distribution" = "fedora" ] ; then + remove_ac_block < $cfgfile | remove_sndconfig_block | uniq > $TMP + else + remove_ac_block < $cfgfile | remove_y2_block | uniq > $TMP + fi + fi + + if [ -z "$have_alias" -a "$kernel" = "new" ]; then + if grep -q char-major-116 /lib/modules/`uname -r`/modules.alias; then + have_alias="yes" + fi + fi + if [ -z "$have_alias" ]; then +echo "alias char-major-116 snd +alias char-major-14 $SOUND_CORE +alias sound-service-0-0 snd-mixer-oss +alias sound-service-0-1 snd-seq-oss +alias sound-service-0-3 snd-pcm-oss +alias sound-service-0-8 snd-seq-oss +alias sound-service-0-12 snd-pcm-oss" >> $addcfg + fi + if [ -n "$alsa_device_opts" ]; then + echo "options snd $alsa_device_opts" >> $addcfg + fi +echo "alias snd-card-0 $CARD_DRIVER +alias sound-slot-0 $CARD_DRIVER" >> $addcfg + if [ -n "$CARD_OPTS" ]; then + echo "options $CARD_DRIVER $CARD_OPTS" >> $addcfg + fi + + if [ -n "$cfgout" ]; then + [ ! -r "$cfgfile" ] || cmp -s "$TMP" "$cfgfile" || cat "$TMP" > "$cfgfile" + cmp -s "$addcfg" "$cfgout" || cat "$addcfg" > "$cfgout" + test -n "$cfgoldout" && rm -f "$cfgoldout" + else + echo "$ACB +# --- ALSACONF version $version ---" >> $TMP + cat "$addcfg" >> "$TMP" + echo "$ACE +" >> $TMP + cmp -s "$TMP" "$cfgfile" || cat "$TMP" > "$cfgfile" + fi + + /sbin/depmod -a 2>/dev/null + + # remove yast2 entries (- only for suse distro) + if [ -f /var/lib/YaST/unique.inf ]; then + awk ' +BEGIN { in_sound=0; } +/^\[sound\]$/ { print; in_sound=1; next; } +/^\[.+\]$/ { print; in_sound=0; next; } +{ if (in_sound == 0) { print; } } +' < /var/lib/YaST/unique.inf > $TMP + cp -f $TMP /var/lib/YaST/unique.inf + fi + + # set up /etc/sysconfig/hardware/* + if [ "$distribution" = "suse" ]; then + case "$suse_version" in + 10.[012]*|10) + setup_hwcfg $CARD_DRIVER + ;; + esac + fi + + farewell + clear + case "$distribution" in + gentoo | debian) + xecho "Running update-modules..." + update-modules + ;; + esac + if [ -x $rcalsasound ] ; then + echo Loading driver... + $rcalsasound restart + fi + echo Setting default volumes... + if [ -x $bindir/set_default_volume ]; then + $bindir/set_default_volume -f + else + set_mixers + fi + if [ -f $TESTSOUND ]; then + msg=$(gettext " + The mixer is set up now for for playing. + Shall I try to play a sound sample now? + + NOTE: +If you have a big amplifier, lower your volumes or say no. + Otherwise check that your speaker volume is open, + and look if you can hear test sound. +") + if $DIALOG --yesno "$msg" 13 65 + then + clear + echo + aplay -N $TESTSOUND + fi + fi + mkdir -p -m 0755 @ASOUND_STATE_DIR@ + if [ ! -r @ASOUND_STATE_DIR@/asound.state ]; then + xecho "Saving the mixer setup used for this in @ASOUND_STATE_DIR@/asound.state." + $sbindir/alsactl store + fi + clear + xecho " +=============================================================================== + + Now ALSA is ready to use. + For adjustment of volumes, use your favorite mixer. + + Have a lot of fun! + +" +} + +# check playback +# return 0 - OK, 1 - NG, 2 - not working (irq/dma problem) +ac_try_load () { + test -n "$LOGFILE" && echo "$1 ${*:2}" >> "$LOGFILE" + /sbin/modprobe snd-$1 ${*:2} >/dev/null 2>&1 + if $lsmod | grep -q -E '^(snd-|snd_)'$1' '; then + : ; + else + /sbin/modprobe -r snd-$1 >/dev/null 2>&1 + return 1 + fi + + # mute mixers + amixer set Master 0% mute >/dev/null 2>&1 + amixer set PCM 0% mute >/dev/null 2>&1 + + # output 0.5 sec + head -c 4000 < /dev/zero | aplay -N -r8000 -fS16_LE -traw -c1 > /dev/null 2>&1 & + # remember pid + pp=$! + # sleep for 2 seconds (to be sure -- 1 sec would be enough) + sleep 2 + # kill the child process if still exists. + kill -9 $pp > /dev/null 2>&1 + st=$? + ac_cardname=`head -n 1 $PROCFS/asound/cards | sed -e 's/^[0-9].* - \(.*\)$/\1/'` + /sbin/modprobe -r snd-$1 >/dev/null 2>&1 + if [ $st = 0 ]; then + # irq problem? + test -n "$LOGFILE" && echo "no playback return" >> "$LOGFILE" + return 2 + else + # seems ok! + test -n "$LOGFILE" && echo "playback OK" >> "$LOGFILE" + return 0 + fi +} + +# check capture +# return 0 - OK, 1 - NG, 2 - not working (irq/dma problem) +# ac_try_capture card duplex opts +ac_try_capture () { + test -n "$LOGFILE" && echo "$1 ${*:2}" >> "$LOGFILE" + /sbin/modprobe snd-$1 ${*:3} >/dev/null 2>&1 + if $lsmod | grep -q -E '^(snd-|snd_)'$1' '; then + : ; + else + /sbin/modprobe -r snd-$1 >/dev/null 2>&1 + return 1 + fi + + # mute mixers + amixer set Master 0% mute >/dev/null 2>&1 + amixer set PCM 0% mute >/dev/null 2>&1 + + play_pid=0 + if [ $2 = yes ]; then + # try duplex - start dummy playing + aplay -N -r8000 -fS16_LE -traw -c1 < /dev/zero > /dev/null 2>&1 & + play_pid=$! + fi + # record 1sec + arecord -N -d1 > /dev/null 2>&1 & + # remember pid + pp=$! + # sleep for 2 seconds + sleep 2 + # kill the child process if still exists. + kill -9 $pp > /dev/null 2>&1 + st=$? + # kill playback process if any + test $play_pid != 0 && kill -9 $play_pid + /sbin/modprobe -r snd-$1 >/dev/null 2>&1 + if [ $st = 0 ]; then + test -n "$LOGFILE" && echo "capture no return" >> "$LOGFILE" + return 2 + else + test -n "$LOGFILE" && echo "capture OK" >> "$LOGFILE" + return 0 + fi +} + +get_dma_pair () { + case $1 in + 0) + echo 1 3 5;; + 1) + echo 0 3 5;; + 3) + echo 1 0 5;; + 5) + echo 3 1 0;; + esac +} + +# +# check playback on specified irqs +# +# ac_try_irq card opts irqs... +# return 0 - OK, 1 - NG, 2 - not working (dma problem?) +# +ac_try_irq () { + card=$1 + opts="$2 ${mpfx}irq=$3" + ac_try_load $card $opts >/dev/null 2>&1 + result=$? + case $result in + 0) + ac_opts="$opts" + return 0 + ;; + 2) + for irq in ${*:4}; do + opts="$2 ${mpfx}irq=$irq" + ac_try_load $card $opts >/dev/null 2>&1 + if [ $? = 0 ]; then + ac_opts="$opts" + return 0 + fi + done + return 2 + ;; + esac + return 1 +} + +# +# check playback/capture on dma1 & dma2 & specified irqs +# +# ac_try_dmas card opts irqs... +# return 0 - OK, 1 - NG +# +ac_try_dmas () { + dma_list=`check_dma_avail 1 0 3 5` + for irq in ${*:3}; do + for dma1 in $dma_list; do + for dma2 in `get_dma_pair $dma1`; do + opts="$2 ${mpfx}dma1=$dma1 ${mpfx}dma2=$dma2 ${mpfx}irq=$irq" + ac_try_load $1 $opts >/dev/null 2>&1 + result=$? + if [ $result = 1 ]; then + if [ $try_all_combination = 1 ]; then + continue + else + return 1 + fi + elif [ $result = 0 ]; then + test -n "$LOGFILE" && echo "Now checking capture..." >> "$LOGFILE" + ac_opts="$opts" + ac_try_capture $1 yes $opts >/dev/null 2>&1 && return 0 + for d in yes no; do + for dma2 in $dma_list; do + if [ $dma1 != $dma2 ]; then + opts="$2 ${mpfx}dma1=$dma1 ${mpfx}dma2=$dma2 ${mpfx}irq=$irq" + ac_opts="$opts" + ac_try_capture $1 $d $opts >/dev/null 2>&1 && return 0 + fi + done + done + return 0 + fi + done + done + done + return 1 +} + +# check if the option $2 exists in card $1: set value $3 +ac_check_option () { + if /sbin/modinfo -p snd-$1 | grep -q $2; then + echo "$2=$3" + fi +} + +ac_try_card_sb8 () { + card=sb8 + irq_list=`check_irq_avail 5 3 9 10 7` + for dma8 in `check_dma_avail 1 3`; do + opts="${mpfx}dma8=$dma8" + ac_try_irq $card "$opts" $irq_list && return 0 + done + return 1 +} + +ac_try_card_sb16 () { + card=sb16 + isapnp=`ac_check_option $card ${mpfx}isapnp 0` + opts="$isapnp" + irq_list=`check_irq_avail 5 9 10 7 3` + dma_list=`check_dma_avail 0 1 3` + dma16_list=`check_dma_avail 5 6 7` + # at first try auto-probing by driver itself + ac_try_load $card $opts >/dev/null 2>&1 + result=$? + case $result in + 0) + ac_opts="$opts" + ac_try_capture $card yes $opts >/dev/null 2>&1 && return 0 + for d in yes no; do + for dma8 in $dma_list; do + for irq in $irq_list; do + opts="${mpfx}dma8=$dma8 ${mpfx}irq=$irq $isapnp" + ac_try_capture $card $d $opts >/dev/null 2>&1 && return 0 + done + done + done + return 0 + ;; + 2) + for dma16 in $dma16_list; do + opts="${mpfx}dma16=$dma16 $isapnp" + if ac_try_irq $card "$opts" $irq_list ; then + ac_try_capture $card yes $ac_opts >/dev/null 2>&1 && return 0 + ac_opts_saved="$ac_opts" + for d in yes no; do + for dma8 in $dma_list; do + ac_opts="$ac_opts_saved ${mpfx}dma8=$dma8" + ac_try_capture $card $d $ac_opts >/dev/null 2>&1 && return 0 + done + done + # return anyway here.. + return 0 + fi + done + ;; + esac + return 1 +} + +ac_try_card_es1688 () { + card=es1688 + opts="" + irq_list=`check_irq_avail 5 9 10 7` + for dma8 in `check_dma_avail 1 3 0`; do + opts="${mpfx}dma8=$dma8 ${mpfx}mpu_irq=-1" + ac_try_irq $card "$opts" $irq_list && return 0 + done + return 1 +} + +ac_try_card_es18xx () { + card=es18xx + opts=`ac_check_option $card ${mpfx}isapnp 0` + ac_try_dmas $card "$opts" `check_irq_avail 5 9 10 7` && return 0 + return 1 +} + +ac_try_card_cs4236 () { + card=cs4236 + irq_list=`check_irq_avail 5 7 9 11 12 15` + isapnp=`ac_check_option $card ${mpfx}isapnp 0` + for cport in 0x538 0x210 0xf00; do + for port in 0x530 0x534; do + opts="${mpfx}port=$port ${mpfx}cport=$cport $isapnp" + ac_try_dmas $card "$opts" $irq_list && return 0 + done + done + return 1 +} + +ac_try_card_cs4232 () { + card=cs4232 + irq_list=`check_irq_avail 5 7 9 11 12 15` + isapnp=`ac_check_option $card ${mpfx}isapnp 0` + for cport in 0x538 0x210 0xf00; do + for port in 0x530 0x534; do + opts="${mpfx}port=$port ${mpfx}cport=$cport $isapnp" + ac_try_dmas $card "$opts" $irq_list && return 0 + done + done + return 1 +} + +ac_try_card_cs4231 () { + card=cs4231 + irq_list=`check_irq_avail 5 7 9 11 12 15` + for port in 0x530 0x534; do + opts="${mpfx}port=$port" + ac_try_dmas $card "$opts" $irq_list && return 0 + done + return 1 +} + +ac_try_card_opl3sa2 () { + card=opl3sa2 + irq_list=`check_irq_avail 5 9 3 1 11 12 15 0` + isapnp=`ac_check_option $card ${mpfx}isapnp 0` + for port in 0x370 0x538 0xf86 0x100; do + for wss_port in 0x530 0xe80 0xf40 0x604; do + opts="${mpfx}fm_port=-1 ${mpfx}midi_port=-1 ${mpfx}port=$port ${mpfx}wss_port=$wss_port $isapnp" + ac_try_dmas $card "$opts" $irq_list && return 0 + done + done + return 1 +} + +ac_config_legacy () { + title=$(gettext "WARNING") + msg=$(gettext " + Probing legacy ISA cards might make + your system unstable. + + Do you want to proceed? + +") + $DIALOG --title "$title" --yesno "$msg" 10 50 || acex 0 + + if [ x"$1" = x ]; then + probe_list="$LEGACY_CARDS" + else + probe_list=$* + fi + menu_args=() + + for card in $probe_list; do + cardname=`/sbin/modinfo -d snd-$card | sed -e 's/^\"\(.*\)\"$/\1/g'` + if [ x"$cardname" != x ]; then + menu_args=("${menu_args[@]}" "$card" "$cardname" "on") + fi + done + if [ x$menu_args = x ]; then + msg=$(gettext "No legacy drivers are available + for your machine") + $DIALOG --msgbox "$msg" 5 50 + return 1 + fi + title=$(gettext "Driver Selection") + msg=$(gettext " Probing legacy ISA cards + + Please select the drivers to probe:") + $DIALOG --title "$title" --checklist "$msg" \ + 17 64 8 "${menu_args[@]}" 2> $FOUND || acex 0 + + if [ $try_all_combination != 1 ]; then + msg=$(gettext " + Shall I try all possible DMA and IRQ combinations? + With this option, some unconventional configuration + might be found, but it will take much longer time.") + if $DIALOG --yesno "$msg" 10 60 + then + try_all_combination=1 + fi + fi + + xecho "Probing legacy cards.. This may take a few minutes.." + echo -n $(gettext "Probing: ") + cards=`cat $FOUND | tr -d \"` + for card in $cards; do + echo -n " $card" + ac_opts="" + if eval ac_try_card_$card ; then + xecho " : FOUND!!" + ac_config_card $card $ac_opts + return 0 + fi + done + echo + title=$(gettext "Result") + msg=$(gettext "No legacy cards found") + $DIALOG --title "$title" --msgbox "$msg" 5 50 + return 1 +} + +# +# main part continued.. +# + +if test -n "$LOGFILE" ; then + touch "$LOGFILE" + echo -n "Starting alsaconf: " >> "$LOGFILE" + date >> "$LOGFILE" +fi + +if [ x"$legacy_probe_card" != x ]; then + ac_opts="" + if eval ac_try_card_$legacy_probe_card >/dev/null 2>&1; then + echo "$ac_opts" + echo "$ac_cardname" + exit 0 + else + echo "FAILED" + exit 1 + fi +fi + +intro + +if [ $do_legacy_only = 1 ]; then + ac_config_legacy + exit 0 +fi + +probe_cards + +devs_found=() +devs_olist="" + +if [ -s "$FOUND" ]; then + while read dev card ; do + MODDIR=/lib/modules/`uname -r` + find $MODDIR -type f | grep -q -E $card'\.(o|ko)' || continue + cardname=`find_device_name $dev | cut -c 1-64` + if [ -z "$cardname" ]; then + cardname="$card" + fi + card=${card##snd-} + devs_found=("${devs_found[@]}" "$card" "$cardname") + devs_devs=("${devs_devs[@]}" "$card" "$dev") + done <"$FOUND" + devs_olist=`cat $FOUND` +fi +if [ x$devs_found != x ]; then + # + # check for TP600E + # + if [ ${devs_found[0]} = cs46xx ]; then + if $lspci -nv 2>/dev/null| grep -q "Subsystem: 1014:1010"; then + msg=$(gettext " + Looks like you having a Thinkpad 600E or 770 notebook. + On this notebook, CS4236 driver should be used + although CS46xx chip is detected. + + Shall I try to snd-cs4236 driver and probe + the legacy ISA configuration?") + if $DIALOG --yesno "$msg" 13 60 + then + try_all_combination=1 + ac_config_legacy cs4236 + exit 0 + fi + elif $lspci -nv 2>/dev/null| grep -q "Subsystem: 8086:8080"; then + msg=$(gettext " + Looks like you having a Dell Dimension machine. + On this machine, CS4232 driver should be used + although CS46xx chip is detected. + + Shall I try to snd-cs4232 driver and probe + the legacy ISA configuration?") + if $DIALOG --yesno "$msg" 13 60 + then + try_all_combination=1 + ac_config_legacy cs4232 + exit 0 + fi + fi + fi + + devs_found=("${devs_found[@]}" "legacy" "Probe legacy ISA (non-PnP) chips") + title=$(gettext "Soundcard Selection") + msg=$(gettext " + Following card(s) are found on your system. + Choose a soundcard to configure: +") + $DIALOG --title "$title" --menu "$msg" 17 76 8 "${devs_found[@]}" --output-fd 3 3> $FOUND || acex 0 + card=`head -n 1 $FOUND` + if [ "$card" = "legacy" ]; then + ac_config_legacy + else + ac_config_card "$card" + fi + exit 0 +else + msg=$(gettext " + No supported PnP or PCI card found. + + Would you like to probe legacy ISA sound cards/chips? + +") + if $DIALOG --yesno "$msg" 9 60 ; then + ac_config_legacy + exit 0 + fi +fi + +rm -f "$FOUND" "$DUMP" +exit 0 diff --git a/alsaconf/po/Makefile.in b/alsaconf/po/Makefile.in new file mode 100644 index 0000000..f1fa9aa --- /dev/null +++ b/alsaconf/po/Makefile.in @@ -0,0 +1,91 @@ +POFILES = ja.po ru.po + +DOMAIN = alsaconf +GETTEXT_SRC = ../alsaconf.in + +XGETTEXT_OPTIONS = -kxmsg -kxecho + +top_builddir = ../.. + +srcdir = @srcdir@ +datadir = @datadir@ +exec_prefix = @exec_prefix@ +prefix = @prefix@ +localedir = $(datadir)/locale + +USE_NLS = @USE_NLS@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +# mkdir_p = @mkdir_p@ +mkdir_p = mkdir -p -- +XGETTEXT = @XGETTEXT@ +MSGFMT = @MSGFMT@ +GMSGFMT = @GMSGFMT@ +MSGMERGE = @MSGMERGE@ +MSGMERGE_UPDATE = @MSGMERGE@ --update + +DISTFILES = $(POFILES) Makefile.in +CATALOGS = $(POFILES:.po=.gmo) + +all: all-@USE_NLS@ + +all-yes: $(CATALOGS) +all-no: + +.SUFFIXES: .po .gmo .mo + +%.mo : $(srcdir)/%.po + $(MSGFMT) -c -o t-$@ $< && mv t-$@ $@ + +%.gmo : $(srcdir)/%.po + @lang=`echo $(srcdir)/$* | sed -e 's,.*/,,'`; \ + rm -f $${lang}.gmo && $(GMSGFMT) -c --statistics -o t-$${lang}.gmo $(srcdir)/$${lang}.po && mv t-$${lang}.gmo $${lang}.gmo + +$(DOMAIN).pot: $(GETTEXT_SRC) + $(XGETTEXT) -o$@ --default-domain=$(DOMAIN) \ + --add-comments=TRANSLATORS: --language=Shell \ + $(XGETTEXT_OPTIONS) $< + +check check_recursive: + +clean: + rm -f $(CATALOGS) $(POFILES:.po=.mo) $(DOMAIN).pot + +update-po: $(DOMAIN).pot + @for po in $(POFILES); do \ + $(MSGMERGE_UPDATE) $(srcdir)/$$po $(DOMAIN).pot; \ + done + +install-data-no: +install-data-yes: all + $(mkdir_p) $(DESTDIR)$(datadir) + @catalogs='$(CATALOGS)'; \ + for cat in $$catalogs; do \ + lang=`echo $$cat | sed -e 's/\.gmo$$//'`; \ + dir=$(localedir)/$$lang/LC_MESSAGES; \ + $(mkdir_p) $(DESTDIR)$$dir; \ + $(INSTALL_DATA) $$cat $(DESTDIR)$$dir/$(DOMAIN).mo; \ + done + +install-data: install-data-@USE_NLS@ +install: install-data + +uninstall-data-no: +uninstall-data-yes: + @catalogs='$(CATALOGS)'; \ + for cat in $$catalogs; do \ + cat=`basename $$cat`; \ + lang=`echo $$cat | sed -e 's/\.gmo$$//'`; \ + rm -f $(DESTDIR)$(localedir)/$$lang/LC_MESSAGES/$(DOMAIN).mo; \ + done + +uninstall-data: uninstall-data-@USE_NLS@ +uninstall: uninstall-data + +dist distdir: $(DISTFILES) + @for file in $(DISTFILES); do \ + cp -p $$file $(distdir); \ + done + +distclean: clean + rm -f Makefile *~ diff --git a/alsaconf/po/ja.po b/alsaconf/po/ja.po new file mode 100644 index 0000000..170f708 --- /dev/null +++ b/alsaconf/po/ja.po @@ -0,0 +1,362 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# FIRST AUTHOR , YEAR. +# +msgid "" +msgstr "" +"Project-Id-Version: alsaconf\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2005-12-02 12:37+0100\n" +"PO-Revision-Date: 2005-12-02 12:39+0100\n" +"Last-Translator: Takashi Iwai \n" +"Language-Team: Japanese \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: ../alsaconf.in:36 +msgid "-s" +msgstr "" + +#: ../alsaconf.in:80 +msgid "ALSA configurator" +msgstr "ALSA 設定ツール" + +#: ../alsaconf.in:82 +msgid "" +"usage: alsaconf [options]\n" +" -l|--legacy check only legacy non-isapnp cards\n" +" -m|--modinfo read module descriptions instead of reading card db\n" +" -s|--sound wav-file\n" +" use the specified wav file as a test sound\n" +" -u|--uid uid set the uid for the ALSA devices (default = 0) [obsoleted]\n" +" -g|--gid gid set the gid for the ALSA devices (default = 0) [obsoleted]\n" +" -d|--devmode mode\n" +" set the permission for ALSA devices (default = 0666) " +"[obs.]\n" +" -r|--strict set strict device mode (equiv. with -g 17 -d 0660) " +"[obsoleted]\n" +" -L|--log file logging on the specified file (for debugging purpose only)\n" +" -p|--probe card-name\n" +" probe a legacy non-isapnp card and print module options\n" +" -P|--listprobe list the supported legacy card modules\n" +" -c|--config file\n" +" specify the module config file\n" +" -R|--resources list available DMA and IRQ resources with debug for legacy\n" +" -h|--help what you're reading" +msgstr "" +"使用法: alsaconf [オプション]\n" +" -l|--legacy 非 ISAPnP カードのみチェックする\n" +" -m|--modinfo カード DB を読む代わりにモジュール記述を読み込み\n" +" -s|--sound WAVファイル\n" +" 指定の WAV ファイルをテスト音として用いる\n" +" -u|--uid uid ALSA デバイスの uid (デフォルト = 0) [旧オプション・無視されます]\n" +" -g|--gid gid ALSA デバイスの gid (デフォルト = 0) [旧]\\n\"\n" +" -d|--devmode モード\n" +" ALSA デバイスのパーミッション(デフォルト = 0666) [旧]\n" +" -r|--strict 厳格なモード (-g 17 -d 0660 と同等) [旧]\n" +" -L|--log file 指定のファイルにログを記録する (デバッグ用途)\n" +" -p|--probe カード名\n" +" 指定の 非IsaPnP カードを検索しモジュールオプションを表示する\n" +" -P|--listprobe サポートされている旧式の(非isapnp)カードのモジュール一覧表示\n" +" -c|--config ファイル\n" +" 指定のモジュール設定ファイルを用いる\n" +" -R|--resources レガシーデバイスのデバッグ用: 可能な DMA と IRQ を表示する\n" +" -h|--help 今見ています" + +#: ../alsaconf.in:252 +msgid "You must be root to use this script." +msgstr "ルートのみ実行可能です" + +#: ../alsaconf.in:294 +msgid "ERROR: The config file doesn't exist: " +msgstr "エラー: 設定ファイルが存在しません: " + +#: ../alsaconf.in:336 +msgid "Error, dialog or whiptail not found." +msgstr "エラー: dialog または whiptail が見つかりません" + +#: ../alsaconf.in:342 +msgid "Error, awk not found. Can't continue." +msgstr "エラー: awk が見つかりません" + +#: ../alsaconf.in:439 +msgid "" +"\n" +" ALSA CONFIGURATOR\n" +" version %s\n" +"\n" +" This script is a configurator for\n" +" Advanced Linux Sound Architecture (ALSA) driver.\n" +"\n" +"\n" +" If ALSA is already running, you should close all sound\n" +" apps now and stop the sound driver.\n" +" alsaconf will try to do this, but it's not 100%% sure." +msgstr "" +"\n" +" ALSA 設定ツール\n" +" バージョン %s\n" +"\n" +" このスクリプトは、Advanced Linux Sound Architecture\n" +" (ALSA) ドライバの設定を行うツールです。\n" +"\n" +"\n" +" もし既に ALSA が起動している場合は、実行前に\n" +" 全てのサウンドアプリケーションを閉じて、サウンド\n" +" ドライバを停止してください。\n" +" alsaconf の動作は 100%% 保証できません。" + +#: ../alsaconf.in:455 +msgid "" +"\n" +"\n" +" OK, sound driver is configured.\n" +"\n" +" ALSA CONFIGURATOR\n" +"\n" +" will prepare the card for playing now.\n" +"\n" +" Now I'll run alsasound init script, then I'll use\n" +" amixer to raise the default volumes.\n" +" You can change the volume later via a mixer\n" +" program such as alsamixer or gamix.\n" +" \n" +" " +msgstr "" +"\n" +"\n" +" サウンドドライバが設定されました。\n" +"\n" +" これからカードの再生の準備を行います。\n" +"\n" +"\n" +" alsasound スクリプトを実行し、その後 amixer で\n" +" デフォルトの音量に設定します。\n" +" 後で、alsamixer や gamix などのミキサープログラム\n" +" を用いて、音量を変更することが可能です。\n" +" " + +#: ../alsaconf.in:518 ../alsaconf.in:523 ../alsaconf.in:528 ../alsaconf.in:533 +msgid "Can't create temp file, exiting..." +msgstr "一時ファイルを作成できませんでした。中止します..." + +#: ../alsaconf.in:643 +msgid "Building card database.." +msgstr "カードデータベースを作成中..." + +#: ../alsaconf.in:647 +msgid "No card database is found.." +msgstr "カードが見つかりませんでした..." + +#: ../alsaconf.in:652 +msgid "Searching sound cards" +msgstr "サウンドカードを検索中" + +#: ../alsaconf.in:806 +msgid "" +"\n" +"Configuring %s\n" +"Do you want to modify %s (and %s if present)?" +msgstr "" +"\n" +"%s を設定します\n" +"%s (および %s) を変更しますか?" + +#: ../alsaconf.in:811 +msgid "" +"\n" +"Configuring %s\n" +"Do you want to modify %s?" +msgstr "" +"\n" +"%s を設定します\n" +"%s を変更しますか?" + +#: ../alsaconf.in:900 +msgid "Running modules-update..." +msgstr "modules-update を実行中..." + +#: ../alsaconf.in:903 +msgid "Running update-modules..." +msgstr "update-modules を実行中..." + +#: ../alsaconf.in:915 +msgid "" +"\n" +" The mixer is set up now for for playing.\n" +" Shall I try to play a sound sample now?\n" +"\n" +" NOTE:\n" +"If you have a big amplifier, lower your volumes or say no.\n" +" Otherwise check that your speaker volume is open,\n" +" and look if you can hear test sound.\n" +msgstr "" +"\n" +" 音量を再生用に準備し終えました。\n" +" サンプルのサウンドを再生しますか?\n" +"\n" +" 注意:\n" +" 大容量アンプの場合は、音量を下げておくか、ここで「いいえ」\n" +" を選択してください。スピーカーの音量をチェックして、\n" +" テスト音が聞こえるかどうか確認してください。\n" + +#: ../alsaconf.in:932 +msgid "Saving the mixer setup used for this in /etc/asound.state." +msgstr "ミキサーの設定を /etc/asound.state に保存します" + +#: ../alsaconf.in:936 +msgid "" +"\n" +"===============================================================================\n" +"\n" +" Now ALSA is ready to use.\n" +" For adjustment of volumes, use your favorite mixer.\n" +"\n" +" Have a lot of fun!\n" +"\n" +msgstr "" +"\n" +"===============================================================================\n" +"\n" +" これで ALSA が使用可能になりました。\n" +" 音量の調整には、ミキサープログラムをご使用下さい。\n" +"\n" + +#: ../alsaconf.in:1244 +msgid "WARNING" +msgstr "注意" + +#: ../alsaconf.in:1245 +msgid "" +"\n" +" Probing legacy ISA cards might make\n" +" your system unstable.\n" +"\n" +" Do you want to proceed?\n" +"\n" +msgstr "" +"\n" +" 旧式の ISA カードの検索を行うと\n" +" システムが不安定になる場合があります。\n" +"\n" +" このまま続けますか?\n" +"\n" + +#: ../alsaconf.in:1268 +msgid "" +"No legacy drivers are available\n" +" for your machine" +msgstr "" +"旧式の ISA カードは\n" +"検出されませんでした" + +#: ../alsaconf.in:1273 +msgid "Driver Selection" +msgstr "ドライバの選択" + +#: ../alsaconf.in:1274 +msgid "" +" Probing legacy ISA cards\n" +"\n" +" Please select the drivers to probe:" +msgstr "" +" 旧式の ISA カードの検出\n" +"\n" +" 検出するドライバを選択してください:" + +#: ../alsaconf.in:1281 +msgid "" +"\n" +" Shall I try all possible DMA and IRQ combinations?\n" +" With this option, some unconventional configuration\n" +" might be found, but it will take much longer time." +msgstr "" +"\n" +" 可能な DMA と IRQ の全ての組合せを試みますか?\n" +" このオプションでは、まれな設定も検出されることが\n" +" 可能ですが、より長い時間がかかります。" + +#: ../alsaconf.in:1291 +msgid "Probing legacy cards.. This may take a few minutes.." +msgstr "旧式カードの検出中... 長時間がかかることがあります..." + +#: ../alsaconf.in:1292 +msgid "Probing: " +msgstr "検出中: " + +#: ../alsaconf.in:1298 +msgid " : FOUND!!" +msgstr " : 発見!!" + +#: ../alsaconf.in:1304 +msgid "Result" +msgstr "結果" + +#: ../alsaconf.in:1305 +msgid "No legacy cards found" +msgstr "旧式カードが見つかりませんでした" + +#: ../alsaconf.in:1364 +msgid "" +"\n" +" Looks like you having a Thinkpad 600E or 770 notebook.\n" +" On this notebook, CS4236 driver should be used\n" +" although CS46xx chip is detected.\n" +"\n" +" Shall I try to snd-cs4236 driver and probe\n" +" the legacy ISA configuration?" +msgstr "" +"\n" +" Thinkpad 600E または 770 をご使用のようです。\n" +" このマシンでは、CS46xx チップが検出されますが\n" +" CS4236 ドライバを用いる必要があります。\n" +"\n" +" snd-cs4236 ドライバを試用して、旧式の ISA 設定\n" +" の検出を行いますか?" + +#: ../alsaconf.in:1378 +msgid "" +"\n" +" Looks like you having a Dell Dimension machine.\n" +" On this machine, CS4232 driver should be used\n" +" although CS46xx chip is detected.\n" +"\n" +" Shall I try to snd-cs4232 driver and probe\n" +" the legacy ISA configuration?" +msgstr "" +"\n" +" Dell Dimension マシンをご使用のようです。\n" +" このマシンでは、CS46xx チップが検出されますが\n" +" CS4232 ドライバを用いる必要があります。\n" +"\n" +" snd-cs4232 ドライバを試用して、旧式の ISA 設定\n" +" の検出を行いますか?" + +#: ../alsaconf.in:1395 +msgid "Soundcard Selection" +msgstr "サウンドカードの選択" + +#: ../alsaconf.in:1396 +msgid "" +"\n" +" Following card(s) are found on your system.\n" +" Choose a soundcard to configure:\n" +msgstr "" +"\n" +" 以下のカードがシステムから検出されました。\n" +" 設定するカードを選択してください:\n" + +#: ../alsaconf.in:1409 +msgid "" +"\n" +" No supported PnP or PCI card found.\n" +"\n" +" Would you like to probe legacy ISA sound cards/chips?\n" +"\n" +msgstr "" +"\n" +" PnP または PCI カードが検出されませんでした。\n" +"\n" +" 旧式の ISA サウンドカードの検出を行いますか?\n" diff --git a/alsaconf/po/ru.po b/alsaconf/po/ru.po new file mode 100644 index 0000000..af4fa0d --- /dev/null +++ b/alsaconf/po/ru.po @@ -0,0 +1,373 @@ +# Russian translations for alsa-utils package +# Английские переводы для пакета alsa-utils. +# Copyright (C) 2005 THE alsa-utils'S COPYRIGHT HOLDER +# This file is distributed under the same license as the alsa-utils package. +# , 2005. +# +msgid "" +msgstr "" +"Project-Id-Version: alsa-utils 1.0.9rc4a\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2005-12-02 12:37+0100\n" +"PO-Revision-Date: 2005-12-02 12:39+0100\n" +"Last-Translator: \n" +"Language-Team: Russian \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%" +"10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);\n" + +#: ../alsaconf.in:36 +msgid "-s" +msgstr "" + +#: ../alsaconf.in:80 +msgid "ALSA configurator" +msgstr "Найстройщик ALSA" + +#: ../alsaconf.in:82 +#, fuzzy +msgid "" +"usage: alsaconf [options]\n" +" -l|--legacy check only legacy non-isapnp cards\n" +" -m|--modinfo read module descriptions instead of reading card db\n" +" -s|--sound wav-file\n" +" use the specified wav file as a test sound\n" +" -u|--uid uid set the uid for the ALSA devices (default = 0) [obsoleted]\n" +" -g|--gid gid set the gid for the ALSA devices (default = 0) [obsoleted]\n" +" -d|--devmode mode\n" +" set the permission for ALSA devices (default = 0666) " +"[obs.]\n" +" -r|--strict set strict device mode (equiv. with -g 17 -d 0660) " +"[obsoleted]\n" +" -L|--log file logging on the specified file (for debugging purpose only)\n" +" -p|--probe card-name\n" +" probe a legacy non-isapnp card and print module options\n" +" -P|--listprobe list the supported legacy card modules\n" +" -c|--config file\n" +" specify the module config file\n" +" -R|--resources list available DMA and IRQ resources with debug for legacy\n" +" -h|--help what you're reading" +msgstr "" +"использование: alsaconf [опции]\n" +" -l|--legacy проверять только не ISAPnP карты\n" +" -m|--modinfo читать описание модулей вместо чтения бызы данных карт\n" +" -s|--sound WAV файл\n" +" использовать указанный WAV файл в качестве тестового\n" +" -u|--uid uid устанавливает uid для ALSA(по умолчанию = 0) [устарело]\n" +" -g|--gid gid устанавливает gid для ALSA(по умолчанию = 0) [устарело]\n" +" -d|--devmode режим\n" +" устанавливает права доступа для ALSA (по умолчанию = 0666) " +"[уст.]\n" +" -r|--strict устанавливает строгие права для ALSA (экв. -g 17 -d 0660) " +"[уст.]\n" +" -L|--log файл записывать события в определенный файл (в целях отладки)\n" +" -p|--probe имя звуковой карты\n" +" проверить обычную не IsaPnP карту и вывести опции модуля\n" +" -P|--listprobe вывести список поддерживаемых не IsaPnP карт\n" +" -c|--config файл\n" +" указывает файл с настройками модуля\n" +" -h|--help вывести это сообщение" + +#: ../alsaconf.in:252 +msgid "You must be root to use this script." +msgstr "Вы должны быть суперпользователем, чтобы использовать этот скрипт." + +#: ../alsaconf.in:294 +msgid "ERROR: The config file doesn't exist: " +msgstr "ОШИБКА: Файл с настройками не существует: " + +#: ../alsaconf.in:336 +msgid "Error, dialog or whiptail not found." +msgstr "Ошибка, dialog или whiptail не найдены." + +#: ../alsaconf.in:342 +msgid "Error, awk not found. Can't continue." +msgstr "Ошибка, awk не найден. Не могу продолжить работу." + +#: ../alsaconf.in:439 +msgid "" +"\n" +" ALSA CONFIGURATOR\n" +" version %s\n" +"\n" +" This script is a configurator for\n" +" Advanced Linux Sound Architecture (ALSA) driver.\n" +"\n" +"\n" +" If ALSA is already running, you should close all sound\n" +" apps now and stop the sound driver.\n" +" alsaconf will try to do this, but it's not 100%% sure." +msgstr "" +"\n" +" Настройщик ALSA\n" +" версия %s\n" +"\n" +" Этот скрипт настраивает Advanced Linux Sound Architecture\n" +"\n" +"\n" +" Если какие-нибудь приложения входящие в пакет ALSA уже запущены,\n" +" вы должны закрыть все приложения работающие со звуком\n" +" и остановаить звуковой драйвер.\n" +" alsaconf попытается это сделать, но результат не гарантируется на все 100%" +"%." + +#: ../alsaconf.in:455 +msgid "" +"\n" +"\n" +" OK, sound driver is configured.\n" +"\n" +" ALSA CONFIGURATOR\n" +"\n" +" will prepare the card for playing now.\n" +"\n" +" Now I'll run alsasound init script, then I'll use\n" +" amixer to raise the default volumes.\n" +" You can change the volume later via a mixer\n" +" program such as alsamixer or gamix.\n" +" \n" +" " +msgstr "" +"\n" +"\n" +" Хорошо, драйвер звуковой карты настроен.\n" +"\n" +" Сейчас Настройщик ALSA\n" +"\n" +" подготовит звуковую карту для проигрования.\n" +"\n" +" Сейчас я запущу скрипт, инициализирующий alsasound, потом использую " +"amixer\n" +" для увеличения уровня громкости по умолчания.\n" +" Вы можете изменить уровень громкости по умолчания позже\n" +" с помощью таких программ как alsamixer или gamix.\n" +" " + +#: ../alsaconf.in:518 ../alsaconf.in:523 ../alsaconf.in:528 ../alsaconf.in:533 +msgid "Can't create temp file, exiting..." +msgstr "Не могу создать временный файл, прекращаю работу..." + +#: ../alsaconf.in:643 +msgid "Building card database.." +msgstr "Создаю базу данных с информацией о звуковых карточках.." + +#: ../alsaconf.in:647 +msgid "No card database is found.." +msgstr "База данных, содержащая информацию о звуковых карточках, не найдена.." + +#: ../alsaconf.in:652 +msgid "Searching sound cards" +msgstr "Ищем звуковые карточки" + +#: ../alsaconf.in:806 +msgid "" +"\n" +"Configuring %s\n" +"Do you want to modify %s (and %s if present)?" +msgstr "" +"\n" +"Настраиваем %s\n" +"Вы хотите изменить %s (и %s, если существует)?" + +#: ../alsaconf.in:811 +msgid "" +"\n" +"Configuring %s\n" +"Do you want to modify %s?" +msgstr "" +"\n" +"Настраиваем %s\n" +"Вы хотите изменить %s?" + +#: ../alsaconf.in:900 +msgid "Running modules-update..." +msgstr "Запускаем modules-update..." + +#: ../alsaconf.in:903 +msgid "Running update-modules..." +msgstr "Запускаем update-modules..." + +#: ../alsaconf.in:915 +msgid "" +"\n" +" The mixer is set up now for for playing.\n" +" Shall I try to play a sound sample now?\n" +"\n" +" NOTE:\n" +"If you have a big amplifier, lower your volumes or say no.\n" +" Otherwise check that your speaker volume is open,\n" +" and look if you can hear test sound.\n" +msgstr "" +"\n" +" Микшер настроен для проигровования.\n" +" Проиграть тестовый пример?\n" +"\n" +" Примечание:\n" +" Если у вас большой усилитель, уменьшите уровень громкости или скажите " +"нет.\n" +" В противном случае проверьте, что ваши колонки включены,\n" +" и удостоверьтесь что вы слышите тестовый пример.\n" + +#: ../alsaconf.in:932 +msgid "Saving the mixer setup used for this in /etc/asound.state." +msgstr "Сохраняем настройки микшера в /etc/asound.state." + +#: ../alsaconf.in:936 +msgid "" +"\n" +"===============================================================================\n" +"\n" +" Now ALSA is ready to use.\n" +" For adjustment of volumes, use your favorite mixer.\n" +"\n" +" Have a lot of fun!\n" +"\n" +msgstr "" +"\n" +"===============================================================================\n" +"\n" +" Теперь ALSA готова к использованию.\n" +" Для регулировки уровня громкости, используйте ваш любимый микшер.\n" +"\n" +" Оторвись по полной!\n" +"\n" + +#: ../alsaconf.in:1244 +msgid "WARNING" +msgstr "ПРЕДУПРЕЖДЕНИЕ" + +#: ../alsaconf.in:1245 +msgid "" +"\n" +" Probing legacy ISA cards might make\n" +" your system unstable.\n" +"\n" +" Do you want to proceed?\n" +"\n" +msgstr "" +"\n" +" Поиск ISA звуковых карточек может сделать\n" +" вашу систему нестабильной.\n" +"\n" +" Вы уверены?\n" +"\n" + +#: ../alsaconf.in:1268 +msgid "" +"No legacy drivers are available\n" +" for your machine" +msgstr "" +"Нету подходяшего драйвера для\n" +" вашей машины" + +#: ../alsaconf.in:1273 +msgid "Driver Selection" +msgstr "Выбор Драйвера" + +#: ../alsaconf.in:1274 +msgid "" +" Probing legacy ISA cards\n" +"\n" +" Please select the drivers to probe:" +msgstr "" +" Поиск ISA звуковых карт\n" +"\n" +" Пожалуйста, выберите драйверы для проверки:" + +#: ../alsaconf.in:1281 +msgid "" +"\n" +" Shall I try all possible DMA and IRQ combinations?\n" +" With this option, some unconventional configuration\n" +" might be found, but it will take much longer time." +msgstr "" +"\n" +" Попробовать все доступные DMA и IRQ комбинации?\n" +" С этой опцией, могут быть найдены некоторые нестандартные\n" +" конфигураии, но это займет намного больше времени." + +#: ../alsaconf.in:1291 +msgid "Probing legacy cards.. This may take a few minutes.." +msgstr "Поиск звуковых карточек.. Это может занять несколько минут.." + +#: ../alsaconf.in:1292 +msgid "Probing: " +msgstr "Проверка: " + +#: ../alsaconf.in:1298 +msgid " : FOUND!!" +msgstr " : НАШЕЛ!!" + +#: ../alsaconf.in:1304 +msgid "Result" +msgstr "Результат" + +#: ../alsaconf.in:1305 +msgid "No legacy cards found" +msgstr "Звуковых карточек не найдено" + +#: ../alsaconf.in:1364 +msgid "" +"\n" +" Looks like you having a Thinkpad 600E or 770 notebook.\n" +" On this notebook, CS4236 driver should be used\n" +" although CS46xx chip is detected.\n" +"\n" +" Shall I try to snd-cs4236 driver and probe\n" +" the legacy ISA configuration?" +msgstr "" +"\n" +" Кажется, мы имеем дело с ноутбуком Thinkpad 600E или 770.\n" +" На этом ноутбуке, драйвер CS4236 должен использоваться\n" +" хотя определяется CS46xx\n" +"\n" +" Использовать snd-cs4236 и проверить правильность ISA\n" +" конфигурации?" + +#: ../alsaconf.in:1378 +msgid "" +"\n" +" Looks like you having a Dell Dimension machine.\n" +" On this machine, CS4232 driver should be used\n" +" although CS46xx chip is detected.\n" +"\n" +" Shall I try to snd-cs4232 driver and probe\n" +" the legacy ISA configuration?" +msgstr "" +"\n" +" Похоже что вы имеем дело с машиной Dell Dimension.\n" +" На этой машине CS4232 драйвер должен исползьовать, チップが検出されますが\n" +" хотя чип звуковой карты определяется как CS46xx.\n" +"\n" +" Использовать snd-cs4232 и проверить ISA валидность\n" +" этой конфигурации?" + +#: ../alsaconf.in:1395 +msgid "Soundcard Selection" +msgstr "Выбор Звуковой карты" + +#: ../alsaconf.in:1396 +msgid "" +"\n" +" Following card(s) are found on your system.\n" +" Choose a soundcard to configure:\n" +msgstr "" +"\n" +" Следущее звуковая(ые) карта(ы) найдены в вашей системе.\n" +" Выберите звуковую карту для настройки:\n" + +#: ../alsaconf.in:1409 +msgid "" +"\n" +" No supported PnP or PCI card found.\n" +"\n" +" Would you like to probe legacy ISA sound cards/chips?\n" +"\n" +msgstr "" +"\n" +" Найдена не поддерживаемая PnP или PCI карта.\n" +"\n" +" Желаете проверить ISA звуковые карты/чипы?\n" +"\n" diff --git a/alsactl/90-alsa-restore.rules.in b/alsactl/90-alsa-restore.rules.in new file mode 100644 index 0000000..c0c1b23 --- /dev/null +++ b/alsactl/90-alsa-restore.rules.in @@ -0,0 +1,8 @@ +ACTION=="add", SUBSYSTEM=="sound", KERNEL=="controlC*", KERNELS!="card*", TEST=="@sbindir@", TEST=="@mydatadir@", GOTO="alsa_restore_go" +GOTO="alsa_restore_end" + +LABEL="alsa_restore_go" +TEST!="@daemonswitch@", RUN+="@sbindir@/alsactl restore $attr{device/number}" +TEST=="@daemonswitch@", RUN+="@sbindir@/alsactl nrestore $attr{device/number}" + +LABEL="alsa_restore_end" diff --git a/alsactl/Makefile.am b/alsactl/Makefile.am new file mode 100644 index 0000000..c1031ac --- /dev/null +++ b/alsactl/Makefile.am @@ -0,0 +1,69 @@ +SUBDIRS = init + +sbin_PROGRAMS=alsactl +man_MANS=alsactl.1 +if USE_XMLTO +man_MANS += alsactl_init.7 +endif +EXTRA_DIST=alsactl.1 alsactl_init.xml + +AM_CFLAGS = -D_GNU_SOURCE + +alsactl_SOURCES=alsactl.c state.c lock.c utils.c init_parse.c init_ucm.c \ + daemon.c monitor.c + +alsactl_CFLAGS=$(AM_CFLAGS) -D__USE_GNU \ + -DSYS_ASOUNDRC=\"$(ASOUND_STATE_DIR)/asound.state\" \ + -DSYS_LOCKFILE=\"$(ASOUND_LOCK_DIR)/asound.state.lock\" \ + -DSYS_PIDFILE=\"$(ALSACTL_PIDFILE_DIR)/alsactl.pid\" + +noinst_HEADERS=alsactl.h list.h init_sysdeps.c init_utils_string.c \ + init_utils_run.c init_sysfs.c + +udevrules_DATA = \ + 90-alsa-restore.rules + +if HAVE_SYSTEMD + +systemdsystemunit_DATA = \ + alsa-state.service \ + alsa-restore.service + +install-data-hook: + $(MKDIR_P) -m 0755 \ + $(DESTDIR)$(systemdsystemunitdir)/sound.target.wants + ( cd $(DESTDIR)$(systemdsystemunitdir)/sound.target.wants && \ + rm -f alsa-state.service alsa-restore.service && \ + $(LN_S) ../alsa-state.service alsa-state.service && \ + $(LN_S) ../alsa-restore.service alsa-restore.service) + +endif + +edit = \ + $(SED) -r -e 's,@sbindir\@,$(sbindir),g' \ + -e 's,@mydatadir\@,$(mydatadir),g' \ + -e 's,@daemonswitch\@,$(ALSACTL_DAEMONSWITCH),g' \ + -e 's,@asoundrcfile\@,$(ASOUND_STATE_DIR)/asound.state,g' \ + < $< > $@ || rm $@ + +alsa-state.service: alsa-state.service.in + $(edit) + +alsa-restore.service: alsa-restore.service.in + $(edit) + +90-alsa-restore.rules: 90-alsa-restore.rules.in + $(edit) + +EXTRA_DIST += \ + alsa-state.service.in \ + alsa-restore.service.in \ + 90-alsa-restore.rules.in + +CLEANFILES = \ + alsa-state.service \ + alsa-restore.service \ + 90-alsa-restore.rules + +%.7: %.xml + xmlto man $? diff --git a/alsactl/Makefile.in b/alsactl/Makefile.in new file mode 100644 index 0000000..de97ef1 --- /dev/null +++ b/alsactl/Makefile.in @@ -0,0 +1,1135 @@ +# Makefile.in generated by automake 1.16.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994-2018 Free Software Foundation, Inc. + +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + + + +VPATH = @srcdir@ +am__is_gnu_make = { \ + if test -z '$(MAKELEVEL)'; then \ + false; \ + elif test -n '$(MAKE_HOST)'; then \ + true; \ + elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ + true; \ + else \ + false; \ + fi; \ +} +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + esac; \ + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +sbin_PROGRAMS = alsactl$(EXEEXT) +@USE_XMLTO_TRUE@am__append_1 = alsactl_init.7 +subdir = alsactl +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/gettext.m4 \ + $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/lib-ld.m4 \ + $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ + $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \ + $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/acinclude.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +DIST_COMMON = $(srcdir)/Makefile.am $(noinst_HEADERS) \ + $(am__DIST_COMMON) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/include/aconfig.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +am__installdirs = "$(DESTDIR)$(sbindir)" "$(DESTDIR)$(man1dir)" \ + "$(DESTDIR)$(man7dir)" "$(DESTDIR)$(systemdsystemunitdir)" \ + "$(DESTDIR)$(udevrulesdir)" +PROGRAMS = $(sbin_PROGRAMS) +am_alsactl_OBJECTS = alsactl-alsactl.$(OBJEXT) alsactl-state.$(OBJEXT) \ + alsactl-lock.$(OBJEXT) alsactl-utils.$(OBJEXT) \ + alsactl-init_parse.$(OBJEXT) alsactl-init_ucm.$(OBJEXT) \ + alsactl-daemon.$(OBJEXT) alsactl-monitor.$(OBJEXT) +alsactl_OBJECTS = $(am_alsactl_OBJECTS) +alsactl_LDADD = $(LDADD) +alsactl_LINK = $(CCLD) $(alsactl_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ + $(LDFLAGS) -o $@ +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__maybe_remake_depfiles = depfiles +am__depfiles_remade = ./$(DEPDIR)/alsactl-alsactl.Po \ + ./$(DEPDIR)/alsactl-daemon.Po \ + ./$(DEPDIR)/alsactl-init_parse.Po \ + ./$(DEPDIR)/alsactl-init_ucm.Po ./$(DEPDIR)/alsactl-lock.Po \ + ./$(DEPDIR)/alsactl-monitor.Po ./$(DEPDIR)/alsactl-state.Po \ + ./$(DEPDIR)/alsactl-utils.Po +am__mv = mv -f +AM_V_lt = $(am__v_lt_@AM_V@) +am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) +am__v_lt_0 = --silent +am__v_lt_1 = +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +AM_V_CC = $(am__v_CC_@AM_V@) +am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) +am__v_CC_0 = @echo " CC " $@; +am__v_CC_1 = +CCLD = $(CC) +LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_CCLD = $(am__v_CCLD_@AM_V@) +am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) +am__v_CCLD_0 = @echo " CCLD " $@; +am__v_CCLD_1 = +SOURCES = $(alsactl_SOURCES) +DIST_SOURCES = $(alsactl_SOURCES) +RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \ + ctags-recursive dvi-recursive html-recursive info-recursive \ + install-data-recursive install-dvi-recursive \ + install-exec-recursive install-html-recursive \ + install-info-recursive install-pdf-recursive \ + install-ps-recursive install-recursive installcheck-recursive \ + installdirs-recursive pdf-recursive ps-recursive \ + tags-recursive uninstall-recursive +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; +am__vpath_adj = case $$p in \ + $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ + *) f=$$p;; \ + esac; +am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; +am__install_max = 40 +am__nobase_strip_setup = \ + srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` +am__nobase_strip = \ + for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" +am__nobase_list = $(am__nobase_strip_setup); \ + for p in $$list; do echo "$$p $$p"; done | \ + sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ + $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ + if (++n[$$2] == $(am__install_max)) \ + { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ + END { for (dir in files) print dir, files[dir] }' +am__base_list = \ + sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ + sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' +am__uninstall_files_from_dir = { \ + test -z "$$files" \ + || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ + || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ + $(am__cd) "$$dir" && rm -f $$files; }; \ + } +man1dir = $(mandir)/man1 +man7dir = $(mandir)/man7 +NROFF = nroff +MANS = $(man_MANS) +DATA = $(systemdsystemunit_DATA) $(udevrules_DATA) +HEADERS = $(noinst_HEADERS) +RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ + distclean-recursive maintainer-clean-recursive +am__recursive_targets = \ + $(RECURSIVE_TARGETS) \ + $(RECURSIVE_CLEAN_TARGETS) \ + $(am__extra_recursive_targets) +AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \ + distdir distdir-am +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) +# Read a list of newline-separated strings from the standard input, +# and print each of them once, without duplicates. Input order is +# *not* preserved. +am__uniquify_input = $(AWK) '\ + BEGIN { nonempty = 0; } \ + { items[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in items) print i; }; } \ +' +# Make sure the list of sources is unique. This is necessary because, +# e.g., the same source file might be shared among _SOURCES variables +# for different programs/libraries. +am__define_uniq_tagged_files = \ + list='$(am__tagged_files)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | $(am__uniquify_input)` +ETAGS = etags +CTAGS = ctags +DIST_SUBDIRS = $(SUBDIRS) +am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/depcomp +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +am__relativize = \ + dir0=`pwd`; \ + sed_first='s,^\([^/]*\)/.*$$,\1,'; \ + sed_rest='s,^[^/]*/*,,'; \ + sed_last='s,^.*/\([^/]*\)$$,\1,'; \ + sed_butlast='s,/*[^/]*$$,,'; \ + while test -n "$$dir1"; do \ + first=`echo "$$dir1" | sed -e "$$sed_first"`; \ + if test "$$first" != "."; then \ + if test "$$first" = ".."; then \ + dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \ + dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \ + else \ + first2=`echo "$$dir2" | sed -e "$$sed_first"`; \ + if test "$$first2" = "$$first"; then \ + dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \ + else \ + dir2="../$$dir2"; \ + fi; \ + dir0="$$dir0"/"$$first"; \ + fi; \ + fi; \ + dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \ + done; \ + reldir="$$dir2" +ACLOCAL = @ACLOCAL@ +ALSACTL_DAEMONSWITCH = @ALSACTL_DAEMONSWITCH@ +ALSACTL_PIDFILE_DIR = @ALSACTL_PIDFILE_DIR@ +ALSA_CFLAGS = @ALSA_CFLAGS@ +ALSA_LIBS = @ALSA_LIBS@ +ALSA_TOPOLOGY_LIBS = @ALSA_TOPOLOGY_LIBS@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +ASOUND_LOCK_DIR = @ASOUND_LOCK_DIR@ +ASOUND_STATE_DIR = @ASOUND_STATE_DIR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CURSESINC = @CURSESINC@ +CURSESLIB = @CURSESLIB@ +CURSES_CFLAGS = @CURSES_CFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +FFTW_CFLAGS = @FFTW_CFLAGS@ +FFTW_INC = @FFTW_INC@ +FFTW_LIB = @FFTW_LIB@ +GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ +GMSGFMT = @GMSGFMT@ +GMSGFMT_015 = @GMSGFMT_015@ +GREP = @GREP@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +INTLLIBS = @INTLLIBS@ +INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@ +LDFLAGS = @LDFLAGS@ +LIBICONV = @LIBICONV@ +LIBINTL = @LIBINTL@ +LIBOBJS = @LIBOBJS@ +LIBRT = @LIBRT@ +LIBS = @LIBS@ +LN_S = @LN_S@ +LTLIBICONV = @LTLIBICONV@ +LTLIBINTL = @LTLIBINTL@ +LTLIBOBJS = @LTLIBOBJS@ +MAINT = @MAINT@ +MAKEINFO = @MAKEINFO@ +MKDIR_P = @MKDIR_P@ +MSGFMT = @MSGFMT@ +MSGFMT_015 = @MSGFMT_015@ +MSGMERGE = @MSGMERGE@ +NCURSESW_CFLAGS = @NCURSESW_CFLAGS@ +NCURSESW_LIBS = @NCURSESW_LIBS@ +NCURSES_CFLAGS = @NCURSES_CFLAGS@ +NCURSES_LIBS = @NCURSES_LIBS@ +OBJEXT = @OBJEXT@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ +POSUB = @POSUB@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +SND_UTIL_MAJOR = @SND_UTIL_MAJOR@ +SND_UTIL_MINOR = @SND_UTIL_MINOR@ +SND_UTIL_SUBMINOR = @SND_UTIL_SUBMINOR@ +SND_UTIL_VERSION = @SND_UTIL_VERSION@ +STRIP = @STRIP@ +SYSTEMD_CFLAGS = @SYSTEMD_CFLAGS@ +SYSTEMD_LIBS = @SYSTEMD_LIBS@ +TESTSOUND = @TESTSOUND@ +USE_NLS = @USE_NLS@ +VERSION = @VERSION@ +XGETTEXT = @XGETTEXT@ +XGETTEXT_015 = @XGETTEXT_015@ +XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_CC = @ac_ct_CC@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +mydatadir = @mydatadir@ +ncurses5_config = @ncurses5_config@ +ncursesw5_config = @ncursesw5_config@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +rst2man_available = @rst2man_available@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +systemdsystemunitdir = @systemdsystemunitdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +udevrulesdir = @udevrulesdir@ +xmlto_available = @xmlto_available@ +SUBDIRS = init +man_MANS = alsactl.1 $(am__append_1) +EXTRA_DIST = alsactl.1 alsactl_init.xml alsa-state.service.in \ + alsa-restore.service.in 90-alsa-restore.rules.in +AM_CFLAGS = -D_GNU_SOURCE +alsactl_SOURCES = alsactl.c state.c lock.c utils.c init_parse.c init_ucm.c \ + daemon.c monitor.c + +alsactl_CFLAGS = $(AM_CFLAGS) -D__USE_GNU \ + -DSYS_ASOUNDRC=\"$(ASOUND_STATE_DIR)/asound.state\" \ + -DSYS_LOCKFILE=\"$(ASOUND_LOCK_DIR)/asound.state.lock\" \ + -DSYS_PIDFILE=\"$(ALSACTL_PIDFILE_DIR)/alsactl.pid\" + +noinst_HEADERS = alsactl.h list.h init_sysdeps.c init_utils_string.c \ + init_utils_run.c init_sysfs.c + +udevrules_DATA = \ + 90-alsa-restore.rules + +@HAVE_SYSTEMD_TRUE@systemdsystemunit_DATA = \ +@HAVE_SYSTEMD_TRUE@ alsa-state.service \ +@HAVE_SYSTEMD_TRUE@ alsa-restore.service + +edit = \ + $(SED) -r -e 's,@sbindir\@,$(sbindir),g' \ + -e 's,@mydatadir\@,$(mydatadir),g' \ + -e 's,@daemonswitch\@,$(ALSACTL_DAEMONSWITCH),g' \ + -e 's,@asoundrcfile\@,$(ASOUND_STATE_DIR)/asound.state,g' \ + < $< > $@ || rm $@ + +CLEANFILES = \ + alsa-state.service \ + alsa-restore.service \ + 90-alsa-restore.rules + +all: all-recursive + +.SUFFIXES: +.SUFFIXES: .c .o .obj +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign alsactl/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --foreign alsactl/Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): +install-sbinPROGRAMS: $(sbin_PROGRAMS) + @$(NORMAL_INSTALL) + @list='$(sbin_PROGRAMS)'; test -n "$(sbindir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(sbindir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(sbindir)" || exit 1; \ + fi; \ + for p in $$list; do echo "$$p $$p"; done | \ + sed 's/$(EXEEXT)$$//' | \ + while read p p1; do if test -f $$p \ + ; then echo "$$p"; echo "$$p"; else :; fi; \ + done | \ + sed -e 'p;s,.*/,,;n;h' \ + -e 's|.*|.|' \ + -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \ + sed 'N;N;N;s,\n, ,g' | \ + $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \ + { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \ + if ($$2 == $$4) files[d] = files[d] " " $$1; \ + else { print "f", $$3 "/" $$4, $$1; } } \ + END { for (d in files) print "f", d, files[d] }' | \ + while read type dir files; do \ + if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \ + test -z "$$files" || { \ + echo " $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(sbindir)$$dir'"; \ + $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(sbindir)$$dir" || exit $$?; \ + } \ + ; done + +uninstall-sbinPROGRAMS: + @$(NORMAL_UNINSTALL) + @list='$(sbin_PROGRAMS)'; test -n "$(sbindir)" || list=; \ + files=`for p in $$list; do echo "$$p"; done | \ + sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \ + -e 's/$$/$(EXEEXT)/' \ + `; \ + test -n "$$list" || exit 0; \ + echo " ( cd '$(DESTDIR)$(sbindir)' && rm -f" $$files ")"; \ + cd "$(DESTDIR)$(sbindir)" && rm -f $$files + +clean-sbinPROGRAMS: + -test -z "$(sbin_PROGRAMS)" || rm -f $(sbin_PROGRAMS) + +alsactl$(EXEEXT): $(alsactl_OBJECTS) $(alsactl_DEPENDENCIES) $(EXTRA_alsactl_DEPENDENCIES) + @rm -f alsactl$(EXEEXT) + $(AM_V_CCLD)$(alsactl_LINK) $(alsactl_OBJECTS) $(alsactl_LDADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/alsactl-alsactl.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/alsactl-daemon.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/alsactl-init_parse.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/alsactl-init_ucm.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/alsactl-lock.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/alsactl-monitor.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/alsactl-state.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/alsactl-utils.Po@am__quote@ # am--include-marker + +$(am__depfiles_remade): + @$(MKDIR_P) $(@D) + @echo '# dummy' >$@-t && $(am__mv) $@-t $@ + +am--depfiles: $(am__depfiles_remade) + +.c.o: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< + +.c.obj: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` + +alsactl-alsactl.o: alsactl.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(alsactl_CFLAGS) $(CFLAGS) -MT alsactl-alsactl.o -MD -MP -MF $(DEPDIR)/alsactl-alsactl.Tpo -c -o alsactl-alsactl.o `test -f 'alsactl.c' || echo '$(srcdir)/'`alsactl.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/alsactl-alsactl.Tpo $(DEPDIR)/alsactl-alsactl.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='alsactl.c' object='alsactl-alsactl.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(alsactl_CFLAGS) $(CFLAGS) -c -o alsactl-alsactl.o `test -f 'alsactl.c' || echo '$(srcdir)/'`alsactl.c + +alsactl-alsactl.obj: alsactl.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(alsactl_CFLAGS) $(CFLAGS) -MT alsactl-alsactl.obj -MD -MP -MF $(DEPDIR)/alsactl-alsactl.Tpo -c -o alsactl-alsactl.obj `if test -f 'alsactl.c'; then $(CYGPATH_W) 'alsactl.c'; else $(CYGPATH_W) '$(srcdir)/alsactl.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/alsactl-alsactl.Tpo $(DEPDIR)/alsactl-alsactl.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='alsactl.c' object='alsactl-alsactl.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(alsactl_CFLAGS) $(CFLAGS) -c -o alsactl-alsactl.obj `if test -f 'alsactl.c'; then $(CYGPATH_W) 'alsactl.c'; else $(CYGPATH_W) '$(srcdir)/alsactl.c'; fi` + +alsactl-state.o: state.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(alsactl_CFLAGS) $(CFLAGS) -MT alsactl-state.o -MD -MP -MF $(DEPDIR)/alsactl-state.Tpo -c -o alsactl-state.o `test -f 'state.c' || echo '$(srcdir)/'`state.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/alsactl-state.Tpo $(DEPDIR)/alsactl-state.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='state.c' object='alsactl-state.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(alsactl_CFLAGS) $(CFLAGS) -c -o alsactl-state.o `test -f 'state.c' || echo '$(srcdir)/'`state.c + +alsactl-state.obj: state.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(alsactl_CFLAGS) $(CFLAGS) -MT alsactl-state.obj -MD -MP -MF $(DEPDIR)/alsactl-state.Tpo -c -o alsactl-state.obj `if test -f 'state.c'; then $(CYGPATH_W) 'state.c'; else $(CYGPATH_W) '$(srcdir)/state.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/alsactl-state.Tpo $(DEPDIR)/alsactl-state.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='state.c' object='alsactl-state.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(alsactl_CFLAGS) $(CFLAGS) -c -o alsactl-state.obj `if test -f 'state.c'; then $(CYGPATH_W) 'state.c'; else $(CYGPATH_W) '$(srcdir)/state.c'; fi` + +alsactl-lock.o: lock.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(alsactl_CFLAGS) $(CFLAGS) -MT alsactl-lock.o -MD -MP -MF $(DEPDIR)/alsactl-lock.Tpo -c -o alsactl-lock.o `test -f 'lock.c' || echo '$(srcdir)/'`lock.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/alsactl-lock.Tpo $(DEPDIR)/alsactl-lock.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='lock.c' object='alsactl-lock.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(alsactl_CFLAGS) $(CFLAGS) -c -o alsactl-lock.o `test -f 'lock.c' || echo '$(srcdir)/'`lock.c + +alsactl-lock.obj: lock.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(alsactl_CFLAGS) $(CFLAGS) -MT alsactl-lock.obj -MD -MP -MF $(DEPDIR)/alsactl-lock.Tpo -c -o alsactl-lock.obj `if test -f 'lock.c'; then $(CYGPATH_W) 'lock.c'; else $(CYGPATH_W) '$(srcdir)/lock.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/alsactl-lock.Tpo $(DEPDIR)/alsactl-lock.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='lock.c' object='alsactl-lock.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(alsactl_CFLAGS) $(CFLAGS) -c -o alsactl-lock.obj `if test -f 'lock.c'; then $(CYGPATH_W) 'lock.c'; else $(CYGPATH_W) '$(srcdir)/lock.c'; fi` + +alsactl-utils.o: utils.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(alsactl_CFLAGS) $(CFLAGS) -MT alsactl-utils.o -MD -MP -MF $(DEPDIR)/alsactl-utils.Tpo -c -o alsactl-utils.o `test -f 'utils.c' || echo '$(srcdir)/'`utils.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/alsactl-utils.Tpo $(DEPDIR)/alsactl-utils.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='utils.c' object='alsactl-utils.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(alsactl_CFLAGS) $(CFLAGS) -c -o alsactl-utils.o `test -f 'utils.c' || echo '$(srcdir)/'`utils.c + +alsactl-utils.obj: utils.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(alsactl_CFLAGS) $(CFLAGS) -MT alsactl-utils.obj -MD -MP -MF $(DEPDIR)/alsactl-utils.Tpo -c -o alsactl-utils.obj `if test -f 'utils.c'; then $(CYGPATH_W) 'utils.c'; else $(CYGPATH_W) '$(srcdir)/utils.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/alsactl-utils.Tpo $(DEPDIR)/alsactl-utils.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='utils.c' object='alsactl-utils.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(alsactl_CFLAGS) $(CFLAGS) -c -o alsactl-utils.obj `if test -f 'utils.c'; then $(CYGPATH_W) 'utils.c'; else $(CYGPATH_W) '$(srcdir)/utils.c'; fi` + +alsactl-init_parse.o: init_parse.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(alsactl_CFLAGS) $(CFLAGS) -MT alsactl-init_parse.o -MD -MP -MF $(DEPDIR)/alsactl-init_parse.Tpo -c -o alsactl-init_parse.o `test -f 'init_parse.c' || echo '$(srcdir)/'`init_parse.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/alsactl-init_parse.Tpo $(DEPDIR)/alsactl-init_parse.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='init_parse.c' object='alsactl-init_parse.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(alsactl_CFLAGS) $(CFLAGS) -c -o alsactl-init_parse.o `test -f 'init_parse.c' || echo '$(srcdir)/'`init_parse.c + +alsactl-init_parse.obj: init_parse.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(alsactl_CFLAGS) $(CFLAGS) -MT alsactl-init_parse.obj -MD -MP -MF $(DEPDIR)/alsactl-init_parse.Tpo -c -o alsactl-init_parse.obj `if test -f 'init_parse.c'; then $(CYGPATH_W) 'init_parse.c'; else $(CYGPATH_W) '$(srcdir)/init_parse.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/alsactl-init_parse.Tpo $(DEPDIR)/alsactl-init_parse.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='init_parse.c' object='alsactl-init_parse.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(alsactl_CFLAGS) $(CFLAGS) -c -o alsactl-init_parse.obj `if test -f 'init_parse.c'; then $(CYGPATH_W) 'init_parse.c'; else $(CYGPATH_W) '$(srcdir)/init_parse.c'; fi` + +alsactl-init_ucm.o: init_ucm.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(alsactl_CFLAGS) $(CFLAGS) -MT alsactl-init_ucm.o -MD -MP -MF $(DEPDIR)/alsactl-init_ucm.Tpo -c -o alsactl-init_ucm.o `test -f 'init_ucm.c' || echo '$(srcdir)/'`init_ucm.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/alsactl-init_ucm.Tpo $(DEPDIR)/alsactl-init_ucm.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='init_ucm.c' object='alsactl-init_ucm.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(alsactl_CFLAGS) $(CFLAGS) -c -o alsactl-init_ucm.o `test -f 'init_ucm.c' || echo '$(srcdir)/'`init_ucm.c + +alsactl-init_ucm.obj: init_ucm.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(alsactl_CFLAGS) $(CFLAGS) -MT alsactl-init_ucm.obj -MD -MP -MF $(DEPDIR)/alsactl-init_ucm.Tpo -c -o alsactl-init_ucm.obj `if test -f 'init_ucm.c'; then $(CYGPATH_W) 'init_ucm.c'; else $(CYGPATH_W) '$(srcdir)/init_ucm.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/alsactl-init_ucm.Tpo $(DEPDIR)/alsactl-init_ucm.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='init_ucm.c' object='alsactl-init_ucm.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(alsactl_CFLAGS) $(CFLAGS) -c -o alsactl-init_ucm.obj `if test -f 'init_ucm.c'; then $(CYGPATH_W) 'init_ucm.c'; else $(CYGPATH_W) '$(srcdir)/init_ucm.c'; fi` + +alsactl-daemon.o: daemon.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(alsactl_CFLAGS) $(CFLAGS) -MT alsactl-daemon.o -MD -MP -MF $(DEPDIR)/alsactl-daemon.Tpo -c -o alsactl-daemon.o `test -f 'daemon.c' || echo '$(srcdir)/'`daemon.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/alsactl-daemon.Tpo $(DEPDIR)/alsactl-daemon.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='daemon.c' object='alsactl-daemon.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(alsactl_CFLAGS) $(CFLAGS) -c -o alsactl-daemon.o `test -f 'daemon.c' || echo '$(srcdir)/'`daemon.c + +alsactl-daemon.obj: daemon.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(alsactl_CFLAGS) $(CFLAGS) -MT alsactl-daemon.obj -MD -MP -MF $(DEPDIR)/alsactl-daemon.Tpo -c -o alsactl-daemon.obj `if test -f 'daemon.c'; then $(CYGPATH_W) 'daemon.c'; else $(CYGPATH_W) '$(srcdir)/daemon.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/alsactl-daemon.Tpo $(DEPDIR)/alsactl-daemon.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='daemon.c' object='alsactl-daemon.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(alsactl_CFLAGS) $(CFLAGS) -c -o alsactl-daemon.obj `if test -f 'daemon.c'; then $(CYGPATH_W) 'daemon.c'; else $(CYGPATH_W) '$(srcdir)/daemon.c'; fi` + +alsactl-monitor.o: monitor.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(alsactl_CFLAGS) $(CFLAGS) -MT alsactl-monitor.o -MD -MP -MF $(DEPDIR)/alsactl-monitor.Tpo -c -o alsactl-monitor.o `test -f 'monitor.c' || echo '$(srcdir)/'`monitor.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/alsactl-monitor.Tpo $(DEPDIR)/alsactl-monitor.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='monitor.c' object='alsactl-monitor.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(alsactl_CFLAGS) $(CFLAGS) -c -o alsactl-monitor.o `test -f 'monitor.c' || echo '$(srcdir)/'`monitor.c + +alsactl-monitor.obj: monitor.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(alsactl_CFLAGS) $(CFLAGS) -MT alsactl-monitor.obj -MD -MP -MF $(DEPDIR)/alsactl-monitor.Tpo -c -o alsactl-monitor.obj `if test -f 'monitor.c'; then $(CYGPATH_W) 'monitor.c'; else $(CYGPATH_W) '$(srcdir)/monitor.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/alsactl-monitor.Tpo $(DEPDIR)/alsactl-monitor.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='monitor.c' object='alsactl-monitor.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(alsactl_CFLAGS) $(CFLAGS) -c -o alsactl-monitor.obj `if test -f 'monitor.c'; then $(CYGPATH_W) 'monitor.c'; else $(CYGPATH_W) '$(srcdir)/monitor.c'; fi` +install-man1: $(man_MANS) + @$(NORMAL_INSTALL) + @list1=''; \ + list2='$(man_MANS)'; \ + test -n "$(man1dir)" \ + && test -n "`echo $$list1$$list2`" \ + || exit 0; \ + echo " $(MKDIR_P) '$(DESTDIR)$(man1dir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(man1dir)" || exit 1; \ + { for i in $$list1; do echo "$$i"; done; \ + if test -n "$$list2"; then \ + for i in $$list2; do echo "$$i"; done \ + | sed -n '/\.1[a-z]*$$/p'; \ + fi; \ + } | while read p; do \ + if test -f $$p; then d=; else d="$(srcdir)/"; fi; \ + echo "$$d$$p"; echo "$$p"; \ + done | \ + sed -e 'n;s,.*/,,;p;h;s,.*\.,,;s,^[^1][0-9a-z]*$$,1,;x' \ + -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,' | \ + sed 'N;N;s,\n, ,g' | { \ + list=; while read file base inst; do \ + if test "$$base" = "$$inst"; then list="$$list $$file"; else \ + echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man1dir)/$$inst'"; \ + $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man1dir)/$$inst" || exit $$?; \ + fi; \ + done; \ + for i in $$list; do echo "$$i"; done | $(am__base_list) | \ + while read files; do \ + test -z "$$files" || { \ + echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(man1dir)'"; \ + $(INSTALL_DATA) $$files "$(DESTDIR)$(man1dir)" || exit $$?; }; \ + done; } + +uninstall-man1: + @$(NORMAL_UNINSTALL) + @list=''; test -n "$(man1dir)" || exit 0; \ + files=`{ for i in $$list; do echo "$$i"; done; \ + l2='$(man_MANS)'; for i in $$l2; do echo "$$i"; done | \ + sed -n '/\.1[a-z]*$$/p'; \ + } | sed -e 's,.*/,,;h;s,.*\.,,;s,^[^1][0-9a-z]*$$,1,;x' \ + -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,'`; \ + dir='$(DESTDIR)$(man1dir)'; $(am__uninstall_files_from_dir) +install-man7: $(man_MANS) + @$(NORMAL_INSTALL) + @list1=''; \ + list2='$(man_MANS)'; \ + test -n "$(man7dir)" \ + && test -n "`echo $$list1$$list2`" \ + || exit 0; \ + echo " $(MKDIR_P) '$(DESTDIR)$(man7dir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(man7dir)" || exit 1; \ + { for i in $$list1; do echo "$$i"; done; \ + if test -n "$$list2"; then \ + for i in $$list2; do echo "$$i"; done \ + | sed -n '/\.7[a-z]*$$/p'; \ + fi; \ + } | while read p; do \ + if test -f $$p; then d=; else d="$(srcdir)/"; fi; \ + echo "$$d$$p"; echo "$$p"; \ + done | \ + sed -e 'n;s,.*/,,;p;h;s,.*\.,,;s,^[^7][0-9a-z]*$$,7,;x' \ + -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,' | \ + sed 'N;N;s,\n, ,g' | { \ + list=; while read file base inst; do \ + if test "$$base" = "$$inst"; then list="$$list $$file"; else \ + echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man7dir)/$$inst'"; \ + $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man7dir)/$$inst" || exit $$?; \ + fi; \ + done; \ + for i in $$list; do echo "$$i"; done | $(am__base_list) | \ + while read files; do \ + test -z "$$files" || { \ + echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(man7dir)'"; \ + $(INSTALL_DATA) $$files "$(DESTDIR)$(man7dir)" || exit $$?; }; \ + done; } + +uninstall-man7: + @$(NORMAL_UNINSTALL) + @list=''; test -n "$(man7dir)" || exit 0; \ + files=`{ for i in $$list; do echo "$$i"; done; \ + l2='$(man_MANS)'; for i in $$l2; do echo "$$i"; done | \ + sed -n '/\.7[a-z]*$$/p'; \ + } | sed -e 's,.*/,,;h;s,.*\.,,;s,^[^7][0-9a-z]*$$,7,;x' \ + -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,'`; \ + dir='$(DESTDIR)$(man7dir)'; $(am__uninstall_files_from_dir) +install-systemdsystemunitDATA: $(systemdsystemunit_DATA) + @$(NORMAL_INSTALL) + @list='$(systemdsystemunit_DATA)'; test -n "$(systemdsystemunitdir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(systemdsystemunitdir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(systemdsystemunitdir)" || exit 1; \ + fi; \ + for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + echo "$$d$$p"; \ + done | $(am__base_list) | \ + while read files; do \ + echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(systemdsystemunitdir)'"; \ + $(INSTALL_DATA) $$files "$(DESTDIR)$(systemdsystemunitdir)" || exit $$?; \ + done + +uninstall-systemdsystemunitDATA: + @$(NORMAL_UNINSTALL) + @list='$(systemdsystemunit_DATA)'; test -n "$(systemdsystemunitdir)" || list=; \ + files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ + dir='$(DESTDIR)$(systemdsystemunitdir)'; $(am__uninstall_files_from_dir) +install-udevrulesDATA: $(udevrules_DATA) + @$(NORMAL_INSTALL) + @list='$(udevrules_DATA)'; test -n "$(udevrulesdir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(udevrulesdir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(udevrulesdir)" || exit 1; \ + fi; \ + for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + echo "$$d$$p"; \ + done | $(am__base_list) | \ + while read files; do \ + echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(udevrulesdir)'"; \ + $(INSTALL_DATA) $$files "$(DESTDIR)$(udevrulesdir)" || exit $$?; \ + done + +uninstall-udevrulesDATA: + @$(NORMAL_UNINSTALL) + @list='$(udevrules_DATA)'; test -n "$(udevrulesdir)" || list=; \ + files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ + dir='$(DESTDIR)$(udevrulesdir)'; $(am__uninstall_files_from_dir) + +# This directory's subdirectories are mostly independent; you can cd +# into them and run 'make' without going through this Makefile. +# To change the values of 'make' variables: instead of editing Makefiles, +# (1) if the variable is set in 'config.status', edit 'config.status' +# (which will cause the Makefiles to be regenerated when you run 'make'); +# (2) otherwise, pass the desired values on the 'make' command line. +$(am__recursive_targets): + @fail=; \ + if $(am__make_keepgoing); then \ + failcom='fail=yes'; \ + else \ + failcom='exit 1'; \ + fi; \ + dot_seen=no; \ + target=`echo $@ | sed s/-recursive//`; \ + case "$@" in \ + distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ + *) list='$(SUBDIRS)' ;; \ + esac; \ + for subdir in $$list; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + dot_seen=yes; \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || eval $$failcom; \ + done; \ + if test "$$dot_seen" = "no"; then \ + $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ + fi; test -z "$$fail" + +ID: $(am__tagged_files) + $(am__define_uniq_tagged_files); mkid -fID $$unique +tags: tags-recursive +TAGS: tags + +tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + set x; \ + here=`pwd`; \ + if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ + include_option=--etags-include; \ + empty_fix=.; \ + else \ + include_option=--include; \ + empty_fix=; \ + fi; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test ! -f $$subdir/TAGS || \ + set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \ + fi; \ + done; \ + $(am__define_uniq_tagged_files); \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: ctags-recursive + +CTAGS: ctags +ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + $(am__define_uniq_tagged_files); \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" +cscopelist: cscopelist-recursive + +cscopelist-am: $(am__tagged_files) + list='$(am__tagged_files)'; \ + case "$(srcdir)" in \ + [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ + *) sdir=$(subdir)/$(srcdir) ;; \ + esac; \ + for i in $$list; do \ + if test -f "$$i"; then \ + echo "$(subdir)/$$i"; \ + else \ + echo "$$sdir/$$i"; \ + fi; \ + done >> $(top_builddir)/cscope.files + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) distdir-am + +distdir-am: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done + @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + $(am__make_dryrun) \ + || test -d "$(distdir)/$$subdir" \ + || $(MKDIR_P) "$(distdir)/$$subdir" \ + || exit 1; \ + dir1=$$subdir; dir2="$(distdir)/$$subdir"; \ + $(am__relativize); \ + new_distdir=$$reldir; \ + dir1=$$subdir; dir2="$(top_distdir)"; \ + $(am__relativize); \ + new_top_distdir=$$reldir; \ + echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \ + echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \ + ($(am__cd) $$subdir && \ + $(MAKE) $(AM_MAKEFLAGS) \ + top_distdir="$$new_top_distdir" \ + distdir="$$new_distdir" \ + am__remove_distdir=: \ + am__skip_length_check=: \ + am__skip_mode_fix=: \ + distdir) \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-recursive +all-am: Makefile $(PROGRAMS) $(MANS) $(DATA) $(HEADERS) +installdirs: installdirs-recursive +installdirs-am: + for dir in "$(DESTDIR)$(sbindir)" "$(DESTDIR)$(man1dir)" "$(DESTDIR)$(man7dir)" "$(DESTDIR)$(systemdsystemunitdir)" "$(DESTDIR)$(udevrulesdir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ + done +install: install-recursive +install-exec: install-exec-recursive +install-data: install-data-recursive +uninstall: uninstall-recursive + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-recursive +install-strip: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + +clean-generic: + -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +@HAVE_SYSTEMD_FALSE@install-data-hook: +clean: clean-recursive + +clean-am: clean-generic clean-sbinPROGRAMS mostlyclean-am + +distclean: distclean-recursive + -rm -f ./$(DEPDIR)/alsactl-alsactl.Po + -rm -f ./$(DEPDIR)/alsactl-daemon.Po + -rm -f ./$(DEPDIR)/alsactl-init_parse.Po + -rm -f ./$(DEPDIR)/alsactl-init_ucm.Po + -rm -f ./$(DEPDIR)/alsactl-lock.Po + -rm -f ./$(DEPDIR)/alsactl-monitor.Po + -rm -f ./$(DEPDIR)/alsactl-state.Po + -rm -f ./$(DEPDIR)/alsactl-utils.Po + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-recursive + +dvi-am: + +html: html-recursive + +html-am: + +info: info-recursive + +info-am: + +install-data-am: install-man install-systemdsystemunitDATA \ + install-udevrulesDATA + @$(NORMAL_INSTALL) + $(MAKE) $(AM_MAKEFLAGS) install-data-hook +install-dvi: install-dvi-recursive + +install-dvi-am: + +install-exec-am: install-sbinPROGRAMS + +install-html: install-html-recursive + +install-html-am: + +install-info: install-info-recursive + +install-info-am: + +install-man: install-man1 install-man7 + +install-pdf: install-pdf-recursive + +install-pdf-am: + +install-ps: install-ps-recursive + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-recursive + -rm -f ./$(DEPDIR)/alsactl-alsactl.Po + -rm -f ./$(DEPDIR)/alsactl-daemon.Po + -rm -f ./$(DEPDIR)/alsactl-init_parse.Po + -rm -f ./$(DEPDIR)/alsactl-init_ucm.Po + -rm -f ./$(DEPDIR)/alsactl-lock.Po + -rm -f ./$(DEPDIR)/alsactl-monitor.Po + -rm -f ./$(DEPDIR)/alsactl-state.Po + -rm -f ./$(DEPDIR)/alsactl-utils.Po + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-recursive + +mostlyclean-am: mostlyclean-compile mostlyclean-generic + +pdf: pdf-recursive + +pdf-am: + +ps: ps-recursive + +ps-am: + +uninstall-am: uninstall-man uninstall-sbinPROGRAMS \ + uninstall-systemdsystemunitDATA uninstall-udevrulesDATA + +uninstall-man: uninstall-man1 uninstall-man7 + +.MAKE: $(am__recursive_targets) install-am install-data-am \ + install-strip + +.PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am \ + am--depfiles check check-am clean clean-generic \ + clean-sbinPROGRAMS cscopelist-am ctags ctags-am distclean \ + distclean-compile distclean-generic distclean-tags distdir dvi \ + dvi-am html html-am info info-am install install-am \ + install-data install-data-am install-data-hook install-dvi \ + install-dvi-am install-exec install-exec-am install-html \ + install-html-am install-info install-info-am install-man \ + install-man1 install-man7 install-pdf install-pdf-am \ + install-ps install-ps-am install-sbinPROGRAMS install-strip \ + install-systemdsystemunitDATA install-udevrulesDATA \ + installcheck installcheck-am installdirs installdirs-am \ + maintainer-clean maintainer-clean-generic mostlyclean \ + mostlyclean-compile mostlyclean-generic pdf pdf-am ps ps-am \ + tags tags-am uninstall uninstall-am uninstall-man \ + uninstall-man1 uninstall-man7 uninstall-sbinPROGRAMS \ + uninstall-systemdsystemunitDATA uninstall-udevrulesDATA + +.PRECIOUS: Makefile + + +@HAVE_SYSTEMD_TRUE@install-data-hook: +@HAVE_SYSTEMD_TRUE@ $(MKDIR_P) -m 0755 \ +@HAVE_SYSTEMD_TRUE@ $(DESTDIR)$(systemdsystemunitdir)/sound.target.wants +@HAVE_SYSTEMD_TRUE@ ( cd $(DESTDIR)$(systemdsystemunitdir)/sound.target.wants && \ +@HAVE_SYSTEMD_TRUE@ rm -f alsa-state.service alsa-restore.service && \ +@HAVE_SYSTEMD_TRUE@ $(LN_S) ../alsa-state.service alsa-state.service && \ +@HAVE_SYSTEMD_TRUE@ $(LN_S) ../alsa-restore.service alsa-restore.service) + +alsa-state.service: alsa-state.service.in + $(edit) + +alsa-restore.service: alsa-restore.service.in + $(edit) + +90-alsa-restore.rules: 90-alsa-restore.rules.in + $(edit) + +%.7: %.xml + xmlto man $? + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/alsactl/alsa-restore.service.in b/alsactl/alsa-restore.service.in new file mode 100644 index 0000000..a84c2e8 --- /dev/null +++ b/alsactl/alsa-restore.service.in @@ -0,0 +1,16 @@ +# +# Note that two different ALSA card state management schemes exist and they +# can be switched using a file exist check - /etc/alsa/state-daemon.conf . +# + +[Unit] +Description=Save/Restore Sound Card State +ConditionPathExists=!@daemonswitch@ +ConditionPathExistsGlob=/dev/snd/control* +ConditionPathExists=@asoundrcfile@ + +[Service] +Type=oneshot +RemainAfterExit=true +ExecStart=-@sbindir@/alsactl restore +ExecStop=-@sbindir@/alsactl store diff --git a/alsactl/alsa-state.service.in b/alsactl/alsa-state.service.in new file mode 100644 index 0000000..5a8fe5e --- /dev/null +++ b/alsactl/alsa-state.service.in @@ -0,0 +1,13 @@ +# +# Note that two different ALSA card state management schemes exist and they +# can be switched using a file exist check - /etc/alsa/state-daemon.conf . +# + +[Unit] +Description=Manage Sound Card State (restore and store) +ConditionPathExists=@daemonswitch@ + +[Service] +Type=simple +ExecStart=-@sbindir@/alsactl -s -n 19 -c rdaemon +ExecStop=-@sbindir@/alsactl -s kill save_and_quit diff --git a/alsactl/alsactl.1 b/alsactl/alsactl.1 new file mode 100644 index 0000000..615491a --- /dev/null +++ b/alsactl/alsactl.1 @@ -0,0 +1,182 @@ +.TH ALSACTL 1 "07 May 2014" +.SH NAME +alsactl \- advanced controls for ALSA soundcard driver + +.SH SYNOPSIS + +\fBalsactl\fP [\fIoptions\fP] [\fIstore\fP|\fIrestore\fP|\fIinit\fP] + +\fBalsactl\fP \fImonitor\fP + +.SH DESCRIPTION +\fBalsactl\fP is used to control advanced settings for the ALSA +soundcard drivers. It supports multiple soundcards. If your card has +features that you can't seem to control from a mixer application, +you have come to the right place. + +.SH COMMANDS + +\fIstore\fP saves the current driver state for the selected soundcard +to the configuration file. + +\fIrestore\fP loads driver state for the selected soundcard from the +configuration file. If restoring fails (eventually partly), the init +action is called. + +\fInrestore\fP is like \fIrestore\fP, but it notifies also the daemon +to do new rescan for available soundcards. + +\fIinit\fP tries to initialize all devices to a default state. If device +is not known, error code 99 is returned. + +\fIdaemon\fP manages to save periodically the sound state. + +\fIrdaemon\fP like \fIdaemon\fP but restore the sound state at first. + +\fIkill\fP notifies the daemon to do the specified operation (quit, +rescan, save_and_quit). + +\fImonitor\fP is for monitoring the events received from the given +control device. + +If no soundcards are specified, setup for all cards will be saved, +loaded or monitored. + +.SH OPTIONS + +.TP +\fI\-h, \-\-help\fP +Help: show available flags and commands. + +.TP +\fI\-d, \-\-debug\fP +Use debug mode: a bit more verbose. + +.TP +\fI\-v, \-\-version\fP +Print alsactl version number. + +.TP +\fI\-f, \-\-file\fP +Select the configuration file to use. The default is /var/lib/alsa/asound.state. + +.TP +\fI\-l, \-\-lock\fP +Use the file locking to serialize the concurrent access to the state file (this +option is default for the global state file). + +.TP +\fI\-L, \-\-no-lock\fP +Do not use the file locking to serialize the concurrent access to the state +file (including the global state file). + +.TP +\fI\-O, \-\-lock-state-file\fP +Select the state lock file path. + +.TP +\fI\-F, \-\-force\fP +Used with restore command. Try to restore the matching control elements +as much as possible. This option is set as default now. + +.TP +\fI\-g, \-\-ignore\fP +Used with store and restore commands. Do not show 'No soundcards found' +and do not set an error exit code when soundcards are not installed. + +.TP +\fI\-P, \-\-pedantic\fP +Used with restore command. Don't restore mismatching control elements. +This option was the old default behavior. + +.TP +\fI\-I, \-\-no\-init\-fallback\fP +Don't initialize cards if restore fails. Since version 1.0.18, +\fBalsactl\fP tries to initialize the card with the restore operation +as default. But this can cause incompatibility with the older version. +The caller may expect that the state won't be touched if no state file +exists. This option takes the restore behavior back to the older +version by suppressing the initialization. + +.TP +\fI\-r, \-\-runstate\fP +Save restore and init state to this file. The file will contain only errors. +Errors are appended with the soundcard id to the end of file. + +.TP +\fI\-R, \-\-remove\fP +Remove runstate file at first. + +.TP +\fI\-E, \-\-env\fP #=# +Set environment variable (useful for init action or you may override +ALSA_CONFIG_PATH to read different or optimized configuration - may be +useful for "boot" scripts). + +.TP +\fI\-i, \-\-initfile\fP +The configuration file for init. By default, PREFIX/share/alsa/init/00main +is used. + +.TP +\fI\-p, \-\-period\fP +The store period in seconds for the daemon command. + +.TP +\fI\-e, \-\-pid-file\fP +The pathname to store the process-id file in the HDB UUCP format (ASCII). + +.TP +\fI\-b, \-\-background\fP +Run the task in background. + +.TP +\fI\-s, \-\-syslog\fP +Use syslog for messages. + +.TP +\fI\-n, \-\-nice\fP +Set the process priority (see 'man nice') + +.TP +\fI\-c, \-\-sched-idle\fP +Set the process scheduling policy to idle (SCHED_IDLE). + +.TP +\fI\-D, \-\-ucm-defaults\fP +Execute also the 'defaults' section from the UCM configuration. The standard +behaviour is to execute only 'once' section. + +.TP +\fI\-U, \-\-no-ucm\fP +Skip the UCM init even if available. It may be useful for the test the +legacy init configuration. + +.SH FILES +\fI/var/lib/alsa/asound.state\fP (or whatever file you specify with the +\fB\-f\fP flag) is used to store current settings for your +soundcards. The settings include all the usual soundcard mixer +settings. More importantly, alsactl is +capable of controlling other card-specific features that mixer apps +usually don't know about. + +The configuration file is generated automatically by running +\fBalsactl store\fP. Editing the configuration file by hand may be +necessary for some soundcard features (e.g. enabling/disabling +automatic mic gain, digital output, joystick/game ports, some future MIDI +routing options, etc). + +.SH SEE ALSO +\fB +amixer(1), +alsamixer(1), +aplay(1), +alsactl_init(7) +\fP + +.SH BUGS +None known. + +.SH AUTHOR +\fBalsactl\fP is by Jaroslav Kysela and Abramo Bagnara +. This document is by Paul Winkler . diff --git a/alsactl/alsactl.c b/alsactl/alsactl.c new file mode 100644 index 0000000..20ebac1 --- /dev/null +++ b/alsactl/alsactl.c @@ -0,0 +1,411 @@ +/* + * Advanced Linux Sound Architecture Control Program + * Copyright (c) by Abramo Bagnara + * Jaroslav Kysela + * + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + */ + +#include "aconfig.h" +#include "version.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include "alsactl.h" + +#ifndef SYS_ASOUNDRC +#define SYS_ASOUNDRC "/var/lib/alsa/asound.state" +#endif +#ifndef SYS_PIDFILE +#define SYS_PIDFILE "/var/run/alsactl.pid" +#endif +#ifndef SYS_LOCKPATH +#define SYS_LOCKPATH "/var/lock" +#endif + +int debugflag = 0; +int force_restore = 1; +int ignore_nocards = 0; +int do_lock = 0; +int use_syslog = 0; +char *command; +char *statefile = NULL; +char *lockfile = SYS_LOCKFILE; + +#define TITLE 0x0100 +#define HEADER 0x0200 +#define FILEARG 0x0400 +#define ENVARG 0x0800 +#define INTARG 0x1000 +#define EMPCMD 0x2000 +#define CARDCMD 0x4000 +#define KILLCMD 0x8000 + +struct arg { + int sarg; + char *larg; + char *comment; +}; + +static struct arg args[] = { +{ TITLE, NULL, "Usage: alsactl command" }, +{ HEADER, NULL, "global options:" }, +{ 'h', "help", "this help" }, +{ 'd', "debug", "debug mode" }, +{ 'v', "version", "print version of this program" }, +{ HEADER, NULL, "Available state options:" }, +{ FILEARG | 'f', "file", "configuration file (default " SYS_ASOUNDRC ")" }, +{ 'l', "lock", "use file locking to serialize concurrent access" }, +{ 'L', "no-lock", "do not use file locking to serialize concurrent access" }, +{ FILEARG | 'O', "lock-state-file", "state lock file path (default " SYS_LOCKFILE ")" }, +{ 'F', "force", "try to restore the matching controls as much as possible" }, +{ 0, NULL, " (default mode)" }, +{ 'g', "ignore", "ignore 'No soundcards found' error" }, +{ 'P', "pedantic", "do not restore mismatching controls (old default)" }, +{ 'I', "no-init-fallback", "" }, +{ 0, NULL, "don't initialize even if restore fails" }, +{ FILEARG | 'r', "runstate", "save restore and init state to this file (only errors)" }, +{ 0, NULL, " default settings is 'no file set'" }, +{ 'R', "remove", "remove runstate file at first, otherwise append errors" }, +{ INTARG | 'p', "period", "store period in seconds for the daemon command" }, +{ FILEARG | 'e', "pid-file", "pathname for the process id (daemon mode)" }, +{ HEADER, NULL, "Available init options:" }, +{ ENVARG | 'E', "env", "set environment variable for init phase (NAME=VALUE)" }, +{ FILEARG | 'i', "initfile", "main configuation file for init phase" }, +{ 0, NULL, " (default " DATADIR "/init/00main)" }, +{ 'b', "background", "run daemon in background" }, +{ 's', "syslog", "use syslog for messages" }, +{ INTARG | 'n', "nice", "set the process priority (see 'man nice')" }, +{ 'c', "sched-idle", "set the process scheduling policy to idle (SCHED_IDLE)" }, +#ifdef HAVE_ALSA_USE_CASE_H +{ 'D', "ucm-defaults", "execute also the UCM 'defaults' section" }, +{ 'U', "no-ucm", "don't init with UCM" }, +#endif +{ HEADER, NULL, "Available commands:" }, +{ CARDCMD, "store", "save current driver setup for one or each soundcards" }, +{ EMPCMD, NULL, " to configuration file" }, +{ CARDCMD, "restore", "load current driver setup for one or each soundcards" }, +{ EMPCMD, NULL, " from configuration file" }, +{ CARDCMD, "nrestore", "like restore, but notify the daemon to rescan soundcards" }, +{ CARDCMD, "init", "initialize driver to a default state" }, +{ CARDCMD, "daemon", "store state periodically for one or each soundcards" }, +{ CARDCMD, "rdaemon", "like daemon but do the state restore at first" }, +{ KILLCMD, "kill", "notify daemon to quit, rescan or save_and_quit" }, +{ CARDCMD, "monitor", "monitor control events" }, +{ 0, NULL, NULL } +}; + +static void help(void) +{ + struct arg *n = args, *a; + char *larg, sa[4], buf[32]; + int sarg; + + sa[0] = '-'; + sa[2] = ','; + sa[3] = '\0'; + while (n->comment) { + a = n; + n++; + sarg = a->sarg; + if (sarg & (HEADER|TITLE)) { + printf("%s%s\n", (sarg & HEADER) != 0 ? "\n" : "", + a->comment); + continue; + } + buf[0] = '\0'; + larg = a->larg; + if (sarg & (EMPCMD|CARDCMD|KILLCMD)) { + if (sarg & CARDCMD) + strcat(buf, ""); + else if (sarg & KILLCMD) + strcat(buf, ""); + printf(" %-8s %-6s %s\n", larg ? larg : "", + buf, a->comment); + continue; + } + sa[1] = a->sarg; + sprintf(buf, "%s%s%s", sa[1] ? sa : "", + larg ? "--" : "", larg ? larg : ""); + if (sarg & ENVARG) + strcat(buf, " #=#"); + else if (sarg & (FILEARG|INTARG)) + strcat(buf, " #"); + printf(" %-15s %s\n", buf, a->comment); + } +} + +#define NO_NICE (-100000) + +static void do_nice(int use_nice, int sched_idle) +{ + struct sched_param sched_param; + + if (use_nice != NO_NICE && nice(use_nice) < 0) + error("nice(%i): %s", use_nice, strerror(errno)); + if (sched_idle) { + if (sched_getparam(0, &sched_param) >= 0) { + sched_param.sched_priority = 0; + if (sched_setscheduler(0, SCHED_IDLE, &sched_param) < 0) + error("sched_setparam failed: %s", strerror(errno)); + } else { + error("sched_getparam failed: %s", strerror(errno)); + } + } +} + +int main(int argc, char *argv[]) +{ + static const char *const devfiles[] = { + "/dev/snd/controlC", + "/dev/snd/pcmC", + "/dev/snd/midiC", + "/dev/snd/hwC", + NULL + }; + char *cfgfile = SYS_ASOUNDRC; + char *initfile = DATADIR "/init/00main"; + char *pidfile = SYS_PIDFILE; + char *cardname, ncardname[16]; + char *cmd; + const char *const *tmp; + int removestate = 0; + int init_fallback = 1; /* new default behavior */ + int period = 5*60; + int background = 0; + int daemoncmd = 0; + int use_nice = NO_NICE; + int sched_idle = 0; + int initflags = 0; + struct arg *a; + struct option *o; + int i, j, k, res; + struct option *long_option; + char *short_option; + + long_option = calloc(ARRAY_SIZE(args), sizeof(struct option)); + if (long_option == NULL) + exit(EXIT_FAILURE); + short_option = malloc(128); + if (short_option == NULL) { + free(long_option); + exit(EXIT_FAILURE); + } + for (i = j = k = 0; i < ARRAY_SIZE(args); i++) { + a = &args[i]; + if ((a->sarg & 0xff) == 0) + continue; + o = &long_option[j]; + o->name = a->larg; + o->has_arg = (a->sarg & (ENVARG|FILEARG|INTARG)) != 0; + o->flag = NULL; + o->val = a->sarg & 0xff; + j++; + short_option[k++] = o->val; + if (o->has_arg) + short_option[k++] = ':'; + } + short_option[k] = '\0'; + command = argv[0]; + while (1) { + int c; + + if ((c = getopt_long(argc, argv, short_option, long_option, + NULL)) < 0) + break; + switch (c) { + case 'h': + help(); + res = EXIT_SUCCESS; + goto out; + case 'f': + cfgfile = optarg; + break; + case 'l': + do_lock = 1; + break; + case 'L': + do_lock = -1; + break; + case 'O': + lockfile = optarg; + break; + case 'F': + force_restore = 1; + break; + case 'g': + ignore_nocards = 1; + break; + case 'E': + if (putenv(optarg)) { + fprintf(stderr, "environment string '%s' is wrong\n", optarg); + res = EXIT_FAILURE; + goto out; + } + break; + case 'i': + initfile = optarg; + break; + case 'I': + init_fallback = 0; + break; + case 'D': + initflags |= FLAG_UCM_DEFAULTS; + break; + case 'U': + initflags |= FLAG_UCM_DISABLED; + break; + case 'r': + statefile = optarg; + break; + case 'R': + removestate = 1; + break; + case 'P': + force_restore = 0; + break; + case 'p': + period = atoi(optarg); + if (period < 10) + period = 5*60; + else if (period > 24*60*60) + period = 24*60*60; + break; + case 'e': + pidfile = optarg; + break; + case 'b': + background = 1; + break; + case 's': + use_syslog = 1; + break; + case 'n': + use_nice = atoi(optarg); + if (use_nice < -20) + use_nice = -20; + else if (use_nice > 19) + use_nice = 19; + break; + case 'c': + sched_idle = 1; + break; + case 'd': + debugflag = 1; + break; + case 'v': + printf("alsactl version " SND_UTIL_VERSION_STR "\n"); + res = EXIT_SUCCESS; + goto out; + case '?': // error msg already printed + help(); + res = EXIT_FAILURE; + goto out; + default: // should never happen + fprintf(stderr, + "Invalid option '%c' (%d) not handled??\n", c, c); + } + } + free(short_option); + short_option = NULL; + free(long_option); + long_option = NULL; + if (argc - optind <= 0) { + fprintf(stderr, "alsactl: Specify command...\n"); + res = 0; + goto out; + } + + cardname = argc - optind > 1 ? argv[optind + 1] : NULL; + for (tmp = devfiles; cardname != NULL && *tmp != NULL; tmp++) { + int len = strlen(*tmp); + if (!strncmp(cardname, *tmp, len)) { + long l = strtol(cardname + len, NULL, 0); + sprintf(ncardname, "%li", l); + cardname = ncardname; + break; + } + } + + /* the global system file should be always locked */ + if (strcmp(cfgfile, SYS_ASOUNDRC) == 0 && do_lock >= 0) + do_lock = 1; + + /* when running in background, use syslog for reports */ + if (background) { + use_syslog = 1; + daemon(0, 0); + } + + cmd = argv[optind]; + daemoncmd = strcmp(cmd, "daemon") == 0 || strcmp(cmd, "rdaemon") == 0; + + if (use_syslog) { + openlog("alsactl", LOG_CONS|LOG_PID, LOG_DAEMON); + if (daemoncmd) + syslog(LOG_INFO, "alsactl " SND_UTIL_VERSION_STR " daemon started"); + } + + snd_lib_error_set_handler(error_handler); + + if (!strcmp(cmd, "init")) { + res = init(initfile, initflags, cardname); + snd_config_update_free_global(); + } else if (!strcmp(cmd, "store")) { + res = save_state(cfgfile, cardname); + } else if (!strcmp(cmd, "restore") || + !strcmp(cmd, "rdaemon") || + !strcmp(cmd, "nrestore")) { + if (removestate) + remove(statefile); + res = load_state(cfgfile, initfile, initflags, cardname, init_fallback); + if (!strcmp(cmd, "rdaemon")) { + do_nice(use_nice, sched_idle); + res = state_daemon(cfgfile, cardname, period, pidfile); + } + if (!strcmp(cmd, "nrestore")) + res = state_daemon_kill(pidfile, "rescan"); + } else if (!strcmp(cmd, "daemon")) { + do_nice(use_nice, sched_idle); + res = state_daemon(cfgfile, cardname, period, pidfile); + } else if (!strcmp(cmd, "kill")) { + res = state_daemon_kill(pidfile, cardname); + } else if (!strcmp(cmd, "monitor")) { + res = monitor(cardname); + } else { + fprintf(stderr, "alsactl: Unknown command '%s'...\n", cmd); + res = -ENODEV; + } + + snd_config_update_free_global(); + if (use_syslog) { + if (daemoncmd) + syslog(LOG_INFO, "alsactl daemon stopped"); + closelog(); + } + return res < 0 ? -res : 0; + +out: + free(short_option); + free(long_option); + return res; +} diff --git a/alsactl/alsactl.h b/alsactl/alsactl.h new file mode 100644 index 0000000..c478695 --- /dev/null +++ b/alsactl/alsactl.h @@ -0,0 +1,64 @@ +extern int debugflag; +extern int force_restore; +extern int ignore_nocards; +extern int do_lock; +extern int use_syslog; +extern char *command; +extern char *statefile; +extern char *lockfile; + +void info_(const char *fcn, long line, const char *fmt, ...); +void error_(const char *fcn, long line, const char *fmt, ...); +void cerror_(const char *fcn, long line, int cond, const char *fmt, ...); +void dbg_(const char *fcn, long line, const char *fmt, ...); +void error_handler(const char *file, int line, const char *function, int err, const char *fmt, ...); + +#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95) +#define info(...) do { info_(__func__, __LINE__, __VA_ARGS__); } while (0) +#define error(...) do { error_(__func__, __LINE__, __VA_ARGS__); } while (0) +#define cerror(cond, ...) do { cerror_(__func__, __LINE__, (cond) != 0, __VA_ARGS__); } while (0) +#define dbg(...) do { dbg_(__func__, __LINE__, __VA_ARGS__); } while (0) +#else +#define info(args...) do { info_(__func__, __LINE__, ##args); } while (0) +#define error(args...) do { error_(__func__, __LINE__, ##args); } while (0) +#define cerror(cond, ...) do { error_(__func__, __LINE__, (cond) != 0, ##args); } while (0) +#define dbg(args...) do { dbg_(__func__, __LINE__, ##args); } while (0) +#endif + +#define FLAG_UCM_DISABLED (1<<0) +#define FLAG_UCM_DEFAULTS (1<<1) + +int init(const char *file, int flags, const char *cardname); +int init_ucm(int flags, int cardno); +int state_lock(const char *file, int timeout); +int state_unlock(int fd, const char *file); +int save_state(const char *file, const char *cardname); +int load_state(const char *file, const char *initfile, int initflags, + const char *cardname, int do_init); +int power(const char *argv[], int argc); +int monitor(const char *name); +int state_daemon(const char *file, const char *cardname, int period, + const char *pidfile); +int state_daemon_kill(const char *pidfile, const char *cmd); + +/* utils */ + +int file_map(const char *filename, char **buf, size_t *bufsize); +void file_unmap(void *buf, size_t bufsize); +size_t line_width(const char *buf, size_t bufsize, size_t pos); +void initfailed(int cardnumber, const char *reason, int exitcode); + +static inline int hextodigit(int c) +{ + if (c >= '0' && c <= '9') + c -= '0'; + else if (c >= 'a' && c <= 'f') + c = c - 'a' + 10; + else if (c >= 'A' && c <= 'F') + c = c - 'A' + 10; + else + return -1; + return c; +} + +#define ARRAY_SIZE(a) (sizeof (a) / sizeof (a)[0]) diff --git a/alsactl/alsactl_init.xml b/alsactl/alsactl_init.xml new file mode 100644 index 0000000..bce26f5 --- /dev/null +++ b/alsactl/alsactl_init.xml @@ -0,0 +1,633 @@ + + + +
+
+ alsactl init + + + alsactl init + July 2008 + alsactl + + + + alsactl_init + 7 + + + + + alsactl init + alsa control management - initialization + + + DESCRIPTION + "alsactl init" provides soundcard specific initialization. + + + CONFIGURATION + All "alsactl init" configuration files are placed in + /usr/share/alsa/init/ directory. The top level + configuration file is /usr/share/alsa/init/00main. + The default top-level file can be also specified using -i or + --initfile parameter for the alsactl tool. + Every file consists of a set of lines of text. All empty lines or + lines beginning with '#' will be ignored. + + Rules files + The "alsactl init" rules are read from the files located + in the /usr/share/alsa/init/*. The top + level configuration file is /usr/share/alsa/init/00main. + Every line in the rules file contains at least one key value pair. + There are two kind of keys, match and assignment keys. If all match + keys are matching against its value, the rule gets applied and the + assign keys get the specified value assigned. + + A rule may consists of a list of one or more key value pairs + separated by a comma. Each key has a distinct operation, depending + on the used operator. Valid operators are: + + + + + Compare for equality. + + + + + + + Compare for non-equality. + + + + + + + Assign a value to a key. Keys that represent a list, + are reset and only this single value is assigned. + + + + + + + Add the value to a key that holds a list + of entries. + + + + + + + Assign a value to a key finally; disallow any + later changes, which may be used to prevent changes by + any later rules. + + + + + The following key names can be used to match against device + properties: + + + + + Match the card index of the ALSA driver. + + + + + + + Set or test universal control attribute. Possible + attributes: + + + + + Numeric control identification. + + + + , + + Control interface name (CARD, HWEDEP, MIXER, PCM, RAWMIDI, TIMER, SEQUENCER) + + + + , + + Subdevice number. + + + + + + Control name + + + + + + Control index + + + + + + Control type (BOOLEAN, INTEGER, INTEGER64, ENUMERATED, BYTES, IEC958) + + + + , + + Attributes (stored in a string - use match characters * and ?): + + + + + control is readable + + + + + + control is writable + + + + + + control is volatile + + + + + + control is inactive + + + + + + control is locked + + + + + + control is TLV readable + + + + + + control is TLV writable + + + + + + control is TLV commandable + + + + + + process is owner of this control + + + + + + control created in user space + + + + + + + + + Control owner process PID number + + + + + + Control count of values + + + + + + Value range - minimum value + + + + + + Value range - maximum value + + + + + + Value range - step value + + + + + + Value range - minimum dB value + + + + + + Value range - maximum dB value + + + + + + Enumerated value - number of text items + + + + + + Enumerated value - list of text names stored between '|' character + + + + + + Value of control stored to a string delimited by + comma (,). + + + + + + Search for a control. Value "1" is returned + if a control was found. The CTL{name} key might + contain match characters * and ?. An control index + might be specified as first argument starting from + zero (e.g. CTL{do_search 2}="1"). + + + + + + Search for a controls and return total count + of matched ones. The CTL{name} key might contain match + characters * and ?. + + + + + + + + + + The relative path to sysfs subsystem specifying + the root directory of a soundcard device. Usually, + it should be set to "/class/sound/card$cardinfo{card}/device". + + + + + + + + Match sysfs attribute values of the soundcard device. + The relative path to sysfs tree must be defined by + CONFIG{sysfs_device} key. Trailing whitespace in the attribute + values is ignored, if the specified match value does + not contain trailing whitespace itself. Depending on + the type of operator, this key is also used to set + the value of a sysfs attribute. + + + + + + + + Match against the value of an environment variable. Up + to five keys can be specified per rule. + Depending on the type of operator, this key is also used + to export a variable to the environment. + + + + + + + Execute external program. The key is true, if + the program returns without exit code zero. The whole event + environment is available to the executed program. The + program's output printed to stdout is available for + the RESULT key. + Several buildin commands are available: + + + + + Search for a control. The CTL{name} key might + contain match characters * and ?. An control index + might be specified as first argument starting from + zero (e.g. PROGRAM="__ctl_search 2"). + + + + + + Search for a controls and return total count + of matched ones. The CTL{name} key might contain match + characters * and ?. + + + + + + + + + + Match the returned string of the last PROGRAM call. + This key can be used in the same or in any later rule + after a PROGRAM call. + + + + + + Most of the fields support a shell style pattern matching. + The following pattern characters are supported: + + + + + Matches zero, or any number of characters. + + + + + + Matches any single character. + + + + + + Matches any single character specified within + the brackets. For example, the pattern string 'tty[SR]' + would match either 'ttyS' or 'ttyR'. Ranges are also + supported within this match with the '-' character. + For example, to match on the range of all digits, + the pattern [0-9] would be used. If the first character + following the '[' is a '!', any characters + not enclosed are matched. + + + + + The following keys can get values assigned: + + + , , + , , + , , + + + Select universal control element. + + + + + + Value is set (written) also to soundcard's control + device and RESULT key is set to errno code. The result of + set operation is always true (it means continue with + next key on line). + + + + + + Value is set (written) also to soundcard's control + device (all control values are set to specified value) and + RESULT key is set to errno code. The result of + set operation is always true (it means continue with + next key on line). + + + + + + Value is set (written) also to soundcard's control + device (all control values are set to specified value). + The result of set operation is true when operation + succeed (it means continue with next key on line). + + + + + + + Export a variable to the environment. Depending on the type of operator, + this key is also to match against an environment variable. + + + + + + + Set RESULT variable. Note that PROGRAM also sets + this variable, but setting this variable manually + might be useful to change code execution order (included + files). + + + + + + + Named label where a GOTO can jump to. + + + + + + + Jumps to the next LABEL with a matching name. + The goto cannot jump backward. + + + + + + + Include the specified filename or files in specified directory. + + + When a directory is specified, only the files with the + extension ".conf" are read. + Also they are read in the alphabetical order. + Thus it's highly recommended to use some number prefix + (e.g. "01-something.conf") to assure the order of execucions. + + + + + + + + Check if specified file or directory exists + + + + + + + The relative path to sysfs subsystem specifying + the root directory of a soundcard device. Usually, + it should be set to "/class/sound/card$cardinfo{card}/device". + + + + + + + + PRINT value to stdout. + + + + + + + PRINT value to stderr. + + + + + + + Exit immediately and set program exit code to value + (should be integer). If value is "return" string, + parser leaves current included file and returns to parent + configuration file. + + + + + + The , , + , + , , + , + fields support simple printf-like string substitutions. + It allows the use of the complete environment set by earlier matching + rules. For all other fields, substitutions are applied while the individual rule is + being processed. The available substitutions are: + + + , + + See CARDINFO{} for more details. + + + + + , + + See CTL{} for more details. + + + + + , + + The value of a sysfs attribute found at the device, where + all keys of the rule have matched. + If the attribute is a symlink, the last element of the symlink target is + returned as the value. + + + + + , + + The value of an environment variable. + + + + + , + + The string returned by the external program requested with PROGRAM. + A single part of the string, separated by a space character may be selected + by specifying the part number as an attribute: . + If the number is followed by the '+' char this part plus all remaining parts + of the result string are substituted: + + + + + , + + Root directory where sysfs file-system is mounted. + Ususally, this value is just "/sys". + + + + + , + + The value of a configuration variable. See CONFIG{} for more details. + + + + + + + The '%' character itself. + + + + + + + The '$' character itself. + + + + The count of characters to be substituted may be limited + by specifying the format length value. For example, '%3s{file}' + will only insert the first three characters of the sysfs + attribute + + + + AUTHOR + Written by Jaroslav Kysela perex@perex.cz + Some portions are written by Greg Kroah-Hartman greg@kroah.com and + Kay Sievers kay.sievers@vrfy.org. + + + + SEE ALSO + + alsactl1 + + + +
+
diff --git a/alsactl/daemon.c b/alsactl/daemon.c new file mode 100644 index 0000000..65f7ac1 --- /dev/null +++ b/alsactl/daemon.c @@ -0,0 +1,460 @@ +/* + * Advanced Linux Sound Architecture Control Program + * Copyright (c) by Jaroslav Kysela + * + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + */ + +#include "aconfig.h" +#include "version.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "alsactl.h" + +struct id_list { + snd_ctl_elem_id_t **list; + int size; +}; + +struct card { + int index; + int pfds; + snd_ctl_t *handle; + struct id_list whitelist; + struct id_list blacklist; +}; + +static int quit = 0; +static int rescan = 0; +static int save_now = 0; + +static void signal_handler_quit(int sig) +{ + quit = 1; + signal(sig, signal_handler_quit); +} + +static void signal_handler_save_and_quit(int sig) +{ + quit = save_now = 1; + signal(sig, signal_handler_quit); +} + +static void signal_handler_rescan(int sig) +{ + rescan = 1; + signal(sig, signal_handler_rescan); +} + +static void free_list(struct id_list *list) +{ + int i; + + for (i = 0; i < list->size; i++) + free(list->list[i]); + free(list->list); +} + +static void card_free(struct card **card) +{ + struct card *c = *card; + + free_list(&c->blacklist); + free_list(&c->whitelist); + if (c->handle) + snd_ctl_close(c->handle); + free(c); + *card = NULL; +} + +static void add_card(struct card ***cards, int *count, const char *cardname) +{ + struct card *card, **cc; + int i, index, findex; + char device[16]; + + index = snd_card_get_index(cardname); + if (index < 0) + return; + for (i = 0, findex = -1; i < *count; i++) { + if ((*cards)[i] == NULL) { + findex = i; + } else { + if ((*cards)[i]->index == index) + return; + } + } + card = calloc(1, sizeof(*card)); + if (card == NULL) + return; + card->index = index; + sprintf(device, "hw:%i", index); + if (snd_ctl_open(&card->handle, device, SND_CTL_READONLY|SND_CTL_NONBLOCK) < 0) { + card_free(&card); + return; + } + card->pfds = snd_ctl_poll_descriptors_count(card->handle); + if (card->pfds < 0) { + card_free(&card); + return; + } + if (snd_ctl_subscribe_events(card->handle, 1) < 0) { + card_free(&card); + return; + } + if (findex >= 0) { + (*cards)[findex] = card; + } else { + cc = realloc(*cards, sizeof(void *) * (*count + 1)); + if (cc == NULL) { + card_free(&card); + return; + } + cc[*count] = card; + *count = *count + 1; + *cards = cc; + } +} + +static void add_cards(struct card ***cards, int *count) +{ + int card = -1; + char cardname[16]; + + while (1) { + if (snd_card_next(&card) < 0) + break; + if (card < 0) + break; + if (card >= 0) { + sprintf(cardname, "%i", card); + add_card(cards, count, cardname); + } + } +} + +static int compare_ids(snd_ctl_elem_id_t *id1, snd_ctl_elem_id_t *id2) +{ + if (id1 == NULL || id2 == NULL) + return 0; + return snd_ctl_elem_id_get_interface(id1) == snd_ctl_elem_id_get_interface(id2) && + snd_ctl_elem_id_get_index(id1) == snd_ctl_elem_id_get_index(id2) && + strcmp(snd_ctl_elem_id_get_name(id1), snd_ctl_elem_id_get_name(id2)) == 0 && + snd_ctl_elem_id_get_device(id1) == snd_ctl_elem_id_get_device(id2) && + snd_ctl_elem_id_get_subdevice(id1) == snd_ctl_elem_id_get_subdevice(id2); +} + +static int in_list(struct id_list *list, snd_ctl_elem_id_t *id) +{ + int i; + snd_ctl_elem_id_t *id1; + + for (i = 0; i < list->size; i++) { + id1 = list->list[i]; + if (id1 == NULL) + continue; + if (compare_ids(id, id1)) + return 1; + } + return 0; +} + +static void remove_from_list(struct id_list *list, snd_ctl_elem_id_t *id) +{ + int i; + + for (i = 0; i < list->size; i++) { + if (compare_ids(id, list->list[i])) { + free(list->list[i]); + list->list[i] = NULL; + } + } +} + +static void add_to_list(struct id_list *list, snd_ctl_elem_id_t *id) +{ + snd_ctl_elem_id_t *id1; + snd_ctl_elem_id_t **n; + int i; + + if (snd_ctl_elem_id_malloc(&id1)) + return; + snd_ctl_elem_id_copy(id1, id); + for (i = 0; i < list->size; i++) { + if (list->list[i] == NULL) { + list->list[i] = id1; + return; + } + } + n = realloc(list->list, sizeof(void *) * (list->size + 1)); + if (n == NULL) + return; + n[list->size] = id1; + list->size++; + list->list = n; +} + +static int check_lists(struct card *card, snd_ctl_elem_id_t *id) +{ + snd_ctl_elem_info_t *info; + snd_ctl_elem_info_alloca(&info); + + if (in_list(&card->blacklist, id)) + return 0; + if (in_list(&card->whitelist, id)) + return 1; + snd_ctl_elem_info_set_id(info, id); + if (snd_ctl_elem_info(card->handle, info) < 0) + return 0; + if (snd_ctl_elem_info_is_writable(info) || + snd_ctl_elem_info_is_tlv_writable(info)) { + add_to_list(&card->whitelist, id); + return 1; + } else { + add_to_list(&card->blacklist, id); + return 0; + } +} + +static int card_events(struct card *card) +{ + int res = 0; + snd_ctl_event_t *ev; + snd_ctl_event_type_t type; + unsigned int mask; + snd_ctl_elem_id_t *id; + snd_ctl_event_alloca(&ev); + snd_ctl_elem_id_alloca(&id); + + while (snd_ctl_read(card->handle, ev) == 1) { + type = snd_ctl_event_get_type(ev); + if (type != SND_CTL_EVENT_ELEM) + continue; + mask = snd_ctl_event_elem_get_mask(ev); + snd_ctl_event_elem_get_id(ev, id); + if (mask == SND_CTL_EVENT_MASK_REMOVE) { + remove_from_list(&card->whitelist, id); + remove_from_list(&card->blacklist, id); + continue; + } + if (mask & SND_CTL_EVENT_MASK_INFO) { + remove_from_list(&card->whitelist, id); + remove_from_list(&card->blacklist, id); + } + if (mask & (SND_CTL_EVENT_MASK_VALUE| + SND_CTL_EVENT_MASK_ADD| + SND_CTL_EVENT_MASK_TLV)) { + if (check_lists(card, id)) + res = 1; + } + } + return res; +} + +static long read_pid_file(const char *pidfile) +{ + int fd, err; + char pid_txt[12]; + + fd = open(pidfile, O_RDONLY); + if (fd >= 0) { + err = read(fd, pid_txt, 11); + if (err != 11) + err = err < 0 ? -errno : -EIO; + close(fd); + pid_txt[11] = '\0'; + return atol(pid_txt); + } else { + return -errno; + } +} + +static int write_pid_file(const char *pidfile) +{ + int fd, err; + char pid_txt[14]; + + sprintf(pid_txt, "%10li\n", (long)getpid()); + fd = open(pidfile, O_WRONLY|O_CREAT|O_EXCL, 0600); + if (fd >= 0) { + err = write(fd, pid_txt, 11); + if (err != 11) { + err = err < 0 ? -errno : -EIO; + unlink(pidfile); + } else { + err = 0; + } + close(fd); + } else { + err = -errno; + } + return err; +} + +int state_daemon_kill(const char *pidfile, const char *cmd) +{ + long pid; + int sig = SIGHUP; + + if (cmd == NULL) { + error("Specify kill command (quit, rescan or save_and_quit)"); + return -EINVAL; + } + if (strcmp(cmd, "rescan") == 0) + sig = SIGUSR1; + else if (strcmp(cmd, "save_and_quit") == 0) + sig = SIGUSR2; + else if (strcmp(cmd, "quit") == 0) + sig = SIGTERM; + if (sig == SIGHUP) { + error("Unknown kill command '%s'", cmd); + return -EINVAL; + } + pid = read_pid_file(pidfile); + if (pid > 0) { + if (kill(pid, sig) >= 0) + return 0; + return -errno; + } + return 0; +} + +static int check_another_instance(const char *pidfile) +{ + long pid; + + pid = read_pid_file(pidfile); + if (pid >= 0) { + /* invoke new card rescan */ + if (kill(pid, SIGUSR1) >= 0) { + usleep(1000); + pid = read_pid_file(pidfile); + if (pid >= 0) + return 1; + } + } + return 0; +} + +int state_daemon(const char *file, const char *cardname, int period, + const char *pidfile) +{ + int count = 0, pcount, psize = 0, i, j, k, changed = 0; + time_t last_write, now; + unsigned short revents; + struct card **cards = NULL; + struct pollfd *pfd = NULL, *pfdn; + + if (check_another_instance(pidfile)) + return 0; + rescan = 1; + signal(SIGABRT, signal_handler_quit); + signal(SIGTERM, signal_handler_quit); + signal(SIGINT, signal_handler_quit); + signal(SIGUSR1, signal_handler_rescan); + signal(SIGUSR2, signal_handler_save_and_quit); + write_pid_file(pidfile); + time(&last_write); + while (!quit || save_now) { + if (save_now) + goto save; + if (rescan) { + if (cardname) { + add_card(&cards, &count, cardname); + } else { + add_cards(&cards, &count); + } + snd_config_update_free_global(); + rescan = 0; + } + for (i = pcount = 0; i < count; i++) { + if (cards[i] == NULL) + continue; + pcount += cards[i]->pfds; + } + if (pcount > psize) { + pfdn = realloc(pfd, sizeof(struct pollfd) * pcount); + if (pfdn) { + psize = pcount; + pfd = pfdn; + } else { + error("No enough memory..."); + goto out; + } + } + for (i = j = 0; i < count; i++) { + if (cards[i] == NULL) + continue; + k = snd_ctl_poll_descriptors(cards[i]->handle, pfd + j, pcount - j); + if (k != cards[i]->pfds) { + error("poll prepare failed: %i", k); + goto out; + } + j += k; + } + i = poll(pfd, j, (period / 2) * 1000); + if (i < 0 && errno == EINTR) + continue; + if (i < 0) { + error("poll failed: %s", strerror(errno)); + break; + } + time(&now); + for (i = j = 0; i < count; i++) { + if (cards[i] == NULL) + continue; + k = snd_ctl_poll_descriptors_revents(cards[i]->handle, + pfd + j, cards[i]->pfds, &revents); + if (k < 0) { + error("poll post failed: %i\n", k); + goto out; + } + j += cards[i]->pfds; + if (revents & (POLLERR|POLLNVAL)) { + card_free(&cards[i]); + } else if (revents & POLLIN) { + if (card_events(cards[i])) { + /* delay the write */ + if (!changed) + last_write = now; + changed = 1; + } + } + } + if ((now - last_write >= period && changed) || save_now) { +save: + changed = save_now = 0; + save_state(file, cardname); + } + } +out: + free(pfd); + remove(pidfile); + if (cards) { + for (i = 0; i < count; i++) + card_free(&cards[i]); + free(cards); + } + return 0; +} diff --git a/alsactl/init/00main b/alsactl/init/00main new file mode 100644 index 0000000..21fd8af --- /dev/null +++ b/alsactl/init/00main @@ -0,0 +1,49 @@ +# This is toplevel configuration for for 'alsactl init'. +# See 'man alsactl_init' for syntax. + +# set root device directory in sysfs for soundcard for ATTR{} command +CONFIG{sysfs_device}="/class/sound/card$cardinfo{card}/device" +ACCESS!="$sysfsroot$config{sysfs_device}", \ + CONFIG{sysfs_device}="/class/sound/controlC$cardinfo{card}/device" + +# test for extra commands +ENV{CMD}=="help", INCLUDE="help", GOTO="00main_end" +ENV{CMD}=="info", INCLUDE="info", GOTO="00main_end" +ENV{CMD}=="default", INCLUDE="default", GOTO="00main_end" +ENV{CMD}=="test", INCLUDE="test", GOTO="00main_end" +ENV{CMD}=="*", ERROR="Unknown command '$env{CMD}'\n", GOTO="00main_end" + +# include files with real configuration +# +# steps are: +# 1) look for preinit subdirectory and parse all files in it +# 2) if RESULT=="skip", skip ALSA standard configuration files +# 3) do ALSA standard configuration +# 4) look for postinit subdirectory and parse all files in it +# 5) if RESULT!="true", initialize hardware using a guess method, +# print an error message and return with exit code 99 +# 6) return with exit code 0 (success) +# + +RESULT="unknown" +ACCESS=="preinit", INCLUDE="preinit" +RESULT=="skip", GOTO="init_end" + +# real ALSA configuration database +CARDINFO{driver}=="HDA-Intel", INCLUDE="hda", GOTO="init_end" +CARDINFO{driver}=="CA0106", INCLUDE="ca0106", GOTO="init_end" +CARDINFO{driver}=="Test", INCLUDE="test", GOTO="init_end" + +LABEL="init_end" +ACCESS=="postinit", INCLUDE="postinit" +RESULT=="true", GOTO="00main_end" +ERROR="Found hardware: \"$cardinfo{driver}\" \"$cardinfo{mixername}\" \"$cardinfo{components}\" \"$attr{subsystem_vendor}\" \"$attr{subsystem_device}\"\n" +ERROR="Hardware is initialized using a generic method\n" +INCLUDE="default" +EXIT="99" + +# +# label identifying end of main file +# + +LABEL="00main_end" diff --git a/alsactl/init/Makefile.am b/alsactl/init/Makefile.am new file mode 100644 index 0000000..64dac41 --- /dev/null +++ b/alsactl/init/Makefile.am @@ -0,0 +1,7 @@ + +init_files = \ + 00main default help info test \ + hda ca0106 +EXTRA_DIST = $(init_files) +alsainitdir = $(datadir)/alsa/init +alsainit_DATA = $(init_files) diff --git a/alsactl/init/Makefile.in b/alsactl/init/Makefile.in new file mode 100644 index 0000000..2a4e3ec --- /dev/null +++ b/alsactl/init/Makefile.in @@ -0,0 +1,529 @@ +# Makefile.in generated by automake 1.16.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994-2018 Free Software Foundation, Inc. + +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +VPATH = @srcdir@ +am__is_gnu_make = { \ + if test -z '$(MAKELEVEL)'; then \ + false; \ + elif test -n '$(MAKE_HOST)'; then \ + true; \ + elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ + true; \ + else \ + false; \ + fi; \ +} +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + esac; \ + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +subdir = alsactl/init +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/gettext.m4 \ + $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/lib-ld.m4 \ + $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ + $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \ + $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/acinclude.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/include/aconfig.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = +SOURCES = +DIST_SOURCES = +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; +am__vpath_adj = case $$p in \ + $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ + *) f=$$p;; \ + esac; +am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; +am__install_max = 40 +am__nobase_strip_setup = \ + srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` +am__nobase_strip = \ + for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" +am__nobase_list = $(am__nobase_strip_setup); \ + for p in $$list; do echo "$$p $$p"; done | \ + sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ + $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ + if (++n[$$2] == $(am__install_max)) \ + { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ + END { for (dir in files) print dir, files[dir] }' +am__base_list = \ + sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ + sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' +am__uninstall_files_from_dir = { \ + test -z "$$files" \ + || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ + || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ + $(am__cd) "$$dir" && rm -f $$files; }; \ + } +am__installdirs = "$(DESTDIR)$(alsainitdir)" +DATA = $(alsainit_DATA) +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) +am__DIST_COMMON = $(srcdir)/Makefile.in +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +ALSACTL_DAEMONSWITCH = @ALSACTL_DAEMONSWITCH@ +ALSACTL_PIDFILE_DIR = @ALSACTL_PIDFILE_DIR@ +ALSA_CFLAGS = @ALSA_CFLAGS@ +ALSA_LIBS = @ALSA_LIBS@ +ALSA_TOPOLOGY_LIBS = @ALSA_TOPOLOGY_LIBS@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +ASOUND_LOCK_DIR = @ASOUND_LOCK_DIR@ +ASOUND_STATE_DIR = @ASOUND_STATE_DIR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CURSESINC = @CURSESINC@ +CURSESLIB = @CURSESLIB@ +CURSES_CFLAGS = @CURSES_CFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +FFTW_CFLAGS = @FFTW_CFLAGS@ +FFTW_INC = @FFTW_INC@ +FFTW_LIB = @FFTW_LIB@ +GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ +GMSGFMT = @GMSGFMT@ +GMSGFMT_015 = @GMSGFMT_015@ +GREP = @GREP@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +INTLLIBS = @INTLLIBS@ +INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@ +LDFLAGS = @LDFLAGS@ +LIBICONV = @LIBICONV@ +LIBINTL = @LIBINTL@ +LIBOBJS = @LIBOBJS@ +LIBRT = @LIBRT@ +LIBS = @LIBS@ +LN_S = @LN_S@ +LTLIBICONV = @LTLIBICONV@ +LTLIBINTL = @LTLIBINTL@ +LTLIBOBJS = @LTLIBOBJS@ +MAINT = @MAINT@ +MAKEINFO = @MAKEINFO@ +MKDIR_P = @MKDIR_P@ +MSGFMT = @MSGFMT@ +MSGFMT_015 = @MSGFMT_015@ +MSGMERGE = @MSGMERGE@ +NCURSESW_CFLAGS = @NCURSESW_CFLAGS@ +NCURSESW_LIBS = @NCURSESW_LIBS@ +NCURSES_CFLAGS = @NCURSES_CFLAGS@ +NCURSES_LIBS = @NCURSES_LIBS@ +OBJEXT = @OBJEXT@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ +POSUB = @POSUB@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +SND_UTIL_MAJOR = @SND_UTIL_MAJOR@ +SND_UTIL_MINOR = @SND_UTIL_MINOR@ +SND_UTIL_SUBMINOR = @SND_UTIL_SUBMINOR@ +SND_UTIL_VERSION = @SND_UTIL_VERSION@ +STRIP = @STRIP@ +SYSTEMD_CFLAGS = @SYSTEMD_CFLAGS@ +SYSTEMD_LIBS = @SYSTEMD_LIBS@ +TESTSOUND = @TESTSOUND@ +USE_NLS = @USE_NLS@ +VERSION = @VERSION@ +XGETTEXT = @XGETTEXT@ +XGETTEXT_015 = @XGETTEXT_015@ +XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_CC = @ac_ct_CC@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +mydatadir = @mydatadir@ +ncurses5_config = @ncurses5_config@ +ncursesw5_config = @ncursesw5_config@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +rst2man_available = @rst2man_available@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +systemdsystemunitdir = @systemdsystemunitdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +udevrulesdir = @udevrulesdir@ +xmlto_available = @xmlto_available@ +init_files = \ + 00main default help info test \ + hda ca0106 + +EXTRA_DIST = $(init_files) +alsainitdir = $(datadir)/alsa/init +alsainit_DATA = $(init_files) +all: all-am + +.SUFFIXES: +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign alsactl/init/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --foreign alsactl/init/Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): +install-alsainitDATA: $(alsainit_DATA) + @$(NORMAL_INSTALL) + @list='$(alsainit_DATA)'; test -n "$(alsainitdir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(alsainitdir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(alsainitdir)" || exit 1; \ + fi; \ + for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + echo "$$d$$p"; \ + done | $(am__base_list) | \ + while read files; do \ + echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(alsainitdir)'"; \ + $(INSTALL_DATA) $$files "$(DESTDIR)$(alsainitdir)" || exit $$?; \ + done + +uninstall-alsainitDATA: + @$(NORMAL_UNINSTALL) + @list='$(alsainit_DATA)'; test -n "$(alsainitdir)" || list=; \ + files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ + dir='$(DESTDIR)$(alsainitdir)'; $(am__uninstall_files_from_dir) +tags TAGS: + +ctags CTAGS: + +cscope cscopelist: + + +distdir: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) distdir-am + +distdir-am: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(DATA) +installdirs: + for dir in "$(DESTDIR)$(alsainitdir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ + done +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic mostlyclean-am + +distclean: distclean-am + -rm -f Makefile +distclean-am: clean-am distclean-generic + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: install-alsainitDATA + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-generic + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-alsainitDATA + +.MAKE: install-am install-strip + +.PHONY: all all-am check check-am clean clean-generic cscopelist-am \ + ctags-am distclean distclean-generic distdir dvi dvi-am html \ + html-am info info-am install install-alsainitDATA install-am \ + install-data install-data-am install-dvi install-dvi-am \ + install-exec install-exec-am install-html install-html-am \ + install-info install-info-am install-man install-pdf \ + install-pdf-am install-ps install-ps-am install-strip \ + installcheck installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-generic pdf \ + pdf-am ps ps-am tags-am uninstall uninstall-alsainitDATA \ + uninstall-am + +.PRECIOUS: Makefile + + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/alsactl/init/ca0106 b/alsactl/init/ca0106 new file mode 100644 index 0000000..45fc833 --- /dev/null +++ b/alsactl/init/ca0106 @@ -0,0 +1,31 @@ +# Configuration for CA0106 driver + +CTL{reset}="mixer" +CTL{name}="Master Playback Volume", CTL{values}="-20dB" +CTL{name}="Master Playback Switch", CTL{values}="on" +CTL{name}="Analog Front Playback Volume", CTL{values}="0dB" +CTL{name}="Analog Front Playback Switch", CTL{values}="on" +CTL{name}="Analog Rear Playback Volume", CTL{values}="0dB" +CTL{name}="Analog Rear Playback Switch", CTL{values}="on" +CTL{name}="Analog Center/LFE Playback Volume", CTL{values}="0dB" +CTL{name}="Analog Center/LFE Playback Switch", CTL{values}="on" +CTL{name}="Analog Side Playback Volume", CTL{values}="0dB" +CTL{name}="Analog Side Playback Switch", CTL{values}="on" +CTL{name}="IEC958 Front Playback Volume", CTL{values}="0dB" +CTL{name}="IEC958 Rear Playback Volume", CTL{values}="0dB" +CTL{name}="IEC958 Center/LFE Playback Volume", CTL{values}="0dB" +# capture +CTL{name}="Analog Source Capture Enum", CTL{value}="Mic" +CTL{name}="Mic Capture Volume", CTL{values}="6dB" +CTL{name}="Shared Mic/Line in Capture Switch", CTL{values}="Mic in" + +# some variants have also AC97 mixer + +CTL{reset}="mixer" +CTL{name}="AC97 Line Capture Volume",PROGRAM!="__ctl_search",GOTO="ac97_end" +CTL{name}="Analog Source Capture Enum", CTL{value}="AC97 in" +CTL{name}="AC97 Mic Capture Switch", "on" +CTL{name}="AC97 Mic Capture Value", "6dB" +LABEL="ac97_end" + +RESULT="true", EXIT="return" diff --git a/alsactl/init/default b/alsactl/init/default new file mode 100644 index 0000000..1c84f3e --- /dev/null +++ b/alsactl/init/default @@ -0,0 +1,284 @@ +# +# Default ALSA volume levels and setting when initialization database fails. +# +# Basic rules are: +# - keep volumes at minimal level, but sound should be hearable +# - enable standard outputs for playback and main microphone for recording +# + +# ************************************************************************** +# playback +# ************************************************************************** + +ENV{ppercent}:="75%" +ENV{cpercent}:="75%" +ENV{pvolume}:="-20dB" +ENV{cvolume}:="12dB" +ENV{has_pmaster_vol}:="false" + +CTL{reset}="mixer" +CTL{name}="Playback Volume",CTL{do_search}=="1", \ + CTL{write}!="$env{pvolume}",CTL{values}="$env{ppercent}" +CTL{name}="Playback Switch",CTL{do_search}=="1", \ + CTL{values}="on" + +CTL{reset}="mixer" +CTL{name}="Master Playback Volume",CTL{do_search}=="1", \ + ENV{has_pmaster_vol}:="true", \ + CTL{write}!="$env{pvolume}",CTL{values}="$env{ppercent}" +CTL{name}="Master Playback Switch",CTL{do_search}=="1", \ + CTL{values}="on" + +CTL{reset}="mixer" +CTL{name}="Master Front Playback Volume",CTL{do_search}=="1", \ + ENV{has_pmaster_vol}:="true", \ + CTL{write}!="$env{pvolume}",CTL{values}="$env{ppercent}" +CTL{name}="Master Front Playback Switch",CTL{do_search}=="1", \ + CTL{values}="on" + +CTL{reset}="mixer" +CTL{name}="Master Digital Playback Volume",CTL{do_search}=="1", \ + CTL{write}!="$env{pvolume}",CTL{values}="$env{ppercent}" +CTL{name}="Master Digital Playback Switch",CTL{do_search}=="1", \ + CTL{values}="on" + +CTL{reset}="mixer" +CTL{name}="Line Out Playback Volume",PROGRAM!="__ctl_search",GOTO="" +# if master volume control is present, turn line out volume to max +ENV{has_pmaster_vol}=="true",CTL{write}=="0dB",GOTO="" +ENV{has_pmaster_vol}=="true",CTL{write}=="100%",GOTO="" +CTL{write}!="$env{pvolume}",CTL{values}="$env{ppercent}" +LABEL="" +CTL{name}="Line Out Playback Switch",CTL{do_search}=="1", \ + CTL{values}="on" + +CTL{reset}="mixer" +CTL{name}="Front Playback Volume",PROGRAM!="__ctl_search",GOTO="" +# if master volume control is present, turn front volume to max +ENV{has_pmaster_vol}=="true",CTL{write}=="0dB",GOTO="" +ENV{has_pmaster_vol}=="true",CTL{write}=="100%",GOTO="" +CTL{write}!="$env{pvolume}",CTL{values}="$env{ppercent}" +LABEL="" +CTL{name}="Front Playback Switch",CTL{do_search}=="1", \ + CTL{values}="on" + +CTL{reset}="mixer" +CTL{name}="Surround Playback Volume",PROGRAM!="__ctl_search",GOTO="" +# if master volume control is present, turn front volume to max +ENV{has_pmaster_vol}=="true",CTL{write}=="0dB",GOTO="" +ENV{has_pmaster_vol}=="true",CTL{write}=="100%",GOTO="" +CTL{write}!="$env{pvolume}",CTL{values}="$env{ppercent}" +LABEL="" +CTL{name}="Surround Playback Switch",CTL{do_search}=="1", \ + CTL{values}="on" + +CTL{reset}="mixer" +CTL{name}="Center Playback Volume",PROGRAM!="__ctl_search",GOTO="" +# if master volume control is present, turn front volume to max +ENV{has_pmaster_vol}=="true",CTL{write}=="0dB",GOTO="" +ENV{has_pmaster_vol}=="true",CTL{write}=="100%",GOTO="" +CTL{write}!="$env{pvolume}",CTL{values}="$env{ppercent}" +LABEL="" +CTL{name}="Center Playback Switch",CTL{do_search}=="1", \ + CTL{values}="on" + +CTL{reset}="mixer" +CTL{name}="LFE Playback Volume",PROGRAM!="__ctl_search",GOTO="" +# if master volume control is present, turn front volume to max +ENV{has_pmaster_vol}=="true",CTL{write}=="0dB",GOTO="" +ENV{has_pmaster_vol}=="true",CTL{write}=="100%",GOTO="" +CTL{write}!="$env{pvolume}",CTL{values}="$env{ppercent}" +LABEL="" +CTL{name}="LFE Playback Switch",CTL{do_search}=="1", \ + CTL{values}="on" + +CTL{reset}="mixer" +CTL{name}="Headphone Playback Volume",PROGRAM!="__ctl_search",GOTO="" +# if master volume control is present, turn headphone volume to max +ENV{has_pmaster_vol}=="true",CTL{write}=="0dB",GOTO="" +ENV{has_pmaster_vol}=="true",CTL{write}=="100%",GOTO="" +CTL{write}!="$env{pvolume}",CTL{values}="$env{ppercent}" +LABEL="" +CTL{name}="Headphone Playback Switch",CTL{do_search}=="1", \ + CTL{values}="on" + +CTL{reset}="mixer" +CTL{name}="Headphone Playback Volume",CTL{index}="1",PROGRAM!="__ctl_search",\ + GOTO="" +# if master volume control is present, turn headphone volume to max +ENV{has_pmaster_vol}=="true",CTL{write}=="0dB",GOTO="" +ENV{has_pmaster_vol}=="true",CTL{write}=="100%",GOTO="" +CTL{write}!="$env{pvolume}",CTL{values}="$env{ppercent}" +LABEL="" +CTL{name}="Headphone Playback Switch",CTL{index}="1",CTL{do_search}=="1", \ + CTL{values}="on" + +CTL{reset}="mixer" +CTL{name}="Speaker Playback Volume",PROGRAM!="__ctl_search",GOTO="" +# if master volume control is present, turn speaker volume to max +ENV{has_pmaster_vol}=="true",CTL{write}=="0dB",GOTO="" +ENV{has_pmaster_vol}=="true",CTL{write}=="100%",GOTO="" +CTL{write}!="$env{pvolume}",CTL{values}="$env{ppercent}" +LABEL="" +CTL{name}="Speaker Playback Switch",CTL{do_search}=="1", \ + CTL{values}="on" + +CTL{reset}="mixer" +CTL{name}="Front Speaker Playback Volume",PROGRAM!="__ctl_search",GOTO="" +# if master volume control is present, turn speaker volume to max +ENV{has_pmaster_vol}=="true",CTL{write}=="0dB",GOTO="" +ENV{has_pmaster_vol}=="true",CTL{write}=="100%",GOTO="" +CTL{write}!="$env{pvolume}",CTL{values}="$env{ppercent}" +LABEL="" +CTL{name}="Front Speaker Playback Switch",CTL{do_search}=="1", \ + CTL{values}="on" + +CTL{reset}="mixer" +CTL{name}="Surround Speaker Playback Volume",PROGRAM!="__ctl_search",GOTO="" +# if master volume control is present, turn speaker volume to max +ENV{has_pmaster_vol}=="true",CTL{write}=="0dB",GOTO="" +ENV{has_pmaster_vol}=="true",CTL{write}=="100%",GOTO="" +CTL{write}!="$env{pvolume}",CTL{values}="$env{ppercent}" +LABEL="" +CTL{name}="Surround Speaker Playback Switch",CTL{do_search}=="1", \ + CTL{values}="on" + +CTL{reset}="mixer" +CTL{name}="Center Speaker Playback Volume",PROGRAM!="__ctl_search",GOTO="" +# if master volume control is present, turn speaker volume to max +ENV{has_pmaster_vol}=="true",CTL{write}=="0dB",GOTO="" +ENV{has_pmaster_vol}=="true",CTL{write}=="100%",GOTO="" +CTL{write}!="$env{pvolume}",CTL{values}="$env{ppercent}" +LABEL="" +CTL{name}="Center Speaker Playback Switch",CTL{do_search}=="1", \ + CTL{values}="on" + +CTL{reset}="mixer" +CTL{name}="LFE Speaker Playback Volume",PROGRAM!="__ctl_search",GOTO="" +# if master volume control is present, turn speaker volume to max +ENV{has_pmaster_vol}=="true",CTL{write}=="0dB",GOTO="" +ENV{has_pmaster_vol}=="true",CTL{write}=="100%",GOTO="" +CTL{write}!="$env{pvolume}",CTL{values}="$env{ppercent}" +LABEL="" +CTL{name}="LFE Speaker Playback Switch",CTL{do_search}=="1", \ + CTL{values}="on" + +CTL{reset}="mixer" +CTL{name}="PC Speaker Playback Volume",CTL{do_search}=="1", \ + CTL{values}="$env{pvolume}",RESULT!="0",CTL{values}="$env{ppercent}" +CTL{name}="PC Speaker Playback Switch",CTL{do_search}=="1", \ + CTL{values}="on" + +CTL{reset}="mixer" +CTL{name}="PCM Playback Volume",PROGRAM!="__ctl_search", \ + CTL{name}="PCM Volume",PROGRAM!="__ctl_search", GOTO="" +# if master volume control is present, turn PCM volume to max +ENV{has_pmaster_vol}=="true",CTL{write}=="0dB",GOTO="" +ENV{has_pmaster_vol}=="true",CTL{write}=="100%",GOTO="" +# exception - some HDA codecs have shifted dB range +CTL{dBmin}=="-34.50dB",CTL{dBmax}=="12.00dB",CTL{write}=="0dB",GOTO="" +CTL{dBmin}=="-30.00dB",CTL{dBmax}=="0dB",CTL{write}=="0dB",GOTO="" +CTL{write}!="$env{pvolume}",CTL{values}="75%" +LABEL="" +CTL{name}="PCM Playback Switch",CTL{do_search}=="1", CTL{values}="on" +CTL{name}="PCM Switch",CTL{do_search}=="1",CTL{values}="on" + +CTL{reset}="mixer" +CTL{name}="PCM Playback Volume",CTL{index}="1",PROGRAM!="__ctl_search", \ + CTL{name}="PCM Volume",PROGRAM!="__ctl_search",GOTO="" +# if master volume control is present, turn PCM volume to max +ENV{has_pmaster_vol}=="true",CTL{write}=="0dB",GOTO="" +ENV{has_pmaster_vol}=="true",CTL{write}=="100%",GOTO="" +# exception - some HDA codecs have shifted dB range +CTL{dBmin}=="-34.50dB",CTL{dBmax}=="12.00dB",CTL{write}=="0dB",GOTO="" +CTL{dBmin}=="-30.00dB",CTL{dBmax}=="0dB",CTL{write}=="0dB",GOTO="" +CTL{write}!="$env{pvolume}",CTL{values}="75%" +LABEL="" +CTL{name}="PCM Playback Switch",CTL{index}="1",CTL{do_search}=="1", \ + CTL{values}="on" +CTL{name}="PCM Switch",CTL{index}="1",CTL{do_search}=="1", \ + CTL{values}="on" + +CTL{reset}="mixer" +CTL{name}="DAC Playback Volume",CTL{do_search}=="1", \ + CTL{values}="$env{pvolume}",RESULT!="0",CTL{values}="$env{ppercent}" +CTL{name}="DAC Playback Switch",CTL{do_search}=="1", \ + CTL{values}="on" + +CTL{reset}="mixer" +CTL{name}="Synth Playback Volume",CTL{do_search}=="1", \ + CTL{values}="$env{pvolume}",RESULT!="0",CTL{values}="$env{ppercent}" +CTL{name}="Synth Playback Switch",CTL{do_search}=="1", \ + CTL{values}="on" + +CTL{reset}="mixer" +CTL{name}="Wave Playback Volume",CTL{do_search}=="1", \ + CTL{values}="100%" +CTL{name}="Wave Playback Switch",CTL{do_search}=="1", \ + CTL{values}="on" + +CTL{reset}="mixer" +CTL{name}="Music Playback Volume",CTL{do_search}=="1", \ + CTL{values}="100%" +CTL{name}="Music Playback Switch",CTL{do_search}=="1", \ + CTL{values}="on" + +CTL{reset}="mixer" +CTL{name}="CD Playback Volume",CTL{do_search}=="1", \ + CTL{values}="0%" +CTL{name}="CD Playback Switch",CTL{do_search}=="1", \ + CTL{values}="off" + +CTL{reset}="mixer" +CTL{name}="Mono Playback Volume",CTL{do_search}=="1", \ + CTL{values}="$env{pvolume}",RESULT!="0",CTL{values}="$env{ppercent}" +CTL{name}="Mono Playback Switch",CTL{do_search}=="1", \ + CTL{values}="on" + +CTL{reset}="mixer" +CTL{name}="Master Mono Playback Volume",CTL{do_search}=="1", \ + CTL{values}="$env{pvolume}",RESULT!="0",CTL{values}="$env{ppercent}" +CTL{name}="Master Mono Playback Switch",CTL{do_search}=="1", \ + CTL{values}="on" + +CTL{reset}="mixer" +CTL{name}="AC97 Playback Volume",CTL{do_search}=="1", \ + CTL{values}="100%" +CTL{name}="AC97 Playback Switch",CTL{do_search}=="1", \ + CTL{values}="on" + +# +# Powermacs +# + +CTL{reset}="mixer" +CTL{name}="DRC Range",CTL{do_search}=="1", \ + CTL{write}!="$env{pvolume}",CTL{values}="$env{ppercent}" + +# ************************************************************************** +# capture +# ************************************************************************** + +CTL{reset}="mixer" +CTL{name}="Capture Volume",CTL{do_search}=="1", \ + CTL{write}!="$env{cvolume}",CTL{values}="$env{cpercent}" +CTL{name}="Capture Switch",CTL{do_search}=="1", \ + CTL{values}="on" + +CTL{name}="Capture Source",PROGRAM!="__ctl_search", GOTO="" +CTL{enums}=="*|Internal Mic|*",CTL{values}="Internal Mic", GOTO="" +CTL{enums}=="*|Mic|*",CTL{values}="Mic" +LABEL="" + +CTL{name}="Input Source",PROGRAM!="__ctl_search", GOTO="" +CTL{enums}=="*|Internal Mic|*",CTL{values}="Internal Mic", GOTO="" +CTL{enums}=="*|Mic|*",CTL{values}="Mic" +LABEL="" + +CTL{name}="Digital Input Source",PROGRAM!="__ctl_search", GOTO="" +CTL{enums}=="*|Digital Mic 1|*",CTL{values}="Digital Mic 1", GOTO="" +CTL{enums}=="*|Mic|*",CTL{values}="Mic" +LABEL="" + +CTL{name}="Mic Boost",CTL{do_search}=="1", CTL{values}="on" +CTL{name}="Internal Mic Boost",CTL{do_search}=="1", CTL{values}="on" diff --git a/alsactl/init/hda b/alsactl/init/hda new file mode 100644 index 0000000..7581095 --- /dev/null +++ b/alsactl/init/hda @@ -0,0 +1,39 @@ +# Configuration for HDA Intel driver (High Definition Audio - Azalia) + +CARDINFO{mixername}=="Realtek ALC880", \ + ATTR{subsystem_vendor}=="0x1025", ATTR{subsystem_device}=="0x0070", \ + GOTO="Acer Travelmate 8100" +CARDINFO{mixername}=="Analog Devices AD1984", \ + ATTR{subsystem_vendor}=="0x17aa", ATTR{subsystem_device}=="0x20ac", \ + GOTO="Lenovo T61" +RESULT="false", EXIT="return" + +LABEL="Acer Travelmate 8100" +# playback +CTL{reset}="mixer" +CTL{name}="Master Playback Volume", CTL{values}="-21dB" +CTL{name}="Master Playback Switch", CTL{values}="on" +CTL{name}="Headphone Playback Switch", CTL{values}="on" +CTL{name}="Front Playback Volume", CTL{values}="-29dB" +CTL{name}="Front Playback Switch", CTL{values}="on" +CTL{name}="PCM Playback Volume", CTL{values}="0dB" +# capture +CTL{name}="Input Source", CTL{value}="Mic" +CTL{name}="Capture Volume", CTL{values}="20dB" +CTL{name}="Capture Switch", CTL{values}="on" +RESULT="true", EXIT="return" + +LABEL="Lenovo T61" +# playback +CTL{reset}="mixer" +CTL{name}="Master Playback Volume", CTL{values}="-13.5dB" +CTL{name}="Master Playback Switch", CTL{values}="on" +CTL{name}="Headphone Playback Switch", CTL{values}="on" +CTL{name}="Speaker Playback Switch", CTL{values}="on" +CTL{name}="PCM Playback Volume", CTL{values}="0dB" +# capture +CTL{name}="Input Source", CTL{value}="Internal Mic" +CTL{name}="Internal Mic Boost", CTL{values}="1" +CTL{name}="Capture Volume", CTL{values}="9dB" +CTL{name}="Capture Switch", CTL{values}="on" +RESULT="true", EXIT="return" diff --git a/alsactl/init/help b/alsactl/init/help new file mode 100644 index 0000000..4f0ba70 --- /dev/null +++ b/alsactl/init/help @@ -0,0 +1,8 @@ +# help page + +PRINT="Available commands (identified by the environment variable CMD):\n\n" +PRINT=" (not set) Do a soundcard initialization\n" +PRINT=" default Do a default (guess method) initialization\n" +PRINT=" help Show this information\n" +PRINT=" info Print all available hardware identification\n" +PRINT=" test Do alsactl utility parser tests\n" diff --git a/alsactl/init/info b/alsactl/init/info new file mode 100644 index 0000000..a4fea19 --- /dev/null +++ b/alsactl/init/info @@ -0,0 +1,22 @@ +# show information about card + +PRINT="CARDINFO:\n" +PRINT=" CARDINFO{id}=\"$CARDINFO{id}\"\n" +PRINT=" CARDINFO{card}=\"$CARDINFO{card}\"\n" +PRINT=" CARDINFO{driver}=\"$CARDINFO{driver}\"\n" +PRINT=" CARDINFO{name}=\"$CARDINFO{name}\"\n" +PRINT=" CARDINFO{longname}=\"$CARDINFO{longname}\"\n" +PRINT=" CARDINFO{mixername}=\"$CARDINFO{mixername}\"\n" +PRINT=" CARDINFO{components}=\"$CARDINFO{components}\"\n" + +# sysfs stuff +PRINT="sysfs:\n" +ATTR{bus}=="*", PRINT=" ATTR{bus}=\"$ATTR{bus}\"\n" +ATTR{class}=="*", PRINT=" ATTR{class}=\"$ATTR{class}\"\n" +ATTR{driver}=="*", PRINT=" ATTR{driver}=\"$ATTR{driver}\"\n" +ATTR{vendor}=="*", PRINT=" ATTR{vendor}=\"$ATTR{vendor}\"\n" +ATTR{device}=="*", PRINT=" ATTR{device}=\"$ATTR{device}\"\n" +ATTR{subsystem_vendor}=="*", \ + PRINT=" ATTR{subsystem_vendor}=\"$ATTR{subsystem_vendor}\"\n" +ATTR{subsystem_device}=="*", \ + PRINT=" ATTR{subsystem_device}=\"$ATTR{subsystem_device}\"\n" diff --git a/alsactl/init/test b/alsactl/init/test new file mode 100644 index 0000000..56659f8 --- /dev/null +++ b/alsactl/init/test @@ -0,0 +1,270 @@ +# Test code +# Just for debugging purposes + +PRINT="Default CTL:\n" +PRINT=" CTL{numid}=\"$ctl{numid}\"\n" +PRINT=" CTL{iface}=\"$ctl{iface}\"\n" +PRINT=" CTL{device}=\"$ctl{device}\"\n" +PRINT=" CTL{subdevice}=\"$ctl{subdevice}\"\n" +PRINT=" CTL{name}=\"$ctl{name}\"\n" +PRINT=" CTL{index}=\"$ctl{index}\"\n" + +CTL{reset}="mixer" + +PRINT="After CTL{reset}=\"mixer\":\n" +PRINT=" CTL{numid}=\"$ctl{numid}\"\n" +PRINT=" CTL{iface}=\"$ctl{iface}\"\n" +PRINT=" CTL{device}=\"$ctl{device}\"\n" +PRINT=" CTL{subdevice}=\"$ctl{subdevice}\"\n" +PRINT=" CTL{name}=\"$ctl{name}\"\n" +PRINT=" CTL{index}=\"$ctl{index}\"\n" + +CTL{numid}="987" +CTL{iface}="sequencer" +CTL{device}="10" +CTL{subdevice}="20" +CTL{name}="Just Test" +CTL{index}="999" + +PRINT="After test sequence:\n" +PRINT=" CTL{numid}=\"$ctl{numid}\"\n" +PRINT=" CTL{iface}=\"$ctl{iface}\"\n" +PRINT=" CTL{device}=\"$ctl{device}\"\n" +PRINT=" CTL{subdevice}=\"$ctl{subdevice}\"\n" +PRINT=" CTL{name}=\"$ctl{name}\"\n" +PRINT=" CTL{index}=\"$ctl{index}\"\n" + +ERROR="Ignore following error:\n " +PROGRAM="__just_test" + +PRINT="CTL{do_count} test:\n" +CTL{search}="mixer", CTL{name}="*Switch*", \ + PRINT=" *Switch* count result: $ctl{do_count}\n" + +PRINT="__ctl_search test:\n" +CTL{search}="mixer", CTL{name}="*Switch*", PROGRAM!="__ctl_search", GOTO="skip_switch_search" +PRINT=" *Switch 0* search result: $result\n" +PRINT=" CTL{numid}=\"$ctl{numid}\"\n" +PRINT=" CTL{iface}=\"$ctl{iface}\"\n" +PRINT=" CTL{device}=\"$ctl{device}\"\n" +PRINT=" CTL{subdevice}=\"$ctl{subdevice}\"\n" +PRINT=" CTL{name}=\"$ctl{name}\"\n" +PRINT=" CTL{index}=\"$ctl{index}\"\n" +CTL{search}="mixer", CTL{name}="*Switch*", PROGRAM!="__ctl_search 1", GOTO="skip_switch_search" +PRINT=" *Switch 1* search result: $result\n" +PRINT=" CTL{numid}=\"$ctl{numid}\"\n" +PRINT=" CTL{iface}=\"$ctl{iface}\"\n" +PRINT=" CTL{device}=\"$ctl{device}\"\n" +PRINT=" CTL{subdevice}=\"$ctl{subdevice}\"\n" +PRINT=" CTL{name}=\"$ctl{name}\"\n" +PRINT=" CTL{index}=\"$ctl{index}\"\n" + +PRINT="First ten elements:\n" +CTL{search}="mixer", CTL{name}="*", CTL{do_search 0}!="1", GOTO="skip_first_ten_search" +PRINT=" Element #0:\n" +PRINT=" CTL{numid}=\"$ctl{numid}\"\n" +PRINT=" CTL{iface}=\"$ctl{iface}\"\n" +PRINT=" CTL{device}=\"$ctl{device}\"\n" +PRINT=" CTL{subdevice}=\"$ctl{subdevice}\"\n" +PRINT=" CTL{name}=\"$ctl{name}\"\n" +PRINT=" CTL{index}=\"$ctl{index}\"\n" +PRINT=" CTL{type}=\"$ctl{type}\"\n" +PRINT=" CTL{attr}=\"$ctl{attr}\"\n" +PRINT=" CTL{owner}=\"$ctl{owner}\"\n" +PRINT=" CTL{count}=\"$ctl{count}\"\n" +PRINT=" CTL{min}=\"$ctl{min}\"\n" +PRINT=" CTL{max}=\"$ctl{max}\"\n" +PRINT=" CTL{step}=\"$ctl{step}\"\n" +PRINT=" CTL{dBmin}=\"$ctl{dBmin}\"\n" +PRINT=" CTL{dBmax}=\"$ctl{dBmax}\"\n" +PRINT=" CTL{items}=\"$ctl{items}\"\n" +PRINT=" CTL{value}=\"$ctl{value}\"\n" +CTL{search}="mixer", CTL{name}="*", CTL{do_search 1}!="1", GOTO="skip_first_ten_search" +PRINT=" Element #1:\n" +PRINT=" CTL{numid}=\"$ctl{numid}\"\n" +PRINT=" CTL{iface}=\"$ctl{iface}\"\n" +PRINT=" CTL{device}=\"$ctl{device}\"\n" +PRINT=" CTL{subdevice}=\"$ctl{subdevice}\"\n" +PRINT=" CTL{name}=\"$ctl{name}\"\n" +PRINT=" CTL{index}=\"$ctl{index}\"\n" +PRINT=" CTL{type}=\"$ctl{type}\"\n" +PRINT=" CTL{attr}=\"$ctl{attr}\"\n" +PRINT=" CTL{owner}=\"$ctl{owner}\"\n" +PRINT=" CTL{count}=\"$ctl{count}\"\n" +PRINT=" CTL{min}=\"$ctl{min}\"\n" +PRINT=" CTL{max}=\"$ctl{max}\"\n" +PRINT=" CTL{step}=\"$ctl{step}\"\n" +PRINT=" CTL{dBmin}=\"$ctl{dBmin}\"\n" +PRINT=" CTL{dBmax}=\"$ctl{dBmax}\"\n" +PRINT=" CTL{items}=\"$ctl{items}\"\n" +PRINT=" CTL{value}=\"$ctl{value}\"\n" +CTL{search}="mixer", CTL{name}="*", CTL{do_search 2}!="1", GOTO="skip_first_ten_search" +PRINT=" Element #2:\n" +PRINT=" CTL{numid}=\"$ctl{numid}\"\n" +PRINT=" CTL{iface}=\"$ctl{iface}\"\n" +PRINT=" CTL{device}=\"$ctl{device}\"\n" +PRINT=" CTL{subdevice}=\"$ctl{subdevice}\"\n" +PRINT=" CTL{name}=\"$ctl{name}\"\n" +PRINT=" CTL{index}=\"$ctl{index}\"\n" +PRINT=" CTL{type}=\"$ctl{type}\"\n" +PRINT=" CTL{attr}=\"$ctl{attr}\"\n" +PRINT=" CTL{owner}=\"$ctl{owner}\"\n" +PRINT=" CTL{count}=\"$ctl{count}\"\n" +PRINT=" CTL{min}=\"$ctl{min}\"\n" +PRINT=" CTL{max}=\"$ctl{max}\"\n" +PRINT=" CTL{step}=\"$ctl{step}\"\n" +PRINT=" CTL{dBmin}=\"$ctl{dBmin}\"\n" +PRINT=" CTL{dBmax}=\"$ctl{dBmax}\"\n" +PRINT=" CTL{items}=\"$ctl{items}\"\n" +PRINT=" CTL{value}=\"$ctl{value}\"\n" +CTL{search}="mixer", CTL{name}="*", CTL{do_search 3}!="3", GOTO="skip_first_ten_search" +PRINT=" Element #3:\n" +PRINT=" CTL{numid}=\"$ctl{numid}\"\n" +PRINT=" CTL{iface}=\"$ctl{iface}\"\n" +PRINT=" CTL{device}=\"$ctl{device}\"\n" +PRINT=" CTL{subdevice}=\"$ctl{subdevice}\"\n" +PRINT=" CTL{name}=\"$ctl{name}\"\n" +PRINT=" CTL{index}=\"$ctl{index}\"\n" +PRINT=" CTL{type}=\"$ctl{type}\"\n" +PRINT=" CTL{attr}=\"$ctl{attr}\"\n" +PRINT=" CTL{owner}=\"$ctl{owner}\"\n" +PRINT=" CTL{count}=\"$ctl{count}\"\n" +PRINT=" CTL{min}=\"$ctl{min}\"\n" +PRINT=" CTL{max}=\"$ctl{max}\"\n" +PRINT=" CTL{dBmin}=\"$ctl{dBmin}\"\n" +PRINT=" CTL{dBmax}=\"$ctl{dBmax}\"\n" +PRINT=" CTL{step}=\"$ctl{step}\"\n" +PRINT=" CTL{items}=\"$ctl{items}\"\n" +PRINT=" CTL{value}=\"$ctl{value}\"\n" +CTL{search}="mixer", CTL{name}="*", CTL{do_search 4}!="1", GOTO="skip_first_ten_search" +PRINT=" Element #4:\n" +PRINT=" CTL{numid}=\"$ctl{numid}\"\n" +PRINT=" CTL{iface}=\"$ctl{iface}\"\n" +PRINT=" CTL{device}=\"$ctl{device}\"\n" +PRINT=" CTL{subdevice}=\"$ctl{subdevice}\"\n" +PRINT=" CTL{name}=\"$ctl{name}\"\n" +PRINT=" CTL{index}=\"$ctl{index}\"\n" +PRINT=" CTL{type}=\"$ctl{type}\"\n" +PRINT=" CTL{attr}=\"$ctl{attr}\"\n" +PRINT=" CTL{owner}=\"$ctl{owner}\"\n" +PRINT=" CTL{count}=\"$ctl{count}\"\n" +PRINT=" CTL{min}=\"$ctl{min}\"\n" +PRINT=" CTL{max}=\"$ctl{max}\"\n" +PRINT=" CTL{step}=\"$ctl{step}\"\n" +PRINT=" CTL{dBmin}=\"$ctl{dBmin}\"\n" +PRINT=" CTL{dBmax}=\"$ctl{dBmax}\"\n" +PRINT=" CTL{items}=\"$ctl{items}\"\n" +PRINT=" CTL{value}=\"$ctl{value}\"\n" +CTL{search}="mixer", CTL{name}="*", CTL{do_search 5}!="1", GOTO="skip_first_ten_search" +PRINT=" Element #5:\n" +PRINT=" CTL{numid}=\"$ctl{numid}\"\n" +PRINT=" CTL{iface}=\"$ctl{iface}\"\n" +PRINT=" CTL{device}=\"$ctl{device}\"\n" +PRINT=" CTL{subdevice}=\"$ctl{subdevice}\"\n" +PRINT=" CTL{name}=\"$ctl{name}\"\n" +PRINT=" CTL{index}=\"$ctl{index}\"\n" +PRINT=" CTL{type}=\"$ctl{type}\"\n" +PRINT=" CTL{attr}=\"$ctl{attr}\"\n" +PRINT=" CTL{owner}=\"$ctl{owner}\"\n" +PRINT=" CTL{count}=\"$ctl{count}\"\n" +PRINT=" CTL{min}=\"$ctl{min}\"\n" +PRINT=" CTL{max}=\"$ctl{max}\"\n" +PRINT=" CTL{step}=\"$ctl{step}\"\n" +PRINT=" CTL{dBmin}=\"$ctl{dBmin}\"\n" +PRINT=" CTL{dBmax}=\"$ctl{dBmax}\"\n" +PRINT=" CTL{items}=\"$ctl{items}\"\n" +PRINT=" CTL{value}=\"$ctl{value}\"\n" +CTL{search}="mixer", CTL{name}="*", CTL{do_search 6}!="1", GOTO="skip_first_ten_search" +PRINT=" Element #6:\n" +PRINT=" CTL{numid}=\"$ctl{numid}\"\n" +PRINT=" CTL{iface}=\"$ctl{iface}\"\n" +PRINT=" CTL{device}=\"$ctl{device}\"\n" +PRINT=" CTL{subdevice}=\"$ctl{subdevice}\"\n" +PRINT=" CTL{name}=\"$ctl{name}\"\n" +PRINT=" CTL{index}=\"$ctl{index}\"\n" +PRINT=" CTL{type}=\"$ctl{type}\"\n" +PRINT=" CTL{attr}=\"$ctl{attr}\"\n" +PRINT=" CTL{owner}=\"$ctl{owner}\"\n" +PRINT=" CTL{count}=\"$ctl{count}\"\n" +PRINT=" CTL{min}=\"$ctl{min}\"\n" +PRINT=" CTL{max}=\"$ctl{max}\"\n" +PRINT=" CTL{step}=\"$ctl{step}\"\n" +PRINT=" CTL{dBmin}=\"$ctl{dBmin}\"\n" +PRINT=" CTL{dBmax}=\"$ctl{dBmax}\"\n" +PRINT=" CTL{items}=\"$ctl{items}\"\n" +PRINT=" CTL{value}=\"$ctl{value}\"\n" +CTL{search}="mixer", CTL{name}="*", CTL{do_search 7}!="1", GOTO="skip_first_ten_search" +PRINT=" Element #7:\n" +PRINT=" CTL{numid}=\"$ctl{numid}\"\n" +PRINT=" CTL{iface}=\"$ctl{iface}\"\n" +PRINT=" CTL{device}=\"$ctl{device}\"\n" +PRINT=" CTL{subdevice}=\"$ctl{subdevice}\"\n" +PRINT=" CTL{name}=\"$ctl{name}\"\n" +PRINT=" CTL{index}=\"$ctl{index}\"\n" +PRINT=" CTL{type}=\"$ctl{type}\"\n" +PRINT=" CTL{attr}=\"$ctl{attr}\"\n" +PRINT=" CTL{owner}=\"$ctl{owner}\"\n" +PRINT=" CTL{count}=\"$ctl{count}\"\n" +PRINT=" CTL{min}=\"$ctl{min}\"\n" +PRINT=" CTL{max}=\"$ctl{max}\"\n" +PRINT=" CTL{step}=\"$ctl{step}\"\n" +PRINT=" CTL{dBmin}=\"$ctl{dBmin}\"\n" +PRINT=" CTL{dBmax}=\"$ctl{dBmax}\"\n" +PRINT=" CTL{items}=\"$ctl{items}\"\n" +PRINT=" CTL{value}=\"$ctl{value}\"\n" +CTL{search}="mixer", CTL{name}="*", CTL{do_search 8}!="1", GOTO="skip_first_ten_search" +PRINT=" Element #8:\n" +PRINT=" CTL{numid}=\"$ctl{numid}\"\n" +PRINT=" CTL{iface}=\"$ctl{iface}\"\n" +PRINT=" CTL{device}=\"$ctl{device}\"\n" +PRINT=" CTL{subdevice}=\"$ctl{subdevice}\"\n" +PRINT=" CTL{name}=\"$ctl{name}\"\n" +PRINT=" CTL{index}=\"$ctl{index}\"\n" +PRINT=" CTL{type}=\"$ctl{type}\"\n" +PRINT=" CTL{attr}=\"$ctl{attr}\"\n" +PRINT=" CTL{owner}=\"$ctl{owner}\"\n" +PRINT=" CTL{count}=\"$ctl{count}\"\n" +PRINT=" CTL{min}=\"$ctl{min}\"\n" +PRINT=" CTL{max}=\"$ctl{max}\"\n" +PRINT=" CTL{step}=\"$ctl{step}\"\n" +PRINT=" CTL{dBmin}=\"$ctl{dBmin}\"\n" +PRINT=" CTL{dBmax}=\"$ctl{dBmax}\"\n" +PRINT=" CTL{items}=\"$ctl{items}\"\n" +PRINT=" CTL{value}=\"$ctl{value}\"\n" +CTL{search}="mixer", CTL{name}="*", CTL{do_search 9}!="1", GOTO="skip_first_ten_search" +PRINT=" Element #9:\n" +PRINT=" CTL{numid}=\"$ctl{numid}\"\n" +PRINT=" CTL{iface}=\"$ctl{iface}\"\n" +PRINT=" CTL{device}=\"$ctl{device}\"\n" +PRINT=" CTL{subdevice}=\"$ctl{subdevice}\"\n" +PRINT=" CTL{name}=\"$ctl{name}\"\n" +PRINT=" CTL{index}=\"$ctl{index}\"\n" +PRINT=" CTL{type}=\"$ctl{type}\"\n" +PRINT=" CTL{attr}=\"$ctl{attr}\"\n" +PRINT=" CTL{owner}=\"$ctl{owner}\"\n" +PRINT=" CTL{count}=\"$ctl{count}\"\n" +PRINT=" CTL{min}=\"$ctl{min}\"\n" +PRINT=" CTL{max}=\"$ctl{max}\"\n" +PRINT=" CTL{step}=\"$ctl{step}\"\n" +PRINT=" CTL{dBmin}=\"$ctl{dBmin}\"\n" +PRINT=" CTL{dBmax}=\"$ctl{dBmax}\"\n" +PRINT=" CTL{items}=\"$ctl{items}\"\n" +PRINT=" CTL{value}=\"$ctl{value}\"\n" +LABEL="skip_first_ten_search" + +PRINT="Elements write test #1:\n", \ + CTL{search}="mixer", CTL{name}="Front Playback Switch", \ + CTL{do_search}=="1", CTL{value}="on,on", \ + PRINT=" result=$result\n" +PRINT="Elements write test #2:\n", \ + CTL{search}="mixer", CTL{name}="Front Playback Volume", \ + CTL{do_search}=="1", CTL{value}="32,32", \ + PRINT=" result=$result\n" +PRINT="Elements write test #3:\n", \ + CTL{search}="mixer", CTL{name}="Front Playback Volume Error", \ + CTL{do_search}=="1", \ +PRINT=" result=$result\n" + +#CTL{reset}="mixer", CTL{name}="Input Source", PRINT="***$ctl{enums}\n" + +PRINT="\nAll tests done..\n" diff --git a/alsactl/init_parse.c b/alsactl/init_parse.c new file mode 100644 index 0000000..ee9cc6d --- /dev/null +++ b/alsactl/init_parse.c @@ -0,0 +1,1809 @@ +/* + * Advanced Linux Sound Architecture Control Program - Parse initialization files + * Copyright (c) by Jaroslav Kysela , + * Greg Kroah-Hartman , + * Kay Sievers + * + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "aconfig.h" +#include "alsactl.h" +#include "list.h" + +#define PATH_SIZE 512 +#define NAME_SIZE 128 +#define EJUSTRETURN 0x7fffffff + +enum key_op { + KEY_OP_UNSET, + KEY_OP_MATCH, + KEY_OP_NOMATCH, + KEY_OP_ADD, + KEY_OP_ASSIGN, + KEY_OP_ASSIGN_FINAL +}; + +struct pair { + char *key; + char *value; + struct pair *next; +}; + +struct space { + struct pair *pairs; + char *rootdir; + char *go_to; + char *program_result; + const char *filename; + int linenum; + int log_run; + int exit_code; + int quit; + unsigned int ctl_id_changed; + snd_hctl_t *ctl_handle; + snd_ctl_card_info_t *ctl_card_info; + snd_ctl_elem_id_t *ctl_id; + snd_ctl_elem_info_t *ctl_info; + snd_ctl_elem_value_t *ctl_value; +}; + +static void Perror(struct space *space, const char *fmt, ...) +{ + va_list arg; + va_start(arg, fmt); + fprintf(stderr, "%s:%i: ", space->filename, space->linenum); + vfprintf(stderr, fmt, arg); + putc('\n', stderr); + va_end(arg); +} + +#include "init_sysdeps.c" +#include "init_utils_string.c" +#include "init_utils_run.c" +#include "init_sysfs.c" + +static void free_space(struct space *space) +{ + struct pair *pair = space->pairs; + struct pair *next = pair; + + while (next) { + pair = next; + next = pair->next; + free(pair->value); + free(pair->key); + free(pair); + } + space->pairs = NULL; + if (space->ctl_value) { + snd_ctl_elem_value_free(space->ctl_value); + space->ctl_value = NULL; + } + if (space->ctl_info) { + snd_ctl_elem_info_free(space->ctl_info); + space->ctl_info = NULL; + } + if (space->ctl_id) { + snd_ctl_elem_id_free(space->ctl_id); + space->ctl_id = NULL; + } + if (space->ctl_card_info) { + snd_ctl_card_info_free(space->ctl_card_info); + space->ctl_card_info = NULL; + } + if (space->ctl_handle) { + snd_hctl_close(space->ctl_handle); + space->ctl_handle = NULL; + } + if (space->rootdir) + free(space->rootdir); + if (space->program_result) + free(space->program_result); + if (space->go_to) + free(space->go_to); + free(space); +} + +static struct pair *value_find(struct space *space, const char *key) +{ + struct pair *pair = space->pairs; + + while (pair && strcmp(pair->key, key) != 0) + pair = pair->next; + return pair; +} + +static int value_set(struct space *space, const char *key, const char *value) +{ + struct pair *pair; + + pair = value_find(space, key); + if (pair) { + free(pair->value); + pair->value = strdup(value); + if (pair->value == NULL) + return -ENOMEM; + } else { + pair = malloc(sizeof(struct pair)); + if (pair == NULL) + return -ENOMEM; + pair->key = strdup(key); + if (pair->key == NULL) { + free(pair); + return -ENOMEM; + } + pair->value = strdup(value); + if (pair->value == NULL) { + free(pair->key); + free(pair); + return -ENOMEM; + } + pair->next = space->pairs; + space->pairs = pair; + } + return 0; +} + +static int init_space(struct space **space, int card) +{ + struct space *res; + char device[16]; + int err; + + res = calloc(1, sizeof(struct space)); + if (res == NULL) + return -ENOMEM; + res->ctl_id_changed = ~0; + res->linenum = -1; + sprintf(device, "hw:%d", card); + err = snd_hctl_open(&res->ctl_handle, device, 0); + if (err < 0) + goto error; + err = snd_hctl_load(res->ctl_handle); + if (err < 0) + goto error; + err = snd_ctl_card_info_malloc(&res->ctl_card_info); + if (err < 0) + goto error; + err = snd_ctl_card_info(snd_hctl_ctl(res->ctl_handle), res->ctl_card_info); + if (err < 0) + goto error; + err = snd_ctl_elem_id_malloc(&res->ctl_id); + if (err < 0) + goto error; + err = snd_ctl_elem_info_malloc(&res->ctl_info); + if (err < 0) + goto error; + err = snd_ctl_elem_value_malloc(&res->ctl_value); + if (err < 0) + goto error; + *space = res; + return 0; + error: + free_space(res); + return err; +} + +static const char *cardinfo_get(struct space *space, const char *attr) +{ + if (strncasecmp(attr, "CARD", 4) == 0) { + static char res[16]; + sprintf(res, "%u", snd_ctl_card_info_get_card(space->ctl_card_info)); + return res; + } + if (strncasecmp(attr, "ID", 2) == 0) + return snd_ctl_card_info_get_id(space->ctl_card_info); + if (strncasecmp(attr, "DRIVER", 6) == 0) + return snd_ctl_card_info_get_driver(space->ctl_card_info); + if (strncasecmp(attr, "NAME", 4) == 0) + return snd_ctl_card_info_get_name(space->ctl_card_info); + if (strncasecmp(attr, "LONGNAME", 8) == 0) + return snd_ctl_card_info_get_longname(space->ctl_card_info); + if (strncasecmp(attr, "MIXERNAME", 9) == 0) + return snd_ctl_card_info_get_mixername(space->ctl_card_info); + if (strncasecmp(attr, "COMPONENTS", 10) == 0) + return snd_ctl_card_info_get_components(space->ctl_card_info); + Perror(space, "unknown cardinfo{} attribute '%s'", attr); + return NULL; +} + +static int check_id_changed(struct space *space, unsigned int what) +{ + snd_hctl_elem_t *elem; + int err; + + if ((space->ctl_id_changed & what & 1) != 0) { + snd_ctl_elem_id_set_numid(space->ctl_id, 0); + elem = snd_hctl_find_elem(space->ctl_handle, space->ctl_id); + if (!elem) + return -ENOENT; + err = snd_hctl_elem_info(elem, space->ctl_info); + if (err == 0) + space->ctl_id_changed &= ~1; + return err; + } + if ((space->ctl_id_changed & what & 2) != 0) { + snd_ctl_elem_id_set_numid(space->ctl_id, 0); + elem = snd_hctl_find_elem(space->ctl_handle, space->ctl_id); + if (!elem) + return -ENOENT; + err = snd_hctl_elem_read(elem, space->ctl_value); + if (err == 0) + space->ctl_id_changed &= ~2; + return err; + } + return 0; +} + +static const char *get_ctl_value(struct space *space) +{ + snd_ctl_elem_type_t type; + unsigned int idx, count; + static char res[1024], tmp[16]; + static const char hex[] = "0123456789abcdef"; + char *pos; + const char *pos1; + + type = snd_ctl_elem_info_get_type(space->ctl_info); + count = snd_ctl_elem_info_get_count(space->ctl_info); + res[0] = '\0'; + switch (type) { + case SND_CTL_ELEM_TYPE_BOOLEAN: + for (idx = 0; idx < count; idx++) { + if (idx > 0) + strlcat(res, ",", sizeof(res)); + strlcat(res, snd_ctl_elem_value_get_boolean(space->ctl_value, idx) ? "on" : "off", sizeof(res)); + } + break; + case SND_CTL_ELEM_TYPE_INTEGER: + for (idx = 0; idx < count; idx++) { + if (idx > 0) + strlcat(res, ",", sizeof(res)); + snprintf(tmp, sizeof(tmp), "%li", snd_ctl_elem_value_get_integer(space->ctl_value, idx)); + strlcat(res, tmp, sizeof(res)); + } + break; + case SND_CTL_ELEM_TYPE_INTEGER64: + for (idx = 0; idx < count; idx++) { + if (idx > 0) + strlcat(res, ",", sizeof(res)); + snprintf(tmp, sizeof(tmp), "%lli", snd_ctl_elem_value_get_integer64(space->ctl_value, idx)); + strlcat(res, tmp, sizeof(res)); + } + break; + case SND_CTL_ELEM_TYPE_ENUMERATED: + for (idx = 0; idx < count; idx++) { + if (idx > 0) + strlcat(res, ",", sizeof(res)); + snprintf(tmp, sizeof(tmp), "%u", snd_ctl_elem_value_get_enumerated(space->ctl_value, idx)); + strlcat(res, tmp, sizeof(res)); + } + break; + case SND_CTL_ELEM_TYPE_BYTES: + case SND_CTL_ELEM_TYPE_IEC958: + if (type == SND_CTL_ELEM_TYPE_IEC958) + count = sizeof(snd_aes_iec958_t); + if (count > (sizeof(res)-1)/2) + count = (sizeof(res)-1/2); + pos = res; + pos1 = snd_ctl_elem_value_get_bytes(space->ctl_value); + while (count > 0) { + idx = *pos1++; + *pos++ = hex[idx >> 4]; + *pos++ = hex[idx & 0x0f]; + count++; + } + *pos++ = '\0'; + break; + default: + Perror(space, "unknown element type '%i'", type); + return NULL; + } + return res; +} + +/* Function to convert from percentage to volume. val = percentage */ +#define convert_prange1(val, min, max) \ + ceil((val) * ((max) - (min)) * 0.01 + (min)) + +static int set_ctl_value(struct space *space, const char *value, int all) +{ + snd_ctl_elem_type_t type; + unsigned int idx, idx2, count, items; + const char *pos, *pos2; + snd_hctl_elem_t *elem; + int val; + long lval; + + type = snd_ctl_elem_info_get_type(space->ctl_info); + count = snd_ctl_elem_info_get_count(space->ctl_info); + switch (type) { + case SND_CTL_ELEM_TYPE_BOOLEAN: + for (idx = 0; idx < count; idx++) { + while (*value == ' ') + value++; + if (*value == '\0') + goto missing; + val = strncasecmp(value, "true", 4) == 0 || + strncasecmp(value, "yes", 3) == 0 || + strncasecmp(value, "on", 2) == 0 || + strncasecmp(value, "1", 1) == 0; + snd_ctl_elem_value_set_boolean(space->ctl_value, idx, val); + if (all) + continue; + pos = strchr(value, ','); + value = pos ? pos + 1 : value + strlen(value) - 1; + } + break; + case SND_CTL_ELEM_TYPE_INTEGER: + for (idx = 0; idx < count; idx++) { + while (*value == ' ') + value++; + pos = strchr(value, ','); + if (pos) + *(char *)pos = '\0'; + remove_trailing_chars((char *)value, ' '); + items = pos ? pos - value : strlen(value); + if (items > 1 && value[items-1] == '%') { + val = convert_prange1(strtol(value, NULL, 0), snd_ctl_elem_info_get_min(space->ctl_info), snd_ctl_elem_info_get_max(space->ctl_info)); + snd_ctl_elem_value_set_integer(space->ctl_value, idx, val); + } else if (items > 2 && value[items-2] == 'd' && value[items-1] == 'B') { + val = strtol(value, NULL, 0) * 100; + if ((pos2 = strchr(value, '.')) != NULL) { + if (isdigit(*(pos2-1)) && isdigit(*(pos2-2))) { + if (val < 0) + val -= strtol(pos2 + 1, NULL, 0); + else + val += strtol(pos2 + 1, NULL, 0); + } else if (isdigit(*(pos2-1))) { + if (val < 0) + val -= strtol(pos2 + 1, NULL, 0) * 10; + else + val += strtol(pos2 + 1, NULL, 0) * 10; + } + } + val = snd_ctl_convert_from_dB(snd_hctl_ctl(space->ctl_handle), space->ctl_id, val, &lval, -1); + if (val < 0) { + dbg("unable to convert dB value '%s' to internal integer range", value); + return val; + } + snd_ctl_elem_value_set_integer(space->ctl_value, idx, lval); + } else { + snd_ctl_elem_value_set_integer(space->ctl_value, idx, strtol(value, NULL, 0)); + } + if (all) + continue; + value = pos ? pos + 1 : value + strlen(value) - 1; + } + break; + case SND_CTL_ELEM_TYPE_INTEGER64: + for (idx = 0; idx < count; idx++) { + while (*value == ' ') + value++; + snd_ctl_elem_value_set_integer64(space->ctl_value, idx, strtoll(value, NULL, 0)); + if (all) + continue; + pos = strchr(value, ','); + value = pos ? pos + 1 : value + strlen(value) - 1; + } + break; + case SND_CTL_ELEM_TYPE_ENUMERATED: + for (idx = 0; idx < count; idx++) { + while (*value == ' ') + value++; + pos = strchr(value, ','); + if (isdigit(value[0]) || value[0] == '-') { + snd_ctl_elem_value_set_enumerated(space->ctl_value, idx, strtol(value, NULL, 0)); + } else { + if (pos) + *(char *)pos = '\0'; + remove_trailing_chars((char *)value, ' '); + items = snd_ctl_elem_info_get_items(space->ctl_info); + for (idx2 = 0; idx2 < items; idx2++) { + snd_ctl_elem_info_set_item(space->ctl_info, idx2); + elem = snd_hctl_find_elem(space->ctl_handle, space->ctl_id); + if (elem == NULL) + return -ENOENT; + val = snd_hctl_elem_info(elem, space->ctl_info); + if (val < 0) + return val; + if (strcasecmp(snd_ctl_elem_info_get_item_name(space->ctl_info), value) == 0) { + snd_ctl_elem_value_set_enumerated(space->ctl_value, idx, idx2); + break; + } + } + if (idx2 >= items) { + Perror(space, "wrong enum identifier '%s'", value); + return -EINVAL; + } + } + if (all) + continue; + value = pos ? pos + 1 : value + strlen(value) - 1; + } + break; + case SND_CTL_ELEM_TYPE_BYTES: + case SND_CTL_ELEM_TYPE_IEC958: + if (type == SND_CTL_ELEM_TYPE_IEC958) + count = sizeof(snd_aes_iec958_t); + while (*value == ' ') + value++; + if (strlen(value) != count * 2) { + Perror(space, "bad ctl value hexa length (should be %u bytes)", count); + return -EINVAL; + } + for (idx = 0; idx < count; idx += 2) { + val = hextodigit(*(value++)) << 4; + val |= hextodigit(*(value++)); + if (val > 255) { + Perror(space, "bad ctl hexa value"); + return -EINVAL; + } + snd_ctl_elem_value_set_byte(space->ctl_value, idx, val); + } + break; + default: + Perror(space, "unknown element type '%i'", type); + return -EINVAL; + } + return 0; + missing: + Perror(space, "missing some ctl values (line %i)", space->linenum); + return -EINVAL; +} + +static int do_match(const char *key, enum key_op op, + const char *key_value, const char *value) +{ + int match; + + if (value == NULL) + return 0; + dbg("match %s '%s' <-> '%s'", key, key_value, value); + match = fnmatch(key_value, value, 0) == 0; + if (match && op == KEY_OP_MATCH) { + dbg("%s is true (matching value)", key); + return 1; + } + if (!match && op == KEY_OP_NOMATCH) { + dbg("%s is true (non-matching value)", key); + return 1; + } + dbg("%s is false", key); + return 0; +} + +static int ctl_match(snd_ctl_elem_id_t *pattern, snd_ctl_elem_id_t *id) +{ + if (snd_ctl_elem_id_get_interface(pattern) != -1 && + snd_ctl_elem_id_get_interface(pattern) != snd_ctl_elem_id_get_interface(id)) + return 0; + if (snd_ctl_elem_id_get_device(pattern) != -1 && + snd_ctl_elem_id_get_device(pattern) != snd_ctl_elem_id_get_device(id)) + return 0; + if (snd_ctl_elem_id_get_subdevice(pattern) != -1 && + snd_ctl_elem_id_get_subdevice(pattern) != snd_ctl_elem_id_get_subdevice(id)) + return 0; + if (snd_ctl_elem_id_get_index(pattern) != -1 && + snd_ctl_elem_id_get_index(pattern) != snd_ctl_elem_id_get_index(id)) + return 0; + if (fnmatch(snd_ctl_elem_id_get_name(pattern), snd_ctl_elem_id_get_name(id), 0) != 0) + return 0; + return 1; +} + +static const char *elemid_get(struct space *space, const char *attr) +{ + long long val; + snd_ctl_elem_type_t type; + static char res[256]; + + if (strncasecmp(attr, "numid", 5) == 0) { + val = snd_ctl_elem_id_get_numid(space->ctl_id); + goto value; + } + if (strncasecmp(attr, "iface", 5) == 0 || + strncasecmp(attr, "interface", 9) == 0) + return snd_ctl_elem_iface_name(snd_ctl_elem_id_get_interface(space->ctl_id)); + if (strncasecmp(attr, "device", 6) == 0) { + val = snd_ctl_elem_id_get_device(space->ctl_id); + goto value; + } + if (strncasecmp(attr, "subdev", 6) == 0) { + val = snd_ctl_elem_id_get_subdevice(space->ctl_id); + goto value; + } + if (strncasecmp(attr, "name", 4) == 0) + return snd_ctl_elem_id_get_name(space->ctl_id); + if (strncasecmp(attr, "index", 5) == 0) { + val = snd_ctl_elem_id_get_index(space->ctl_id); + goto value; + } + if (strncasecmp(attr, "type", 4) == 0) { + if (check_id_changed(space, 1)) + return NULL; + return snd_ctl_elem_type_name(snd_ctl_elem_info_get_type(space->ctl_info)); + } + if (strncasecmp(attr, "attr", 4) == 0) { + if (check_id_changed(space, 1)) + return NULL; + res[0] = '\0'; + if (snd_ctl_elem_info_is_readable(space->ctl_info)) + strcat(res, "r"); + if (snd_ctl_elem_info_is_writable(space->ctl_info)) + strcat(res, "w"); + if (snd_ctl_elem_info_is_volatile(space->ctl_info)) + strcat(res, "v"); + if (snd_ctl_elem_info_is_inactive(space->ctl_info)) + strcat(res, "i"); + if (snd_ctl_elem_info_is_locked(space->ctl_info)) + strcat(res, "l"); + if (snd_ctl_elem_info_is_tlv_readable(space->ctl_info)) + strcat(res, "R"); + if (snd_ctl_elem_info_is_tlv_writable(space->ctl_info)) + strcat(res, "W"); + if (snd_ctl_elem_info_is_tlv_commandable(space->ctl_info)) + strcat(res, "C"); + if (snd_ctl_elem_info_is_owner(space->ctl_info)) + strcat(res, "o"); + if (snd_ctl_elem_info_is_user(space->ctl_info)) + strcat(res, "u"); + return res; + } + if (strncasecmp(attr, "owner", 5) == 0) { + if (check_id_changed(space, 1)) + return NULL; + val = snd_ctl_elem_info_get_owner(space->ctl_info); + goto value; + } + if (strncasecmp(attr, "count", 5) == 0) { + if (check_id_changed(space, 1)) + return NULL; + val = snd_ctl_elem_info_get_count(space->ctl_info); + goto value; + } + if (strncasecmp(attr, "min", 3) == 0) { + if (check_id_changed(space, 1)) + return NULL; + type = snd_ctl_elem_info_get_type(space->ctl_info); + if (type == SND_CTL_ELEM_TYPE_INTEGER64) + val = snd_ctl_elem_info_get_min64(space->ctl_info); + else if (type == SND_CTL_ELEM_TYPE_INTEGER) + val = snd_ctl_elem_info_get_min(space->ctl_info); + else + goto empty; + goto value; + } + if (strncasecmp(attr, "max", 3) == 0) { + if (check_id_changed(space, 1)) + return NULL; + type = snd_ctl_elem_info_get_type(space->ctl_info); + if (type == SND_CTL_ELEM_TYPE_INTEGER64) + val = snd_ctl_elem_info_get_max64(space->ctl_info); + else if (type == SND_CTL_ELEM_TYPE_INTEGER) + val = snd_ctl_elem_info_get_max(space->ctl_info); + else + goto empty; + goto value; + } + if (strncasecmp(attr, "step", 3) == 0) { + if (check_id_changed(space, 1)) + return NULL; + type = snd_ctl_elem_info_get_type(space->ctl_info); + if (type == SND_CTL_ELEM_TYPE_INTEGER64) + val = snd_ctl_elem_info_get_step64(space->ctl_info); + else if (type == SND_CTL_ELEM_TYPE_INTEGER) + val = snd_ctl_elem_info_get_step(space->ctl_info); + else + goto empty; + goto value; + } + if (strncasecmp(attr, "items", 5) == 0) { + if (check_id_changed(space, 1)) + return NULL; + if (snd_ctl_elem_info_get_type(space->ctl_info) == SND_CTL_ELEM_TYPE_ENUMERATED) + val = snd_ctl_elem_info_get_items(space->ctl_info); + else { + empty: + res[0] = '\0'; + return res; + } + goto value; + } + if (strncasecmp(attr, "value", 5) == 0) { + if (check_id_changed(space, 3)) + return NULL; + return get_ctl_value(space); + } + if (strncasecmp(attr, "dBmin", 5) == 0) { + long min, max; + if (check_id_changed(space, 1)) + return NULL; + if (snd_ctl_get_dB_range(snd_hctl_ctl(space->ctl_handle), space->ctl_id, &min, &max) < 0) + goto empty; + val = min; +dbvalue: + sprintf(res, "%li.%02idB", (long)(val / 100), (int)abs(val % 100)); + return res; + } + if (strncasecmp(attr, "dBmax", 5) == 0) { + long min, max; + if (check_id_changed(space, 1)) + return NULL; + if (snd_ctl_get_dB_range(snd_hctl_ctl(space->ctl_handle), space->ctl_id, &min, &max) < 0) + goto empty; + val = max; + goto dbvalue; + } + if (strncasecmp(attr, "enums", 5) == 0) { + unsigned int idx, items; + snd_hctl_elem_t *elem; + if (check_id_changed(space, 1)) + return NULL; + if (snd_ctl_elem_info_get_type(space->ctl_info) != SND_CTL_ELEM_TYPE_ENUMERATED) + goto empty; + items = snd_ctl_elem_info_get_items(space->ctl_info); + strcpy(res, "|"); + for (idx = 0; idx < items; idx++) { + snd_ctl_elem_info_set_item(space->ctl_info, idx); + elem = snd_hctl_find_elem(space->ctl_handle, space->ctl_id); + if (elem == NULL) + break; + if (snd_hctl_elem_info(elem, space->ctl_info) < 0) + break; + strlcat(res, snd_ctl_elem_info_get_item_name(space->ctl_info), sizeof(res)); + strlcat(res, "|", sizeof(res)); + } + return res; + } + if (strncasecmp(attr, "do_search", 9) == 0) { + int err, index = 0; + snd_hctl_elem_t *elem; + snd_ctl_elem_id_t *id; + char *pos = strchr(attr, ' '); + if (pos) + index = strtol(pos, NULL, 0); + err = snd_ctl_elem_id_malloc(&id); + if (err < 0) + return NULL; + elem = snd_hctl_first_elem(space->ctl_handle); + while (elem) { + snd_hctl_elem_get_id(elem, id); + if (!ctl_match(space->ctl_id, id)) + goto next_search; + if (index > 0) { + index--; + goto next_search; + } + strcpy(res, "1"); + snd_ctl_elem_id_copy(space->ctl_id, id); + snd_ctl_elem_id_free(id); + dbg("do_ctl_search found a control"); + return res; + next_search: + elem = snd_hctl_elem_next(elem); + } + snd_ctl_elem_id_free(id); + strcpy(res, "0"); + return res; + } + if (strncasecmp(attr, "do_count", 8) == 0) { + int err, index = 0; + snd_hctl_elem_t *elem; + snd_ctl_elem_id_t *id; + err = snd_ctl_elem_id_malloc(&id); + if (err < 0) + return NULL; + elem = snd_hctl_first_elem(space->ctl_handle); + while (elem) { + snd_hctl_elem_get_id(elem, id); + if (ctl_match(space->ctl_id, id)) + index++; + elem = snd_hctl_elem_next(elem); + } + snd_ctl_elem_id_free(id); + sprintf(res, "%d", index); + dbg("do_ctl_count found %s controls", res); + return res; + } + Perror(space, "unknown ctl{} attribute '%s'", attr); + return NULL; + value: + sprintf(res, "%lli", val); + return res; +} + +static int elemid_set(struct space *space, const char *attr, const char *value) +{ + unsigned int val; + void (*fcn)(snd_ctl_elem_id_t *, unsigned int); + snd_ctl_elem_iface_t iface; + int err; + + if (strncasecmp(attr, "numid", 5) == 0) { + fcn = snd_ctl_elem_id_set_numid; + goto value; + } + if (strncasecmp(attr, "iface", 5) == 0 || + strncasecmp(attr, "interface", 9) == 0 || + strncasecmp(attr, "reset", 5) == 0 || + strncasecmp(attr, "search", 6) == 0) { + if (strlen(value) == 0 && strncasecmp(attr, "search", 6) == 0) { + iface = 0; + goto search; + } + for (iface = 0; iface <= SND_CTL_ELEM_IFACE_LAST; iface++) { + if (strcasecmp(value, snd_ctl_elem_iface_name(iface)) == 0) { + if (strncasecmp(attr, "reset", 5) == 0) + snd_ctl_elem_id_clear(space->ctl_id); + if (strncasecmp(attr, "search", 5) == 0) { + search: + snd_ctl_elem_id_clear(space->ctl_id); + /* -1 means all */ + snd_ctl_elem_id_set_interface(space->ctl_id, -1); + snd_ctl_elem_id_set_device(space->ctl_id, -1); + snd_ctl_elem_id_set_subdevice(space->ctl_id, -1); + snd_ctl_elem_id_set_name(space->ctl_id, "*"); + snd_ctl_elem_id_set_index(space->ctl_id, -1); + if (strlen(value) == 0) + return 0; + } + snd_ctl_elem_id_set_interface(space->ctl_id, iface); + space->ctl_id_changed = ~0; + return 0; + } + } + Perror(space, "unknown control interface name '%s'", value); + return -EINVAL; + } + if (strncasecmp(attr, "device", 6) == 0) { + fcn = snd_ctl_elem_id_set_device; + goto value; + } + if (strncasecmp(attr, "subdev", 6) == 0) { + fcn = snd_ctl_elem_id_set_subdevice; + goto value; + } + if (strncasecmp(attr, "name", 4) == 0) { + snd_ctl_elem_id_set_name(space->ctl_id, value); + space->ctl_id_changed = ~0; + return 0; + } + if (strncasecmp(attr, "index", 5) == 0) { + fcn = snd_ctl_elem_id_set_index; + goto value; + } + if (strncasecmp(attr, "values", 6) == 0 || + strncasecmp(attr, "value", 5) == 0) { + err = check_id_changed(space, 1); + if (err < 0) { + Perror(space, "control element not found"); + return err; + } + err = set_ctl_value(space, value, strncasecmp(attr, "values", 6) == 0); + if (err < 0) { + space->ctl_id_changed |= 2; + } else { + space->ctl_id_changed &= ~2; + snd_ctl_elem_value_set_id(space->ctl_value, space->ctl_id); + err = snd_ctl_elem_write(snd_hctl_ctl(space->ctl_handle), space->ctl_value); + if (err < 0) { + Perror(space, "value write error: %s", snd_strerror(err)); + return err; + } + } + return err; + } + Perror(space, "unknown CTL{} attribute '%s'", attr); + return -EINVAL; + value: + val = (unsigned int)strtol(value, NULL, 0); + fcn(space->ctl_id, val); + space->ctl_id_changed = ~0; + return 0; +} + +static int get_key(char **line, char **key, enum key_op *op, char **value) +{ + char *linepos; + char *temp; + + linepos = *line; + if (linepos == NULL && linepos[0] == '\0') + return -EINVAL; + + /* skip whitespace */ + while (isspace(linepos[0]) || linepos[0] == ',') + linepos++; + + /* get the key */ + if (linepos[0] == '\0') + return -EINVAL; + *key = linepos; + + while (1) { + linepos++; + if (linepos[0] == '\0') + return -1; + if (isspace(linepos[0])) + break; + if (linepos[0] == '=') + break; + if (linepos[0] == '+') + break; + if (linepos[0] == '!') + break; + if (linepos[0] == ':') + break; + } + + /* remember end of key */ + temp = linepos; + + /* skip whitespace after key */ + while (isspace(linepos[0])) + linepos++; + if (linepos[0] == '\0') + return -EINVAL; + + /* get operation type */ + if (linepos[0] == '=' && linepos[1] == '=') { + *op = KEY_OP_MATCH; + linepos += 2; + dbg("operator=match"); + } else if (linepos[0] == '!' && linepos[1] == '=') { + *op = KEY_OP_NOMATCH; + linepos += 2; + dbg("operator=nomatch"); + } else if (linepos[0] == '+' && linepos[1] == '=') { + *op = KEY_OP_ADD; + linepos += 2; + dbg("operator=add"); + } else if (linepos[0] == '=') { + *op = KEY_OP_ASSIGN; + linepos++; + dbg("operator=assign"); + } else if (linepos[0] == ':' && linepos[1] == '=') { + *op = KEY_OP_ASSIGN_FINAL; + linepos += 2; + dbg("operator=assign_final"); + } else + return -EINVAL; + + /* terminate key */ + temp[0] = '\0'; + dbg("key='%s'", *key); + + /* skip whitespace after operator */ + while (isspace(linepos[0])) + linepos++; + if (linepos[0] == '\0') + return -EINVAL; + + /* get the value*/ + if (linepos[0] != '"') + return -EINVAL; + linepos++; + *value = linepos; + + while (1) { + temp = strchr(linepos, '"'); + if (temp && temp[-1] == '\\') { + linepos = temp + 1; + continue; + } + break; + } + if (!temp) + return -EINVAL; + temp[0] = '\0'; + temp++; + dbg("value='%s'", *value); + + /* move line to next key */ + *line = temp; + + return 0; +} + +/* extract possible KEY{attr} */ +static char *get_key_attribute(struct space *space, char *str, char *res, size_t ressize) +{ + char *pos; + char *attr; + + attr = strchr(str, '{'); + if (attr != NULL) { + attr++; + pos = strchr(attr, '}'); + if (pos == NULL) { + Perror(space, "missing closing brace for format"); + return NULL; + } + pos[0] = '\0'; + strlcpy(res, attr, ressize); + pos[0] = '}'; + dbg("attribute='%s'", res); + return res; + } + + return NULL; +} + +/* extract possible {attr} and move str behind it */ +static char *get_format_attribute(struct space *space, char **str) +{ + char *pos; + char *attr = NULL; + + if (*str[0] == '{') { + pos = strchr(*str, '}'); + if (pos == NULL) { + Perror(space, "missing closing brace for format"); + return NULL; + } + pos[0] = '\0'; + attr = *str+1; + *str = pos+1; + dbg("attribute='%s', str='%s'", attr, *str); + } + return attr; +} + +/* extract possible format length and move str behind it*/ +static int get_format_len(struct space *space, char **str) +{ + int num; + char *tail; + + if (isdigit(*str[0])) { + num = (int) strtoul(*str, &tail, 10); + if (num > 0) { + *str = tail; + dbg("format length=%i", num); + return num; + } else { + Perror(space, "format parsing error '%s'", *str); + } + } + return -1; +} + +static void apply_format(struct space *space, char *string, size_t maxsize) +{ + char temp[PATH_SIZE]; + char temp2[PATH_SIZE]; + char *head, *tail, *pos, *cpos, *attr, *rest; + struct pair *pair; + int len; + int i; + int count; + enum subst_type { + SUBST_UNKNOWN, + SUBST_CARDINFO, + SUBST_CTL, + SUBST_RESULT, + SUBST_ATTR, + SUBST_SYSFSROOT, + SUBST_ENV, + SUBST_CONFIG, + }; + static const struct subst_map { + char *name; + char fmt; + enum subst_type type; + } map[] = { + { .name = "cardinfo", .fmt = 'i', .type = SUBST_CARDINFO }, + { .name = "ctl", .fmt = 'C', .type = SUBST_CTL }, + { .name = "result", .fmt = 'c', .type = SUBST_RESULT }, + { .name = "attr", .fmt = 's', .type = SUBST_ATTR }, + { .name = "sysfsroot", .fmt = 'r', .type = SUBST_SYSFSROOT }, + { .name = "env", .fmt = 'E', .type = SUBST_ENV }, + { .name = "config", .fmt = 'g', .type = SUBST_CONFIG }, + { NULL, '\0', 0 } + }; + enum subst_type type; + const struct subst_map *subst; + + head = string; + while (1) { + len = -1; + while (head[0] != '\0') { + if (head[0] == '$') { + /* substitute named variable */ + if (head[1] == '\0') + break; + if (head[1] == '$') { + strlcpy(temp, head+2, sizeof(temp)); + strlcpy(head+1, temp, maxsize); + head++; + continue; + } + head[0] = '\0'; + for (subst = map; subst->name; subst++) { + if (strncasecmp(&head[1], subst->name, strlen(subst->name)) == 0) { + type = subst->type; + tail = head + strlen(subst->name)+1; + dbg("will substitute format name '%s'", subst->name); + goto found; + } + } + } else if (head[0] == '%') { + /* substitute format char */ + if (head[1] == '\0') + break; + if (head[1] == '%') { + strlcpy(temp, head+2, sizeof(temp)); + strlcpy(head+1, temp, maxsize); + head++; + continue; + } + head[0] = '\0'; + tail = head+1; + len = get_format_len(space, &tail); + for (subst = map; subst->name; subst++) { + if (tail[0] == subst->fmt) { + type = subst->type; + tail++; + dbg("will substitute format char '%c'", subst->fmt); + goto found; + } + } + } + head++; + } + break; +found: + attr = get_format_attribute(space, &tail); + strlcpy(temp, tail, sizeof(temp)); + dbg("format=%i, string='%s', tail='%s'", type ,string, tail); + + switch (type) { + case SUBST_CARDINFO: + if (attr == NULL) + Perror(space, "missing identification parametr for cardinfo"); + else { + const char *value = cardinfo_get(space, attr); + if (value == NULL) + break; + strlcat(string, value, maxsize); + dbg("substitute cardinfo{%s} '%s'", attr, value); + } + break; + case SUBST_CTL: + if (attr == NULL) + Perror(space, "missing identification parametr for ctl"); + else { + const char *value = elemid_get(space, attr); + if (value == NULL) + break; + strlcat(string, value, maxsize); + dbg("substitute ctl{%s} '%s'", attr, value); + } + break; + case SUBST_RESULT: + if (space->program_result == NULL) + break; + /* get part part of the result string */ + i = 0; + if (attr != NULL) + i = strtoul(attr, &rest, 10); + if (i > 0) { + dbg("request part #%d of result string", i); + cpos = space->program_result; + while (--i) { + while (cpos[0] != '\0' && !isspace(cpos[0])) + cpos++; + while (isspace(cpos[0])) + cpos++; + } + if (i > 0) { + Perror(space, "requested part of result string not found"); + break; + } + strlcpy(temp2, cpos, sizeof(temp2)); + /* %{2+}c copies the whole string from the second part on */ + if (rest[0] != '+') { + cpos = strchr(temp2, ' '); + if (cpos) + cpos[0] = '\0'; + } + strlcat(string, temp2, maxsize); + dbg("substitute part of result string '%s'", temp2); + } else { + strlcat(string, space->program_result, maxsize); + dbg("substitute result string '%s'", space->program_result); + } + break; + case SUBST_ATTR: + if (attr == NULL) + Perror(space, "missing file parameter for attr"); + else { + const char *value = NULL; + size_t size; + + pair = value_find(space, "sysfs_device"); + if (pair == NULL) + break; + value = sysfs_attr_get_value(pair->value, attr); + + if (value == NULL) + break; + + /* strip trailing whitespace and replace untrusted characters of sysfs value */ + size = strlcpy(temp2, value, sizeof(temp2)); + if (size >= sizeof(temp2)) + size = sizeof(temp2)-1; + while (size > 0 && isspace(temp2[size-1])) + temp2[--size] = '\0'; + count = replace_untrusted_chars(temp2); + if (count > 0) + Perror(space, "%i untrusted character(s) replaced" , count); + strlcat(string, temp2, maxsize); + dbg("substitute sysfs value '%s'", temp2); + } + break; + case SUBST_SYSFSROOT: + strlcat(string, sysfs_path, maxsize); + dbg("substitute sysfs_path '%s'", sysfs_path); + break; + case SUBST_ENV: + if (attr == NULL) { + dbg("missing attribute"); + break; + } + pos = getenv(attr); + if (pos == NULL) { + dbg("env '%s' not available", attr); + break; + } + dbg("substitute env '%s=%s'", attr, pos); + strlcat(string, pos, maxsize); + break; + case SUBST_CONFIG: + if (attr == NULL) { + dbg("missing attribute"); + break; + } + pair = value_find(space, attr); + if (pair == NULL) + break; + strlcat(string, pair->value, maxsize); + break; + default: + Perror(space, "unknown substitution type=%i", type); + break; + } + /* possibly truncate to format-char specified length */ + if (len != -1) { + head[len] = '\0'; + dbg("truncate to %i chars, subtitution string becomes '%s'", len, head); + } + strlcat(string, temp, maxsize); + } + /* unescape strings */ + head = tail = string; + while (*head != '\0') { + if (*head == '\\') { + head++; + if (*head == '\0') + break; + switch (*head) { + case 'a': *tail++ = '\a'; break; + case 'b': *tail++ = '\b'; break; + case 'n': *tail++ = '\n'; break; + case 'r': *tail++ = '\r'; break; + case 't': *tail++ = '\t'; break; + case 'v': *tail++ = '\v'; break; + case '\\': *tail++ = '\\'; break; + default: *tail++ = *head; break; + } + head++; + continue; + } + if (*head) + *tail++ = *head++; + } + *tail = 0; +} + +static +int run_program1(struct space *space, + const char *command0, char *result, + size_t ressize, size_t *reslen, int log) +{ + if (strncmp(command0, "__ctl_search", 12) == 0) { + const char *res = elemid_get(space, "do_search"); + if (res == NULL || strcmp(res, "1") != 0) + return EXIT_FAILURE; + return EXIT_SUCCESS; + } + if (strncmp(command0, "__ctl_count", 11) == 0) { + const char *res = elemid_get(space, "do_count"); + if (res == NULL || strcmp(res, "0") == 0) + return EXIT_FAILURE; + strlcpy(result, res, ressize); + return EXIT_SUCCESS; + } + Perror(space, "unknown buildin command '%s'", command0); + return EXIT_FAILURE; +} + +static int parse(struct space *space, const char *filename); + +static char *new_root_dir(const char *filename) +{ + char *res, *tmp; + + res = strdup(filename); + if (res) { + tmp = strrchr(res, '/'); + if (tmp) + *tmp = '\0'; + } + dbg("new_root_dir '%s' '%s'", filename, res); + return res; +} + +/* return non-zero if the file name has the extension ".conf" */ +static int conf_name_filter(const struct dirent *d) +{ + char *ext = strrchr(d->d_name, '.'); + return ext && !strcmp(ext, ".conf"); +} + +static int parse_line(struct space *space, char *line, size_t linesize) +{ + char *linepos; + char *key, *value, *attr, *temp; + struct pair *pair; + enum key_op op; + int err = 0, count; + char string[PATH_SIZE]; + char result[PATH_SIZE]; + + linepos = line; + while (*linepos != '\0') { + op = KEY_OP_UNSET; + + err = get_key(&linepos, &key, &op, &value); + if (err < 0) + goto invalid; + + if (strncasecmp(key, "LABEL", 5) == 0) { + if (op != KEY_OP_ASSIGN) { + Perror(space, "invalid LABEL operation"); + goto invalid; + } + if (space->go_to && strcmp(space->go_to, value) == 0) { + free(space->go_to); + space->go_to = NULL; + } + continue; + } + + if (space->go_to) { + dbg("skip (GOTO '%s')", space->go_to); + break; /* not for us */ + } + + if (strncasecmp(key, "CTL{", 4) == 0) { + attr = get_key_attribute(space, key + 3, string, sizeof(string)); + if (attr == NULL) { + Perror(space, "error parsing CTL attribute"); + goto invalid; + } + if (op == KEY_OP_ASSIGN) { + strlcpy(result, value, sizeof(result)); + apply_format(space, result, sizeof(result)); + dbg("ctl assign: '%s' '%s'", value, attr); + err = elemid_set(space, attr, result); + if (space->program_result) { + free(space->program_result); + space->program_result = NULL; + } + snprintf(string, sizeof(string), "%i", err); + space->program_result = strdup(string); + err = 0; + if (space->program_result == NULL) + break; + } else if (op == KEY_OP_MATCH || op == KEY_OP_NOMATCH) { + if (strncmp(attr, "write", 5) == 0) { + strlcpy(result, value, sizeof(result)); + apply_format(space, result, sizeof(result)); + dbg("ctl write: '%s' '%s'", value, attr); + err = elemid_set(space, "values", result); + if (err == 0 && op == KEY_OP_NOMATCH) + break; + if (err != 0 && op == KEY_OP_MATCH) + break; + } else { + temp = (char *)elemid_get(space, attr); + dbg("ctl match: '%s' '%s' '%s'", attr, value, temp); + if (!do_match(key, op, value, temp)) + break; + } + } else { + Perror(space, "invalid CTL{} operation"); + goto invalid; + } + continue; + } + if (strcasecmp(key, "RESULT") == 0) { + if (op == KEY_OP_MATCH || op == KEY_OP_NOMATCH) { + if (!do_match(key, op, value, space->program_result)) + break; + } else if (op == KEY_OP_ASSIGN) { + if (space->program_result) { + free(space->program_result); + space->program_result = NULL; + } + strlcpy(string, value, sizeof(string)); + apply_format(space, string, sizeof(string)); + space->program_result = strdup(string); + if (space->program_result == NULL) + break; + } else { + Perror(space, "invalid RESULT operation"); + goto invalid; + } + continue; + } + if (strcasecmp(key, "PROGRAM") == 0) { + if (op == KEY_OP_UNSET) + continue; + strlcpy(string, value, sizeof(string)); + apply_format(space, string, sizeof(string)); + if (space->program_result) { + free(space->program_result); + space->program_result = NULL; + } + if (run_program(space, string, result, sizeof(result), NULL, space->log_run) != 0) { + dbg("PROGRAM '%s' is false", string); + if (op != KEY_OP_NOMATCH) + break; + } else { + remove_trailing_chars(result, '\n'); + count = replace_untrusted_chars(result); + if (count) + info("%i untrusted character(s) replaced", count); + dbg("PROGRAM '%s' result is '%s'", string, result); + space->program_result = strdup(result); + if (space->program_result == NULL) + break; + dbg("PROGRAM returned successful"); + if (op == KEY_OP_NOMATCH) + break; + } + dbg("PROGRAM key is true"); + continue; + } + if (strncasecmp(key, "CARDINFO{", 9) == 0) { + attr = get_key_attribute(space, key + 8, string, sizeof(string)); + if (attr == NULL) { + Perror(space, "error parsing CARDINFO attribute"); + goto invalid; + } + if (op == KEY_OP_MATCH || op == KEY_OP_NOMATCH) { + dbg("cardinfo: '%s' '%s'", value, attr); + temp = (char *)cardinfo_get(space, attr); + if (!do_match(key, op, value, temp)) + break; + } else { + Perror(space, "invalid CARDINFO{} operation"); + goto invalid; + } + continue; + } + if (strncasecmp(key, "ATTR{", 5) == 0) { + attr = get_key_attribute(space, key + 4, string, sizeof(string)); + if (attr == NULL) { + Perror(space, "error parsing ATTR attribute"); + goto invalid; + } + if (op == KEY_OP_MATCH || op == KEY_OP_NOMATCH) { + pair = value_find(space, "sysfs_device"); + if (pair == NULL) + break; + dbg("sysfs_attr: '%s' '%s'", pair->value, attr); + temp = sysfs_attr_get_value(pair->value, attr); + if (!do_match(key, op, value, temp)) + break; + } else { + Perror(space, "invalid ATTR{} operation"); + goto invalid; + } + continue; + } + if (strncasecmp(key, "ENV{", 4) == 0) { + attr = get_key_attribute(space, key + 3, string, sizeof(string)); + if (attr == NULL) { + Perror(space, "error parsing ENV attribute"); + goto invalid; + } + if (op == KEY_OP_MATCH || op == KEY_OP_NOMATCH) { + temp = getenv(attr); + dbg("env: '%s' '%s'", attr, temp); + if (!do_match(key, op, value, temp)) + break; + } else if (op == KEY_OP_ASSIGN || + op == KEY_OP_ASSIGN_FINAL) { + strlcpy(result, value, sizeof(result)); + apply_format(space, result, sizeof(result)); + dbg("env set: '%s' '%s'", attr, result); + if (setenv(attr, result, op == KEY_OP_ASSIGN_FINAL)) + break; + } else { + Perror(space, "invalid ENV{} operation"); + goto invalid; + } + continue; + } + if (strcasecmp(key, "GOTO") == 0) { + if (op != KEY_OP_ASSIGN) { + Perror(space, "invalid GOTO operation"); + goto invalid; + } + space->go_to = strdup(value); + if (space->go_to == NULL) { + err = -ENOMEM; + break; + } + continue; + } + if (strcasecmp(key, "INCLUDE") == 0) { + char *rootdir, *go_to; + const char *filename; + struct stat st; + int linenum; + if (op != KEY_OP_ASSIGN) { + Perror(space, "invalid INCLUDE operation"); + goto invalid; + } + if (value[0] == '/') + strlcpy(string, value, sizeof(string)); + else { + strlcpy(string, space->rootdir, sizeof(string)); + strlcat(string, "/", sizeof(string)); + strlcat(string, value, sizeof(string)); + } + rootdir = space->rootdir; + go_to = space->go_to; + filename = space->filename; + linenum = space->linenum; + if (stat(string, &st)) { + Perror(space, "invalid filename '%s'", string); + continue; + } + if (S_ISDIR(st.st_mode)) { + struct dirent **list; + int i, num; + num = scandir(string, &list, conf_name_filter, + alphasort); + if (num < 0) { + Perror(space, "invalid directory '%s'", string); + continue; + } + count = strlen(string); + for (i = 0; i < num; i++) { + string[count] = '\0'; + strlcat(string, "/", sizeof(string)); + strlcat(string, list[i]->d_name, sizeof(string)); + space->go_to = NULL; + space->rootdir = new_root_dir(string); + free(list[i]); + if (space->rootdir) { + err = parse(space, string); + free(space->rootdir); + } else + err = -ENOMEM; + if (space->go_to) { + Perror(space, "unterminated GOTO '%s'", space->go_to); + free(space->go_to); + } + if (err) + break; + } + free(list); + } else { + space->go_to = NULL; + space->rootdir = new_root_dir(string); + if (space->rootdir) { + err = parse(space, string); + free(space->rootdir); + } else + err = -ENOMEM; + if (space->go_to) { + Perror(space, "unterminated GOTO '%s'", space->go_to); + free(space->go_to); + } + } + space->go_to = go_to; + space->rootdir = rootdir; + space->filename = filename; + space->linenum = linenum; + if (space->quit) + break; + if (err) + break; + continue; + } + if (strncasecmp(key, "ACCESS", 6) == 0) { + if (op == KEY_OP_MATCH || op == KEY_OP_NOMATCH) { + if (value[0] == '$') { + strlcpy(string, value, sizeof(string)); + apply_format(space, string, sizeof(string)); + if (string[0] == '/') + goto __access1; + } + if (value[0] != '/') { + strlcpy(string, space->rootdir, sizeof(string)); + strlcat(string, "/", sizeof(string)); + strlcat(string, value, sizeof(string)); + } else { + strlcpy(string, value, sizeof(string)); + } + apply_format(space, string, sizeof(string)); + __access1: + count = access(string, F_OK); + dbg("access(%s) = %i (%s)", string, count, value); + if (op == KEY_OP_MATCH && count != 0) + break; + if (op == KEY_OP_NOMATCH && count == 0) + break; + } else { + Perror(space, "invalid ACCESS operation"); + goto invalid; + } + continue; + } + if (strncasecmp(key, "PRINT", 5) == 0) { + if (op != KEY_OP_ASSIGN) { + Perror(space, "invalid PRINT operation"); + goto invalid; + } + strlcpy(string, value, sizeof(string)); + apply_format(space, string, sizeof(string)); + fwrite(string, strlen(string), 1, stdout); + continue; + } + if (strncasecmp(key, "ERROR", 5) == 0) { + if (op != KEY_OP_ASSIGN) { + Perror(space, "invalid ERROR operation"); + goto invalid; + } + strlcpy(string, value, sizeof(string)); + apply_format(space, string, sizeof(string)); + fwrite(string, strlen(string), 1, stderr); + continue; + } + if (strncasecmp(key, "EXIT", 4) == 0) { + if (op != KEY_OP_ASSIGN) { + Perror(space, "invalid EXIT operation"); + goto invalid; + } + strlcpy(string, value, sizeof(string)); + apply_format(space, string, sizeof(string)); + if (strcmp(string, "return") == 0) + return -EJUSTRETURN; + space->exit_code = strtol(string, NULL, 0); + space->quit = 1; + break; + } + if (strncasecmp(key, "CONFIG{", 7) == 0) { + attr = get_key_attribute(space, key + 6, string, sizeof(string)); + if (attr == NULL) { + Perror(space, "error parsing CONFIG attribute"); + goto invalid; + } + strlcpy(result, value, sizeof(result)); + apply_format(space, result, sizeof(result)); + if (op == KEY_OP_ASSIGN) { + err = value_set(space, attr, result); + dbg("CONFIG{%s}='%s'", attr, result); + break; + } else if (op == KEY_OP_MATCH || op == KEY_OP_NOMATCH) { + pair = value_find(space, attr); + if (pair == NULL) + break; + if (!do_match(key, op, result, pair->value)) + break; + } else { + Perror(space, "invalid CONFIG{} operation"); + goto invalid; + } + } + + Perror(space, "unknown key '%s'", key); + } + return err; + +invalid: + Perror(space, "invalid rule"); + return -EINVAL; +} + +static int parse(struct space *space, const char *filename) +{ + char *buf, *bufline, *line; + size_t bufsize, pos, count, linesize; + unsigned int linenum, i, j, linenum_adj; + int err; + + dbg("start of file '%s'", filename); + + if (file_map(filename, &buf, &bufsize) != 0) { + err = errno; + error("Unable to open file '%s': %s", filename, strerror(err)); + return -err; + } + + err = 0; + pos = 0; + linenum = 0; + linesize = 128; + line = malloc(linesize); + if (line == NULL) { + file_unmap(buf, bufsize); + return -ENOMEM; + } + space->filename = filename; + while (!err && pos < bufsize && !space->quit) { + count = line_width(buf, bufsize, pos); + bufline = buf + pos; + pos += count + 1; + linenum++; + + /* skip whitespaces */ + while (count > 0 && isspace(bufline[0])) { + bufline++; + count--; + } + if (count == 0) + continue; + + /* comment check */ + if (bufline[0] == '#') + continue; + + if (count > linesize - 1) { + free(line); + linesize = (count + 127 + 1) & ~127; + if (linesize > 2048) { + error("file %s, line %i too long", filename, linenum); + err = -EINVAL; + break; + } + line = malloc(linesize); + if (line == NULL) { + err = -EINVAL; + break; + } + } + + /* skip backslash and newline from multiline rules */ + linenum_adj = 0; + for (i = j = 0; i < count; i++) { + if (bufline[i] == '\\' && bufline[i+1] == '\n') { + linenum_adj++; + continue; + } + line[j++] = bufline[i]; + } + line[j] = '\0'; + + dbg("read (%i) '%s'", linenum, line); + space->linenum = linenum; + err = parse_line(space, line, linesize); + if (err == -EJUSTRETURN) { + err = 0; + break; + } + linenum += linenum_adj; + } + + free(line); + space->filename = NULL; + space->linenum = -1; + file_unmap(buf, bufsize); + dbg("end of file '%s'", filename); + return err ? err : -abs(space->exit_code); +} + +int init(const char *filename, int flags, const char *cardname) +{ + struct space *space; + int err = 0, lasterr = 0, card, first; + + sysfs_init(); + if (!cardname) { + first = 1; + card = -1; + while (1) { + if (snd_card_next(&card) < 0) + break; + if (card < 0) { + if (first) { + error("No soundcards found..."); + return -ENODEV; + } + break; + } + first = 0; + if (!(flags & FLAG_UCM_DISABLED)) { + err = init_ucm(flags, card); + if (err == 0) + continue; + } + err = init_space(&space, card); + if (err == 0) { + space->rootdir = new_root_dir(filename); + if (space->rootdir != NULL) + err = parse(space, filename); + if (err <= -99) { /* non-fatal errors */ + if (lasterr == 0) + lasterr = err; + err = 0; + } + free_space(space); + } + if (err < 0) + break; + } + err = lasterr; + } else { + card = snd_card_get_index(cardname); + if (card < 0) { + error("Cannot find soundcard '%s'...", cardname); + goto error; + } + if (!(flags & FLAG_UCM_DISABLED)) { + err = init_ucm(flags, card); + if (err == 0) + return 0; + } + memset(&space, 0, sizeof(space)); + err = init_space(&space, card); + if (err == 0) { + space->rootdir = new_root_dir(filename); + if (space->rootdir != NULL) + err = parse(space, filename); + free_space(space); + } + } + error: + sysfs_cleanup(); + return err; +} diff --git a/alsactl/init_sysdeps.c b/alsactl/init_sysdeps.c new file mode 100644 index 0000000..3aca1b4 --- /dev/null +++ b/alsactl/init_sysdeps.c @@ -0,0 +1,63 @@ +/* + * Copyright (C) 2003 Greg Kroah-Hartman + * Copyright (C) 2005-2006 Kay Sievers + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation version 2 of the License. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#if defined(__GLIBC__) && !(defined(__UCLIBC__) && defined(__USE_BSD)) +static size_t strlcpy(char *dst, const char *src, size_t size) +{ + size_t bytes = 0; + char *q = dst; + const char *p = src; + char ch; + + while ((ch = *p++)) { + if (bytes+1 < size) + *q++ = ch; + bytes++; + } + + /* If size == 0 there is no space for a final null... */ + if (size) + *q = '\0'; + return bytes; +} + +static size_t strlcat(char *dst, const char *src, size_t size) +{ + size_t bytes = 0; + char *q = dst; + const char *p = src; + char ch; + + while (bytes < size && *q) { + q++; + bytes++; + } + if (bytes == size) + return (bytes + strlen(src)); + + while ((ch = *p++)) { + if (bytes+1 < size) + *q++ = ch; + bytes++; + } + + *q = '\0'; + return bytes; +} +#endif /* __GLIBC__ */ diff --git a/alsactl/init_sysfs.c b/alsactl/init_sysfs.c new file mode 100644 index 0000000..57ef615 --- /dev/null +++ b/alsactl/init_sysfs.c @@ -0,0 +1,163 @@ +/* + * Copyright (C) 2005-2006 Kay Sievers + * 2008 Jaroslav Kysela + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation version 2 of the License. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + + +static char sysfs_path[PATH_SIZE]; + +/* attribute value cache */ +static LIST_HEAD(attr_list); +struct sysfs_attr { + struct list_head node; + char path[PATH_SIZE]; + char *value; /* points to value_local if value is cached */ + char value_local[NAME_SIZE]; +}; + +static int sysfs_init(void) +{ + const char *env; + char sysfs_test[PATH_SIZE]; + + INIT_LIST_HEAD(&attr_list); + + env = getenv("SYSFS_PATH"); + if (env) { + strlcpy(sysfs_path, env, sizeof(sysfs_path)); + remove_trailing_chars(sysfs_path, '/'); + } else + strlcpy(sysfs_path, "/sys", sizeof(sysfs_path)); + dbg("sysfs_path='%s'", sysfs_path); + + strlcpy(sysfs_test, sysfs_path, sizeof(sysfs_test)); + strlcat(sysfs_test, "/kernel/uevent_seqnum", sizeof(sysfs_test)); + if (access(sysfs_test, F_OK)) { + strlcpy(sysfs_test, sysfs_path, sizeof(sysfs_test)); + strlcat(sysfs_test, "/kernel/uevent_helper", sizeof(sysfs_test)); + if (access(sysfs_test, F_OK)) { + error("sysfs path '%s' is invalid", sysfs_path); + return -errno; + } + } + + return 0; +} + +static void sysfs_cleanup(void) +{ + struct sysfs_attr *attr_loop; + struct sysfs_attr *attr_temp; + + list_for_each_entry_safe(attr_loop, attr_temp, &attr_list, node) { + list_del(&attr_loop->node); + free(attr_loop); + } +} + +static char *sysfs_attr_get_value(const char *devpath, const char *attr_name) +{ + char path_full[PATH_SIZE]; + const char *path; + char value[NAME_SIZE]; + struct sysfs_attr *attr_loop; + struct sysfs_attr *attr; + struct stat statbuf; + int fd; + ssize_t size; + size_t sysfs_len; + + dbg("open '%s'/'%s'", devpath, attr_name); + sysfs_len = strlcpy(path_full, sysfs_path, sizeof(path_full)); + path = &path_full[sysfs_len]; + strlcat(path_full, devpath, sizeof(path_full)); + strlcat(path_full, "/", sizeof(path_full)); + strlcat(path_full, attr_name, sizeof(path_full)); + + /* look for attribute in cache */ + list_for_each_entry(attr_loop, &attr_list, node) { + if (strcmp(attr_loop->path, path) == 0) { + dbg("found in cache '%s'", attr_loop->path); + return attr_loop->value; + } + } + + /* store attribute in cache (also negatives are kept in cache) */ + dbg("new uncached attribute '%s'", path_full); + attr = malloc(sizeof(struct sysfs_attr)); + if (attr == NULL) + return NULL; + memset(attr, 0x00, sizeof(struct sysfs_attr)); + strlcpy(attr->path, path, sizeof(attr->path)); + dbg("add to cache '%s'", path_full); + list_add(&attr->node, &attr_list); + + if (lstat(path_full, &statbuf) != 0) { + dbg("stat '%s' failed: %s", path_full, strerror(errno)); + goto out; + } + + if (S_ISLNK(statbuf.st_mode)) { + /* links return the last element of the target path */ + char link_target[PATH_SIZE + 1]; + int len; + const char *pos; + + len = readlink(path_full, link_target, sizeof(link_target) - 1); + if (len > 0) { + link_target[len] = '\0'; + pos = strrchr(link_target, '/'); + if (pos != NULL) { + dbg("cache '%s' with link value '%s'", path_full, pos+1); + strlcpy(attr->value_local, &pos[1], sizeof(attr->value_local)); + attr->value = attr->value_local; + } + } + goto out; + } + + /* skip directories */ + if (S_ISDIR(statbuf.st_mode)) + goto out; + + /* skip non-readable files */ + if ((statbuf.st_mode & S_IRUSR) == 0) + goto out; + + /* read attribute value */ + fd = open(path_full, O_RDONLY); + if (fd < 0) { + dbg("attribute '%s' does not exist", path_full); + goto out; + } + size = read(fd, value, sizeof(value)); + close(fd); + if (size < 0) + goto out; + if (size == sizeof(value)) + goto out; + + /* got a valid value, store and return it */ + value[size] = '\0'; + remove_trailing_chars(value, '\n'); + dbg("cache '%s' with attribute value '%s'", path_full, value); + strlcpy(attr->value_local, value, sizeof(attr->value_local)); + attr->value = attr->value_local; + +out: + return attr->value; +} diff --git a/alsactl/init_ucm.c b/alsactl/init_ucm.c new file mode 100644 index 0000000..6468c9d --- /dev/null +++ b/alsactl/init_ucm.c @@ -0,0 +1,63 @@ +/* + * Advanced Linux Sound Architecture Control Program - UCM Initialization + * Copyright (c) by Jaroslav Kysela + * + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + */ + +#include "aconfig.h" +#include +#include "alsactl.h" + +#ifdef HAVE_ALSA_USE_CASE_H + +#include + +/* + * Keep it as simple as possible. Execute commands from the SectionOnce only. + */ +int init_ucm(int flags, int cardno) +{ + snd_use_case_mgr_t *uc_mgr; + char id[32]; + int err; + + snprintf(id, sizeof(id), "hw:%d", cardno); + err = snd_use_case_mgr_open(&uc_mgr, id); + if (err < 0) + return err; + err = snd_use_case_set(uc_mgr, "_boot", NULL); + if (err < 0) + goto _error; + if ((flags & FLAG_UCM_DEFAULTS) != 0) { + err = snd_use_case_set(uc_mgr, "_defaults", NULL); + if (err < 0) + goto _error; + } +_error: + snd_use_case_mgr_close(uc_mgr); + return err; +} + +#else + +int init_ucm(int flags, int cardno) +{ + return 0; +} + +#endif diff --git a/alsactl/init_utils_run.c b/alsactl/init_utils_run.c new file mode 100644 index 0000000..dde490b --- /dev/null +++ b/alsactl/init_utils_run.c @@ -0,0 +1,247 @@ +/* + * Copyright (C) 2004-2005 Kay Sievers + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation version 2 of the License. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#define MY_MAX(a,b) ((a) > (b) ? (a) : (b)) + +#define READ_END 0 +#define WRITE_END 1 + +static +int run_program1(struct space *space, + const char *command0, char *result, + size_t ressize, size_t *reslen, int log); + +static +int run_program0(struct space *space, + const char *command0, char *result, + size_t ressize, size_t *reslen, int log) +{ + int retval = 0; + int status; + int outpipe[2] = {-1, -1}; + int errpipe[2] = {-1, -1}; + pid_t pid; + char arg[PATH_SIZE]; + char program[PATH_SIZE]; + char *argv[(sizeof(arg) / 2) + 1]; + int devnull; + int i; + + /* build argv from comand */ + strlcpy(arg, command0, sizeof(arg)); + i = 0; + if (strchr(arg, ' ') != NULL) { + char *pos = arg; + + while (pos != NULL) { + if (pos[0] == '\'') { + /* don't separate if in apostrophes */ + pos++; + argv[i] = strsep(&pos, "\'"); + while (pos != NULL && pos[0] == ' ') + pos++; + } else { + argv[i] = strsep(&pos, " "); + } + dbg("arg[%i] '%s'", i, argv[i]); + i++; + } + argv[i] = NULL; + } else { + argv[0] = arg; + argv[1] = NULL; + } + info("'%s'", command0); + + /* prepare pipes from child to parent */ + if (result || log) { + if (pipe(outpipe) != 0) { + Perror(space, "pipe failed: %s", strerror(errno)); + return -1; + } + } + if (log) { + if (pipe(errpipe) != 0) { + Perror(space, "pipe failed: %s", strerror(errno)); + return -1; + } + } + + /* allow programs in /lib/alsa called without the path */ + if (strchr(argv[0], '/') == NULL) { + strlcpy(program, "/lib/alsa/", sizeof(program)); + strlcat(program, argv[0], sizeof(program)); + argv[0] = program; + } + + pid = fork(); + switch(pid) { + case 0: + /* child closes parent ends of pipes */ + if (outpipe[READ_END] > 0) + close(outpipe[READ_END]); + if (errpipe[READ_END] > 0) + close(errpipe[READ_END]); + + /* discard child output or connect to pipe */ + devnull = open("/dev/null", O_RDWR); + if (devnull > 0) { + dup2(devnull, STDIN_FILENO); + if (outpipe[WRITE_END] < 0) + dup2(devnull, STDOUT_FILENO); + if (errpipe[WRITE_END] < 0) + dup2(devnull, STDERR_FILENO); + close(devnull); + } else + Perror(space, "open /dev/null failed: %s", strerror(errno)); + if (outpipe[WRITE_END] > 0) { + dup2(outpipe[WRITE_END], STDOUT_FILENO); + close(outpipe[WRITE_END]); + } + if (errpipe[WRITE_END] > 0) { + dup2(errpipe[WRITE_END], STDERR_FILENO); + close(errpipe[WRITE_END]); + } + execv(argv[0], argv); + + /* we should never reach this */ + Perror(space, "exec of program '%s' failed", argv[0]); + _exit(1); + case -1: + Perror(space, "fork of '%s' failed: %s", argv[0], strerror(errno)); + return -1; + default: + /* read from child if requested */ + if (outpipe[READ_END] > 0 || errpipe[READ_END] > 0) { + ssize_t count; + size_t respos = 0; + + /* parent closes child ends of pipes */ + if (outpipe[WRITE_END] > 0) + close(outpipe[WRITE_END]); + if (errpipe[WRITE_END] > 0) + close(errpipe[WRITE_END]); + + /* read child output */ + while (outpipe[READ_END] > 0 || errpipe[READ_END] > 0) { + int fdcount; + fd_set readfds; + + FD_ZERO(&readfds); + if (outpipe[READ_END] > 0) + FD_SET(outpipe[READ_END], &readfds); + if (errpipe[READ_END] > 0) + FD_SET(errpipe[READ_END], &readfds); + fdcount = select(MY_MAX(outpipe[READ_END], errpipe[READ_END])+1, &readfds, NULL, NULL, NULL); + if (fdcount < 0) { + if (errno == EINTR) + continue; + retval = -1; + break; + } + + /* get stdout */ + if (outpipe[READ_END] > 0 && FD_ISSET(outpipe[READ_END], &readfds)) { + char inbuf[1024]; + char *pos; + char *line; + + count = read(outpipe[READ_END], inbuf, sizeof(inbuf)-1); + if (count <= 0) { + close(outpipe[READ_END]); + outpipe[READ_END] = -1; + if (count < 0) { + Perror(space, "stdin read failed: %s", strerror(errno)); + retval = -1; + } + continue; + } + inbuf[count] = '\0'; + + /* store result for rule processing */ + if (result) { + if (respos + count < ressize) { + memcpy(&result[respos], inbuf, count); + respos += count; + } else { + Perror(space, "ressize %ld too short", (long)ressize); + retval = -1; + } + } + pos = inbuf; + while ((line = strsep(&pos, "\n"))) + if (pos || line[0] != '\0') + info("'%s' (stdout) '%s'", argv[0], line); + } + + /* get stderr */ + if (errpipe[READ_END] > 0 && FD_ISSET(errpipe[READ_END], &readfds)) { + char errbuf[1024]; + char *pos; + char *line; + + count = read(errpipe[READ_END], errbuf, sizeof(errbuf)-1); + if (count <= 0) { + close(errpipe[READ_END]); + errpipe[READ_END] = -1; + if (count < 0) + Perror(space, "stderr read failed: %s", strerror(errno)); + continue; + } + errbuf[count] = '\0'; + pos = errbuf; + while ((line = strsep(&pos, "\n"))) + if (pos || line[0] != '\0') + info("'%s' (stderr) '%s'", argv[0], line); + } + } + if (outpipe[READ_END] > 0) + close(outpipe[READ_END]); + if (errpipe[READ_END] > 0) + close(errpipe[READ_END]); + + /* return the childs stdout string */ + if (result) { + result[respos] = '\0'; + dbg("result='%s'", result); + if (reslen) + *reslen = respos; + } + } + waitpid(pid, &status, 0); + if (WIFEXITED(status)) { + info("'%s' returned with status %i", argv[0], WEXITSTATUS(status)); + if (WEXITSTATUS(status) != 0) + retval = -1; + } else { + Perror(space, "'%s' abnormal exit", argv[0]); + retval = -1; + } + } + + return retval; +} + +static +int run_program(struct space *space, const char *command0, char *result, + size_t ressize, size_t *reslen, int log) +{ + if (command0[0] == '_' && command0[1] == '_') + return run_program1(space, command0, result, ressize, reslen, log); + return run_program0(space, command0, result, ressize, reslen, log); +} diff --git a/alsactl/init_utils_string.c b/alsactl/init_utils_string.c new file mode 100644 index 0000000..01ea800 --- /dev/null +++ b/alsactl/init_utils_string.c @@ -0,0 +1,183 @@ +/* + * Copyright (C) 2004-2005 Kay Sievers + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation version 2 of the License. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + + +static void remove_trailing_chars(char *path, char c) +{ + size_t len; + + len = strlen(path); + while (len > 0 && path[len-1] == c) + path[--len] = '\0'; +} + +/* count of characters used to encode one unicode char */ +static int utf8_encoded_expected_len(const char *str) +{ + unsigned char c = (unsigned char)str[0]; + + if (c < 0x80) + return 1; + if ((c & 0xe0) == 0xc0) + return 2; + if ((c & 0xf0) == 0xe0) + return 3; + if ((c & 0xf8) == 0xf0) + return 4; + if ((c & 0xfc) == 0xf8) + return 5; + if ((c & 0xfe) == 0xfc) + return 6; + return 0; +} + +/* decode one unicode char */ +static int utf8_encoded_to_unichar(const char *str) +{ + int unichar; + int len; + int i; + + len = utf8_encoded_expected_len(str); + switch (len) { + case 1: + return (int)str[0]; + case 2: + unichar = str[0] & 0x1f; + break; + case 3: + unichar = (int)str[0] & 0x0f; + break; + case 4: + unichar = (int)str[0] & 0x07; + break; + case 5: + unichar = (int)str[0] & 0x03; + break; + case 6: + unichar = (int)str[0] & 0x01; + break; + default: + return -1; + } + + for (i = 1; i < len; i++) { + if (((int)str[i] & 0xc0) != 0x80) + return -1; + unichar <<= 6; + unichar |= (int)str[i] & 0x3f; + } + + return unichar; +} + +/* expected size used to encode one unicode char */ +static int utf8_unichar_to_encoded_len(int unichar) +{ + if (unichar < 0x80) + return 1; + if (unichar < 0x800) + return 2; + if (unichar < 0x10000) + return 3; + if (unichar < 0x200000) + return 4; + if (unichar < 0x4000000) + return 5; + return 6; +} + +/* check if unicode char has a valid numeric range */ +static int utf8_unichar_valid_range(int unichar) +{ + if (unichar > 0x10ffff) + return 0; + if ((unichar & 0xfffff800) == 0xd800) + return 0; + if ((unichar > 0xfdcf) && (unichar < 0xfdf0)) + return 0; + if ((unichar & 0xffff) == 0xffff) + return 0; + return 1; +} + +/* validate one encoded unicode char and return its length */ +static int utf8_encoded_valid_unichar(const char *str) +{ + int len; + int unichar; + int i; + + len = utf8_encoded_expected_len(str); + if (len == 0) + return -1; + + /* ascii is valid */ + if (len == 1) + return 1; + + /* check if expected encoded chars are available */ + for (i = 0; i < len; i++) + if ((str[i] & 0x80) != 0x80) + return -1; + + unichar = utf8_encoded_to_unichar(str); + + /* check if encoded length matches encoded value */ + if (utf8_unichar_to_encoded_len(unichar) != len) + return -1; + + /* check if value has valid range */ + if (!utf8_unichar_valid_range(unichar)) + return -1; + + return len; +} + +/* replace everything but whitelisted plain ascii and valid utf8 */ +static int replace_untrusted_chars(char *str) +{ + size_t i = 0; + int replaced = 0; + + while (str[i] != '\0') { + int len; + + /* valid printable ascii char */ + if ((str[i] >= '0' && str[i] <= '9') || + (str[i] >= 'A' && str[i] <= 'Z') || + (str[i] >= 'a' && str[i] <= 'z') || + strchr(" #$%+-./:=?@_,", str[i])) { + i++; + continue; + } + /* valid utf8 is accepted */ + len = utf8_encoded_valid_unichar(&str[i]); + if (len > 1) { + i += len; + continue; + } + + /* everything else is garbage */ + str[i] = '_'; + i++; + replaced++; + } + + return replaced; +} diff --git a/alsactl/list.h b/alsactl/list.h new file mode 100644 index 0000000..8626630 --- /dev/null +++ b/alsactl/list.h @@ -0,0 +1,289 @@ +/* + * Copied from the Linux kernel source tree, version 2.6.0-test1. + * + * Licensed under the GPL v2 as per the whole kernel source tree. + * + */ + +#ifndef _LIST_H +#define _LIST_H + +/** + * container_of - cast a member of a structure out to the containing structure + * + * @ptr: the pointer to the member. + * @type: the type of the container struct this is embedded in. + * @member: the name of the member within the struct. + * + */ +#define container_of(ptr, type, member) ({ \ + const typeof( ((type *)0)->member ) *__mptr = (ptr); \ + (type *)( (char *)__mptr - offsetof(type,member) );}) + +/* + * These are non-NULL pointers that will result in page faults + * under normal circumstances, used to verify that nobody uses + * non-initialized list entries. + */ +#define LIST_POISON1 ((void *) 0x00100100) +#define LIST_POISON2 ((void *) 0x00200200) + +/* + * Simple doubly linked list implementation. + * + * Some of the internal functions ("__xxx") are useful when + * manipulating whole lists rather than single entries, as + * sometimes we already know the next/prev entries and we can + * generate better code by using them directly rather than + * using the generic single-entry routines. + */ + +struct list_head { + struct list_head *next, *prev; +}; + +#define LIST_HEAD_INIT(name) { &(name), &(name) } + +#define LIST_HEAD(name) \ + struct list_head name = LIST_HEAD_INIT(name) + +#define INIT_LIST_HEAD(ptr) do { \ + (ptr)->next = (ptr); (ptr)->prev = (ptr); \ +} while (0) + +/* + * Insert a new entry between two known consecutive entries. + * + * This is only for internal list manipulation where we know + * the prev/next entries already! + */ +static inline void __list_add(struct list_head *new, + struct list_head *prev, + struct list_head *next) +{ + next->prev = new; + new->next = next; + new->prev = prev; + prev->next = new; +} + +/** + * list_add - add a new entry + * @new: new entry to be added + * @head: list head to add it after + * + * Insert a new entry after the specified head. + * This is good for implementing stacks. + */ +static inline void list_add(struct list_head *new, struct list_head *head) +{ + __list_add(new, head, head->next); +} + +/** + * list_add_tail - add a new entry + * @new: new entry to be added + * @head: list head to add it before + * + * Insert a new entry before the specified head. + * This is useful for implementing queues. + */ +static inline void list_add_tail(struct list_head *new, struct list_head *head) +{ + __list_add(new, head->prev, head); +} + +/* + * Delete a list entry by making the prev/next entries + * point to each other. + * + * This is only for internal list manipulation where we know + * the prev/next entries already! + */ +static inline void __list_del(struct list_head * prev, struct list_head * next) +{ + next->prev = prev; + prev->next = next; +} + +/** + * list_del - deletes entry from list. + * @entry: the element to delete from the list. + * Note: list_empty on entry does not return true after this, the entry is + * in an undefined state. + */ +static inline void list_del(struct list_head *entry) +{ + __list_del(entry->prev, entry->next); + entry->next = LIST_POISON1; + entry->prev = LIST_POISON2; +} + +/** + * list_del_init - deletes entry from list and reinitialize it. + * @entry: the element to delete from the list. + */ +static inline void list_del_init(struct list_head *entry) +{ + __list_del(entry->prev, entry->next); + INIT_LIST_HEAD(entry); +} + +/** + * list_move - delete from one list and add as another's head + * @list: the entry to move + * @head: the head that will precede our entry + */ +static inline void list_move(struct list_head *list, struct list_head *head) +{ + __list_del(list->prev, list->next); + list_add(list, head); +} + +/** + * list_move_tail - delete from one list and add as another's tail + * @list: the entry to move + * @head: the head that will follow our entry + */ +static inline void list_move_tail(struct list_head *list, + struct list_head *head) +{ + __list_del(list->prev, list->next); + list_add_tail(list, head); +} + +/** + * list_empty - tests whether a list is empty + * @head: the list to test. + */ +static inline int list_empty(struct list_head *head) +{ + return head->next == head; +} + +static inline void __list_splice(struct list_head *list, + struct list_head *head) +{ + struct list_head *first = list->next; + struct list_head *last = list->prev; + struct list_head *at = head->next; + + first->prev = head; + head->next = first; + + last->next = at; + at->prev = last; +} + +/** + * list_splice - join two lists + * @list: the new list to add. + * @head: the place to add it in the first list. + */ +static inline void list_splice(struct list_head *list, struct list_head *head) +{ + if (!list_empty(list)) + __list_splice(list, head); +} + +/** + * list_splice_init - join two lists and reinitialise the emptied list. + * @list: the new list to add. + * @head: the place to add it in the first list. + * + * The list at @list is reinitialised + */ +static inline void list_splice_init(struct list_head *list, + struct list_head *head) +{ + if (!list_empty(list)) { + __list_splice(list, head); + INIT_LIST_HEAD(list); + } +} + +/** + * list_entry - get the struct for this entry + * @ptr: the &struct list_head pointer. + * @type: the type of the struct this is embedded in. + * @member: the name of the list_struct within the struct. + */ +#define list_entry(ptr, type, member) \ + container_of(ptr, type, member) + +/** + * list_for_each - iterate over a list + * @pos: the &struct list_head to use as a loop counter. + * @head: the head for your list. + */ +#define list_for_each(pos, head) \ + for (pos = (head)->next; pos != (head); \ + pos = pos->next) + +/** + * __list_for_each - iterate over a list + * @pos: the &struct list_head to use as a loop counter. + * @head: the head for your list. + * + * This variant differs from list_for_each() in that it's the + * simplest possible list iteration code. + * Use this for code that knows the list to be very short (empty + * or 1 entry) most of the time. + */ +#define __list_for_each(pos, head) \ + for (pos = (head)->next; pos != (head); pos = pos->next) + +/** + * list_for_each_prev - iterate over a list backwards + * @pos: the &struct list_head to use as a loop counter. + * @head: the head for your list. + */ +#define list_for_each_prev(pos, head) \ + for (pos = (head)->prev; pos != (head); pos = pos->prev) + +/** + * list_for_each_safe - iterate over a list safe against removal of list entry + * @pos: the &struct list_head to use as a loop counter. + * @n: another &struct list_head to use as temporary storage + * @head: the head for your list. + */ +#define list_for_each_safe(pos, n, head) \ + for (pos = (head)->next, n = pos->next; pos != (head); \ + pos = n, n = pos->next) + +/** + * list_for_each_entry - iterate over list of given type + * @pos: the type * to use as a loop counter. + * @head: the head for your list. + * @member: the name of the list_struct within the struct. + */ +#define list_for_each_entry(pos, head, member) \ + for (pos = list_entry((head)->next, typeof(*pos), member); \ + &pos->member != (head); \ + pos = list_entry(pos->member.next, typeof(*pos), member)) + +/** + * list_for_each_entry_reverse - iterate backwards over list of given type. + * @pos: the type * to use as a loop counter. + * @head: the head for your list. + * @member: the name of the list_struct within the struct. + */ +#define list_for_each_entry_reverse(pos, head, member) \ + for (pos = list_entry((head)->prev, typeof(*pos), member); \ + &pos->member != (head); \ + pos = list_entry(pos->member.prev, typeof(*pos), member)) + +/** + * list_for_each_entry_safe - iterate over list of given type safe against removal of list entry + * @pos: the type * to use as a loop counter. + * @n: another type * to use as temporary storage + * @head: the head for your list. + * @member: the name of the list_struct within the struct. + */ +#define list_for_each_entry_safe(pos, n, head, member) \ + for (pos = list_entry((head)->next, typeof(*pos), member), \ + n = list_entry(pos->member.next, typeof(*pos), member); \ + &pos->member != (head); \ + pos = n, n = list_entry(n->member.next, typeof(*n), member)) + +#endif /* _LIST_H */ diff --git a/alsactl/lock.c b/alsactl/lock.c new file mode 100644 index 0000000..4a48539 --- /dev/null +++ b/alsactl/lock.c @@ -0,0 +1,137 @@ +/* + * Advanced Linux Sound Architecture Control Program + * Copyright (c) by Jaroslav Kysela + * + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + */ + +#include "aconfig.h" +#include "version.h" +#include +#include +#include +#include +#include +#include +#include +#include "alsactl.h" + +static int state_lock_(const char *file, int lock, int timeout, int _fd) +{ + int fd = -1, err = 0; + struct flock lck; + struct stat st; + char lcktxt[14]; + char *nfile = lockfile; + + if (do_lock <= 0) + return 0; + + lck.l_type = lock ? F_WRLCK : F_UNLCK; + lck.l_whence = SEEK_SET; + lck.l_start = 0; + lck.l_len = 11; + lck.l_pid = 0; + if (lock) { + snprintf(lcktxt, sizeof(lcktxt), "%10li\n", (long)getpid()); + } else { + snprintf(lcktxt, sizeof(lcktxt), "%10s\n", ""); + fd = _fd; + } + while (fd < 0 && timeout-- > 0) { + fd = open(nfile, O_RDWR); + if (!lock && fd < 0) { + err = -EIO; + goto out; + } + if (fd < 0) { + fd = open(nfile, O_RDWR|O_CREAT|O_EXCL, 0644); + if (fd < 0) { + if (errno == EBUSY || errno == EAGAIN) { + sleep(1); + timeout--; + } else { + err = -errno; + goto out; + } + } + } + } + if (fd < 0 && timeout <= 0) { + err = -EBUSY; + goto out; + } + if (fstat(fd, &st) < 0) { + err = -errno; + goto out; + } + if (st.st_size != 11 || !lock) { + if (write(fd, lcktxt, 11) != 11) { + err = -EIO; + goto out; + } + if (lock && lseek(fd, 0, SEEK_SET)) { + err = -errno; + goto out; + } + } + while (timeout > 0) { + if (fcntl(fd, F_SETLK, &lck) < 0) { + sleep(1); + timeout--; + } else { + break; + } + } + if (timeout <= 0) { + err = -EBUSY; + goto out; + } + if (lock) { + if (write(fd, lcktxt, 11) != 11) { + err = -EIO; + goto out; + } + return fd; + } + err = 0; + +out: + if (fd >= 0) + close(fd); + return err; +} + +int state_lock(const char *file, int timeout) +{ + int err; + + err = state_lock_(file, 1, timeout, -1); + if (err < 0) + error("file %s lock error: %s", file, strerror(-err)); + return err; +} + +int state_unlock(int _fd, const char *file) +{ + int err; + + err = state_lock_(file, 0, 10, _fd); + if (err < 0) + error("file %s unlock error: %s", file, strerror(-err)); + return err; +} diff --git a/alsactl/monitor.c b/alsactl/monitor.c new file mode 100644 index 0000000..fa6cd85 --- /dev/null +++ b/alsactl/monitor.c @@ -0,0 +1,473 @@ +/* + * Advanced Linux Sound Architecture Control Program + * Copyright (c) by Takashi Iwai + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include "aconfig.h" +#include "version.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include "list.h" + +struct src_entry { + snd_ctl_t *handle; + char *name; + unsigned int pfd_count; + struct list_head list; +}; + +struct snd_card_iterator { + int card; + char name[16]; +}; + +void snd_card_iterator_init(struct snd_card_iterator *iter) +{ + iter->card = -1; + memset(iter->name, 0, sizeof(iter->name)); +} + +static const char *snd_card_iterator_next(struct snd_card_iterator *iter) +{ + if (snd_card_next(&iter->card) < 0) + return NULL; + if (iter->card < 0) + return NULL; + + snprintf(iter->name, sizeof(iter->name), "hw:%d", iter->card); + + return (const char *)iter->name; +} + +static void remove_source_entry(struct src_entry *entry) +{ + list_del(&entry->list); + if (entry->handle) + snd_ctl_close(entry->handle); + free(entry->name); + free(entry); +} + +static void clear_source_list(struct list_head *srcs) +{ + struct src_entry *entry, *tmp; + + list_for_each_entry_safe(entry, tmp, srcs, list) + remove_source_entry(entry); +} + +static int insert_source_entry(struct list_head *srcs, snd_ctl_t *handle, + const char *name) +{ + struct src_entry *entry; + int count; + int err; + + entry = calloc(1, sizeof(*entry)); + if (!entry) + return -ENOMEM; + INIT_LIST_HEAD(&entry->list); + entry->handle = handle; + + entry->name = strdup(name); + if (!entry->name) { + err = -ENOMEM; + goto error; + } + + count = snd_ctl_poll_descriptors_count(handle); + if (count < 0) { + err = count; + goto error; + } + if (count == 0) { + err = -ENXIO; + goto error; + } + entry->pfd_count = count; + + list_add_tail(&entry->list, srcs); + + return 0; +error: + remove_source_entry(entry); + return err; +} + +static int open_ctl(const char *name, snd_ctl_t **ctlp) +{ + snd_ctl_t *ctl; + int err; + + err = snd_ctl_open(&ctl, name, SND_CTL_READONLY); + if (err < 0) { + fprintf(stderr, "Cannot open ctl %s\n", name); + return err; + } + err = snd_ctl_subscribe_events(ctl, 1); + if (err < 0) { + fprintf(stderr, "Cannot open subscribe events to ctl %s\n", name); + snd_ctl_close(ctl); + return err; + } + *ctlp = ctl; + return 0; +} + +static inline bool seek_entry_by_name(struct list_head *srcs, const char *name) +{ + struct src_entry *entry; + + list_for_each_entry(entry, srcs, list) { + if (!strcmp(entry->name, name)) + return true; + } + + return false; +} + +static int prepare_source_entry(struct list_head *srcs, const char *name) +{ + snd_ctl_t *handle; + int err; + + if (!name) { + struct snd_card_iterator iter; + const char *cardname; + + snd_card_iterator_init(&iter); + while ((cardname = snd_card_iterator_next(&iter))) { + if (seek_entry_by_name(srcs, cardname)) + continue; + err = open_ctl(cardname, &handle); + if (err < 0) + return err; + err = insert_source_entry(srcs, handle, cardname); + if (err < 0) + return err; + } + } else { + if (seek_entry_by_name(srcs, name)) + return 0; + err = open_ctl(name, &handle); + if (err < 0) + return err; + err = insert_source_entry(srcs, handle, name); + if (err < 0) + return err; + } + + return 0; +} + +static int check_control_cdev(int infd, bool *retry) +{ + struct inotify_event *ev; + char *buf; + int err = 0; + + buf = calloc(1, sizeof(*ev) + NAME_MAX); + if (!buf) + return -ENOMEM; + + while (1) { + ssize_t len = read(infd, buf, sizeof(*ev) + NAME_MAX); + if (len < 0) { + if (errno != EAGAIN) + err = errno; + break; + } else if (len == 0) { + break; + } + + size_t pos = 0; + while (pos < len) { + ev = (struct inotify_event *)(buf + pos); + if ((ev->mask & IN_CREATE) && + strstr(ev->name, "controlC") == ev->name) + *retry = true; + pos += sizeof(*ev) + ev->len; + } + } + + free(buf); + + return err; +} + +static int print_event(snd_ctl_t *ctl, const char *name) +{ + snd_ctl_event_t *event; + unsigned int mask; + int err; + + snd_ctl_event_alloca(&event); + err = snd_ctl_read(ctl, event); + if (err < 0) + return err; + + if (snd_ctl_event_get_type(event) != SND_CTL_EVENT_ELEM) + return 0; + + printf("node %s, #%d (%i,%i,%i,%s,%i)", + name, + snd_ctl_event_elem_get_numid(event), + snd_ctl_event_elem_get_interface(event), + snd_ctl_event_elem_get_device(event), + snd_ctl_event_elem_get_subdevice(event), + snd_ctl_event_elem_get_name(event), + snd_ctl_event_elem_get_index(event)); + + mask = snd_ctl_event_elem_get_mask(event); + if (mask == SND_CTL_EVENT_MASK_REMOVE) { + printf(" REMOVE\n"); + return 0; + } + + if (mask & SND_CTL_EVENT_MASK_VALUE) + printf(" VALUE"); + if (mask & SND_CTL_EVENT_MASK_INFO) + printf(" INFO"); + if (mask & SND_CTL_EVENT_MASK_ADD) + printf(" ADD"); + if (mask & SND_CTL_EVENT_MASK_TLV) + printf(" TLV"); + printf("\n"); + return 0; +} + +static int operate_dispatcher(int epfd, uint32_t op, struct epoll_event *epev, + struct src_entry *entry) +{ + struct pollfd *pfds; + int count; + int i; + int err = 0; + + pfds = calloc(entry->pfd_count, sizeof(*pfds)); + if (!pfds) + return -ENOMEM; + + count = snd_ctl_poll_descriptors(entry->handle, pfds, entry->pfd_count); + if (count < 0) { + err = count; + goto end; + } + if (count != entry->pfd_count) { + err = -EIO; + goto end; + } + + for (i = 0; i < entry->pfd_count; ++i) { + err = epoll_ctl(epfd, op, pfds[i].fd, epev); + if (err < 0) + break; + } +end: + free(pfds); + return err; +} + +static int prepare_dispatcher(int epfd, int sigfd, int infd, + struct list_head *srcs) +{ + struct epoll_event ev = {0}; + struct src_entry *entry; + int err = 0; + + ev.events = EPOLLIN; + ev.data.fd = sigfd; + if (epoll_ctl(epfd, EPOLL_CTL_ADD, sigfd, &ev) < 0) + return -errno; + + ev.events = EPOLLIN; + ev.data.fd = infd; + if (epoll_ctl(epfd, EPOLL_CTL_ADD, infd, &ev) < 0) + return -errno; + + list_for_each_entry(entry, srcs, list) { + ev.events = EPOLLIN; + ev.data.ptr = (void *)entry; + err = operate_dispatcher(epfd, EPOLL_CTL_ADD, &ev, entry); + if (err < 0) + break; + } + + return err; +} + +static int run_dispatcher(int epfd, int sigfd, int infd, struct list_head *srcs, + bool *retry) +{ + struct src_entry *entry; + unsigned int max_ev_count; + struct epoll_event *epev; + int err = 0; + + max_ev_count = 0; + list_for_each_entry(entry, srcs, list) + max_ev_count += entry->pfd_count; + + epev = calloc(max_ev_count, sizeof(*epev)); + if (!epev) + return -ENOMEM; + + while (true) { + int count; + int i; + + count = epoll_wait(epfd, epev, max_ev_count, -1); + if (count < 0) { + if (errno == EINTR) + continue; + err = count; + break; + } + if (count == 0) + continue; + + for (i = 0; i < count; ++i) { + struct epoll_event *ev = epev + i; + + if (ev->data.fd == sigfd) + goto end; + + if (ev->data.fd == infd) { + err = check_control_cdev(infd, retry); + if (err < 0 || *retry) + goto end; + continue; + } + + entry = ev->data.ptr; + if (ev->events & EPOLLIN) + print_event(entry->handle, entry->name); + if (ev->events & EPOLLERR) { + operate_dispatcher(epfd, EPOLL_CTL_DEL, NULL, entry); + remove_source_entry(entry); + } + } + } +end: + free(epev); + return err; +} + +static void clear_dispatcher(int epfd, int sigfd, int infd, + struct list_head *srcs) +{ + struct src_entry *entry; + + list_for_each_entry(entry, srcs, list) + operate_dispatcher(epfd, EPOLL_CTL_DEL, NULL, entry); + + epoll_ctl(epfd, EPOLL_CTL_DEL, infd, NULL); + + epoll_ctl(epfd, EPOLL_CTL_DEL, sigfd, NULL); +} + +static int prepare_signalfd(int *sigfd) +{ + sigset_t mask; + int fd; + + sigemptyset(&mask); + sigaddset(&mask, SIGINT); + sigaddset(&mask, SIGTERM); + + if (sigprocmask(SIG_BLOCK, &mask, NULL) < 0) + return -errno; + + fd = signalfd(-1, &mask, 0); + if (fd < 0) + return -errno; + *sigfd = fd; + + return 0; +} + +int monitor(const char *name) +{ + LIST_HEAD(srcs); + int sigfd = 0; + int epfd; + int infd; + int wd = 0; + bool retry; + int err = 0; + + err = prepare_signalfd(&sigfd); + if (err < 0) + return err; + + epfd = epoll_create(1); + if (epfd < 0) { + close(sigfd); + return -errno; + } + + infd = inotify_init1(IN_NONBLOCK); + if (infd < 0) { + err = -errno; + goto error; + } + wd = inotify_add_watch(infd, "/dev/snd/", IN_CREATE); + if (wd < 0) { + err = -errno; + goto error; + } +retry: + retry = false; + err = prepare_source_entry(&srcs, name); + if (err < 0) + goto error; + + err = prepare_dispatcher(epfd, sigfd, infd, &srcs); + if (err >= 0) + err = run_dispatcher(epfd, sigfd, infd, &srcs, &retry); + clear_dispatcher(epfd, sigfd, infd, &srcs); + + if (retry) { + // A simple makeshift for timing gap between creation of nodes + // by devtmpfs and chmod() by udevd. + struct timespec req = { .tv_sec = 1 }; + nanosleep(&req, NULL); + goto retry; + } +error: + clear_source_list(&srcs); + + if (wd > 0) + inotify_rm_watch(infd, wd); + close(infd); + + close(epfd); + + close(sigfd); + + return err; +} diff --git a/alsactl/state.c b/alsactl/state.c new file mode 100644 index 0000000..ea1d3bc --- /dev/null +++ b/alsactl/state.c @@ -0,0 +1,1786 @@ +/* + * Advanced Linux Sound Architecture Control Program + * Copyright (c) by Abramo Bagnara + * Jaroslav Kysela + * + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + */ + +#include "aconfig.h" +#include "version.h" +#include +#include +#include +#include +#include +#include +#include "alsactl.h" + + +static char *id_str(snd_ctl_elem_id_t *id) +{ + static char str[128]; + assert(id); + sprintf(str, "%i,%i,%i,%s,%i", + snd_ctl_elem_id_get_interface(id), + snd_ctl_elem_id_get_device(id), + snd_ctl_elem_id_get_subdevice(id), + snd_ctl_elem_id_get_name(id), + snd_ctl_elem_id_get_index(id)); + return str; +} + +static char *num_str(long n) +{ + static char str[32]; + sprintf(str, "%ld", n); + return str; +} + +static int snd_config_integer_add(snd_config_t *father, char *id, long integer) +{ + int err; + snd_config_t *leaf; + err = snd_config_imake_integer(&leaf, id, integer); + if (err < 0) + return err; + err = snd_config_add(father, leaf); + if (err < 0) { + snd_config_delete(leaf); + return err; + } + return 0; +} + +static int snd_config_integer64_add(snd_config_t *father, char *id, long long integer) +{ + int err; + snd_config_t *leaf; + err = snd_config_imake_integer64(&leaf, id, integer); + if (err < 0) + return err; + err = snd_config_add(father, leaf); + if (err < 0) { + snd_config_delete(leaf); + return err; + } + return 0; +} + +static int snd_config_string_add(snd_config_t *father, const char *id, const char *string) +{ + int err; + snd_config_t *leaf; + err = snd_config_imake_string(&leaf, id, string); + if (err < 0) + return err; + err = snd_config_add(father, leaf); + if (err < 0) { + snd_config_delete(leaf); + return err; + } + return 0; +} + +static int snd_config_compound_add(snd_config_t *father, const char *id, int join, + snd_config_t **node) +{ + int err; + snd_config_t *leaf; + err = snd_config_make_compound(&leaf, id, join); + if (err < 0) + return err; + err = snd_config_add(father, leaf); + if (err < 0) { + snd_config_delete(leaf); + return err; + } + *node = leaf; + return 0; +} + +#define MAX_USER_TLV_SIZE 64 + +static char *tlv_to_str(unsigned int *tlv) +{ + int i, len = tlv[1] / 4 + 2; + char *s, *p; + + if (len >= MAX_USER_TLV_SIZE) + return NULL; + s = malloc(len * 8 + 1); + if (! s) + return NULL; + p = s; + for (i = 0; i < len; i++) { + sprintf(p, "%08x", tlv[i]); + p += 8; + } + return s; +} + +static unsigned int *str_to_tlv(const char *s) +{ + int i, j, c, len; + unsigned int *tlv; + + len = strlen(s); + if (len % 8) /* aligned to 4 bytes (= 8 letters) */ + return NULL; + len /= 8; + if (len > MAX_USER_TLV_SIZE) + return NULL; + tlv = malloc(sizeof(int) * len); + if (! tlv) + return NULL; + for (i = 0; i < len; i++) { + tlv[i] = 0; + for (j = 0; j < 8; j++) { + if ((c = hextodigit(*s++)) < 0) { + free(tlv); + return NULL; + } + tlv[i] = (tlv[i] << 4) | c; + } + } + return tlv; +} + +/* + * add the TLV string, dB ranges, and dB values to comment fields + */ +static int add_tlv_comments(snd_ctl_t *handle, snd_ctl_elem_id_t *id, + snd_ctl_elem_info_t *info, snd_ctl_elem_value_t *ctl, + snd_config_t *comment) +{ + unsigned int tlv[MAX_USER_TLV_SIZE]; + unsigned int *db; + long rangemin, rangemax; + long dbmin, dbmax, dbgain; + snd_config_t *value; + unsigned int i, count; + int err; + + if (snd_ctl_elem_tlv_read(handle, id, tlv, sizeof(tlv)) < 0) + return 0; /* ignore error */ + + if (snd_ctl_elem_info_is_tlv_writable(info)) { + char *s = tlv_to_str(tlv); + if (s) { + err = snd_config_string_add(comment, "tlv", s); + free(s); + if (err < 0) { + error("snd_config_string_add: %s", snd_strerror(err)); + return err; + } + } + } + + err = snd_tlv_parse_dB_info(tlv, sizeof(tlv), &db); + if (err <= 0) + return 0; + + rangemin = snd_ctl_elem_info_get_min(info); + rangemax = snd_ctl_elem_info_get_max(info); + snd_tlv_get_dB_range(db, rangemin, rangemax, &dbmin, &dbmax); + if (err < 0) + return err; + snd_config_integer_add(comment, "dbmin", dbmin); + snd_config_integer_add(comment, "dbmax", dbmax); + + if (snd_ctl_elem_info_get_type(info) == SND_CTL_ELEM_TYPE_INTEGER) { + err = snd_config_compound_add(comment, "dbvalue", 1, &value); + if (err < 0) { + error("snd_config_compound_add: %s", snd_strerror(err)); + return err; + } + count = snd_ctl_elem_info_get_count(info); + for (i = 0; i < count; i++) { + err = snd_tlv_convert_to_dB(db, rangemin, rangemax, + snd_ctl_elem_value_get_integer(ctl, i), &dbgain); + if (err < 0) { + error("snd_tlv_convert_to_dB: %s", snd_strerror(err)); + return err; + } + err = snd_config_integer_add(value, num_str(i), dbgain); + if (err < 0) { + error("snd_config_integer_add: %s", snd_strerror(err)); + return err; + } + } + } + return 0; +} + +static int get_control(snd_ctl_t *handle, snd_ctl_elem_id_t *id, snd_config_t *top) +{ + snd_ctl_elem_value_t *ctl; + snd_ctl_elem_info_t *info; + snd_config_t *control, *comment, *item, *value; + const char *s; + char buf[256]; + unsigned int idx; + int err; + unsigned int device, subdevice, index; + const char *name; + snd_ctl_elem_type_t type; + unsigned int count; + snd_ctl_elem_value_alloca(&ctl); + snd_ctl_elem_info_alloca(&info); + snd_ctl_elem_info_set_id(info, id); + err = snd_ctl_elem_info(handle, info); + if (err < 0) { + error("Cannot read control info '%s': %s", id_str(id), snd_strerror(err)); + return err; + } + + if (!snd_ctl_elem_info_is_readable(info)) + return 0; + snd_ctl_elem_value_set_id(ctl, id); + err = snd_ctl_elem_read(handle, ctl); + if (err < 0) { + error("Cannot read control '%s': %s", id_str(id), snd_strerror(err)); + return err; + } + + err = snd_config_compound_add(top, num_str(snd_ctl_elem_info_get_numid(info)), 0, &control); + if (err < 0) { + error("snd_config_compound_add: %s", snd_strerror(err)); + return err; + } + err = snd_config_make_compound(&comment, "comment", 0); + if (err < 0) { + error("snd_config_make_compound: %s", snd_strerror(err)); + return err; + } + + buf[0] = '\0'; + buf[1] = '\0'; + if (snd_ctl_elem_info_is_readable(info)) + strcat(buf, " read"); + if (snd_ctl_elem_info_is_writable(info)) + strcat(buf, " write"); + if (snd_ctl_elem_info_is_inactive(info)) + strcat(buf, " inactive"); + if (snd_ctl_elem_info_is_volatile(info)) + strcat(buf, " volatile"); + if (snd_ctl_elem_info_is_locked(info)) + strcat(buf, " locked"); + if (snd_ctl_elem_info_is_user(info)) + strcat(buf, " user"); + err = snd_config_string_add(comment, "access", buf + 1); + if (err < 0) { + error("snd_config_string_add: %s", snd_strerror(err)); + return err; + } + + type = snd_ctl_elem_info_get_type(info); + device = snd_ctl_elem_info_get_device(info); + subdevice = snd_ctl_elem_info_get_subdevice(info); + index = snd_ctl_elem_info_get_index(info); + name = snd_ctl_elem_info_get_name(info); + count = snd_ctl_elem_info_get_count(info); + s = snd_ctl_elem_type_name(type); + err = snd_config_string_add(comment, "type", s); + if (err < 0) { + error("snd_config_string_add: %s", snd_strerror(err)); + return err; + } + err = snd_config_integer_add(comment, "count", count); + if (err < 0) { + error("snd_config_integer_add: %s", snd_strerror(err)); + return err; + } + + switch (type) { + case SND_CTL_ELEM_TYPE_BOOLEAN: + break; + case SND_CTL_ELEM_TYPE_INTEGER: + { + long min = snd_ctl_elem_info_get_min(info); + long max = snd_ctl_elem_info_get_max(info); + long step = snd_ctl_elem_info_get_step(info); + if (step) + sprintf(buf, "%li - %li (step %li)", min, max, step); + else + sprintf(buf, "%li - %li", min, max); + err = snd_config_string_add(comment, "range", buf); + if (err < 0) { + error("snd_config_string_add: %s", snd_strerror(err)); + return err; + } + if (snd_ctl_elem_info_is_tlv_readable(info)) { + err = add_tlv_comments(handle, id, info, ctl, comment); + if (err < 0) + return err; + } + break; + } + case SND_CTL_ELEM_TYPE_INTEGER64: + { + long long min = snd_ctl_elem_info_get_min64(info); + long long max = snd_ctl_elem_info_get_max64(info); + long long step = snd_ctl_elem_info_get_step64(info); + if (step) + sprintf(buf, "%lli - %lli (step %lli)", min, max, step); + else + sprintf(buf, "%lli - %lli", min, max); + err = snd_config_string_add(comment, "range", buf); + if (err < 0) { + error("snd_config_string_add: %s", snd_strerror(err)); + return err; + } + break; + } + case SND_CTL_ELEM_TYPE_ENUMERATED: + { + unsigned int items; + err = snd_config_compound_add(comment, "item", 1, &item); + if (err < 0) { + error("snd_config_compound_add: %s", snd_strerror(err)); + return err; + } + items = snd_ctl_elem_info_get_items(info); + for (idx = 0; idx < items; idx++) { + snd_ctl_elem_info_set_item(info, idx); + err = snd_ctl_elem_info(handle, info); + if (err < 0) { + error("snd_ctl_card_info: %s", snd_strerror(err)); + return err; + } + err = snd_config_string_add(item, num_str(idx), snd_ctl_elem_info_get_item_name(info)); + if (err < 0) { + error("snd_config_string_add: %s", snd_strerror(err)); + return err; + } + } + break; + } + default: + break; + } + s = snd_ctl_elem_iface_name(snd_ctl_elem_info_get_interface(info)); + err = snd_config_string_add(control, "iface", s); + if (err < 0) { + error("snd_config_string_add: %s", snd_strerror(err)); + return err; + } + if (device != 0) { + err = snd_config_integer_add(control, "device", device); + if (err < 0) { + error("snd_config_integer_add: %s", snd_strerror(err)); + return err; + } + } + if (subdevice != 0) { + err = snd_config_integer_add(control, "subdevice", subdevice); + if (err < 0) { + error("snd_config_integer_add: %s", snd_strerror(err)); + return err; + } + } + err = snd_config_string_add(control, "name", name); + if (err < 0) { + error("snd_config_string_add: %s", snd_strerror(err)); + return err; + } + if (index != 0) { + err = snd_config_integer_add(control, "index", index); + if (err < 0) { + error("snd_config_integer_add: %s", snd_strerror(err)); + return err; + } + } + + switch (type) { + case SND_CTL_ELEM_TYPE_BYTES: + case SND_CTL_ELEM_TYPE_IEC958: + { + size_t size = type == SND_CTL_ELEM_TYPE_BYTES ? + count : sizeof(snd_aes_iec958_t); + char buf[size * 2 + 1]; + char *p = buf; + char *hex = "0123456789abcdef"; + const unsigned char *bytes = + (const unsigned char *)snd_ctl_elem_value_get_bytes(ctl); + for (idx = 0; idx < size; idx++) { + int v = bytes[idx]; + *p++ = hex[v >> 4]; + *p++ = hex[v & 0x0f]; + } + *p = '\0'; + err = snd_config_string_add(control, "value", buf); + if (err < 0) { + error("snd_config_string_add: %s", snd_strerror(err)); + return err; + } + goto finish; + } + default: + break; + } + + if (count == 1) { + switch (type) { + case SND_CTL_ELEM_TYPE_BOOLEAN: + err = snd_config_string_add(control, "value", snd_ctl_elem_value_get_boolean(ctl, 0) ? "true" : "false"); + if (err < 0) { + error("snd_config_string_add: %s", snd_strerror(err)); + return err; + } + goto finish; + case SND_CTL_ELEM_TYPE_INTEGER: + err = snd_config_integer_add(control, "value", snd_ctl_elem_value_get_integer(ctl, 0)); + if (err < 0) { + error("snd_config_integer_add: %s", snd_strerror(err)); + return err; + } + goto finish; + case SND_CTL_ELEM_TYPE_INTEGER64: + err = snd_config_integer64_add(control, "value", snd_ctl_elem_value_get_integer64(ctl, 0)); + if (err < 0) { + error("snd_config_integer64_add: %s", snd_strerror(err)); + return err; + } + goto finish; + case SND_CTL_ELEM_TYPE_ENUMERATED: + { + unsigned int v = snd_ctl_elem_value_get_enumerated(ctl, 0); + snd_config_t *c; + err = snd_config_search(item, num_str(v), &c); + if (err == 0) { + err = snd_config_get_string(c, &s); + assert(err == 0); + err = snd_config_string_add(control, "value", s); + } else { + err = snd_config_integer_add(control, "value", v); + } + if (err < 0) + error("snd_config add: %s", snd_strerror(err)); + goto finish; + } + default: + error("Unknown control type: %d\n", type); + return -EINVAL; + } + } + + err = snd_config_compound_add(control, "value", 1, &value); + if (err < 0) { + error("snd_config_compound_add: %s", snd_strerror(err)); + return err; + } + + switch (type) { + case SND_CTL_ELEM_TYPE_BOOLEAN: + for (idx = 0; idx < count; idx++) { + err = snd_config_string_add(value, num_str(idx), snd_ctl_elem_value_get_boolean(ctl, idx) ? "true" : "false"); + if (err < 0) { + error("snd_config_string_add: %s", snd_strerror(err)); + return err; + } + } + break; + case SND_CTL_ELEM_TYPE_INTEGER: + for (idx = 0; idx < count; idx++) { + err = snd_config_integer_add(value, num_str(idx), snd_ctl_elem_value_get_integer(ctl, idx)); + if (err < 0) { + error("snd_config_integer_add: %s", snd_strerror(err)); + return err; + } + } + break; + case SND_CTL_ELEM_TYPE_INTEGER64: + for (idx = 0; idx < count; idx++) { + err = snd_config_integer64_add(value, num_str(idx), snd_ctl_elem_value_get_integer64(ctl, idx)); + if (err < 0) { + error("snd_config_integer64_add: %s", snd_strerror(err)); + return err; + } + } + break; + case SND_CTL_ELEM_TYPE_ENUMERATED: + for (idx = 0; idx < count; idx++) { + unsigned int v = snd_ctl_elem_value_get_enumerated(ctl, idx); + snd_config_t *c; + err = snd_config_search(item, num_str(v), &c); + if (err == 0) { + err = snd_config_get_string(c, &s); + assert(err == 0); + err = snd_config_string_add(value, num_str(idx), s); + } else { + err = snd_config_integer_add(value, num_str(idx), v); + } + if (err < 0) { + error("snd_config add: %s", snd_strerror(err)); + return err; + } + } + break; + default: + error("Unknown control type: %d\n", type); + return -EINVAL; + } + +finish: + err = snd_config_add(control, comment); + if (err < 0) { + error("snd_config_add: %s", snd_strerror(err)); + return err; + } + return 0; +} + +static int get_controls(int cardno, snd_config_t *top) +{ + snd_ctl_t *handle; + snd_ctl_card_info_t *info; + snd_config_t *state, *card, *control; + snd_ctl_elem_list_t *list; + snd_ctl_elem_id_t *elem_id; + unsigned int idx; + int err; + char name[32]; + unsigned int count; + const char *id; + snd_ctl_card_info_alloca(&info); + snd_ctl_elem_list_alloca(&list); + snd_ctl_elem_id_alloca(&elem_id); + + sprintf(name, "hw:%d", cardno); + err = snd_ctl_open(&handle, name, SND_CTL_READONLY); + if (err < 0) { + error("snd_ctl_open error: %s", snd_strerror(err)); + return err; + } + err = snd_ctl_card_info(handle, info); + if (err < 0) { + error("snd_ctl_card_info error: %s", snd_strerror(err)); + goto _close; + } + id = snd_ctl_card_info_get_id(info); + err = snd_config_search(top, "state", &state); + if (err == 0 && + snd_config_get_type(state) != SND_CONFIG_TYPE_COMPOUND) { + error("config state node is not a compound"); + err = -EINVAL; + goto _close; + } + if (err < 0) { + err = snd_config_compound_add(top, "state", 1, &state); + if (err < 0) { + error("snd_config_compound_add: %s", snd_strerror(err)); + goto _close; + } + } + err = snd_config_search(state, id, &card); + if (err == 0 && + snd_config_get_type(card) != SND_CONFIG_TYPE_COMPOUND) { + error("config state.%s node is not a compound", id); + err = -EINVAL; + goto _close; + } + if (err < 0) { + err = snd_config_compound_add(state, id, 0, &card); + if (err < 0) { + error("snd_config_compound_add: %s", snd_strerror(err)); + goto _close; + } + } + err = snd_config_search(card, "control", &control); + if (err == 0) { + err = snd_config_delete(control); + if (err < 0) { + error("snd_config_delete: %s", snd_strerror(err)); + goto _close; + } + } + err = snd_ctl_elem_list(handle, list); + if (err < 0) { + error("Cannot determine controls: %s", snd_strerror(err)); + goto _close; + } + count = snd_ctl_elem_list_get_count(list); + err = snd_config_compound_add(card, "control", count > 0, &control); + if (err < 0) { + error("snd_config_compound_add: %s", snd_strerror(err)); + goto _close; + } + if (count == 0) { + err = 0; + goto _close; + } + snd_ctl_elem_list_set_offset(list, 0); + if (snd_ctl_elem_list_alloc_space(list, count) < 0) { + error("No enough memory..."); + goto _close; + } + if ((err = snd_ctl_elem_list(handle, list)) < 0) { + error("Cannot determine controls (2): %s", snd_strerror(err)); + goto _free; + } + for (idx = 0; idx < count; ++idx) { + snd_ctl_elem_list_get_id(list, idx, elem_id); + err = get_control(handle, elem_id, control); + if (err < 0) + goto _free; + } + + err = 0; + _free: + snd_ctl_elem_list_free_space(list); + _close: + snd_ctl_close(handle); + return err; +} + +static long config_iface(snd_config_t *n) +{ + long i; + long long li; + snd_ctl_elem_iface_t idx; + const char *str; + switch (snd_config_get_type(n)) { + case SND_CONFIG_TYPE_INTEGER: + snd_config_get_integer(n, &i); + return i; + case SND_CONFIG_TYPE_INTEGER64: + snd_config_get_integer64(n, &li); + return li; + case SND_CONFIG_TYPE_STRING: + snd_config_get_string(n, &str); + break; + default: + return -1; + } + for (idx = 0; idx <= SND_CTL_ELEM_IFACE_LAST; idx++) { + if (strcasecmp(snd_ctl_elem_iface_name(idx), str) == 0) + return idx; + } + return -1; +} + +static int config_bool(snd_config_t *n, int doit) +{ + const char *str; + long val; + long long lval; + + switch (snd_config_get_type(n)) { + case SND_CONFIG_TYPE_INTEGER: + snd_config_get_integer(n, &val); + if (val < 0 || val > 1) + return -1; + return val; + case SND_CONFIG_TYPE_INTEGER64: + snd_config_get_integer64(n, &lval); + if (lval < 0 || lval > 1) + return -1; + return (int) lval; + case SND_CONFIG_TYPE_STRING: + snd_config_get_string(n, &str); + break; + case SND_CONFIG_TYPE_COMPOUND: + if (!force_restore || !doit) + return -1; + n = snd_config_iterator_entry(snd_config_iterator_first(n)); + return config_bool(n, doit); + default: + return -1; + } + if (strcmp(str, "on") == 0 || strcmp(str, "true") == 0) + return 1; + if (strcmp(str, "off") == 0 || strcmp(str, "false") == 0) + return 0; + return -1; +} + +static int config_enumerated(snd_config_t *n, snd_ctl_t *handle, + snd_ctl_elem_info_t *info, int doit) +{ + const char *str; + long val; + long long lval; + unsigned int idx, items; + + switch (snd_config_get_type(n)) { + case SND_CONFIG_TYPE_INTEGER: + snd_config_get_integer(n, &val); + return val; + case SND_CONFIG_TYPE_INTEGER64: + snd_config_get_integer64(n, &lval); + return (int) lval; + case SND_CONFIG_TYPE_STRING: + snd_config_get_string(n, &str); + break; + case SND_CONFIG_TYPE_COMPOUND: + if (!force_restore || !doit) + return -1; + n = snd_config_iterator_entry(snd_config_iterator_first(n)); + return config_enumerated(n, handle, info, doit); + default: + return -1; + } + items = snd_ctl_elem_info_get_items(info); + for (idx = 0; idx < items; idx++) { + int err; + snd_ctl_elem_info_set_item(info, idx); + err = snd_ctl_elem_info(handle, info); + if (err < 0) { + error("snd_ctl_elem_info: %s", snd_strerror(err)); + return err; + } + if (strcmp(str, snd_ctl_elem_info_get_item_name(info)) == 0) + return idx; + } + return -1; +} + +static int config_integer(snd_config_t *n, long *val, int doit) +{ + int err = snd_config_get_integer(n, val); + if (err < 0 && force_restore && doit) { + if (snd_config_get_type(n) != SND_CONFIG_TYPE_COMPOUND) + return err; + n = snd_config_iterator_entry(snd_config_iterator_first(n)); + return config_integer(n, val, doit); + } + return err; +} + +static int config_integer64(snd_config_t *n, long long *val, int doit) +{ + int err = snd_config_get_integer64(n, val); + if (err < 0 && force_restore && doit) { + if (snd_config_get_type(n) != SND_CONFIG_TYPE_COMPOUND) + return err; + n = snd_config_iterator_entry(snd_config_iterator_first(n)); + return config_integer64(n, val, doit); + } + return err; +} + +static int check_comment_access(snd_config_t *conf, const char *str) +{ + snd_config_iterator_t i, next; + + snd_config_for_each(i, next, conf) { + snd_config_t *n = snd_config_iterator_entry(i); + const char *id, *s; + if (snd_config_get_id(n, &id) < 0) + continue; + if (strcmp(id, "access") == 0) { + if (snd_config_get_string(n, &s) < 0) + return 0; + if (strstr(s, str)) + return 1; + } + } + return 0; +} + +/* + * get the item type from the given comment config + */ +static int get_comment_type(snd_config_t *n) +{ + static const snd_ctl_elem_type_t types[] = { + SND_CTL_ELEM_TYPE_BOOLEAN, + SND_CTL_ELEM_TYPE_INTEGER, + SND_CTL_ELEM_TYPE_ENUMERATED, + SND_CTL_ELEM_TYPE_BYTES, + SND_CTL_ELEM_TYPE_IEC958, + SND_CTL_ELEM_TYPE_INTEGER64, + }; + const char *type; + unsigned int i; + + if (snd_config_get_string(n, &type) < 0) + return -EINVAL; + for (i = 0; i < ARRAY_SIZE(types); ++i) + if (strcmp(type, snd_ctl_elem_type_name(types[i])) == 0) + return types[i]; + return -EINVAL; +} + +/* + * get the value range from the given comment config + */ +static int get_comment_range(snd_config_t *n, int ctype, + long *imin, long *imax, long *istep) +{ + const char *s; + int err; + + if (snd_config_get_string(n, &s) < 0) + return -EINVAL; + switch (ctype) { + case SND_CTL_ELEM_TYPE_INTEGER: + err = sscanf(s, "%li - %li (step %li)", imin, imax, istep); + if (err != 3) { + istep = 0; + err = sscanf(s, "%li - %li", imin, imax); + if (err != 2) + return -EINVAL; + } + break; + default: + return -EINVAL; + } + return 0; +} + +struct string_array { + unsigned int count; + const char **strings; +}; + +static int get_comment_items(snd_config_t *n, struct string_array *items) +{ + snd_config_iterator_t it, next; + unsigned int i; + int err; + + snd_config_for_each(it, next, n) { + snd_config_t *item = snd_config_iterator_entry(it); + const char *id; + unsigned int numid; + + if (snd_config_get_id(item, &id) < 0) + return -EINVAL; + numid = atoi(id); + if (numid > 999999) + return -EINVAL; + + if (numid >= items->count) { + const char **strings = realloc(items->strings, (numid + 1) * sizeof(char *)); + if (!strings) + return -ENOMEM; + for (i = items->count; i < numid + 1; ++i) + strings[i] = NULL; + items->count = numid + 1; + items->strings = strings; + } + err = snd_config_get_string(item, &items->strings[numid]); + if (err < 0) + return err; + } + + for (i = 0; i < items->count; ++i) + if (!items->strings[i]) + return -EINVAL; + + return 0; +} + +static int add_user_control(snd_ctl_t *handle, snd_ctl_elem_info_t *info, snd_config_t *conf) +{ + snd_ctl_elem_id_t *id; + snd_config_iterator_t i, next; + long imin, imax, istep; + snd_ctl_elem_type_t ctype; + unsigned int count; + struct string_array enum_items; + int err; + unsigned int *tlv; + + imin = imax = istep = 0; + count = 0; + ctype = SND_CTL_ELEM_TYPE_NONE; + enum_items.count = 0; + enum_items.strings = NULL; + tlv = NULL; + snd_config_for_each(i, next, conf) { + snd_config_t *n = snd_config_iterator_entry(i); + const char *id; + if (snd_config_get_id(n, &id) < 0) + continue; + if (strcmp(id, "type") == 0) { + err = get_comment_type(n); + if (err < 0) + goto error; + ctype = err; + continue; + } + if (strcmp(id, "range") == 0) { + err = get_comment_range(n, ctype, &imin, &imax, &istep); + if (err < 0) + goto error; + continue; + } + if (strcmp(id, "count") == 0) { + long v; + if ((err = snd_config_get_integer(n, &v)) < 0) + goto error; + count = v; + continue; + } + if (strcmp(id, "item") == 0) { + err = get_comment_items(n, &enum_items); + if (err < 0) + goto error; + continue; + } + if (strcmp(id, "tlv") == 0) { + const char *s; + if ((err = snd_config_get_string(n, &s)) < 0) + goto error; + if (tlv) + free(tlv); + if ((tlv = str_to_tlv(s)) == NULL) { + err = -EINVAL; + goto error; + } + continue; + } + } + + snd_ctl_elem_id_alloca(&id); + snd_ctl_elem_info_get_id(info, id); + if (count <= 0) + count = 1; + switch (ctype) { + case SND_CTL_ELEM_TYPE_INTEGER: + if (imin > imax || istep > imax - imin) { + err = -EINVAL; + goto error; + } + err = snd_ctl_elem_add_integer(handle, id, count, imin, imax, istep); + if (err < 0) + goto error; + if (tlv) + snd_ctl_elem_tlv_write(handle, id, tlv); + break; + case SND_CTL_ELEM_TYPE_BOOLEAN: + err = snd_ctl_elem_add_boolean(handle, id, count); + break; + case SND_CTL_ELEM_TYPE_ENUMERATED: + err = snd_ctl_elem_add_enumerated(handle, id, count, + enum_items.count, enum_items.strings); + break; + case SND_CTL_ELEM_TYPE_IEC958: + err = snd_ctl_elem_add_iec958(handle, id); + break; + default: + err = -EINVAL; + break; + } + + error: + free(tlv); + free(enum_items.strings); + if (err < 0) + return err; + return snd_ctl_elem_info(handle, info); +} + +/* + * check whether the config item has the same of compatible type + */ +static int check_comment_type(snd_config_t *conf, int type) +{ + snd_config_t *n; + int ctype; + + if (snd_config_search(conf, "type", &n) < 0) + return 0; /* not defined */ + ctype = get_comment_type(n); + if (ctype == type) + return 0; + if ((ctype == SND_CTL_ELEM_TYPE_BOOLEAN || + ctype == SND_CTL_ELEM_TYPE_INTEGER || + ctype == SND_CTL_ELEM_TYPE_INTEGER64 || + ctype == SND_CTL_ELEM_TYPE_ENUMERATED) && + (type == SND_CTL_ELEM_TYPE_BOOLEAN || + type == SND_CTL_ELEM_TYPE_INTEGER || + type == SND_CTL_ELEM_TYPE_INTEGER64 || + type == SND_CTL_ELEM_TYPE_ENUMERATED)) + return 0; /* OK, compatible */ + return -EINVAL; +} + +/* + * convert from an old value to a new value with the same dB level + */ +static int convert_to_new_db(snd_config_t *value, long omin, long omax, + long nmin, long nmax, + long odbmin, long odbmax, + snd_config_t *comment, const char *index, + snd_ctl_t *device, snd_ctl_elem_id_t *id, + int doit) +{ + snd_config_t *db_node; + long db, val; + int err; + + if (snd_config_searchv(comment, &db_node, "dbvalue", index, NULL) < 0 || + snd_config_get_integer(db_node, &db) < 0) { + err = config_integer(value, &val, doit); + if (err < 0) + return err; + if (val < omin || val > omax) + return -EINVAL; + db = ((val - omin) * (odbmax - odbmin)) / (omax - omin) + odbmin; + } + + err = snd_ctl_convert_from_dB(device, id, db, &val, db > 0); + if (err < 0) + return err; + if (val < nmin) + val = nmin; + else if (val > nmax) + val = nmax; + return snd_config_set_integer(value, val); +} + +/* + * compare the current value range with the old range in comments. + * also, if dB information is available, try to compare them. + * if any change occurs, try to keep the same dB level. + */ +static int check_comment_range(snd_ctl_t *handle, snd_config_t *conf, + snd_ctl_elem_info_t *info, snd_config_t *value, + int doit) +{ + snd_config_t *n; + long omin, omax, ostep; + long nmin, nmax; + long odbmin, odbmax; + long ndbmin, ndbmax; + snd_ctl_elem_id_t *id; + + if (snd_config_search(conf, "range", &n) < 0) + return 0; + if (get_comment_range(n, SND_CTL_ELEM_TYPE_INTEGER, + &omin, &omax, &ostep) < 0) + return 0; + nmin = snd_ctl_elem_info_get_min(info); + nmax = snd_ctl_elem_info_get_max(info); + if (omin != nmin && omax != nmax) { + /* Hey, the range mismatches */ + if (!force_restore || !doit) + return -EINVAL; + } + if (omin >= omax || nmin >= nmax) + return 0; /* invalid values */ + + if (snd_config_search(conf, "dbmin", &n) < 0) + return 0; + if (config_integer(n, &odbmin, doit) < 0) + return 0; + if (snd_config_search(conf, "dbmax", &n) < 0) + return 0; + if (config_integer(n, &odbmax, doit) < 0) + return 0; + if (odbmin >= odbmax) + return 0; /* invalid values */ + snd_ctl_elem_id_alloca(&id); + snd_ctl_elem_info_get_id(info, id); + if (snd_ctl_get_dB_range(handle, id, &ndbmin, &ndbmax) < 0) + return 0; + if (ndbmin >= ndbmax) + return 0; /* invalid values */ + if (omin == nmin && omax == nmax && + odbmin == ndbmin && odbmax == ndbmax) + return 0; /* OK, identical one */ + + /* Let's guess the current value from dB range */ + if (snd_config_get_type(value) == SND_CONFIG_TYPE_COMPOUND) { + snd_config_iterator_t i, next; + snd_config_for_each(i, next, value) { + snd_config_t *n = snd_config_iterator_entry(i); + const char *idxstr; + if (snd_config_get_id(n, &idxstr) < 0) + continue; + convert_to_new_db(n, omin, omax, nmin, nmax, + odbmin, odbmax, conf, idxstr, + handle, id, doit); + } + } else + convert_to_new_db(value, omin, omax, nmin, nmax, + odbmin, odbmax, conf, "0", + handle, id, doit); + return 0; +} + +static int restore_config_value(snd_ctl_t *handle, snd_ctl_elem_info_t *info, + snd_ctl_elem_iface_t type, + snd_config_t *value, + snd_ctl_elem_value_t *ctl, int idx, + int doit) +{ + long val; + long long lval; + int err; + + switch (type) { + case SND_CTL_ELEM_TYPE_BOOLEAN: + val = config_bool(value, doit); + if (val >= 0) { + snd_ctl_elem_value_set_boolean(ctl, idx, val); + return 1; + } + break; + case SND_CTL_ELEM_TYPE_INTEGER: + err = config_integer(value, &val, doit); + if (err == 0) { + snd_ctl_elem_value_set_integer(ctl, idx, val); + return 1; + } + break; + case SND_CTL_ELEM_TYPE_INTEGER64: + err = config_integer64(value, &lval, doit); + if (err == 0) { + snd_ctl_elem_value_set_integer64(ctl, idx, lval); + return 1; + } + break; + case SND_CTL_ELEM_TYPE_ENUMERATED: + val = config_enumerated(value, handle, info, doit); + if (val >= 0) { + snd_ctl_elem_value_set_enumerated(ctl, idx, val); + return 1; + } + break; + case SND_CTL_ELEM_TYPE_BYTES: + case SND_CTL_ELEM_TYPE_IEC958: + break; + default: + cerror(doit, "Unknow control type: %d", type); + return -EINVAL; + } + return 0; +} + +static int restore_config_value2(snd_ctl_t *handle, snd_ctl_elem_info_t *info, + snd_ctl_elem_iface_t type, + snd_config_t *value, + snd_ctl_elem_value_t *ctl, int idx, + unsigned int numid, int doit) +{ + int err = restore_config_value(handle, info, type, value, ctl, idx, doit); + long val; + + if (err != 0) + return err; + switch (type) { + case SND_CTL_ELEM_TYPE_BYTES: + case SND_CTL_ELEM_TYPE_IEC958: + err = snd_config_get_integer(value, &val); + if (err < 0 || val < 0 || val > 255) { + cerror(doit, "bad control.%d.value.%d content", numid, idx); + return force_restore && doit ? 0 : -EINVAL; + } + snd_ctl_elem_value_set_byte(ctl, idx, val); + return 1; + default: + break; + } + return 0; +} + +static int set_control(snd_ctl_t *handle, snd_config_t *control, + int *maxnumid, int doit) +{ + snd_ctl_elem_value_t *ctl; + snd_ctl_elem_info_t *info; + snd_config_iterator_t i, next; + unsigned int numid1; + snd_ctl_elem_iface_t iface = -1; + int iface1; + const char *name1; + unsigned int numid; + snd_ctl_elem_type_t type; + unsigned int count; + long device = -1; + long device1; + long subdevice = -1; + long subdevice1; + const char *name = NULL; + long index1; + long index = -1; + snd_config_t *value = NULL; + snd_config_t *comment = NULL; + unsigned int idx; + int err; + char *set; + const char *id; + snd_ctl_elem_value_alloca(&ctl); + snd_ctl_elem_info_alloca(&info); + if (snd_config_get_type(control) != SND_CONFIG_TYPE_COMPOUND) { + cerror(doit, "control is not a compound"); + return -EINVAL; + } + err = snd_config_get_id(control, &id); + if (err < 0) { + cerror(doit, "unable to get id"); + return -EINVAL; + } + numid = atoi(id); + if ((int)numid > *maxnumid) + *maxnumid = numid; + snd_config_for_each(i, next, control) { + snd_config_t *n = snd_config_iterator_entry(i); + const char *fld; + if (snd_config_get_id(n, &fld) < 0) + continue; + if (strcmp(fld, "comment") == 0) { + if (snd_config_get_type(n) != SND_CONFIG_TYPE_COMPOUND) { + cerror(doit, "control.%d.%s is invalid", numid, fld); + return -EINVAL; + } + comment = n; + continue; + } + if (strcmp(fld, "iface") == 0) { + iface = (snd_ctl_elem_iface_t)config_iface(n); + continue; + } + if (strcmp(fld, "device") == 0) { + if (snd_config_get_type(n) != SND_CONFIG_TYPE_INTEGER) { + cerror(doit, "control.%d.%s is invalid", numid, fld); + return -EINVAL; + } + snd_config_get_integer(n, &device); + continue; + } + if (strcmp(fld, "subdevice") == 0) { + if (snd_config_get_type(n) != SND_CONFIG_TYPE_INTEGER) { + cerror(doit, "control.%d.%s is invalid", numid, fld); + return -EINVAL; + } + snd_config_get_integer(n, &subdevice); + continue; + } + if (strcmp(fld, "name") == 0) { + if (snd_config_get_type(n) != SND_CONFIG_TYPE_STRING) { + cerror(doit, "control.%d.%s is invalid", numid, fld); + return -EINVAL; + } + snd_config_get_string(n, &name); + continue; + } + if (strcmp(fld, "index") == 0) { + if (snd_config_get_type(n) != SND_CONFIG_TYPE_INTEGER) { + cerror(doit, "control.%d.%s is invalid", numid, fld); + return -EINVAL; + } + snd_config_get_integer(n, &index); + continue; + } + if (strcmp(fld, "value") == 0) { + value = n; + continue; + } + cerror(doit, "unknown control.%d.%s field", numid, fld); + } + if (!value) { + cerror(doit, "missing control.%d.value", numid); + return -EINVAL; + } + if (device < 0) + device = 0; + if (subdevice < 0) + subdevice = 0; + if (index < 0) + index = 0; + + err = -EINVAL; + if (!force_restore) { + snd_ctl_elem_info_set_numid(info, numid); + err = snd_ctl_elem_info(handle, info); + } + if (err < 0 && name) { + snd_ctl_elem_info_set_numid(info, 0); + snd_ctl_elem_info_set_interface(info, iface); + snd_ctl_elem_info_set_device(info, device); + snd_ctl_elem_info_set_subdevice(info, subdevice); + snd_ctl_elem_info_set_name(info, name); + snd_ctl_elem_info_set_index(info, index); + err = snd_ctl_elem_info(handle, info); + if (err < 0 && comment && check_comment_access(comment, "user")) { + err = add_user_control(handle, info, comment); + if (err < 0) { + cerror(doit, "failed to add user control #%d (%s)", + numid, snd_strerror(err)); + return err; + } + } + } + if (err < 0) { + cerror(doit, "failed to obtain info for control #%d (%s)", numid, snd_strerror(err)); + return -ENOENT; + } + numid1 = snd_ctl_elem_info_get_numid(info); + iface1 = snd_ctl_elem_info_get_interface(info); + device1 = snd_ctl_elem_info_get_device(info); + subdevice1 = snd_ctl_elem_info_get_subdevice(info); + name1 = snd_ctl_elem_info_get_name(info); + index1 = snd_ctl_elem_info_get_index(info); + count = snd_ctl_elem_info_get_count(info); + type = snd_ctl_elem_info_get_type(info); + if (err |= numid != numid1 && !force_restore) + cerror(doit, "warning: numid mismatch (%d/%d) for control #%d", + numid, numid1, numid); + if (err |= iface != iface1) + cerror(doit, "warning: iface mismatch (%d/%d) for control #%d", iface, iface1, numid); + if (err |= device != device1) + cerror(doit, "warning: device mismatch (%ld/%ld) for control #%d", device, device1, numid); + if (err |= subdevice != subdevice1) + cerror(doit, "warning: subdevice mismatch (%ld/%ld) for control #%d", subdevice, subdevice1, numid); + if (err |= strcmp(name, name1)) + cerror(doit, "warning: name mismatch (%s/%s) for control #%d", name, name1, numid); + if (err |= index != index1) + cerror(doit, "warning: index mismatch (%ld/%ld) for control #%d", index, index1, numid); + if (err < 0) { + cerror(doit, "failed to obtain info for control #%d (%s)", numid, snd_strerror(err)); + return -ENOENT; + } + + if (comment) { + if (check_comment_type(comment, type) < 0) + cerror(doit, "incompatible field type for control #%d", numid); + if (type == SND_CTL_ELEM_TYPE_INTEGER) { + if (check_comment_range(handle, comment, info, value, doit) < 0) { + cerror(doit, "value range mismatch for control #%d", + numid); + return -EINVAL; + } + } + /* inactive controls are not restored */ + if (comment && check_comment_access(comment, "inactive")) + return 0; + } + + if (snd_ctl_elem_info_is_inactive(info) || + !snd_ctl_elem_info_is_writable(info)) + return 0; + snd_ctl_elem_value_set_numid(ctl, numid1); + + if (count == 1) { + err = restore_config_value(handle, info, type, value, ctl, 0, doit); + if (err < 0) + return err; + if (err > 0) + goto _ok; + } + switch (type) { + case SND_CTL_ELEM_TYPE_BYTES: + case SND_CTL_ELEM_TYPE_IEC958: + { + const char *buf; + err = snd_config_get_string(value, &buf); + if (err >= 0) { + int c1 = 0; + int len = strlen(buf); + unsigned int idx = 0; + int size = type == SND_CTL_ELEM_TYPE_BYTES ? + count : sizeof(snd_aes_iec958_t); + if (size * 2 != len) { + cerror(doit, "bad control.%d.value contents\n", numid); + return -EINVAL; + } + while (*buf) { + int c = *buf++; + if ((c = hextodigit(c)) < 0) { + cerror(doit, "bad control.%d.value contents\n", numid); + return -EINVAL; + } + if (idx % 2 == 1) + snd_ctl_elem_value_set_byte(ctl, idx / 2, c1 << 4 | c); + else + c1 = c; + idx++; + } + goto _ok; + } + } + default: + break; + } + if (snd_config_get_type(value) != SND_CONFIG_TYPE_COMPOUND) { + if (!force_restore || !doit) { + cerror(doit, "bad control.%d.value type", numid); + return -EINVAL; + } + for (idx = 0; idx < count; ++idx) { + err = restore_config_value2(handle, info, type, value, + ctl, idx, numid, doit); + if (err < 0) + return err; + } + goto _ok; + } + + set = (char*) alloca(count); + memset(set, 0, count); + snd_config_for_each(i, next, value) { + snd_config_t *n = snd_config_iterator_entry(i); + const char *id; + if (snd_config_get_id(n, &id) < 0) + continue; + idx = atoi(id); + if (idx >= count || set[idx]) { + cerror(doit, "bad control.%d.value index", numid); + if (!force_restore || !doit) + return -EINVAL; + continue; + } + err = restore_config_value2(handle, info, type, n, + ctl, idx, numid, doit); + if (err < 0) + return err; + if (err > 0) + set[idx] = 1; + } + for (idx = 0; idx < count; ++idx) { + if (!set[idx]) { + cerror(doit, "control.%d.value.%d is not specified", numid, idx); + if (!force_restore || !doit) + return -EINVAL; + } + } + + _ok: + err = doit ? snd_ctl_elem_write(handle, ctl) : 0; + if (err < 0) { + error("Cannot write control '%d:%ld:%ld:%s:%ld' : %s", (int)iface, device, subdevice, name, index, snd_strerror(err)); + return err; + } + return 0; +} + +static int set_controls(int card, snd_config_t *top, int doit) +{ + snd_ctl_t *handle; + snd_ctl_card_info_t *info; + snd_config_t *control; + snd_config_iterator_t i, next; + int err, maxnumid = -1; + char name[32], tmpid[16]; + const char *id; + snd_ctl_card_info_alloca(&info); + + sprintf(name, "hw:%d", card); + dbg("device='%s', doit=%i", name, doit); + err = snd_ctl_open(&handle, name, 0); + if (err < 0) { + error("snd_ctl_open error: %s", snd_strerror(err)); + return err; + } + err = snd_ctl_card_info(handle, info); + if (err < 0) { + error("snd_ctl_card_info error: %s", snd_strerror(err)); + goto _close; + } + id = snd_ctl_card_info_get_id(info); + dbg("card-info-id: '%s'", id); + err = snd_config_searchv(top, &control, "state", id, "control", 0); + if (err < 0) { + if (force_restore) { + sprintf(tmpid, "card%d", card); + err = snd_config_searchv(top, &control, "state", tmpid, "control", 0); + if (! err) + id = tmpid; + } + if (err < 0) { + fprintf(stderr, "No state is present for card %s\n", id); + goto _close; + } + id = tmpid; + } + if (snd_config_get_type(control) != SND_CONFIG_TYPE_COMPOUND) { + cerror(doit, "state.%s.control is not a compound\n", id); + return -EINVAL; + } + snd_config_for_each(i, next, control) { + snd_config_t *n = snd_config_iterator_entry(i); + err = set_control(handle, n, &maxnumid, doit); + if (err < 0 && (!force_restore || !doit)) + goto _close; + } + + dbg("maxnumid=%i", maxnumid); + /* check if we have additional controls in driver */ + /* in this case we should go through init procedure */ + if (!doit && maxnumid >= 0) { + snd_ctl_elem_info_t *info; + snd_ctl_elem_info_alloca(&info); + snd_ctl_elem_info_set_numid(info, maxnumid+1); + if (snd_ctl_elem_info(handle, info) == 0) { + /* not very informative */ + /* but value is used for check only */ + err = -EAGAIN; + dbg("more controls than maxnumid?"); + goto _close; + } + } + + _close: + snd_ctl_close(handle); + dbg("result code: %i", err); + return err; +} + +int save_state(const char *file, const char *cardname) +{ + int err; + snd_config_t *config; + snd_input_t *in; + snd_output_t *out; + int stdio; + char *nfile = NULL; + int lock_fd = -EINVAL; + + err = snd_config_top(&config); + if (err < 0) { + error("snd_config_top error: %s", snd_strerror(err)); + return err; + } + stdio = !strcmp(file, "-"); + if (!stdio) { + nfile = malloc(strlen(file) + 5); + if (nfile == NULL) { + error("No enough memory..."); + err = -ENOMEM; + goto out; + } + strcpy(nfile, file); + strcat(nfile, ".new"); + lock_fd = state_lock(file, 10); + if (lock_fd < 0) { + err = lock_fd; + goto out; + } + } + if (!stdio && (err = snd_input_stdio_open(&in, file, "r")) >= 0) { + err = snd_config_load(config, in); + snd_input_close(in); +#if 0 + if (err < 0) { + error("snd_config_load error: %s", snd_strerror(err)); + goto out; + } +#endif + } + + if (!cardname) { + int card, first = 1; + + card = -1; + /* find each installed soundcards */ + while (1) { + if (snd_card_next(&card) < 0) + break; + if (card < 0) { + if (first) { + if (ignore_nocards) { + err = 0; + goto out; + } else { + error("No soundcards found..."); + err = -ENODEV; + goto out; + } + } + break; + } + first = 0; + if ((err = get_controls(card, config))) + goto out; + } + } else { + int cardno; + + cardno = snd_card_get_index(cardname); + if (cardno < 0) { + error("Cannot find soundcard '%s'...", cardname); + err = cardno; + goto out; + } + if ((err = get_controls(cardno, config))) { + goto out; + } + } + + if (stdio) { + err = snd_output_stdio_attach(&out, stdout, 0); + } else { + err = snd_output_stdio_open(&out, nfile, "w"); + } + if (err < 0) { + error("Cannot open %s for writing: %s", file, snd_strerror(err)); + err = -errno; + goto out; + } + err = snd_config_save(config, out); + snd_output_close(out); + if (err < 0) { + error("snd_config_save: %s", snd_strerror(err)); + } else if (nfile) { + err = rename(nfile, file); + if (err < 0) + error("rename failed: %s (%s)", strerror(-err), file); + } +out: + if (!stdio && lock_fd >= 0) + state_unlock(lock_fd, file); + free(nfile); + snd_config_delete(config); + snd_config_update_free_global(); + return err; +} + +int load_state(const char *file, const char *initfile, int initflags, + const char *cardname, int do_init) +{ + int err, finalerr = 0; + snd_config_t *config; + snd_input_t *in; + int stdio, lock_fd = -EINVAL; + + err = snd_config_top(&config); + if (err < 0) { + error("snd_config_top error: %s", snd_strerror(err)); + return err; + } + stdio = !strcmp(file, "-"); + if (stdio) { + err = snd_input_stdio_attach(&in, stdin, 0); + } else { + lock_fd = state_lock(file, 10); + err = lock_fd >= 0 ? snd_input_stdio_open(&in, file, "r") : lock_fd; + } + if (err >= 0) { + err = snd_config_load(config, in); + snd_input_close(in); + if (lock_fd >= 0) + state_unlock(lock_fd, file); + if (err < 0) { + error("snd_config_load error: %s", snd_strerror(err)); + goto out; + } + } else { + int card, first = 1; + char cardname1[16]; + + if (lock_fd >= 0) + state_unlock(lock_fd, file); + error("Cannot open %s for reading: %s", file, snd_strerror(err)); + finalerr = err; + if (cardname) { + card = snd_card_get_index(cardname); + if (card < 0) { + error("Cannot find soundcard '%s'...", cardname); + err = -ENODEV; + goto out; + } + goto single; + } else { + card = -1; + } + /* find each installed soundcards */ + while (!cardname) { + if (snd_card_next(&card) < 0) + break; + if (card < 0) + break; +single: + first = 0; + if (!do_init) + break; + sprintf(cardname1, "%i", card); + err = init(initfile, initflags, cardname1); + if (err < 0) { + finalerr = err; + initfailed(card, "init", err); + } + initfailed(card, "restore", -ENOENT); + } + if (first) + finalerr = 0; /* no cards, no error code */ + err = finalerr; + goto out; + } + + if (!cardname) { + int card, first = 1; + char cardname1[16]; + + card = -1; + /* find each installed soundcards */ + while (1) { + if (snd_card_next(&card) < 0) + break; + if (card < 0) { + if (first) { + if (ignore_nocards) { + err = 0; + goto out; + } else { + error("No soundcards found..."); + err = -ENODEV; + goto out; + } + } + break; + } + first = 0; + /* do a check if controls matches state file */ + if (do_init && set_controls(card, config, 0)) { + sprintf(cardname1, "%i", card); + err = init(initfile, initflags, cardname1); + if (err < 0) { + initfailed(card, "init", err); + finalerr = err; + } + } + if ((err = set_controls(card, config, 1))) { + if (!force_restore) + finalerr = err; + initfailed(card, "restore", err); + } + } + } else { + int cardno; + + cardno = snd_card_get_index(cardname); + if (cardno < 0) { + error("Cannot find soundcard '%s'...", cardname); + err = -ENODEV; + goto out; + } + /* do a check if controls matches state file */ + if (do_init && set_controls(cardno, config, 0)) { + err = init(initfile, initflags, cardname); + if (err < 0) { + initfailed(cardno, "init", err); + finalerr = err; + } + } + if ((err = set_controls(cardno, config, 1))) { + initfailed(cardno, "restore", err); + if (!force_restore) + goto out; + } + } + err = finalerr; +out: + snd_config_delete(config); + snd_config_update_free_global(); + return err; +} diff --git a/alsactl/utils.c b/alsactl/utils.c new file mode 100644 index 0000000..a83aa0a --- /dev/null +++ b/alsactl/utils.c @@ -0,0 +1,195 @@ +/* + * Advanced Linux Sound Architecture Control Program - Support routines + * Copyright (c) by Jaroslav Kysela + * + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include "alsactl.h" + +int file_map(const char *filename, char **buf, size_t *bufsize) +{ + struct stat stats; + int fd; + + fd = open(filename, O_RDONLY); + if (fd < 0) { + return -1; + } + + if (fstat(fd, &stats) < 0) { + close(fd); + return -1; + } + + *buf = mmap(NULL, stats.st_size, PROT_READ, MAP_SHARED, fd, 0); + if (*buf == MAP_FAILED) { + close(fd); + return -1; + } + *bufsize = stats.st_size; + + close(fd); + + return 0; +} + +void file_unmap(void *buf, size_t bufsize) +{ + munmap(buf, bufsize); +} + +size_t line_width(const char *buf, size_t bufsize, size_t pos) +{ + int esc = 0; + size_t count; + + for (count = pos; count < bufsize; count++) { + if (!esc && buf[count] == '\n') + break; + esc = buf[count] == '\\'; + } + + return count - pos; +} + +void initfailed(int cardnumber, const char *reason, int exitcode) +{ + int fp; + char *str; + char sexitcode[16]; + + if (statefile == NULL) + return; + if (snd_card_get_name(cardnumber, &str) < 0) + return; + sprintf(sexitcode, "%i", exitcode); + fp = open(statefile, O_WRONLY|O_CREAT|O_APPEND, 0644); + write(fp, str, strlen(str)); + write(fp, ":", 1); + write(fp, reason, strlen(reason)); + write(fp, ":", 1); + write(fp, sexitcode, strlen(sexitcode)); + write(fp, "\n", 1); + close(fp); + free(str); +} + +static void syslog_(int prio, const char *fcn, long line, + const char *fmt, va_list ap) +{ + char buf[1024]; + + snprintf(buf, sizeof(buf), "%s: %s:%ld: ", command, fcn, line); + buf[sizeof(buf)-1] = '\0'; + vsnprintf(buf + strlen(buf), sizeof(buf)-strlen(buf), fmt, ap); + buf[sizeof(buf)-1] = '\0'; + syslog(prio, "%s", buf); +} + +void info_(const char *fcn, long line, const char *fmt, ...) +{ + va_list ap; + + va_start(ap, fmt); + if (use_syslog) { + syslog_(LOG_INFO, fcn, line, fmt, ap); + } else { + fprintf(stdout, "%s: %s:%ld: ", command, fcn, line); + vfprintf(stdout, fmt, ap); + putc('\n', stdout); + } + va_end(ap); +} + +void error_(const char *fcn, long line, const char *fmt, ...) +{ + va_list ap; + + va_start(ap, fmt); + if (use_syslog) { + syslog_(LOG_ERR, fcn, line, fmt, ap); + } else { + fprintf(stderr, "%s: %s:%ld: ", command, fcn, line); + vfprintf(stderr, fmt, ap); + putc('\n', stderr); + } + va_end(ap); +} + +void cerror_(const char *fcn, long line, int cond, const char *fmt, ...) +{ + va_list ap; + + if (!cond && !debugflag) + return; + va_start(ap, fmt); + if (use_syslog) { + syslog_(LOG_ERR, fcn, line, fmt, ap); + } else { + fprintf(stderr, "%s: %s:%ld: ", command, fcn, line); + vfprintf(stderr, fmt, ap); + putc('\n', stderr); + } + va_end(ap); +} + +void dbg_(const char *fcn, long line, const char *fmt, ...) +{ + va_list ap; + + if (!debugflag) + return; + va_start(ap, fmt); + if (use_syslog) { + syslog_(LOG_DEBUG, fcn, line, fmt, ap); + } else { + fprintf(stderr, "%s: %s:%ld: ", command, fcn, line); + vfprintf(stderr, fmt, ap); + putc('\n', stderr); + } + va_end(ap); +} + +void error_handler(const char *file, int line, const char *function, int err, const char *fmt, ...) +{ + char buf[2048]; + va_list arg; + + va_start(arg, fmt); + vsnprintf(buf, sizeof(buf), fmt, arg); + va_end(arg); + if (use_syslog) + syslog(LOG_ERR, "alsa-lib %s:%i:(%s) %s%s%s\n", file, line, function, + buf, err ? ": " : "", err ? snd_strerror(err) : ""); + else + fprintf(stderr, "alsa-lib %s:%i:(%s) %s%s%s\n", file, line, function, + buf, err ? ": " : "", err ? snd_strerror(err) : ""); +} diff --git a/alsaloop/Makefile.am b/alsaloop/Makefile.am new file mode 100644 index 0000000..4cdf20b --- /dev/null +++ b/alsaloop/Makefile.am @@ -0,0 +1,14 @@ +AM_CPPFLAGS = -I$(top_srcdir)/include +LDADD = -lm +AM_CFLAGS = -D_GNU_SOURCE +if HAVE_SAMPLERATE +LDADD += -lsamplerate +endif +# LDFLAGS = -static +# CFLAGS += -g -Wall + +bin_PROGRAMS = alsaloop +alsaloop_SOURCES = alsaloop.c pcmjob.c control.c +noinst_HEADERS = alsaloop.h +man_MANS = alsaloop.1 +EXTRA_DIST = alsaloop.1 diff --git a/alsaloop/Makefile.in b/alsaloop/Makefile.in new file mode 100644 index 0000000..9e2c6b5 --- /dev/null +++ b/alsaloop/Makefile.in @@ -0,0 +1,735 @@ +# Makefile.in generated by automake 1.16.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994-2018 Free Software Foundation, Inc. + +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + + +VPATH = @srcdir@ +am__is_gnu_make = { \ + if test -z '$(MAKELEVEL)'; then \ + false; \ + elif test -n '$(MAKE_HOST)'; then \ + true; \ + elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ + true; \ + else \ + false; \ + fi; \ +} +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + esac; \ + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +@HAVE_SAMPLERATE_TRUE@am__append_1 = -lsamplerate +bin_PROGRAMS = alsaloop$(EXEEXT) +subdir = alsaloop +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/gettext.m4 \ + $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/lib-ld.m4 \ + $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ + $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \ + $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/acinclude.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +DIST_COMMON = $(srcdir)/Makefile.am $(noinst_HEADERS) \ + $(am__DIST_COMMON) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/include/aconfig.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +am__installdirs = "$(DESTDIR)$(bindir)" "$(DESTDIR)$(man1dir)" +PROGRAMS = $(bin_PROGRAMS) +am_alsaloop_OBJECTS = alsaloop.$(OBJEXT) pcmjob.$(OBJEXT) \ + control.$(OBJEXT) +alsaloop_OBJECTS = $(am_alsaloop_OBJECTS) +alsaloop_LDADD = $(LDADD) +am__DEPENDENCIES_1 = +alsaloop_DEPENDENCIES = $(am__DEPENDENCIES_1) +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__maybe_remake_depfiles = depfiles +am__depfiles_remade = ./$(DEPDIR)/alsaloop.Po ./$(DEPDIR)/control.Po \ + ./$(DEPDIR)/pcmjob.Po +am__mv = mv -f +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +AM_V_CC = $(am__v_CC_@AM_V@) +am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) +am__v_CC_0 = @echo " CC " $@; +am__v_CC_1 = +CCLD = $(CC) +LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_CCLD = $(am__v_CCLD_@AM_V@) +am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) +am__v_CCLD_0 = @echo " CCLD " $@; +am__v_CCLD_1 = +SOURCES = $(alsaloop_SOURCES) +DIST_SOURCES = $(alsaloop_SOURCES) +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; +am__vpath_adj = case $$p in \ + $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ + *) f=$$p;; \ + esac; +am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; +am__install_max = 40 +am__nobase_strip_setup = \ + srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` +am__nobase_strip = \ + for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" +am__nobase_list = $(am__nobase_strip_setup); \ + for p in $$list; do echo "$$p $$p"; done | \ + sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ + $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ + if (++n[$$2] == $(am__install_max)) \ + { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ + END { for (dir in files) print dir, files[dir] }' +am__base_list = \ + sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ + sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' +am__uninstall_files_from_dir = { \ + test -z "$$files" \ + || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ + || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ + $(am__cd) "$$dir" && rm -f $$files; }; \ + } +man1dir = $(mandir)/man1 +NROFF = nroff +MANS = $(man_MANS) +HEADERS = $(noinst_HEADERS) +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) +# Read a list of newline-separated strings from the standard input, +# and print each of them once, without duplicates. Input order is +# *not* preserved. +am__uniquify_input = $(AWK) '\ + BEGIN { nonempty = 0; } \ + { items[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in items) print i; }; } \ +' +# Make sure the list of sources is unique. This is necessary because, +# e.g., the same source file might be shared among _SOURCES variables +# for different programs/libraries. +am__define_uniq_tagged_files = \ + list='$(am__tagged_files)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | $(am__uniquify_input)` +ETAGS = etags +CTAGS = ctags +am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/depcomp +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +ALSACTL_DAEMONSWITCH = @ALSACTL_DAEMONSWITCH@ +ALSACTL_PIDFILE_DIR = @ALSACTL_PIDFILE_DIR@ +ALSA_CFLAGS = @ALSA_CFLAGS@ +ALSA_LIBS = @ALSA_LIBS@ +ALSA_TOPOLOGY_LIBS = @ALSA_TOPOLOGY_LIBS@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +ASOUND_LOCK_DIR = @ASOUND_LOCK_DIR@ +ASOUND_STATE_DIR = @ASOUND_STATE_DIR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CURSESINC = @CURSESINC@ +CURSESLIB = @CURSESLIB@ +CURSES_CFLAGS = @CURSES_CFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +FFTW_CFLAGS = @FFTW_CFLAGS@ +FFTW_INC = @FFTW_INC@ +FFTW_LIB = @FFTW_LIB@ +GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ +GMSGFMT = @GMSGFMT@ +GMSGFMT_015 = @GMSGFMT_015@ +GREP = @GREP@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +INTLLIBS = @INTLLIBS@ +INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@ +LDFLAGS = @LDFLAGS@ +LIBICONV = @LIBICONV@ +LIBINTL = @LIBINTL@ +LIBOBJS = @LIBOBJS@ +LIBRT = @LIBRT@ +LIBS = @LIBS@ +LN_S = @LN_S@ +LTLIBICONV = @LTLIBICONV@ +LTLIBINTL = @LTLIBINTL@ +LTLIBOBJS = @LTLIBOBJS@ +MAINT = @MAINT@ +MAKEINFO = @MAKEINFO@ +MKDIR_P = @MKDIR_P@ +MSGFMT = @MSGFMT@ +MSGFMT_015 = @MSGFMT_015@ +MSGMERGE = @MSGMERGE@ +NCURSESW_CFLAGS = @NCURSESW_CFLAGS@ +NCURSESW_LIBS = @NCURSESW_LIBS@ +NCURSES_CFLAGS = @NCURSES_CFLAGS@ +NCURSES_LIBS = @NCURSES_LIBS@ +OBJEXT = @OBJEXT@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ +POSUB = @POSUB@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +SND_UTIL_MAJOR = @SND_UTIL_MAJOR@ +SND_UTIL_MINOR = @SND_UTIL_MINOR@ +SND_UTIL_SUBMINOR = @SND_UTIL_SUBMINOR@ +SND_UTIL_VERSION = @SND_UTIL_VERSION@ +STRIP = @STRIP@ +SYSTEMD_CFLAGS = @SYSTEMD_CFLAGS@ +SYSTEMD_LIBS = @SYSTEMD_LIBS@ +TESTSOUND = @TESTSOUND@ +USE_NLS = @USE_NLS@ +VERSION = @VERSION@ +XGETTEXT = @XGETTEXT@ +XGETTEXT_015 = @XGETTEXT_015@ +XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_CC = @ac_ct_CC@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +mydatadir = @mydatadir@ +ncurses5_config = @ncurses5_config@ +ncursesw5_config = @ncursesw5_config@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +rst2man_available = @rst2man_available@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +systemdsystemunitdir = @systemdsystemunitdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +udevrulesdir = @udevrulesdir@ +xmlto_available = @xmlto_available@ +AM_CPPFLAGS = -I$(top_srcdir)/include +LDADD = -lm $(am__append_1) +AM_CFLAGS = -D_GNU_SOURCE +alsaloop_SOURCES = alsaloop.c pcmjob.c control.c +noinst_HEADERS = alsaloop.h +man_MANS = alsaloop.1 +EXTRA_DIST = alsaloop.1 +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .o .obj +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign alsaloop/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --foreign alsaloop/Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): +install-binPROGRAMS: $(bin_PROGRAMS) + @$(NORMAL_INSTALL) + @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(bindir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(bindir)" || exit 1; \ + fi; \ + for p in $$list; do echo "$$p $$p"; done | \ + sed 's/$(EXEEXT)$$//' | \ + while read p p1; do if test -f $$p \ + ; then echo "$$p"; echo "$$p"; else :; fi; \ + done | \ + sed -e 'p;s,.*/,,;n;h' \ + -e 's|.*|.|' \ + -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \ + sed 'N;N;N;s,\n, ,g' | \ + $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \ + { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \ + if ($$2 == $$4) files[d] = files[d] " " $$1; \ + else { print "f", $$3 "/" $$4, $$1; } } \ + END { for (d in files) print "f", d, files[d] }' | \ + while read type dir files; do \ + if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \ + test -z "$$files" || { \ + echo " $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(bindir)$$dir'"; \ + $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \ + } \ + ; done + +uninstall-binPROGRAMS: + @$(NORMAL_UNINSTALL) + @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ + files=`for p in $$list; do echo "$$p"; done | \ + sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \ + -e 's/$$/$(EXEEXT)/' \ + `; \ + test -n "$$list" || exit 0; \ + echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \ + cd "$(DESTDIR)$(bindir)" && rm -f $$files + +clean-binPROGRAMS: + -test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS) + +alsaloop$(EXEEXT): $(alsaloop_OBJECTS) $(alsaloop_DEPENDENCIES) $(EXTRA_alsaloop_DEPENDENCIES) + @rm -f alsaloop$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(alsaloop_OBJECTS) $(alsaloop_LDADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/alsaloop.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/control.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pcmjob.Po@am__quote@ # am--include-marker + +$(am__depfiles_remade): + @$(MKDIR_P) $(@D) + @echo '# dummy' >$@-t && $(am__mv) $@-t $@ + +am--depfiles: $(am__depfiles_remade) + +.c.o: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< + +.c.obj: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` +install-man1: $(man_MANS) + @$(NORMAL_INSTALL) + @list1=''; \ + list2='$(man_MANS)'; \ + test -n "$(man1dir)" \ + && test -n "`echo $$list1$$list2`" \ + || exit 0; \ + echo " $(MKDIR_P) '$(DESTDIR)$(man1dir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(man1dir)" || exit 1; \ + { for i in $$list1; do echo "$$i"; done; \ + if test -n "$$list2"; then \ + for i in $$list2; do echo "$$i"; done \ + | sed -n '/\.1[a-z]*$$/p'; \ + fi; \ + } | while read p; do \ + if test -f $$p; then d=; else d="$(srcdir)/"; fi; \ + echo "$$d$$p"; echo "$$p"; \ + done | \ + sed -e 'n;s,.*/,,;p;h;s,.*\.,,;s,^[^1][0-9a-z]*$$,1,;x' \ + -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,' | \ + sed 'N;N;s,\n, ,g' | { \ + list=; while read file base inst; do \ + if test "$$base" = "$$inst"; then list="$$list $$file"; else \ + echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man1dir)/$$inst'"; \ + $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man1dir)/$$inst" || exit $$?; \ + fi; \ + done; \ + for i in $$list; do echo "$$i"; done | $(am__base_list) | \ + while read files; do \ + test -z "$$files" || { \ + echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(man1dir)'"; \ + $(INSTALL_DATA) $$files "$(DESTDIR)$(man1dir)" || exit $$?; }; \ + done; } + +uninstall-man1: + @$(NORMAL_UNINSTALL) + @list=''; test -n "$(man1dir)" || exit 0; \ + files=`{ for i in $$list; do echo "$$i"; done; \ + l2='$(man_MANS)'; for i in $$l2; do echo "$$i"; done | \ + sed -n '/\.1[a-z]*$$/p'; \ + } | sed -e 's,.*/,,;h;s,.*\.,,;s,^[^1][0-9a-z]*$$,1,;x' \ + -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,'`; \ + dir='$(DESTDIR)$(man1dir)'; $(am__uninstall_files_from_dir) + +ID: $(am__tagged_files) + $(am__define_uniq_tagged_files); mkid -fID $$unique +tags: tags-am +TAGS: tags + +tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + set x; \ + here=`pwd`; \ + $(am__define_uniq_tagged_files); \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: ctags-am + +CTAGS: ctags +ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + $(am__define_uniq_tagged_files); \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" +cscopelist: cscopelist-am + +cscopelist-am: $(am__tagged_files) + list='$(am__tagged_files)'; \ + case "$(srcdir)" in \ + [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ + *) sdir=$(subdir)/$(srcdir) ;; \ + esac; \ + for i in $$list; do \ + if test -f "$$i"; then \ + echo "$(subdir)/$$i"; \ + else \ + echo "$$sdir/$$i"; \ + fi; \ + done >> $(top_builddir)/cscope.files + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) distdir-am + +distdir-am: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(PROGRAMS) $(MANS) $(HEADERS) +installdirs: + for dir in "$(DESTDIR)$(bindir)" "$(DESTDIR)$(man1dir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ + done +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-binPROGRAMS clean-generic mostlyclean-am + +distclean: distclean-am + -rm -f ./$(DEPDIR)/alsaloop.Po + -rm -f ./$(DEPDIR)/control.Po + -rm -f ./$(DEPDIR)/pcmjob.Po + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: install-man + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: install-binPROGRAMS + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: install-man1 + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -f ./$(DEPDIR)/alsaloop.Po + -rm -f ./$(DEPDIR)/control.Po + -rm -f ./$(DEPDIR)/pcmjob.Po + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-binPROGRAMS uninstall-man + +uninstall-man: uninstall-man1 + +.MAKE: install-am install-strip + +.PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-am clean \ + clean-binPROGRAMS clean-generic cscopelist-am ctags ctags-am \ + distclean distclean-compile distclean-generic distclean-tags \ + distdir dvi dvi-am html html-am info info-am install \ + install-am install-binPROGRAMS install-data install-data-am \ + install-dvi install-dvi-am install-exec install-exec-am \ + install-html install-html-am install-info install-info-am \ + install-man install-man1 install-pdf install-pdf-am install-ps \ + install-ps-am install-strip installcheck installcheck-am \ + installdirs maintainer-clean maintainer-clean-generic \ + mostlyclean mostlyclean-compile mostlyclean-generic pdf pdf-am \ + ps ps-am tags tags-am uninstall uninstall-am \ + uninstall-binPROGRAMS uninstall-man uninstall-man1 + +.PRECIOUS: Makefile + + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/alsaloop/alsaloop.1 b/alsaloop/alsaloop.1 new file mode 100644 index 0000000..33fa4d1 --- /dev/null +++ b/alsaloop/alsaloop.1 @@ -0,0 +1,206 @@ +.TH ALSALOOP 1 "5 Aug 2010" +.SH NAME +alsaloop \- command\-line PCM loopback +.SH SYNOPSIS +\fBalsaloop\fP [\fI\-option\fP] [\fIcmd\fP] +.SH DESCRIPTION + +\fBalsaloop\fP allows create a PCM loopback between a PCM capture device +and a PCM playback device. + +\fBalsaloop\fP supports multiple soundcards, adaptive clock synchronization, +adaptive rate resampling using the samplerate library (if available in +the system). Also, mixer controls can be redirected from one card to +another (for example Master and PCM). + +.SH OPTIONS + +.TP +\fI\-h\fP | \fI\-\-help\fP + +Prints the help information. + +.TP +\fI\-g \fP | \fI\-\-config=\fP + +Use given configuration file. The syntax of this file is simple: one line +contains the command line options for one job. The '#' means comment and +rest of line is ignored. Example: + + # First line \- comment, second line \- first job + \-C hw:1,0 \-P hw:0,0 \-t 50000 \-T 1 + # Third line \- comment, fourth line \- second job + \-C hw:1,1 \-P hw:0,1 \-t 40000 \-T 2 + +.TP +\fI\-d\fP | \fI\-\-daemonize\fP + +Daemonize the main process and use syslog for messages. + +.TP +\fI\-P \fP | \fI\-\-pdevice=\fP + +Use given playback device. + +.TP +\fI\-C \fP | \fI\-\-cdevice=\fP + +Use given capture device. + +.TP +\fI\-X \fP | \fI\-\-pctl=\fP + +Use given CTL device for playback. + +.TP +\fI\-Y \fP | \fI\-\-cctl=\fP + +Use given CTL device for capture. + +.TP +\fI\-l \fP | \fI\-\-latency=\fP + +Requested latency in frames. + +.TP +\fI\-t \fP | \fI\-\-tlatency=\fP + +Requested latency in usec (1/1000000sec). + +.TP +\fI\-f \fP | \fI\-\-format=\fP + +Format specification (usually S16_LE S32_LE). Use \-h to list all formats. +Default format is S16_LE. + +.TP +\fI\-c \fP | \fI\-\-channels=\fP + +Channel count specification. Default value is 2. + +.TP +\fI\-c \fP | \fI\-\-rate=\fP + +Rate specification. Default value is 48000 (Hz). + +.TP +\fI\-n\fP | \fI\-\-resample\fP + +Allow rate resampling using alsa\-lib. + +.TP +\fI\-A \fP | \fI\-\-samplerate=\fP + +Use libsamplerate and choose a converter: + + 0 or sincbest \- best quality + 1 or sincmedium \- medium quality + 2 or sincfastest \- lowest quality + 3 or zerohold \- hold zero samples + 4 or linear \- worst quality - linear resampling + 5 or auto \- choose best method + +.TP +\fI\-B \fP | \fI\-\-buffer=\fP + +Buffer size in frames. + +.TP +\fI\-E \fP | \fI\-\-period=\fP + +Period size in frames. + +.TP +\fI\-s \fP | \fI\-\-seconds=\fP + +Duration of loop in seconds. + +.TP +\fI\-b\fP | \fI\-\-nblock\fP + +Non\-block mode (very early process wakeup). Eats more CPU. + +.TP +\fI\-S \fP | \fI\-\-sync=\fP + +Sync mode specification for capture to playback stream: + 0 or none \- do not touch the stream + 1 or simple \- add or remove samples to keep + both streams synchronized + 2 or captshift \- use driver for the capture device + (if supported) to compensate + the rate shift + 3 or playshift \- use driver for the playback device + (if supported) to compensate + the rate shift + 4 or samplerate \- use samplerate library to do rate resampling + 5 or auto \- automatically selects the best method + in this order: captshift, playshift, + samplerate, simple + +.TP +\fI\-T \fP | \fI\-\-thread=\fP + +Thread number (\-1 means create a unique thread). All jobs with same +thread numbers are run within one thread. + +.TP +\fI\-m \fP | \fI\-\-mixer=\fP + +Redirect mixer control from the playback card to the capture card. Format of +\fImixid\fP is SRCID(PLAYBACK)[@DSTID(PLAYBACK)]: + + "name='Master Playback Switch'@name='Another Switch'" + "name='PCM Playback Volume'" + +Known attributes: + + name \- control ID name + index \- control ID index + device \- control ID device + subdevice \- control ID subdevice + iface \- control ID interface + numid \- control ID numid + +.TP +\fI\-O \fP | \fI\-\-ossmixer=\fP + +Redirect mixer control from the OSS Mixer emulation layer (capture card) +to the ALSA layer (capture card). Format of \fIossmixid\fP is +ALSAID[,INDEX]@OSSID: + + "Master@VOLUME" + "PCM,1@ALTPCM" + +Known OSS attributes: + + VOLUME, BASS, TREBLE, SYNTH, PCM, SPEAKER, LINE, MIC, CD, IMIX, ALTPCM, + RECLEV, IGAIN, OGAIN, LINE1, LINE2, LINE3, DIGITAL1, DIGITAL2, DIGITAL3, + PHONEIN, PHONEOUT, VIDEO, RADIO, MONITOR + +.TP +\fI\-v\fP | \fI\-\-verbose\fP + +Verbose mode. Use multiple times to increase verbosity. + + +.TP +\fI\-U\fP | \fI\-\-xrun\fP + +Verbose xrun profiling. + +.TP +\fI\-W \fP | \fI\-\-wake=\fP + +Set process wake timeout. + +.SH EXAMPLES + +.TP +\fBalsaloop \-C hw:0,0 \-P hw:1,0 \-t 50000\fR + +.SH BUGS +None known. +.SH AUTHOR +\fBalsaloop\fP is by Jaroslav Kysela . +This document is by Jaroslav Kysela . diff --git a/alsaloop/alsaloop.c b/alsaloop/alsaloop.c new file mode 100644 index 0000000..6a9ce58 --- /dev/null +++ b/alsaloop/alsaloop.c @@ -0,0 +1,934 @@ +/* + * A simple PCM loopback utility with adaptive sample rate support + * + * Author: Jaroslav Kysela + * + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "alsaloop.h" + +struct loopback_thread { + int threaded; + pthread_t thread; + int exitcode; + struct loopback **loopbacks; + int loopbacks_count; + snd_output_t *output; +}; + +int quit = 0; +int verbose = 0; +int workarounds = 0; +int daemonize = 0; +int use_syslog = 0; +struct loopback **loopbacks = NULL; +int loopbacks_count = 0; +char **my_argv = NULL; +int my_argc = 0; +struct loopback_thread *threads; +int threads_count = 0; +pthread_t main_job; +int arg_default_xrun = 0; +int arg_default_wake = 0; + +static void my_exit(struct loopback_thread *thread, int exitcode) +{ + int i; + + for (i = 0; i < thread->loopbacks_count; i++) + pcmjob_done(thread->loopbacks[i]); + if (thread->threaded) { + thread->exitcode = exitcode; + pthread_exit(0); + } + exit(exitcode); +} + +static int create_loopback_handle(struct loopback_handle **_handle, + const char *device, + const char *ctldev, + const char *id) +{ + char idbuf[1024]; + struct loopback_handle *handle; + + handle = calloc(1, sizeof(*handle)); + if (handle == NULL) + return -ENOMEM; + if (device == NULL) + device = "hw:0,0"; + handle->device = strdup(device); + if (handle->device == NULL) + return -ENOMEM; + if (ctldev) { + handle->ctldev = strdup(ctldev); + if (handle->ctldev == NULL) + return -ENOMEM; + } else { + handle->ctldev = NULL; + } + snprintf(idbuf, sizeof(idbuf)-1, "%s %s", id, device); + idbuf[sizeof(idbuf)-1] = '\0'; + handle->id = strdup(idbuf); + handle->access = SND_PCM_ACCESS_RW_INTERLEAVED; + handle->format = SND_PCM_FORMAT_S16_LE; + handle->rate = handle->rate_req = 48000; + handle->channels = 2; + handle->resample = 0; + *_handle = handle; + return 0; +} + +static int create_loopback(struct loopback **_handle, + struct loopback_handle *play, + struct loopback_handle *capt, + snd_output_t *output) +{ + struct loopback *handle; + + handle = calloc(1, sizeof(*handle)); + if (handle == NULL) + return -ENOMEM; + handle->play = play; + handle->capt = capt; + play->loopback = handle; + capt->loopback = handle; + handle->latency_req = 0; + handle->latency_reqtime = 10000; + handle->loop_time = ~0UL; + handle->loop_limit = ~0ULL; + handle->output = output; + handle->state = output; +#ifdef USE_SAMPLERATE + handle->src_enable = 1; + handle->src_converter_type = SRC_SINC_BEST_QUALITY; +#endif + *_handle = handle; + return 0; +} + +static void set_loop_time(struct loopback *loop, unsigned long loop_time) +{ + loop->loop_time = loop_time; + loop->loop_limit = loop->capt->rate * loop_time; +} + +static void setscheduler(void) +{ + struct sched_param sched_param; + + if (sched_getparam(0, &sched_param) < 0) { + logit(LOG_WARNING, "Scheduler getparam failed.\n"); + return; + } + sched_param.sched_priority = sched_get_priority_max(SCHED_RR); + if (!sched_setscheduler(0, SCHED_RR, &sched_param)) { + if (verbose) + logit(LOG_WARNING, "Scheduler set to Round Robin with priority %i\n", sched_param.sched_priority); + return; + } + if (verbose) + logit(LOG_INFO, "!!!Scheduler set to Round Robin with priority %i FAILED!\n", sched_param.sched_priority); +} + +void help(void) +{ + int k; + printf( +"Usage: alsaloop [OPTION]...\n\n" +"-h,--help help\n" +"-g,--config configuration file (one line = one job specified)\n" +"-d,--daemonize daemonize the main process and use syslog for errors\n" +"-P,--pdevice playback device\n" +"-C,--cdevice capture device\n" +"-X,--pctl playback ctl device\n" +"-Y,--cctl capture ctl device\n" +"-l,--latency requested latency in frames\n" +"-t,--tlatency requested latency in usec (1/1000000sec)\n" +"-f,--format sample format\n" +"-c,--channels channels\n" +"-r,--rate rate\n" +"-n,--resample resample in alsa-lib\n" +"-A,--samplerate use converter (0=sincbest,1=sincmedium,2=sincfastest,\n" +" 3=zerohold,4=linear)\n" +"-B,--buffer buffer size in frames\n" +"-E,--period period size in frames\n" +"-s,--seconds duration of loop in seconds\n" +"-b,--nblock non-block mode (very early process wakeup)\n" +"-S,--sync sync mode(0=none,1=simple,2=captshift,3=playshift,4=samplerate,\n" +" 5=auto)\n" +"-a,--slave stream parameters slave mode (0=auto, 1=on, 2=off)\n" +"-T,--thread thread number (-1 = create unique)\n" +"-m,--mixer redirect mixer, argument is:\n" +" SRC_SLAVE_ID(PLAYBACK)[@DST_SLAVE_ID(CAPTURE)]\n" +"-O,--ossmixer rescan and redirect oss mixer, argument is:\n" +" ALSA_ID@OSS_ID (for example: \"Master@VOLUME\")\n" +"-e,--effect apply an effect (bandpass filter sweep)\n" +"-v,--verbose verbose mode (more -v means more verbose)\n" +"-w,--workaround use workaround (serialopen)\n" +"-U,--xrun xrun profiling\n" +"-W,--wake process wake timeout in ms\n" +"-z,--syslog use syslog for errors\n" +); + printf("\nRecognized sample formats are:"); + for (k = 0; k < SND_PCM_FORMAT_LAST; ++k) { + const char *s = snd_pcm_format_name(k); + if (s) + printf(" %s", s); + } + printf("\n\n"); + printf( +"Tip #1 (usable 500ms latency, good CPU usage, superb xrun prevention):\n" +" alsaloop -t 500000\n" +"Tip #2 (superb 1ms latency, but heavy CPU usage):\n" +" alsaloop -t 1000\n" +); +} + +static long timediff(struct timeval t1, struct timeval t2) +{ + signed long l; + + t1.tv_sec -= t2.tv_sec; + l = (signed long) t1.tv_usec - (signed long) t2.tv_usec; + if (l < 0) { + t1.tv_sec--; + l = 1000000 + l; + l %= 1000000; + } + return (t1.tv_sec * 1000000) + l; +} + +static void add_loop(struct loopback *loop) +{ + loopbacks = realloc(loopbacks, (loopbacks_count + 1) * + sizeof(struct loopback *)); + if (loopbacks == NULL) { + logit(LOG_CRIT, "No enough memory\n"); + exit(EXIT_FAILURE); + } + loopbacks[loopbacks_count++] = loop; +} + +static int init_mixer_control(struct loopback_control *control, + char *id) +{ + int err; + + err = snd_ctl_elem_id_malloc(&control->id); + if (err < 0) + return err; + err = snd_ctl_elem_info_malloc(&control->info); + if (err < 0) + return err; + err = snd_ctl_elem_value_malloc(&control->value); + if (err < 0) + return err; + err = control_parse_id(id, control->id); + if (err < 0) + return err; + return 0; +} + +static int add_mixers(struct loopback *loop, + char **mixers, + int mixers_count) +{ + struct loopback_mixer *mixer, *last = NULL; + char *str1; + int err; + + while (mixers_count > 0) { + mixer = calloc(1, sizeof(*mixer)); + if (mixer == NULL) + return -ENOMEM; + if (last) + last->next = mixer; + else + loop->controls = mixer; + last = mixer; + str1 = strchr(*mixers, '@'); + if (str1) + *str1 = '\0'; + err = init_mixer_control(&mixer->src, *mixers); + if (err < 0) { + logit(LOG_CRIT, "Wrong mixer control ID syntax '%s'\n", *mixers); + return -EINVAL; + } + err = init_mixer_control(&mixer->dst, str1 ? str1 + 1 : *mixers); + if (err < 0) { + logit(LOG_CRIT, "Wrong mixer control ID syntax '%s'\n", str1 ? str1 + 1 : *mixers); + return -EINVAL; + } + if (str1) + *str1 = '@'; + mixers++; + mixers_count--; + } + return 0; +} + +static int add_oss_mixers(struct loopback *loop, + char **mixers, + int mixers_count) +{ + struct loopback_ossmixer *mixer, *last = NULL; + char *str1, *str2; + + while (mixers_count > 0) { + mixer = calloc(1, sizeof(*mixer)); + if (mixer == NULL) + return -ENOMEM; + if (last) + last->next = mixer; + else + loop->oss_controls = mixer; + last = mixer; + str1 = strchr(*mixers, ','); + if (str1) + *str1 = '\0'; + str2 = strchr(str1 ? str1 + 1 : *mixers, '@'); + if (str2) + *str2 = '\0'; + mixer->alsa_id = strdup(*mixers); + if (str1) + mixer->alsa_index = atoi(str1); + mixer->oss_id = strdup(str2 ? str2 + 1 : *mixers); + if (mixer->alsa_id == NULL || mixer->oss_id == NULL) { + logit(LOG_CRIT, "Not enough memory"); + return -ENOMEM; + } + if (str1) + *str1 = ','; + if (str2) + *str2 = ','; + mixers++; + mixers_count--; + } + return 0; +} + +static void enable_syslog(void) +{ + if (!use_syslog) { + use_syslog = 1; + openlog("alsaloop", LOG_NDELAY|LOG_PID, LOG_DAEMON); + } +} + +static int parse_config_file(const char *file, snd_output_t *output); + +static int parse_config(int argc, char *argv[], snd_output_t *output, + int cmdline) +{ + struct option long_option[] = + { + {"help", 0, NULL, 'h'}, + {"config", 1, NULL, 'g'}, + {"daemonize", 0, NULL, 'd'}, + {"pdevice", 1, NULL, 'P'}, + {"cdevice", 1, NULL, 'C'}, + {"pctl", 1, NULL, 'X'}, + {"cctl", 1, NULL, 'Y'}, + {"latency", 1, NULL, 'l'}, + {"tlatency", 1, NULL, 't'}, + {"format", 1, NULL, 'f'}, + {"channels", 1, NULL, 'c'}, + {"rate", 1, NULL, 'r'}, + {"buffer", 1, NULL, 'B'}, + {"period", 1, NULL, 'E'}, + {"seconds", 1, NULL, 's'}, + {"nblock", 0, NULL, 'b'}, + {"effect", 0, NULL, 'e'}, + {"verbose", 0, NULL, 'v'}, + {"resample", 0, NULL, 'n'}, + {"samplerate", 1, NULL, 'A'}, + {"sync", 1, NULL, 'S'}, + {"slave", 1, NULL, 'a'}, + {"thread", 1, NULL, 'T'}, + {"mixer", 1, NULL, 'm'}, + {"ossmixer", 1, NULL, 'O'}, + {"workaround", 1, NULL, 'w'}, + {"xrun", 0, NULL, 'U'}, + {"syslog", 0, NULL, 'z'}, + {NULL, 0, NULL, 0}, + }; + int err, morehelp; + char *arg_config = NULL; + char *arg_pdevice = NULL; + char *arg_cdevice = NULL; + char *arg_pctl = NULL; + char *arg_cctl = NULL; + unsigned int arg_latency_req = 0; + unsigned int arg_latency_reqtime = 10000; + snd_pcm_format_t arg_format = SND_PCM_FORMAT_S16_LE; + unsigned int arg_channels = 2; + unsigned int arg_rate = 48000; + snd_pcm_uframes_t arg_buffer_size = 0; + snd_pcm_uframes_t arg_period_size = 0; + unsigned long arg_loop_time = ~0UL; + int arg_nblock = 0; + int arg_effect = 0; + int arg_resample = 0; +#ifdef USE_SAMPLERATE + int arg_samplerate = SRC_SINC_FASTEST + 1; +#endif + int arg_sync = SYNC_TYPE_AUTO; + int arg_slave = SLAVE_TYPE_AUTO; + int arg_thread = 0; + struct loopback *loop = NULL; + char *arg_mixers[MAX_MIXERS]; + int arg_mixers_count = 0; + char *arg_ossmixers[MAX_MIXERS]; + int arg_ossmixers_count = 0; + int arg_xrun = arg_default_xrun; + int arg_wake = arg_default_wake; + + morehelp = 0; + while (1) { + int c; + if ((c = getopt_long(argc, argv, + "hdg:P:C:X:Y:l:t:F:f:c:r:s:benvA:S:a:m:T:O:w:UW:z", + long_option, NULL)) < 0) + break; + switch (c) { + case 'h': + morehelp++; + break; + case 'g': + arg_config = strdup(optarg); + break; + case 'd': + daemonize = 1; + enable_syslog(); + break; + case 'P': + arg_pdevice = strdup(optarg); + break; + case 'C': + arg_cdevice = strdup(optarg); + break; + case 'X': + arg_pctl = strdup(optarg); + break; + case 'Y': + arg_cctl = strdup(optarg); + break; + case 'l': + err = atoi(optarg); + arg_latency_req = err >= 4 ? err : 4; + break; + case 't': + err = atoi(optarg); + arg_latency_reqtime = err >= 500 ? err : 500; + break; + case 'f': + arg_format = snd_pcm_format_value(optarg); + if (arg_format == SND_PCM_FORMAT_UNKNOWN) { + logit(LOG_WARNING, "Unknown format, setting to default S16_LE\n"); + arg_format = SND_PCM_FORMAT_S16_LE; + } + break; + case 'c': + err = atoi(optarg); + arg_channels = err >= 1 && err < 1024 ? err : 1; + break; + case 'r': + err = atoi(optarg); + arg_rate = err >= 4000 && err < 200000 ? err : 44100; + break; + case 'B': + err = atoi(optarg); + arg_buffer_size = err >= 32 && err < 200000 ? err : 0; + break; + case 'E': + err = atoi(optarg); + arg_period_size = err >= 32 && err < 200000 ? err : 0; + break; + case 's': + err = atoi(optarg); + arg_loop_time = err >= 1 && err <= 100000 ? err : 30; + break; + case 'b': + arg_nblock = 1; + break; + case 'e': + arg_effect = 1; + break; + case 'n': + arg_resample = 1; + break; +#ifdef USE_SAMPLERATE + case 'A': + if (strcasecmp(optarg, "sincbest") == 0) + arg_samplerate = SRC_SINC_BEST_QUALITY; + else if (strcasecmp(optarg, "sincmedium") == 0) + arg_samplerate = SRC_SINC_MEDIUM_QUALITY; + else if (strcasecmp(optarg, "sincfastest") == 0) + arg_samplerate = SRC_SINC_FASTEST; + else if (strcasecmp(optarg, "zerohold") == 0) + arg_samplerate = SRC_ZERO_ORDER_HOLD; + else if (strcasecmp(optarg, "linear") == 0) + arg_samplerate = SRC_LINEAR; + else + arg_samplerate = atoi(optarg); + if (arg_samplerate < 0 || arg_samplerate > SRC_LINEAR) + arg_sync = SRC_SINC_FASTEST; + arg_samplerate += 1; + break; +#endif + case 'S': + if (strcasecmp(optarg, "samplerate") == 0) + arg_sync = SYNC_TYPE_SAMPLERATE; + else if (optarg[0] == 'n') + arg_sync = SYNC_TYPE_NONE; + else if (optarg[0] == 's') + arg_sync = SYNC_TYPE_SIMPLE; + else if (optarg[0] == 'c') + arg_sync = SYNC_TYPE_CAPTRATESHIFT; + else if (optarg[0] == 'p') + arg_sync = SYNC_TYPE_PLAYRATESHIFT; + else if (optarg[0] == 'r') + arg_sync = SYNC_TYPE_SAMPLERATE; + else + arg_sync = atoi(optarg); + if (arg_sync < 0 || arg_sync > SYNC_TYPE_LAST) + arg_sync = SYNC_TYPE_AUTO; + break; + case 'a': + if (optarg[0] == 'a') + arg_slave = SLAVE_TYPE_AUTO; + else if (strcasecmp(optarg, "on") == 0) + arg_slave = SLAVE_TYPE_ON; + else if (strcasecmp(optarg, "off") == 0) + arg_slave = SLAVE_TYPE_OFF; + else + arg_slave = atoi(optarg); + if (arg_slave < 0 || arg_slave > SLAVE_TYPE_LAST) + arg_slave = SLAVE_TYPE_AUTO; + break; + case 'T': + arg_thread = atoi(optarg); + if (arg_thread < 0) + arg_thread = 10000000 + loopbacks_count; + break; + case 'm': + if (arg_mixers_count >= MAX_MIXERS) { + logit(LOG_CRIT, "Maximum redirected mixer controls reached (max %i)\n", (int)MAX_MIXERS); + exit(EXIT_FAILURE); + } + arg_mixers[arg_mixers_count++] = optarg; + break; + case 'O': + if (arg_ossmixers_count >= MAX_MIXERS) { + logit(LOG_CRIT, "Maximum redirected mixer controls reached (max %i)\n", (int)MAX_MIXERS); + exit(EXIT_FAILURE); + } + arg_ossmixers[arg_ossmixers_count++] = optarg; + break; + case 'v': + verbose++; + break; + case 'w': + if (strcasecmp(optarg, "serialopen") == 0) + workarounds |= WORKAROUND_SERIALOPEN; + break; + case 'U': + arg_xrun = 1; + if (cmdline) + arg_default_xrun = 1; + break; + case 'W': + arg_wake = atoi(optarg); + if (cmdline) + arg_default_wake = arg_wake; + break; + case 'z': + enable_syslog(); + break; + } + } + + if (morehelp) { + help(); + exit(EXIT_SUCCESS); + } + if (arg_config == NULL) { + struct loopback_handle *play; + struct loopback_handle *capt; + err = create_loopback_handle(&play, arg_pdevice, arg_pctl, "playback"); + if (err < 0) { + logit(LOG_CRIT, "Unable to create playback handle.\n"); + exit(EXIT_FAILURE); + } + err = create_loopback_handle(&capt, arg_cdevice, arg_cctl, "capture"); + if (err < 0) { + logit(LOG_CRIT, "Unable to create capture handle.\n"); + exit(EXIT_FAILURE); + } + err = create_loopback(&loop, play, capt, output); + if (err < 0) { + logit(LOG_CRIT, "Unable to create loopback handle.\n"); + exit(EXIT_FAILURE); + } + play->format = capt->format = arg_format; + play->rate = play->rate_req = capt->rate = capt->rate_req = arg_rate; + play->channels = capt->channels = arg_channels; + play->buffer_size_req = capt->buffer_size_req = arg_buffer_size; + play->period_size_req = capt->period_size_req = arg_period_size; + play->resample = capt->resample = arg_resample; + play->nblock = capt->nblock = arg_nblock ? 1 : 0; + loop->latency_req = arg_latency_req; + loop->latency_reqtime = arg_latency_reqtime; + loop->sync = arg_sync; + loop->slave = arg_slave; + loop->thread = arg_thread; + loop->xrun = arg_xrun; + loop->wake = arg_wake; + err = add_mixers(loop, arg_mixers, arg_mixers_count); + if (err < 0) { + logit(LOG_CRIT, "Unable to add mixer controls.\n"); + exit(EXIT_FAILURE); + } + err = add_oss_mixers(loop, arg_ossmixers, arg_ossmixers_count); + if (err < 0) { + logit(LOG_CRIT, "Unable to add ossmixer controls.\n"); + exit(EXIT_FAILURE); + } +#ifdef USE_SAMPLERATE + loop->src_enable = arg_samplerate > 0; + if (loop->src_enable) + loop->src_converter_type = arg_samplerate - 1; +#endif + set_loop_time(loop, arg_loop_time); + add_loop(loop); + return 0; + } + + return parse_config_file(arg_config, output); +} + +static int parse_config_file(const char *file, snd_output_t *output) +{ + FILE *fp; + char line[2048], word[2048]; + char *str, *ptr; + int argc, c, err = 0; + char **argv; + + fp = fopen(file, "r"); + if (fp == NULL) { + logit(LOG_CRIT, "Unable to open file '%s': %s\n", file, strerror(errno)); + return -EIO; + } + while (!feof(fp)) { + if (fgets(line, sizeof(line)-1, fp) == NULL) + break; + line[sizeof(line)-1] = '\0'; + my_argv = realloc(my_argv, my_argc + MAX_ARGS * sizeof(char *)); + if (my_argv == NULL) + return -ENOMEM; + argv = my_argv + my_argc; + argc = 0; + argv[argc++] = strdup(""); + my_argc++; + str = line; + while (*str) { + ptr = word; + while (*str && (*str == ' ' || *str < ' ')) + str++; + if (*str == '#') + goto __next; + if (*str == '\'' || *str == '\"') { + c = *str++; + while (*str && *str != c) + *ptr++ = *str++; + if (*str == c) + str++; + } else { + while (*str && *str != ' ' && *str != '\t') + *ptr++ = *str++; + } + if (ptr != word) { + if (*(ptr-1) == '\n') + ptr--; + *ptr = '\0'; + if (argc >= MAX_ARGS) { + logit(LOG_CRIT, "Too many arguments."); + goto __error; + } + argv[argc++] = strdup(word); + my_argc++; + } + } + /* erase runtime variables for getopt */ + optarg = NULL; + optind = opterr = 1; + optopt = '?'; + + err = parse_config(argc, argv, output, 0); + __next: + if (err < 0) + break; + err = 0; + } + __error: + fclose(fp); + + return err; +} + +static void thread_job1(void *_data) +{ + struct loopback_thread *thread = _data; + snd_output_t *output = thread->output; + struct pollfd *pfds = NULL; + int pfds_count = 0; + int i, j, err, wake = 1000000; + + setscheduler(); + + for (i = 0; i < thread->loopbacks_count; i++) { + err = pcmjob_init(thread->loopbacks[i]); + if (err < 0) { + logit(LOG_CRIT, "Loopback initialization failure.\n"); + my_exit(thread, EXIT_FAILURE); + } + } + for (i = 0; i < thread->loopbacks_count; i++) { + err = pcmjob_start(thread->loopbacks[i]); + if (err < 0) { + logit(LOG_CRIT, "Loopback start failure.\n"); + my_exit(thread, EXIT_FAILURE); + } + pfds_count += thread->loopbacks[i]->pollfd_count; + j = thread->loopbacks[i]->wake; + if (j > 0 && j < wake) + wake = j; + } + if (wake >= 1000000) + wake = -1; + pfds = calloc(pfds_count, sizeof(struct pollfd)); + if (pfds == NULL || pfds_count <= 0) { + logit(LOG_CRIT, "Poll FDs allocation failed.\n"); + my_exit(thread, EXIT_FAILURE); + } + while (!quit) { + struct timeval tv1, tv2; + for (i = j = 0; i < thread->loopbacks_count; i++) { + err = pcmjob_pollfds_init(thread->loopbacks[i], &pfds[j]); + if (err < 0) { + logit(LOG_CRIT, "Poll FD initialization failed.\n"); + my_exit(thread, EXIT_FAILURE); + } + j += err; + } + if (verbose > 10) + gettimeofday(&tv1, NULL); + err = poll(pfds, j, wake); + if (err < 0) + err = -errno; + if (verbose > 10) { + gettimeofday(&tv2, NULL); + snd_output_printf(output, "pool took %lius\n", timediff(tv2, tv1)); + } + if (err < 0) { + if (err == -EINTR || err == -ERESTART) + continue; + logit(LOG_CRIT, "Poll failed: %s\n", strerror(-err)); + my_exit(thread, EXIT_FAILURE); + } + for (i = j = 0; i < thread->loopbacks_count; i++) { + struct loopback *loop = thread->loopbacks[i]; + if (j < loop->active_pollfd_count) { + err = pcmjob_pollfds_handle(loop, &pfds[j]); + if (err < 0) { + logit(LOG_CRIT, "pcmjob failed.\n"); + exit(EXIT_FAILURE); + } + } + j += loop->active_pollfd_count; + } + } + + my_exit(thread, EXIT_SUCCESS); +} + +static void thread_job(struct loopback_thread *thread) +{ + if (!thread->threaded) { + thread_job1(thread); + return; + } + pthread_create(&thread->thread, NULL, (void *) &thread_job1, + (void *) thread); +} + +static void send_to_all(int sig) +{ + struct loopback_thread *thread; + int i; + + for (i = 0; i < threads_count; i++) { + thread = &threads[i]; + if (thread->threaded) + pthread_kill(thread->thread, sig); + } +} + +static void signal_handler(int sig) +{ + quit = 1; + send_to_all(SIGUSR2); +} + +static void signal_handler_state(int sig) +{ + pthread_t self = pthread_self(); + struct loopback_thread *thread; + int i, j; + + if (pthread_equal(main_job, self)) + send_to_all(SIGUSR1); + for (i = 0; i < threads_count; i++) { + thread = &threads[i]; + if (thread->thread == self) { + for (j = 0; j < thread->loopbacks_count; j++) + pcmjob_state(thread->loopbacks[j]); + } + } + signal(sig, signal_handler_state); +} + +static void signal_handler_ignore(int sig) +{ + signal(sig, signal_handler_ignore); +} + +int main(int argc, char *argv[]) +{ + snd_output_t *output; + int i, j, k, l, err; + + err = snd_output_stdio_attach(&output, stdout, 0); + if (err < 0) { + logit(LOG_CRIT, "Output failed: %s\n", snd_strerror(err)); + exit(EXIT_FAILURE); + } + err = parse_config(argc, argv, output, 1); + if (err < 0) { + logit(LOG_CRIT, "Unable to parse arguments or configuration...\n"); + exit(EXIT_FAILURE); + } + while (my_argc > 0) + free(my_argv[--my_argc]); + free(my_argv); + + if (loopbacks_count <= 0) { + logit(LOG_CRIT, "No loopback defined...\n"); + exit(EXIT_FAILURE); + } + + if (daemonize) { + if (daemon(0, 0) < 0) { + logit(LOG_CRIT, "daemon() failed: %s\n", strerror(errno)); + exit(EXIT_FAILURE); + } + i = fork(); + if (i < 0) { + logit(LOG_CRIT, "fork() failed: %s\n", strerror(errno)); + exit(EXIT_FAILURE); + } + if (i > 0) { + /* wait(&i); */ + exit(EXIT_SUCCESS); + } + } + + /* we must sort thread IDs */ + j = -1; + do { + k = 0x7fffffff; + for (i = 0; i < loopbacks_count; i++) { + if (loopbacks[i]->thread < k && + loopbacks[i]->thread > j) + k = loopbacks[i]->thread; + } + j++; + for (i = 0; i < loopbacks_count; i++) { + if (loopbacks[i]->thread == k) + loopbacks[i]->thread = j; + } + } while (k != 0x7fffffff); + /* fix maximum thread id */ + for (i = 0, j = -1; i < loopbacks_count; i++) { + if (loopbacks[i]->thread > j) + j = loopbacks[i]->thread; + } + j += 1; + threads = calloc(1, sizeof(struct loopback_thread) * j); + if (threads == NULL) { + logit(LOG_CRIT, "No enough memory\n"); + exit(EXIT_FAILURE); + } + /* sort all threads */ + for (k = 0; k < j; k++) { + for (i = l = 0; i < loopbacks_count; i++) + if (loopbacks[i]->thread == k) + l++; + threads[k].loopbacks = malloc(l * sizeof(struct loopback *)); + threads[k].loopbacks_count = l; + threads[k].output = output; + threads[k].threaded = j > 1; + for (i = l = 0; i < loopbacks_count; i++) + if (loopbacks[i]->thread == k) + threads[k].loopbacks[l++] = loopbacks[i]; + } + threads_count = j; + main_job = pthread_self(); + + signal(SIGINT, signal_handler); + signal(SIGTERM, signal_handler); + signal(SIGABRT, signal_handler); + signal(SIGUSR1, signal_handler_state); + signal(SIGUSR2, signal_handler_ignore); + + for (k = 0; k < threads_count; k++) + thread_job(&threads[k]); + + if (j > 1) { + for (k = 0; k < threads_count; k++) + pthread_join(threads[k].thread, NULL); + } + + if (use_syslog) + closelog(); + exit(EXIT_SUCCESS); +} diff --git a/alsaloop/alsaloop.h b/alsaloop/alsaloop.h new file mode 100644 index 0000000..c4aa618 --- /dev/null +++ b/alsaloop/alsaloop.h @@ -0,0 +1,219 @@ +/* + * A simple PCM loopback utility + * Copyright (c) 2010 by Jaroslav Kysela + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + */ + +#include "aconfig.h" +#ifdef HAVE_SAMPLERATE_H +#define USE_SAMPLERATE +#include +#else +enum { + SRC_SINC_BEST_QUALITY = 0, + SRC_SINC_MEDIUM_QUALITY = 1, + SRC_SINC_FASTEST = 2, + SRC_ZERO_ORDER_HOLD = 3, + SRC_LINEAR = 4 +}; +#endif + +#define MAX_ARGS 128 +#define MAX_MIXERS 64 + +#if 0 +#define FILE_PWRITE "/tmp/alsaloop.praw" +#define FILE_CWRITE "/tmp/alsaloop.craw" +#endif + +#define WORKAROUND_SERIALOPEN (1<<0) + +typedef enum _sync_type { + SYNC_TYPE_NONE = 0, + SYNC_TYPE_SIMPLE, /* add or remove samples */ + SYNC_TYPE_CAPTRATESHIFT, + SYNC_TYPE_PLAYRATESHIFT, + SYNC_TYPE_SAMPLERATE, + SYNC_TYPE_AUTO, /* order: CAPTRATESHIFT, PLAYRATESHIFT, */ + /* SAMPLERATE, SIMPLE */ + SYNC_TYPE_LAST = SYNC_TYPE_AUTO +} sync_type_t; + +typedef enum _slave_type { + SLAVE_TYPE_AUTO = 0, + SLAVE_TYPE_ON = 1, + SLAVE_TYPE_OFF = 2, + SLAVE_TYPE_LAST = SLAVE_TYPE_OFF +} slave_type_t; + +struct loopback_control { + snd_ctl_elem_id_t *id; + snd_ctl_elem_info_t *info; + snd_ctl_elem_value_t *value; +}; + +struct loopback_mixer { + unsigned int skip:1; + struct loopback_control src; + struct loopback_control dst; + struct loopback_mixer *next; +}; + +struct loopback_ossmixer { + unsigned int skip:1; + const char *alsa_id; + int alsa_index; + const char *oss_id; + struct loopback_ossmixer *next; +}; + +struct loopback_handle { + struct loopback *loopback; + char *device; + char *ctldev; + char *id; + int card_number; + snd_pcm_t *handle; + snd_pcm_access_t access; + snd_pcm_format_t format; + unsigned int rate; + unsigned int rate_req; + unsigned int channels; + unsigned int buffer_size; + unsigned int period_size; + snd_pcm_uframes_t avail_min; + unsigned int buffer_size_req; + unsigned int period_size_req; + unsigned int frame_size; + unsigned int resample:1; /* do resample */ + unsigned int nblock:1; /* do block (period size) transfers */ + unsigned int xrun_pending:1; + unsigned int pollfd_count; + /* I/O job */ + char *buf; /* I/O buffer */ + snd_pcm_uframes_t buf_pos; /* I/O position */ + snd_pcm_uframes_t buf_count; /* filled samples */ + snd_pcm_uframes_t buf_size; /* buffer size in frames */ + snd_pcm_uframes_t buf_over; /* capture buffer overflow */ + int stall; + /* statistics */ + snd_pcm_uframes_t max; + unsigned long long counter; + unsigned long sync_point; /* in samples */ + snd_pcm_sframes_t last_delay; + double pitch; + snd_pcm_uframes_t total_queued; + /* control */ + snd_ctl_t *ctl; + unsigned int ctl_pollfd_count; + snd_ctl_elem_value_t *ctl_notify; + snd_ctl_elem_value_t *ctl_rate_shift; + snd_ctl_elem_value_t *ctl_active; + snd_ctl_elem_value_t *ctl_format; + snd_ctl_elem_value_t *ctl_rate; + snd_ctl_elem_value_t *ctl_channels; +}; + +struct loopback { + char *id; + struct loopback_handle *capt; + struct loopback_handle *play; + snd_pcm_uframes_t latency; /* final latency in frames */ + unsigned int latency_req; /* in frames */ + unsigned int latency_reqtime; /* in us */ + unsigned long loop_time; /* ~0 = unlimited (in seconds) */ + unsigned long long loop_limit; /* ~0 = unlimited (in frames) */ + snd_output_t *output; + snd_output_t *state; + int pollfd_count; + int active_pollfd_count; + unsigned int linked:1; /* linked streams */ + unsigned int reinit:1; + unsigned int running:1; + unsigned int stop_pending:1; + snd_pcm_uframes_t stop_count; + sync_type_t sync; /* type of sync */ + slave_type_t slave; + int thread; /* thread number */ + unsigned int wake; + /* statistics */ + double pitch; + double pitch_delta; + snd_pcm_sframes_t pitch_diff; + snd_pcm_sframes_t pitch_diff_min; + snd_pcm_sframes_t pitch_diff_max; + unsigned int total_queued_count; + snd_timestamp_t tstamp_start; + snd_timestamp_t tstamp_end; + /* xrun profiling */ + unsigned int xrun:1; /* xrun profiling */ + snd_timestamp_t xrun_last_update; + snd_timestamp_t xrun_last_wake0; + snd_timestamp_t xrun_last_wake; + snd_timestamp_t xrun_last_check0; + snd_timestamp_t xrun_last_check; + snd_pcm_sframes_t xrun_last_pdelay; + snd_pcm_sframes_t xrun_last_cdelay; + snd_pcm_uframes_t xrun_buf_pcount; + snd_pcm_uframes_t xrun_buf_ccount; + unsigned int xrun_out_frames; + long xrun_max_proctime; + double xrun_max_missing; + /* control mixer */ + struct loopback_mixer *controls; + struct loopback_ossmixer *oss_controls; + /* sample rate */ + unsigned int use_samplerate:1; +#ifdef USE_SAMPLERATE + unsigned int src_enable:1; + int src_converter_type; + SRC_STATE *src_state; + SRC_DATA src_data; + unsigned int src_out_frames; +#endif +#ifdef FILE_CWRITE + FILE *cfile; +#endif +#ifdef FILE_PWRITE + FILE *pfile; +#endif +}; + +extern int verbose; +extern int workarounds; +extern int use_syslog; + +#define logit(priority, fmt, args...) do { \ + if (use_syslog) \ + syslog(priority, fmt, ##args); \ + else \ + fprintf(stderr, fmt, ##args); \ +} while (0) + +int pcmjob_init(struct loopback *loop); +int pcmjob_done(struct loopback *loop); +int pcmjob_start(struct loopback *loop); +int pcmjob_stop(struct loopback *loop); +int pcmjob_pollfds_init(struct loopback *loop, struct pollfd *fds); +int pcmjob_pollfds_handle(struct loopback *loop, struct pollfd *fds); +void pcmjob_state(struct loopback *loop); + +int control_parse_id(const char *str, snd_ctl_elem_id_t *id); +int control_id_match(snd_ctl_elem_id_t *id1, snd_ctl_elem_id_t *id2); +int control_init(struct loopback *loop); +int control_done(struct loopback *loop); +int control_event(struct loopback_handle *lhandle, snd_ctl_event_t *ev); diff --git a/alsaloop/control.c b/alsaloop/control.c new file mode 100644 index 0000000..cf5693b --- /dev/null +++ b/alsaloop/control.c @@ -0,0 +1,424 @@ +/* + * A simple PCM loopback utility + * Copyright (c) 2010 by Jaroslav Kysela + * + * Author: Jaroslav Kysela + * + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + */ + +#include +#include +#include +#include "alsaloop.h" + +static char *id_str(snd_ctl_elem_id_t *id) +{ + static char str[128]; + + sprintf(str, "%i,%s,%i,%i,%s,%i", + snd_ctl_elem_id_get_numid(id), + snd_ctl_elem_iface_name(snd_ctl_elem_id_get_interface(id)), + snd_ctl_elem_id_get_device(id), + snd_ctl_elem_id_get_subdevice(id), + snd_ctl_elem_id_get_name(id), + snd_ctl_elem_id_get_index(id)); + return str; +} + +int control_parse_id(const char *str, snd_ctl_elem_id_t *id) +{ + int c, size, numid; + char *ptr; + + while (*str == ' ' || *str == '\t') + str++; + if (!(*str)) + return -EINVAL; + snd_ctl_elem_id_set_interface(id, SND_CTL_ELEM_IFACE_MIXER); /* default */ + while (*str) { + if (!strncasecmp(str, "numid=", 6)) { + str += 6; + numid = atoi(str); + if (numid <= 0) { + logit(LOG_CRIT, "Invalid numid %d\n", numid); + return -EINVAL; + } + snd_ctl_elem_id_set_numid(id, atoi(str)); + while (isdigit(*str)) + str++; + } else if (!strncasecmp(str, "iface=", 6)) { + str += 6; + if (!strncasecmp(str, "card", 4)) { + snd_ctl_elem_id_set_interface(id, SND_CTL_ELEM_IFACE_CARD); + str += 4; + } else if (!strncasecmp(str, "mixer", 5)) { + snd_ctl_elem_id_set_interface(id, SND_CTL_ELEM_IFACE_MIXER); + str += 5; + } else if (!strncasecmp(str, "pcm", 3)) { + snd_ctl_elem_id_set_interface(id, SND_CTL_ELEM_IFACE_PCM); + str += 3; + } else if (!strncasecmp(str, "rawmidi", 7)) { + snd_ctl_elem_id_set_interface(id, SND_CTL_ELEM_IFACE_RAWMIDI); + str += 7; + } else if (!strncasecmp(str, "timer", 5)) { + snd_ctl_elem_id_set_interface(id, SND_CTL_ELEM_IFACE_TIMER); + str += 5; + } else if (!strncasecmp(str, "sequencer", 9)) { + snd_ctl_elem_id_set_interface(id, SND_CTL_ELEM_IFACE_SEQUENCER); + str += 9; + } else { + return -EINVAL; + } + } else if (!strncasecmp(str, "name=", 5)) { + char buf[64]; + str += 5; + ptr = buf; + size = 0; + if (*str == '\'' || *str == '\"') { + c = *str++; + while (*str && *str != c) { + if (size < (int)sizeof(buf)) { + *ptr++ = *str; + size++; + } + str++; + } + if (*str == c) + str++; + } else { + while (*str && *str != ',') { + if (size < (int)sizeof(buf)) { + *ptr++ = *str; + size++; + } + str++; + } + } + *ptr = '\0'; + snd_ctl_elem_id_set_name(id, buf); + } else if (!strncasecmp(str, "index=", 6)) { + str += 6; + snd_ctl_elem_id_set_index(id, atoi(str)); + while (isdigit(*str)) + str++; + } else if (!strncasecmp(str, "device=", 7)) { + str += 7; + snd_ctl_elem_id_set_device(id, atoi(str)); + while (isdigit(*str)) + str++; + } else if (!strncasecmp(str, "subdevice=", 10)) { + str += 10; + snd_ctl_elem_id_set_subdevice(id, atoi(str)); + while (isdigit(*str)) + str++; + } + if (*str == ',') { + str++; + } else { + if (*str) + return -EINVAL; + } + } + return 0; +} + +int control_id_match(snd_ctl_elem_id_t *id1, snd_ctl_elem_id_t *id2) +{ + if (snd_ctl_elem_id_get_interface(id1) != + snd_ctl_elem_id_get_interface(id2)) + return 0; + if (snd_ctl_elem_id_get_device(id1) != + snd_ctl_elem_id_get_device(id2)) + return 0; + if (snd_ctl_elem_id_get_subdevice(id1) != + snd_ctl_elem_id_get_subdevice(id2)) + return 0; + if (strcmp(snd_ctl_elem_id_get_name(id1), + snd_ctl_elem_id_get_name(id2)) != 0) + return 0; + if (snd_ctl_elem_id_get_index(id1) != + snd_ctl_elem_id_get_index(id2)) + return 0; + return 1; +} + +static int control_init1(struct loopback_handle *lhandle, + struct loopback_control *ctl) +{ + int err; + + snd_ctl_elem_info_set_id(ctl->info, ctl->id); + snd_ctl_elem_value_set_id(ctl->value, ctl->id); + if (lhandle->ctl == NULL) { + logit(LOG_WARNING, "Unable to read control info for '%s'\n", id_str(ctl->id)); + return -EIO; + } + err = snd_ctl_elem_info(lhandle->ctl, ctl->info); + if (err < 0) { + logit(LOG_WARNING, "Unable to read control info '%s': %s\n", id_str(ctl->id), snd_strerror(err)); + return err; + } + err = snd_ctl_elem_read(lhandle->ctl, ctl->value); + if (err < 0) { + logit(LOG_WARNING, "Unable to read control value (init1) '%s': %s\n", id_str(ctl->id), snd_strerror(err)); + return err; + } + return 0; +} + +static int copy_value(struct loopback_control *dst, + struct loopback_control *src) +{ + snd_ctl_elem_type_t type; + unsigned int count; + int i; + + type = snd_ctl_elem_info_get_type(dst->info); + count = snd_ctl_elem_info_get_count(dst->info); + switch (type) { + case SND_CTL_ELEM_TYPE_BOOLEAN: + for (i = 0; i < count; i++) + snd_ctl_elem_value_set_boolean(dst->value, + i, snd_ctl_elem_value_get_boolean(src->value, i)); + break; + case SND_CTL_ELEM_TYPE_INTEGER: + for (i = 0; i < count; i++) { + snd_ctl_elem_value_set_integer(dst->value, + i, snd_ctl_elem_value_get_integer(src->value, i)); + } + break; + default: + logit(LOG_CRIT, "Unable to copy control value for type %s\n", snd_ctl_elem_type_name(type)); + return -EINVAL; + } + return 0; +} + +static int oss_set(struct loopback *loop, + struct loopback_ossmixer *ossmix, + int enable) +{ + char buf[128], file[128]; + int fd; + + if (loop->capt->card_number < 0) + return 0; + if (!enable) { + sprintf(buf, "%s \"\" 0\n", ossmix->oss_id); + } else { + sprintf(buf, "%s \"%s\" %i\n", ossmix->oss_id, ossmix->alsa_id, ossmix->alsa_index); + } + sprintf(file, "/proc/asound/card%i/oss_mixer", loop->capt->card_number); + if (verbose) + snd_output_printf(loop->output, "%s: Initialize OSS volume %s: %s", loop->id, file, buf); + fd = open(file, O_WRONLY); + if (fd >= 0 && write(fd, buf, strlen(buf)) == strlen(buf)) { + close(fd); + return 0; + } + if (fd >= 0) + close(fd); + logit(LOG_INFO, "%s: Unable to initialize OSS Mixer ID '%s'\n", loop->id, ossmix->oss_id); + return -1; +} + +static int control_init2(struct loopback *loop, + struct loopback_mixer *mix) +{ + snd_ctl_elem_type_t type; + unsigned int count; + int err; + + snd_ctl_elem_info_copy(mix->dst.info, mix->src.info); + snd_ctl_elem_info_set_id(mix->dst.info, mix->dst.id); + snd_ctl_elem_value_clear(mix->dst.value); + snd_ctl_elem_value_set_id(mix->dst.value, mix->dst.id); + type = snd_ctl_elem_info_get_type(mix->dst.info); + count = snd_ctl_elem_info_get_count(mix->dst.info); + snd_ctl_elem_remove(loop->capt->ctl, mix->dst.id); + switch (type) { + case SND_CTL_ELEM_TYPE_BOOLEAN: + err = snd_ctl_elem_add_boolean(loop->capt->ctl, + mix->dst.id, count); + copy_value(&mix->dst, &mix->src); + break; + case SND_CTL_ELEM_TYPE_INTEGER: + err = snd_ctl_elem_add_integer(loop->capt->ctl, + mix->dst.id, count, + snd_ctl_elem_info_get_min(mix->dst.info), + snd_ctl_elem_info_get_max(mix->dst.info), + snd_ctl_elem_info_get_step(mix->dst.info)); + copy_value(&mix->dst, &mix->src); + break; + default: + logit(LOG_CRIT, "Unable to handle control type %s\n", snd_ctl_elem_type_name(type)); + err = -EINVAL; + break; + } + if (err < 0) { + logit(LOG_CRIT, "Unable to create control '%s': %s\n", id_str(mix->dst.id), snd_strerror(err)); + return err; + } + err = snd_ctl_elem_unlock(loop->capt->ctl, mix->dst.id); + if (err < 0) { + logit(LOG_CRIT, "Unable to unlock control info '%s': %s\n", id_str(mix->dst.id), snd_strerror(err)); + return err; + } + err = snd_ctl_elem_info(loop->capt->ctl, mix->dst.info); + if (err < 0) { + logit(LOG_CRIT, "Unable to read control info '%s': %s\n", id_str(mix->dst.id), snd_strerror(err)); + return err; + } + if (snd_ctl_elem_info_is_tlv_writable(mix->dst.info)) { + unsigned int tlv[64]; + err = snd_ctl_elem_tlv_read(loop->play->ctl, + mix->src.id, + tlv, sizeof(tlv)); + if (err < 0) { + logit(LOG_CRIT, "Unable to read TLV for '%s': %s\n", id_str(mix->src.id), snd_strerror(err)); + tlv[0] = tlv[1] = 0; + } + err = snd_ctl_elem_tlv_write(loop->capt->ctl, + mix->dst.id, + tlv); + if (err < 0) { + logit(LOG_CRIT, "Unable to write TLV for '%s': %s\n", id_str(mix->src.id), snd_strerror(err)); + return err; + } + } + err = snd_ctl_elem_write(loop->capt->ctl, mix->dst.value); + if (err < 0) { + logit(LOG_CRIT, "Unable to write control value '%s': %s\n", id_str(mix->dst.id), snd_strerror(err)); + return err; + } + return 0; +} + +int control_init(struct loopback *loop) +{ + struct loopback_mixer *mix; + struct loopback_ossmixer *ossmix; + int err; + + for (ossmix = loop->oss_controls; ossmix; ossmix = ossmix->next) + oss_set(loop, ossmix, 0); + for (mix = loop->controls; mix; mix = mix->next) { + err = control_init1(loop->play, &mix->src); + if (err < 0) { + logit(LOG_WARNING, "%s: Disabling playback control '%s'\n", loop->id, id_str(mix->src.id)); + mix->skip = 1; + continue; + } + err = control_init2(loop, mix); + if (err < 0) + return err; + } + for (ossmix = loop->oss_controls; ossmix; ossmix = ossmix->next) { + err = oss_set(loop, ossmix, 1); + if (err < 0) { + ossmix->skip = 1; + logit(LOG_WARNING, "%s: Disabling OSS mixer ID '%s'\n", loop->id, ossmix->oss_id); + } + } + return 0; +} + +int control_done(struct loopback *loop) +{ + struct loopback_mixer *mix; + struct loopback_ossmixer *ossmix; + int err; + + if (loop->capt->ctl == NULL) + return 0; + for (ossmix = loop->oss_controls; ossmix; ossmix = ossmix->next) { + err = oss_set(loop, ossmix, 0); + if (err < 0) + logit(LOG_WARNING, "%s: Unable to remove OSS control '%s'\n", loop->id, ossmix->oss_id); + } + for (mix = loop->controls; mix; mix = mix->next) { + if (mix->skip) + continue; + err = snd_ctl_elem_remove(loop->capt->ctl, mix->dst.id); + if (err < 0) + logit(LOG_WARNING, "%s: Unable to remove control '%s': %s\n", loop->id, id_str(mix->dst.id), snd_strerror(err)); + } + return 0; +} + +static int control_event1(struct loopback *loop, + struct loopback_mixer *mix, + snd_ctl_event_t *ev, + int capture) +{ + unsigned int mask = snd_ctl_event_elem_get_mask(ev); + int err; + + if (mask == SND_CTL_EVENT_MASK_REMOVE) + return 0; + if ((mask & SND_CTL_EVENT_MASK_VALUE) == 0) + return 0; + if (!capture) { + snd_ctl_elem_value_set_id(mix->src.value, mix->src.id); + err = snd_ctl_elem_read(loop->play->ctl, mix->src.value); + if (err < 0) { + logit(LOG_CRIT, "Unable to read control value (event1) '%s': %s\n", id_str(mix->src.id), snd_strerror(err)); + return err; + } + copy_value(&mix->dst, &mix->src); + err = snd_ctl_elem_write(loop->capt->ctl, mix->dst.value); + if (err < 0) { + logit(LOG_CRIT, "Unable to write control value (event1) '%s': %s\n", id_str(mix->dst.id), snd_strerror(err)); + return err; + } + } else { + err = snd_ctl_elem_read(loop->capt->ctl, mix->dst.value); + if (err < 0) { + logit(LOG_CRIT, "Unable to read control value (event2) '%s': %s\n", id_str(mix->dst.id), snd_strerror(err)); + return err; + } + copy_value(&mix->src, &mix->dst); + err = snd_ctl_elem_write(loop->play->ctl, mix->src.value); + if (err < 0) { + logit(LOG_CRIT, "Unable to write control value (event2) '%s': %s\n", id_str(mix->src.id), snd_strerror(err)); + return err; + } + } + return 0; +} + +int control_event(struct loopback_handle *lhandle, snd_ctl_event_t *ev) +{ + snd_ctl_elem_id_t *id2; + struct loopback_mixer *mix; + int capt = lhandle == lhandle->loopback->capt; + int err; + + snd_ctl_elem_id_alloca(&id2); + snd_ctl_event_elem_get_id(ev, id2); + for (mix = lhandle->loopback->controls; mix; mix = mix->next) { + if (mix->skip) + continue; + if (control_id_match(id2, capt ? mix->dst.id : mix->src.id)) { + err = control_event1(lhandle->loopback, mix, ev, capt); + if (err < 0) + return err; + } + } + return 0; +} diff --git a/alsaloop/pcmjob.c b/alsaloop/pcmjob.c new file mode 100644 index 0000000..6a9aff4 --- /dev/null +++ b/alsaloop/pcmjob.c @@ -0,0 +1,2038 @@ +/* + * A simple PCM loopback utility + * Copyright (c) 2010 by Jaroslav Kysela + * + * Author: Jaroslav Kysela + * + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "alsaloop.h" + +#define XRUN_PROFILE_UNKNOWN (-10000000) + +static int set_rate_shift(struct loopback_handle *lhandle, double pitch); +static int get_rate(struct loopback_handle *lhandle); + +#define SYNCTYPE(v) [SYNC_TYPE_##v] = #v + +static const char *sync_types[] = { + SYNCTYPE(NONE), + SYNCTYPE(SIMPLE), + SYNCTYPE(CAPTRATESHIFT), + SYNCTYPE(PLAYRATESHIFT), + SYNCTYPE(SAMPLERATE), + SYNCTYPE(AUTO) +}; + +#define SRCTYPE(v) [SRC_##v] = "SRC_" #v + +#ifdef USE_SAMPLERATE +static const char *src_types[] = { + SRCTYPE(SINC_BEST_QUALITY), + SRCTYPE(SINC_MEDIUM_QUALITY), + SRCTYPE(SINC_FASTEST), + SRCTYPE(ZERO_ORDER_HOLD), + SRCTYPE(LINEAR) +}; +#endif + +static pthread_once_t pcm_open_mutex_once = PTHREAD_ONCE_INIT; +static pthread_mutex_t pcm_open_mutex; + +static void pcm_open_init_mutex(void) +{ + pthread_mutexattr_t attr; + + pthread_mutexattr_init(&attr); + pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE); + pthread_mutex_init(&pcm_open_mutex, &attr); + pthread_mutexattr_destroy(&attr); +} + +static inline void pcm_open_lock(void) +{ + pthread_once(&pcm_open_mutex_once, pcm_open_init_mutex); + if (workarounds & WORKAROUND_SERIALOPEN) + pthread_mutex_lock(&pcm_open_mutex); +} + +static inline void pcm_open_unlock(void) +{ + if (workarounds & WORKAROUND_SERIALOPEN) + pthread_mutex_unlock(&pcm_open_mutex); +} + +static inline snd_pcm_uframes_t get_whole_latency(struct loopback *loop) +{ + return loop->latency; +} + +static inline unsigned long long + frames_to_time(unsigned int rate, + snd_pcm_uframes_t frames) +{ + return (frames * 1000000ULL) / rate; +} + +static inline snd_pcm_uframes_t time_to_frames(unsigned int rate, + unsigned long long time) +{ + return (time * rate) / 1000000ULL; +} + +static int setparams_stream(struct loopback_handle *lhandle, + snd_pcm_hw_params_t *params) +{ + snd_pcm_t *handle = lhandle->handle; + int err; + unsigned int rrate; + + err = snd_pcm_hw_params_any(handle, params); + if (err < 0) { + logit(LOG_CRIT, "Broken configuration for %s PCM: no configurations available: %s\n", lhandle->id, snd_strerror(err)); + return err; + } + err = snd_pcm_hw_params_set_rate_resample(handle, params, lhandle->resample); + if (err < 0) { + logit(LOG_CRIT, "Resample setup failed for %s (val %u): %s\n", lhandle->id, lhandle->resample, snd_strerror(err)); + return err; + } + err = snd_pcm_hw_params_set_access(handle, params, lhandle->access); + if (err < 0) { + logit(LOG_CRIT, "Access type not available for %s: %s\n", lhandle->id, snd_strerror(err)); + return err; + } + err = snd_pcm_hw_params_set_format(handle, params, lhandle->format); + if (err < 0) { + logit(LOG_CRIT, "Sample format not available for %s: %s\n", lhandle->id, snd_strerror(err)); + return err; + } + err = snd_pcm_hw_params_set_channels(handle, params, lhandle->channels); + if (err < 0) { + logit(LOG_CRIT, "Channels count (%u) not available for %s: %s\n", lhandle->channels, lhandle->id, snd_strerror(err)); + return err; + } + rrate = lhandle->rate_req; + err = snd_pcm_hw_params_set_rate_near(handle, params, &rrate, 0); + if (err < 0) { + logit(LOG_CRIT, "Rate %uHz not available for %s: %s\n", lhandle->rate_req, lhandle->id, snd_strerror(err)); + return err; + } + rrate = 0; + snd_pcm_hw_params_get_rate(params, &rrate, 0); + lhandle->rate = rrate; + if ( +#ifdef USE_SAMPLERATE + !lhandle->loopback->src_enable && +#endif + (int)rrate != lhandle->rate) { + logit(LOG_CRIT, "Rate does not match (requested %uHz, got %uHz, resample %u)\n", lhandle->rate, rrate, lhandle->resample); + return -EINVAL; + } + lhandle->pitch = (double)lhandle->rate_req / (double)lhandle->rate; + return 0; +} + +static int setparams_bufsize(struct loopback_handle *lhandle, + snd_pcm_hw_params_t *params, + snd_pcm_hw_params_t *tparams, + snd_pcm_uframes_t bufsize) +{ + snd_pcm_t *handle = lhandle->handle; + int err; + snd_pcm_uframes_t periodsize; + snd_pcm_uframes_t buffersize; + snd_pcm_uframes_t last_bufsize = 0; + + if (lhandle->buffer_size_req > 0) { + bufsize = lhandle->buffer_size_req; + last_bufsize = bufsize; + goto __set_it; + } + __again: + if (lhandle->buffer_size_req > 0) { + logit(LOG_CRIT, "Unable to set buffer size %li for %s\n", (long)lhandle->buffer_size, lhandle->id); + return -EIO; + } + if (last_bufsize == bufsize) + bufsize += 4; + last_bufsize = bufsize; + if (bufsize > 10*1024*1024) { + logit(LOG_CRIT, "Buffer size too big\n"); + return -EIO; + } + __set_it: + snd_pcm_hw_params_copy(params, tparams); + periodsize = bufsize * 8; + err = snd_pcm_hw_params_set_buffer_size_near(handle, params, &periodsize); + if (err < 0) { + logit(LOG_CRIT, "Unable to set buffer size %li for %s: %s\n", periodsize, lhandle->id, snd_strerror(err)); + goto __again; + } + snd_pcm_hw_params_get_buffer_size(params, &periodsize); + if (verbose > 6) + snd_output_printf(lhandle->loopback->output, "%s: buffer_size=%li\n", lhandle->id, periodsize); + if (lhandle->period_size_req > 0) + periodsize = lhandle->period_size_req; + else + periodsize /= 8; + err = snd_pcm_hw_params_set_period_size_near(handle, params, &periodsize, 0); + if (err < 0) { + logit(LOG_CRIT, "Unable to set period size %li for %s: %s\n", periodsize, lhandle->id, snd_strerror(err)); + goto __again; + } + snd_pcm_hw_params_get_period_size(params, &periodsize, NULL); + if (verbose > 6) + snd_output_printf(lhandle->loopback->output, "%s: period_size=%li\n", lhandle->id, periodsize); + if (periodsize != bufsize) + bufsize = periodsize; + snd_pcm_hw_params_get_buffer_size(params, &buffersize); + if (periodsize * 2 > buffersize) + goto __again; + lhandle->period_size = periodsize; + lhandle->buffer_size = buffersize; + return 0; +} + +static int setparams_set(struct loopback_handle *lhandle, + snd_pcm_hw_params_t *params, + snd_pcm_sw_params_t *swparams, + snd_pcm_uframes_t bufsize) +{ + snd_pcm_t *handle = lhandle->handle; + int err; + snd_pcm_uframes_t val, period_size, buffer_size; + + err = snd_pcm_hw_params(handle, params); + if (err < 0) { + logit(LOG_CRIT, "Unable to set hw params for %s: %s\n", lhandle->id, snd_strerror(err)); + return err; + } + err = snd_pcm_sw_params_current(handle, swparams); + if (err < 0) { + logit(LOG_CRIT, "Unable to determine current swparams for %s: %s\n", lhandle->id, snd_strerror(err)); + return err; + } + err = snd_pcm_sw_params_set_start_threshold(handle, swparams, 0x7fffffff); + if (err < 0) { + logit(LOG_CRIT, "Unable to set start threshold mode for %s: %s\n", lhandle->id, snd_strerror(err)); + return err; + } + snd_pcm_hw_params_get_period_size(params, &period_size, NULL); + snd_pcm_hw_params_get_buffer_size(params, &buffer_size); + if (lhandle->nblock) { + if (lhandle == lhandle->loopback->play) { + val = buffer_size - (2 * period_size - 4); + } else { + val = 4; + } + if (verbose > 6) + snd_output_printf(lhandle->loopback->output, "%s: avail_min1=%li\n", lhandle->id, val); + } else { + if (lhandle == lhandle->loopback->play) { + val = bufsize + bufsize / 2; + if (val > (buffer_size * 3) / 4) + val = (buffer_size * 3) / 4; + val = buffer_size - val; + } else { + val = bufsize / 2; + if (val > buffer_size / 4) + val = buffer_size / 4; + } + if (verbose > 6) + snd_output_printf(lhandle->loopback->output, "%s: avail_min2=%li\n", lhandle->id, val); + } + err = snd_pcm_sw_params_set_avail_min(handle, swparams, val); + if (err < 0) { + logit(LOG_CRIT, "Unable to set avail min for %s: %s\n", lhandle->id, snd_strerror(err)); + return err; + } + snd_pcm_sw_params_get_avail_min(swparams, &lhandle->avail_min); + err = snd_pcm_sw_params(handle, swparams); + if (err < 0) { + logit(LOG_CRIT, "Unable to set sw params for %s: %s\n", lhandle->id, snd_strerror(err)); + return err; + } + return 0; +} + +static int increase_playback_avail_min(struct loopback_handle *lhandle) +{ + snd_pcm_t *handle = lhandle->handle; + snd_pcm_sw_params_t *swparams; + struct timespec ts; + int err; + + if (lhandle->avail_min + (lhandle->period_size / 2) > lhandle->buffer_size) { + /* avoid 100% CPU usage for broken plugins */ + ts.tv_sec = 0; + ts.tv_nsec = 10000; + nanosleep(&ts, NULL); + return 0; + } + snd_pcm_sw_params_alloca(&swparams); + err = snd_pcm_sw_params_current(handle, swparams); + if (err < 0) { + logit(LOG_CRIT, "Unable to determine current swparams for %s: %s\n", lhandle->id, snd_strerror(err)); + return err; + } + err = snd_pcm_sw_params_set_avail_min(handle, swparams, lhandle->avail_min + 4); + if (err < 0) { + logit(LOG_CRIT, "Unable to set avail min for %s: %s\n", lhandle->id, snd_strerror(err)); + return err; + } + snd_pcm_sw_params_get_avail_min(swparams, &lhandle->avail_min); + if (verbose > 6) + snd_output_printf(lhandle->loopback->output, "%s: change avail_min=%li\n", lhandle->id, lhandle->avail_min); + err = snd_pcm_sw_params(handle, swparams); + if (err < 0) { + logit(LOG_CRIT, "Unable to set sw params for %s: %s\n", lhandle->id, snd_strerror(err)); + return err; + } + return 0; +} + +static int setparams(struct loopback *loop, snd_pcm_uframes_t bufsize) +{ + int err; + snd_pcm_hw_params_t *pt_params, *ct_params; /* templates with rate, format and channels */ + snd_pcm_hw_params_t *p_params, *c_params; + snd_pcm_sw_params_t *p_swparams, *c_swparams; + + snd_pcm_hw_params_alloca(&p_params); + snd_pcm_hw_params_alloca(&c_params); + snd_pcm_hw_params_alloca(&pt_params); + snd_pcm_hw_params_alloca(&ct_params); + snd_pcm_sw_params_alloca(&p_swparams); + snd_pcm_sw_params_alloca(&c_swparams); + if ((err = setparams_stream(loop->play, pt_params)) < 0) { + logit(LOG_CRIT, "Unable to set parameters for %s stream: %s\n", loop->play->id, snd_strerror(err)); + return err; + } + if ((err = setparams_stream(loop->capt, ct_params)) < 0) { + logit(LOG_CRIT, "Unable to set parameters for %s stream: %s\n", loop->capt->id, snd_strerror(err)); + return err; + } + + if ((err = setparams_bufsize(loop->play, p_params, pt_params, bufsize / loop->play->pitch)) < 0) { + logit(LOG_CRIT, "Unable to set buffer parameters for %s stream: %s\n", loop->play->id, snd_strerror(err)); + return err; + } + if ((err = setparams_bufsize(loop->capt, c_params, ct_params, bufsize / loop->capt->pitch)) < 0) { + logit(LOG_CRIT, "Unable to set buffer parameters for %s stream: %s\n", loop->capt->id, snd_strerror(err)); + return err; + } + + if ((err = setparams_set(loop->play, p_params, p_swparams, bufsize / loop->play->pitch)) < 0) { + logit(LOG_CRIT, "Unable to set sw parameters for %s stream: %s\n", loop->play->id, snd_strerror(err)); + return err; + } + if ((err = setparams_set(loop->capt, c_params, c_swparams, bufsize / loop->capt->pitch)) < 0) { + logit(LOG_CRIT, "Unable to set sw parameters for %s stream: %s\n", loop->capt->id, snd_strerror(err)); + return err; + } + +#if 0 + if (!loop->linked) + if (snd_pcm_link(loop->capt->handle, loop->play->handle) >= 0) + loop->linked = 1; +#endif + if ((err = snd_pcm_prepare(loop->play->handle)) < 0) { + logit(LOG_CRIT, "Prepare %s error: %s\n", loop->play->id, snd_strerror(err)); + return err; + } + if (!loop->linked && (err = snd_pcm_prepare(loop->capt->handle)) < 0) { + logit(LOG_CRIT, "Prepare %s error: %s\n", loop->capt->id, snd_strerror(err)); + return err; + } + + if (verbose) { + snd_pcm_dump(loop->play->handle, loop->output); + snd_pcm_dump(loop->capt->handle, loop->output); + } + return 0; +} + +static void showlatency(snd_output_t *out, size_t latency, unsigned int rate, + char *prefix) +{ + double d; + d = (double)latency / (double)rate; + snd_output_printf(out, "%s %li frames, %.3fus, %.6fms (%.4fHz)\n", prefix, (long)latency, d * 1000000, d * 1000, (double)1 / d); +} + +static long timediff(snd_timestamp_t t1, snd_timestamp_t t2) +{ + signed long l; + + t1.tv_sec -= t2.tv_sec; + if (t1.tv_usec < t2.tv_usec) { + l = ((t1.tv_usec + 1000000) - t2.tv_usec) % 1000000; + t1.tv_sec--; + } else { + l = t1.tv_usec - t2.tv_usec; + } + return (t1.tv_sec * 1000000) + l; +} + +static int getcurtimestamp(snd_timestamp_t *ts) +{ + struct timeval tv; + gettimeofday(&tv, NULL); + ts->tv_sec = tv.tv_sec; + ts->tv_usec = tv.tv_usec; + return 0; +} + +static void xrun_profile0(struct loopback *loop) +{ + snd_pcm_sframes_t pdelay, cdelay; + + if (snd_pcm_delay(loop->play->handle, &pdelay) >= 0 && + snd_pcm_delay(loop->capt->handle, &cdelay) >= 0) { + getcurtimestamp(&loop->xrun_last_update); + loop->xrun_last_pdelay = pdelay; + loop->xrun_last_cdelay = cdelay; + loop->xrun_buf_pcount = loop->play->buf_count; + loop->xrun_buf_ccount = loop->capt->buf_count; +#ifdef USE_SAMPLERATE + loop->xrun_out_frames = loop->src_out_frames; +#endif + } +} + +static inline void xrun_profile(struct loopback *loop) +{ + if (loop->xrun) + xrun_profile0(loop); +} + +static void xrun_stats0(struct loopback *loop) +{ + snd_timestamp_t t; + double expected, last, wake, check, queued = -1, proc, missing = -1; + double maxbuf, pfilled, cfilled, cqueued = -1, avail_min; + double sincejob; + + expected = ((double)loop->latency / + (double)loop->play->rate_req) * 1000; + getcurtimestamp(&t); + last = (double)timediff(t, loop->xrun_last_update) / 1000; + wake = (double)timediff(t, loop->xrun_last_wake) / 1000; + check = (double)timediff(t, loop->xrun_last_check) / 1000; + sincejob = (double)timediff(t, loop->tstamp_start) / 1000; + if (loop->xrun_last_pdelay != XRUN_PROFILE_UNKNOWN) + queued = ((double)loop->xrun_last_pdelay / + (double)loop->play->rate) * 1000; + if (loop->xrun_last_cdelay != XRUN_PROFILE_UNKNOWN) + cqueued = ((double)loop->xrun_last_cdelay / + (double)loop->capt->rate) * 1000; + maxbuf = ((double)loop->play->buffer_size / + (double)loop->play->rate) * 1000; + proc = (double)loop->xrun_max_proctime / 1000; + pfilled = ((double)(loop->xrun_buf_pcount + loop->xrun_out_frames) / + (double)loop->play->rate) * 1000; + cfilled = ((double)loop->xrun_buf_ccount / + (double)loop->capt->rate) * 1000; + avail_min = (((double)loop->play->buffer_size - + (double)loop->play->avail_min ) / + (double)loop->play->rate) * 1000; + avail_min = expected - avail_min; + if (queued >= 0) + missing = last - queued; + if (missing >= 0 && loop->xrun_max_missing < missing) + loop->xrun_max_missing = missing; + loop->xrun_max_proctime = 0; + getcurtimestamp(&t); + logit(LOG_INFO, " last write before %.4fms, queued %.4fms/%.4fms -> missing %.4fms\n", last, queued, cqueued, missing); + logit(LOG_INFO, " expected %.4fms, processing %.4fms, max missing %.4fms\n", expected, proc, loop->xrun_max_missing); + logit(LOG_INFO, " last wake %.4fms, last check %.4fms, avail_min %.4fms\n", wake, check, avail_min); + logit(LOG_INFO, " max buf %.4fms, pfilled %.4fms, cfilled %.4fms\n", maxbuf, pfilled, cfilled); + logit(LOG_INFO, " job started before %.4fms\n", sincejob); +} + +static inline void xrun_stats(struct loopback *loop) +{ + if (loop->xrun) + xrun_stats0(loop); +} + +static inline snd_pcm_uframes_t buf_avail(struct loopback_handle *lhandle) +{ + return lhandle->buf_size - lhandle->buf_count; +} + +static void buf_remove(struct loopback *loop, snd_pcm_uframes_t count) +{ + /* remove samples from the capture buffer */ + if (count <= 0) + return; + if (loop->play->buf == loop->capt->buf) { + if (count < loop->capt->buf_count) + loop->capt->buf_count -= count; + else + loop->capt->buf_count = 0; + } +} + +#if 0 +static void buf_add_copy(struct loopback *loop) +{ + struct loopback_handle *capt = loop->capt; + struct loopback_handle *play = loop->play; + snd_pcm_uframes_t count, count1, cpos, ppos; + + count = capt->buf_count; + cpos = capt->buf_pos - count; + if (cpos > capt->buf_size) + cpos += capt->buf_size; + ppos = (play->buf_pos + play->buf_count) % play->buf_size; + while (count > 0) { + count1 = count; + if (count1 + cpos > capt->buf_size) + count1 = capt->buf_size - cpos; + if (count1 > buf_avail(play)) + count1 = buf_avail(play); + if (count1 + ppos > play->buf_size) + count1 = play->buf_size - ppos; + if (count1 == 0) + break; + memcpy(play->buf + ppos * play->frame_size, + capt->buf + cpos * capt->frame_size, + count1 * capt->frame_size); + play->buf_count += count1; + capt->buf_count -= count1; + ppos += count1; + ppos %= play->buf_size; + cpos += count1; + cpos %= capt->buf_size; + count -= count1; + } +} +#endif + +#ifdef USE_SAMPLERATE +static void buf_add_src(struct loopback *loop) +{ + struct loopback_handle *capt = loop->capt; + struct loopback_handle *play = loop->play; + float *old_data_out; + snd_pcm_uframes_t count, pos, count1, pos1; + count = capt->buf_count; + pos = 0; + pos1 = capt->buf_pos - count; + if (pos1 > capt->buf_size) + pos1 += capt->buf_size; + while (count > 0) { + count1 = count; + if (count1 + pos1 > capt->buf_size) + count1 = capt->buf_size - pos1; + if (capt->format == SND_PCM_FORMAT_S32) + src_int_to_float_array((int *)(capt->buf + + pos1 * capt->frame_size), + (void *)loop->src_data.data_in + + pos * capt->channels, + count1 * capt->channels); + else + src_short_to_float_array((short *)(capt->buf + + pos1 * capt->frame_size), + (void *)loop->src_data.data_in + + pos * capt->channels, + count1 * capt->channels); + count -= count1; + pos += count1; + pos1 += count1; + pos1 %= capt->buf_size; + } + loop->src_data.input_frames = pos; + loop->src_data.output_frames = play->buf_size - + loop->src_out_frames; + loop->src_data.end_of_input = 0; + old_data_out = loop->src_data.data_out; + loop->src_data.data_out = old_data_out + loop->src_out_frames; + src_process(loop->src_state, &loop->src_data); + loop->src_data.data_out = old_data_out; + capt->buf_count -= loop->src_data.input_frames_used; + count = loop->src_data.output_frames_gen + + loop->src_out_frames; + pos = 0; + pos1 = (play->buf_pos + play->buf_count) % play->buf_size; + while (count > 0) { + count1 = count; + if (count1 + pos1 > play->buf_size) + count1 = play->buf_size - pos1; + if (count1 > buf_avail(play)) + count1 = buf_avail(play); + if (count1 == 0) + break; + if (capt->format == SND_PCM_FORMAT_S32) + src_float_to_int_array(loop->src_data.data_out + + pos * play->channels, + (int *)(play->buf + + pos1 * play->frame_size), + count1 * play->channels); + else + src_float_to_short_array(loop->src_data.data_out + + pos * play->channels, + (short *)(play->buf + + pos1 * play->frame_size), + count1 * play->channels); + play->buf_count += count1; + count -= count1; + pos += count1; + pos1 += count1; + pos1 %= play->buf_size; + } +#if 0 + printf("src: pos = %li, gen = %li, out = %li, count = %li\n", + (long)pos, (long)loop->src_data.output_frames_gen, + (long)loop->src_out_frames, play->buf_count); +#endif + loop->src_out_frames = (loop->src_data.output_frames_gen + + loop->src_out_frames) - pos; + if (loop->src_out_frames > 0) { + memmove(loop->src_data.data_out, + loop->src_data.data_out + pos * play->channels, + loop->src_out_frames * play->channels * sizeof(float)); + } +} +#else +static void buf_add_src(struct loopback *loop) +{ +} +#endif + +static void buf_add(struct loopback *loop, snd_pcm_uframes_t count) +{ + /* copy samples from capture to playback buffer */ + if (count <= 0) + return; + if (loop->play->buf == loop->capt->buf) { + loop->play->buf_count += count; + } else { + buf_add_src(loop); + } +} + +static int xrun(struct loopback_handle *lhandle) +{ + int err; + + if (lhandle == lhandle->loopback->play) { + logit(LOG_DEBUG, "underrun for %s\n", lhandle->id); + xrun_stats(lhandle->loopback); + if ((err = snd_pcm_prepare(lhandle->handle)) < 0) + return err; + lhandle->xrun_pending = 1; + } else { + logit(LOG_DEBUG, "overrun for %s\n", lhandle->id); + xrun_stats(lhandle->loopback); + if ((err = snd_pcm_prepare(lhandle->handle)) < 0) + return err; + lhandle->xrun_pending = 1; + } + return 0; +} + +static int suspend(struct loopback_handle *lhandle) +{ + int err; + + while ((err = snd_pcm_resume(lhandle->handle)) == -EAGAIN) + usleep(1); + if (err < 0) + return xrun(lhandle); + return 0; +} + +static int readit(struct loopback_handle *lhandle) +{ + snd_pcm_sframes_t r, res = 0; + snd_pcm_sframes_t avail; + int err; + + avail = snd_pcm_avail_update(lhandle->handle); + if (avail == -EPIPE) { + return xrun(lhandle); + } else if (avail == -ESTRPIPE) { + if ((err = suspend(lhandle)) < 0) + return err; + } + if (avail > buf_avail(lhandle)) { + lhandle->buf_over += avail - buf_avail(lhandle); + avail = buf_avail(lhandle); + } else if (avail == 0) { + if (snd_pcm_state(lhandle->handle) == SND_PCM_STATE_DRAINING) { + lhandle->loopback->reinit = 1; + return 0; + } + } + while (avail > 0) { + r = buf_avail(lhandle); + if (r + lhandle->buf_pos > lhandle->buf_size) + r = lhandle->buf_size - lhandle->buf_pos; + if (r > avail) + r = avail; + r = snd_pcm_readi(lhandle->handle, + lhandle->buf + + lhandle->buf_pos * + lhandle->frame_size, r); + if (r == 0) + return res; + if (r < 0) { + if (r == -EPIPE) { + err = xrun(lhandle); + return res > 0 ? res : err; + } else if (r == -ESTRPIPE) { + if ((err = suspend(lhandle)) < 0) + return res > 0 ? res : err; + r = 0; + } else { + return res > 0 ? res : r; + } + } +#ifdef FILE_CWRITE + if (lhandle->loopback->cfile) + fwrite(lhandle->buf + lhandle->buf_pos * lhandle->frame_size, + r, lhandle->frame_size, lhandle->loopback->cfile); +#endif + res += r; + if (lhandle->max < res) + lhandle->max = res; + lhandle->counter += r; + lhandle->buf_count += r; + lhandle->buf_pos += r; + lhandle->buf_pos %= lhandle->buf_size; + avail -= r; + } + return res; +} + +static int writeit(struct loopback_handle *lhandle) +{ + snd_pcm_sframes_t avail; + snd_pcm_sframes_t r, res = 0; + int err; + + __again: + avail = snd_pcm_avail_update(lhandle->handle); + if (avail == -EPIPE) { + if ((err = xrun(lhandle)) < 0) + return err; + return res; + } else if (avail == -ESTRPIPE) { + if ((err = suspend(lhandle)) < 0) + return err; + goto __again; + } + while (avail > 0 && lhandle->buf_count > 0) { + r = lhandle->buf_count; + if (r + lhandle->buf_pos > lhandle->buf_size) + r = lhandle->buf_size - lhandle->buf_pos; + if (r > avail) + r = avail; + r = snd_pcm_writei(lhandle->handle, + lhandle->buf + + lhandle->buf_pos * + lhandle->frame_size, r); + if (r <= 0) { + if (r == -EPIPE) { + if ((err = xrun(lhandle)) < 0) + return err; + return res; + } else if (r == -ESTRPIPE) { + } + return res > 0 ? res : r; + } +#ifdef FILE_PWRITE + if (lhandle->loopback->pfile) + fwrite(lhandle->buf + lhandle->buf_pos * lhandle->frame_size, + r, lhandle->frame_size, lhandle->loopback->pfile); +#endif + res += r; + lhandle->counter += r; + lhandle->buf_count -= r; + lhandle->buf_pos += r; + lhandle->buf_pos %= lhandle->buf_size; + xrun_profile(lhandle->loopback); + if (lhandle->loopback->stop_pending) { + lhandle->loopback->stop_count += r; + if (lhandle->loopback->stop_count * lhandle->pitch > + lhandle->loopback->latency * 3) { + lhandle->loopback->stop_pending = 0; + lhandle->loopback->reinit = 1; + break; + } + } + } + return res; +} + +static snd_pcm_sframes_t remove_samples(struct loopback *loop, + int capture_preferred, + snd_pcm_sframes_t count) +{ + struct loopback_handle *play = loop->play; + struct loopback_handle *capt = loop->capt; + + if (loop->play->buf == loop->capt->buf) { + if (count > loop->play->buf_count) + count = loop->play->buf_count; + if (count > loop->capt->buf_count) + count = loop->capt->buf_count; + capt->buf_count -= count; + play->buf_pos += count; + play->buf_pos %= play->buf_size; + play->buf_count -= count; + return count; + } + if (capture_preferred) { + if (count > capt->buf_count) + count = capt->buf_count; + capt->buf_count -= count; + } else { + if (count > play->buf_count) + count = play->buf_count; + play->buf_count -= count; + } + return count; +} + +static int xrun_sync(struct loopback *loop) +{ + struct loopback_handle *play = loop->play; + struct loopback_handle *capt = loop->capt; + snd_pcm_uframes_t fill = get_whole_latency(loop); + snd_pcm_sframes_t pdelay, cdelay, delay1, pdelay1, cdelay1, diff; + int err; + + __again: + if (verbose > 5) + snd_output_printf(loop->output, "%s: xrun sync %i %i\n", loop->id, capt->xrun_pending, play->xrun_pending); + if (capt->xrun_pending) { + __pagain: + capt->xrun_pending = 0; + if ((err = snd_pcm_prepare(capt->handle)) < 0) { + logit(LOG_CRIT, "%s prepare failed: %s\n", capt->id, snd_strerror(err)); + return err; + } + if ((err = snd_pcm_start(capt->handle)) < 0) { + logit(LOG_CRIT, "%s start failed: %s\n", capt->id, snd_strerror(err)); + return err; + } + } else { + diff = readit(capt); + buf_add(loop, diff); + if (capt->xrun_pending) + goto __pagain; + } + /* skip additional playback samples */ + if ((err = snd_pcm_delay(capt->handle, &cdelay)) < 0) { + if (err == -EPIPE) { + capt->xrun_pending = 1; + goto __again; + } + if (err == -ESTRPIPE) { + err = suspend(capt); + if (err < 0) + return err; + goto __again; + } + logit(LOG_CRIT, "%s capture delay failed: %s\n", capt->id, snd_strerror(err)); + return err; + } + if ((err = snd_pcm_delay(play->handle, &pdelay)) < 0) { + if (err == -EPIPE) { + pdelay = 0; + play->xrun_pending = 1; + } else if (err == -ESTRPIPE) { + err = suspend(play); + if (err < 0) + return err; + goto __again; + } else { + logit(LOG_CRIT, "%s playback delay failed: %s\n", play->id, snd_strerror(err)); + return err; + } + } + capt->counter = cdelay; + play->counter = pdelay; + if (play->buf != capt->buf) + cdelay += capt->buf_count; + pdelay += play->buf_count; +#ifdef USE_SAMPLERATE + pdelay += loop->src_out_frames; +#endif + cdelay1 = cdelay * capt->pitch; + pdelay1 = pdelay * play->pitch; + delay1 = cdelay1 + pdelay1; + capt->total_queued = 0; + play->total_queued = 0; + loop->total_queued_count = 0; + loop->pitch_diff = loop->pitch_diff_min = loop->pitch_diff_max = 0; + if (verbose > 6) { + snd_output_printf(loop->output, + "sync: cdelay=%li(%li), pdelay=%li(%li), fill=%li (delay=%li)" +#ifdef USE_SAMPLERATE + ", src_out=%li" +#endif + "\n", + (long)cdelay, (long)cdelay1, (long)pdelay, (long)pdelay1, + (long)fill, (long)delay1 +#ifdef USE_SAMPLERATE + , (long)loop->src_out_frames +#endif + ); + snd_output_printf(loop->output, + "sync: cbufcount=%li, pbufcount=%li\n", + (long)capt->buf_count, (long)play->buf_count); + } + if (delay1 > fill && capt->counter > 0) { + if ((err = snd_pcm_drop(capt->handle)) < 0) + return err; + if ((err = snd_pcm_prepare(capt->handle)) < 0) + return err; + if ((err = snd_pcm_start(capt->handle)) < 0) + return err; + diff = remove_samples(loop, 1, (delay1 - fill) / capt->pitch); + if (verbose > 6) + snd_output_printf(loop->output, + "sync: capt stop removed %li samples\n", (long)diff); + goto __again; + } + if (delay1 > fill) { + diff = (delay1 - fill) / play->pitch; + if (diff > play->buf_count) + diff = play->buf_count; + if (verbose > 6) + snd_output_printf(loop->output, + "sync: removing %li playback samples, delay1=%li\n", (long)diff, (long)delay1); + diff = remove_samples(loop, 0, diff); + pdelay -= diff; + pdelay1 = pdelay * play->pitch; + delay1 = cdelay1 + pdelay1; + if (verbose > 6) + snd_output_printf(loop->output, + "sync: removed %li playback samples, delay1=%li\n", (long)diff, (long)delay1); + } + if (delay1 > fill) { + diff = (delay1 - fill) / capt->pitch; + if (diff > capt->buf_count) + diff = capt->buf_count; + if (verbose > 6) + snd_output_printf(loop->output, + "sync: removing %li captured samples, delay1=%li\n", (long)diff, (long)delay1); + diff -= remove_samples(loop, 1, diff); + cdelay -= diff; + cdelay1 = cdelay * capt->pitch; + delay1 = cdelay1 + pdelay1; + if (verbose > 6) + snd_output_printf(loop->output, + "sync: removed %li captured samples, delay1=%li\n", (long)diff, (long)delay1); + } + if (play->xrun_pending) { + play->xrun_pending = 0; + diff = (fill - delay1) / play->pitch; + if (verbose > 6) + snd_output_printf(loop->output, + "sync: xrun_pending, silence filling %li / buf_count=%li\n", (long)diff, play->buf_count); + if (fill > delay1 && play->buf_count < diff) { + diff = diff - play->buf_count; + if (verbose > 6) + snd_output_printf(loop->output, + "sync: playback silence added %li samples\n", (long)diff); + play->buf_pos -= diff; + play->buf_pos %= play->buf_size; + err = snd_pcm_format_set_silence(play->format, play->buf + play->buf_pos * play->frame_size, + diff * play->channels); + if (err < 0) + return err; + play->buf_count += diff; + } + if ((err = snd_pcm_prepare(play->handle)) < 0) { + logit(LOG_CRIT, "%s prepare failed: %s\n", play->id, snd_strerror(err)); + return err; + } + delay1 = writeit(play); + if (verbose > 6) + snd_output_printf(loop->output, + "sync: playback wrote %li samples\n", (long)delay1); + if (delay1 > diff) { + buf_remove(loop, delay1 - diff); + if (verbose > 6) + snd_output_printf(loop->output, + "sync: playback buf_remove %li samples\n", (long)(delay1 - diff)); + } + if ((err = snd_pcm_start(play->handle)) < 0) { + logit(LOG_CRIT, "%s start failed: %s\n", play->id, snd_strerror(err)); + return err; + } + } else if (delay1 < fill) { + diff = (fill - delay1) / play->pitch; + while (diff > 0) { + delay1 = play->buf_size - play->buf_pos; + if (verbose > 6) + snd_output_printf(loop->output, + "sync: playback short, silence filling %li / buf_count=%li\n", (long)delay1, play->buf_count); + if (delay1 > diff) + delay1 = diff; + err = snd_pcm_format_set_silence(play->format, play->buf + play->buf_pos * play->frame_size, + delay1 * play->channels); + if (err < 0) + return err; + play->buf_pos += delay1; + play->buf_pos %= play->buf_size; + play->buf_count += delay1; + diff -= delay1; + } + writeit(play); + } + if (verbose > 5) { + snd_output_printf(loop->output, "%s: xrun sync ok\n", loop->id); + if (verbose > 6) { + if (snd_pcm_delay(capt->handle, &cdelay) < 0) + cdelay = -1; + if (snd_pcm_delay(play->handle, &pdelay) < 0) + pdelay = -1; + if (play->buf != capt->buf) + cdelay += capt->buf_count; + pdelay += play->buf_count; +#ifdef USE_SAMPLERATE + pdelay += loop->src_out_frames; +#endif + cdelay1 = cdelay * capt->pitch; + pdelay1 = pdelay * play->pitch; + delay1 = cdelay1 + pdelay1; + snd_output_printf(loop->output, "%s: sync verify: %li\n", loop->id, delay1); + } + } + loop->xrun_max_proctime = 0; + return 0; +} + +static int set_notify(struct loopback_handle *lhandle, int enable) +{ + int err; + + if (lhandle->ctl_notify == NULL) + return 0; + snd_ctl_elem_value_set_boolean(lhandle->ctl_notify, 0, enable); + err = snd_ctl_elem_write(lhandle->ctl, lhandle->ctl_notify); + if (err < 0) { + logit(LOG_CRIT, "Cannot set PCM Notify element for %s: %s\n", lhandle->id, snd_strerror(err)); + return err; + } + err = snd_ctl_elem_read(lhandle->ctl, lhandle->ctl_notify); + if (err < 0) { + logit(LOG_CRIT, "Cannot get PCM Notify element for %s: %s\n", lhandle->id, snd_strerror(err)); + return err; + } + return 0; +} + +static int set_rate_shift(struct loopback_handle *lhandle, double pitch) +{ + int err; + + if (lhandle->ctl_rate_shift == NULL) + return 0; + snd_ctl_elem_value_set_integer(lhandle->ctl_rate_shift, 0, pitch * 100000); + err = snd_ctl_elem_write(lhandle->ctl, lhandle->ctl_rate_shift); + if (err < 0) { + logit(LOG_CRIT, "Cannot set PCM Rate Shift element for %s: %s\n", lhandle->id, snd_strerror(err)); + return err; + } + return 0; +} + +void update_pitch(struct loopback *loop) +{ + double pitch = loop->pitch; + +#ifdef USE_SAMPLERATE + if (loop->sync == SYNC_TYPE_SAMPLERATE) { + loop->src_data.src_ratio = (double)1.0 / (pitch * + loop->play->pitch * loop->capt->pitch); + if (verbose > 2) + snd_output_printf(loop->output, "%s: Samplerate src_ratio update1: %.8f\n", loop->id, loop->src_data.src_ratio); + } else +#endif + if (loop->sync == SYNC_TYPE_CAPTRATESHIFT) { + set_rate_shift(loop->capt, pitch); +#ifdef USE_SAMPLERATE + if (loop->use_samplerate) { + loop->src_data.src_ratio = + (double)1.0 / + (loop->play->pitch * loop->capt->pitch); + if (verbose > 2) + snd_output_printf(loop->output, "%s: Samplerate src_ratio update2: %.8f\n", loop->id, loop->src_data.src_ratio); + } +#endif + } + else if (loop->sync == SYNC_TYPE_PLAYRATESHIFT) { + set_rate_shift(loop->play, pitch); +#ifdef USE_SAMPLERATE + if (loop->use_samplerate) { + loop->src_data.src_ratio = + (double)1.0 / + (loop->play->pitch * loop->capt->pitch); + if (verbose > 2) + snd_output_printf(loop->output, "%s: Samplerate src_ratio update3: %.8f\n", loop->id, loop->src_data.src_ratio); + } +#endif + } + if (verbose) + snd_output_printf(loop->output, "New pitch for %s: %.8f (min/max samples = %li/%li)\n", loop->id, pitch, loop->pitch_diff_min, loop->pitch_diff_max); +} + +static int get_active(struct loopback_handle *lhandle) +{ + int err; + + if (lhandle->ctl_active == NULL) + return 0; + err = snd_ctl_elem_read(lhandle->ctl, lhandle->ctl_active); + if (err < 0) { + logit(LOG_CRIT, "Cannot get PCM Slave Active element for %s: %s\n", lhandle->id, snd_strerror(err)); + return err; + } + return snd_ctl_elem_value_get_boolean(lhandle->ctl_active, 0); +} + +static int get_format(struct loopback_handle *lhandle) +{ + int err; + + if (lhandle->ctl_format == NULL) + return 0; + err = snd_ctl_elem_read(lhandle->ctl, lhandle->ctl_format); + if (err < 0) { + logit(LOG_CRIT, "Cannot get PCM Format element for %s: %s\n", lhandle->id, snd_strerror(err)); + return err; + } + return snd_ctl_elem_value_get_integer(lhandle->ctl_format, 0); +} + +static int get_rate(struct loopback_handle *lhandle) +{ + int err; + + if (lhandle->ctl_rate == NULL) + return 0; + err = snd_ctl_elem_read(lhandle->ctl, lhandle->ctl_rate); + if (err < 0) { + logit(LOG_CRIT, "Cannot get PCM Rate element for %s: %s\n", lhandle->id, snd_strerror(err)); + return err; + } + return snd_ctl_elem_value_get_integer(lhandle->ctl_rate, 0); +} + +static int get_channels(struct loopback_handle *lhandle) +{ + int err; + + if (lhandle->ctl_channels == NULL) + return 0; + err = snd_ctl_elem_read(lhandle->ctl, lhandle->ctl_channels); + if (err < 0) { + logit(LOG_CRIT, "Cannot get PCM Channels element for %s: %s\n", lhandle->id, snd_strerror(err)); + return err; + } + return snd_ctl_elem_value_get_integer(lhandle->ctl_channels, 0); +} + +static void openctl_elem(struct loopback_handle *lhandle, + int device, int subdevice, + const char *name, + snd_ctl_elem_value_t **elem) +{ + int err; + + if (snd_ctl_elem_value_malloc(elem) < 0) { + *elem = NULL; + } else { + snd_ctl_elem_value_set_interface(*elem, + SND_CTL_ELEM_IFACE_PCM); + snd_ctl_elem_value_set_device(*elem, device); + snd_ctl_elem_value_set_subdevice(*elem, subdevice); + snd_ctl_elem_value_set_name(*elem, name); + err = snd_ctl_elem_read(lhandle->ctl, *elem); + if (err < 0) { + snd_ctl_elem_value_free(*elem); + *elem = NULL; + } + } +} + +static int openctl(struct loopback_handle *lhandle, int device, int subdevice) +{ + int err; + + lhandle->ctl_rate_shift = NULL; + if (lhandle->loopback->play == lhandle) { + if (lhandle->loopback->controls) + goto __events; + return 0; + } + openctl_elem(lhandle, device, subdevice, "PCM Notify", + &lhandle->ctl_notify); + openctl_elem(lhandle, device, subdevice, "PCM Rate Shift 100000", + &lhandle->ctl_rate_shift); + set_rate_shift(lhandle, 1); + openctl_elem(lhandle, device, subdevice, "PCM Slave Active", + &lhandle->ctl_active); + openctl_elem(lhandle, device, subdevice, "PCM Slave Format", + &lhandle->ctl_format); + openctl_elem(lhandle, device, subdevice, "PCM Slave Rate", + &lhandle->ctl_rate); + openctl_elem(lhandle, device, subdevice, "PCM Slave Channels", + &lhandle->ctl_channels); + if ((lhandle->ctl_active && + lhandle->ctl_format && + lhandle->ctl_rate && + lhandle->ctl_channels) || + lhandle->loopback->controls) { + __events: + if ((err = snd_ctl_poll_descriptors_count(lhandle->ctl)) < 0) + lhandle->ctl_pollfd_count = 0; + else + lhandle->ctl_pollfd_count = err; + if (snd_ctl_subscribe_events(lhandle->ctl, 1) < 0) + lhandle->ctl_pollfd_count = 0; + } + return 0; +} + +static int openit(struct loopback_handle *lhandle) +{ + snd_pcm_info_t *info; + int stream = lhandle == lhandle->loopback->play ? + SND_PCM_STREAM_PLAYBACK : + SND_PCM_STREAM_CAPTURE; + int err, card, device, subdevice; + pcm_open_lock(); + err = snd_pcm_open(&lhandle->handle, lhandle->device, stream, SND_PCM_NONBLOCK); + pcm_open_unlock(); + if (err < 0) { + logit(LOG_CRIT, "%s open error: %s\n", lhandle->id, snd_strerror(err)); + return err; + } + if ((err = snd_pcm_info_malloc(&info)) < 0) + return err; + if ((err = snd_pcm_info(lhandle->handle, info)) < 0) { + snd_pcm_info_free(info); + return err; + } + card = snd_pcm_info_get_card(info); + device = snd_pcm_info_get_device(info); + subdevice = snd_pcm_info_get_subdevice(info); + snd_pcm_info_free(info); + lhandle->card_number = card; + lhandle->ctl = NULL; + if (card >= 0 || lhandle->ctldev) { + char name[16], *dev = lhandle->ctldev; + if (dev == NULL) { + sprintf(name, "hw:%i", card); + dev = name; + } + pcm_open_lock(); + err = snd_ctl_open(&lhandle->ctl, dev, SND_CTL_NONBLOCK); + pcm_open_unlock(); + if (err < 0) { + logit(LOG_CRIT, "%s [%s] ctl open error: %s\n", lhandle->id, dev, snd_strerror(err)); + lhandle->ctl = NULL; + } + if (lhandle->ctl) + openctl(lhandle, device, subdevice); + } + return 0; +} + +static int freeit(struct loopback_handle *lhandle) +{ + free(lhandle->buf); + lhandle->buf = NULL; + return 0; +} + +static int closeit(struct loopback_handle *lhandle) +{ + int err = 0; + + set_rate_shift(lhandle, 1); + if (lhandle->ctl_rate_shift) + snd_ctl_elem_value_free(lhandle->ctl_rate_shift); + lhandle->ctl_rate_shift = NULL; + if (lhandle->ctl) + err = snd_ctl_close(lhandle->ctl); + lhandle->ctl = NULL; + if (lhandle->handle) + err = snd_pcm_close(lhandle->handle); + lhandle->handle = NULL; + return err; +} + +static int init_handle(struct loopback_handle *lhandle, int alloc) +{ + snd_pcm_uframes_t lat; + lhandle->frame_size = (snd_pcm_format_physical_width(lhandle->format) + / 8) * lhandle->channels; + lhandle->sync_point = lhandle->rate * 15; /* every 15 seconds */ + lat = lhandle->loopback->latency; + if (lhandle->buffer_size > lat) + lat = lhandle->buffer_size; + lhandle->buf_size = lat * 2; + if (alloc) { + lhandle->buf = calloc(1, lhandle->buf_size * lhandle->frame_size); + if (lhandle->buf == NULL) + return -ENOMEM; + } + return 0; +} + +int pcmjob_init(struct loopback *loop) +{ + int err; + char id[128]; + +#ifdef FILE_CWRITE + loop->cfile = fopen(FILE_CWRITE, "w+"); +#endif +#ifdef FILE_PWRITE + loop->pfile = fopen(FILE_PWRITE, "w+"); +#endif + if ((err = openit(loop->play)) < 0) + goto __error; + if ((err = openit(loop->capt)) < 0) + goto __error; + snprintf(id, sizeof(id), "%s/%s", loop->play->id, loop->capt->id); + id[sizeof(id)-1] = '\0'; + loop->id = strdup(id); + if (loop->sync == SYNC_TYPE_AUTO && loop->capt->ctl_rate_shift) + loop->sync = SYNC_TYPE_CAPTRATESHIFT; + if (loop->sync == SYNC_TYPE_AUTO && loop->play->ctl_rate_shift) + loop->sync = SYNC_TYPE_PLAYRATESHIFT; +#ifdef USE_SAMPLERATE + if (loop->sync == SYNC_TYPE_AUTO && loop->src_enable) + loop->sync = SYNC_TYPE_SAMPLERATE; +#endif + if (loop->sync == SYNC_TYPE_AUTO) + loop->sync = SYNC_TYPE_SIMPLE; + if (loop->slave == SLAVE_TYPE_AUTO && + loop->capt->ctl_notify && + loop->capt->ctl_active && + loop->capt->ctl_format && + loop->capt->ctl_rate && + loop->capt->ctl_channels) + loop->slave = SLAVE_TYPE_ON; + if (loop->slave == SLAVE_TYPE_ON) { + err = set_notify(loop->capt, 1); + if (err < 0) + goto __error; + if (loop->capt->ctl_notify == NULL || + snd_ctl_elem_value_get_boolean(loop->capt->ctl_notify, 0) == 0) { + logit(LOG_CRIT, "unable to enable slave mode for %s\n", loop->id); + err = -EINVAL; + goto __error; + } + } + err = control_init(loop); + if (err < 0) + goto __error; + return 0; + __error: + pcmjob_done(loop); + return err; +} + +static void freeloop(struct loopback *loop) +{ +#ifdef USE_SAMPLERATE + if (loop->use_samplerate) { + if (loop->src_state) + src_delete(loop->src_state); + loop->src_state = NULL; + free((void *)loop->src_data.data_in); + loop->src_data.data_in = NULL; + free(loop->src_data.data_out); + loop->src_data.data_out = NULL; + } +#endif + if (loop->play->buf == loop->capt->buf) + loop->play->buf = NULL; + freeit(loop->play); + freeit(loop->capt); +} + +int pcmjob_done(struct loopback *loop) +{ + control_done(loop); + closeit(loop->play); + closeit(loop->capt); + freeloop(loop); + free(loop->id); + loop->id = NULL; +#ifdef FILE_PWRITE + if (loop->pfile) { + fclose(loop->pfile); + loop->pfile = NULL; + } +#endif +#ifdef FILE_CWRITE + if (loop->cfile) { + fclose(loop->cfile); + loop->cfile = NULL; + } +#endif + return 0; +} + +static void lhandle_start(struct loopback_handle *lhandle) +{ + lhandle->buf_pos = 0; + lhandle->buf_count = 0; + lhandle->counter = 0; + lhandle->total_queued = 0; +} + +static void fix_format(struct loopback *loop, int force) +{ + snd_pcm_format_t format = loop->capt->format; + + if (!force && loop->sync != SYNC_TYPE_SAMPLERATE) + return; + if (format == SND_PCM_FORMAT_S16 || + format == SND_PCM_FORMAT_S32) + return; + if (snd_pcm_format_width(format) > 16) + format = SND_PCM_FORMAT_S32; + else + format = SND_PCM_FORMAT_S16; + loop->capt->format = format; + loop->play->format = format; +} + +int pcmjob_start(struct loopback *loop) +{ + snd_pcm_uframes_t count; + int err; + + loop->pollfd_count = loop->play->ctl_pollfd_count + + loop->capt->ctl_pollfd_count; + if ((err = snd_pcm_poll_descriptors_count(loop->play->handle)) < 0) + goto __error; + loop->play->pollfd_count = err; + loop->pollfd_count += err; + if ((err = snd_pcm_poll_descriptors_count(loop->capt->handle)) < 0) + goto __error; + loop->capt->pollfd_count = err; + loop->pollfd_count += err; + if (loop->slave == SLAVE_TYPE_ON) { + err = get_active(loop->capt); + if (err < 0) + goto __error; + if (err == 0) /* stream is not active */ + return 0; + err = get_format(loop->capt); + if (err < 0) + goto __error; + loop->play->format = loop->capt->format = err; + fix_format(loop, 0); + err = get_rate(loop->capt); + if (err < 0) + goto __error; + loop->play->rate_req = loop->capt->rate_req = err; + err = get_channels(loop->capt); + if (err < 0) + goto __error; + loop->play->channels = loop->capt->channels = err; + } + loop->reinit = 0; + loop->use_samplerate = 0; +__again: + if (loop->latency_req) { + loop->latency_reqtime = frames_to_time(loop->play->rate_req, + loop->latency_req); + loop->latency_req = 0; + } + loop->latency = time_to_frames(loop->play->rate_req, loop->latency_reqtime); + if ((err = setparams(loop, loop->latency/2)) < 0) + goto __error; + if (verbose) + showlatency(loop->output, loop->latency, loop->play->rate_req, "Latency"); + if (loop->play->access == loop->capt->access && + loop->play->format == loop->capt->format && + loop->play->rate == loop->capt->rate && + loop->play->channels == loop->capt->channels && + loop->sync != SYNC_TYPE_SAMPLERATE) { + if (verbose > 1) + snd_output_printf(loop->output, "shared buffer!!!\n"); + if ((err = init_handle(loop->play, 1)) < 0) + goto __error; + if ((err = init_handle(loop->capt, 0)) < 0) + goto __error; + if (loop->play->buf_size < loop->capt->buf_size) { + char *nbuf = realloc(loop->play->buf, + loop->capt->buf_size * + loop->capt->frame_size); + if (nbuf == NULL) { + err = -ENOMEM; + goto __error; + } + loop->play->buf = nbuf; + loop->play->buf_size = loop->capt->buf_size; + } else if (loop->capt->buf_size < loop->play->buf_size) { + char *nbuf = realloc(loop->capt->buf, + loop->play->buf_size * + loop->play->frame_size); + if (nbuf == NULL) { + err = -ENOMEM; + goto __error; + } + loop->capt->buf = nbuf; + loop->capt->buf_size = loop->play->buf_size; + } + loop->capt->buf = loop->play->buf; + } else { + if ((err = init_handle(loop->play, 1)) < 0) + goto __error; + if ((err = init_handle(loop->capt, 1)) < 0) + goto __error; + if (loop->play->rate_req != loop->play->rate || + loop->capt->rate_req != loop->capt->rate) { + snd_pcm_format_t format1, format2; + loop->use_samplerate = 1; + format1 = loop->play->format; + format2 = loop->capt->format; + fix_format(loop, 1); + if (loop->play->format != format1 || + loop->capt->format != format2) { + pcmjob_stop(loop); + goto __again; + } + } + } +#ifdef USE_SAMPLERATE + if (loop->sync == SYNC_TYPE_SAMPLERATE) + loop->use_samplerate = 1; + if (loop->use_samplerate && !loop->src_enable) { + logit(LOG_CRIT, "samplerate conversion required but disabled\n"); + loop->use_samplerate = 0; + err = -EIO; + goto __error; + } + if (loop->use_samplerate) { + if ((loop->capt->format != SND_PCM_FORMAT_S16 || + loop->play->format != SND_PCM_FORMAT_S16) && + (loop->capt->format != SND_PCM_FORMAT_S32 || + loop->play->format != SND_PCM_FORMAT_S32)) { + logit(LOG_CRIT, "samplerate conversion supports only %s or %s formats (play=%s, capt=%s)\n", snd_pcm_format_name(SND_PCM_FORMAT_S16), snd_pcm_format_name(SND_PCM_FORMAT_S32), snd_pcm_format_name(loop->play->format), snd_pcm_format_name(loop->capt->format)); + loop->use_samplerate = 0; + err = -EIO; + goto __error; + } + loop->src_state = src_new(loop->src_converter_type, + loop->play->channels, &err); + loop->src_data.data_in = calloc(1, sizeof(float)*loop->capt->channels*loop->capt->buf_size); + if (loop->src_data.data_in == NULL) { + err = -ENOMEM; + goto __error; + } + loop->src_data.data_out = calloc(1, sizeof(float)*loop->play->channels*loop->play->buf_size); + if (loop->src_data.data_out == NULL) { + err = -ENOMEM; + goto __error; + } + loop->src_data.src_ratio = (double)loop->play->rate / + (double)loop->capt->rate; + loop->src_data.end_of_input = 0; + loop->src_out_frames = 0; + } else { + loop->src_state = NULL; + } +#else + if (loop->sync == SYNC_TYPE_SAMPLERATE || loop->use_samplerate) { + logit(LOG_CRIT, "alsaloop is compiled without libsamplerate support\n"); + err = -EIO; + goto __error; + } +#endif + if (verbose) { + snd_output_printf(loop->output, "%s sync type: %s", loop->id, sync_types[loop->sync]); +#ifdef USE_SAMPLERATE + if (loop->sync == SYNC_TYPE_SAMPLERATE) + snd_output_printf(loop->output, " (%s)", src_types[loop->src_converter_type]); +#endif + snd_output_printf(loop->output, "\n"); + } + lhandle_start(loop->play); + lhandle_start(loop->capt); + if ((err = snd_pcm_format_set_silence(loop->play->format, + loop->play->buf, + loop->play->buf_size * loop->play->channels)) < 0) { + logit(LOG_CRIT, "%s: silence error\n", loop->id); + goto __error; + } + if (verbose > 4) + snd_output_printf(loop->output, "%s: capt->buffer_size = %li, play->buffer_size = %li\n", loop->id, loop->capt->buf_size, loop->play->buf_size); + loop->pitch = 1.0; + update_pitch(loop); + loop->pitch_delta = 1.0 / ((double)loop->capt->rate * 4); + loop->total_queued_count = 0; + loop->pitch_diff = 0; + count = get_whole_latency(loop) / loop->play->pitch; + loop->play->buf_count = count; + if (loop->play->buf == loop->capt->buf) + loop->capt->buf_pos = count; + err = writeit(loop->play); + if (verbose > 4) + snd_output_printf(loop->output, "%s: silence queued %i samples\n", loop->id, err); + if (count > loop->play->buffer_size) + count = loop->play->buffer_size; + if (err != count) { + logit(LOG_CRIT, "%s: initial playback fill error (%i/%i/%u)\n", loop->id, err, (int)count, loop->play->buffer_size); + err = -EIO; + goto __error; + } + loop->running = 1; + loop->stop_pending = 0; + if (loop->xrun) { + getcurtimestamp(&loop->xrun_last_update); + loop->xrun_last_pdelay = XRUN_PROFILE_UNKNOWN; + loop->xrun_last_cdelay = XRUN_PROFILE_UNKNOWN; + loop->xrun_max_proctime = 0; + } + if ((err = snd_pcm_start(loop->capt->handle)) < 0) { + logit(LOG_CRIT, "pcm start %s error: %s\n", loop->capt->id, snd_strerror(err)); + goto __error; + } + if (!loop->linked) { + if ((err = snd_pcm_start(loop->play->handle)) < 0) { + logit(LOG_CRIT, "pcm start %s error: %s\n", loop->play->id, snd_strerror(err)); + goto __error; + } + } + return 0; + __error: + pcmjob_stop(loop); + return err; +} + +int pcmjob_stop(struct loopback *loop) +{ + int err; + + if (loop->running) { + if ((err = snd_pcm_drop(loop->capt->handle)) < 0) + logit(LOG_WARNING, "pcm drop %s error: %s\n", loop->capt->id, snd_strerror(err)); + if ((err = snd_pcm_drop(loop->play->handle)) < 0) + logit(LOG_WARNING, "pcm drop %s error: %s\n", loop->play->id, snd_strerror(err)); + if ((err = snd_pcm_hw_free(loop->capt->handle)) < 0) + logit(LOG_WARNING, "pcm hw_free %s error: %s\n", loop->capt->id, snd_strerror(err)); + if ((err = snd_pcm_hw_free(loop->play->handle)) < 0) + logit(LOG_WARNING, "pcm hw_free %s error: %s\n", loop->play->id, snd_strerror(err)); + loop->running = 0; + } + freeloop(loop); + return 0; +} + +int pcmjob_pollfds_init(struct loopback *loop, struct pollfd *fds) +{ + int err, idx = 0; + + if (loop->running) { + err = snd_pcm_poll_descriptors(loop->play->handle, fds + idx, loop->play->pollfd_count); + if (err < 0) + return err; + idx += loop->play->pollfd_count; + err = snd_pcm_poll_descriptors(loop->capt->handle, fds + idx, loop->capt->pollfd_count); + if (err < 0) + return err; + idx += loop->capt->pollfd_count; + } + if (loop->play->ctl_pollfd_count > 0 && + (loop->slave == SLAVE_TYPE_ON || loop->controls)) { + err = snd_ctl_poll_descriptors(loop->play->ctl, fds + idx, loop->play->ctl_pollfd_count); + if (err < 0) + return err; + idx += loop->play->ctl_pollfd_count; + } + if (loop->capt->ctl_pollfd_count > 0 && + (loop->slave == SLAVE_TYPE_ON || loop->controls)) { + err = snd_ctl_poll_descriptors(loop->capt->ctl, fds + idx, loop->capt->ctl_pollfd_count); + if (err < 0) + return err; + idx += loop->capt->ctl_pollfd_count; + } + loop->active_pollfd_count = idx; + return idx; +} + +static snd_pcm_sframes_t get_queued_playback_samples(struct loopback *loop) +{ + snd_pcm_sframes_t delay; + int err; + + if ((err = snd_pcm_delay(loop->play->handle, &delay)) < 0) + return 0; + loop->play->last_delay = delay; + delay += loop->play->buf_count; +#ifdef USE_SAMPLERATE + delay += loop->src_out_frames; +#endif + return delay; +} + +static snd_pcm_sframes_t get_queued_capture_samples(struct loopback *loop) +{ + snd_pcm_sframes_t delay; + int err; + + if ((err = snd_pcm_delay(loop->capt->handle, &delay)) < 0) + return 0; + loop->capt->last_delay = delay; + delay += loop->capt->buf_count; + return delay; +} + +static int ctl_event_check(snd_ctl_elem_value_t *val, snd_ctl_event_t *ev) +{ + snd_ctl_elem_id_t *id1, *id2; + snd_ctl_elem_id_alloca(&id1); + snd_ctl_elem_id_alloca(&id2); + snd_ctl_elem_value_get_id(val, id1); + snd_ctl_event_elem_get_id(ev, id2); + if (snd_ctl_event_elem_get_mask(ev) == SND_CTL_EVENT_MASK_REMOVE) + return 0; + if ((snd_ctl_event_elem_get_mask(ev) & SND_CTL_EVENT_MASK_VALUE) == 0) + return 0; + return control_id_match(id1, id2); +} + +static int handle_ctl_events(struct loopback_handle *lhandle, + unsigned short events) +{ + struct loopback *loop = lhandle->loopback; + snd_ctl_event_t *ev; + int err, restart = 0; + + snd_ctl_event_alloca(&ev); + while ((err = snd_ctl_read(lhandle->ctl, ev)) != 0 && err != -EAGAIN) { + if (err < 0) + break; + if (snd_ctl_event_get_type(ev) != SND_CTL_EVENT_ELEM) + continue; + if (lhandle == loop->play) + goto __ctl_check; + if (verbose > 6) + snd_output_printf(loop->output, "%s: ctl event!!!! %s\n", lhandle->id, snd_ctl_event_elem_get_name(ev)); + if (ctl_event_check(lhandle->ctl_active, ev)) { + continue; + } else if (ctl_event_check(lhandle->ctl_format, ev)) { + err = get_format(lhandle); + if (lhandle->format != err) + restart = 1; + continue; + } else if (ctl_event_check(lhandle->ctl_rate, ev)) { + err = get_rate(lhandle); + if (lhandle->rate != err) + restart = 1; + continue; + } else if (ctl_event_check(lhandle->ctl_channels, ev)) { + err = get_channels(lhandle); + if (lhandle->channels != err) + restart = 1; + continue; + } + __ctl_check: + control_event(lhandle, ev); + } + err = get_active(lhandle); + if (verbose > 7) + snd_output_printf(loop->output, "%s: ctl event active %i\n", lhandle->id, err); + if (!err) { + if (lhandle->loopback->running) { + loop->stop_pending = 1; + loop->stop_count = 0; + } + } else { + loop->stop_pending = 0; + if (loop->running == 0) + restart = 1; + } + if (restart) { + pcmjob_stop(loop); + err = pcmjob_start(loop); + if (err < 0) + return err; + } + return 1; +} + +int pcmjob_pollfds_handle(struct loopback *loop, struct pollfd *fds) +{ + struct loopback_handle *play = loop->play; + struct loopback_handle *capt = loop->capt; + unsigned short prevents, crevents, events; + snd_pcm_uframes_t ccount, pcount; + int err, loopcount = 0, idx; + + if (verbose > 11) + snd_output_printf(loop->output, "%s: pollfds handle\n", loop->id); + if (verbose > 13 || loop->xrun) + getcurtimestamp(&loop->tstamp_start); + if (verbose > 12) { + snd_pcm_sframes_t pdelay, cdelay; + if ((err = snd_pcm_delay(play->handle, &pdelay)) < 0) + snd_output_printf(loop->output, "%s: delay error: %s / %li / %li\n", play->id, snd_strerror(err), play->buf_size, play->buf_count); + else + snd_output_printf(loop->output, "%s: delay %li / %li / %li\n", play->id, pdelay, play->buf_size, play->buf_count); + if ((err = snd_pcm_delay(capt->handle, &cdelay)) < 0) + snd_output_printf(loop->output, "%s: delay error: %s / %li / %li\n", capt->id, snd_strerror(err), capt->buf_size, capt->buf_count); + else + snd_output_printf(loop->output, "%s: delay %li / %li / %li\n", capt->id, cdelay, capt->buf_size, capt->buf_count); + } + idx = 0; + if (loop->running) { + err = snd_pcm_poll_descriptors_revents(play->handle, fds, + play->pollfd_count, + &prevents); + if (err < 0) + return err; + idx += play->pollfd_count; + err = snd_pcm_poll_descriptors_revents(capt->handle, fds + idx, + capt->pollfd_count, + &crevents); + if (err < 0) + return err; + idx += capt->pollfd_count; + if (loop->xrun) { + if (prevents || crevents) { + loop->xrun_last_wake = loop->xrun_last_wake0; + loop->xrun_last_wake0 = loop->tstamp_start; + } + loop->xrun_last_check = loop->xrun_last_check0; + loop->xrun_last_check0 = loop->tstamp_start; + } + } else { + prevents = crevents = 0; + } + if (play->ctl_pollfd_count > 0 && + (loop->slave == SLAVE_TYPE_ON || loop->controls)) { + err = snd_ctl_poll_descriptors_revents(play->ctl, fds + idx, + play->ctl_pollfd_count, + &events); + if (err < 0) + return err; + if (events) { + err = handle_ctl_events(play, events); + if (err == 1) + return 0; + if (err < 0) + return err; + } + idx += play->ctl_pollfd_count; + } + if (capt->ctl_pollfd_count > 0 && + (loop->slave == SLAVE_TYPE_ON || loop->controls)) { + err = snd_ctl_poll_descriptors_revents(capt->ctl, fds + idx, + capt->ctl_pollfd_count, + &events); + if (err < 0) + return err; + if (events) { + err = handle_ctl_events(capt, events); + if (err == 1) + return 0; + if (err < 0) + return err; + } + idx += capt->ctl_pollfd_count; + } + if (verbose > 9) + snd_output_printf(loop->output, "%s: prevents = 0x%x, crevents = 0x%x\n", loop->id, prevents, crevents); + if (!loop->running) + goto __pcm_end; + do { + ccount = readit(capt); + if (prevents != 0 && crevents == 0 && + ccount == 0 && loopcount == 0) { + if (play->stall > 20) { + play->stall = 0; + increase_playback_avail_min(play); + break; + } + play->stall++; + break; + } + if (ccount > 0) + play->stall = 0; + buf_add(loop, ccount); + if (capt->xrun_pending || loop->reinit) + break; + /* we read new samples, if we have a room in the playback + buffer, feed them there */ + pcount = writeit(play); + buf_remove(loop, pcount); + if (pcount > 0) + play->stall = 0; + if (play->xrun_pending || loop->reinit) + break; + loopcount++; + } while ((ccount > 0 || pcount > 0) && loopcount > 10); + if (play->xrun_pending || capt->xrun_pending) { + if ((err = xrun_sync(loop)) < 0) + return err; + } + if (loop->reinit) { + err = pcmjob_stop(loop); + if (err < 0) + return err; + err = pcmjob_start(loop); + if (err < 0) + return err; + } + if (loop->sync != SYNC_TYPE_NONE && + play->counter >= play->sync_point && + capt->counter >= play->sync_point) { + snd_pcm_sframes_t diff, lat = get_whole_latency(loop); + diff = ((double)(((double)play->total_queued * play->pitch) + + ((double)capt->total_queued * capt->pitch)) / + (double)loop->total_queued_count) - lat; + /* FIXME: this algorithm may be slightly better */ + if (verbose > 3) + snd_output_printf(loop->output, "%s: sync diff %li old diff %li\n", loop->id, diff, loop->pitch_diff); + if (diff > 0) { + if (diff == loop->pitch_diff) + loop->pitch += loop->pitch_delta; + else if (diff > loop->pitch_diff) + loop->pitch += loop->pitch_delta*2; + } else if (diff < 0) { + if (diff == loop->pitch_diff) + loop->pitch -= loop->pitch_delta; + else if (diff < loop->pitch_diff) + loop->pitch -= loop->pitch_delta*2; + } + loop->pitch_diff = diff; + if (loop->pitch_diff_min > diff) + loop->pitch_diff_min = diff; + if (loop->pitch_diff_max < diff) + loop->pitch_diff_max = diff; + update_pitch(loop); + play->counter -= play->sync_point; + capt->counter -= play->sync_point; + play->total_queued = 0; + capt->total_queued = 0; + loop->total_queued_count = 0; + } + if (loop->sync != SYNC_TYPE_NONE) { + snd_pcm_sframes_t pqueued, cqueued; + + /* Reduce cumulative error by interleaving playback vs capture reading order */ + if (loop->total_queued_count & 1) { + pqueued = get_queued_playback_samples(loop); + cqueued = get_queued_capture_samples(loop); + } else { + cqueued = get_queued_capture_samples(loop); + pqueued = get_queued_playback_samples(loop); + } + + if (verbose > 4) + snd_output_printf(loop->output, "%s: queued %li/%li samples\n", loop->id, pqueued, cqueued); + if (pqueued > 0) + play->total_queued += pqueued; + if (cqueued > 0) + capt->total_queued += cqueued; + if (pqueued > 0 || cqueued > 0) + loop->total_queued_count += 1; + } + if (verbose > 12) { + snd_pcm_sframes_t pdelay, cdelay; + if ((err = snd_pcm_delay(play->handle, &pdelay)) < 0) + snd_output_printf(loop->output, "%s: end delay error: %s / %li / %li\n", play->id, snd_strerror(err), play->buf_size, play->buf_count); + else + snd_output_printf(loop->output, "%s: end delay %li / %li / %li\n", play->id, pdelay, play->buf_size, play->buf_count); + if ((err = snd_pcm_delay(capt->handle, &cdelay)) < 0) + snd_output_printf(loop->output, "%s: end delay error: %s / %li / %li\n", capt->id, snd_strerror(err), capt->buf_size, capt->buf_count); + else + snd_output_printf(loop->output, "%s: end delay %li / %li / %li\n", capt->id, cdelay, capt->buf_size, capt->buf_count); + } + __pcm_end: + if (verbose > 13 || loop->xrun) { + long diff; + getcurtimestamp(&loop->tstamp_end); + diff = timediff(loop->tstamp_end, loop->tstamp_start); + if (verbose > 13) + snd_output_printf(loop->output, "%s: processing time %lius\n", loop->id, diff); + if (loop->xrun && loop->xrun_max_proctime < diff) + loop->xrun_max_proctime = diff; + } + return 0; +} + +#define OUT(args...) \ + snd_output_printf(loop->state, ##args) + +static pthread_mutex_t state_mutex = PTHREAD_MUTEX_INITIALIZER; + +static void show_handle(struct loopback_handle *lhandle, const char *id) +{ + struct loopback *loop = lhandle->loopback; + + OUT(" %s: %s:\n", id, lhandle->id); + OUT(" device = '%s', ctldev '%s'\n", lhandle->device, lhandle->ctldev); + OUT(" card_number = %i\n", lhandle->card_number); + if (!loop->running) + return; + OUT(" access = %s, format = %s, rate = %u, channels = %u\n", snd_pcm_access_name(lhandle->access), snd_pcm_format_name(lhandle->format), lhandle->rate, lhandle->channels); + OUT(" buffer_size = %u, period_size = %u, avail_min = %li\n", lhandle->buffer_size, lhandle->period_size, lhandle->avail_min); + OUT(" xrun_pending = %i\n", lhandle->xrun_pending); + OUT(" buf_size = %li, buf_pos = %li, buf_count = %li, buf_over = %li\n", lhandle->buf_size, lhandle->buf_pos, lhandle->buf_count, lhandle->buf_over); + OUT(" pitch = %.8f\n", lhandle->pitch); +} + +void pcmjob_state(struct loopback *loop) +{ + pthread_t self = pthread_self(); + pthread_mutex_lock(&state_mutex); + OUT("State dump for thread %p job %i: %s:\n", (void *)self, loop->thread, loop->id); + OUT(" running = %i\n", loop->running); + OUT(" sync = %i\n", loop->sync); + OUT(" slave = %i\n", loop->slave); + if (!loop->running) + goto __skip; + OUT(" pollfd_count = %i\n", loop->pollfd_count); + OUT(" pitch = %.8f, delta = %.8f, diff = %li, min = %li, max = %li\n", loop->pitch, loop->pitch_delta, loop->pitch_diff, loop->pitch_diff_min, loop->pitch_diff_max); + OUT(" use_samplerate = %i\n", loop->use_samplerate); + __skip: + show_handle(loop->play, "playback"); + show_handle(loop->capt, "capture"); + pthread_mutex_unlock(&state_mutex); +} diff --git a/alsamixer/Makefile.am b/alsamixer/Makefile.am new file mode 100644 index 0000000..14209d9 --- /dev/null +++ b/alsamixer/Makefile.am @@ -0,0 +1,30 @@ +AM_CFLAGS = -D_GNU_SOURCE @CURSES_CFLAGS@ -DCURSESINC="@CURSESINC@" +LDADD = @CURSESLIB@ + +bin_PROGRAMS = alsamixer +alsamixer_SOURCES = card_select.c card_select.h \ + bindings.c bindings.h \ + cli.c \ + colors.c colors.h \ + curskey.c curskey.h \ + configparser.c configparser.h \ + device_name.c device_name.h \ + die.c die.h \ + mainloop.c mainloop.h \ + mem.c mem.h \ + menu_widget.c menu_widget.h \ + mixer_clickable.c mixer_clickable.h \ + mixer_controls.c mixer_controls.h \ + mixer_display.c mixer_display.h \ + mixer_widget.c mixer_widget.h \ + proc_files.c proc_files.h \ + textbox.c textbox.h \ + utils.c utils.h \ + volume_mapping.c volume_mapping.h \ + widget.c widget.h +man_MANS = alsamixer.1 +EXTRA_DIST = alsamixer.1 +alsamixer_CPPFLAGS = -I$(top_srcdir)/include + +#LDFLAGS = -static +#CFLAGS += -g -Wall diff --git a/alsamixer/Makefile.in b/alsamixer/Makefile.in new file mode 100644 index 0000000..ba4c05d --- /dev/null +++ b/alsamixer/Makefile.in @@ -0,0 +1,1115 @@ +# Makefile.in generated by automake 1.16.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994-2018 Free Software Foundation, Inc. + +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +VPATH = @srcdir@ +am__is_gnu_make = { \ + if test -z '$(MAKELEVEL)'; then \ + false; \ + elif test -n '$(MAKE_HOST)'; then \ + true; \ + elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ + true; \ + else \ + false; \ + fi; \ +} +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + esac; \ + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +bin_PROGRAMS = alsamixer$(EXEEXT) +subdir = alsamixer +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/gettext.m4 \ + $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/lib-ld.m4 \ + $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ + $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \ + $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/acinclude.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/include/aconfig.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +am__installdirs = "$(DESTDIR)$(bindir)" "$(DESTDIR)$(man1dir)" +PROGRAMS = $(bin_PROGRAMS) +am_alsamixer_OBJECTS = alsamixer-card_select.$(OBJEXT) \ + alsamixer-bindings.$(OBJEXT) alsamixer-cli.$(OBJEXT) \ + alsamixer-colors.$(OBJEXT) alsamixer-curskey.$(OBJEXT) \ + alsamixer-configparser.$(OBJEXT) \ + alsamixer-device_name.$(OBJEXT) alsamixer-die.$(OBJEXT) \ + alsamixer-mainloop.$(OBJEXT) alsamixer-mem.$(OBJEXT) \ + alsamixer-menu_widget.$(OBJEXT) \ + alsamixer-mixer_clickable.$(OBJEXT) \ + alsamixer-mixer_controls.$(OBJEXT) \ + alsamixer-mixer_display.$(OBJEXT) \ + alsamixer-mixer_widget.$(OBJEXT) \ + alsamixer-proc_files.$(OBJEXT) alsamixer-textbox.$(OBJEXT) \ + alsamixer-utils.$(OBJEXT) alsamixer-volume_mapping.$(OBJEXT) \ + alsamixer-widget.$(OBJEXT) +alsamixer_OBJECTS = $(am_alsamixer_OBJECTS) +alsamixer_LDADD = $(LDADD) +alsamixer_DEPENDENCIES = +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__maybe_remake_depfiles = depfiles +am__depfiles_remade = ./$(DEPDIR)/alsamixer-bindings.Po \ + ./$(DEPDIR)/alsamixer-card_select.Po \ + ./$(DEPDIR)/alsamixer-cli.Po ./$(DEPDIR)/alsamixer-colors.Po \ + ./$(DEPDIR)/alsamixer-configparser.Po \ + ./$(DEPDIR)/alsamixer-curskey.Po \ + ./$(DEPDIR)/alsamixer-device_name.Po \ + ./$(DEPDIR)/alsamixer-die.Po ./$(DEPDIR)/alsamixer-mainloop.Po \ + ./$(DEPDIR)/alsamixer-mem.Po \ + ./$(DEPDIR)/alsamixer-menu_widget.Po \ + ./$(DEPDIR)/alsamixer-mixer_clickable.Po \ + ./$(DEPDIR)/alsamixer-mixer_controls.Po \ + ./$(DEPDIR)/alsamixer-mixer_display.Po \ + ./$(DEPDIR)/alsamixer-mixer_widget.Po \ + ./$(DEPDIR)/alsamixer-proc_files.Po \ + ./$(DEPDIR)/alsamixer-textbox.Po \ + ./$(DEPDIR)/alsamixer-utils.Po \ + ./$(DEPDIR)/alsamixer-volume_mapping.Po \ + ./$(DEPDIR)/alsamixer-widget.Po +am__mv = mv -f +AM_V_lt = $(am__v_lt_@AM_V@) +am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) +am__v_lt_0 = --silent +am__v_lt_1 = +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +AM_V_CC = $(am__v_CC_@AM_V@) +am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) +am__v_CC_0 = @echo " CC " $@; +am__v_CC_1 = +CCLD = $(CC) +LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_CCLD = $(am__v_CCLD_@AM_V@) +am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) +am__v_CCLD_0 = @echo " CCLD " $@; +am__v_CCLD_1 = +SOURCES = $(alsamixer_SOURCES) +DIST_SOURCES = $(alsamixer_SOURCES) +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; +am__vpath_adj = case $$p in \ + $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ + *) f=$$p;; \ + esac; +am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; +am__install_max = 40 +am__nobase_strip_setup = \ + srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` +am__nobase_strip = \ + for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" +am__nobase_list = $(am__nobase_strip_setup); \ + for p in $$list; do echo "$$p $$p"; done | \ + sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ + $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ + if (++n[$$2] == $(am__install_max)) \ + { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ + END { for (dir in files) print dir, files[dir] }' +am__base_list = \ + sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ + sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' +am__uninstall_files_from_dir = { \ + test -z "$$files" \ + || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ + || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ + $(am__cd) "$$dir" && rm -f $$files; }; \ + } +man1dir = $(mandir)/man1 +NROFF = nroff +MANS = $(man_MANS) +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) +# Read a list of newline-separated strings from the standard input, +# and print each of them once, without duplicates. Input order is +# *not* preserved. +am__uniquify_input = $(AWK) '\ + BEGIN { nonempty = 0; } \ + { items[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in items) print i; }; } \ +' +# Make sure the list of sources is unique. This is necessary because, +# e.g., the same source file might be shared among _SOURCES variables +# for different programs/libraries. +am__define_uniq_tagged_files = \ + list='$(am__tagged_files)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | $(am__uniquify_input)` +ETAGS = etags +CTAGS = ctags +am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/depcomp +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +ALSACTL_DAEMONSWITCH = @ALSACTL_DAEMONSWITCH@ +ALSACTL_PIDFILE_DIR = @ALSACTL_PIDFILE_DIR@ +ALSA_CFLAGS = @ALSA_CFLAGS@ +ALSA_LIBS = @ALSA_LIBS@ +ALSA_TOPOLOGY_LIBS = @ALSA_TOPOLOGY_LIBS@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +ASOUND_LOCK_DIR = @ASOUND_LOCK_DIR@ +ASOUND_STATE_DIR = @ASOUND_STATE_DIR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CURSESINC = @CURSESINC@ +CURSESLIB = @CURSESLIB@ +CURSES_CFLAGS = @CURSES_CFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +FFTW_CFLAGS = @FFTW_CFLAGS@ +FFTW_INC = @FFTW_INC@ +FFTW_LIB = @FFTW_LIB@ +GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ +GMSGFMT = @GMSGFMT@ +GMSGFMT_015 = @GMSGFMT_015@ +GREP = @GREP@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +INTLLIBS = @INTLLIBS@ +INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@ +LDFLAGS = @LDFLAGS@ +LIBICONV = @LIBICONV@ +LIBINTL = @LIBINTL@ +LIBOBJS = @LIBOBJS@ +LIBRT = @LIBRT@ +LIBS = @LIBS@ +LN_S = @LN_S@ +LTLIBICONV = @LTLIBICONV@ +LTLIBINTL = @LTLIBINTL@ +LTLIBOBJS = @LTLIBOBJS@ +MAINT = @MAINT@ +MAKEINFO = @MAKEINFO@ +MKDIR_P = @MKDIR_P@ +MSGFMT = @MSGFMT@ +MSGFMT_015 = @MSGFMT_015@ +MSGMERGE = @MSGMERGE@ +NCURSESW_CFLAGS = @NCURSESW_CFLAGS@ +NCURSESW_LIBS = @NCURSESW_LIBS@ +NCURSES_CFLAGS = @NCURSES_CFLAGS@ +NCURSES_LIBS = @NCURSES_LIBS@ +OBJEXT = @OBJEXT@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ +POSUB = @POSUB@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +SND_UTIL_MAJOR = @SND_UTIL_MAJOR@ +SND_UTIL_MINOR = @SND_UTIL_MINOR@ +SND_UTIL_SUBMINOR = @SND_UTIL_SUBMINOR@ +SND_UTIL_VERSION = @SND_UTIL_VERSION@ +STRIP = @STRIP@ +SYSTEMD_CFLAGS = @SYSTEMD_CFLAGS@ +SYSTEMD_LIBS = @SYSTEMD_LIBS@ +TESTSOUND = @TESTSOUND@ +USE_NLS = @USE_NLS@ +VERSION = @VERSION@ +XGETTEXT = @XGETTEXT@ +XGETTEXT_015 = @XGETTEXT_015@ +XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_CC = @ac_ct_CC@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +mydatadir = @mydatadir@ +ncurses5_config = @ncurses5_config@ +ncursesw5_config = @ncursesw5_config@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +rst2man_available = @rst2man_available@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +systemdsystemunitdir = @systemdsystemunitdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +udevrulesdir = @udevrulesdir@ +xmlto_available = @xmlto_available@ +AM_CFLAGS = -D_GNU_SOURCE @CURSES_CFLAGS@ -DCURSESINC="@CURSESINC@" +LDADD = @CURSESLIB@ +alsamixer_SOURCES = card_select.c card_select.h \ + bindings.c bindings.h \ + cli.c \ + colors.c colors.h \ + curskey.c curskey.h \ + configparser.c configparser.h \ + device_name.c device_name.h \ + die.c die.h \ + mainloop.c mainloop.h \ + mem.c mem.h \ + menu_widget.c menu_widget.h \ + mixer_clickable.c mixer_clickable.h \ + mixer_controls.c mixer_controls.h \ + mixer_display.c mixer_display.h \ + mixer_widget.c mixer_widget.h \ + proc_files.c proc_files.h \ + textbox.c textbox.h \ + utils.c utils.h \ + volume_mapping.c volume_mapping.h \ + widget.c widget.h + +man_MANS = alsamixer.1 +EXTRA_DIST = alsamixer.1 +alsamixer_CPPFLAGS = -I$(top_srcdir)/include +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .o .obj +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign alsamixer/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --foreign alsamixer/Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): +install-binPROGRAMS: $(bin_PROGRAMS) + @$(NORMAL_INSTALL) + @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(bindir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(bindir)" || exit 1; \ + fi; \ + for p in $$list; do echo "$$p $$p"; done | \ + sed 's/$(EXEEXT)$$//' | \ + while read p p1; do if test -f $$p \ + ; then echo "$$p"; echo "$$p"; else :; fi; \ + done | \ + sed -e 'p;s,.*/,,;n;h' \ + -e 's|.*|.|' \ + -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \ + sed 'N;N;N;s,\n, ,g' | \ + $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \ + { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \ + if ($$2 == $$4) files[d] = files[d] " " $$1; \ + else { print "f", $$3 "/" $$4, $$1; } } \ + END { for (d in files) print "f", d, files[d] }' | \ + while read type dir files; do \ + if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \ + test -z "$$files" || { \ + echo " $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(bindir)$$dir'"; \ + $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \ + } \ + ; done + +uninstall-binPROGRAMS: + @$(NORMAL_UNINSTALL) + @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ + files=`for p in $$list; do echo "$$p"; done | \ + sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \ + -e 's/$$/$(EXEEXT)/' \ + `; \ + test -n "$$list" || exit 0; \ + echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \ + cd "$(DESTDIR)$(bindir)" && rm -f $$files + +clean-binPROGRAMS: + -test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS) + +alsamixer$(EXEEXT): $(alsamixer_OBJECTS) $(alsamixer_DEPENDENCIES) $(EXTRA_alsamixer_DEPENDENCIES) + @rm -f alsamixer$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(alsamixer_OBJECTS) $(alsamixer_LDADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/alsamixer-bindings.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/alsamixer-card_select.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/alsamixer-cli.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/alsamixer-colors.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/alsamixer-configparser.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/alsamixer-curskey.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/alsamixer-device_name.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/alsamixer-die.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/alsamixer-mainloop.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/alsamixer-mem.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/alsamixer-menu_widget.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/alsamixer-mixer_clickable.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/alsamixer-mixer_controls.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/alsamixer-mixer_display.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/alsamixer-mixer_widget.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/alsamixer-proc_files.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/alsamixer-textbox.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/alsamixer-utils.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/alsamixer-volume_mapping.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/alsamixer-widget.Po@am__quote@ # am--include-marker + +$(am__depfiles_remade): + @$(MKDIR_P) $(@D) + @echo '# dummy' >$@-t && $(am__mv) $@-t $@ + +am--depfiles: $(am__depfiles_remade) + +.c.o: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< + +.c.obj: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` + +alsamixer-card_select.o: card_select.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(alsamixer_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT alsamixer-card_select.o -MD -MP -MF $(DEPDIR)/alsamixer-card_select.Tpo -c -o alsamixer-card_select.o `test -f 'card_select.c' || echo '$(srcdir)/'`card_select.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/alsamixer-card_select.Tpo $(DEPDIR)/alsamixer-card_select.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='card_select.c' object='alsamixer-card_select.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(alsamixer_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o alsamixer-card_select.o `test -f 'card_select.c' || echo '$(srcdir)/'`card_select.c + +alsamixer-card_select.obj: card_select.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(alsamixer_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT alsamixer-card_select.obj -MD -MP -MF $(DEPDIR)/alsamixer-card_select.Tpo -c -o alsamixer-card_select.obj `if test -f 'card_select.c'; then $(CYGPATH_W) 'card_select.c'; else $(CYGPATH_W) '$(srcdir)/card_select.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/alsamixer-card_select.Tpo $(DEPDIR)/alsamixer-card_select.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='card_select.c' object='alsamixer-card_select.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(alsamixer_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o alsamixer-card_select.obj `if test -f 'card_select.c'; then $(CYGPATH_W) 'card_select.c'; else $(CYGPATH_W) '$(srcdir)/card_select.c'; fi` + +alsamixer-bindings.o: bindings.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(alsamixer_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT alsamixer-bindings.o -MD -MP -MF $(DEPDIR)/alsamixer-bindings.Tpo -c -o alsamixer-bindings.o `test -f 'bindings.c' || echo '$(srcdir)/'`bindings.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/alsamixer-bindings.Tpo $(DEPDIR)/alsamixer-bindings.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='bindings.c' object='alsamixer-bindings.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(alsamixer_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o alsamixer-bindings.o `test -f 'bindings.c' || echo '$(srcdir)/'`bindings.c + +alsamixer-bindings.obj: bindings.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(alsamixer_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT alsamixer-bindings.obj -MD -MP -MF $(DEPDIR)/alsamixer-bindings.Tpo -c -o alsamixer-bindings.obj `if test -f 'bindings.c'; then $(CYGPATH_W) 'bindings.c'; else $(CYGPATH_W) '$(srcdir)/bindings.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/alsamixer-bindings.Tpo $(DEPDIR)/alsamixer-bindings.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='bindings.c' object='alsamixer-bindings.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(alsamixer_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o alsamixer-bindings.obj `if test -f 'bindings.c'; then $(CYGPATH_W) 'bindings.c'; else $(CYGPATH_W) '$(srcdir)/bindings.c'; fi` + +alsamixer-cli.o: cli.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(alsamixer_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT alsamixer-cli.o -MD -MP -MF $(DEPDIR)/alsamixer-cli.Tpo -c -o alsamixer-cli.o `test -f 'cli.c' || echo '$(srcdir)/'`cli.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/alsamixer-cli.Tpo $(DEPDIR)/alsamixer-cli.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='cli.c' object='alsamixer-cli.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(alsamixer_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o alsamixer-cli.o `test -f 'cli.c' || echo '$(srcdir)/'`cli.c + +alsamixer-cli.obj: cli.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(alsamixer_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT alsamixer-cli.obj -MD -MP -MF $(DEPDIR)/alsamixer-cli.Tpo -c -o alsamixer-cli.obj `if test -f 'cli.c'; then $(CYGPATH_W) 'cli.c'; else $(CYGPATH_W) '$(srcdir)/cli.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/alsamixer-cli.Tpo $(DEPDIR)/alsamixer-cli.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='cli.c' object='alsamixer-cli.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(alsamixer_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o alsamixer-cli.obj `if test -f 'cli.c'; then $(CYGPATH_W) 'cli.c'; else $(CYGPATH_W) '$(srcdir)/cli.c'; fi` + +alsamixer-colors.o: colors.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(alsamixer_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT alsamixer-colors.o -MD -MP -MF $(DEPDIR)/alsamixer-colors.Tpo -c -o alsamixer-colors.o `test -f 'colors.c' || echo '$(srcdir)/'`colors.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/alsamixer-colors.Tpo $(DEPDIR)/alsamixer-colors.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='colors.c' object='alsamixer-colors.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(alsamixer_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o alsamixer-colors.o `test -f 'colors.c' || echo '$(srcdir)/'`colors.c + +alsamixer-colors.obj: colors.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(alsamixer_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT alsamixer-colors.obj -MD -MP -MF $(DEPDIR)/alsamixer-colors.Tpo -c -o alsamixer-colors.obj `if test -f 'colors.c'; then $(CYGPATH_W) 'colors.c'; else $(CYGPATH_W) '$(srcdir)/colors.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/alsamixer-colors.Tpo $(DEPDIR)/alsamixer-colors.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='colors.c' object='alsamixer-colors.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(alsamixer_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o alsamixer-colors.obj `if test -f 'colors.c'; then $(CYGPATH_W) 'colors.c'; else $(CYGPATH_W) '$(srcdir)/colors.c'; fi` + +alsamixer-curskey.o: curskey.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(alsamixer_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT alsamixer-curskey.o -MD -MP -MF $(DEPDIR)/alsamixer-curskey.Tpo -c -o alsamixer-curskey.o `test -f 'curskey.c' || echo '$(srcdir)/'`curskey.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/alsamixer-curskey.Tpo $(DEPDIR)/alsamixer-curskey.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='curskey.c' object='alsamixer-curskey.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(alsamixer_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o alsamixer-curskey.o `test -f 'curskey.c' || echo '$(srcdir)/'`curskey.c + +alsamixer-curskey.obj: curskey.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(alsamixer_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT alsamixer-curskey.obj -MD -MP -MF $(DEPDIR)/alsamixer-curskey.Tpo -c -o alsamixer-curskey.obj `if test -f 'curskey.c'; then $(CYGPATH_W) 'curskey.c'; else $(CYGPATH_W) '$(srcdir)/curskey.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/alsamixer-curskey.Tpo $(DEPDIR)/alsamixer-curskey.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='curskey.c' object='alsamixer-curskey.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(alsamixer_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o alsamixer-curskey.obj `if test -f 'curskey.c'; then $(CYGPATH_W) 'curskey.c'; else $(CYGPATH_W) '$(srcdir)/curskey.c'; fi` + +alsamixer-configparser.o: configparser.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(alsamixer_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT alsamixer-configparser.o -MD -MP -MF $(DEPDIR)/alsamixer-configparser.Tpo -c -o alsamixer-configparser.o `test -f 'configparser.c' || echo '$(srcdir)/'`configparser.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/alsamixer-configparser.Tpo $(DEPDIR)/alsamixer-configparser.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='configparser.c' object='alsamixer-configparser.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(alsamixer_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o alsamixer-configparser.o `test -f 'configparser.c' || echo '$(srcdir)/'`configparser.c + +alsamixer-configparser.obj: configparser.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(alsamixer_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT alsamixer-configparser.obj -MD -MP -MF $(DEPDIR)/alsamixer-configparser.Tpo -c -o alsamixer-configparser.obj `if test -f 'configparser.c'; then $(CYGPATH_W) 'configparser.c'; else $(CYGPATH_W) '$(srcdir)/configparser.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/alsamixer-configparser.Tpo $(DEPDIR)/alsamixer-configparser.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='configparser.c' object='alsamixer-configparser.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(alsamixer_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o alsamixer-configparser.obj `if test -f 'configparser.c'; then $(CYGPATH_W) 'configparser.c'; else $(CYGPATH_W) '$(srcdir)/configparser.c'; fi` + +alsamixer-device_name.o: device_name.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(alsamixer_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT alsamixer-device_name.o -MD -MP -MF $(DEPDIR)/alsamixer-device_name.Tpo -c -o alsamixer-device_name.o `test -f 'device_name.c' || echo '$(srcdir)/'`device_name.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/alsamixer-device_name.Tpo $(DEPDIR)/alsamixer-device_name.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='device_name.c' object='alsamixer-device_name.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(alsamixer_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o alsamixer-device_name.o `test -f 'device_name.c' || echo '$(srcdir)/'`device_name.c + +alsamixer-device_name.obj: device_name.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(alsamixer_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT alsamixer-device_name.obj -MD -MP -MF $(DEPDIR)/alsamixer-device_name.Tpo -c -o alsamixer-device_name.obj `if test -f 'device_name.c'; then $(CYGPATH_W) 'device_name.c'; else $(CYGPATH_W) '$(srcdir)/device_name.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/alsamixer-device_name.Tpo $(DEPDIR)/alsamixer-device_name.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='device_name.c' object='alsamixer-device_name.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(alsamixer_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o alsamixer-device_name.obj `if test -f 'device_name.c'; then $(CYGPATH_W) 'device_name.c'; else $(CYGPATH_W) '$(srcdir)/device_name.c'; fi` + +alsamixer-die.o: die.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(alsamixer_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT alsamixer-die.o -MD -MP -MF $(DEPDIR)/alsamixer-die.Tpo -c -o alsamixer-die.o `test -f 'die.c' || echo '$(srcdir)/'`die.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/alsamixer-die.Tpo $(DEPDIR)/alsamixer-die.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='die.c' object='alsamixer-die.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(alsamixer_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o alsamixer-die.o `test -f 'die.c' || echo '$(srcdir)/'`die.c + +alsamixer-die.obj: die.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(alsamixer_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT alsamixer-die.obj -MD -MP -MF $(DEPDIR)/alsamixer-die.Tpo -c -o alsamixer-die.obj `if test -f 'die.c'; then $(CYGPATH_W) 'die.c'; else $(CYGPATH_W) '$(srcdir)/die.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/alsamixer-die.Tpo $(DEPDIR)/alsamixer-die.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='die.c' object='alsamixer-die.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(alsamixer_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o alsamixer-die.obj `if test -f 'die.c'; then $(CYGPATH_W) 'die.c'; else $(CYGPATH_W) '$(srcdir)/die.c'; fi` + +alsamixer-mainloop.o: mainloop.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(alsamixer_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT alsamixer-mainloop.o -MD -MP -MF $(DEPDIR)/alsamixer-mainloop.Tpo -c -o alsamixer-mainloop.o `test -f 'mainloop.c' || echo '$(srcdir)/'`mainloop.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/alsamixer-mainloop.Tpo $(DEPDIR)/alsamixer-mainloop.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='mainloop.c' object='alsamixer-mainloop.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(alsamixer_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o alsamixer-mainloop.o `test -f 'mainloop.c' || echo '$(srcdir)/'`mainloop.c + +alsamixer-mainloop.obj: mainloop.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(alsamixer_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT alsamixer-mainloop.obj -MD -MP -MF $(DEPDIR)/alsamixer-mainloop.Tpo -c -o alsamixer-mainloop.obj `if test -f 'mainloop.c'; then $(CYGPATH_W) 'mainloop.c'; else $(CYGPATH_W) '$(srcdir)/mainloop.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/alsamixer-mainloop.Tpo $(DEPDIR)/alsamixer-mainloop.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='mainloop.c' object='alsamixer-mainloop.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(alsamixer_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o alsamixer-mainloop.obj `if test -f 'mainloop.c'; then $(CYGPATH_W) 'mainloop.c'; else $(CYGPATH_W) '$(srcdir)/mainloop.c'; fi` + +alsamixer-mem.o: mem.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(alsamixer_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT alsamixer-mem.o -MD -MP -MF $(DEPDIR)/alsamixer-mem.Tpo -c -o alsamixer-mem.o `test -f 'mem.c' || echo '$(srcdir)/'`mem.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/alsamixer-mem.Tpo $(DEPDIR)/alsamixer-mem.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='mem.c' object='alsamixer-mem.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(alsamixer_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o alsamixer-mem.o `test -f 'mem.c' || echo '$(srcdir)/'`mem.c + +alsamixer-mem.obj: mem.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(alsamixer_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT alsamixer-mem.obj -MD -MP -MF $(DEPDIR)/alsamixer-mem.Tpo -c -o alsamixer-mem.obj `if test -f 'mem.c'; then $(CYGPATH_W) 'mem.c'; else $(CYGPATH_W) '$(srcdir)/mem.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/alsamixer-mem.Tpo $(DEPDIR)/alsamixer-mem.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='mem.c' object='alsamixer-mem.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(alsamixer_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o alsamixer-mem.obj `if test -f 'mem.c'; then $(CYGPATH_W) 'mem.c'; else $(CYGPATH_W) '$(srcdir)/mem.c'; fi` + +alsamixer-menu_widget.o: menu_widget.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(alsamixer_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT alsamixer-menu_widget.o -MD -MP -MF $(DEPDIR)/alsamixer-menu_widget.Tpo -c -o alsamixer-menu_widget.o `test -f 'menu_widget.c' || echo '$(srcdir)/'`menu_widget.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/alsamixer-menu_widget.Tpo $(DEPDIR)/alsamixer-menu_widget.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='menu_widget.c' object='alsamixer-menu_widget.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(alsamixer_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o alsamixer-menu_widget.o `test -f 'menu_widget.c' || echo '$(srcdir)/'`menu_widget.c + +alsamixer-menu_widget.obj: menu_widget.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(alsamixer_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT alsamixer-menu_widget.obj -MD -MP -MF $(DEPDIR)/alsamixer-menu_widget.Tpo -c -o alsamixer-menu_widget.obj `if test -f 'menu_widget.c'; then $(CYGPATH_W) 'menu_widget.c'; else $(CYGPATH_W) '$(srcdir)/menu_widget.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/alsamixer-menu_widget.Tpo $(DEPDIR)/alsamixer-menu_widget.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='menu_widget.c' object='alsamixer-menu_widget.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(alsamixer_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o alsamixer-menu_widget.obj `if test -f 'menu_widget.c'; then $(CYGPATH_W) 'menu_widget.c'; else $(CYGPATH_W) '$(srcdir)/menu_widget.c'; fi` + +alsamixer-mixer_clickable.o: mixer_clickable.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(alsamixer_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT alsamixer-mixer_clickable.o -MD -MP -MF $(DEPDIR)/alsamixer-mixer_clickable.Tpo -c -o alsamixer-mixer_clickable.o `test -f 'mixer_clickable.c' || echo '$(srcdir)/'`mixer_clickable.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/alsamixer-mixer_clickable.Tpo $(DEPDIR)/alsamixer-mixer_clickable.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='mixer_clickable.c' object='alsamixer-mixer_clickable.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(alsamixer_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o alsamixer-mixer_clickable.o `test -f 'mixer_clickable.c' || echo '$(srcdir)/'`mixer_clickable.c + +alsamixer-mixer_clickable.obj: mixer_clickable.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(alsamixer_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT alsamixer-mixer_clickable.obj -MD -MP -MF $(DEPDIR)/alsamixer-mixer_clickable.Tpo -c -o alsamixer-mixer_clickable.obj `if test -f 'mixer_clickable.c'; then $(CYGPATH_W) 'mixer_clickable.c'; else $(CYGPATH_W) '$(srcdir)/mixer_clickable.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/alsamixer-mixer_clickable.Tpo $(DEPDIR)/alsamixer-mixer_clickable.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='mixer_clickable.c' object='alsamixer-mixer_clickable.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(alsamixer_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o alsamixer-mixer_clickable.obj `if test -f 'mixer_clickable.c'; then $(CYGPATH_W) 'mixer_clickable.c'; else $(CYGPATH_W) '$(srcdir)/mixer_clickable.c'; fi` + +alsamixer-mixer_controls.o: mixer_controls.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(alsamixer_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT alsamixer-mixer_controls.o -MD -MP -MF $(DEPDIR)/alsamixer-mixer_controls.Tpo -c -o alsamixer-mixer_controls.o `test -f 'mixer_controls.c' || echo '$(srcdir)/'`mixer_controls.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/alsamixer-mixer_controls.Tpo $(DEPDIR)/alsamixer-mixer_controls.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='mixer_controls.c' object='alsamixer-mixer_controls.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(alsamixer_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o alsamixer-mixer_controls.o `test -f 'mixer_controls.c' || echo '$(srcdir)/'`mixer_controls.c + +alsamixer-mixer_controls.obj: mixer_controls.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(alsamixer_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT alsamixer-mixer_controls.obj -MD -MP -MF $(DEPDIR)/alsamixer-mixer_controls.Tpo -c -o alsamixer-mixer_controls.obj `if test -f 'mixer_controls.c'; then $(CYGPATH_W) 'mixer_controls.c'; else $(CYGPATH_W) '$(srcdir)/mixer_controls.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/alsamixer-mixer_controls.Tpo $(DEPDIR)/alsamixer-mixer_controls.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='mixer_controls.c' object='alsamixer-mixer_controls.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(alsamixer_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o alsamixer-mixer_controls.obj `if test -f 'mixer_controls.c'; then $(CYGPATH_W) 'mixer_controls.c'; else $(CYGPATH_W) '$(srcdir)/mixer_controls.c'; fi` + +alsamixer-mixer_display.o: mixer_display.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(alsamixer_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT alsamixer-mixer_display.o -MD -MP -MF $(DEPDIR)/alsamixer-mixer_display.Tpo -c -o alsamixer-mixer_display.o `test -f 'mixer_display.c' || echo '$(srcdir)/'`mixer_display.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/alsamixer-mixer_display.Tpo $(DEPDIR)/alsamixer-mixer_display.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='mixer_display.c' object='alsamixer-mixer_display.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(alsamixer_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o alsamixer-mixer_display.o `test -f 'mixer_display.c' || echo '$(srcdir)/'`mixer_display.c + +alsamixer-mixer_display.obj: mixer_display.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(alsamixer_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT alsamixer-mixer_display.obj -MD -MP -MF $(DEPDIR)/alsamixer-mixer_display.Tpo -c -o alsamixer-mixer_display.obj `if test -f 'mixer_display.c'; then $(CYGPATH_W) 'mixer_display.c'; else $(CYGPATH_W) '$(srcdir)/mixer_display.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/alsamixer-mixer_display.Tpo $(DEPDIR)/alsamixer-mixer_display.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='mixer_display.c' object='alsamixer-mixer_display.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(alsamixer_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o alsamixer-mixer_display.obj `if test -f 'mixer_display.c'; then $(CYGPATH_W) 'mixer_display.c'; else $(CYGPATH_W) '$(srcdir)/mixer_display.c'; fi` + +alsamixer-mixer_widget.o: mixer_widget.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(alsamixer_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT alsamixer-mixer_widget.o -MD -MP -MF $(DEPDIR)/alsamixer-mixer_widget.Tpo -c -o alsamixer-mixer_widget.o `test -f 'mixer_widget.c' || echo '$(srcdir)/'`mixer_widget.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/alsamixer-mixer_widget.Tpo $(DEPDIR)/alsamixer-mixer_widget.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='mixer_widget.c' object='alsamixer-mixer_widget.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(alsamixer_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o alsamixer-mixer_widget.o `test -f 'mixer_widget.c' || echo '$(srcdir)/'`mixer_widget.c + +alsamixer-mixer_widget.obj: mixer_widget.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(alsamixer_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT alsamixer-mixer_widget.obj -MD -MP -MF $(DEPDIR)/alsamixer-mixer_widget.Tpo -c -o alsamixer-mixer_widget.obj `if test -f 'mixer_widget.c'; then $(CYGPATH_W) 'mixer_widget.c'; else $(CYGPATH_W) '$(srcdir)/mixer_widget.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/alsamixer-mixer_widget.Tpo $(DEPDIR)/alsamixer-mixer_widget.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='mixer_widget.c' object='alsamixer-mixer_widget.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(alsamixer_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o alsamixer-mixer_widget.obj `if test -f 'mixer_widget.c'; then $(CYGPATH_W) 'mixer_widget.c'; else $(CYGPATH_W) '$(srcdir)/mixer_widget.c'; fi` + +alsamixer-proc_files.o: proc_files.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(alsamixer_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT alsamixer-proc_files.o -MD -MP -MF $(DEPDIR)/alsamixer-proc_files.Tpo -c -o alsamixer-proc_files.o `test -f 'proc_files.c' || echo '$(srcdir)/'`proc_files.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/alsamixer-proc_files.Tpo $(DEPDIR)/alsamixer-proc_files.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='proc_files.c' object='alsamixer-proc_files.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(alsamixer_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o alsamixer-proc_files.o `test -f 'proc_files.c' || echo '$(srcdir)/'`proc_files.c + +alsamixer-proc_files.obj: proc_files.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(alsamixer_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT alsamixer-proc_files.obj -MD -MP -MF $(DEPDIR)/alsamixer-proc_files.Tpo -c -o alsamixer-proc_files.obj `if test -f 'proc_files.c'; then $(CYGPATH_W) 'proc_files.c'; else $(CYGPATH_W) '$(srcdir)/proc_files.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/alsamixer-proc_files.Tpo $(DEPDIR)/alsamixer-proc_files.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='proc_files.c' object='alsamixer-proc_files.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(alsamixer_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o alsamixer-proc_files.obj `if test -f 'proc_files.c'; then $(CYGPATH_W) 'proc_files.c'; else $(CYGPATH_W) '$(srcdir)/proc_files.c'; fi` + +alsamixer-textbox.o: textbox.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(alsamixer_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT alsamixer-textbox.o -MD -MP -MF $(DEPDIR)/alsamixer-textbox.Tpo -c -o alsamixer-textbox.o `test -f 'textbox.c' || echo '$(srcdir)/'`textbox.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/alsamixer-textbox.Tpo $(DEPDIR)/alsamixer-textbox.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='textbox.c' object='alsamixer-textbox.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(alsamixer_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o alsamixer-textbox.o `test -f 'textbox.c' || echo '$(srcdir)/'`textbox.c + +alsamixer-textbox.obj: textbox.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(alsamixer_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT alsamixer-textbox.obj -MD -MP -MF $(DEPDIR)/alsamixer-textbox.Tpo -c -o alsamixer-textbox.obj `if test -f 'textbox.c'; then $(CYGPATH_W) 'textbox.c'; else $(CYGPATH_W) '$(srcdir)/textbox.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/alsamixer-textbox.Tpo $(DEPDIR)/alsamixer-textbox.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='textbox.c' object='alsamixer-textbox.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(alsamixer_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o alsamixer-textbox.obj `if test -f 'textbox.c'; then $(CYGPATH_W) 'textbox.c'; else $(CYGPATH_W) '$(srcdir)/textbox.c'; fi` + +alsamixer-utils.o: utils.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(alsamixer_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT alsamixer-utils.o -MD -MP -MF $(DEPDIR)/alsamixer-utils.Tpo -c -o alsamixer-utils.o `test -f 'utils.c' || echo '$(srcdir)/'`utils.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/alsamixer-utils.Tpo $(DEPDIR)/alsamixer-utils.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='utils.c' object='alsamixer-utils.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(alsamixer_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o alsamixer-utils.o `test -f 'utils.c' || echo '$(srcdir)/'`utils.c + +alsamixer-utils.obj: utils.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(alsamixer_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT alsamixer-utils.obj -MD -MP -MF $(DEPDIR)/alsamixer-utils.Tpo -c -o alsamixer-utils.obj `if test -f 'utils.c'; then $(CYGPATH_W) 'utils.c'; else $(CYGPATH_W) '$(srcdir)/utils.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/alsamixer-utils.Tpo $(DEPDIR)/alsamixer-utils.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='utils.c' object='alsamixer-utils.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(alsamixer_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o alsamixer-utils.obj `if test -f 'utils.c'; then $(CYGPATH_W) 'utils.c'; else $(CYGPATH_W) '$(srcdir)/utils.c'; fi` + +alsamixer-volume_mapping.o: volume_mapping.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(alsamixer_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT alsamixer-volume_mapping.o -MD -MP -MF $(DEPDIR)/alsamixer-volume_mapping.Tpo -c -o alsamixer-volume_mapping.o `test -f 'volume_mapping.c' || echo '$(srcdir)/'`volume_mapping.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/alsamixer-volume_mapping.Tpo $(DEPDIR)/alsamixer-volume_mapping.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='volume_mapping.c' object='alsamixer-volume_mapping.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(alsamixer_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o alsamixer-volume_mapping.o `test -f 'volume_mapping.c' || echo '$(srcdir)/'`volume_mapping.c + +alsamixer-volume_mapping.obj: volume_mapping.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(alsamixer_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT alsamixer-volume_mapping.obj -MD -MP -MF $(DEPDIR)/alsamixer-volume_mapping.Tpo -c -o alsamixer-volume_mapping.obj `if test -f 'volume_mapping.c'; then $(CYGPATH_W) 'volume_mapping.c'; else $(CYGPATH_W) '$(srcdir)/volume_mapping.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/alsamixer-volume_mapping.Tpo $(DEPDIR)/alsamixer-volume_mapping.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='volume_mapping.c' object='alsamixer-volume_mapping.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(alsamixer_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o alsamixer-volume_mapping.obj `if test -f 'volume_mapping.c'; then $(CYGPATH_W) 'volume_mapping.c'; else $(CYGPATH_W) '$(srcdir)/volume_mapping.c'; fi` + +alsamixer-widget.o: widget.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(alsamixer_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT alsamixer-widget.o -MD -MP -MF $(DEPDIR)/alsamixer-widget.Tpo -c -o alsamixer-widget.o `test -f 'widget.c' || echo '$(srcdir)/'`widget.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/alsamixer-widget.Tpo $(DEPDIR)/alsamixer-widget.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='widget.c' object='alsamixer-widget.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(alsamixer_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o alsamixer-widget.o `test -f 'widget.c' || echo '$(srcdir)/'`widget.c + +alsamixer-widget.obj: widget.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(alsamixer_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT alsamixer-widget.obj -MD -MP -MF $(DEPDIR)/alsamixer-widget.Tpo -c -o alsamixer-widget.obj `if test -f 'widget.c'; then $(CYGPATH_W) 'widget.c'; else $(CYGPATH_W) '$(srcdir)/widget.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/alsamixer-widget.Tpo $(DEPDIR)/alsamixer-widget.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='widget.c' object='alsamixer-widget.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(alsamixer_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o alsamixer-widget.obj `if test -f 'widget.c'; then $(CYGPATH_W) 'widget.c'; else $(CYGPATH_W) '$(srcdir)/widget.c'; fi` +install-man1: $(man_MANS) + @$(NORMAL_INSTALL) + @list1=''; \ + list2='$(man_MANS)'; \ + test -n "$(man1dir)" \ + && test -n "`echo $$list1$$list2`" \ + || exit 0; \ + echo " $(MKDIR_P) '$(DESTDIR)$(man1dir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(man1dir)" || exit 1; \ + { for i in $$list1; do echo "$$i"; done; \ + if test -n "$$list2"; then \ + for i in $$list2; do echo "$$i"; done \ + | sed -n '/\.1[a-z]*$$/p'; \ + fi; \ + } | while read p; do \ + if test -f $$p; then d=; else d="$(srcdir)/"; fi; \ + echo "$$d$$p"; echo "$$p"; \ + done | \ + sed -e 'n;s,.*/,,;p;h;s,.*\.,,;s,^[^1][0-9a-z]*$$,1,;x' \ + -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,' | \ + sed 'N;N;s,\n, ,g' | { \ + list=; while read file base inst; do \ + if test "$$base" = "$$inst"; then list="$$list $$file"; else \ + echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man1dir)/$$inst'"; \ + $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man1dir)/$$inst" || exit $$?; \ + fi; \ + done; \ + for i in $$list; do echo "$$i"; done | $(am__base_list) | \ + while read files; do \ + test -z "$$files" || { \ + echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(man1dir)'"; \ + $(INSTALL_DATA) $$files "$(DESTDIR)$(man1dir)" || exit $$?; }; \ + done; } + +uninstall-man1: + @$(NORMAL_UNINSTALL) + @list=''; test -n "$(man1dir)" || exit 0; \ + files=`{ for i in $$list; do echo "$$i"; done; \ + l2='$(man_MANS)'; for i in $$l2; do echo "$$i"; done | \ + sed -n '/\.1[a-z]*$$/p'; \ + } | sed -e 's,.*/,,;h;s,.*\.,,;s,^[^1][0-9a-z]*$$,1,;x' \ + -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,'`; \ + dir='$(DESTDIR)$(man1dir)'; $(am__uninstall_files_from_dir) + +ID: $(am__tagged_files) + $(am__define_uniq_tagged_files); mkid -fID $$unique +tags: tags-am +TAGS: tags + +tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + set x; \ + here=`pwd`; \ + $(am__define_uniq_tagged_files); \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: ctags-am + +CTAGS: ctags +ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + $(am__define_uniq_tagged_files); \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" +cscopelist: cscopelist-am + +cscopelist-am: $(am__tagged_files) + list='$(am__tagged_files)'; \ + case "$(srcdir)" in \ + [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ + *) sdir=$(subdir)/$(srcdir) ;; \ + esac; \ + for i in $$list; do \ + if test -f "$$i"; then \ + echo "$(subdir)/$$i"; \ + else \ + echo "$$sdir/$$i"; \ + fi; \ + done >> $(top_builddir)/cscope.files + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) distdir-am + +distdir-am: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(PROGRAMS) $(MANS) +installdirs: + for dir in "$(DESTDIR)$(bindir)" "$(DESTDIR)$(man1dir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ + done +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-binPROGRAMS clean-generic mostlyclean-am + +distclean: distclean-am + -rm -f ./$(DEPDIR)/alsamixer-bindings.Po + -rm -f ./$(DEPDIR)/alsamixer-card_select.Po + -rm -f ./$(DEPDIR)/alsamixer-cli.Po + -rm -f ./$(DEPDIR)/alsamixer-colors.Po + -rm -f ./$(DEPDIR)/alsamixer-configparser.Po + -rm -f ./$(DEPDIR)/alsamixer-curskey.Po + -rm -f ./$(DEPDIR)/alsamixer-device_name.Po + -rm -f ./$(DEPDIR)/alsamixer-die.Po + -rm -f ./$(DEPDIR)/alsamixer-mainloop.Po + -rm -f ./$(DEPDIR)/alsamixer-mem.Po + -rm -f ./$(DEPDIR)/alsamixer-menu_widget.Po + -rm -f ./$(DEPDIR)/alsamixer-mixer_clickable.Po + -rm -f ./$(DEPDIR)/alsamixer-mixer_controls.Po + -rm -f ./$(DEPDIR)/alsamixer-mixer_display.Po + -rm -f ./$(DEPDIR)/alsamixer-mixer_widget.Po + -rm -f ./$(DEPDIR)/alsamixer-proc_files.Po + -rm -f ./$(DEPDIR)/alsamixer-textbox.Po + -rm -f ./$(DEPDIR)/alsamixer-utils.Po + -rm -f ./$(DEPDIR)/alsamixer-volume_mapping.Po + -rm -f ./$(DEPDIR)/alsamixer-widget.Po + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: install-man + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: install-binPROGRAMS + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: install-man1 + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -f ./$(DEPDIR)/alsamixer-bindings.Po + -rm -f ./$(DEPDIR)/alsamixer-card_select.Po + -rm -f ./$(DEPDIR)/alsamixer-cli.Po + -rm -f ./$(DEPDIR)/alsamixer-colors.Po + -rm -f ./$(DEPDIR)/alsamixer-configparser.Po + -rm -f ./$(DEPDIR)/alsamixer-curskey.Po + -rm -f ./$(DEPDIR)/alsamixer-device_name.Po + -rm -f ./$(DEPDIR)/alsamixer-die.Po + -rm -f ./$(DEPDIR)/alsamixer-mainloop.Po + -rm -f ./$(DEPDIR)/alsamixer-mem.Po + -rm -f ./$(DEPDIR)/alsamixer-menu_widget.Po + -rm -f ./$(DEPDIR)/alsamixer-mixer_clickable.Po + -rm -f ./$(DEPDIR)/alsamixer-mixer_controls.Po + -rm -f ./$(DEPDIR)/alsamixer-mixer_display.Po + -rm -f ./$(DEPDIR)/alsamixer-mixer_widget.Po + -rm -f ./$(DEPDIR)/alsamixer-proc_files.Po + -rm -f ./$(DEPDIR)/alsamixer-textbox.Po + -rm -f ./$(DEPDIR)/alsamixer-utils.Po + -rm -f ./$(DEPDIR)/alsamixer-volume_mapping.Po + -rm -f ./$(DEPDIR)/alsamixer-widget.Po + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-binPROGRAMS uninstall-man + +uninstall-man: uninstall-man1 + +.MAKE: install-am install-strip + +.PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-am clean \ + clean-binPROGRAMS clean-generic cscopelist-am ctags ctags-am \ + distclean distclean-compile distclean-generic distclean-tags \ + distdir dvi dvi-am html html-am info info-am install \ + install-am install-binPROGRAMS install-data install-data-am \ + install-dvi install-dvi-am install-exec install-exec-am \ + install-html install-html-am install-info install-info-am \ + install-man install-man1 install-pdf install-pdf-am install-ps \ + install-ps-am install-strip installcheck installcheck-am \ + installdirs maintainer-clean maintainer-clean-generic \ + mostlyclean mostlyclean-compile mostlyclean-generic pdf pdf-am \ + ps ps-am tags tags-am uninstall uninstall-am \ + uninstall-binPROGRAMS uninstall-man uninstall-man1 + +.PRECIOUS: Makefile + + +#LDFLAGS = -static +#CFLAGS += -g -Wall + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/alsamixer/alsamixer.1 b/alsamixer/alsamixer.1 new file mode 100644 index 0000000..8d34680 --- /dev/null +++ b/alsamixer/alsamixer.1 @@ -0,0 +1,191 @@ +.TH ALSAMIXER 1 "22 May 2009" +.SH NAME +alsamixer \- soundcard mixer for ALSA soundcard driver, with ncurses interface +.SH SYNOPSIS + +\fBalsamixer\fP [\fIoptions\fP] + +.SH DESCRIPTION +\fBalsamixer\fP is an ncurses mixer program for use with the ALSA +soundcard drivers. It supports multiple soundcards with multiple devices. + +.SH OPTIONS + +.TP +\fI\-h, \-\-help\fP +Help: show available flags. + +.TP +\fI\-c, \-\-card\fP +Select the soundcard to use, if you have more than one. Cards are +numbered from 0 (the default). + +.TP +\fI\-D, \-\-device\fP +Select the mixer device to control. + +.TP +\fI\-V, \-\-view\fP +Select the starting view mode, either \fIplayback\fP, \fIcapture\fP or \fIall\fP. + +.TP +\fI\-g, \-\-no\-color\fP +Toggle the using of colors. + +.SH MIXER VIEWS + +The top-left corner of \fBalsamixer\fP is the are to show some basic +information: the card name, the mixer chip name, the current view +mode and the currently selected mixer item. +When the mixer item is switched off, \fI[Off]\fP is displayed in its +name. + +Volume bars are located below the basic information area. You can +scroll left/right when all controls can't be put in a single screen. +The name of each control is shown in the bottom below the volume bars. +The currently selected item is drawn in red and/of emphasized. + +Each mixer control with volume capability shows a box and the current +volume filled in that box. The volume percentages are displayed below +the volume bar for left and right channels. For a mono control, only +one value is shown there. + +When a mixer control is turned off, \fIM\fP (mute) appears below the +volume bar. When it's turned on, \fIO\fP in green appears instead. +You can toggle the switch via \fIm\fP key. + +When a mixer control has capture capability, the capture flag appears +below the volume bar, too. When the capture is turned off, +\-\-\-\-\-\-\- is shown. \fICAPTURE\fP in red appears when the +capture switch is turned on. In addition, \fIL\fP and \fIR\fP letters +appear in left and right side to indicate that left and the right +channels are turned on. + +Some controls have the enumeration list, and don't show boxes but only +texts which indicate the currently active item. You can change the +item via up/down keys. + +.SH VIEW MODES +\fBalsamixer\fP has three view modes: playback, capture and all. +In the playback view, only the controls related with playback are shown. +Similarly, only the controls for capture (recording) are shown in the capture +view. The all view mode shows all controls. The current view mode is displayed +in the top-left position together with the mixer name, etc. + +The default view mode is the playback view. You can change it via +\fI-V\fP option. + +Each view mode can be switched via keyboard commands, too. +See the next section. + +.SH KEYBOARD COMMANDS +\fBalsamixer\fP recognizes the following keyboard commands to control the soundcard. +Commands shown here in upper case can also be given in lower case. +To be reminded of these keystrokes, hit the \fIh\fP key. + +.SS +General Controls + +The \fILeft\fP and \fIright arrow\fP keys are used to select the +channel (or device, depending on your preferred terminology). You can +also use \fIn\fP ("next") and \fIp\fP ("previous"). + +The \fIUp\fP and \fIDown Arrows\fP control the volume for the +currently selected device. You can also use \fI+\fP or \fI\-\fP for the +same purpose. Both the left and right signals are affected. For +independent left and right control, see below. + +The \fIB\fP or \fI=\fP key adjusts the balance of volumes on left and +right channels. + +\fIM\fP toggles muting for the current channel (both left and right). +If the hardware supports it, you can +mute left and right independently by using \fI,\fP (or \fI<\fP) and +\fI.\fP (or \fI>\fP) respectively. + +\fISPACE\fP enables recording for the current channel. If any other +channels have recording enabled, they will have their recording function +disabled first. This only works for valid input channels, of course. + +\fIL\fP re-draws the screen. + +.SS +View Mode Controls +Function keys are used to change view modes. +You can switch to the help mode and the proc info mode via \fIF1\fP and +\fIF2\fP keys, respectively. +On terminals that can't use function keys like gnome\-terminal, \fI?\fP and +\fI/\fP keys can be used alternatively for help and proc modes. + +\fIF3\fP, \fIF4\fP and \fIF5\fP keys are used to switch to playback, capture +and all view mode, respectively. \fITAB\fP key toggles the +current view mode circularly. + +.SS +Quick Volume Changes + +\fIPageUp\fP increases volume by 5. + +\fIPageDown\fP decreases volume by 5. + +\fIEnd\fP sets volume to 0. + +You can also control left & right levels for the current channel +independently, as follows: + +[\fIQ\fP | \fIW\fP | \fIE\fP ] -- turn UP [ left | both | right ] + +[\fIZ\fP | \fIX\fP | \fIC\fP ] -- turn DOWN [ left | both | right ] + +If the currently selected mixer channel is not a stereo channel, then +all UP keys will work like \fIW\fP, and all DOWN keys will work like \fIX\fP. + +The number keys from \fI0\fP to \fI9\fP are to change the absolute volume +quickly. They correspond to 0 to 90% volume. + +.SS +Selecting the Sound Card + +You can select another sound card by pressing the \fIF6\fP or \fIS\fP keys. +This will show a list of available sound cards to choose from, +and an entry to enter the mixer device name by hand. + +.SS +Exiting + +Quit the program with \fIALT Q\fP, or by hitting \fIESC\fP. +Please note that you might need to hit \fIESC\fP twice on some terminals +since it's regarded as a prefix key. + +.SH VOLUME MAPPING +In \fBalsamixer\fP, the volume is mapped to a value that is more natural +for a human ear. The mapping is designed so that the position in the +interval is proportional to the volume as a human ear would perceive +it, i.e. the position is the cubic root of the linear sample +multiplication factor. For controls with a small range (24 dB or +less), the mapping is linear in the dB values so that each step has +the same size visually. + +Only for controls without dB information, a linear mapping of the +hardware volume register values is used (this is the same algorithm as +used in the old \fBalsamixer\fP). + +.SH SEE ALSO +\fB +amixer(1), +aplay(1), +arecord(1) +\fP + +.SH BUGS +Some terminal emulators (e.g. \fBnxterm\fP) may not +work quite right with ncurses, but that's their own damn +fault. Plain old \fBxterm\fP seems to be fine. + +.SH AUTHOR +.B alsamixer +has been written by Tim Janik and +been further improved by Jaroslav Kysela +and Clemens Ladisch . + +This manual page was provided by Paul Winkler . diff --git a/alsamixer/bindings.c b/alsamixer/bindings.c new file mode 100644 index 0000000..4c8db18 --- /dev/null +++ b/alsamixer/bindings.c @@ -0,0 +1,132 @@ +#include "bindings.h" +#include "mixer_widget.h" + +#define CNTRL(C) (C%32) + +uint8_t textbox_bindings[KEY_MAX] = { + ['\n'] = CMD_TEXTBOX_CLOSE, + ['\r'] = CMD_TEXTBOX_CLOSE, + [27] = CMD_TEXTBOX_CLOSE, + [KEY_CANCEL] = CMD_TEXTBOX_CLOSE, + [KEY_ENTER] = CMD_TEXTBOX_CLOSE, + [KEY_CLOSE] = CMD_TEXTBOX_CLOSE, + [KEY_EXIT] = CMD_TEXTBOX_CLOSE, + [KEY_DOWN] = CMD_TEXTBOX_DOWN, + [KEY_SF] = CMD_TEXTBOX_DOWN, + ['J'] = CMD_TEXTBOX_DOWN, + ['j'] = CMD_TEXTBOX_DOWN, + ['X'] = CMD_TEXTBOX_DOWN, + ['x'] = CMD_TEXTBOX_DOWN, + [KEY_UP] = CMD_TEXTBOX_UP, + [KEY_SR] = CMD_TEXTBOX_UP, + ['K'] = CMD_TEXTBOX_UP, + ['k'] = CMD_TEXTBOX_UP, + ['W'] = CMD_TEXTBOX_UP, + ['w'] = CMD_TEXTBOX_UP, + [KEY_LEFT] = CMD_TEXTBOX_LEFT, + ['H'] = CMD_TEXTBOX_LEFT, + ['h'] = CMD_TEXTBOX_LEFT, + ['P'] = CMD_TEXTBOX_LEFT, + ['p'] = CMD_TEXTBOX_LEFT, + [KEY_RIGHT] = CMD_TEXTBOX_RIGHT, + ['L'] = CMD_TEXTBOX_RIGHT, + ['l'] = CMD_TEXTBOX_RIGHT, + ['N'] = CMD_TEXTBOX_RIGHT, + ['n'] = CMD_TEXTBOX_RIGHT, + [KEY_NPAGE] = CMD_TEXTBOX_PAGE_DOWN, + [' '] = CMD_TEXTBOX_PAGE_DOWN, + [KEY_PPAGE] = CMD_TEXTBOX_PAGE_UP, + [KEY_BACKSPACE] = CMD_TEXTBOX_PAGE_UP, + ['B'] = CMD_TEXTBOX_PAGE_UP, + ['b'] = CMD_TEXTBOX_PAGE_UP, + [KEY_HOME] = CMD_TEXTBOX_TOP, + [KEY_BEG] = CMD_TEXTBOX_TOP, + [KEY_LL] = CMD_TEXTBOX_BOTTOM, + [KEY_END] = CMD_TEXTBOX_BOTTOM, + ['\t'] = CMD_TEXTBOX_PAGE_RIGHT, + [KEY_BTAB] = CMD_TEXTBOX_PAGE_LEFT, +}; + +command_enum mixer_bindings[] = { + [27] = CMD_MIXER_CLOSE, + [KEY_CANCEL] = CMD_MIXER_CLOSE, + [KEY_F(10)] = CMD_MIXER_CLOSE, + [KEY_F(1)] = CMD_MIXER_HELP, + [KEY_HELP] = CMD_MIXER_HELP, + ['H'] = CMD_MIXER_HELP, + ['h'] = CMD_MIXER_HELP, + ['?'] = CMD_MIXER_HELP, + [KEY_F(2)] = CMD_MIXER_SYSTEM_INFORMATION, + ['/'] = CMD_MIXER_SYSTEM_INFORMATION, + [KEY_F(3)] = CMD_WITH_ARG(CMD_MIXER_SET_VIEW_MODE, VIEW_MODE_PLAYBACK), + [KEY_F(4)] = CMD_WITH_ARG(CMD_MIXER_SET_VIEW_MODE, VIEW_MODE_CAPTURE), + [KEY_F(5)] = CMD_WITH_ARG(CMD_MIXER_SET_VIEW_MODE, VIEW_MODE_ALL), + ['\t'] = CMD_MIXER_TOGGLE_VIEW_MODE, + [KEY_F(6)] = CMD_MIXER_SELECT_CARD, + ['S'] = CMD_MIXER_SELECT_CARD, + ['s'] = CMD_MIXER_SELECT_CARD, + [KEY_REFRESH] = CMD_MIXER_REFRESH, + [CNTRL('L')] = CMD_MIXER_REFRESH, + ['L'] = CMD_MIXER_REFRESH, + ['l'] = CMD_MIXER_REFRESH, + [KEY_LEFT] = CMD_WITH_ARG(CMD_MIXER_PREVIOUS, 1), + ['p'] = CMD_WITH_ARG(CMD_MIXER_PREVIOUS, 1), + ['P'] = CMD_WITH_ARG(CMD_MIXER_PREVIOUS, 1), + [KEY_RIGHT] = CMD_WITH_ARG(CMD_MIXER_NEXT, 1), + ['N'] = CMD_WITH_ARG(CMD_MIXER_NEXT, 1), + ['n'] = CMD_WITH_ARG(CMD_MIXER_NEXT, 1), + [KEY_PPAGE] = CMD_WITH_ARG(CMD_MIXER_CONTROL_UP, 5), + [KEY_NPAGE] = CMD_WITH_ARG(CMD_MIXER_CONTROL_DOWN, 5), + [KEY_LL] = CMD_WITH_ARG(CMD_MIXER_CONTROL_SET_PERCENT, 0), + [KEY_END] = CMD_WITH_ARG(CMD_MIXER_CONTROL_SET_PERCENT, 0), + ['0'] = CMD_WITH_ARG(CMD_MIXER_CONTROL_SET_PERCENT, 0), + ['1'] = CMD_WITH_ARG(CMD_MIXER_CONTROL_SET_PERCENT, 10), + ['2'] = CMD_WITH_ARG(CMD_MIXER_CONTROL_SET_PERCENT, 20), + ['3'] = CMD_WITH_ARG(CMD_MIXER_CONTROL_SET_PERCENT, 30), + ['4'] = CMD_WITH_ARG(CMD_MIXER_CONTROL_SET_PERCENT, 40), + ['5'] = CMD_WITH_ARG(CMD_MIXER_CONTROL_SET_PERCENT, 50), + ['6'] = CMD_WITH_ARG(CMD_MIXER_CONTROL_SET_PERCENT, 60), + ['7'] = CMD_WITH_ARG(CMD_MIXER_CONTROL_SET_PERCENT, 70), + ['8'] = CMD_WITH_ARG(CMD_MIXER_CONTROL_SET_PERCENT, 80), + ['9'] = CMD_WITH_ARG(CMD_MIXER_CONTROL_SET_PERCENT, 90), +#if 0 + [KEY_BEG] = CMD_WITH_ARG(CMD_MIXER_CONTROL_SET_PERCENT, 100), + [KEY_HELP] = CMD_WITH_ARG(CMD_MIXER_CONTROL_SET_PERCENT, 100), +#endif + [KEY_UP] = CMD_WITH_ARG(CMD_MIXER_CONTROL_UP, 1), + ['+'] = CMD_WITH_ARG(CMD_MIXER_CONTROL_UP, 1), + ['K'] = CMD_WITH_ARG(CMD_MIXER_CONTROL_UP, 1), + ['k'] = CMD_WITH_ARG(CMD_MIXER_CONTROL_UP, 1), + ['W'] = CMD_WITH_ARG(CMD_MIXER_CONTROL_UP, 1), + ['w'] = CMD_WITH_ARG(CMD_MIXER_CONTROL_UP, 1), + [KEY_DOWN] = CMD_WITH_ARG(CMD_MIXER_CONTROL_DOWN, 1), + ['-'] = CMD_WITH_ARG(CMD_MIXER_CONTROL_DOWN, 1), + ['J'] = CMD_WITH_ARG(CMD_MIXER_CONTROL_DOWN, 1), + ['j'] = CMD_WITH_ARG(CMD_MIXER_CONTROL_DOWN, 1), + ['X'] = CMD_WITH_ARG(CMD_MIXER_CONTROL_DOWN, 1), + ['x'] = CMD_WITH_ARG(CMD_MIXER_CONTROL_DOWN, 1), + ['Q'] = CMD_WITH_ARG(CMD_MIXER_CONTROL_UP_LEFT, 1), + ['q'] = CMD_WITH_ARG(CMD_MIXER_CONTROL_UP_LEFT, 1), + ['Y'] = CMD_WITH_ARG(CMD_MIXER_CONTROL_DOWN_LEFT, 1), + ['y'] = CMD_WITH_ARG(CMD_MIXER_CONTROL_DOWN_LEFT, 1), + ['Z'] = CMD_WITH_ARG(CMD_MIXER_CONTROL_DOWN_LEFT, 1), + ['z'] = CMD_WITH_ARG(CMD_MIXER_CONTROL_DOWN_LEFT, 1), + ['E'] = CMD_WITH_ARG(CMD_MIXER_CONTROL_UP_RIGHT, 1), + ['e'] = CMD_WITH_ARG(CMD_MIXER_CONTROL_UP_RIGHT, 1), + ['C'] = CMD_WITH_ARG(CMD_MIXER_CONTROL_DOWN_RIGHT, 1), + ['c'] = CMD_WITH_ARG(CMD_MIXER_CONTROL_DOWN_RIGHT, 1), + ['M'] = CMD_WITH_ARG(CMD_MIXER_TOGGLE_MUTE, LEFT|RIGHT), + ['m'] = CMD_WITH_ARG(CMD_MIXER_TOGGLE_MUTE, LEFT|RIGHT), + ['<'] = CMD_WITH_ARG(CMD_MIXER_TOGGLE_MUTE, LEFT), + [','] = CMD_WITH_ARG(CMD_MIXER_TOGGLE_MUTE, LEFT), + ['>'] = CMD_WITH_ARG(CMD_MIXER_TOGGLE_MUTE, RIGHT), + ['.'] = CMD_WITH_ARG(CMD_MIXER_TOGGLE_MUTE, RIGHT), + [' '] = CMD_WITH_ARG(CMD_MIXER_TOGGLE_CAPTURE, LEFT|RIGHT), + [KEY_IC] = CMD_WITH_ARG(CMD_MIXER_TOGGLE_CAPTURE, LEFT), + [';'] = CMD_WITH_ARG(CMD_MIXER_TOGGLE_CAPTURE, LEFT), + [KEY_DC] = CMD_WITH_ARG(CMD_MIXER_TOGGLE_CAPTURE, RIGHT), + ['\''] = CMD_WITH_ARG(CMD_MIXER_TOGGLE_CAPTURE, RIGHT), + ['B'] = CMD_MIXER_BALANCE_CONTROL, + ['b'] = CMD_MIXER_BALANCE_CONTROL, + ['='] = CMD_MIXER_BALANCE_CONTROL, +}; diff --git a/alsamixer/bindings.h b/alsamixer/bindings.h new file mode 100644 index 0000000..fa2e8d3 --- /dev/null +++ b/alsamixer/bindings.h @@ -0,0 +1,81 @@ +#ifndef BINDINGS_H_INCLUDED +#define BINDINGS_H_INCLUDED + +#include CURSESINC +#include +#include + +/* Commands are stored in an uint16_t and may take an unsigned numeric argument. + * The command itself is stored in the lower 7 bits, the argument is stored + * in the higher 9 bits. + * + * The value `0` is used for no (unbound) command. */ + +typedef uint16_t command_enum; +extern command_enum mixer_bindings[KEY_MAX]; +/* No need for a 16bit type, since textbox commands don't take arguments */ +extern uint8_t textbox_bindings[KEY_MAX]; + +#define CMD_WITH_ARG(CMD, ARG) \ + ((CMD) + ((ARG) << 9)) + +#define CMD_GET_COMMAND(CMD) \ + ((CMD) & 0x1FF) + +#define CMD_GET_ARGUMENT(CMD) \ + ((CMD) >> 9) + +enum mixer_command { + // `CMD % 4` should produce the channel mask + CMD_MIXER_CONTROL_DOWN_LEFT = 1, + CMD_MIXER_CONTROL_DOWN_RIGHT, + CMD_MIXER_CONTROL_DOWN, + CMD_MIXER_CONTROL_UP_LEFT = 5, + CMD_MIXER_CONTROL_UP_RIGHT, + CMD_MIXER_CONTROL_UP, + CMD_MIXER_CONTROL_SET_PERCENT_LEFT = 9, + CMD_MIXER_CONTROL_SET_PERCENT_RIGHT, + CMD_MIXER_CONTROL_SET_PERCENT, + + // Keep those in the same order as displayed on screen + CMD_MIXER_HELP, + CMD_MIXER_SYSTEM_INFORMATION, + CMD_MIXER_SELECT_CARD, + CMD_MIXER_CLOSE, + + CMD_MIXER_TOGGLE_VIEW_MODE, + CMD_MIXER_SET_VIEW_MODE, + CMD_MIXER_PREVIOUS, + CMD_MIXER_NEXT, + CMD_MIXER_FOCUS_CONTROL, + CMD_MIXER_TOGGLE_MUTE, + CMD_MIXER_TOGGLE_CAPTURE, + CMD_MIXER_BALANCE_CONTROL, + CMD_MIXER_REFRESH, + + // Mouse + CMD_MIXER_MOUSE_CLICK_MUTE, + CMD_MIXER_MOUSE_CLICK_VOLUME_BAR, + CMD_MIXER_MOUSE_CLICK_CONTROL_ENUM, +}; + +enum textbox_command { + /* Since these commands are also used by the menu widget we make use of + * the menu_driver() request constants. + * KEY_MAX is substracted so the value fits in 8 bits. */ + CMD_TEXTBOX___MIN_MENU_COMMAND = MIN_MENU_COMMAND - KEY_MAX, + CMD_TEXTBOX_TOP = REQ_FIRST_ITEM - KEY_MAX, + CMD_TEXTBOX_BOTTOM = REQ_LAST_ITEM - KEY_MAX, + CMD_TEXTBOX_LEFT = REQ_LEFT_ITEM - KEY_MAX, + CMD_TEXTBOX_RIGHT = REQ_RIGHT_ITEM - KEY_MAX, + CMD_TEXTBOX_UP = REQ_UP_ITEM - KEY_MAX, + CMD_TEXTBOX_DOWN = REQ_DOWN_ITEM - KEY_MAX, + CMD_TEXTBOX_PAGE_DOWN = REQ_SCR_DPAGE - KEY_MAX, + CMD_TEXTBOX_PAGE_UP = REQ_SCR_UPAGE - KEY_MAX, + CMD_TEXTBOX___MAX_MENU_COMMAND = MAX_MENU_COMMAND - KEY_MAX, + CMD_TEXTBOX_PAGE_LEFT, + CMD_TEXTBOX_PAGE_RIGHT, + CMD_TEXTBOX_CLOSE, +}; + +#endif diff --git a/alsamixer/card_select.c b/alsamixer/card_select.c new file mode 100644 index 0000000..a58c037 --- /dev/null +++ b/alsamixer/card_select.c @@ -0,0 +1,197 @@ +/* + * card_select.c - select a card by list or device name + * Copyright (c) Clemens Ladisch + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include "aconfig.h" +#include +#include +#include +#include +#include +#include "gettext_curses.h" +#include "die.h" +#include "mem.h" +#include "utils.h" +#include "colors.h" +#include "widget.h" +#include "menu_widget.h" +#include "mixer_widget.h" +#include "device_name.h" +#include "card_select.h" + +struct card { + struct card *next; + char *indexstr; + char *name; + char *device_name; +}; + +static struct widget list_widget; +static struct card first_card; +static ITEM **items; +static MENU *menu; +static ITEM *initial_item; + +static void on_key_enter(void) +{ + ITEM *item = current_item(menu); + if (item) { + struct card *card = item_userptr(item); + if (card->device_name) { + if (select_card_by_name(card->device_name)) + list_widget.close(); + } else { + create_device_name_form(); + } + } +} + +static void on_handle_key(int key) +{ + switch (menu_widget_handle_key(menu, key)) { + case KEY_ENTER: + on_key_enter(); + break; + case KEY_CANCEL: + list_widget.close(); + break; + } +} + +static void create(void) +{ + menu_widget_create(&list_widget, menu, _("Sound Card")); +} + +void close_card_select_list(void) +{ + unsigned int i; + struct card *card, *next_card; + + unpost_menu(menu); + free_menu(menu); + for (i = 0; items[i]; ++i) + free_item(items[i]); + free(items); + for (card = first_card.next; card; card = next_card) { + next_card = card->next; + free(card->indexstr); + free(card->name); + free(card->device_name); + free(card); + } + widget_free(&list_widget); +} + +static struct widget list_widget = { + .handle_key = on_handle_key, + .window_size_changed = create, + .close = close_card_select_list, +}; + +static int get_cards(void) +{ + int count, number, err; + snd_ctl_t *ctl; + snd_ctl_card_info_t *info; + char buf[16]; + struct card *card, *prev_card; + + first_card.indexstr = "-"; + first_card.name = _("(default)"); + first_card.device_name = "default"; + count = 1; + + snd_ctl_card_info_alloca(&info); + prev_card = &first_card; + number = -1; + for (;;) { + err = snd_card_next(&number); + if (err < 0) + fatal_alsa_error(_("cannot enumerate sound cards"), err); + if (number < 0) + break; + sprintf(buf, "hw:%d", number); + err = snd_ctl_open(&ctl, buf, 0); + if (err < 0) + continue; + err = snd_ctl_card_info(ctl, info); + snd_ctl_close(ctl); + if (err < 0) + continue; + card = ccalloc(1, sizeof *card); + card->device_name = cstrdup(buf); + card->indexstr = cstrdup(buf + 3); + card->name = cstrdup(snd_ctl_card_info_get_name(info)); + prev_card->next = card; + prev_card = card; + ++count; + } + + card = ccalloc(1, sizeof *card); + card->indexstr = cstrdup(" "); + card->name = cstrdup(_("enter device name...")); + prev_card->next = card; + ++count; + + return count; +} + +static void create_list_items(int cards) +{ + int i; + struct card *card; + ITEM *item; + + initial_item = NULL; + items = ccalloc(cards + 1, sizeof(ITEM*)); + i = 0; + for (card = &first_card; card; card = card->next) { + item = new_item(card->indexstr, card->name); + if (!item) + fatal_error("cannot create menu item"); + set_item_userptr(item, card); + items[i++] = item; + if (!initial_item && + mixer_device_name && + (!card->device_name || + !strcmp(card->device_name, mixer_device_name))) + initial_item = item; + } + assert(i == cards); +} + +void create_card_select_list(void) +{ + int cards; + + cards = get_cards(); + create_list_items(cards); + + menu = new_menu(items); + if (!menu) + fatal_error("cannot create menu"); + set_menu_fore(menu, attrs.menu_selected); + set_menu_back(menu, attrs.menu); + set_menu_mark(menu, NULL); + if (initial_item) + set_current_item(menu, initial_item); + set_menu_spacing(menu, 2, 1, 1); + menu_opts_on(menu, O_SHOWDESC); + + create(); +} diff --git a/alsamixer/card_select.h b/alsamixer/card_select.h new file mode 100644 index 0000000..4ba15fc --- /dev/null +++ b/alsamixer/card_select.h @@ -0,0 +1,7 @@ +#ifndef CARD_SELECT_H_INCLUDED +#define CARD_SELECT_H_INCLUDED + +void create_card_select_list(void); +void close_card_select_list(void); + +#endif diff --git a/alsamixer/cli.c b/alsamixer/cli.c new file mode 100644 index 0000000..23d34ad --- /dev/null +++ b/alsamixer/cli.c @@ -0,0 +1,166 @@ +/* + * alsamixer - curses mixer for the ALSA project + * Copyright (c) 1998,1999 Tim Janik + * Jaroslav Kysela + * Copyright (c) 2009 Clemens Ladisch + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include "aconfig.h" +#include +#include +#include +#include +#include +#include "gettext_curses.h" +#include "mixer_widget.h" +#include "mainloop.h" +#include "configparser.h" + +static int use_color = 1; +static int use_mouse = 1; +static const char* config_file = CONFIG_DEFAULT; +static struct snd_mixer_selem_regopt selem_regopt = { + .ver = 1, + .abstract = SND_MIXER_SABSTRACT_NONE, + .device = "default", +}; + +static void show_help(void) +{ + puts(_("Usage: alsamixer [options]")); + puts(_("Useful options:\n" + " -h, --help this help\n" + " -c, --card=NUMBER sound card number or id\n" + " -D, --device=NAME mixer device name\n" + " -m, --mouse enable mouse\n" + " -M, --no-mouse disable mouse\n" + " -f, --config=FILE configuration file\n" + " -F, --no-config do not load configuration file\n" + " -V, --view=MODE starting view mode: playback/capture/all")); + puts(_("Debugging options:\n" + " -g, --no-color toggle using of colors\n" + " -a, --abstraction=NAME mixer abstraction level: none/basic")); +} + +static void parse_options(int argc, char *argv[]) +{ + static const char short_options[] = "hc:D:f:FmMV:gsa:"; + static const struct option long_options[] = { + { .name = "help", .val = 'h' }, + { .name = "card", .has_arg = 1, .val = 'c' }, + { .name = "config", .has_arg = 1, .val = 'f' }, + { .name = "no-config", .val = 'F' }, + { .name = "device", .has_arg = 1, .val = 'D' }, + { .name = "mouse", .val = 'm' }, + { .name = "no-mouse", .val = 'M' }, + { .name = "view", .has_arg = 1, .val = 'V' }, + { .name = "no-color", .val = 'g' }, + { .name = "abstraction", .has_arg = 1, .val = 'a' }, + { 0 } + }; + int option; + int card_index; + static char name_buf[16]; + + while ((option = getopt_long(argc, argv, short_options, + long_options, NULL)) != -1) { + switch (option) { + case '?': + case 'h': + show_help(); + exit(EXIT_SUCCESS); + case 'c': + card_index = snd_card_get_index(optarg); + if (card_index < 0) { + fprintf(stderr, _("invalid card index: %s\n"), optarg); + goto fail; + } + sprintf(name_buf, "hw:%d", card_index); + selem_regopt.device = name_buf; + break; + case 'D': + selem_regopt.device = optarg; + break; + case 'f': + config_file = optarg; + break; + case 'F': + config_file = NULL; + break; + case 'm': + use_mouse = 1; + break; + case 'M': + use_mouse = 0; + break; + case 'V': + if (*optarg == 'p' || *optarg == 'P') + view_mode = VIEW_MODE_PLAYBACK; + else if (*optarg == 'c' || *optarg == 'C') + view_mode = VIEW_MODE_CAPTURE; + else + view_mode = VIEW_MODE_ALL; + break; + case 'g': + use_color = !use_color; + break; + case 'a': + if (!strcmp(optarg, "none")) + selem_regopt.abstract = SND_MIXER_SABSTRACT_NONE; + else if (!strcmp(optarg, "basic")) + selem_regopt.abstract = SND_MIXER_SABSTRACT_BASIC; + else { + fprintf(stderr, _("unknown abstraction level: %s\n"), optarg); + goto fail; + } + break; + default: + fprintf(stderr, _("unknown option: %c\n"), option); +fail: + fputs(_("try `alsamixer --help' for more information\n"), stderr); + exit(EXIT_FAILURE); + } + } +} + +int main(int argc, char *argv[]) +{ + if (!isatty(fileno(stdin))) + return 0; + + setlocale(LC_ALL, ""); +#ifdef ENABLE_NLS_IN_CURSES + textdomain(PACKAGE); +#endif + + parse_options(argc, argv); + + create_mixer_object(&selem_regopt); + + initialize_curses(use_color, use_mouse); + + if (config_file == CONFIG_DEFAULT) + parse_default_config_file(); + else if (config_file) + parse_config_file(config_file); + + create_mixer_widget(); + + mainloop(); + + app_shutdown(); + return 0; +} diff --git a/alsamixer/colors.c b/alsamixer/colors.c new file mode 100644 index 0000000..1a8cb8f --- /dev/null +++ b/alsamixer/colors.c @@ -0,0 +1,121 @@ +/* + * colors.c - color and attribute definitions + * Copyright (c) 1998,1999 Tim Janik + * Jaroslav Kysela + * Copyright (c) 2009 Clemens Ladisch + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include "aconfig.h" +#include CURSESINC +#include "colors.h" + +struct attributes attrs; + +int get_color_pair(short fg, short bg) +{ + static int color_pairs_defined = 0; + short i, pair_fg, pair_bg; + + for (i = 1; i <= color_pairs_defined; ++i) { + if (OK == pair_content(i, &pair_fg, &pair_bg)) + if (pair_fg == fg && pair_bg == bg) + return COLOR_PAIR(i); + } + + if (color_pairs_defined + 1 < COLOR_PAIRS) { + ++color_pairs_defined; + init_pair(color_pairs_defined, fg, bg); + return COLOR_PAIR(color_pairs_defined); + } + + return 0; +} + +void init_colors(int use_color) +{ + if (!!has_colors() == !!use_color) { + start_color(); + use_default_colors(); + + get_color_pair(COLOR_CYAN, COLOR_BLACK); // COLOR_PAIR(1) + get_color_pair(COLOR_YELLOW, COLOR_BLACK); + get_color_pair(COLOR_WHITE, COLOR_GREEN); + get_color_pair(COLOR_RED, COLOR_BLACK); + get_color_pair(COLOR_WHITE, COLOR_BLACK); + get_color_pair(COLOR_WHITE, COLOR_BLUE); + get_color_pair(COLOR_RED, COLOR_BLUE); + get_color_pair(COLOR_GREEN, COLOR_GREEN); + get_color_pair(COLOR_WHITE, COLOR_RED); // COLOR_PAIR(9) +#ifdef TRICOLOR_VOLUME_BAR + get_color_pair(COLOR_WHITE, COLOR_WHITE); + get_color_pair(COLOR_RED, COLOR_RED); +#endif + + attrs = (struct attributes) { + .mixer_frame = COLOR_PAIR(1), + .mixer_text = COLOR_PAIR(1), + .mixer_active = A_BOLD | COLOR_PAIR(2), + .ctl_frame = A_BOLD | COLOR_PAIR(1), + .ctl_mute = COLOR_PAIR(1), + .ctl_nomute = A_BOLD | COLOR_PAIR(3), + .ctl_capture = A_BOLD | COLOR_PAIR(4), + .ctl_nocapture = COLOR_PAIR(5), + .ctl_label = A_BOLD | COLOR_PAIR(6), + .ctl_label_focus = A_BOLD | COLOR_PAIR(7), + .ctl_mark_focus = A_BOLD | COLOR_PAIR(4), + .ctl_bar_lo = A_BOLD | COLOR_PAIR(8), +#ifdef TRICOLOR_VOLUME_BAR + .ctl_bar_mi = A_BOLD | COLOR_PAIR(10), + .ctl_bar_hi = A_BOLD | COLOR_PAIR(11), +#endif + .ctl_inactive = COLOR_PAIR(5), + .ctl_label_inactive = A_REVERSE | COLOR_PAIR(5), + .errormsg = A_BOLD | COLOR_PAIR(9), + .infomsg = A_BOLD | COLOR_PAIR(6), + .textbox = A_BOLD | COLOR_PAIR(6), + .textfield = A_REVERSE | COLOR_PAIR(5), + .menu = A_BOLD | COLOR_PAIR(6), + .menu_selected = A_REVERSE | COLOR_PAIR(6) + }; + } else { + attrs = (struct attributes) { + .mixer_frame = A_NORMAL, + .mixer_text = A_NORMAL, + .mixer_active = A_BOLD, + .ctl_frame = A_BOLD, + .ctl_mute = A_NORMAL, + .ctl_nomute = A_BOLD, + .ctl_capture = A_BOLD, + .ctl_nocapture = A_NORMAL, + .ctl_label = A_REVERSE, + .ctl_label_focus = A_REVERSE | A_BOLD, + .ctl_mark_focus = A_BOLD, + .ctl_bar_lo = A_BOLD, +#ifdef TRICOLOR_VOLUME_BAR + .ctl_bar_mi = A_BOLD, + .ctl_bar_hi = A_BOLD, +#endif + .ctl_inactive = A_NORMAL, + .ctl_label_inactive = A_REVERSE, + .errormsg = A_STANDOUT, + .infomsg = A_NORMAL, + .textbox = A_NORMAL, + .textfield = A_REVERSE, + .menu = A_NORMAL, + .menu_selected = A_REVERSE, + }; + } +} diff --git a/alsamixer/colors.h b/alsamixer/colors.h new file mode 100644 index 0000000..7ca6ac5 --- /dev/null +++ b/alsamixer/colors.h @@ -0,0 +1,41 @@ +#ifndef COLORS_H_INCLUDED +#define COLORS_H_INCLUDED + +#define TRICOLOR_VOLUME_BAR + +struct attributes { + // Alphabetically sorted +#ifdef TRICOLOR_VOLUME_BAR + int ctl_bar_hi; +#endif + int ctl_bar_lo; +#ifdef TRICOLOR_VOLUME_BAR + int ctl_bar_mi; +#endif + int ctl_capture; + int ctl_frame; + int ctl_inactive; + int ctl_label; + int ctl_label_focus; + int ctl_label_inactive; + int ctl_mark_focus; + int ctl_mute; + int ctl_nocapture; + int ctl_nomute; + int errormsg; + int infomsg; + int menu; + int menu_selected; + int mixer_active; + int mixer_frame; + int mixer_text; + int textbox; + int textfield; +}; + +extern struct attributes attrs; + +void init_colors(int use_color); +int get_color_pair(short fg, short bg); + +#endif diff --git a/alsamixer/configparser.c b/alsamixer/configparser.c new file mode 100644 index 0000000..93aa72a --- /dev/null +++ b/alsamixer/configparser.c @@ -0,0 +1,592 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include CURSESINC +#include "colors.h" +#include "gettext_curses.h" +#include "utils.h" +#include "curskey.h" +#include "bindings.h" +#include "mixer_widget.h" + +#define ERROR_CONFIG (-1) +#define ERROR_MISSING_ARGUMENTS (-2) +#define ERROR_TOO_MUCH_ARGUMENTS (-3) + +static const char *error_message; +static const char *error_cause; + +static int strlist_index(const char *haystack, unsigned int itemlen, const char *needle) { + unsigned int needle_len; + unsigned int pos; + const char *found; + + needle_len = strlen(needle); + if (needle_len <= itemlen && needle[needle_len - 1] != ' ') { + found = strstr(haystack, needle); + if (found) { + pos = (found - haystack); + if (pos % itemlen == 0 && (needle_len == itemlen || haystack[pos+needle_len] == ' ')) + return pos / itemlen; + } + } + + return -1; +} + +static int color_by_name(const char *name) { + return strlist_index( + "default" + "black " + "red " + "green " + "yellow " + "blue " + "magenta" + "cyan " + "white ", 7, name) - 1; +}; + +static int attr_by_name(const char *name) { + return (int[]) { + -1, + A_BOLD, + A_REVERSE, + A_STANDOUT, + A_DIM, + A_UNDERLINE, +#ifdef A_ITALIC + A_ITALIC, +#endif + A_NORMAL, + A_BLINK, + }[strlist_index( + "bold " + "reverse " + "standout " + "dim " + "underline" +#ifdef A_ITALIC + "italic " +#endif + "normal " + "blink ", 9, name) + 1]; +}; + +#define W_NUMBER (1U << 0) + +enum textbox_word { + TW_BOTTOM = (1U << 1), + TW_CLOSE = (1U << 2), + TW_DOWN = (1U << 3), + TW_LEFT = (1U << 4), + TW_PAGE = (1U << 5), + TW_RIGHT = (1U << 6), + TW_TOP = (1U << 7), + TW_UP = (1U << 8), +}; + +const char *textbox_words = + "bottom" + "close " + "down " + "left " + "page " + "right " + "top " + "up "; + +enum mixer_word { + MW_ALL = (1U << 1), + MW_BALANCE = (1U << 2), + MW_CAPTURE = (1U << 3), + MW_CARD = (1U << 4), + MW_CLOSE = (1U << 5), + MW_CONTROL = (1U << 6), + MW_DOWN = (1U << 7), + MW_FOCUS = (1U << 8), + MW_HELP = (1U << 9), + MW_INFORMATION = (1U << 10), + MW_LEFT = (1U << 11), + MW_MODE = (1U << 12), + MW_MUTE = (1U << 13), + MW_NEXT = (1U << 14), + MW_PLAYBACK = (1U << 15), + MW_PREVIOUS = (1U << 16), + MW_REFRESH = (1U << 17), + MW_RIGHT = (1U << 18), + MW_SELECT = (1U << 19), + MW_SET = (1U << 20), + MW_SYSTEM = (1U << 21), + MW_TOGGLE = (1U << 22), + MW_UP = (1U << 23), +}; + +const char *mixer_words = + "all " + "balance " + "capture " + "card " + "close " + "control " + "down " + "focus " + "help " + "information" + "left " + "mode " + "mute " + "next " + "playback " + "previous " + "refresh " + "right " + "select " + "set " + "system " + "toggle " + "up "; + +static unsigned int parse_words(const char *name, const char* wordlist, unsigned int itemlen, unsigned int *number) { + unsigned int words = 0; + unsigned int word; + unsigned int i; + char buf[16]; + char *endptr; + + while (*name) { + for (i = 0; i < sizeof(buf) - 1; ++i) { + if (*name == '\0') + break; + if (*name == '_') { + ++name; + break; + } + buf[i] = *name; + ++name; + } + buf[i] = '\0'; + + if (buf[0] >= '0' && buf[0] <= '9') { + if (number) { + *number = strtoumax(buf, &endptr, 10); + if (*endptr != '\0') + return 0; + } + word = W_NUMBER; + } + else if ((i = strlist_index(wordlist, itemlen, buf)) >= 0) + word = 2U << i; + else + return 0; + + if (words & word) // no duplicate words + return 0; + words |= word; + } + + return words; +} + +static int textbox_command_by_name(const char *name) { + switch (parse_words(name, textbox_words, 6, NULL)) { + case TW_TOP: return CMD_TEXTBOX_TOP; + case TW_BOTTOM: return CMD_TEXTBOX_BOTTOM; + case TW_CLOSE: return CMD_TEXTBOX_CLOSE; + case TW_UP: return CMD_TEXTBOX_UP; + case TW_DOWN: return CMD_TEXTBOX_DOWN; + case TW_LEFT: return CMD_TEXTBOX_LEFT; + case TW_RIGHT: return CMD_TEXTBOX_RIGHT; + case TW_PAGE|TW_UP: return CMD_TEXTBOX_PAGE_UP; + case TW_PAGE|TW_DOWN: return CMD_TEXTBOX_PAGE_DOWN; + case TW_PAGE|TW_LEFT: return CMD_TEXTBOX_PAGE_LEFT; + case TW_PAGE|TW_RIGHT: return CMD_TEXTBOX_PAGE_RIGHT; + default: return 0; + } +} + +static int mixer_command_by_name(const char *name) { + unsigned int channel = 0; + unsigned int number = 1; // default numeric arg + unsigned int words = parse_words(name, mixer_words, 11, &number); + + switch (words) { + case MW_HELP: return CMD_MIXER_HELP; + case MW_CLOSE: return CMD_MIXER_CLOSE; + case MW_REFRESH: return CMD_MIXER_REFRESH; + case MW_SELECT|MW_CARD: return CMD_MIXER_SELECT_CARD; + case MW_SYSTEM|MW_INFORMATION: return CMD_MIXER_SYSTEM_INFORMATION; + case MW_MODE|MW_ALL: return CMD_WITH_ARG(CMD_MIXER_SET_VIEW_MODE, VIEW_MODE_ALL); + case MW_MODE|MW_CAPTURE: return CMD_WITH_ARG(CMD_MIXER_SET_VIEW_MODE, VIEW_MODE_CAPTURE); + case MW_MODE|MW_PLAYBACK: return CMD_WITH_ARG(CMD_MIXER_SET_VIEW_MODE, VIEW_MODE_PLAYBACK); + case MW_MODE|MW_TOGGLE: return CMD_MIXER_TOGGLE_VIEW_MODE; + case MW_CONTROL|MW_BALANCE: return CMD_MIXER_BALANCE_CONTROL; + case MW_NEXT: + case MW_NEXT|W_NUMBER: + case MW_PREVIOUS: + case MW_PREVIOUS|W_NUMBER: + return ((number < 1 || number > 511) ? 0 : + CMD_WITH_ARG((words & MW_NEXT + ? CMD_MIXER_NEXT + : CMD_MIXER_PREVIOUS), number)); + case MW_CONTROL|MW_FOCUS|W_NUMBER: + return ((number < 1 || number > 512) ? 0 : + CMD_WITH_ARG(CMD_MIXER_FOCUS_CONTROL, number - 1)); + } + + if (words & MW_LEFT) + channel |= LEFT; + if (words & MW_RIGHT) + channel |= RIGHT; + if (!channel) + channel = LEFT|RIGHT; + + switch (words & ~(MW_LEFT|MW_RIGHT)) { + case MW_CONTROL|MW_UP: + case MW_CONTROL|MW_UP|W_NUMBER: + case MW_CONTROL|MW_DOWN: + case MW_CONTROL|MW_DOWN|W_NUMBER: + return ((number < 1 || number > 100) ? 0 : + CMD_WITH_ARG((words & MW_UP + ? CMD_MIXER_CONTROL_UP_LEFT + : CMD_MIXER_CONTROL_DOWN_LEFT) + channel - 1, number)); + case MW_CONTROL|MW_SET|W_NUMBER: + return (number > 100 ? 0 : + CMD_WITH_ARG(CMD_MIXER_CONTROL_SET_PERCENT_LEFT + channel - 1, number)); + case MW_TOGGLE|MW_MUTE: + return CMD_WITH_ARG(CMD_MIXER_TOGGLE_MUTE, channel); + case MW_TOGGLE|MW_CAPTURE: + return CMD_WITH_ARG(CMD_MIXER_TOGGLE_CAPTURE, channel); + } + + return 0; +} + +static int* element_by_name(const char *name) { + int idx = strlist_index( +#ifdef TRICOLOR_VOLUME_BAR + "ctl_bar_hi " +#endif + "ctl_bar_lo " +#ifdef TRICOLOR_VOLUME_BAR + "ctl_bar_mi " +#endif + "ctl_capture " + "ctl_frame " + "ctl_inactive " + "ctl_label " + "ctl_label_focus " + "ctl_label_inactive" + "ctl_mark_focus " + "ctl_mute " + "ctl_nocapture " + "ctl_nomute " + "errormsg " + "infomsg " + "menu " + "menu_selected " + "mixer_active " + "mixer_frame " + "mixer_text " + "textbox " + "textfield ", 18, name); + + if (idx < 0) { +#ifndef TRICOLOR_VOLUME_BAR + if (strlist_index( + "ctl_bar_hi" + "ctl_bar_mi", 10, name) >= 0) + return &errno; // dummy element +#endif + return NULL; + } + + return &( ((int*) &attrs)[idx] ); +} + +static int cfg_bind(char **argv, unsigned int argc) { + const char *command_name; + command_enum command = 0; + unsigned int i; + int keys[3] = { -1, -1, -1 }; + union { + command_enum *mixer_bindings; + uint8_t *textbox_bindings; + } bind_to = { + .mixer_bindings = mixer_bindings + }; + + if (argc == 2) + command_name = argv[1]; + else if (argc == 3) { + command_name = argv[2]; + + if (! strcmp(argv[1], "textbox")) { + bind_to.textbox_bindings = textbox_bindings; + } + else if (! strcmp(argv[1], "mixer")) + ; // bind_to.mixer_bindings = mixer_bindings + else { + error_message = _("invalid widget"); + error_cause = argv[1]; + return ERROR_CONFIG; + } + } + else { + return (argc < 2 ? ERROR_MISSING_ARGUMENTS : ERROR_TOO_MUCH_ARGUMENTS); + } + + keys[0] = curskey_parse(argv[0]); + if (keys[0] < 0 || keys[0] >= ARRAY_SIZE(mixer_bindings)) { + error_message = _("invalid key"); + error_cause = argv[0]; + return ERROR_CONFIG; + } + + if (keys[0] == KEY_ENTER || keys[0] == '\n' || keys[0] == '\r') { + keys[0] = KEY_ENTER; + keys[1] = '\n'; + keys[2] = '\r'; + } + + if (bind_to.textbox_bindings == textbox_bindings) + command = textbox_command_by_name(command_name); + else + command = mixer_command_by_name(command_name); + + if (!command) { + if (!strcmp(command_name, "none")) + ; // command = 0 + else { + error_message = _("invalid command"); + error_cause = command_name; + return ERROR_CONFIG; + } + } + + for (i = 0; i < ARRAY_SIZE(keys) && keys[i] != -1; ++i) { + if (bind_to.textbox_bindings == textbox_bindings) + bind_to.textbox_bindings[keys[i]] = command; + else + bind_to.mixer_bindings[keys[i]] = command; + } + + return 0; +} + +static int cfg_color(char **argv, unsigned int argc) +{ + short fg_color, bg_color; + unsigned int i; + int *element; + int attr; + + if (argc < 3) + return ERROR_MISSING_ARGUMENTS; + + if (NULL == (element = element_by_name(argv[0]))) { + error_message = _("unknown theme element"); + error_cause = argv[0]; + return ERROR_CONFIG; + } + + if (-2 == (fg_color = color_by_name(argv[1]))) { + error_message = _("unknown color"); + error_cause = argv[1]; + return ERROR_CONFIG; + } + + if (-2 == (bg_color = color_by_name(argv[2]))) { + error_message = _("unknown color"); + error_cause = argv[2]; + return ERROR_CONFIG; + } + + *element = get_color_pair(fg_color, bg_color); + + for (i = 3; i < argc; ++i) { + if (-1 == (attr = attr_by_name(argv[i]))) { + error_message = _("unknown color attribute"); + error_cause = argv[i]; + return ERROR_CONFIG; + } + else + *element |= attr; + } + return 0; +} + +static int cfg_set(char **argv, unsigned int argc) +{ + char *endptr; + + if (argc == 2) { + if (! strcmp(argv[0], "mouse_wheel_step")) { + mouse_wheel_step = strtoumax(argv[1], &endptr, 10); + if (mouse_wheel_step > 100 || *endptr != '\0') { + mouse_wheel_step = 1; + error_message = _("invalid value"); + error_cause = argv[1]; + return ERROR_CONFIG; + } + } + else if (! strcmp(argv[0], "mouse_wheel_focuses_control")) { + if ((argv[1][0] == '0' || argv[1][0] == '1') && argv[1][1] == '\0') + mouse_wheel_focuses_control = argv[1][0] - '0'; + else { + error_message = _("invalid value"); + error_cause = argv[1]; + return ERROR_CONFIG; + } + } + else { + error_message = _("unknown option"); + error_cause = argv[0]; + return ERROR_CONFIG; + } + } + else { + return (argc < 2 ? ERROR_MISSING_ARGUMENTS : ERROR_TOO_MUCH_ARGUMENTS); + } + + return 0; +} + +/* Split $line on whitespace, store it in $args, return the argument count. + * Return 0 for commented lines ('\s*#'). + * + * This will modify contents of $line. + */ +static unsigned int parse_line(char *line, char **args, unsigned int args_size) +{ + unsigned int count; + + for (count = 0; count < args_size; ++count) { + while (*line && isspace(*line)) + ++line; + + if (*line == '\0') + break; + + if (*line == '#' && count == 0) + break; + + args[count] = line; + + while (*line && !isspace(*line)) + ++line; + + if (*line != '\0') { + *line = '\0'; + ++line; + } + } + + return count; +} + +static int process_line(char *line) { + char *args[16]; + unsigned int argc = parse_line(line, args, ARRAY_SIZE(args)); + int ret = 0; + + if (argc >= 1) { + error_cause = NULL; + //error_message = _("unknown error"); + + if (argc >= ARRAY_SIZE(args)) + ret = ERROR_TOO_MUCH_ARGUMENTS; + else { + ret = strlist_index( + "bind " + "color" + "set ", 5, args[0]); + switch (ret) { + case 0: ret = cfg_bind(args + 1, argc - 1); break; + case 1: ret = cfg_color(args + 1, argc - 1); break; + case 2: ret = cfg_set(args + 1, argc - 1); break; + default: error_message = _("unknown command"); + } + } + + if (ret == ERROR_MISSING_ARGUMENTS) + error_message = _("missing arguments"); + else if (ret == ERROR_TOO_MUCH_ARGUMENTS) + error_message = _("too much arguments"); + } + + return ret; +} + +void parse_config_file(const char *file_name) +{ + char *buf; + unsigned int file_size; + unsigned int lineno; + unsigned int i; + char *line; + + endwin(); // print warnings to stderr + + buf = read_file(file_name, &file_size); + if (!buf) { + fprintf(stderr, "%s: %s\n", file_name, strerror(errno)); + return; + } + + curskey_init(); + curskey_define_meta_keys(128); + + lineno = 0; + line = buf; + for (i = 0; i < file_size; ++i) { + if (buf[i] == '\n') { + buf[i] = '\0'; + ++lineno; + if (process_line(line) < 0) { + if (error_cause) + fprintf(stderr, "%s:%d: %s: %s: %s\n", file_name, lineno, line, error_message, error_cause); + else + fprintf(stderr, "%s:%d: %s: %s\n", file_name, lineno, line, error_message); + } + line = &buf[i + 1]; + } + } + + free(buf); + curskey_destroy(); +} + +void parse_default_config_file() { + char file[4096]; + const char *home; + + home = getenv("XDG_CONFIG_HOME"); + if (home && *home) { + snprintf(file, sizeof(file), "%s/alsamixer.rc", home); + if (! access(file, F_OK)) + return parse_config_file(file); + } + + home = getenv("HOME"); + if (!home || !*home) { + struct passwd *pwd = getpwuid(getuid()); + if (pwd) + home = pwd->pw_dir; + } + + if (home && *home) { + snprintf(file, sizeof(file), "%s/.config/alsamixer.rc", home); + if (! access(file, F_OK)) + return parse_config_file(file); + + snprintf(file, sizeof(file), "%s/.alsamixer.rc", home); + if (! access(file, F_OK)) + return parse_config_file(file); + } +} diff --git a/alsamixer/configparser.h b/alsamixer/configparser.h new file mode 100644 index 0000000..43f5392 --- /dev/null +++ b/alsamixer/configparser.h @@ -0,0 +1,9 @@ +#ifndef CONFIGPARSER_H_INCLUDED +#define CONFIGPARSER_H_INCLUDED + +#define CONFIG_DEFAULT ((const char*) 1) + +void parse_config_file(const char *file); +void parse_default_config_file(); + +#endif diff --git a/alsamixer/curskey.c b/alsamixer/curskey.c new file mode 100644 index 0000000..5f39b4a --- /dev/null +++ b/alsamixer/curskey.c @@ -0,0 +1,274 @@ +#include +#include +#include +#include "curskey.h" +#include "utils.h" +#include "mem.h" + +struct curskey_key { + char *keyname; + int keycode; +}; + +static struct curskey_key *keynames; +static unsigned int keynames_count; + +unsigned int meta_keycode_start; +static uint64_t invalid_meta_char_mask[2]; + +// Names for non-printable/whitespace characters and aliases for existing keys +static const struct curskey_key keyname_aliases[] = { + // Sorted by `keyname` + { "DEL", KEY_DEL }, + { "DELETE", KEY_DC }, + { "ENTER", '\n' }, + { "ENTER", '\r' }, + { "ESCAPE", KEY_ESCAPE }, + { "INSERT", KEY_IC }, + { "PAGEDOWN", KEY_NPAGE }, + { "PAGEUP", KEY_PPAGE }, + { "SPACE", KEY_SPACE }, + { "TAB", KEY_TAB } +}; + +#define STARTSWITH_KEY(S) \ + ((name[0] == 'K' || name[0] == 'k') && \ + (name[1] == 'E' || name[1] == 'e') && \ + (name[2] == 'Y' || name[2] == 'y') && \ + (name[3] == '_')) + +#define IS_META(S) \ + ((S[0] == 'M' || S[0] == 'm' || S[0] == 'A' || S[0] == 'a') && S[1] == '-') + +static int curskey_key_cmp(const void *a, const void *b) { + return strcmp(((struct curskey_key*) a)->keyname, + ((struct curskey_key*) b)->keyname); +} + +static int curskey_find(const struct curskey_key *table, unsigned int size, const char *name) { + unsigned int start = 0; + unsigned int end = size; + unsigned int i; + int cmp; + + while (1) { + i = (start+end) / 2; + cmp = strcasecmp(name, table[i].keyname); + + if (cmp == 0) + return table[i].keycode; + else if (end == start + 1) + return ERR; + else if (cmp > 0) + start = i; + else + end = i; + } +} + +/* Translate the name of a ncurses KEY_ constant to its value. + * "KEY_DOWN" -> 258 + * + * Return ERR on failure. + */ +int curskey_keycode(const char *name) +{ + int i; + + if (! name) + return ERR; + + if (STARTSWITH_KEY(name)) + name += 4; + + if (name[0] == 'F' || name[0] == 'f') { + i = (name[1] == '(' ? 2 : 1); + + if (name[i] >= '0' && name[i] <= '9') { + i = atoi(name + i); + if (i >= 1 && i <= 63) + return KEY_F(i); + } + } + + i = curskey_find(keyname_aliases, ARRAY_SIZE(keyname_aliases), name); + if (i != ERR) + return i; + + return curskey_find(keynames, keynames_count, name); +} + +static void free_ncurses_keynames() { + if (keynames) { + while (keynames_count) + free(keynames[--keynames_count].keyname); + free(keynames); + keynames = NULL; + } +} + +/* Create the list of ncurses KEY_ constants and their names. + * Returns OK on success, ERR on failure. + */ +int create_ncurses_keynames() { + int key; + char *name; + + free_ncurses_keynames(); + keynames = ccalloc(sizeof(struct curskey_key), (KEY_MAX - KEY_MIN)); + + for (key = KEY_MIN; key != KEY_MAX; ++key) { + name = (char*) keyname(key); + + if (!name || !STARTSWITH_KEY(name)) + continue; + + name += 4; + if (name[0] == 'F' && name[1] == '(') + continue; // ignore KEY_F(1),... + + keynames[keynames_count].keycode = key; + keynames[keynames_count].keyname = cstrdup(name); + ++keynames_count; + } + + keynames = crealloc(keynames, keynames_count * sizeof(struct curskey_key)); + qsort(keynames, keynames_count, sizeof(struct curskey_key), curskey_key_cmp); + + return OK; +} + +/* Defines meta escape sequences in ncurses. + * + * Some combinations with meta/alt may not be available since they collide + * with the prefix of a pre-defined key. + * For example, keys F1 - F4 begin with "\eO", so ALT-O cannot be defined. + * + * Returns OK if meta keys are available, ERR otherwise. + */ +int curskey_define_meta_keys(unsigned int keycode_start) { +#ifdef NCURSES_VERSION + int ch; + int keycode; + int new_keycode = keycode_start; + char key_sequence[3] = "\e "; + + invalid_meta_char_mask[0] = 0; + invalid_meta_char_mask[1] = 0; + + for (ch = 0; ch <= CURSKEY_MAX_META_CHAR; ++ch) { + key_sequence[1] = ch; + keycode = key_defined(key_sequence); + if (! keycode) { + define_key(key_sequence, new_keycode); + } + else if (keycode == new_keycode) + ; + else + invalid_meta_char_mask[ch/65] |= (1UL << (ch % 64)); + + ++new_keycode; + } + + meta_keycode_start = keycode_start; + return OK; +#endif + return ERR; +} + +/* Return the keycode for a key with modifiers applied. + * + * Available modifiers are: + * - CURSKEY_MOD_META / CURSKEY_MOD_ALT + * - CURSKEY_MOD_CNTRL + * + * See also the macros curskey_meta_key(), curskey_cntrl_key(). + * + * Returns ERR if the modifiers cannot be applied to this key. + */ +int curskey_mod_key(int key, unsigned int modifiers) { + if (modifiers & CURSKEY_MOD_CNTRL) { + if ((key >= 'A' && key <= '_') || (key >= 'a' && key <= 'z') || key == ' ') + key = key % 32; + else + return ERR; + } + + if (modifiers & CURSKEY_MOD_META) { + if (meta_keycode_start && + (key >= 0 && key <= CURSKEY_MAX_META_CHAR) && + ! (invalid_meta_char_mask[key/65] & (1UL << (key % 64)))) { + key = meta_keycode_start + key; + } + else + return ERR; + } + + return key; +} + +/* Return the ncurses keycode for a key definition. + * + * Key definition may be: + * - Single character (a, z, ...) + * - Character with control-modifier (^x, C-x, c-x, ...) + * - Character with meta/alt-modifier (M-x, m-x, A-x, a-x, ...) + * - Character with both modifiers (C-M-x, M-C-x, M-^x, ...) + * - Curses keyname, no modifiers allowed (KEY_HOME, HOME, F1, F(1), ...) + * + * Returns ERR if either + * - The key definition is NULL or empty + * - The key could not be found ("KEY_FOO") + * - The key combination is invalid in general ("C-TAB", "C-RETURN") + * - The key is invalid because of compile time options (the + * `define_key()` function was not available.) + * - The key is invalid because it could not be defined by + * curskey_define_meta_keys() + */ +int curskey_parse(const char *def) { + int c; + unsigned int mod = 0; + + if (! def) + return ERR; + + for (;;) { + if (def[0] == '^' && def[1] != '\0') { + ++def; + mod |= CURSKEY_MOD_CNTRL; + } + else if ((def[0] == 'C' || def[0] == 'c') && def[1] == '-') { + def += 2; + mod |= CURSKEY_MOD_CNTRL; + } + else if (IS_META(def)) { + if (! meta_keycode_start) + return ERR; + def += 2; + mod |= CURSKEY_MOD_ALT; + } + else + break; + } + + if (*def == '\0') + return ERR; + else if (*(def+1) == '\0') + c = *def; + else + c = curskey_keycode(def); + + return curskey_mod_key(c, mod); +} + +/* Initialize curskey. + * Returns OK on success, ERR on failure. */ +int curskey_init() { + keypad(stdscr, TRUE); + return create_ncurses_keynames(); +} + +/* Destroy curskey. */ +void curskey_destroy() { + free_ncurses_keynames(); +} diff --git a/alsamixer/curskey.h b/alsamixer/curskey.h new file mode 100644 index 0000000..129a652 --- /dev/null +++ b/alsamixer/curskey.h @@ -0,0 +1,37 @@ +#ifndef CURSKEY_H_INCLUDED +#define CURSKEY_H_INCLUDED + +#include CURSESINC + +/* Additional KEY_ constants */ +#define KEY_SPACE ' ' +#define KEY_TAB '\t' +#define KEY_DEL 127 +#define KEY_ESCAPE 27 +#define KEY_INSERT KEY_IC +#define KEY_DELETE KEY_DC +#define KEY_PAGEUP KEY_PPAGE +#define KEY_PAGEDOWN KEY_NPAGE + +/* Modifiers */ +#define CURSKEY_MOD_CNTRL 1U +#define CURSKEY_MOD_META 2U +#define CURSKEY_MOD_ALT CURSKEY_MOD_META + +/* Defines the range of characters which should be "meta-able" */ +#define CURSKEY_MAX_META_CHAR 127 + +int curskey_init(); +void curskey_destroy(); +int curskey_define_meta_keys(unsigned int keycode_start); + +int curskey_parse(const char *keydef); +int curskey_mod_key(int key, unsigned int modifiers); + +#define curskey_meta_key(KEY) \ + curskey_mod_key(KEY, CURSKEY_MOD_META) + +#define curskey_cntrl_key(KEY) \ + curskey_mod_key(KEY, CURSKEY_MOD_CNTRL) + +#endif diff --git a/alsamixer/device_name.c b/alsamixer/device_name.c new file mode 100644 index 0000000..26b03d5 --- /dev/null +++ b/alsamixer/device_name.c @@ -0,0 +1,195 @@ +/* + * device_name_form.c - ask for sound control device name + * Copyright (c) Clemens Ladisch + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include "aconfig.h" +#include +#include +#include CURSESINC +#include +#include "gettext_curses.h" +#include "die.h" +#include "mem.h" +#include "utils.h" +#include "colors.h" +#include "widget.h" +#include "mixer_widget.h" +#include "card_select.h" +#include "device_name.h" + +static struct widget form_widget; +static FIELD *fields[3]; +static FORM *form; + +static char *dup_current_name(void) +{ + int rows, cols, max, i; + char *s; + + if (form_driver(form, REQ_VALIDATION) == E_OK) { + dynamic_field_info(fields[1], &rows, &cols, &max); + s = ccalloc(1, cols + 1); + memcpy(s, field_buffer(fields[1], 0), cols); + for (i = strlen(s) - 1; i >= 0 && s[i] == ' '; --i) + s[i] = '\0'; + return s; + } else { + return cstrdup(""); + } +} + +static void on_key_enter(void) +{ + char *s; + bool ok; + + s = dup_current_name(); + ok = select_card_by_name(s); + free(s); + if (ok) { + form_widget.close(); + close_card_select_list(); + } +} + +static void on_form_key(int key) +{ + static const struct { + int key; + int request; + } key_map[] = { + { KEY_LEFT, REQ_PREV_CHAR }, + { KEY_RIGHT, REQ_NEXT_CHAR }, + { KEY_HOME, REQ_BEG_FIELD }, + { KEY_BACKSPACE, REQ_DEL_PREV }, + { 127, REQ_DEL_PREV }, + { KEY_DC, REQ_DEL_CHAR }, + { KEY_BEG, REQ_BEG_FIELD }, + { KEY_END, REQ_END_FIELD }, + }; + unsigned int i; + + if (key >= 32 && key < 256 && key != 127) { + form_driver(form, key); + return; + } + for (i = 0; i < ARRAY_SIZE(key_map); ++i) + if (key_map[i].key == key) { + form_driver(form, key_map[i].request); + break; + } +} + +static void on_handle_key(int key) +{ + switch (key) { + case 27: + case KEY_CANCEL: + form_widget.close(); + break; + case 10: + case 13: + case KEY_ENTER: + on_key_enter(); + break; + default: + on_form_key(key); + break; + } +} + +static bool create(void) +{ + const char *title; + + if (screen_lines < 6 || screen_cols < 36) { + form_widget.close(); + beep(); + return FALSE; + } + widget_init(&form_widget, + 6, 36, SCREEN_CENTER, SCREEN_CENTER, + attrs.textbox, WIDGET_BORDER | WIDGET_SUBWINDOW | WIDGET_CURSOR_VISIBLE); + title = _("Sound Card"); + mvwprintw(form_widget.window, 0, (36 - 2 - get_mbs_width(title)) / 2, " %s ", title); + + set_form_win(form, form_widget.window); + set_form_sub(form, form_widget.subwindow); + return TRUE; +} + +static void on_window_size_changed(void) +{ + form_driver(form, REQ_VALIDATION); /* save field value */ + unpost_form(form); + + if (!create()) + return; + + /* + * This call fails because ncurses does not allow changing options of + * the current field, and we cannot change the current field because + * there is only one. The only way to make this work would be to throw + * away and recreate all fields. + */ + field_opts_off(fields[1], O_BLANK); + + post_form(form); +} + +static void on_close(void) +{ + unpost_form(form); + free_form(form); + free_field(fields[0]); + free_field(fields[1]); + widget_free(&form_widget); +} + +static struct widget form_widget = { + .handle_key = on_handle_key, + .window_size_changed = on_window_size_changed, + .close = on_close, +}; + +void create_device_name_form(void) +{ + fields[0] = new_field(1, 32, 1, 1, 0, 0); + if (!fields[0]) + fatal_error("cannot create field"); + field_opts_off(fields[0], O_ACTIVE|O_EDIT); + set_field_fore(fields[0], attrs.textbox); + set_field_back(fields[0], attrs.textbox); + set_field_buffer(fields[0], 0, _("Device name:")); + + fields[1] = new_field(1, 32, 2, 1, 0, 0); + if (!fields[1]) + fatal_error("cannot create field"); + field_opts_off(fields[1], O_AUTOSKIP|O_NULLOK|O_STATIC); + set_field_fore(fields[1], attrs.textfield); + set_field_back(fields[1], attrs.textfield); + set_field_buffer(fields[1], 0, mixer_device_name); + + form = new_form(fields); + if (!form) + fatal_error("cannot create form"); + + if (!create()) + return; + + post_form(form); +} diff --git a/alsamixer/device_name.h b/alsamixer/device_name.h new file mode 100644 index 0000000..f4a1f3f --- /dev/null +++ b/alsamixer/device_name.h @@ -0,0 +1,6 @@ +#ifndef DEVICE_NAME_FORM_H_INCLUDED +#define DEVICE_NAME_FORM_H_INCLUDED + +void create_device_name_form(void); + +#endif diff --git a/alsamixer/die.c b/alsamixer/die.c new file mode 100644 index 0000000..899a501 --- /dev/null +++ b/alsamixer/die.c @@ -0,0 +1,39 @@ +/* + * die.c - error handlers + * Copyright (c) Clemens Ladisch + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include "aconfig.h" +#include +#include +#include +#include "gettext_curses.h" +#include "mainloop.h" +#include "die.h" + +void fatal_error(const char *msg) +{ + app_shutdown(); + fprintf(stderr, "%s\n", msg); + exit(EXIT_FAILURE); +} + +void fatal_alsa_error(const char *msg, int err) +{ + app_shutdown(); + fprintf(stderr, _("%s: %s\n"), msg, snd_strerror(err)); + exit(EXIT_FAILURE); +} diff --git a/alsamixer/die.h b/alsamixer/die.h new file mode 100644 index 0000000..39ef1c0 --- /dev/null +++ b/alsamixer/die.h @@ -0,0 +1,7 @@ +#ifndef DIE_H_INCLUDED +#define DIE_H_INCLUDED + +void fatal_error(const char *msg) __attribute__((__noreturn__)); +void fatal_alsa_error(const char *msg, int err) __attribute__((__noreturn__)); + +#endif diff --git a/alsamixer/mainloop.c b/alsamixer/mainloop.c new file mode 100644 index 0000000..e67c0f8 --- /dev/null +++ b/alsamixer/mainloop.c @@ -0,0 +1,145 @@ +/* + * mainloop.c - main loop + * Copyright (c) Clemens Ladisch + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include "aconfig.h" +#include +#include +#include +#include +#include +#include +#include "mem.h" +#include "die.h" +#include "colors.h" +#include "widget.h" +#include "mixer_widget.h" +#include "mixer_display.h" +#include "mixer_controls.h" +#include "mainloop.h" + +static WINDOW *curses_initialized; + +static void black_hole_error_handler(const char *file, int line, + const char *function, int err, + const char *fmt, ...) +{ +} + +void initialize_curses(bool use_color, bool use_mouse) +{ + curses_initialized = initscr(); + cbreak(); + noecho(); +#ifdef HAVE_CURSES_ESCDELAY + set_escdelay(100); +#endif + window_size_changed(); /* update screen_lines/cols */ + init_colors(use_color); + if (use_mouse) + mousemask(ALL_MOUSE_EVENTS, NULL); + snd_lib_error_set_handler(black_hole_error_handler); +} + +void app_shutdown(void) +{ + if (curses_initialized) { + clear(); + refresh(); + curs_set(1); + endwin(); + } + mixer_shutdown(); +} + +void mainloop(void) +{ + struct pollfd *pollfds = NULL; + int nfds = 0, n; + const struct widget *active_widget; + unsigned short revents; + int key; + int err; + + for (;;) { + update_panels(); + doupdate(); + + active_widget = get_active_widget(); + if (!active_widget) + break; + + n = 1 + snd_mixer_poll_descriptors_count(mixer); + if (n != nfds) { + free(pollfds); + nfds = n; + pollfds = ccalloc(nfds, sizeof *pollfds); + pollfds[0].fd = fileno(stdin); + pollfds[0].events = POLLIN; + } + err = snd_mixer_poll_descriptors(mixer, &pollfds[1], nfds - 1); + if (err < 0) + fatal_alsa_error("cannot get poll descriptors", err); + n = poll(pollfds, nfds, -1); + if (n < 0) { + if (errno == EINTR) { + pollfds[0].revents = 0; + doupdate(); /* handle SIGWINCH */ + } else { + fatal_error("poll error"); + } + } + if (pollfds[0].revents & (POLLERR | POLLHUP | POLLNVAL)) + break; + if (pollfds[0].revents & POLLIN) + --n; + if (n > 0) { + err = snd_mixer_poll_descriptors_revents(mixer, &pollfds[1], nfds - 1, &revents); + if (err < 0) + fatal_alsa_error("cannot get poll events", err); + if (revents & (POLLERR | POLLNVAL)) + close_mixer_device(); + else if (revents & POLLIN) + snd_mixer_handle_events(mixer); + } + key = wgetch(active_widget->window); + while (key != ERR) { +#ifdef KEY_RESIZE + if (key == KEY_RESIZE) + window_size_changed(); + else +#endif + active_widget->handle_key(key); + active_widget = get_active_widget(); + if (!active_widget) + break; + key = wgetch(active_widget->window); + } + if (!active_widget) + break; + if (controls_changed) { + controls_changed = FALSE; + create_controls(); + control_values_changed = FALSE; + display_controls(); + } else if (control_values_changed) { + control_values_changed = FALSE; + display_controls(); + } + } + free(pollfds); +} diff --git a/alsamixer/mainloop.h b/alsamixer/mainloop.h new file mode 100644 index 0000000..d777e0f --- /dev/null +++ b/alsamixer/mainloop.h @@ -0,0 +1,10 @@ +#ifndef MAINLOOP_H_INCLUDED +#define MAINLOOP_H_INCLUDED + +#include CURSESINC + +void initialize_curses(bool use_color, bool use_mouse); +void mainloop(void); +void app_shutdown(void); + +#endif diff --git a/alsamixer/mem.c b/alsamixer/mem.c new file mode 100644 index 0000000..b6e1df2 --- /dev/null +++ b/alsamixer/mem.c @@ -0,0 +1,67 @@ +/* + * mem.c - memory allocation checkers + * Copyright (c) Clemens Ladisch + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include "aconfig.h" +#include +#include +#include +#include +#include +#include "die.h" +#include "mem.h" + +static void check(void *p) +{ + if (!p) + fatal_error("out of memory"); +} + +void *ccalloc(size_t n, size_t size) +{ + void *mem = calloc(n, size); + if (n && size) + check(mem); + return mem; +} + +void *crealloc(void *ptr, size_t new_size) +{ + ptr = realloc(ptr, new_size); + if (new_size) + check(ptr); + return ptr; +} + +char *cstrdup(const char *s) +{ + char *str = strdup(s); + check(str); + return str; +} + +char *casprintf(const char *fmt, ...) +{ + va_list ap; + char *str; + + va_start(ap, fmt); + if (vasprintf(&str, fmt, ap) < 0) + check(NULL); + va_end(ap); + return str; +} diff --git a/alsamixer/mem.h b/alsamixer/mem.h new file mode 100644 index 0000000..d0e5f54 --- /dev/null +++ b/alsamixer/mem.h @@ -0,0 +1,11 @@ +#ifndef MEM_H_INCLUDED +#define MEM_H_INCLUDED + +#include + +void *ccalloc(size_t n, size_t size); +void *crealloc(void *ptr, size_t new_size); +char *cstrdup(const char *s); +char *casprintf(const char *fmt, ...) __attribute__((__format__(printf, 1, 2))); + +#endif diff --git a/alsamixer/menu_widget.c b/alsamixer/menu_widget.c new file mode 100644 index 0000000..bf5ed52 --- /dev/null +++ b/alsamixer/menu_widget.c @@ -0,0 +1,92 @@ +#include "menu_widget.h" +#include "colors.h" +#include "utils.h" +#include "bindings.h" + +/* Returns + * - KEY_CANCEL: close is requested + * - KEY_ENTER: item is selected + * - -1: no action + */ +int menu_widget_handle_key(MENU *menu, int key) +{ + MEVENT m; + + switch (key) { + case 27: + case KEY_CANCEL: + case 'q': + case 'Q': + return KEY_CANCEL; + case '\n': + case '\r': + case KEY_ENTER: + return KEY_ENTER; + + case KEY_MOUSE: + switch (menu_driver(menu, KEY_MOUSE)) { + case E_UNKNOWN_COMMAND: + /* If you double-click an item a REQ_TOGGLE_ITEM is generated + * and E_UNKNOWN_COMMAND is returned. (man menu_driver) */ + return KEY_ENTER; + case E_REQUEST_DENIED: + /* If menu did not handle KEY_MOUSE is has to be removed from + * input queue to prevent an infinite loop. */ + key = wgetch(menu_win(menu)); + if (key == KEY_MOUSE) { + if (getmouse(&m) == ERR) + return -1; + if (m.bstate & (BUTTON4_PRESSED|BUTTON4_CLICKED)) + menu_driver(menu, REQ_UP_ITEM); +#if NCURSES_MOUSE_VERSION > 1 + else if (m.bstate & (BUTTON5_PRESSED|BUTTON5_CLICKED)) + menu_driver(menu, REQ_DOWN_ITEM); +#endif + else + return KEY_CANCEL; + } + else if (key > 0) + ungetch(key); + } + return -1; + + default: + if (key < ARRAY_SIZE(textbox_bindings)) { + key = textbox_bindings[key]; + if (key >= CMD_TEXTBOX___MIN_MENU_COMMAND && + key <= CMD_TEXTBOX___MAX_MENU_COMMAND) + menu_driver(menu, key + KEY_MAX); + } + + return -1; + } +} + +void menu_widget_create(struct widget *widget, MENU *menu, const char *title) +{ + int rows, columns; + + if (menu) + unpost_menu(menu); + + if (screen_lines < 3 || screen_cols < 10) { + widget->close(); + beep(); + return; + } + scale_menu(menu, &rows, &columns); + rows += 2; + columns += 2; + if (rows > screen_lines) + rows = screen_lines; + if (columns > screen_cols) + columns = screen_cols; + + widget_init(widget, rows, columns, SCREEN_CENTER, SCREEN_CENTER, + attrs.menu, WIDGET_BORDER | WIDGET_SUBWINDOW); + + mvwprintw(widget->window, 0, (columns - 2 - get_mbs_width(title)) / 2, " %s ", title); + set_menu_win(menu, widget->window); + set_menu_sub(menu, widget->subwindow); + post_menu(menu); +} diff --git a/alsamixer/menu_widget.h b/alsamixer/menu_widget.h new file mode 100644 index 0000000..e8e8a1e --- /dev/null +++ b/alsamixer/menu_widget.h @@ -0,0 +1,10 @@ +#ifndef MENU_WIDGET_H_INCLUDED +#define MENU_WIDGET_H_INCLUDED + +#include "widget.h" +#include + +int menu_widget_handle_key(MENU *menu, int key); +void menu_widget_create(struct widget *widget, MENU *menu, const char *title); + +#endif diff --git a/alsamixer/mixer_clickable.c b/alsamixer/mixer_clickable.c new file mode 100644 index 0000000..c772f37 --- /dev/null +++ b/alsamixer/mixer_clickable.c @@ -0,0 +1,136 @@ +#include +#include +#include "mixer_clickable.h" + +extern int screen_cols; +extern int screen_lines; + +static struct clickable_rect *clickable_rects = NULL; +static unsigned int clickable_rects_count = 0; +static unsigned int last_rect = 0; + +/* Using 0 instead of -1 for marking free rectangles allows us to use + * memset for `freeing` all rectangles at once. + * Zero is actually a valid coordinate in ncurses, but since we don't have + * any clickables in the top line this is fine. */ +#define FREE_MARKER 0 +#define RECT_IS_FREE(RECT) ((RECT).y1 == FREE_MARKER) +#define RECT_FREE(RECT) ((RECT).y1 = FREE_MARKER) + +void clickable_set(int y1, int x1, int y2, int x2, command_enum command, int arg1) { + struct clickable_rect* tmp; + unsigned int i; + + for (i = last_rect; i < clickable_rects_count; ++i) { + if (RECT_IS_FREE(clickable_rects[i])) { + last_rect = i; + goto SET_CLICKABLE_DATA; + } + } + + for (i = 0; i < last_rect; ++i) { + if (RECT_IS_FREE(clickable_rects[i])) { + last_rect = i; + goto SET_CLICKABLE_DATA; + } + } + + last_rect = clickable_rects_count; + tmp = realloc(clickable_rects, (clickable_rects_count + 8) * sizeof(*clickable_rects)); + if (!tmp) { + free(clickable_rects); + clickable_rects = NULL; + clickable_rects_count = 0; + last_rect = 0; + return; + } + clickable_rects = tmp; +#if FREE_MARKER == 0 + memset(clickable_rects + clickable_rects_count, 0, 8 * sizeof(*clickable_rects)); +#else + for (i = clickable_rects_count; i < clickable_rects_count + 8; ++i) + RECT_FREE(clickable_rects[i]); +#endif + clickable_rects_count += 8; + +SET_CLICKABLE_DATA: + clickable_rects[last_rect] = (struct clickable_rect) { + .y1 = y1, + .x1 = x1, + .x2 = x2, + .y2 = y2, + .command = command, + .arg1 = arg1 + }; +} + +void clickable_set_relative(WINDOW *win, int y1, int x1, int y2, int x2, command_enum command, int arg1) { + int y, x; + getyx(win, y, x); + y1 = y + y1; + x1 = x + x1; + y2 = y + y2; + x2 = x + x2; + clickable_set(y1, x1, y2, x2, command, arg1); +} + +void clickable_clear(int y1, int x1, int y2, int x2) { +#define IS_IN_RECT(Y, X) (Y >= y1 && Y <= y2 && X >= x1 && X <= x2) + unsigned int i; + + if (x1 == 0 && x2 == -1 && y2 == -1) { + if (y1 == 0) { + // Optimize case: clear all +#if FREE_MARKER == 0 + if (clickable_rects) + memset(clickable_rects, 0, + clickable_rects_count * sizeof(*clickable_rects)); +#else + for (i = 0; i < clickable_rects_count; ++i) + RECT_FREE(clickable_rects[i]); +#endif + } + else { + // Optimize case: clear all lines beyond y1 + for (i = 0; i < clickable_rects_count; ++i) { + if (clickable_rects[i].y2 >= y1) + RECT_FREE(clickable_rects[i]); + } + } + return; + } + + if (y2 < 0) + y2 = screen_lines + y2 + 1; + if (x2 < 0) + x2 = screen_cols + x2 + 1; + + for (i = 0; i < clickable_rects_count; ++i) { + if (!RECT_IS_FREE(clickable_rects[i]) && ( + IS_IN_RECT(clickable_rects[i].y1, clickable_rects[i].x1) || + IS_IN_RECT(clickable_rects[i].y2, clickable_rects[i].x2) + )) + { + RECT_FREE(clickable_rects[i]); + } + } +} + +struct clickable_rect* clickable_find(int y, int x) { + unsigned int i; + + for (i = 0; i < clickable_rects_count; ++i) { + if ( + !RECT_IS_FREE(clickable_rects[i]) && + y >= clickable_rects[i].y1 && + x >= clickable_rects[i].x1 && + y <= clickable_rects[i].y2 && + x <= clickable_rects[i].x2 + ) + { + return &clickable_rects[i]; + } + } + + return NULL; +} diff --git a/alsamixer/mixer_clickable.h b/alsamixer/mixer_clickable.h new file mode 100644 index 0000000..792c711 --- /dev/null +++ b/alsamixer/mixer_clickable.h @@ -0,0 +1,21 @@ +#ifndef MIXER_CLICKABLE_H +#define MIXER_CLICKABLE_H + +#include CURSESINC +#include "bindings.h" + +struct clickable_rect { + short y1; + short x1; + short y2; + short x2; + command_enum command; + int arg1; +}; + +void clickable_set(int y1, int x1, int y2, int x2, command_enum command, int arg1); +void clickable_set_relative(WINDOW *win, int y1, int x1, int y2, int x2, command_enum command, int arg1); +void clickable_clear(int y1, int x1, int y2, int x2); +struct clickable_rect* clickable_find(int y, int x); + +#endif diff --git a/alsamixer/mixer_controls.c b/alsamixer/mixer_controls.c new file mode 100644 index 0000000..9573517 --- /dev/null +++ b/alsamixer/mixer_controls.c @@ -0,0 +1,519 @@ +/* + * mixer_controls.c - handles mixer controls and mapping from selems + * Copyright (c) 1998,1999 Tim Janik + * Jaroslav Kysela + * Copyright (c) 2009 Clemens Ladisch + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include "aconfig.h" +#include +#include +#include +#include CURSESINC +#include +#include "utils.h" +#include "mem.h" +#include "mixer_display.h" +#include "mixer_widget.h" +#include "mixer_controls.h" + +struct control *controls; +unsigned int controls_count; + +static const snd_mixer_selem_channel_id_t supported_channels[] = { + SND_MIXER_SCHN_FRONT_LEFT, + SND_MIXER_SCHN_FRONT_RIGHT, + SND_MIXER_SCHN_REAR_LEFT, + SND_MIXER_SCHN_REAR_RIGHT, + SND_MIXER_SCHN_FRONT_CENTER, + SND_MIXER_SCHN_WOOFER, + SND_MIXER_SCHN_SIDE_LEFT, + SND_MIXER_SCHN_SIDE_RIGHT, +}; +#define LAST_SUPPORTED_CHANNEL SND_MIXER_SCHN_SIDE_RIGHT + +static const snd_mixer_selem_channel_id_t control_channels[][2] = { + { SND_MIXER_SCHN_FRONT_LEFT, SND_MIXER_SCHN_FRONT_RIGHT }, + { SND_MIXER_SCHN_REAR_LEFT, SND_MIXER_SCHN_REAR_RIGHT }, + { SND_MIXER_SCHN_FRONT_CENTER, SND_MIXER_SCHN_UNKNOWN }, + { SND_MIXER_SCHN_WOOFER, SND_MIXER_SCHN_UNKNOWN }, + { SND_MIXER_SCHN_SIDE_LEFT, SND_MIXER_SCHN_SIDE_RIGHT }, +}; + +bool are_there_any_controls(void) +{ + snd_mixer_elem_t *elem; + unsigned int i; + + for (elem = snd_mixer_first_elem(mixer); + elem; + elem = snd_mixer_elem_next(elem)) { + if (snd_mixer_elem_get_type(elem) != SND_MIXER_ELEM_SIMPLE) + continue; + if (snd_mixer_selem_is_enumerated(elem)) + return TRUE; + if (snd_mixer_selem_has_playback_volume_joined(elem) || + snd_mixer_selem_has_capture_volume_joined(elem) || + snd_mixer_selem_has_playback_switch_joined(elem) || + snd_mixer_selem_has_capture_switch_joined(elem)) + return TRUE; + for (i = 0; i < ARRAY_SIZE(supported_channels); ++i) + if (snd_mixer_selem_has_playback_channel(elem, supported_channels[i]) || + snd_mixer_selem_has_capture_channel(elem, supported_channels[i])) + return TRUE; + } + return FALSE; +} + +static bool has_more_than_front_capture_channels(snd_mixer_elem_t *elem) +{ + unsigned int i; + + for (i = 2; i < ARRAY_SIZE(supported_channels); ++i) + if (snd_mixer_selem_has_capture_channel(elem, supported_channels[i])) + return TRUE; + return FALSE; +} + +static bool has_any_control_channel(snd_mixer_elem_t *elem, + const snd_mixer_selem_channel_id_t channels[2], + int (*has_channel)(snd_mixer_elem_t *, snd_mixer_selem_channel_id_t)) +{ + return has_channel(elem, channels[0]) || + (channels[1] != SND_MIXER_SCHN_UNKNOWN && has_channel(elem, channels[1])); +} + +static bool has_merged_cswitch(snd_mixer_elem_t *elem) +{ + bool pvol, psw; + unsigned int i; + + pvol = snd_mixer_selem_has_playback_volume(elem); + psw = snd_mixer_selem_has_playback_switch(elem); + if ((pvol || psw) && + snd_mixer_selem_has_capture_switch(elem) && + !snd_mixer_selem_has_capture_volume(elem)) { + if (snd_mixer_selem_has_capture_switch_joined(elem)) + return TRUE; + else if (((pvol && snd_mixer_selem_has_playback_volume_joined(elem)) || + (psw && snd_mixer_selem_has_playback_switch_joined(elem))) && + has_more_than_front_capture_channels(elem)) + return FALSE; + for (i = 0; i < ARRAY_SIZE(control_channels); ++i) { + if (has_any_control_channel(elem, control_channels[i], snd_mixer_selem_has_capture_channel) && + !has_any_control_channel(elem, control_channels[i], snd_mixer_selem_has_playback_channel)) + return FALSE; + } + return TRUE; + } + return FALSE; +} + +static unsigned int get_playback_controls_count(snd_mixer_elem_t *elem) +{ + unsigned int count = 0; + unsigned int i; + int has_vol, has_sw; + + has_vol = snd_mixer_selem_has_playback_volume(elem); + has_sw = snd_mixer_selem_has_playback_switch(elem); + if (!has_vol && !has_sw) + return 0; + if ((!has_vol || snd_mixer_selem_has_playback_volume_joined(elem)) && + (!has_sw || snd_mixer_selem_has_playback_switch_joined(elem))) + return 1; + for (i = 0; i < ARRAY_SIZE(control_channels); ++i) { + if (snd_mixer_selem_has_playback_channel(elem, control_channels[i][0]) || + (control_channels[i][1] != SND_MIXER_SCHN_UNKNOWN && + snd_mixer_selem_has_playback_channel(elem, control_channels[i][1]))) + ++count; + } + return count; +} + +static unsigned int get_capture_controls_count(snd_mixer_elem_t *elem) +{ + unsigned int count = 0; + unsigned int i; + int has_vol, has_sw; + + has_vol = snd_mixer_selem_has_capture_volume(elem); + has_sw = snd_mixer_selem_has_capture_switch(elem); + if ((!has_vol && !has_sw) || + (view_mode == VIEW_MODE_ALL && has_merged_cswitch(elem))) + return 0; + if ((!has_vol || snd_mixer_selem_has_capture_volume_joined(elem)) && + (!has_sw || snd_mixer_selem_has_capture_switch_joined(elem))) + return 1; + for (i = 0; i < ARRAY_SIZE(control_channels); ++i) { + if (snd_mixer_selem_has_capture_channel(elem, control_channels[i][0]) || + (control_channels[i][1] != SND_MIXER_SCHN_UNKNOWN && + snd_mixer_selem_has_capture_channel(elem, control_channels[i][1]))) + ++count; + } + return count; +} + +static unsigned int get_controls_count_for_elem(snd_mixer_elem_t *elem) +{ + unsigned int p, c; + + if (snd_mixer_elem_get_type(elem) != SND_MIXER_ELEM_SIMPLE) + return 0; + if (snd_mixer_selem_is_enumerated(elem)) { + switch (view_mode) { + case VIEW_MODE_PLAYBACK: + return snd_mixer_selem_is_enum_capture(elem) ? 0 : 1; + case VIEW_MODE_CAPTURE: + return snd_mixer_selem_is_enum_capture(elem) ? 1 : 0; + case VIEW_MODE_ALL: + default: + return 1; + } + } + switch (view_mode) { + case VIEW_MODE_PLAYBACK: + return get_playback_controls_count(elem); + case VIEW_MODE_CAPTURE: + return get_capture_controls_count(elem); + case VIEW_MODE_ALL: + default: + p = get_playback_controls_count(elem); + c = get_capture_controls_count(elem); + return has_merged_cswitch(elem) ? p : p + c; + } +} + +static void create_name(struct control *control) +{ + unsigned int index; + char *s; + + index = snd_mixer_selem_get_index(control->elem); + if (index > 0) + control->name = casprintf("%s %u", snd_mixer_selem_get_name(control->elem), index); + else + control->name = cstrdup(snd_mixer_selem_get_name(control->elem)); + + while ((s = strstr(control->name, "IEC958")) != NULL) + memcpy(s, "S/PDIF", 6); +} + +static unsigned int create_controls_for_elem(snd_mixer_elem_t *elem, struct control *control) +{ + unsigned int count = 0; + unsigned int i; + unsigned int enum_index; + struct control *front_control = NULL; + bool has_pvol, has_psw; + bool has_cvol, has_csw; + bool has_channel[LAST_SUPPORTED_CHANNEL + 1]; + bool merged_cswitch; + bool has_ch0, has_ch1; + + if (snd_mixer_elem_get_type(elem) != SND_MIXER_ELEM_SIMPLE) + return 0; + if (snd_mixer_selem_is_enumerated(elem)) { + if ((view_mode == VIEW_MODE_PLAYBACK && snd_mixer_selem_is_enum_capture(elem)) || + (view_mode == VIEW_MODE_CAPTURE && !snd_mixer_selem_is_enum_capture(elem))) + return 0; + control->elem = elem; + control->flags = TYPE_ENUM; + control->enum_channel_bits = 0; + for (i = 0; i <= SND_MIXER_SCHN_LAST; ++i) + if (snd_mixer_selem_get_enum_item(control->elem, (snd_mixer_selem_channel_id_t)i, &enum_index) >= 0) + control->enum_channel_bits |= 1 << i; + if (snd_mixer_selem_is_active(control->elem)) + control->flags |= IS_ACTIVE; + create_name(control); + return 1; + } + has_pvol = snd_mixer_selem_has_playback_volume(elem); + has_psw = snd_mixer_selem_has_playback_switch(elem); + has_cvol = snd_mixer_selem_has_capture_volume(elem); + has_csw = snd_mixer_selem_has_capture_switch(elem); + merged_cswitch = view_mode == VIEW_MODE_ALL && has_merged_cswitch(elem); + if (view_mode != VIEW_MODE_CAPTURE && (has_pvol || has_psw)) { + if ((!has_pvol || snd_mixer_selem_has_playback_volume_joined(elem)) && + (!has_psw || snd_mixer_selem_has_playback_switch_joined(elem))) { + control->elem = elem; + if (has_pvol) { + control->flags |= TYPE_PVOLUME | HAS_VOLUME_0; + control->volume_channels[0] = 0; + } + if (has_psw) { + control->flags |= TYPE_PSWITCH | HAS_PSWITCH_0; + control->pswitch_channels[0] = 0; + } + if (merged_cswitch) { + control->flags |= TYPE_CSWITCH; + if (snd_mixer_selem_has_capture_switch_joined(elem)) { + control->flags |= HAS_CSWITCH_0; + control->cswitch_channels[0] = 0; + } else { + if (snd_mixer_selem_has_capture_channel(elem, control_channels[0][0])) { + control->flags |= HAS_CSWITCH_0; + control->cswitch_channels[0] = control_channels[0][0]; + } + if (control_channels[0][1] != SND_MIXER_SCHN_UNKNOWN && + snd_mixer_selem_has_capture_channel(elem, control_channels[0][1])) { + control->flags |= HAS_CSWITCH_1; + control->cswitch_channels[1] = control_channels[0][1]; + } + } + if ((control->flags & (HAS_CSWITCH_0 | HAS_CSWITCH_1)) == HAS_CSWITCH_1) { + control->flags ^= HAS_CSWITCH_0 | HAS_CSWITCH_1; + control->cswitch_channels[0] = control->cswitch_channels[1]; + } + } + if (snd_mixer_selem_is_active(control->elem)) + control->flags |= IS_ACTIVE; + create_name(control); + ++control; + ++count; + } else { + for (i = 0; i < ARRAY_SIZE(supported_channels); ++i) + has_channel[supported_channels[i]] = + snd_mixer_selem_has_playback_channel(elem, supported_channels[i]); + for (i = 0; i < ARRAY_SIZE(control_channels); ++i) { + has_ch0 = has_channel[control_channels[i][0]]; + has_ch1 = control_channels[i][1] != SND_MIXER_SCHN_UNKNOWN && + has_channel[control_channels[i][1]]; + if (!has_ch0 && !has_ch1) + continue; + control->elem = elem; + if (has_pvol) { + control->flags |= TYPE_PVOLUME; + if (snd_mixer_selem_has_playback_volume_joined(elem)) { + control->flags |= HAS_VOLUME_0; + control->volume_channels[0] = 0; + } else { + if (has_ch0) { + control->flags |= HAS_VOLUME_0; + control->volume_channels[0] = control_channels[i][0]; + } + if (has_ch1) { + control->flags |= HAS_VOLUME_1; + control->volume_channels[1] = control_channels[i][1]; + } + } + } + if (has_psw) { + control->flags |= TYPE_PSWITCH; + if (snd_mixer_selem_has_playback_switch_joined(elem)) { + control->flags |= HAS_PSWITCH_0; + control->pswitch_channels[0] = 0; + } else { + if (has_ch0) { + control->flags |= HAS_PSWITCH_0; + control->pswitch_channels[0] = control_channels[i][0]; + } + if (has_ch1) { + control->flags |= HAS_PSWITCH_1; + control->pswitch_channels[1] = control_channels[i][1]; + } + } + } + if (merged_cswitch) { + control->flags |= TYPE_CSWITCH; + if (snd_mixer_selem_has_capture_switch_joined(elem)) { + control->flags |= HAS_CSWITCH_0; + control->cswitch_channels[0] = 0; + } else { + if (snd_mixer_selem_has_capture_channel(elem, control_channels[i][0])) { + control->flags |= HAS_CSWITCH_0; + control->cswitch_channels[0] = control_channels[i][0]; + } + if (control_channels[i][1] != SND_MIXER_SCHN_UNKNOWN && + snd_mixer_selem_has_capture_channel(elem, control_channels[i][1])) { + control->flags |= HAS_CSWITCH_1; + control->cswitch_channels[1] = control_channels[i][1]; + } + } + } + if ((control->flags & (HAS_VOLUME_0 | HAS_VOLUME_1)) == HAS_VOLUME_1) { + control->flags ^= HAS_VOLUME_0 | HAS_VOLUME_1; + control->volume_channels[0] = control->volume_channels[1]; + } + if ((control->flags & (HAS_PSWITCH_0 | HAS_PSWITCH_1)) == HAS_PSWITCH_1) { + control->flags ^= HAS_PSWITCH_0 | HAS_PSWITCH_1; + control->pswitch_channels[0] = control->pswitch_channels[1]; + } + if ((control->flags & (HAS_CSWITCH_0 | HAS_CSWITCH_1)) == HAS_CSWITCH_1) { + control->flags ^= HAS_CSWITCH_0 | HAS_CSWITCH_1; + control->cswitch_channels[0] = control->cswitch_channels[1]; + } + if (snd_mixer_selem_is_active(control->elem)) + control->flags |= IS_ACTIVE; + create_name(control); + if (i == 0) + front_control = control; + else { + front_control->flags |= IS_MULTICH | 0; + control->flags |= IS_MULTICH | i; + } + ++control; + ++count; + } + } + } + if (view_mode != VIEW_MODE_PLAYBACK && (has_cvol || has_csw) && !merged_cswitch) { + if ((!has_cvol || snd_mixer_selem_has_capture_volume_joined(elem)) && + (!has_csw || snd_mixer_selem_has_capture_switch_joined(elem))) { + control->elem = elem; + if (has_cvol) { + control->flags |= TYPE_CVOLUME | HAS_VOLUME_0; + control->volume_channels[0] = 0; + } + if (has_csw) { + control->flags |= TYPE_CSWITCH | HAS_CSWITCH_0; + control->cswitch_channels[0] = 0; + } + if (snd_mixer_selem_is_active(control->elem)) + control->flags |= IS_ACTIVE; + create_name(control); + ++control; + ++count; + } else { + for (i = 0; i < ARRAY_SIZE(supported_channels); ++i) + has_channel[supported_channels[i]] = + snd_mixer_selem_has_capture_channel(elem, supported_channels[i]); + for (i = 0; i < ARRAY_SIZE(control_channels); ++i) { + has_ch0 = has_channel[control_channels[i][0]]; + has_ch1 = control_channels[i][1] != SND_MIXER_SCHN_UNKNOWN && + has_channel[control_channels[i][1]]; + if (!has_ch0 && !has_ch1) + continue; + control->elem = elem; + if (has_cvol) { + control->flags |= TYPE_CVOLUME; + if (snd_mixer_selem_has_capture_volume_joined(elem)) { + control->flags |= HAS_VOLUME_0; + control->volume_channels[0] = 0; + } else { + if (has_ch0) { + control->flags |= HAS_VOLUME_0; + control->volume_channels[0] = control_channels[i][0]; + } + if (has_ch1) { + control->flags |= HAS_VOLUME_1; + control->volume_channels[1] = control_channels[i][1]; + } + } + } + if (has_csw) { + control->flags |= TYPE_CSWITCH; + if (snd_mixer_selem_has_capture_switch_joined(elem)) { + control->flags |= HAS_CSWITCH_0; + control->cswitch_channels[0] = 0; + } else { + if (has_ch0) { + control->flags |= HAS_CSWITCH_0; + control->cswitch_channels[0] = control_channels[i][0]; + } + if (has_ch1) { + control->flags |= HAS_CSWITCH_1; + control->cswitch_channels[1] = control_channels[i][1]; + } + } + } + if ((control->flags & (HAS_VOLUME_0 | HAS_VOLUME_1)) == HAS_VOLUME_1) { + control->flags ^= HAS_VOLUME_0 | HAS_VOLUME_1; + control->volume_channels[0] = control->volume_channels[1]; + } + if ((control->flags & (HAS_CSWITCH_0 | HAS_CSWITCH_1)) == HAS_CSWITCH_1) { + control->flags ^= HAS_CSWITCH_0 | HAS_CSWITCH_1; + control->cswitch_channels[0] = control->cswitch_channels[1]; + } + if (snd_mixer_selem_is_active(control->elem)) + control->flags |= IS_ACTIVE; + create_name(control); + if (i == 0) + front_control = control; + else { + front_control->flags |= IS_MULTICH | 0; + control->flags |= IS_MULTICH | i; + } + ++control; + ++count; + } + } + } + return count; +} + +static void search_for_focus_control(void) +{ + snd_mixer_elem_t *elem; + unsigned int i; + + elem = snd_mixer_find_selem(mixer, current_selem_id); + if (elem) + for (i = 0; i < controls_count; ++i) + if (controls[i].elem == elem) { + focus_control_index = i; + for (;;) { + ++i; + if (i >= controls_count || controls[i].elem != elem) + return; + if (controls[i].flags == current_control_flags) { + focus_control_index = i; + return; + } + } + } + focus_control_index = 0; +} + +void free_controls(void) +{ + unsigned int i; + + for (i = 0; i < controls_count; ++i) + free(controls[i].name); + free(controls); + controls = NULL; + controls_count = 0; +} + +void create_controls(void) +{ + snd_mixer_elem_t *elem; + struct control *control; + + free_controls(); + + for (elem = snd_mixer_first_elem(mixer); + elem; + elem = snd_mixer_elem_next(elem)) + controls_count += get_controls_count_for_elem(elem); + + if (controls_count > 0) { + controls = ccalloc(controls_count, sizeof *controls); + control = controls; + for (elem = snd_mixer_first_elem(mixer); + elem; + elem = snd_mixer_elem_next(elem)) + control += create_controls_for_elem(elem, control); + assert(control == controls + controls_count); + } + + compute_controls_layout(); + display_view_mode(); + + search_for_focus_control(); + refocus_control(); +} diff --git a/alsamixer/mixer_controls.h b/alsamixer/mixer_controls.h new file mode 100644 index 0000000..dbb3a9d --- /dev/null +++ b/alsamixer/mixer_controls.h @@ -0,0 +1,37 @@ +#ifndef MIXER_CONTROLS_H_INCLUDED +#define MIXER_CONTROLS_H_INCLUDED + +#include + +struct control { + snd_mixer_elem_t *elem; + char *name; + unsigned int flags; +#define TYPE_PVOLUME (1u << 4) +#define TYPE_CVOLUME (1u << 5) +#define TYPE_PSWITCH (1u << 6) +#define TYPE_CSWITCH (1u << 7) +#define TYPE_ENUM (1u << 8) +#define HAS_VOLUME_0 (1u << 9) +#define HAS_VOLUME_1 (1u << 10) +#define HAS_PSWITCH_0 (1u << 11) +#define HAS_PSWITCH_1 (1u << 12) +#define HAS_CSWITCH_0 (1u << 13) +#define HAS_CSWITCH_1 (1u << 14) +#define IS_MULTICH (1u << 15) +#define IS_ACTIVE (1u << 16) +#define MULTICH_MASK (0x0000f) + snd_mixer_selem_channel_id_t volume_channels[2]; + snd_mixer_selem_channel_id_t pswitch_channels[2]; + snd_mixer_selem_channel_id_t cswitch_channels[2]; + unsigned int enum_channel_bits; +}; + +extern struct control *controls; +extern unsigned int controls_count; + +bool are_there_any_controls(void); +void create_controls(void); +void free_controls(void); + +#endif diff --git a/alsamixer/mixer_display.c b/alsamixer/mixer_display.c new file mode 100644 index 0000000..882781d --- /dev/null +++ b/alsamixer/mixer_display.c @@ -0,0 +1,763 @@ +/* + * mixer_display.c - handles displaying of mixer widget and controls + * Copyright (c) 1874 Lewis Carroll + * Copyright (c) 2009 Clemens Ladisch + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#define _C99_SOURCE /* lrint() */ +#include "aconfig.h" +#include +#include +#include +#include +#include CURSESINC +#include +#include "gettext_curses.h" +#include "utils.h" +#include "mem.h" +#include "colors.h" +#include "widget.h" +#include "volume_mapping.h" +#include "mixer_widget.h" +#include "mixer_controls.h" +#include "mixer_display.h" +#include "mixer_clickable.h" + +enum align { + ALIGN_LEFT, + ALIGN_RIGHT, + ALIGN_CENTER, +}; + +static bool screen_too_small; +static bool has_info_items; + +static int info_items_left; +static int info_items_width; + +static int visible_controls; +static int first_visible_control_index; +static int first_control_x; +static int control_width; +static int control_name_width; + +static int base_y; +static int volume_height; +static int cswitch_y; +static int values_y; +static int name_y; +static int channel_name_y; + +static void display_string_in_field(int y, int x, const char *s, int width, enum align align) +{ + int string_width; + const char *s_end; + int spaces; + int cur_y, cur_x; + + wmove(mixer_widget.window, y, x); + string_width = width; + s_end = mbs_at_width(s, &string_width, -1); + if (string_width >= width) { + waddnstr(mixer_widget.window, s, s_end - s); + } else { + if (align != ALIGN_LEFT) { + spaces = width - string_width; + if (align == ALIGN_CENTER) + spaces /= 2; + if (spaces > 0) + wprintw(mixer_widget.window, "%*s", spaces, ""); + } + waddstr(mixer_widget.window, s); + if (align != ALIGN_RIGHT) { + getyx(mixer_widget.window, cur_y, cur_x); + if (cur_y == y) { + spaces = x + width - cur_x; + if (spaces > 0) + wprintw(mixer_widget.window, "%*s", spaces, ""); + } + } + } +} + +void init_mixer_layout(void) +{ + const char *labels_left[4] = { + _("Card:"), + _("Chip:"), + _("View:"), + _("Item:"), + }; + const char *labels_right[4] = { + _("F1: Help"), + _("F2: System information"), + _("F6: Select sound card"), + _("Esc: Exit"), + }; + unsigned int label_width_left, label_width_right; + unsigned int right_x, i; + + clickable_clear(0, 0, -1, -1); + screen_too_small = screen_lines < 14 || screen_cols < 12; + has_info_items = screen_lines >= 6; + if (!has_info_items) + return; + + label_width_left = get_max_mbs_width(labels_left, 4); + label_width_right = get_max_mbs_width(labels_right, 4); + if (2 + label_width_left + 1 + 28 + label_width_right + 2 > screen_cols) + label_width_right = 0; + if (2 + label_width_left + 1 + 28 + label_width_right + 2 > screen_cols) + label_width_left = 0; + + info_items_left = label_width_left ? 3 + label_width_left : 2; + right_x = screen_cols - label_width_right - 2; + info_items_width = right_x - info_items_left; + if (info_items_width < 1) { + has_info_items = FALSE; + return; + } + + wattrset(mixer_widget.window, attrs.mixer_text); + if (label_width_left) + for (i = 0; i < 4; ++i) + display_string_in_field(1 + i, 2, labels_left[i], + label_width_left, ALIGN_RIGHT); + if (label_width_right) + for (i = 0; i < 4; ++i) { + display_string_in_field(1 + i, right_x, labels_right[i], + label_width_right, ALIGN_LEFT); + clickable_set(1 + i, right_x, 1 + i, right_x + label_width_right - 1, + CMD_MIXER_HELP + i, -1); + } +} + +void display_card_info(void) +{ + snd_hctl_t *hctl; + snd_ctl_t *ctl; + snd_ctl_card_info_t *card_info; + const char *card_name = NULL; + const char *mixer_name = NULL; + int err; + + if (!has_info_items) + return; + + snd_ctl_card_info_alloca(&card_info); + if (mixer_device_name) + err = snd_mixer_get_hctl(mixer, mixer_device_name, &hctl); + else + err = -1; + if (err >= 0) { + ctl = snd_hctl_ctl(hctl); + err = snd_ctl_card_info(ctl, card_info); + if (err >= 0) { + card_name = snd_ctl_card_info_get_name(card_info); + mixer_name = snd_ctl_card_info_get_mixername(card_info); + } + } + + if (card_name) + wattrset(mixer_widget.window, attrs.mixer_active); + else { + wattrset(mixer_widget.window, attrs.mixer_text); + if (unplugged) + card_name = _("(unplugged)"); + else + card_name = "-"; + } + display_string_in_field(1, info_items_left, card_name, info_items_width, ALIGN_LEFT); + + if (mixer_name) + wattrset(mixer_widget.window, attrs.mixer_active); + else { + wattrset(mixer_widget.window, attrs.mixer_text); + mixer_name = "-"; + } + display_string_in_field(2, info_items_left, mixer_name, info_items_width, ALIGN_LEFT); +} + +void display_view_mode(void) +{ + const char *modes[3] = { + _("Playback"), + _("Capture"), + _("All"), + }; + unsigned int widths[3]; + bool has_view_mode; + int i; + + clickable_clear(3, 0, 3, 30); + if (!has_info_items) + return; + + has_view_mode = controls_count > 0 || are_there_any_controls(); + for (i = 0; i < 3; ++i) + widths[i] = get_mbs_width(modes[i]); + if (4 + widths[0] + 6 + widths[1] + 6 + widths[2] + 1 <= info_items_width) { + wmove(mixer_widget.window, 3, info_items_left - 1); + wattrset(mixer_widget.window, attrs.mixer_text); + for (i = 0; i < 3; ++i) { + wprintw(mixer_widget.window, " F%c:", '3' + i); + if (has_view_mode && (int)view_mode == i) { + wattrset(mixer_widget.window, attrs.mixer_active); + wprintw(mixer_widget.window, "[%s]", modes[i]); + wattrset(mixer_widget.window, attrs.mixer_text); + } else { + wprintw(mixer_widget.window, " %s ", modes[i]); + } + clickable_set_relative(mixer_widget.window, 0, -(widths[i] + 5), 0, -1, + CMD_WITH_ARG(CMD_MIXER_SET_VIEW_MODE, i), -1); + } + } else { + wattrset(mixer_widget.window, attrs.mixer_active); + display_string_in_field(3, info_items_left, + has_view_mode ? modes[view_mode] : "", + info_items_width, ALIGN_LEFT); + } +} + +static char *format_gain(long db) +{ + if (db != SND_CTL_TLV_DB_GAIN_MUTE) + return casprintf("%.2f", db / 100.0); + else + return cstrdup(_("mute")); +} + +static void display_focus_item_info(void) +{ + struct control *control; + unsigned int index; + char buf[64]; + long db, db2; + int sw, sw2; + char *dbs, *dbs2; + char *value_info; + char *item_info; + int err; + + if (!has_info_items) + return; + wattrset(mixer_widget.window, attrs.mixer_active); + if (!controls_count || screen_too_small) { + display_string_in_field(4, info_items_left, "", info_items_width, ALIGN_LEFT); + return; + } + control = &controls[focus_control_index]; + value_info = NULL; + if (control->flags & TYPE_ENUM) { + err = snd_mixer_selem_get_enum_item(control->elem, ffs(control->enum_channel_bits) - 1, &index); + if (err >= 0) + err = snd_mixer_selem_get_enum_item_name(control->elem, index, sizeof buf - 1, buf); + if (err >= 0) + value_info = casprintf(" [%s]", buf); + } else if (control->flags & (TYPE_PVOLUME | TYPE_CVOLUME)) { + int (*get_vol_func)(snd_mixer_elem_t *, snd_mixer_selem_channel_id_t, long *); + + if (control->flags & TYPE_PVOLUME) + get_vol_func = snd_mixer_selem_get_playback_dB; + else + get_vol_func = snd_mixer_selem_get_capture_dB; + if (!(control->flags & HAS_VOLUME_1)) { + err = get_vol_func(control->elem, control->volume_channels[0], &db); + if (err >= 0) { + dbs = format_gain(db); + value_info = casprintf(" [%s %s]", _("dB gain:"), dbs); + free(dbs); + } + } else { + err = get_vol_func(control->elem, control->volume_channels[0], &db); + if (err >= 0) + err = get_vol_func(control->elem, control->volume_channels[1], &db2); + if (err >= 0) { + dbs = format_gain(db); + dbs2 = format_gain(db2); + value_info = casprintf(_(" [%s %s, %s]"), _("dB gain:"), dbs, dbs2); + free(dbs); + free(dbs2); + } + } + } else if (control->flags & TYPE_PSWITCH) { + if (!(control->flags & HAS_PSWITCH_1)) { + err = snd_mixer_selem_get_playback_switch(control->elem, control->pswitch_channels[0], &sw); + if (err >= 0 && !sw) + value_info = casprintf(" [%s]", _("Off")); + } else { + err = snd_mixer_selem_get_playback_switch(control->elem, control->pswitch_channels[0], &sw); + if (err >= 0) + err = snd_mixer_selem_get_playback_switch(control->elem, control->pswitch_channels[1], &sw2); + if (err >= 0 && (!sw || !sw2)) + value_info = casprintf(" [%s, %s]", sw ? _("On") : _("Off"), sw2 ? _("On") : _("Off")); + } + } else if (control->flags & TYPE_CSWITCH) { + if (!(control->flags & HAS_CSWITCH_1)) { + err = snd_mixer_selem_get_capture_switch(control->elem, control->cswitch_channels[0], &sw); + if (err >= 0 && !sw) + value_info = casprintf(" [%s]", _("Off")); + } else { + err = snd_mixer_selem_get_capture_switch(control->elem, control->cswitch_channels[0], &sw); + if (err >= 0) + err = snd_mixer_selem_get_capture_switch(control->elem, control->cswitch_channels[1], &sw2); + if (err >= 0 && (!sw || !sw2)) + value_info = casprintf(" [%s, %s]", sw ? _("On") : _("Off"), sw2 ? _("On") : _("Off")); + } + } + item_info = casprintf("%s%s", control->name, value_info ? value_info : ""); + free(value_info); + display_string_in_field(4, info_items_left, item_info, info_items_width, ALIGN_LEFT); + free(item_info); +} + +static void clear_controls_display(void) +{ + int i; + + clickable_clear(5, 0, -1, -1); + wattrset(mixer_widget.window, attrs.mixer_frame); + for (i = 5; i < screen_lines - 1; ++i) + mvwprintw(mixer_widget.window, i, 1, "%*s", screen_cols - 2, ""); +} + +static void center_string(int line, const char *s) +{ + int width = get_mbs_width(s); + if (width <= screen_cols - 2) + mvwaddstr(mixer_widget.window, line, (screen_cols - width) / 2, s); +} + +static void display_unplugged(void) +{ + int lines, top, left; + bool boojum; + + lines = screen_lines - 6; + if (lines < 2) + return; + top = lines / 2; + boojum = lines >= 10 && screen_cols >= 48; + top -= boojum ? 5 : 1; + if (top < 5) + top = 5; + if (boojum) { + left = (screen_cols - 46) / 2; + wattrset(mixer_widget.window, attrs.mixer_text); + mvwaddstr(mixer_widget.window, top + 0, left, "In the midst of the word he was trying to say,"); + mvwaddstr(mixer_widget.window, top + 1, left + 2, "In the midst of his laughter and glee,"); + mvwaddstr(mixer_widget.window, top + 2, left, "He had softly and suddenly vanished away---"); + mvwaddstr(mixer_widget.window, top + 3, left + 2, "For the Snark was a Boojum, you see."); + mvwchgat(mixer_widget.window, top + 3, left + 16, 3, /* ^^^ */ + attrs.mixer_text | A_BOLD, PAIR_NUMBER(attrs.mixer_text), NULL); + mvwaddstr(mixer_widget.window, top + 5, left, "(Lewis Carroll, \"The Hunting of the Snark\")"); + top += 8; + } + wattrset(mixer_widget.window, attrs.errormsg); + center_string(top, _("The sound device was unplugged.")); + center_string(top + 1, _("Press F6 to select another sound card.")); +} + +static void display_no_controls(void) +{ + int y; + const char *msg; + + y = (screen_lines - 6) / 2 - 1; + if (y < 5) + y = 5; + if (y >= screen_lines - 1) + return; + wattrset(mixer_widget.window, attrs.infomsg); + if (view_mode == VIEW_MODE_PLAYBACK && are_there_any_controls()) + msg = _("This sound device does not have any playback controls."); + else if (view_mode == VIEW_MODE_CAPTURE && are_there_any_controls()) + msg = _("This sound device does not have any capture controls."); + else + msg = _("This sound device does not have any controls."); + center_string(y, msg); +} + +static void display_string_centered_in_control(int y, int col, const char *s, int width) +{ + int left, x; + + left = first_control_x + col * (control_width + 1); + x = left + (control_width - width) / 2; + display_string_in_field(y, x, s, width, ALIGN_CENTER); +} + +static void display_control(unsigned int control_index) +{ + struct control *control; + int col; + int i, c; + int left, frame_left; + int bar_height; + double volumes[2]; + int switches[2]; + unsigned int index; + const char *s; + char buf[64]; + int err; + + control = &controls[control_index]; + col = control_index - first_visible_control_index; + left = first_control_x + col * (control_width + 1); + frame_left = left + (control_width - 4) / 2; + if (control->flags & IS_ACTIVE) + wattrset(mixer_widget.window, attrs.ctl_frame); + else + wattrset(mixer_widget.window, attrs.ctl_inactive); + if (control->flags & (TYPE_PVOLUME | TYPE_CVOLUME)) { + mvwaddch(mixer_widget.window, base_y - volume_height - 1, frame_left, ACS_ULCORNER); + waddch(mixer_widget.window, ACS_HLINE); + waddch(mixer_widget.window, ACS_HLINE); + waddch(mixer_widget.window, ACS_URCORNER); + mvwvline(mixer_widget.window, base_y - volume_height, frame_left, ACS_VLINE, volume_height); + mvwvline(mixer_widget.window, base_y - volume_height, frame_left + 3, ACS_VLINE, volume_height); + mvwaddch(mixer_widget.window, base_y, frame_left, + control->flags & TYPE_PSWITCH ? ACS_LTEE : ACS_LLCORNER); + waddch(mixer_widget.window, ACS_HLINE); + waddch(mixer_widget.window, ACS_HLINE); + waddch(mixer_widget.window, + control->flags & TYPE_PSWITCH ? ACS_RTEE : ACS_LRCORNER); + } else if (control->flags & TYPE_PSWITCH) { + mvwaddch(mixer_widget.window, base_y, frame_left, ACS_ULCORNER); + waddch(mixer_widget.window, ACS_HLINE); + waddch(mixer_widget.window, ACS_HLINE); + waddch(mixer_widget.window, ACS_URCORNER); + } + if (control->flags & TYPE_PSWITCH) { + mvwaddch(mixer_widget.window, base_y + 1, frame_left, ACS_VLINE); + mvwaddch(mixer_widget.window, base_y + 1, frame_left + 3, ACS_VLINE); + mvwaddch(mixer_widget.window, base_y + 2, frame_left, ACS_LLCORNER); + waddch(mixer_widget.window, ACS_HLINE); + waddch(mixer_widget.window, ACS_HLINE); + waddch(mixer_widget.window, ACS_LRCORNER); + } + if (control->flags & (TYPE_PVOLUME | TYPE_CVOLUME)) { + double (*get_vol_func)(snd_mixer_elem_t *, snd_mixer_selem_channel_id_t); + + if (control->flags & TYPE_PVOLUME) + get_vol_func = get_normalized_playback_volume; + else + get_vol_func = get_normalized_capture_volume; + volumes[0] = get_vol_func(control->elem, control->volume_channels[0]); + if (control->flags & HAS_VOLUME_1) + volumes[1] = get_vol_func(control->elem, control->volume_channels[1]); + else + volumes[1] = volumes[0]; + + if (control->flags & IS_ACTIVE) + wattrset(mixer_widget.window, 0); + for (c = 0; c < 2; c++) { + bar_height = lrint(volumes[c] * volume_height); + for (i = 0; i < volume_height; ++i) { + chtype ch; + if (i + 1 > bar_height) + ch = ' ' | (control->flags & IS_ACTIVE ? + attrs.ctl_frame : 0); + else { + ch = ACS_CKBOARD; + if (!(control->flags & IS_ACTIVE)) + ; +#ifdef TRICOLOR_VOLUME_BAR + else if (i > volume_height * 8 / 10) + ch |= attrs.ctl_bar_hi; + else if (i > volume_height * 4 / 10) + ch |= attrs.ctl_bar_mi; +#endif + else + ch |= attrs.ctl_bar_lo; + } + mvwaddch(mixer_widget.window, base_y - i - 1, + frame_left + c + 1, ch); + } + } + clickable_set(base_y - volume_height, frame_left + 1, base_y, frame_left + 2, + CMD_MIXER_MOUSE_CLICK_VOLUME_BAR, control_index); + if (control->flags & IS_ACTIVE) + wattrset(mixer_widget.window, attrs.mixer_active); + if (!(control->flags & HAS_VOLUME_1)) { + sprintf(buf, "%d", (int)lrint(volumes[0] * 100)); + display_string_in_field(values_y, frame_left - 2, buf, 8, ALIGN_CENTER); + } else { + mvwprintw(mixer_widget.window, values_y, frame_left - 2, + "%3d", (int)lrint(volumes[0] * 100)); + if (control->flags & IS_ACTIVE) + wattrset(mixer_widget.window, attrs.ctl_frame); + waddstr(mixer_widget.window, "<>"); + if (control->flags & IS_ACTIVE) + wattrset(mixer_widget.window, attrs.mixer_active); + wprintw(mixer_widget.window, "%-3d", (int)lrint(volumes[1] * 100)); + } + } + + if (control->flags & TYPE_PSWITCH) { + err = snd_mixer_selem_get_playback_switch(control->elem, control->pswitch_channels[0], &switches[0]); + if (err >= 0 && (control->flags & HAS_PSWITCH_1)) + err = snd_mixer_selem_get_playback_switch(control->elem, control->pswitch_channels[1], &switches[1]); + else + switches[1] = switches[0]; + if (err < 0) + return; + if (control->flags & IS_ACTIVE) + wattrset(mixer_widget.window, 0); + mvwaddch(mixer_widget.window, base_y + 1, frame_left + 1, + switches[0] + /* TRANSLATORS: playback on; one character */ + ? _("O")[0] | (control->flags & IS_ACTIVE ? attrs.ctl_nomute : 0) + /* TRANSLATORS: playback muted; one character */ + : _("M")[0] | (control->flags & IS_ACTIVE ? attrs.ctl_mute : 0)); + waddch(mixer_widget.window, + switches[1] + ? _("O")[0] | (control->flags & IS_ACTIVE ? attrs.ctl_nomute : 0) + : _("M")[0] | (control->flags & IS_ACTIVE ? attrs.ctl_mute : 0)); + clickable_set(base_y + 1, frame_left + 1, base_y + 1, frame_left + 2, + CMD_MIXER_MOUSE_CLICK_MUTE, control_index); + } + + if (control->flags & TYPE_CSWITCH) { + err = snd_mixer_selem_get_capture_switch(control->elem, control->cswitch_channels[0], &switches[0]); + if (err >= 0 && (control->flags & HAS_CSWITCH_1)) + err = snd_mixer_selem_get_capture_switch(control->elem, control->cswitch_channels[1], &switches[1]); + else + switches[1] = switches[0]; + if (err < 0) + return; + if (control->flags & IS_ACTIVE) + wattrset(mixer_widget.window, switches[0] ? attrs.ctl_capture : attrs.ctl_nocapture); + /* TRANSLATORS: "left"; no more than two characters */ + display_string_in_field(cswitch_y - 1, frame_left - 2, switches[0] ? _("L") : "", 2, ALIGN_RIGHT); + clickable_set(cswitch_y - 1, frame_left - 2, cswitch_y - 1, frame_left - 1, + CMD_WITH_ARG(CMD_MIXER_TOGGLE_CAPTURE, LEFT), control_index); + if (control->flags & IS_ACTIVE) + wattrset(mixer_widget.window, switches[1] ? attrs.ctl_capture : attrs.ctl_nocapture); + /* TRANSLATORS: "right"; no more than two characters */ + display_string_in_field(cswitch_y - 1, frame_left + 4, switches[1] ? _("R") : "", 2, ALIGN_LEFT); + clickable_set(cswitch_y - 1, frame_left + 4, cswitch_y - 1, frame_left + 5, + CMD_WITH_ARG(CMD_MIXER_TOGGLE_CAPTURE, RIGHT), control_index); + /* TRANSLATORS: no more than eight characters */ + s = _("CAPTURE"); + if (switches[0] || switches[1]) { + if (control->flags & IS_ACTIVE) + wattrset(mixer_widget.window, attrs.ctl_capture); + display_string_in_field(cswitch_y, frame_left - 2, s, 8, ALIGN_CENTER); + } else { + i = get_mbs_width(s); + if (i > 8) + i = 8; + memset(buf, '-', i); + buf[i] = '\0'; + if (control->flags & IS_ACTIVE) + wattrset(mixer_widget.window, attrs.ctl_nocapture); + display_string_in_field(cswitch_y, frame_left - 2, buf, 8, ALIGN_CENTER); + } + clickable_set(cswitch_y, frame_left - 2, cswitch_y, frame_left - 2 + 8, + CMD_WITH_ARG(CMD_MIXER_TOGGLE_CAPTURE, LEFT|RIGHT), control_index); + } + + if (control->flags & TYPE_ENUM) { + err = snd_mixer_selem_get_enum_item(control->elem, ffs(control->enum_channel_bits) - 1, &index); + if (err < 0) + return; + err = snd_mixer_selem_get_enum_item_name(control->elem, index, sizeof buf - 1, buf); + if (err < 0) + return; + if (control->flags & IS_ACTIVE) + wattrset(mixer_widget.window, attrs.mixer_active); + display_string_centered_in_control(base_y, col, buf, control_width); + clickable_set_relative(mixer_widget.window, 0, -control_name_width, 0, -2, + CMD_MIXER_MOUSE_CLICK_CONTROL_ENUM, control_index); + } + + if (control_index == focus_control_index) { + i = first_control_x + col * (control_width + 1) + (control_width - control_name_width) / 2; + wattrset(mixer_widget.window, attrs.ctl_mark_focus); + mvwaddch(mixer_widget.window, name_y, i - 1, '<'); + mvwaddch(mixer_widget.window, name_y, i + control_name_width, '>'); + if (control->flags & IS_ACTIVE) + wattrset(mixer_widget.window, attrs.ctl_label_focus); + else + wattrset(mixer_widget.window, attrs.ctl_label_inactive); + } else { + if (control->flags & IS_ACTIVE) + wattrset(mixer_widget.window, attrs.ctl_label); + else + wattrset(mixer_widget.window, attrs.ctl_label_inactive); + } + display_string_centered_in_control(name_y, col, control->name, control_name_width); + clickable_set_relative(mixer_widget.window, -1, -control_name_width, 0, -2, + CMD_WITH_ARG(CMD_MIXER_FOCUS_CONTROL, control_index), -1); + if (channel_name_y > name_y) { + if (control->flags & IS_MULTICH) { + switch (control->flags & MULTICH_MASK) { + case 0: + default: + s = _("Front"); + break; + case 1: + s = _("Rear"); + break; + case 2: + s = _("Center"); + break; + case 3: + s = _("Woofer"); + break; + case 4: + s = _("Side"); + break; + } + } else { + s = ""; + wattrset(mixer_widget.window, attrs.mixer_frame); + } + display_string_centered_in_control(channel_name_y, col, s, + control_name_width); + } +} + +static void display_scroll_indicators(void) +{ + int y0, y1, y; + chtype left, right; + + if (screen_too_small) + return; + y0 = screen_lines * 3 / 8; + y1 = screen_lines * 5 / 8; + left = first_visible_control_index > 0 ? ACS_LARROW : ACS_VLINE; + right = first_visible_control_index + visible_controls < controls_count + ? ACS_RARROW : ACS_VLINE; + wattrset(mixer_widget.window, attrs.mixer_frame); + mvwvline(mixer_widget.window, y0, 0, left, y1 - y0 + 1); + mvwvline(mixer_widget.window, y0, screen_cols -1, right, y1 - y0 + 1); + clickable_set(y0, 0, y1, 0, + CMD_WITH_ARG(CMD_MIXER_PREVIOUS, visible_controls), -1); + clickable_set(y0, screen_cols - 1, y1, screen_cols - 1, + CMD_WITH_ARG(CMD_MIXER_NEXT, visible_controls), -1); +} + +void display_controls(void) +{ + unsigned int i; + + if (first_visible_control_index > controls_count - visible_controls) + first_visible_control_index = controls_count - visible_controls; + if (first_visible_control_index > focus_control_index) + first_visible_control_index = focus_control_index; + else if (first_visible_control_index < focus_control_index - visible_controls + 1 && visible_controls) + first_visible_control_index = focus_control_index - visible_controls + 1; + + clear_controls_display(); + + display_focus_item_info(); + + if (controls_count > 0) { + if (!screen_too_small) + for (i = 0; i < visible_controls; ++i) + display_control(first_visible_control_index + i); + } else if (unplugged) { + display_unplugged(); + } else if (mixer_device_name) { + display_no_controls(); + } + display_scroll_indicators(); +} + +void compute_controls_layout(void) +{ + bool any_volume, any_pswitch, any_cswitch, any_multich; + int max_width, name_len; + int height, space; + unsigned int i; + + if (controls_count == 0 || screen_too_small) { + visible_controls = 0; + return; + } + + any_volume = FALSE; + any_pswitch = FALSE; + any_cswitch = FALSE; + any_multich = FALSE; + for (i = 0; i < controls_count; ++i) { + if (controls[i].flags & (TYPE_PVOLUME | TYPE_CVOLUME)) + any_volume = 1; + if (controls[i].flags & TYPE_PSWITCH) + any_pswitch = 1; + if (controls[i].flags & TYPE_CSWITCH) + any_cswitch = 1; + if (controls[i].flags & IS_MULTICH) + any_multich = 1; + } + + max_width = 8; + for (i = 0; i < controls_count; ++i) { + name_len = strlen(controls[i].name); + if (name_len > max_width) + max_width = name_len; + } + max_width = (max_width + 1) & ~1; + + control_width = (screen_cols - 3 - (int)controls_count) / controls_count; + if (control_width < 8) + control_width = 8; + if (control_width > max_width) + control_width = max_width; + if (control_width > screen_cols - 4) + control_width = screen_cols - 4; + + visible_controls = (screen_cols - 3) / (control_width + 1); + if (visible_controls > controls_count) + visible_controls = controls_count; + + first_control_x = 2 + (screen_cols - 3 - visible_controls * (control_width + 1)) / 2; + + if (control_width < max_width) + control_name_width = control_width; + else + control_name_width = max_width; + + height = 2; + if (any_volume) + height += 2; + if (any_pswitch) + height += 2; + if (any_cswitch) + height += 1; + if (any_multich) + height += 1; + if (any_volume) { + space = screen_lines - 6 - height; + if (space <= 1) + volume_height = 1; + else if (space <= 10) + volume_height = space; + else + volume_height = 10 + (space - 10) / 2; + height += volume_height; + } + + space = screen_lines - 6 - height; + channel_name_y = screen_lines - 2 - space / 2; + name_y = channel_name_y - any_multich; + values_y = name_y - any_volume; + cswitch_y = values_y - any_cswitch; + base_y = cswitch_y - 1 - 2 * any_pswitch; +} diff --git a/alsamixer/mixer_display.h b/alsamixer/mixer_display.h new file mode 100644 index 0000000..3d65670 --- /dev/null +++ b/alsamixer/mixer_display.h @@ -0,0 +1,10 @@ +#ifndef MIXER_DISPLAY_H_INCLUDED +#define MIXER_DISPLAY_H_INCLUDED + +void init_mixer_layout(void); +void display_card_info(void); +void display_view_mode(void); +void display_controls(void); +void compute_controls_layout(void); + +#endif diff --git a/alsamixer/mixer_widget.c b/alsamixer/mixer_widget.c new file mode 100644 index 0000000..027b1a2 --- /dev/null +++ b/alsamixer/mixer_widget.c @@ -0,0 +1,668 @@ +/* + * mixer_widget.c - mixer widget and keys handling + * Copyright (c) 1998,1999 Tim Janik + * Jaroslav Kysela + * Copyright (c) 2009 Clemens Ladisch + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include "aconfig.h" +#include +#include +#include +#include +#include "gettext_curses.h" +#include "version.h" +#include "utils.h" +#include "die.h" +#include "mem.h" +#include "colors.h" +#include "widget.h" +#include "textbox.h" +#include "proc_files.h" +#include "card_select.h" +#include "volume_mapping.h" +#include "mixer_clickable.h" +#include "mixer_controls.h" +#include "mixer_display.h" +#include "mixer_widget.h" +#include "bindings.h" + +snd_mixer_t *mixer; +char *mixer_device_name; +bool unplugged; + +struct widget mixer_widget; + +enum view_mode view_mode; + +int focus_control_index; +snd_mixer_selem_id_t *current_selem_id; +unsigned int current_control_flags; + +bool control_values_changed; +bool controls_changed; + +unsigned int mouse_wheel_step = 1; +bool mouse_wheel_focuses_control = 1; + +static int elem_callback(snd_mixer_elem_t *elem, unsigned int mask) +{ + if (mask == SND_CTL_EVENT_MASK_REMOVE) { + controls_changed = TRUE; + } else { + if (mask & SND_CTL_EVENT_MASK_VALUE) + control_values_changed = TRUE; + + if (mask & SND_CTL_EVENT_MASK_INFO) + controls_changed = TRUE; + } + + return 0; +} + +static int mixer_callback(snd_mixer_t *mixer, unsigned int mask, snd_mixer_elem_t *elem) +{ + if (mask & SND_CTL_EVENT_MASK_ADD) { + snd_mixer_elem_set_callback(elem, elem_callback); + controls_changed = TRUE; + } + return 0; +} + +void create_mixer_object(struct snd_mixer_selem_regopt *selem_regopt) +{ + int err; + + err = snd_mixer_open(&mixer, 0); + if (err < 0) + fatal_alsa_error(_("cannot open mixer"), err); + + mixer_device_name = cstrdup(selem_regopt->device); + err = snd_mixer_selem_register(mixer, selem_regopt, NULL); + if (err < 0) + fatal_alsa_error(_("cannot open mixer"), err); + + snd_mixer_set_callback(mixer, mixer_callback); + + err = snd_mixer_load(mixer); + if (err < 0) + fatal_alsa_error(_("cannot load mixer controls"), err); + + err = snd_mixer_selem_id_malloc(¤t_selem_id); + if (err < 0) + fatal_error("out of memory"); +} + +static void set_view_mode(enum view_mode m) +{ + view_mode = m; + create_controls(); +} + +static void close_hctl(void) +{ + free_controls(); + if (mixer_device_name) { + snd_mixer_detach(mixer, mixer_device_name); + free(mixer_device_name); + mixer_device_name = NULL; + } +} + +static void check_unplugged(void) +{ + snd_hctl_t *hctl; + snd_ctl_t *ctl; + unsigned int state; + int err; + + unplugged = FALSE; + if (mixer_device_name) { + err = snd_mixer_get_hctl(mixer, mixer_device_name, &hctl); + if (err >= 0) { + ctl = snd_hctl_ctl(hctl); + /* just any random function that does an ioctl() */ + err = snd_ctl_get_power_state(ctl, &state); + if (err == -ENODEV) + unplugged = TRUE; + } + } +} + +void close_mixer_device(void) +{ + check_unplugged(); + close_hctl(); + + display_card_info(); + set_view_mode(view_mode); +} + +bool select_card_by_name(const char *device_name) +{ + int err; + bool opened; + char *msg; + + close_hctl(); + unplugged = FALSE; + + opened = FALSE; + if (device_name) { + err = snd_mixer_attach(mixer, device_name); + if (err >= 0) + opened = TRUE; + else { + msg = casprintf(_("Cannot open mixer device '%s'."), device_name); + show_alsa_error(msg, err); + free(msg); + } + } + if (opened) { + mixer_device_name = cstrdup(device_name); + + err = snd_mixer_load(mixer); + if (err < 0) + fatal_alsa_error(_("cannot load mixer controls"), err); + } + + display_card_info(); + set_view_mode(view_mode); + return opened; +} + +static void show_help(void) +{ + const char *help[] = { + _("Esc Exit"), + _("F1 ? H Help"), + _("F2 / System information"), + _("F3 Show playback controls"), + _("F4 Show capture controls"), + _("F5 Show all controls"), + _("Tab Toggle view mode (F3/F4/F5)"), + _("F6 S Select sound card"), + _("L Redraw screen"), + "", + _("Left Move to the previous control"), + _("Right Move to the next control"), + "", + _("Up/Down Change volume"), + _("+ - Change volume"), + _("Page Up/Dn Change volume in big steps"), + _("End Set volume to 0%"), + _("0-9 Set volume to 0%-90%"), + _("Q W E Increase left/both/right volumes"), + /* TRANSLATORS: or Y instead of Z */ + _("Z X C Decrease left/both/right volumes"), + _("B Balance left and right volumes"), + "", + _("M Toggle mute"), + /* TRANSLATORS: or , . */ + _("< > Toggle left/right mute"), + "", + _("Space Toggle capture"), + /* TRANSLATORS: or Insert Delete */ + _("; ' Toggle left/right capture"), + "", + _("Authors:"), + _(" Tim Janik"), + _(" Jaroslav Kysela "), + _(" Clemens Ladisch "), + }; + show_text(help, ARRAY_SIZE(help), _("Help")); +} + +void refocus_control(void) +{ + if (focus_control_index < controls_count) { + snd_mixer_selem_get_id(controls[focus_control_index].elem, current_selem_id); + current_control_flags = controls[focus_control_index].flags; + } + + display_controls(); +} + +static struct control *get_focus_control(unsigned int type) +{ + if (focus_control_index >= 0 && + focus_control_index < controls_count && + (controls[focus_control_index].flags & IS_ACTIVE) && + (controls[focus_control_index].flags & type)) + return &controls[focus_control_index]; + else + return NULL; +} + +static void change_enum_to_percent(struct control *control, int value) +{ + unsigned int i; + unsigned int index; + unsigned int new_index; + int items; + int err; + + i = ffs(control->enum_channel_bits) - 1; + err = snd_mixer_selem_get_enum_item(control->elem, i, &index); + if (err < 0) + return; + new_index = index; + if (value == 0) { + new_index = 0; + } else if (value == 100) { + items = snd_mixer_selem_get_enum_items(control->elem); + if (items < 1) + return; + new_index = items - 1; + } + if (new_index == index) + return; + for (i = 0; i <= SND_MIXER_SCHN_LAST; ++i) + if (control->enum_channel_bits & (1 << i)) + snd_mixer_selem_set_enum_item(control->elem, i, new_index); +} + +static void change_enum_relative(struct control *control, int delta) +{ + int items; + unsigned int i; + unsigned int index; + int new_index; + int err; + + items = snd_mixer_selem_get_enum_items(control->elem); + if (items < 1) + return; + err = snd_mixer_selem_get_enum_item(control->elem, 0, &index); + if (err < 0) + return; + new_index = (int)index + delta; + if (new_index < 0) + new_index = 0; + else if (new_index >= items) + new_index = items - 1; + if (new_index == index) + return; + for (i = 0; i <= SND_MIXER_SCHN_LAST; ++i) + if (control->enum_channel_bits & (1 << i)) + snd_mixer_selem_set_enum_item(control->elem, i, new_index); +} + +static void change_volume_to_percent(struct control *control, int value, unsigned int channels) +{ + int (*set_func)(snd_mixer_elem_t *, snd_mixer_selem_channel_id_t, double, int); + + if (!(control->flags & HAS_VOLUME_1)) + channels = LEFT; + if (control->flags & TYPE_PVOLUME) + set_func = set_normalized_playback_volume; + else + set_func = set_normalized_capture_volume; + if (channels & LEFT) + set_func(control->elem, control->volume_channels[0], value / 100.0, 0); + if (channels & RIGHT) + set_func(control->elem, control->volume_channels[1], value / 100.0, 0); +} + +static double clamp_volume(double v) +{ + if (v < 0) + return 0; + if (v > 1) + return 1; + return v; +} + +static void change_volume_relative(struct control *control, int delta, unsigned int channels) +{ + double (*get_func)(snd_mixer_elem_t *, snd_mixer_selem_channel_id_t); + int (*set_func)(snd_mixer_elem_t *, snd_mixer_selem_channel_id_t, double, int); + double left, right; + int dir; + + if (!(control->flags & HAS_VOLUME_1)) + channels = LEFT; + if (control->flags & TYPE_PVOLUME) { + get_func = get_normalized_playback_volume; + set_func = set_normalized_playback_volume; + } else { + get_func = get_normalized_capture_volume; + set_func = set_normalized_capture_volume; + } + if (channels & LEFT) + left = get_func(control->elem, control->volume_channels[0]); + if (channels & RIGHT) + right = get_func(control->elem, control->volume_channels[1]); + dir = delta > 0 ? 1 : -1; + if (channels & LEFT) { + left = clamp_volume(left + delta / 100.0); + set_func(control->elem, control->volume_channels[0], left, dir); + } + if (channels & RIGHT) { + right = clamp_volume(right + delta / 100.0); + set_func(control->elem, control->volume_channels[1], right, dir); + } +} + +static void change_control_to_percent(int value, unsigned int channels) +{ + struct control *control; + + control = get_focus_control(TYPE_PVOLUME | TYPE_CVOLUME | TYPE_ENUM); + if (!control) + return; + if (control->flags & TYPE_ENUM) + change_enum_to_percent(control, value); + else + change_volume_to_percent(control, value, channels); + display_controls(); +} + +static void change_control_relative(int delta, unsigned int channels) +{ + struct control *control; + + control = get_focus_control(TYPE_PVOLUME | TYPE_CVOLUME | TYPE_ENUM); + if (!control) + return; + if (control->flags & TYPE_ENUM) + change_enum_relative(control, delta); + else + change_volume_relative(control, delta, channels); + display_controls(); +} + +static void toggle_switches(unsigned int type, unsigned int channels) +{ + struct control *control; + unsigned int switch_1_mask; + int (*get_func)(snd_mixer_elem_t *, snd_mixer_selem_channel_id_t, int *); + int (*set_func)(snd_mixer_elem_t *, snd_mixer_selem_channel_id_t, int); + snd_mixer_selem_channel_id_t channel_ids[2]; + int left, right; + int err; + + control = get_focus_control(type); + if (!control) + return; + if (type == TYPE_PSWITCH) { + switch_1_mask = HAS_PSWITCH_1; + get_func = snd_mixer_selem_get_playback_switch; + set_func = snd_mixer_selem_set_playback_switch; + channel_ids[0] = control->pswitch_channels[0]; + channel_ids[1] = control->pswitch_channels[1]; + } else { + switch_1_mask = HAS_CSWITCH_1; + get_func = snd_mixer_selem_get_capture_switch; + set_func = snd_mixer_selem_set_capture_switch; + channel_ids[0] = control->cswitch_channels[0]; + channel_ids[1] = control->cswitch_channels[1]; + } + if (!(control->flags & switch_1_mask)) + channels = LEFT; + if (channels & LEFT) { + err = get_func(control->elem, channel_ids[0], &left); + if (err < 0) + return; + } + if (channels & RIGHT) { + err = get_func(control->elem, channel_ids[1], &right); + if (err < 0) + return; + } + if (channels & LEFT) + set_func(control->elem, channel_ids[0], !left); + if (channels & RIGHT) + set_func(control->elem, channel_ids[1], !right); + display_controls(); +} + +static void toggle_mute(unsigned int channels) +{ + toggle_switches(TYPE_PSWITCH, channels); +} + +static void toggle_capture(unsigned int channels) +{ + toggle_switches(TYPE_CSWITCH, channels); +} + +static void balance_volumes(void) +{ + struct control *control; + double left, right; + + control = get_focus_control(TYPE_PVOLUME | TYPE_CVOLUME); + if (!control || !(control->flags & HAS_VOLUME_1)) + return; + if (control->flags & TYPE_PVOLUME) { + left = get_normalized_playback_volume(control->elem, control->volume_channels[0]); + right = get_normalized_playback_volume(control->elem, control->volume_channels[1]); + } else { + left = get_normalized_capture_volume(control->elem, control->volume_channels[0]); + right = get_normalized_capture_volume(control->elem, control->volume_channels[1]); + } + left = (left + right) / 2; + if (control->flags & TYPE_PVOLUME) { + set_normalized_playback_volume(control->elem, control->volume_channels[0], left, 0); + set_normalized_playback_volume(control->elem, control->volume_channels[1], left, 0); + } else { + set_normalized_capture_volume(control->elem, control->volume_channels[0], left, 0); + set_normalized_capture_volume(control->elem, control->volume_channels[1], left, 0); + } + display_controls(); +} + +static int on_mouse_key() { + MEVENT m; + command_enum cmd = 0; + unsigned int channels = LEFT | RIGHT; + unsigned int index; + struct control *control; + struct clickable_rect *rect; + + if (getmouse(&m) == ERR) + return 0; + + if (m.bstate & ( + BUTTON1_PRESSED|BUTTON1_RELEASED| + BUTTON2_PRESSED|BUTTON2_RELEASED| + BUTTON3_PRESSED|BUTTON3_RELEASED)) + return 0; + + rect = clickable_find(m.y, m.x); + if (rect) + cmd = rect->command; + +#if NCURSES_MOUSE_VERSION > 1 + if (m.bstate & (BUTTON4_CLICKED|BUTTON4_PRESSED|BUTTON5_CLICKED|BUTTON5_PRESSED)) { + switch (cmd) { + case CMD_MIXER_MOUSE_CLICK_CONTROL_ENUM: + focus_control_index = rect->arg1; + return CMD_WITH_ARG(( + m.bstate & (BUTTON4_CLICKED|BUTTON4_PRESSED) + ? CMD_MIXER_CONTROL_UP + : CMD_MIXER_CONTROL_DOWN + ), 1); + + case CMD_MIXER_MOUSE_CLICK_VOLUME_BAR: + if (mouse_wheel_focuses_control) + focus_control_index = rect->arg1; + + default: + return CMD_WITH_ARG(( + m.bstate & (BUTTON4_CLICKED|BUTTON4_PRESSED) + ? CMD_MIXER_CONTROL_UP + : CMD_MIXER_CONTROL_DOWN + ), mouse_wheel_step); + } + } +#endif + + /* If the rectangle has got an argument (value != -1) it is used for + * setting `focus_control_index` */ + if (rect && rect->arg1 >= 0) + focus_control_index = rect->arg1; + + switch (cmd) { + case CMD_MIXER_MOUSE_CLICK_VOLUME_BAR: + if (m.bstate & (BUTTON3_CLICKED|BUTTON3_DOUBLE_CLICKED|BUTTON3_TRIPLE_CLICKED)) + channels = m.x - rect->x1 + 1; + return CMD_WITH_ARG(CMD_MIXER_CONTROL_SET_PERCENT_LEFT + channels - 1, + (100 * (rect->y2 - m.y) / (rect->y2 - rect->y1)) // volume + ); + + case CMD_MIXER_MOUSE_CLICK_MUTE: + if (m.bstate & (BUTTON3_CLICKED|BUTTON3_DOUBLE_CLICKED|BUTTON3_TRIPLE_CLICKED)) + channels = m.x - rect->x1 + 1; + return CMD_WITH_ARG(CMD_MIXER_TOGGLE_MUTE, channels); + + case CMD_MIXER_MOUSE_CLICK_CONTROL_ENUM: + control = get_focus_control(TYPE_ENUM); + if (control && + (snd_mixer_selem_get_enum_item(control->elem, 0, &index) >= 0)) { + return (index == 0 + ? CMD_WITH_ARG(CMD_MIXER_CONTROL_UP, 100) + : CMD_WITH_ARG(CMD_MIXER_CONTROL_DOWN, 1)); + } + break; + + default: + return cmd; // non-mouse command + } + + return 0; // failed mouse command +} + +static void on_handle_key(int key) +{ + int arg; + command_enum cmd; + + if (key == KEY_MOUSE) + cmd = on_mouse_key(); + else if (key < ARRAY_SIZE(mixer_bindings)) + cmd = mixer_bindings[key]; + else + return; + + arg = CMD_GET_ARGUMENT(cmd); + cmd = CMD_GET_COMMAND(cmd); + + switch (cmd) { + case CMD_MIXER_CONTROL_DOWN_LEFT: + case CMD_MIXER_CONTROL_DOWN_RIGHT: + case CMD_MIXER_CONTROL_DOWN: + arg = (-arg); + case CMD_MIXER_CONTROL_UP_LEFT: + case CMD_MIXER_CONTROL_UP_RIGHT: + case CMD_MIXER_CONTROL_UP: + change_control_relative(arg, cmd % 4); + break; + case CMD_MIXER_CONTROL_SET_PERCENT_LEFT: + case CMD_MIXER_CONTROL_SET_PERCENT_RIGHT: + case CMD_MIXER_CONTROL_SET_PERCENT: + change_control_to_percent(arg, cmd % 4); + break; + case CMD_MIXER_CLOSE: + mixer_widget.close(); + break; + case CMD_MIXER_HELP: + show_help(); + break; + case CMD_MIXER_SYSTEM_INFORMATION: + create_proc_files_list(); + break; + case CMD_MIXER_TOGGLE_VIEW_MODE: + arg = (view_mode + 1) % VIEW_MODE_COUNT; + case CMD_MIXER_SET_VIEW_MODE: + set_view_mode((enum view_mode)(arg)); + break; + case CMD_MIXER_SELECT_CARD: + create_card_select_list(); + break; + case CMD_MIXER_REFRESH: + clearok(mixer_widget.window, TRUE); + display_controls(); + break; + case CMD_MIXER_PREVIOUS: + arg = (-arg); + case CMD_MIXER_NEXT: + arg = focus_control_index + arg; + case CMD_MIXER_FOCUS_CONTROL: + focus_control_index = arg; + if (focus_control_index < 0) + focus_control_index = 0; + else if (focus_control_index >= controls_count) + focus_control_index = controls_count - 1; + refocus_control(); + break; + case CMD_MIXER_TOGGLE_MUTE: + toggle_mute(arg); + break; + case CMD_MIXER_TOGGLE_CAPTURE: + toggle_capture(arg); + break; + case CMD_MIXER_BALANCE_CONTROL: + balance_volumes(); + break; + } +} + +static void create(void) +{ + static const char title[] = " AlsaMixer v" SND_UTIL_VERSION_STR " "; + + widget_init(&mixer_widget, screen_lines, screen_cols, 0, 0, + attrs.mixer_frame, WIDGET_BORDER); + if (screen_cols >= (sizeof(title) - 1) + 2) { + wattrset(mixer_widget.window, attrs.mixer_active); + mvwaddstr(mixer_widget.window, 0, (screen_cols - (sizeof(title) - 1)) / 2, title); + } + init_mixer_layout(); + display_card_info(); + set_view_mode(view_mode); +} + +static void on_window_size_changed(void) +{ + create(); +} + +static void on_close(void) +{ + widget_free(&mixer_widget); +} + +void mixer_shutdown(void) +{ + free_controls(); + if (mixer) + snd_mixer_close(mixer); + if (current_selem_id) + snd_mixer_selem_id_free(current_selem_id); +} + +struct widget mixer_widget = { + .handle_key = on_handle_key, + .window_size_changed = on_window_size_changed, + .close = on_close, +}; + +void create_mixer_widget(void) +{ + create(); +} diff --git a/alsamixer/mixer_widget.h b/alsamixer/mixer_widget.h new file mode 100644 index 0000000..3b6f474 --- /dev/null +++ b/alsamixer/mixer_widget.h @@ -0,0 +1,45 @@ +#ifndef MIXER_WIDGET_H_INCLUDED +#define MIXER_WIDGET_H_INCLUDED + +#include CURSESINC +#include +#include "widget.h" + +enum view_mode { + VIEW_MODE_PLAYBACK, + VIEW_MODE_CAPTURE, + VIEW_MODE_ALL, + VIEW_MODE_COUNT, +}; + +enum channel_mask { + LEFT = 1, + RIGHT = 2, +}; + +extern snd_mixer_t *mixer; +extern char *mixer_device_name; +extern bool unplugged; + +extern struct widget mixer_widget; + +extern enum view_mode view_mode; + +extern int focus_control_index; +extern snd_mixer_selem_id_t *current_selem_id; +extern unsigned int current_control_flags; + +extern bool control_values_changed; +extern bool controls_changed; + +extern unsigned int mouse_wheel_step; +extern bool mouse_wheel_focuses_control; + +void create_mixer_object(struct snd_mixer_selem_regopt *selem_regopt); +void create_mixer_widget(void); +void mixer_shutdown(void); +void close_mixer_device(void); +bool select_card_by_name(const char *device_name); +void refocus_control(void); + +#endif diff --git a/alsamixer/proc_files.c b/alsamixer/proc_files.c new file mode 100644 index 0000000..0ca003b --- /dev/null +++ b/alsamixer/proc_files.c @@ -0,0 +1,107 @@ +/* + * proc_files.c - shows ALSA system information files + * Copyright (c) Clemens Ladisch + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include "aconfig.h" +#include +#include +#include +#include "gettext_curses.h" +#include "utils.h" +#include "die.h" +#include "mem.h" +#include "colors.h" +#include "widget.h" +#include "textbox.h" +#include "proc_files.h" +#include "menu_widget.h" + +static struct widget proc_widget; +static ITEM *items[7]; +static unsigned int items_count; +static MENU *menu; + +static void on_handle_key(int key) +{ + ITEM *item; + + switch (menu_widget_handle_key(menu, key)) { + case KEY_ENTER: + item = current_item(menu); + if (item) + show_textfile(item_name(item)); + break; + case KEY_CANCEL: + proc_widget.close(); + break; + } +} + +static void create(void) +{ + menu_widget_create(&proc_widget, menu, _("Select File")); +} + +static void on_close(void) +{ + unsigned int i; + + unpost_menu(menu); + free_menu(menu); + for (i = 0; i < items_count; ++i) + free_item(items[i]); + widget_free(&proc_widget); +} + +static void add_item(const char *file_name) +{ + if (access(file_name, F_OK) == 0) { + items[items_count] = new_item(file_name, NULL); + if (!items[items_count]) + fatal_error("cannot create menu item"); + ++items_count; + assert(items_count < ARRAY_SIZE(items)); + } +} + +static struct widget proc_widget = { + .handle_key = on_handle_key, + .window_size_changed = create, + .close = on_close, +}; + +void create_proc_files_list(void) +{ + items_count = 0; + add_item("/proc/asound/version"); + add_item("/proc/asound/cards"); + add_item("/proc/asound/devices"); + add_item("/proc/asound/oss/devices"); + add_item("/proc/asound/timers"); + add_item("/proc/asound/pcm"); + items[items_count] = NULL; + + menu = new_menu(items); + if (!menu) + fatal_error("cannot create menu"); + set_menu_fore(menu, attrs.menu_selected); + set_menu_back(menu, attrs.menu); + set_menu_mark(menu, NULL); + menu_opts_off(menu, O_SHOWDESC); + + create(); +} diff --git a/alsamixer/proc_files.h b/alsamixer/proc_files.h new file mode 100644 index 0000000..8862c71 --- /dev/null +++ b/alsamixer/proc_files.h @@ -0,0 +1,6 @@ +#ifndef PROC_FILES_H_INCLUDED +#define PROC_FILES_H_INCLUDED + +void create_proc_files_list(void); + +#endif diff --git a/alsamixer/textbox.c b/alsamixer/textbox.c new file mode 100644 index 0000000..ebac9fa --- /dev/null +++ b/alsamixer/textbox.c @@ -0,0 +1,335 @@ +/* + * textbox.c - show a text box for messages, files or help + * Copyright (c) 1998,1999 Tim Janik + * Jaroslav Kysela + * Copyright (c) 2009 Clemens Ladisch + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include "aconfig.h" +#include +#include +#include +#include +#include CURSESINC +#include +#include "gettext_curses.h" +#include "utils.h" +#include "die.h" +#include "mem.h" +#include "colors.h" +#include "widget.h" +#include "textbox.h" +#include "bindings.h" + +static void create_text_box(const char *const *lines, unsigned int count, + const char *title, int attrs); + +void show_error(const char *msg, int err) +{ + const char *lines[2]; + unsigned int count; + + lines[0] = msg; + count = 1; + if (err) { + lines[1] = strerror(err); + count = 2; + } + create_text_box(lines, count, _("Error"), attrs.errormsg); +} + +void show_alsa_error(const char *msg, int err) +{ + const char *lines[2]; + unsigned int count; + + lines[0] = msg; + count = 1; + if (err < 0) { + lines[1] = snd_strerror(err); + count = 2; + } + create_text_box(lines, count, _("Error"), attrs.errormsg); +} + +void show_textfile(const char *file_name) +{ + char *buf; + unsigned int file_size; + unsigned int line_count; + unsigned int i; + const char **lines; + const char *start_line; + + buf = read_file(file_name, &file_size); + if (!buf) { + int err = errno; + buf = casprintf(_("Cannot open file \"%s\"."), file_name); + show_error(buf, err); + return; + } + line_count = 0; + for (i = 0; i < file_size; ++i) + line_count += buf[i] == '\n'; + lines = ccalloc(line_count, sizeof *lines); + line_count = 0; + start_line = buf; + for (i = 0; i < file_size; ++i) { + if (buf[i] == '\n') { + lines[line_count++] = start_line; + buf[i] = '\0'; + start_line = &buf[i + 1]; + } + if (buf[i] == '\t') + buf[i] = ' '; + } + create_text_box(lines, line_count, file_name, attrs.textbox); + free(lines); + free(buf); +} + +void show_text(const char *const *lines, unsigned int count, const char *title) +{ + create_text_box(lines, count, title, attrs.textbox); +} + +/**********************************************************************/ + +static struct widget text_widget; +static char *title; +static int widget_attrs; +static char **text_lines; +static unsigned int text_lines_count; +static int max_line_width; +static int text_box_y; +static int text_box_x; +static int max_scroll_y; +static int max_scroll_x; +static int current_top; +static int current_left; + +static void update_text_lines(void) +{ + int i; + int width; + const char *line_begin; + const char *line_end; + int cur_y, cur_x; + int rest_of_line; + + for (i = 0; i < text_box_y; ++i) { + width = current_left; + line_begin = mbs_at_width(text_lines[current_top + i], &width, 1); + wmove(text_widget.window, i + 1, 1); + if (width > current_left) + waddch(text_widget.window, ' '); + if (*line_begin != '\0') { + width = text_box_x - (width > current_left); + line_end = mbs_at_width(line_begin, &width, -1); + if (width) + waddnstr(text_widget.window, line_begin, + line_end - line_begin); + } + getyx(text_widget.window, cur_y, cur_x); + if (cur_y == i + 1) { + rest_of_line = text_box_x + 1 - cur_x; + if (rest_of_line > 0) + wprintw(text_widget.window, "%*s", rest_of_line, ""); + } + } +} + +static void update_y_scroll_bar(void) +{ + int length; + int begin; + + if (max_scroll_y <= 0 || text_lines_count == 0) + return; + length = text_box_y * text_box_y / text_lines_count; + if (length >= text_box_y) + return; + begin = current_top * (text_box_y - length) / max_scroll_y; + mvwvline(text_widget.window, 1, text_box_x + 1, ' ', text_box_y); + mvwvline(text_widget.window, begin + 1, text_box_x + 1, ACS_BOARD, length); +} + +static void update_x_scroll_bar(void) +{ + int length; + int begin; + + if (max_scroll_x <= 0 || max_line_width <= 0) + return; + length = text_box_x * text_box_x / max_line_width; + if (length >= text_box_x) + return; + begin = current_left * (text_box_x - length) / max_scroll_x; + mvwhline(text_widget.window, text_box_y + 1, 1, ' ', text_box_x); + mvwhline(text_widget.window, text_box_y + 1, begin + 1, ACS_BOARD, length); +} + +static void move_x(int delta) +{ + int left; + + left = current_left + delta; + if (left < 0) + left = 0; + else if (left > max_scroll_x) + left = max_scroll_x; + if (left != current_left) { + current_left = left; + update_text_lines(); + update_x_scroll_bar(); + } +} + +static void move_y(int delta) +{ + int top; + + top = current_top + delta; + if (top < 0) + top = 0; + else if (top > max_scroll_y) + top = max_scroll_y; + if (top != current_top) { + current_top = top; + update_text_lines(); + update_y_scroll_bar(); + } +} + +static void on_handle_key(int key) +{ + if (key >= ARRAY_SIZE(textbox_bindings)) + return; + + switch (textbox_bindings[key]) { + case CMD_TEXTBOX_CLOSE: + text_widget.close(); + break; + case CMD_TEXTBOX_DOWN: + move_y(1); + break; + case CMD_TEXTBOX_UP: + move_y(-1); + break; + case CMD_TEXTBOX_LEFT: + move_x(-1); + break; + case CMD_TEXTBOX_RIGHT: + move_x(1); + break; + case CMD_TEXTBOX_PAGE_DOWN: + move_y(text_box_y); + break; + case CMD_TEXTBOX_PAGE_UP: + move_y(-text_box_y); + break; + case CMD_TEXTBOX_TOP: + move_x(-max_scroll_x); + break; + case CMD_TEXTBOX_BOTTOM: + move_x(max_scroll_x); + break; + case CMD_TEXTBOX_PAGE_RIGHT: + move_x(8); + break; + case CMD_TEXTBOX_PAGE_LEFT: + move_x(-8); + break; + } +} + +static bool create(void) +{ + int len, width; + + if (screen_lines < 3 || screen_cols < 8) { + text_widget.close(); + beep(); + return FALSE; + } + + width = max_line_width; + len = get_mbs_width(title) + 2; + if (width < len) + width = len; + + text_box_y = text_lines_count; + if (text_box_y > screen_lines - 2) + text_box_y = screen_lines - 2; + max_scroll_y = text_lines_count - text_box_y; + text_box_x = width; + if (text_box_x > screen_cols - 2) + text_box_x = screen_cols - 2; + max_scroll_x = max_line_width - text_box_x; + + widget_init(&text_widget, text_box_y + 2, text_box_x + 2, + SCREEN_CENTER, SCREEN_CENTER, widget_attrs, WIDGET_BORDER); + mvwprintw(text_widget.window, 0, (text_box_x + 2 - get_mbs_width(title) - 2) / 2, " %s ", title); + + if (current_top > max_scroll_y) + current_top = max_scroll_y; + if (current_left > max_scroll_x) + current_left = max_scroll_x; + update_text_lines(); + update_y_scroll_bar(); + update_x_scroll_bar(); + return TRUE; +} + +static void on_window_size_changed(void) +{ + create(); +} + +static void on_close(void) +{ + unsigned int i; + + for (i = 0; i < text_lines_count; ++i) + free(text_lines[i]); + free(text_lines); + widget_free(&text_widget); +} + +static struct widget text_widget = { + .handle_key = on_handle_key, + .window_size_changed = on_window_size_changed, + .close = on_close, +}; + +static void create_text_box(const char *const *lines, unsigned int count, + const char *title_, int attrs) +{ + unsigned int i; + + text_lines = ccalloc(count, sizeof *text_lines); + for (i = 0; i < count; ++i) + text_lines[i] = cstrdup(lines[i]); + text_lines_count = count; + max_line_width = get_max_mbs_width(lines, count); + title = cstrdup(title_); + widget_attrs = attrs; + + current_top = 0; + current_left = 0; + + create(); +} diff --git a/alsamixer/textbox.h b/alsamixer/textbox.h new file mode 100644 index 0000000..7dc290b --- /dev/null +++ b/alsamixer/textbox.h @@ -0,0 +1,10 @@ +#ifndef TEXTBOX_H_INCLUDED +#define TEXTBOX_H_INCLUDED + +void show_error(const char *msg, int err); +void show_alsa_error(const char *msg, int err); +void show_text(const char *const *text_lines, unsigned int count, + const char *title); +void show_textfile(const char *file_name); + +#endif diff --git a/alsamixer/utils.c b/alsamixer/utils.c new file mode 100644 index 0000000..64c69f2 --- /dev/null +++ b/alsamixer/utils.c @@ -0,0 +1,148 @@ +/* + * utils.c - multibyte-string helpers + * Copyright (c) Clemens Ladisch + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#ifndef _XOPEN_SOURCE +#define _XOPEN_SOURCE +#endif +#include "aconfig.h" +#include +#include +#include +#include +#include +#include +#include "utils.h" +#include "mem.h" + +/* + * mbs_at_width - compute screen position in a string + * + * For displaying strings on the screen, we have to know how many character + * cells are occupied. This function calculates the position in a multibyte + * string that is at a desired position. + * + * Parameters: + * s: the string + * width: on input, the desired number of character cells; on output, the actual + * position, in character cells, of the return value + * dir: -1 or 1; in which direction to round if a multi-column character goes + * over the desired width + * + * Return value: + * Pointer to the place in the string that is as near the desired width as + * possible. If the string is too short, the return value points to the + * terminating zero. If the last character is a multi-column character that + * goes over the desired width, the return value may be one character cell + * earlier or later than desired, depending on the dir parameter. + * In any case, the return value points after any zero-width characters that + * follow the last character. + */ +const char *mbs_at_width(const char *s, int *width, int dir) +{ + size_t len; + wchar_t wc; + int bytes; + int width_so_far, w; + + if (*width <= 0) + return s; + mbtowc(NULL, NULL, 0); /* reset shift state */ + len = strlen(s); + width_so_far = 0; + while (len && (bytes = mbtowc(&wc, s, len)) > 0) { + w = wcwidth(wc); + if (width_so_far + w > *width && dir < 0) + break; + if (w >= 0) + width_so_far += w; + s += bytes; + len -= bytes; + if (width_so_far >= *width) { + while (len && (bytes = mbtowc(&wc, s, len)) > 0) { + w = wcwidth(wc); + if (w != 0) + break; + s += bytes; + len -= bytes; + } + break; + } + } + *width = width_so_far; + return s; +} + +/* + * get_mbs_width - compute screen width of a string + */ +unsigned int get_mbs_width(const char *s) +{ + int width; + + width = INT_MAX; + mbs_at_width(s, &width, 1); + return width; +} + +/* + * get_max_mbs_width - get width of longest string in an array + */ +unsigned int get_max_mbs_width(const char *const *s, unsigned int count) +{ + unsigned int max_width, i, len; + + max_width = 0; + for (i = 0; i < count; ++i) { + len = get_mbs_width(s[i]); + if (len > max_width) + max_width = len; + } + return max_width; +} + +#define MAX_FILE_SIZE 1048576 +char *read_file(const char *file_name, unsigned int *file_size) +{ + FILE *f; + int err; + char *buf; + unsigned int allocated = 2048; + unsigned int bytes_read; + + f = fopen(file_name, "r"); + if (!f) { + err = errno; + errno = err; + return NULL; + } + *file_size = 0; + buf = NULL; + do { + allocated *= 2; + buf = crealloc(buf, allocated); + bytes_read = fread(buf + *file_size, 1, allocated - *file_size, f); + *file_size += bytes_read; + } while (*file_size == allocated && allocated < MAX_FILE_SIZE); + fclose(f); + if (*file_size > 0 && buf[*file_size - 1] != '\n' && *file_size < allocated) { + buf[*file_size] = '\n'; + ++*file_size; + } + return buf; +} + diff --git a/alsamixer/utils.h b/alsamixer/utils.h new file mode 100644 index 0000000..8301311 --- /dev/null +++ b/alsamixer/utils.h @@ -0,0 +1,11 @@ +#ifndef UTILS_H_INCLUDED +#define UTILS_H_INCLUDED + +#define ARRAY_SIZE(a) (sizeof(a) / sizeof *(a)) + +unsigned int get_mbs_width(const char *s); +unsigned int get_max_mbs_width(const char *const *s, unsigned int count); +const char *mbs_at_width(const char *s, int *width, int dir); +char *read_file(const char *file_name, unsigned int *file_size); + +#endif diff --git a/alsamixer/volume_mapping.c b/alsamixer/volume_mapping.c new file mode 100644 index 0000000..29ab061 --- /dev/null +++ b/alsamixer/volume_mapping.c @@ -0,0 +1,179 @@ +/* + * Copyright (c) 2010 Clemens Ladisch + * + * Permission to use, copy, modify, and/or distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +/* + * The functions in this file map the value ranges of ALSA mixer controls onto + * the interval 0..1. + * + * The mapping is designed so that the position in the interval is proportional + * to the volume as a human ear would perceive it (i.e., the position is the + * cubic root of the linear sample multiplication factor). For controls with + * a small range (24 dB or less), the mapping is linear in the dB values so + * that each step has the same size visually. Only for controls without dB + * information, a linear mapping of the hardware volume register values is used + * (this is the same algorithm as used in the old alsamixer). + * + * When setting the volume, 'dir' is the rounding direction: + * -1/0/1 = down/nearest/up. + */ + +#define _ISOC99_SOURCE /* lrint() */ +#include "aconfig.h" +#include +#include +#include "volume_mapping.h" + +#define MAX_LINEAR_DB_SCALE 24 + +static inline bool use_linear_dB_scale(long dBmin, long dBmax) +{ + return dBmax - dBmin <= MAX_LINEAR_DB_SCALE * 100; +} + +static long lrint_dir(double x, int dir) +{ + if (dir > 0) + return lrint(ceil(x)); + else if (dir < 0) + return lrint(floor(x)); + else + return lrint(x); +} + +enum ctl_dir { PLAYBACK, CAPTURE }; + +static int (* const get_dB_range[2])(snd_mixer_elem_t *, long *, long *) = { + snd_mixer_selem_get_playback_dB_range, + snd_mixer_selem_get_capture_dB_range, +}; +static int (* const get_raw_range[2])(snd_mixer_elem_t *, long *, long *) = { + snd_mixer_selem_get_playback_volume_range, + snd_mixer_selem_get_capture_volume_range, +}; +static int (* const get_dB[2])(snd_mixer_elem_t *, snd_mixer_selem_channel_id_t, long *) = { + snd_mixer_selem_get_playback_dB, + snd_mixer_selem_get_capture_dB, +}; +static int (* const get_raw[2])(snd_mixer_elem_t *, snd_mixer_selem_channel_id_t, long *) = { + snd_mixer_selem_get_playback_volume, + snd_mixer_selem_get_capture_volume, +}; +static int (* const set_dB[2])(snd_mixer_elem_t *, snd_mixer_selem_channel_id_t, long, int) = { + snd_mixer_selem_set_playback_dB, + snd_mixer_selem_set_capture_dB, +}; +static int (* const set_raw[2])(snd_mixer_elem_t *, snd_mixer_selem_channel_id_t, long) = { + snd_mixer_selem_set_playback_volume, + snd_mixer_selem_set_capture_volume, +}; + +static double get_normalized_volume(snd_mixer_elem_t *elem, + snd_mixer_selem_channel_id_t channel, + enum ctl_dir ctl_dir) +{ + long min, max, value; + double normalized, min_norm; + int err; + + err = get_dB_range[ctl_dir](elem, &min, &max); + if (err < 0 || min >= max) { + err = get_raw_range[ctl_dir](elem, &min, &max); + if (err < 0 || min == max) + return 0; + + err = get_raw[ctl_dir](elem, channel, &value); + if (err < 0) + return 0; + + return (value - min) / (double)(max - min); + } + + err = get_dB[ctl_dir](elem, channel, &value); + if (err < 0) + return 0; + + if (use_linear_dB_scale(min, max)) + return (value - min) / (double)(max - min); + + normalized = pow(10, (value - max) / 6000.0); + if (min != SND_CTL_TLV_DB_GAIN_MUTE) { + min_norm = pow(10, (min - max) / 6000.0); + normalized = (normalized - min_norm) / (1 - min_norm); + } + + return normalized; +} + +static int set_normalized_volume(snd_mixer_elem_t *elem, + snd_mixer_selem_channel_id_t channel, + double volume, + int dir, + enum ctl_dir ctl_dir) +{ + long min, max, value; + double min_norm; + int err; + + err = get_dB_range[ctl_dir](elem, &min, &max); + if (err < 0 || min >= max) { + err = get_raw_range[ctl_dir](elem, &min, &max); + if (err < 0) + return err; + + value = lrint_dir(volume * (max - min), dir) + min; + return set_raw[ctl_dir](elem, channel, value); + } + + if (use_linear_dB_scale(min, max)) { + value = lrint_dir(volume * (max - min), dir) + min; + return set_dB[ctl_dir](elem, channel, value, dir); + } + + if (min != SND_CTL_TLV_DB_GAIN_MUTE) { + min_norm = pow(10, (min - max) / 6000.0); + volume = volume * (1 - min_norm) + min_norm; + } + value = lrint_dir(6000.0 * log10(volume), dir) + max; + return set_dB[ctl_dir](elem, channel, value, dir); +} + +double get_normalized_playback_volume(snd_mixer_elem_t *elem, + snd_mixer_selem_channel_id_t channel) +{ + return get_normalized_volume(elem, channel, PLAYBACK); +} + +double get_normalized_capture_volume(snd_mixer_elem_t *elem, + snd_mixer_selem_channel_id_t channel) +{ + return get_normalized_volume(elem, channel, CAPTURE); +} + +int set_normalized_playback_volume(snd_mixer_elem_t *elem, + snd_mixer_selem_channel_id_t channel, + double volume, + int dir) +{ + return set_normalized_volume(elem, channel, volume, dir, PLAYBACK); +} + +int set_normalized_capture_volume(snd_mixer_elem_t *elem, + snd_mixer_selem_channel_id_t channel, + double volume, + int dir) +{ + return set_normalized_volume(elem, channel, volume, dir, CAPTURE); +} diff --git a/alsamixer/volume_mapping.h b/alsamixer/volume_mapping.h new file mode 100644 index 0000000..d4251d6 --- /dev/null +++ b/alsamixer/volume_mapping.h @@ -0,0 +1,19 @@ +#ifndef VOLUME_MAPPING_H_INCLUDED +#define VOLUME_MAPPING_H_INCLUDED + +#include + +double get_normalized_playback_volume(snd_mixer_elem_t *elem, + snd_mixer_selem_channel_id_t channel); +double get_normalized_capture_volume(snd_mixer_elem_t *elem, + snd_mixer_selem_channel_id_t channel); +int set_normalized_playback_volume(snd_mixer_elem_t *elem, + snd_mixer_selem_channel_id_t channel, + double volume, + int dir); +int set_normalized_capture_volume(snd_mixer_elem_t *elem, + snd_mixer_selem_channel_id_t channel, + double volume, + int dir); + +#endif diff --git a/alsamixer/widget.c b/alsamixer/widget.c new file mode 100644 index 0000000..17f3ace --- /dev/null +++ b/alsamixer/widget.c @@ -0,0 +1,146 @@ +/* + * widget.c - handles widget objects and the widget stack + * Copyright (c) Clemens Ladisch + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include "aconfig.h" +#include +#include +#include +#include +#include "die.h" +#include "widget.h" + +int screen_lines; +int screen_cols; + +static int cursor_visibility = -1; + +static void widget_handle_key(int key) +{ +} + +static void update_cursor_visibility(void) +{ + const struct widget *active_widget; + + active_widget = get_active_widget(); + if (active_widget && + active_widget->cursor_visibility != cursor_visibility) { + cursor_visibility = active_widget->cursor_visibility; + curs_set(cursor_visibility); + } +} + +void widget_init(struct widget *widget, int lines_, int cols, int y, int x, + chtype bkgd, unsigned int flags) +{ + WINDOW *old_window; + + if (y == SCREEN_CENTER) + y = (screen_lines - lines_) / 2; + if (x == SCREEN_CENTER) + x = (screen_cols - cols) / 2; + + old_window = widget->window; + widget->window = newwin(lines_, cols, y, x); + if (!widget->window) + fatal_error("cannot create window"); + keypad(widget->window, TRUE); + nodelay(widget->window, TRUE); + leaveok(widget->window, !(flags & WIDGET_CURSOR_VISIBLE)); + wbkgdset(widget->window, bkgd); + werase(widget->window); + + if (flags & WIDGET_BORDER) + box(widget->window, 0, 0); + if (flags & WIDGET_SUBWINDOW) { + if (widget->subwindow) + delwin(widget->subwindow); + widget->subwindow = derwin(widget->window, + lines_ - 2, cols - 2, 1, 1); + if (!widget->subwindow) + fatal_error("cannot create subwindow"); + wbkgdset(widget->subwindow, bkgd); + } + widget->cursor_visibility = !!(flags & WIDGET_CURSOR_VISIBLE); + + if (widget->panel) { + replace_panel(widget->panel, widget->window); + } else { + widget->panel = new_panel(widget->window); + if (!widget->panel) + fatal_error("cannot create panel"); + set_panel_userptr(widget->panel, widget); + } + + //if (!widget->handle_key) + // widget->handle_key = widget_handle_key; + + if (old_window) + delwin(old_window); + + update_cursor_visibility(); +} + +void widget_free(struct widget *widget) +{ + if (widget->panel) { + del_panel(widget->panel); + widget->panel = NULL; + } + if (widget->subwindow) { + delwin(widget->subwindow); + widget->subwindow = NULL; + } + if (widget->window) { + delwin(widget->window); + widget->window = NULL; + } + + update_cursor_visibility(); +} + +const struct widget *get_active_widget(void) +{ + PANEL *active_panel; + + active_panel = panel_below(NULL); + if (active_panel) + return panel_userptr(active_panel); + else + return NULL; +} + +void window_size_changed(void) +{ + PANEL *panel, *below; + const struct widget *widget; + struct winsize size; + + if (ioctl(STDOUT_FILENO, TIOCGWINSZ, &size) == 0) + resize_term(size.ws_row, size.ws_col); + + getmaxyx(stdscr, screen_lines, screen_cols); + if (tigetflag("xenl") != 1 && tigetflag("am") != 1) + --screen_lines; + + for (panel = panel_below(NULL); panel; panel = below) { + below = panel_below(panel); + widget = panel_userptr(panel); + widget->window_size_changed(); + } +} diff --git a/alsamixer/widget.h b/alsamixer/widget.h new file mode 100644 index 0000000..58a132c --- /dev/null +++ b/alsamixer/widget.h @@ -0,0 +1,33 @@ +#ifndef WIDGET_H_INCLUDED +#define WIDGET_H_INCLUDED + +#include + +#define WIDGET_BORDER 0x1 +#define WIDGET_SUBWINDOW 0x2 +#define WIDGET_CURSOR_VISIBLE 0x4 + +#define SCREEN_CENTER -1 + +struct widget { + WINDOW *window; + WINDOW *subwindow; /* optional: contents without border */ + PANEL *panel; + int cursor_visibility; + + void (*handle_key)(int key); + void (*window_size_changed)(void); + void (*close)(void); +}; + +extern int screen_lines; +extern int screen_cols; + +void widget_init(struct widget *widget, + int lines_, int cols, int y, int x, + chtype bkgd, unsigned int flags); +void widget_free(struct widget *widget); +const struct widget *get_active_widget(void); +void window_size_changed(void); + +#endif diff --git a/alsaucm/Makefile.am b/alsaucm/Makefile.am new file mode 100644 index 0000000..2010fc0 --- /dev/null +++ b/alsaucm/Makefile.am @@ -0,0 +1,20 @@ +bin_PROGRAMS = \ + alsaucm + +if USE_RST2MAN +man_MANS = alsaucm.1 +endif + +alsaucm_SOURCES = usecase.c dump.c + +noinst_HEADERS = usecase.h + +AM_CPPFLAGS = \ + -Wall -I$(top_srcdir)/include + +%.1: %.rst + rst2man $< > $@ + +EXTRA_DIST = alsaucm.rst + +CLEANFILES = alsaucm.1 diff --git a/alsaucm/Makefile.in b/alsaucm/Makefile.in new file mode 100644 index 0000000..193c32a --- /dev/null +++ b/alsaucm/Makefile.in @@ -0,0 +1,732 @@ +# Makefile.in generated by automake 1.16.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994-2018 Free Software Foundation, Inc. + +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + + +VPATH = @srcdir@ +am__is_gnu_make = { \ + if test -z '$(MAKELEVEL)'; then \ + false; \ + elif test -n '$(MAKE_HOST)'; then \ + true; \ + elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ + true; \ + else \ + false; \ + fi; \ +} +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + esac; \ + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +bin_PROGRAMS = alsaucm$(EXEEXT) +subdir = alsaucm +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/gettext.m4 \ + $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/lib-ld.m4 \ + $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ + $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \ + $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/acinclude.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +DIST_COMMON = $(srcdir)/Makefile.am $(noinst_HEADERS) \ + $(am__DIST_COMMON) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/include/aconfig.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +am__installdirs = "$(DESTDIR)$(bindir)" "$(DESTDIR)$(man1dir)" +PROGRAMS = $(bin_PROGRAMS) +am_alsaucm_OBJECTS = usecase.$(OBJEXT) dump.$(OBJEXT) +alsaucm_OBJECTS = $(am_alsaucm_OBJECTS) +alsaucm_LDADD = $(LDADD) +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__maybe_remake_depfiles = depfiles +am__depfiles_remade = ./$(DEPDIR)/dump.Po ./$(DEPDIR)/usecase.Po +am__mv = mv -f +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +AM_V_CC = $(am__v_CC_@AM_V@) +am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) +am__v_CC_0 = @echo " CC " $@; +am__v_CC_1 = +CCLD = $(CC) +LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_CCLD = $(am__v_CCLD_@AM_V@) +am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) +am__v_CCLD_0 = @echo " CCLD " $@; +am__v_CCLD_1 = +SOURCES = $(alsaucm_SOURCES) +DIST_SOURCES = $(alsaucm_SOURCES) +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; +am__vpath_adj = case $$p in \ + $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ + *) f=$$p;; \ + esac; +am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; +am__install_max = 40 +am__nobase_strip_setup = \ + srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` +am__nobase_strip = \ + for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" +am__nobase_list = $(am__nobase_strip_setup); \ + for p in $$list; do echo "$$p $$p"; done | \ + sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ + $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ + if (++n[$$2] == $(am__install_max)) \ + { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ + END { for (dir in files) print dir, files[dir] }' +am__base_list = \ + sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ + sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' +am__uninstall_files_from_dir = { \ + test -z "$$files" \ + || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ + || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ + $(am__cd) "$$dir" && rm -f $$files; }; \ + } +man1dir = $(mandir)/man1 +NROFF = nroff +MANS = $(man_MANS) +HEADERS = $(noinst_HEADERS) +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) +# Read a list of newline-separated strings from the standard input, +# and print each of them once, without duplicates. Input order is +# *not* preserved. +am__uniquify_input = $(AWK) '\ + BEGIN { nonempty = 0; } \ + { items[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in items) print i; }; } \ +' +# Make sure the list of sources is unique. This is necessary because, +# e.g., the same source file might be shared among _SOURCES variables +# for different programs/libraries. +am__define_uniq_tagged_files = \ + list='$(am__tagged_files)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | $(am__uniquify_input)` +ETAGS = etags +CTAGS = ctags +am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/depcomp +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +ALSACTL_DAEMONSWITCH = @ALSACTL_DAEMONSWITCH@ +ALSACTL_PIDFILE_DIR = @ALSACTL_PIDFILE_DIR@ +ALSA_CFLAGS = @ALSA_CFLAGS@ +ALSA_LIBS = @ALSA_LIBS@ +ALSA_TOPOLOGY_LIBS = @ALSA_TOPOLOGY_LIBS@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +ASOUND_LOCK_DIR = @ASOUND_LOCK_DIR@ +ASOUND_STATE_DIR = @ASOUND_STATE_DIR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CURSESINC = @CURSESINC@ +CURSESLIB = @CURSESLIB@ +CURSES_CFLAGS = @CURSES_CFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +FFTW_CFLAGS = @FFTW_CFLAGS@ +FFTW_INC = @FFTW_INC@ +FFTW_LIB = @FFTW_LIB@ +GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ +GMSGFMT = @GMSGFMT@ +GMSGFMT_015 = @GMSGFMT_015@ +GREP = @GREP@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +INTLLIBS = @INTLLIBS@ +INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@ +LDFLAGS = @LDFLAGS@ +LIBICONV = @LIBICONV@ +LIBINTL = @LIBINTL@ +LIBOBJS = @LIBOBJS@ +LIBRT = @LIBRT@ +LIBS = @LIBS@ +LN_S = @LN_S@ +LTLIBICONV = @LTLIBICONV@ +LTLIBINTL = @LTLIBINTL@ +LTLIBOBJS = @LTLIBOBJS@ +MAINT = @MAINT@ +MAKEINFO = @MAKEINFO@ +MKDIR_P = @MKDIR_P@ +MSGFMT = @MSGFMT@ +MSGFMT_015 = @MSGFMT_015@ +MSGMERGE = @MSGMERGE@ +NCURSESW_CFLAGS = @NCURSESW_CFLAGS@ +NCURSESW_LIBS = @NCURSESW_LIBS@ +NCURSES_CFLAGS = @NCURSES_CFLAGS@ +NCURSES_LIBS = @NCURSES_LIBS@ +OBJEXT = @OBJEXT@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ +POSUB = @POSUB@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +SND_UTIL_MAJOR = @SND_UTIL_MAJOR@ +SND_UTIL_MINOR = @SND_UTIL_MINOR@ +SND_UTIL_SUBMINOR = @SND_UTIL_SUBMINOR@ +SND_UTIL_VERSION = @SND_UTIL_VERSION@ +STRIP = @STRIP@ +SYSTEMD_CFLAGS = @SYSTEMD_CFLAGS@ +SYSTEMD_LIBS = @SYSTEMD_LIBS@ +TESTSOUND = @TESTSOUND@ +USE_NLS = @USE_NLS@ +VERSION = @VERSION@ +XGETTEXT = @XGETTEXT@ +XGETTEXT_015 = @XGETTEXT_015@ +XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_CC = @ac_ct_CC@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +mydatadir = @mydatadir@ +ncurses5_config = @ncurses5_config@ +ncursesw5_config = @ncursesw5_config@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +rst2man_available = @rst2man_available@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +systemdsystemunitdir = @systemdsystemunitdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +udevrulesdir = @udevrulesdir@ +xmlto_available = @xmlto_available@ +@USE_RST2MAN_TRUE@man_MANS = alsaucm.1 +alsaucm_SOURCES = usecase.c dump.c +noinst_HEADERS = usecase.h +AM_CPPFLAGS = \ + -Wall -I$(top_srcdir)/include + +EXTRA_DIST = alsaucm.rst +CLEANFILES = alsaucm.1 +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .o .obj +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign alsaucm/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --foreign alsaucm/Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): +install-binPROGRAMS: $(bin_PROGRAMS) + @$(NORMAL_INSTALL) + @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(bindir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(bindir)" || exit 1; \ + fi; \ + for p in $$list; do echo "$$p $$p"; done | \ + sed 's/$(EXEEXT)$$//' | \ + while read p p1; do if test -f $$p \ + ; then echo "$$p"; echo "$$p"; else :; fi; \ + done | \ + sed -e 'p;s,.*/,,;n;h' \ + -e 's|.*|.|' \ + -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \ + sed 'N;N;N;s,\n, ,g' | \ + $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \ + { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \ + if ($$2 == $$4) files[d] = files[d] " " $$1; \ + else { print "f", $$3 "/" $$4, $$1; } } \ + END { for (d in files) print "f", d, files[d] }' | \ + while read type dir files; do \ + if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \ + test -z "$$files" || { \ + echo " $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(bindir)$$dir'"; \ + $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \ + } \ + ; done + +uninstall-binPROGRAMS: + @$(NORMAL_UNINSTALL) + @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ + files=`for p in $$list; do echo "$$p"; done | \ + sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \ + -e 's/$$/$(EXEEXT)/' \ + `; \ + test -n "$$list" || exit 0; \ + echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \ + cd "$(DESTDIR)$(bindir)" && rm -f $$files + +clean-binPROGRAMS: + -test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS) + +alsaucm$(EXEEXT): $(alsaucm_OBJECTS) $(alsaucm_DEPENDENCIES) $(EXTRA_alsaucm_DEPENDENCIES) + @rm -f alsaucm$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(alsaucm_OBJECTS) $(alsaucm_LDADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dump.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/usecase.Po@am__quote@ # am--include-marker + +$(am__depfiles_remade): + @$(MKDIR_P) $(@D) + @echo '# dummy' >$@-t && $(am__mv) $@-t $@ + +am--depfiles: $(am__depfiles_remade) + +.c.o: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< + +.c.obj: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` +install-man1: $(man_MANS) + @$(NORMAL_INSTALL) + @list1=''; \ + list2='$(man_MANS)'; \ + test -n "$(man1dir)" \ + && test -n "`echo $$list1$$list2`" \ + || exit 0; \ + echo " $(MKDIR_P) '$(DESTDIR)$(man1dir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(man1dir)" || exit 1; \ + { for i in $$list1; do echo "$$i"; done; \ + if test -n "$$list2"; then \ + for i in $$list2; do echo "$$i"; done \ + | sed -n '/\.1[a-z]*$$/p'; \ + fi; \ + } | while read p; do \ + if test -f $$p; then d=; else d="$(srcdir)/"; fi; \ + echo "$$d$$p"; echo "$$p"; \ + done | \ + sed -e 'n;s,.*/,,;p;h;s,.*\.,,;s,^[^1][0-9a-z]*$$,1,;x' \ + -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,' | \ + sed 'N;N;s,\n, ,g' | { \ + list=; while read file base inst; do \ + if test "$$base" = "$$inst"; then list="$$list $$file"; else \ + echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man1dir)/$$inst'"; \ + $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man1dir)/$$inst" || exit $$?; \ + fi; \ + done; \ + for i in $$list; do echo "$$i"; done | $(am__base_list) | \ + while read files; do \ + test -z "$$files" || { \ + echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(man1dir)'"; \ + $(INSTALL_DATA) $$files "$(DESTDIR)$(man1dir)" || exit $$?; }; \ + done; } + +uninstall-man1: + @$(NORMAL_UNINSTALL) + @list=''; test -n "$(man1dir)" || exit 0; \ + files=`{ for i in $$list; do echo "$$i"; done; \ + l2='$(man_MANS)'; for i in $$l2; do echo "$$i"; done | \ + sed -n '/\.1[a-z]*$$/p'; \ + } | sed -e 's,.*/,,;h;s,.*\.,,;s,^[^1][0-9a-z]*$$,1,;x' \ + -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,'`; \ + dir='$(DESTDIR)$(man1dir)'; $(am__uninstall_files_from_dir) + +ID: $(am__tagged_files) + $(am__define_uniq_tagged_files); mkid -fID $$unique +tags: tags-am +TAGS: tags + +tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + set x; \ + here=`pwd`; \ + $(am__define_uniq_tagged_files); \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: ctags-am + +CTAGS: ctags +ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + $(am__define_uniq_tagged_files); \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" +cscopelist: cscopelist-am + +cscopelist-am: $(am__tagged_files) + list='$(am__tagged_files)'; \ + case "$(srcdir)" in \ + [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ + *) sdir=$(subdir)/$(srcdir) ;; \ + esac; \ + for i in $$list; do \ + if test -f "$$i"; then \ + echo "$(subdir)/$$i"; \ + else \ + echo "$$sdir/$$i"; \ + fi; \ + done >> $(top_builddir)/cscope.files + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) distdir-am + +distdir-am: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(PROGRAMS) $(MANS) $(HEADERS) +installdirs: + for dir in "$(DESTDIR)$(bindir)" "$(DESTDIR)$(man1dir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ + done +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + +clean-generic: + -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-binPROGRAMS clean-generic mostlyclean-am + +distclean: distclean-am + -rm -f ./$(DEPDIR)/dump.Po + -rm -f ./$(DEPDIR)/usecase.Po + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: install-man + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: install-binPROGRAMS + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: install-man1 + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -f ./$(DEPDIR)/dump.Po + -rm -f ./$(DEPDIR)/usecase.Po + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-binPROGRAMS uninstall-man + +uninstall-man: uninstall-man1 + +.MAKE: install-am install-strip + +.PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-am clean \ + clean-binPROGRAMS clean-generic cscopelist-am ctags ctags-am \ + distclean distclean-compile distclean-generic distclean-tags \ + distdir dvi dvi-am html html-am info info-am install \ + install-am install-binPROGRAMS install-data install-data-am \ + install-dvi install-dvi-am install-exec install-exec-am \ + install-html install-html-am install-info install-info-am \ + install-man install-man1 install-pdf install-pdf-am install-ps \ + install-ps-am install-strip installcheck installcheck-am \ + installdirs maintainer-clean maintainer-clean-generic \ + mostlyclean mostlyclean-compile mostlyclean-generic pdf pdf-am \ + ps ps-am tags tags-am uninstall uninstall-am \ + uninstall-binPROGRAMS uninstall-man uninstall-man1 + +.PRECIOUS: Makefile + + +%.1: %.rst + rst2man $< > $@ + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/alsaucm/alsaucm.rst b/alsaucm/alsaucm.rst new file mode 100644 index 0000000..7890ba5 --- /dev/null +++ b/alsaucm/alsaucm.rst @@ -0,0 +1,235 @@ +========= + alsaucm +========= + +--------------------- +ALSA Use Case Manager +--------------------- + +:Author: Antonio Ospite +:Date: 2016-09-22 +:Copyright: GPLv2+ +:Manual section: 1 +:Manual group: General Commands Manual + +SYNOPSIS +======== + +*alsaucm* [command] + +DESCRIPTION +=========== + +alsaucm (ALSA Use Case Manager) is a program to use the ALSA `Use Case +Interface`_ from the command line. + +On complex sound cards, setting up audio routes is not trivial and mixer +settings can conflict one another preventing the audio card to work at all. + +The ALSA Use Case Manager is a mechanism for controlling complex audio +hardware establishing a relationship between hardware configurations and +meaningful use cases that the end-user can relate with. + +The use case manager can also be used to switch between use cases when +necessary, in a consistent way. + +At a lower level, the use case manager works by configuring the sound card +ALSA kcontrols to change the hardware digital and analog audio routing to +match the requested device use case. + +The use case manager kcontrol configurations are stored in easy to modify text +files. An audio use case can be defined by a **verb** and **device** parameter. + +The verb describes the use case action i.e. a phone call, listening to music, +recording a conversation etc. The device describes the physical audio capture +and playback hardware i.e. headphones, phone handset, bluetooth headset, etc. + + +OPTIONS +======= + +Available options: + + **-h**, **--help** + this help + + **-c**, **--card** `NAME` + open card NAME + + **-i**, **--interactive** + interactive mode + + **-b**, **--batch** `FILE` + batch mode (use ``'-'`` for the stdin input) + + **-n**, **--no-open** + do not open first card found + + +Available commands: + + ``open`` `NAME` + open card NAME. + + valid names are sound card names as listed in ``/usr/share/alsa/ucm``. + + ``reset`` + reset sound card to default state. + + ``reload`` + reload configuration. + + ``listcards`` + list available cards. + + ``list`` `IDENTIFIER` + list command, for items returning two entries (value+comment). + + the value of the `IDENTIFIER` argument can can be: + + - ``_verbs`` - get verb list (in pair verb+comment) + - ``_devices[/{verb}]`` - get list of supported devices (in pair device+comment) + - ``_modifiers[/{verb}]`` - get list of supported modifiers (in pair modifier+comment) + + The forms without the trailing ``/{verb}`` are valid only after a specific + verb has been set. + + ``list1`` `IDENTIFIER` + list command, for lists returning one item per entry. + + the value of the `IDENTIFIER` argument can vary depending on the context, + it can be: + + - ``TQ[/{verb}]`` - get list of Tone Quality identifiers + - ``_enadevs`` - get list of enabled devices + - ``_enamods`` - get list of enabled modifiers + - ``_supporteddevs/{modifier}|{device}[/{verb}]`` - list of supported devices + - ``_conflictingdevs/{modifier}|{device}[/{verb}]`` - list of conflicting devices + + ``get`` `IDENTIFIER` + get string value. + + the value of the `IDENTIFIER` argument can can be: + + - ``_verb`` - return current verb + - ``[=]{NAME}[/[{modifier}|{/device}][/{verb}]]`` (For valid NAMEs look at the + ALSA `Use Case Interface`_) + + + ``geti`` `IDENTIFIER` + get integer value. + + the value of the `IDENTIFIER` argument can can be: + + - ``_devstatus/{device}`` + - ``_modtstaus/{device}`` + + ``set`` `IDENTIFIER` `VALUE` + set string value + + The value of the `IDENTIFIER` argument can can be: + + - ``_verb`` - set the verb to `VALUE` + - ``_enadev`` - enable the device specified by `VALUE` + - ``_disdev`` - disable the device specified by `VALUE` + - ``_swdev/{old_device}`` - switche device: + + - disable `old_device` and then enable the device specified by + `VALUE` + - if no device was enabled just return + + - ``_enamod`` - enable the modifier specified by `VALUE` + - ``_dismod`` - disable the modifier specified by `VALUE` + - ``_swmod/{old_modifier}`` - switch modifier: + + - disable `old_modifier` and then enable the modifier specified by + `VALUE` + - if no modifier was enabled just return + + Note that the identifiers referring to devices and modifiers are valid + only after setting a verb. + + ``h``, ``help`` + help + + ``q``, ``quit`` + quit + + +FILES +===== + +The master use case files for each supported sound card are in ``/usr/share/alsa/ucm``. + +For example, the master use case file for the `Pandaboard` card is in +``/usr/share/alsa/ucm/PandaBoard/PandaBoard.conf``, this file lists all the +supported use cases, e.g. + +:: + + SectionUseCase."HiFi" { + File "hifi" + Comment "Play HiFi quality Music." + } + ... + + +Each use case defines a _verb, which is described in the file specified in +the ``File`` directive, like above. + +The ``HiFi`` verb above is described in +``/usr/share/alsa/ucm/PandaBoard/hifi``. + +For more details on the syntax of UCM files, see the alsa-lib source code: +http://git.alsa-project.org/?p=alsa-lib.git;a=blob;f=src/ucm/parser.c + + +EXAMPLES OF USE +=============== + +Some commands, like for instance ``list _devices``, +can only work after setting a ``_verb`` in the **same execution**, for +instance this sequence doesn't work: + +:: + + # alsaucm -c bytcr-rt5640 set _verb HiFi + # alsaucm -c bytcr-rt5640 list _devices + + +However this command does: + +:: + + # alsaucm -n -b - < + */ + +#include +#include +#include +#include +#include "usecase.h" +#include "aconfig.h" +#include "version.h" + +struct renderer { + int (*init)(struct renderer *r); + void (*done)(struct renderer *r); + int (*verb_begin)(struct renderer *r, + const char *verb, + const char *comment); + int (*verb_end)(struct renderer *r); + int (*device_block_begin)(struct renderer *r); + int (*device_block_end)(struct renderer *r); + int (*device_begin)(struct renderer *r, + const char *device, + const char *comment); + int (*device_end)(struct renderer *r); + int (*modifier_block_begin)(struct renderer *r); + int (*modifier_block_end)(struct renderer *r); + int (*modifier_begin)(struct renderer *r, + const char *device, + const char *comment); + int (*modifier_end)(struct renderer *r); + int (*supported_begin)(struct renderer *r); + int (*supported_value)(struct renderer *r, const char *value, int last); + int (*supported_end)(struct renderer *r); + int (*conflict_begin)(struct renderer *r); + int (*conflict_value)(struct renderer *r, const char *value, int last); + int (*conflict_end)(struct renderer *r); + int (*value_begin)(struct renderer *r); + int (*value_end)(struct renderer *r); + int (*value)(struct renderer *r, const char *ident, const char *value); + void *opaque; +}; + +/* + * Text renderer + */ + +struct text { + char a[1]; +}; + +static char *tesc(const char *s, char *buf, size_t buf_len) +{ + char *dst = buf; + char c = '\0'; + if (strchr(s, '"') || strchr(s, ' ') || strchr(s, '.')) { + *dst++ = c = '"'; + buf_len--; + } + while (*s && buf_len > 2) { + if (*s == '"') { + if (buf_len > 3) { + *dst++ = '\\'; + *dst++ = *s++; + buf_len -= 2; + continue; + } else { + break; + } + } + *dst++ = *s++; + } + if (c) + *dst++ = c; + *dst = '\0'; + return buf; +} + +#define ESC(s, esc) tesc((s), (esc), sizeof(esc)) + +static int text_verb_start(struct renderer *r, const char *verb, const char *comment) +{ + char buf1[128], buf2[128]; + printf("Verb.%s {\n", ESC(verb, buf1)); + if (comment && comment[0]) + printf("\tComment %s\n", ESC(comment, buf2)); + return 0; +} + +static int text_verb_end(struct renderer *r) +{ + printf("}\n"); + return 0; +} + +static int text_2nd_level_begin(struct renderer *r, + const char *key, + const char *val, + const char *comment) +{ + char buf1[128], buf2[128]; + printf("\t%s.%s {\n", key, ESC(val, buf1)); + if (comment && comment[0]) + printf("\t\tComment %s\n", ESC(comment, buf2)); + return 0; +} + +static int text_2nd_level_end(struct renderer *r) +{ + printf("\t}\n"); + return 0; +} + +static int text_2nd_level(struct renderer *r, const char *txt) +{ + printf("\t\t%s", txt); + return 0; +} + +static int text_3rd_level(struct renderer *r, const char *txt) +{ + printf("\t\t\t%s", txt); + return 0; +} + +static int text_dev_start(struct renderer *r, const char *dev, const char *comment) +{ + return text_2nd_level_begin(r, "Device", dev, comment); +} + +static int text_mod_start(struct renderer *r, const char *dev, const char *comment) +{ + return text_2nd_level_begin(r, "Modifier", dev, comment); +} + +static int text_supcon_start(struct renderer *r, const char *key) +{ + if (text_2nd_level(r, key)) + return 1; + printf(" [\n"); + return 0; +} + +static int text_supcon_value(struct renderer *r, const char *value, int last) +{ + char buf[256]; + ESC(value, buf); + if (!last && strlen(buf) < sizeof(buf) - 2) + strcat(buf, ","); + if (text_3rd_level(r, buf)) + return 1; + printf("\n"); + return 0; +} + +static int text_supcon_end(struct renderer *r) +{ + return text_2nd_level(r, "]\n"); +} + +static int text_sup_start(struct renderer *r) +{ + return text_supcon_start(r, "SupportedDevices"); +} + +static int text_con_start(struct renderer *r) +{ + return text_supcon_start(r, "ConflictingDevices"); +} + +static int text_value_begin(struct renderer *r) +{ + return text_2nd_level(r, "Values {\n"); +} + +static int text_value_end(struct renderer *r) +{ + return text_2nd_level(r, "}\n"); +} + +static int text_value(struct renderer *r, const char *ident, const char *value) +{ + char buf1[256], buf2[256]; + int err; + + ESC(ident, buf1); + err = text_3rd_level(r, buf1); + if (err < 0) + return err; + ESC(value, buf2); + printf(" %s\n", buf2); + return 0; +} + +static struct renderer text_renderer = { + .verb_begin = text_verb_start, + .verb_end = text_verb_end, + .device_begin = text_dev_start, + .device_end = text_2nd_level_end, + .modifier_begin = text_mod_start, + .modifier_end = text_2nd_level_end, + .supported_begin = text_sup_start, + .supported_value = text_supcon_value, + .supported_end = text_supcon_end, + .conflict_begin = text_con_start, + .conflict_value = text_supcon_value, + .conflict_end = text_supcon_end, + .value_begin = text_value_begin, + .value_end = text_value_end, + .value = text_value, +}; + +/* + * JSON renderer + */ + +struct json { + int block[5]; +}; + +static char *jesc(const char *s, char *buf, size_t buf_len) +{ + char *dst = buf; + char c = '"'; + *dst++ = c; + buf_len--; + while (*s && buf_len > 2) { + if (*s == '"') { + if (buf_len > 3) { + *dst++ = '\\'; + *dst++ = *s++; + buf_len -= 2; + continue; + } else { + break; + } + } + *dst++ = *s++; + } + *dst++ = c; + *dst = '\0'; + return buf; +} + +#define JESC(s, esc) jesc((s), (esc), sizeof(esc)) + +static void json_block(struct renderer *r, int level, int last) +{ + struct json *j = r->opaque; + printf((j->block[level] && !last) ? ",\n" : "\n"); + j->block[level] = last ? 0 : 1; +} + +static int json_init(struct renderer *r) +{ + printf("{\n \"Verbs\": {"); + return 0; +} + +static void json_done(struct renderer *r) +{ + json_block(r, 0, 1); + printf(" }\n}\n"); +} + +static int json_verb_start(struct renderer *r, const char *verb, const char *comment) +{ + char buf[256]; + json_block(r, 0, 0); + printf(" %s: {", JESC(verb, buf)); + if (comment && comment[0]) { + json_block(r, 1, 0); + printf(" \"Comment\": %s", JESC(comment, buf)); + } + return 0; +} + +static int json_verb_end(struct renderer *r) +{ + json_block(r, 1, 1); + printf(" }"); + return 0; +} + +static int json_2nd_level_block_end(struct renderer *r) +{ + json_block(r, 2, 1); + printf(" }"); + return 0; +} + +static int json_2nd_level_begin(struct renderer *r, + const char *val, + const char *comment) +{ + char buf[256]; + json_block(r, 2, 0); + printf(" %s: {", JESC(val, buf)); + if (comment && comment[0]) { + json_block(r, 3, 0); + printf(" \"Comment\": %s", JESC(comment, buf)); + } + return 0; +} + +static int json_2nd_level_end(struct renderer *r) +{ + json_block(r, 3, 1); + printf(" }"); + return 0; +} + +static int json_2nd_level(struct renderer *r, const char *txt) +{ + printf(" %s", txt); + return 0; +} + +static int json_3rd_level(struct renderer *r, const char *txt) +{ + printf(" %s", txt); + return 0; +} + +static int json_dev_block_start(struct renderer *r) +{ + json_block(r, 1, 0); + printf(" \"Devices\": {"); + return 0; +} + +static int json_mod_block_start(struct renderer *r) +{ + json_block(r, 1, 0); + printf(" \"Modifiers\": {"); + return 0; +} + +static int json_supcon_start(struct renderer *r, const char *key) +{ + json_block(r, 3, 0); + if (json_2nd_level(r, key)) + return 1; + printf(": ["); + return 0; +} + +static int json_supcon_value(struct renderer *r, const char *value, int last) +{ + char buf[256]; + JESC(value, buf); + json_block(r, 4, 0); + return json_3rd_level(r, buf); +} + +static int json_supcon_end(struct renderer *r) +{ + json_block(r, 4, 1); + return json_2nd_level(r, "]"); +} + +static int json_sup_start(struct renderer *r) +{ + return json_supcon_start(r, "\"SupportedDevices\""); +} + +static int json_con_start(struct renderer *r) +{ + return json_supcon_start(r, "\"ConflictingDevices\""); +} + +static int json_value_begin(struct renderer *r) +{ + json_block(r, 3, 0); + return json_2nd_level(r, "\"Values\": {"); +} + +static int json_value_end(struct renderer *r) +{ + json_block(r, 4, 1); + return json_2nd_level(r, "}"); +} + +static int json_value(struct renderer *r, const char *ident, const char *value) +{ + char buf[256]; + int err; + + json_block(r, 4, 0); + JESC(ident, buf); + err = json_3rd_level(r, buf); + if (err < 0) + return err; + JESC(value, buf); + printf(": %s", buf); + return 0; +} + +static struct renderer json_renderer = { + .init = json_init, + .done = json_done, + .verb_begin = json_verb_start, + .verb_end = json_verb_end, + .device_block_begin = json_dev_block_start, + .device_block_end = json_2nd_level_block_end, + .device_begin = json_2nd_level_begin, + .device_end = json_2nd_level_end, + .modifier_block_begin = json_mod_block_start, + .modifier_block_end = json_2nd_level_block_end, + .modifier_begin = json_2nd_level_begin, + .modifier_end = json_2nd_level_end, + .supported_begin = json_sup_start, + .supported_value = json_supcon_value, + .supported_end = json_supcon_end, + .conflict_begin = json_con_start, + .conflict_value = json_supcon_value, + .conflict_end = json_supcon_end, + .value_begin = json_value_begin, + .value_end = json_value_end, + .value = json_value, +}; + +/* + * universal dump functions + */ + +static int render_devlist(struct context *context, + struct renderer *render, + const char *verb, + const char *device, + const char *list, + int (*begin)(struct renderer *), + int (*value)(struct renderer *, const char *value, int last), + int (*end)(struct renderer *)) +{ + snd_use_case_mgr_t *uc_mgr = context->uc_mgr; + const char **dev_list; + char buf[256]; + int err = 0, j, dev_num; + + snprintf(buf, sizeof(buf), "%s/%s/%s", list, device, verb); + dev_num = snd_use_case_get_list(uc_mgr, buf, &dev_list); + if (dev_num < 0) { + fprintf(stderr, "%s: unable to get %s for verb '%s' for device '%s'\n", + context->command, list, verb, device); + return dev_num; + } + if (dev_num > 0) { + err = begin(render); + if (err < 0) + goto __err; + for (j = 0; j < dev_num; j++) { + err = value(render, dev_list[j], j + 1 == dev_num); + if (err < 0) + goto __err; + } + err = end(render); + } +__err: + snd_use_case_free_list(dev_list, dev_num); + return err; +} + +static int render_values(struct context *context, + struct renderer *render, + const char *verb, + const char *device) +{ + snd_use_case_mgr_t *uc_mgr = context->uc_mgr; + const char **list, *value; + char buf[256]; + int err = 0, j, num; + + snprintf(buf, sizeof(buf), "_identifiers/%s/%s", device, verb); + num = snd_use_case_get_list(uc_mgr, buf, &list); + if (num < 0) { + fprintf(stderr, "%s: unable to get _identifiers for verb '%s' for device '%s': %s\n", + context->command, verb, device, snd_strerror(num)); + return num; + } + if (num == 0) + goto __err; + if (render->value_begin) { + err = render->value_begin(render); + if (err < 0) + goto __err; + } + for (j = 0; j < num; j++) { + snprintf(buf, sizeof(buf), "%s/%s/%s", list[j], device, verb); + err = snd_use_case_get(uc_mgr, buf, &value); + if (err < 0) { + fprintf(stderr, "%s: unable to get value '%s' for verb '%s' for device '%s': %s\n", + context->command, list[j], verb, device, snd_strerror(err)); + goto __err; + } + err = render->value(render, list[j], value); + free((char *)value); + if (err < 0) + goto __err; + } + if (render->value_end) + err = render->value_end(render); +__err: + snd_use_case_free_list(list, num); + return err; +} + +static int render_device(struct context *context, + struct renderer *render, + const char *verb, + const char *device) +{ + int err; + + err = render_devlist(context, render, verb, device, + "_supporteddevs", + render->supported_begin, + render->supported_value, + render->supported_end); + if (err < 0) + return err; + err = render_devlist(context, render, verb, device, + "_conflictingdevs", + render->conflict_begin, + render->conflict_value, + render->conflict_end); + if (err < 0) + return err; + return render_values(context, render, verb, device); +} + +static void render(struct context *context, struct renderer *render) +{ + snd_use_case_mgr_t *uc_mgr = context->uc_mgr; + int i, j, num, dev_num; + const char **list, **dev_list, *verb, *comment; + char buf[256]; + + num = snd_use_case_verb_list(uc_mgr, &list); + if (num < 0) { + fprintf(stderr, "%s: no verbs found\n", context->command); + return; + } + if (render->init && render->init(render)) + goto __end; + for (i = 0; i < num; i += 2) { + /* verb */ + verb = list[i + 0]; + comment = list[i + 1]; + if (render->verb_begin(render, verb, comment)) + break; + /* devices */ + snprintf(buf, sizeof(buf), "_devices/%s", verb); + dev_num = snd_use_case_get_list(uc_mgr, buf, &dev_list); + if (dev_num < 0) { + fprintf(stderr, "%s: unable to get devices for verb '%s'\n", + context->command, verb); + continue; + } + if (dev_num == 0) + goto __mods; + if (render->device_block_begin && render->device_block_begin(render)) { + snd_use_case_free_list(dev_list, dev_num); + goto __end; + } + for (j = 0; j < dev_num; j += 2) { + render->device_begin(render, dev_list[j + 0], dev_list[j + 1]); + if (render_device(context, render, verb, dev_list[j + 0])) { + snd_use_case_free_list(dev_list, dev_num); + goto __end; + } + render->device_end(render); + } + snd_use_case_free_list(dev_list, dev_num); + if (render->device_block_end && render->device_block_end(render)) + goto __end; +__mods: + /* modifiers */ + snprintf(buf, sizeof(buf), "_modifiers/%s", verb); + dev_num = snd_use_case_get_list(uc_mgr, buf, &dev_list); + if (dev_num < 0) { + fprintf(stderr, "%s: unable to get modifiers for verb '%s'\n", + context->command, verb); + continue; + } + if (dev_num == 0) + goto __verb_end; + if (render->modifier_block_begin && render->modifier_block_begin(render)) { + snd_use_case_free_list(dev_list, dev_num); + goto __end; + } + for (j = 0; j < dev_num; j += 2) { + render->modifier_begin(render, dev_list[j + 0], dev_list[j + 1]); + render->modifier_end(render); + } + snd_use_case_free_list(dev_list, dev_num); + if (render->modifier_block_end && render->modifier_block_end(render)) + goto __end; +__verb_end: + /* end */ + if (render->verb_end(render)) + break; + } + if (render->done) + render->done(render); +__end: + snd_use_case_free_list(list, num); +} + +void dump(struct context *context, const char *format) +{ + struct renderer r; + struct text t; + struct json j; + + r.opaque = NULL; + if (strcasecmp(format, "text") == 0 || + strcasecmp(format, "txt") == 0) { + memset(&t, 0, sizeof(t)); + r = text_renderer; + r.opaque = &t; + } else if (strcasecmp(format, "json") == 0) { + memset(&j, 0, sizeof(j)); + r = json_renderer; + r.opaque = &j; + } + if (r.opaque != NULL) { + render(context, &r); + return; + } + fprintf(stderr, "%s: unknown dump format '%s'\n", + context->command, format); +} diff --git a/alsaucm/usecase.c b/alsaucm/usecase.c new file mode 100644 index 0000000..d39a159 --- /dev/null +++ b/alsaucm/usecase.c @@ -0,0 +1,511 @@ +/* + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * Support for the verb/device/modifier core logic and API, + * command line tool and file parser was kindly sponsored by + * Texas Instruments Inc. + * Support for multiple active modifiers and devices, + * transition sequences, multiple client access and user defined use + * cases was kindly sponsored by Wolfson Microelectronics PLC. + * + * Copyright (C) 2008-2010 SlimLogic Ltd + * Copyright (C) 2010 Wolfson Microelectronics PLC + * Copyright (C) 2010 Texas Instruments Inc. + * Copyright (C) 2010 Red Hat Inc. + * Authors: Liam Girdwood + * Stefan Schmidt + * Justin Xu + * Jaroslav Kysela + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include "usecase.h" +#include "aconfig.h" +#include "version.h" + +#define MAX_BUF 256 + +enum uc_cmd { + /* management */ + OM_UNKNOWN = 0, + OM_OPEN, + OM_RESET, + OM_RELOAD, + OM_LISTCARDS, + OM_DUMP, + OM_LIST2, + OM_LIST1, + + /* set/get */ + OM_SET, + OM_GET, + OM_GETI, + + /* misc */ + OM_HELP, + OM_QUIT, +}; + +struct cmd { + int code; + int args; + unsigned int opencard:1; + const char *id; +}; + +static struct cmd cmds[] = { + { OM_OPEN, 1, 0, "open" }, + { OM_RESET, 0, 1, "reset" }, + { OM_RELOAD, 0, 1, "reload" }, + { OM_LISTCARDS, 0, 0, "listcards" }, + { OM_DUMP, 1, 1, "dump" }, + { OM_LIST1, 1, 1, "list1" }, + { OM_LIST2, 1, 1, "list" }, + { OM_SET, 2, 1, "set" }, + { OM_GET, 1, 1, "get" }, + { OM_GETI, 1, 1, "geti" }, + { OM_DUMP, 1, 1, "dump" }, + { OM_HELP, 0, 0, "help" }, + { OM_QUIT, 0, 0, "quit" }, + { OM_HELP, 0, 0, "h" }, + { OM_HELP, 0, 0, "?" }, + { OM_QUIT, 0, 0, "q" }, + { OM_UNKNOWN, 0, 0, NULL } +}; + +static void dump_help(struct context *context) +{ + if (context->command) + printf("Usage: %s [command]\n", context->command); + printf( +"\nAvailable options:\n" +" -h,--help this help\n" +" -c,--card NAME open card NAME\n" +" -i,--interactive interactive mode\n" +" -b,--batch FILE batch mode (use '-' for the stdin input)\n" +" -n,--no-open do not open first card found\n" +"\nAvailable commands:\n" +" open NAME open card NAME\n" +" reset reset sound card to default state\n" +" reload reload configuration\n" +" listcards list available cards\n" +" dump FORMAT dump all config information (format: text,json)\n" +" list IDENTIFIER list command, for items with value + comment\n" +" list1 IDENTIFIER list command, for items without comments\n" +" get IDENTIFIER get string value\n" +" geti IDENTIFIER get integer value\n" +" set IDENTIFIER VALUE set string value\n" +" h,help help\n" +" q,quit quit\n" +); +} + +static int parse_line(struct context *context, char *line) +{ + char *start, **nargv; + int c; + + context->argc = 0; + while (*line) { + while (*line && (*line == ' ' || *line == '\t' || + *line == '\n')) + line++; + c = *line; + if (c == '\0') + return 0; + if (c == '\"' || c == '\'') { + start = ++line; + while (*line && *line != c) + line++; + if (*line) { + *line = '\0'; + line++; + } + } else { + start = line; + while (*line && *line != ' ' && *line != '\t' && + *line != '\n') + line++; + if (*line) { + *line = '\0'; + line++; + } + } + if (start[0] == '\0' && context->argc == 0) + return 0; + if (context->argc + 1 >= context->arga) { + context->arga += 4; + nargv = realloc(context->argv, + context->arga * sizeof(char *)); + if (nargv == NULL) + return -ENOMEM; + context->argv = nargv; + } + context->argv[context->argc++] = start; + } + return 0; +} + +static void my_exit(struct context *context, int exitcode) +{ + if (context->uc_mgr) + snd_use_case_mgr_close(context->uc_mgr); + if (context->arga > 0) + free(context->argv); + if (context->card) + free(context->card); + if (context->batch) + free(context->batch); + free(context); + snd_config_update_free_global(); + exit(exitcode); +} +static void do_initial_open(struct context *context) +{ + int card, err; + char name[16]; + + if (!context->no_open && context->card == NULL) { + card = -1; + err = snd_card_next(&card); + if (err < 0) { + fprintf(stderr, "%s: no sound card found: %s\n", + context->command, snd_strerror(err)); + my_exit(context, EXIT_FAILURE); + } + snprintf(name, sizeof(name), "hw:%d", card); + context->card = strdup(name); + } + + /* open library */ + if (!context->no_open) { + err = snd_use_case_mgr_open(&context->uc_mgr, + context->card); + if (err < 0) { + fprintf(stderr, + "%s: error failed to open sound card %s: %s\n", + context->command, context->card, snd_strerror(err)); + my_exit(context, EXIT_FAILURE); + } + } +} + +static int do_one(struct context *context, struct cmd *cmd, char **argv) +{ + const char **list, *str; + long lval; + int err, i, j, entries; + + if (cmd->opencard && context->uc_mgr == NULL) { + if (!context->no_open) { + do_initial_open(context); + context->no_open = 1; + } else { + fprintf(stderr, "%s: command '%s' requires an open card\n", + context->command, cmd->id); + return 0; + } + } + switch (cmd->code) { + case OM_OPEN: + if (context->uc_mgr) + snd_use_case_mgr_close(context->uc_mgr); + context->uc_mgr = NULL; + free(context->card); + context->card = strdup(argv[0]); + err = snd_use_case_mgr_open(&context->uc_mgr, context->card); + if (err < 0) { + fprintf(stderr, + "%s: error failed to open sound card %s: %s\n", + context->command, context->card, + snd_strerror(err)); + return err; + } + break; + case OM_RESET: + err = snd_use_case_mgr_reset(context->uc_mgr); + if (err < 0) { + fprintf(stderr, + "%s: error failed to reset sound card %s: %s\n", + context->command, context->card, + snd_strerror(err)); + return err; + } + break; + case OM_RELOAD: + err = snd_use_case_mgr_reload(context->uc_mgr); + if (err < 0) { + fprintf(stderr, + "%s: error failed to reload manager %s: %s\n", + context->command, context->card, + snd_strerror(err)); + return err; + } + break; + case OM_LISTCARDS: + err = snd_use_case_card_list(&list); + if (err < 0) { + fprintf(stderr, + "%s: error failed to get card list: %s\n", + context->command, + snd_strerror(err)); + return err; + } + if (err == 0) { + printf(" list is empty\n"); + return 0; + } + for (i = 0; i < err / 2; i++) { + printf(" %i: %s\n", i, list[i*2]); + if (list[i*2+1]) + printf(" %s\n", list[i*2+1]); + } + snd_use_case_free_list(list, err); + break; + case OM_DUMP: + dump(context, argv[0]); + break; + case OM_LIST1: + case OM_LIST2: + switch (cmd->code) { + case OM_LIST1: + entries = 1; + break; + case OM_LIST2: + entries = 2; + break; + } + + err = snd_use_case_get_list(context->uc_mgr, + argv[0], + &list); + if (err < 0) { + fprintf(stderr, + "%s: error failed to get list %s: %s\n", + context->command, argv[0], + snd_strerror(err)); + return err; + } + if (err == 0) { + printf(" list is empty\n"); + return 0; + } + for (i = 0; i < err / entries; i++) { + printf(" %i: %s\n", i, list[i*entries]); + for (j = 0; j < entries - 1; j++) + if (list[i*entries+j+1]) + printf(" %s\n", list[i*entries+j+1]); + } + snd_use_case_free_list(list, err); + break; + case OM_SET: + err = snd_use_case_set(context->uc_mgr, argv[0], argv[1]); + if (err < 0) { + fprintf(stderr, + "%s: error failed to set %s=%s: %s\n", + context->command, argv[0], argv[1], + snd_strerror(err)); + return err; + } + break; + case OM_GET: + err = snd_use_case_get(context->uc_mgr, argv[0], &str); + if (err < 0) { + fprintf(stderr, + "%s: error failed to get %s: %s\n", + context->command, argv[0], + snd_strerror(err)); + return err; + } + printf(" %s=%s\n", argv[0], str); + free((void *)str); + break; + case OM_GETI: + err = snd_use_case_geti(context->uc_mgr, argv[0], &lval); + if (err < 0) { + fprintf(stderr, + "%s: error failed to get integer %s: %s\n", + context->command, argv[0], + snd_strerror(err)); + return lval; + } + printf(" %s=%li\n", argv[0], lval); + break; + case OM_QUIT: + context->do_exit = 1; + break; + case OM_HELP: + dump_help(context); + break; + default: + fprintf(stderr, "%s: unimplemented command '%s'\n", + context->command, cmd->id); + return -EINVAL; + } + return 0; +} + +static int do_commands(struct context *context) +{ + char *command, **argv; + struct cmd *cmd; + int i, acnt, err; + + for (i = 0; i < context->argc && !context->do_exit; i++) { + command = context->argv[i]; + for (cmd = cmds; cmd->id != NULL; cmd++) { + if (strcmp(cmd->id, command) == 0) + break; + } + if (cmd->id == NULL) { + fprintf(stderr, "%s: unknown command '%s'\n", + context->command, command); + return -EINVAL; + } + acnt = context->argc - (i + 1); + if (acnt < cmd->args) { + fprintf(stderr, "%s: expected %i arguments (got %i)\n", + context->command, cmd->args, acnt); + return -EINVAL; + } + argv = context->argv + i + 1; + err = do_one(context, cmd, argv); + if (err < 0) + return err; + i += cmd->args; + } + return 0; +} + +enum { + OPT_VERSION = 1, +}; + +int main(int argc, char *argv[]) +{ + static const char short_options[] = "hb:c:in"; + static const struct option long_options[] = { + {"help", 0, 0, 'h'}, + {"version", 0, 0, OPT_VERSION}, + {"card", 1, 0, 'c'}, + {"interactive", 0, 0, 'i'}, + {"batch", 1, 0, 'b'}, + {"no-open", 0, 0, 'n'}, + {0, 0, 0, 0} + }; + struct context *context; + const char *command = argv[0]; + int c, err, option_index; + char cmd[MAX_BUF]; + FILE *in; + + context = calloc(1, sizeof(*context)); + if (context == NULL) + return EXIT_FAILURE; + context->command = command; + while ((c = getopt_long(argc, argv, short_options, + long_options, &option_index)) != -1) { + switch (c) { + case 'h': + dump_help(context); + break; + case OPT_VERSION: + printf("%s: version " SND_UTIL_VERSION_STR "\n", command); + break; + case 'c': + if (context->card) + free(context->card); + context->card = strdup(optarg); + break; + case 'i': + context->interactive = 1; + context->batch = NULL; + break; + case 'b': + context->batch = strdup(optarg); + context->interactive = 0; + break; + case 'n': + context->no_open = 1; + break; + default: + fprintf(stderr, "Try '%s --help' for more information.\n", command); + my_exit(context, EXIT_FAILURE); + } + } + + /* parse and execute any command line commands */ + if (argc > optind) { + context->argv = argv + optind; + context->argc = argc - optind; + err = do_commands(context); + if (err < 0) + my_exit(context, EXIT_FAILURE); + } + + if (!context->interactive && !context->batch) + my_exit(context, EXIT_SUCCESS); + + if (context->interactive) { + printf("%s: Interacive mode - 'q' to quit\n", command); + in = stdin; + } else { + if (strcmp(context->batch, "-") == 0) { + in = stdin; + } else { + in = fopen(context->batch, "r"); + if (in == NULL) { + fprintf(stderr, "%s: error failed to open file '%s': %s\n", + command, context->batch, strerror(-errno)); + my_exit(context, EXIT_FAILURE); + } + } + } + + /* run the interactive command parser and handler */ + while (!context->do_exit && !feof(in)) { + if (context->interactive) + printf("%s>> ", argv[0]); + fflush(stdin); + if (fgets(cmd, MAX_BUF, in) == NULL) + break; + err = parse_line(context, cmd); + if (err < 0) { + fprintf(stderr, "%s: unable to parse line\n", + command); + my_exit(context, EXIT_FAILURE); + } + err = do_commands(context); + if (err < 0) { + if (context->interactive) + printf("^^^ error, try again\n"); + else + my_exit(context, EXIT_FAILURE); + } + } + + if (in != stdin) + fclose(in); + + my_exit(context, EXIT_SUCCESS); + return EXIT_SUCCESS; +} diff --git a/alsaucm/usecase.h b/alsaucm/usecase.h new file mode 100644 index 0000000..a85716a --- /dev/null +++ b/alsaucm/usecase.h @@ -0,0 +1,35 @@ +/* + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#ifndef __USECASE_H +#define __USECASE_H + +struct context { + snd_use_case_mgr_t *uc_mgr; + const char *command; + char *card; + char **argv; + int argc; + int arga; + char *batch; + unsigned int interactive:1; + unsigned int no_open:1; + unsigned int do_exit:1; +}; + +void dump(struct context *context, const char *format); + +#endif diff --git a/amidi/Makefile.am b/amidi/Makefile.am new file mode 100644 index 0000000..0b91685 --- /dev/null +++ b/amidi/Makefile.am @@ -0,0 +1,5 @@ +AM_CPPFLAGS = -I$(top_srcdir)/include +EXTRA_DIST = amidi.1 + +bin_PROGRAMS = amidi +man_MANS = amidi.1 diff --git a/amidi/Makefile.in b/amidi/Makefile.in new file mode 100644 index 0000000..4efa228 --- /dev/null +++ b/amidi/Makefile.in @@ -0,0 +1,717 @@ +# Makefile.in generated by automake 1.16.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994-2018 Free Software Foundation, Inc. + +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +VPATH = @srcdir@ +am__is_gnu_make = { \ + if test -z '$(MAKELEVEL)'; then \ + false; \ + elif test -n '$(MAKE_HOST)'; then \ + true; \ + elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ + true; \ + else \ + false; \ + fi; \ +} +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + esac; \ + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +bin_PROGRAMS = amidi$(EXEEXT) +subdir = amidi +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/gettext.m4 \ + $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/lib-ld.m4 \ + $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ + $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \ + $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/acinclude.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/include/aconfig.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +am__installdirs = "$(DESTDIR)$(bindir)" "$(DESTDIR)$(man1dir)" +PROGRAMS = $(bin_PROGRAMS) +amidi_SOURCES = amidi.c +amidi_OBJECTS = amidi.$(OBJEXT) +amidi_LDADD = $(LDADD) +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__maybe_remake_depfiles = depfiles +am__depfiles_remade = ./$(DEPDIR)/amidi.Po +am__mv = mv -f +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +AM_V_CC = $(am__v_CC_@AM_V@) +am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) +am__v_CC_0 = @echo " CC " $@; +am__v_CC_1 = +CCLD = $(CC) +LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_CCLD = $(am__v_CCLD_@AM_V@) +am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) +am__v_CCLD_0 = @echo " CCLD " $@; +am__v_CCLD_1 = +SOURCES = amidi.c +DIST_SOURCES = amidi.c +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; +am__vpath_adj = case $$p in \ + $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ + *) f=$$p;; \ + esac; +am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; +am__install_max = 40 +am__nobase_strip_setup = \ + srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` +am__nobase_strip = \ + for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" +am__nobase_list = $(am__nobase_strip_setup); \ + for p in $$list; do echo "$$p $$p"; done | \ + sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ + $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ + if (++n[$$2] == $(am__install_max)) \ + { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ + END { for (dir in files) print dir, files[dir] }' +am__base_list = \ + sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ + sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' +am__uninstall_files_from_dir = { \ + test -z "$$files" \ + || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ + || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ + $(am__cd) "$$dir" && rm -f $$files; }; \ + } +man1dir = $(mandir)/man1 +NROFF = nroff +MANS = $(man_MANS) +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) +# Read a list of newline-separated strings from the standard input, +# and print each of them once, without duplicates. Input order is +# *not* preserved. +am__uniquify_input = $(AWK) '\ + BEGIN { nonempty = 0; } \ + { items[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in items) print i; }; } \ +' +# Make sure the list of sources is unique. This is necessary because, +# e.g., the same source file might be shared among _SOURCES variables +# for different programs/libraries. +am__define_uniq_tagged_files = \ + list='$(am__tagged_files)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | $(am__uniquify_input)` +ETAGS = etags +CTAGS = ctags +am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/depcomp +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +ALSACTL_DAEMONSWITCH = @ALSACTL_DAEMONSWITCH@ +ALSACTL_PIDFILE_DIR = @ALSACTL_PIDFILE_DIR@ +ALSA_CFLAGS = @ALSA_CFLAGS@ +ALSA_LIBS = @ALSA_LIBS@ +ALSA_TOPOLOGY_LIBS = @ALSA_TOPOLOGY_LIBS@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +ASOUND_LOCK_DIR = @ASOUND_LOCK_DIR@ +ASOUND_STATE_DIR = @ASOUND_STATE_DIR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CURSESINC = @CURSESINC@ +CURSESLIB = @CURSESLIB@ +CURSES_CFLAGS = @CURSES_CFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +FFTW_CFLAGS = @FFTW_CFLAGS@ +FFTW_INC = @FFTW_INC@ +FFTW_LIB = @FFTW_LIB@ +GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ +GMSGFMT = @GMSGFMT@ +GMSGFMT_015 = @GMSGFMT_015@ +GREP = @GREP@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +INTLLIBS = @INTLLIBS@ +INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@ +LDFLAGS = @LDFLAGS@ +LIBICONV = @LIBICONV@ +LIBINTL = @LIBINTL@ +LIBOBJS = @LIBOBJS@ +LIBRT = @LIBRT@ +LIBS = @LIBS@ +LN_S = @LN_S@ +LTLIBICONV = @LTLIBICONV@ +LTLIBINTL = @LTLIBINTL@ +LTLIBOBJS = @LTLIBOBJS@ +MAINT = @MAINT@ +MAKEINFO = @MAKEINFO@ +MKDIR_P = @MKDIR_P@ +MSGFMT = @MSGFMT@ +MSGFMT_015 = @MSGFMT_015@ +MSGMERGE = @MSGMERGE@ +NCURSESW_CFLAGS = @NCURSESW_CFLAGS@ +NCURSESW_LIBS = @NCURSESW_LIBS@ +NCURSES_CFLAGS = @NCURSES_CFLAGS@ +NCURSES_LIBS = @NCURSES_LIBS@ +OBJEXT = @OBJEXT@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ +POSUB = @POSUB@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +SND_UTIL_MAJOR = @SND_UTIL_MAJOR@ +SND_UTIL_MINOR = @SND_UTIL_MINOR@ +SND_UTIL_SUBMINOR = @SND_UTIL_SUBMINOR@ +SND_UTIL_VERSION = @SND_UTIL_VERSION@ +STRIP = @STRIP@ +SYSTEMD_CFLAGS = @SYSTEMD_CFLAGS@ +SYSTEMD_LIBS = @SYSTEMD_LIBS@ +TESTSOUND = @TESTSOUND@ +USE_NLS = @USE_NLS@ +VERSION = @VERSION@ +XGETTEXT = @XGETTEXT@ +XGETTEXT_015 = @XGETTEXT_015@ +XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_CC = @ac_ct_CC@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +mydatadir = @mydatadir@ +ncurses5_config = @ncurses5_config@ +ncursesw5_config = @ncursesw5_config@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +rst2man_available = @rst2man_available@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +systemdsystemunitdir = @systemdsystemunitdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +udevrulesdir = @udevrulesdir@ +xmlto_available = @xmlto_available@ +AM_CPPFLAGS = -I$(top_srcdir)/include +EXTRA_DIST = amidi.1 +man_MANS = amidi.1 +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .o .obj +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign amidi/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --foreign amidi/Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): +install-binPROGRAMS: $(bin_PROGRAMS) + @$(NORMAL_INSTALL) + @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(bindir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(bindir)" || exit 1; \ + fi; \ + for p in $$list; do echo "$$p $$p"; done | \ + sed 's/$(EXEEXT)$$//' | \ + while read p p1; do if test -f $$p \ + ; then echo "$$p"; echo "$$p"; else :; fi; \ + done | \ + sed -e 'p;s,.*/,,;n;h' \ + -e 's|.*|.|' \ + -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \ + sed 'N;N;N;s,\n, ,g' | \ + $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \ + { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \ + if ($$2 == $$4) files[d] = files[d] " " $$1; \ + else { print "f", $$3 "/" $$4, $$1; } } \ + END { for (d in files) print "f", d, files[d] }' | \ + while read type dir files; do \ + if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \ + test -z "$$files" || { \ + echo " $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(bindir)$$dir'"; \ + $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \ + } \ + ; done + +uninstall-binPROGRAMS: + @$(NORMAL_UNINSTALL) + @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ + files=`for p in $$list; do echo "$$p"; done | \ + sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \ + -e 's/$$/$(EXEEXT)/' \ + `; \ + test -n "$$list" || exit 0; \ + echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \ + cd "$(DESTDIR)$(bindir)" && rm -f $$files + +clean-binPROGRAMS: + -test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS) + +amidi$(EXEEXT): $(amidi_OBJECTS) $(amidi_DEPENDENCIES) $(EXTRA_amidi_DEPENDENCIES) + @rm -f amidi$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(amidi_OBJECTS) $(amidi_LDADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/amidi.Po@am__quote@ # am--include-marker + +$(am__depfiles_remade): + @$(MKDIR_P) $(@D) + @echo '# dummy' >$@-t && $(am__mv) $@-t $@ + +am--depfiles: $(am__depfiles_remade) + +.c.o: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< + +.c.obj: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` +install-man1: $(man_MANS) + @$(NORMAL_INSTALL) + @list1=''; \ + list2='$(man_MANS)'; \ + test -n "$(man1dir)" \ + && test -n "`echo $$list1$$list2`" \ + || exit 0; \ + echo " $(MKDIR_P) '$(DESTDIR)$(man1dir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(man1dir)" || exit 1; \ + { for i in $$list1; do echo "$$i"; done; \ + if test -n "$$list2"; then \ + for i in $$list2; do echo "$$i"; done \ + | sed -n '/\.1[a-z]*$$/p'; \ + fi; \ + } | while read p; do \ + if test -f $$p; then d=; else d="$(srcdir)/"; fi; \ + echo "$$d$$p"; echo "$$p"; \ + done | \ + sed -e 'n;s,.*/,,;p;h;s,.*\.,,;s,^[^1][0-9a-z]*$$,1,;x' \ + -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,' | \ + sed 'N;N;s,\n, ,g' | { \ + list=; while read file base inst; do \ + if test "$$base" = "$$inst"; then list="$$list $$file"; else \ + echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man1dir)/$$inst'"; \ + $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man1dir)/$$inst" || exit $$?; \ + fi; \ + done; \ + for i in $$list; do echo "$$i"; done | $(am__base_list) | \ + while read files; do \ + test -z "$$files" || { \ + echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(man1dir)'"; \ + $(INSTALL_DATA) $$files "$(DESTDIR)$(man1dir)" || exit $$?; }; \ + done; } + +uninstall-man1: + @$(NORMAL_UNINSTALL) + @list=''; test -n "$(man1dir)" || exit 0; \ + files=`{ for i in $$list; do echo "$$i"; done; \ + l2='$(man_MANS)'; for i in $$l2; do echo "$$i"; done | \ + sed -n '/\.1[a-z]*$$/p'; \ + } | sed -e 's,.*/,,;h;s,.*\.,,;s,^[^1][0-9a-z]*$$,1,;x' \ + -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,'`; \ + dir='$(DESTDIR)$(man1dir)'; $(am__uninstall_files_from_dir) + +ID: $(am__tagged_files) + $(am__define_uniq_tagged_files); mkid -fID $$unique +tags: tags-am +TAGS: tags + +tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + set x; \ + here=`pwd`; \ + $(am__define_uniq_tagged_files); \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: ctags-am + +CTAGS: ctags +ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + $(am__define_uniq_tagged_files); \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" +cscopelist: cscopelist-am + +cscopelist-am: $(am__tagged_files) + list='$(am__tagged_files)'; \ + case "$(srcdir)" in \ + [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ + *) sdir=$(subdir)/$(srcdir) ;; \ + esac; \ + for i in $$list; do \ + if test -f "$$i"; then \ + echo "$(subdir)/$$i"; \ + else \ + echo "$$sdir/$$i"; \ + fi; \ + done >> $(top_builddir)/cscope.files + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) distdir-am + +distdir-am: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(PROGRAMS) $(MANS) +installdirs: + for dir in "$(DESTDIR)$(bindir)" "$(DESTDIR)$(man1dir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ + done +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-binPROGRAMS clean-generic mostlyclean-am + +distclean: distclean-am + -rm -f ./$(DEPDIR)/amidi.Po + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: install-man + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: install-binPROGRAMS + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: install-man1 + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -f ./$(DEPDIR)/amidi.Po + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-binPROGRAMS uninstall-man + +uninstall-man: uninstall-man1 + +.MAKE: install-am install-strip + +.PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-am clean \ + clean-binPROGRAMS clean-generic cscopelist-am ctags ctags-am \ + distclean distclean-compile distclean-generic distclean-tags \ + distdir dvi dvi-am html html-am info info-am install \ + install-am install-binPROGRAMS install-data install-data-am \ + install-dvi install-dvi-am install-exec install-exec-am \ + install-html install-html-am install-info install-info-am \ + install-man install-man1 install-pdf install-pdf-am install-ps \ + install-ps-am install-strip installcheck installcheck-am \ + installdirs maintainer-clean maintainer-clean-generic \ + mostlyclean mostlyclean-compile mostlyclean-generic pdf pdf-am \ + ps ps-am tags tags-am uninstall uninstall-am \ + uninstall-binPROGRAMS uninstall-man uninstall-man1 + +.PRECIOUS: Makefile + + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/amidi/amidi.1 b/amidi/amidi.1 new file mode 100644 index 0000000..5bc24ba --- /dev/null +++ b/amidi/amidi.1 @@ -0,0 +1,178 @@ +.TH AMIDI 1 "30 Aug 2016" + +.SH NAME +amidi \- read from and write to ALSA RawMIDI ports + +.SH SYNOPSIS +\fBamidi\fP [\fI\-p port\fP] [\fI\-s file\fP | \fI\-S data\fP] +[\fI\-r file\fP] [\fI\-d\fP] [\fI\-t seconds\fP] [\fI\-a\fP] + +.SH DESCRIPTION +.B amidi +is a command-line utility which allows one to receive and send +SysEx (system exclusive) data from/to external MIDI devices. +It can also send any other MIDI commands. + +.B amidi +handles only files containing raw MIDI commands, without timing +information. +.B amidi +does not support Standard MIDI (.mid) files, but +.B aplaymidi(1) +and +.B arecordmidi(1) +do. + +.SH OPTIONS + +Use the +.I \-h, +.I \-V, +.I \-l, +or +.I \-L +options to display information; +or use at least one of the +.I \-s, +.I \-r, +.I \-S, +or +.I \-d +options to specify what data to send or receive. + +.TP +.I \-h, \-\-help +Help: prints a list of options. + +.TP +.I \-V, \-\-version +Prints the current version. + +.TP +.I \-l, \-\-list\-devices +Prints a list of all hardware MIDI ports. + +.TP +.I \-L, \-\-list\-rawmidis +Prints all RawMIDI definitions. +(used when debugging configuration files) + +.TP +.I \-p, \-\-port=name +Sets the name of the ALSA RawMIDI port to use. +If this is not specified, +.B amidi +uses the default port defined in the configuration file +(the default for this is port 0 on card 0, which may not exist). + +.TP +.I \-s, \-\-send=filename +Sends the contents of the specified file to the MIDI port. +The file must contain raw MIDI commands (e.g. a .syx file); +for Standard MIDI (.mid) files, use +.B aplaymidi(1). + +.TP +.I \-r, \-\-receive=filename +Writes data received from the MIDI port into the specified file. +The file will contain raw MIDI commands (such as in a .syx file); +to record a Standard MIDI (.mid) file, use +.B arecordmidi(1). + +.B amidi +will filter out any Active Sensing and Clock bytes (FEh, F8h), unless the +.I \-a +or +.I \-c +options have been given. + +.TP +.I \-S, \-\-send\-hex="..." +Sends the bytes specified as hexadecimal numbers to the MIDI port. + +.TP +.I \-d, \-\-dump +Prints data received from the MIDI port as hexadecimal bytes. +Active Sensing and Clock bytes (FEh, F8h) will not be shown, unless the +.I \-a +or +.I \-c +options have been given. + +This option is useful for debugging. + +.TP +.I \-t, \-\-timeout=seconds +Stops receiving data when no data has been received for the specified +amount of time. + +If this option has not been given, you must press Ctrl+C (or kill +.B amidi\fR) +to stop receiving data. + +.TP +.I \-a, \-\-active\-sensing +Does not ignore Active Sensing bytes (FEh) when saving or printing +received MIDI commands. + +.TP +.I \-c, \-\-clock +Does not ignore Clock bytes (F8h) when saving or printing received +MIDI commands. + +.TP +.I \-i, \-\-sysex-interval=mseconds +Adds a delay in between each SysEx message sent to a device. It is +useful when sending firmware updates via SysEx messages to a remote +device. + +.SH EXAMPLES + +.TP +.B amidi \-p hw:0 \-s my_settings.syx +will send the MIDI commands in +.I my_settings.syx +to port +.I hw:0. + +.TP +.B amidi \-p hw:1,0,0 -s firmware.syx \-i 100 +will send the MIDI commands in +.I firmware.syx +to port +.I hw:1,0,0 +with 100 milliseconds delay in between each SysEx message. + +.TP +.B amidi \-S 'F0 43 10 4C 00 00 7E 00 F7' +sends an XG Reset to the default port. + +.TP +.B amidi \-p hw:1,2 \-S F0411042110C000000000074F7 \-r dump.syx \-t 1 +sends a \(lqParameter Dump Request\(rq to a GS device, saves the received +parameter data to the file +.I dump.syx, +and stops after the device has finished sending data +(when no data has been received for one second). + +.TP +.B amidi \-p virtual \-d +creates a virtual RawMIDI port and prints all data sent to this port. + +.SH FILES +.I /usr/share/alsa/alsa.conf +default rawmidi definitions +.br +.I /etc/asound.conf +system\-wide rawmidi definitions +.br +.I ~/.asoundrc +user specific rawmidi definitions + +.SH SEE ALSO +aplaymidi(1) +.br +arecordmidi(1) + +.SH AUTHOR +Clemens Ladisch diff --git a/amidi/amidi.c b/amidi/amidi.c new file mode 100644 index 0000000..cde4697 --- /dev/null +++ b/amidi/amidi.c @@ -0,0 +1,721 @@ +/* + * amidi.c - read from/write to RawMIDI ports + * + * Copyright (c) Clemens Ladisch + * + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#define _GNU_SOURCE +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "aconfig.h" +#include "version.h" + +#define NSEC_PER_SEC 1000000000L + +static int do_device_list, do_rawmidi_list; +static char *port_name = "default"; +static char *send_file_name; +static char *receive_file_name; +static char *send_hex; +static char *send_data; +static int send_data_length; +static int receive_file; +static int dump; +static float timeout; +static int stop; +static int sysex_interval; +static snd_rawmidi_t *input, **inputp; +static snd_rawmidi_t *output, **outputp; + +static void error(const char *format, ...) +{ + va_list ap; + + va_start(ap, format); + vfprintf(stderr, format, ap); + va_end(ap); + putc('\n', stderr); +} + +static void usage(void) +{ + printf( + "Usage: amidi options\n" + "\n" + "-h, --help this help\n" + "-V, --version print current version\n" + "-l, --list-devices list all hardware ports\n" + "-L, --list-rawmidis list all RawMIDI definitions\n" + "-p, --port=name select port by name\n" + "-s, --send=file send the contents of a (.syx) file\n" + "-r, --receive=file write received data into a file\n" + "-S, --send-hex=\"...\" send hexadecimal bytes\n" + "-d, --dump print received data as hexadecimal bytes\n" + "-t, --timeout=seconds exits when no data has been received\n" + " for the specified duration\n" + "-a, --active-sensing include active sensing bytes\n" + "-c, --clock include clock bytes\n" + "-i, --sysex-interval=mseconds delay in between each SysEx message\n"); +} + +static void version(void) +{ + puts("amidi version " SND_UTIL_VERSION_STR); +} + +static void *my_malloc(size_t size) +{ + void *p = malloc(size); + if (!p) { + error("out of memory"); + exit(EXIT_FAILURE); + } + return p; +} + +static void list_device(snd_ctl_t *ctl, int card, int device) +{ + snd_rawmidi_info_t *info; + const char *name; + const char *sub_name; + int subs, subs_in, subs_out; + int sub; + int err; + + snd_rawmidi_info_alloca(&info); + snd_rawmidi_info_set_device(info, device); + + snd_rawmidi_info_set_stream(info, SND_RAWMIDI_STREAM_INPUT); + err = snd_ctl_rawmidi_info(ctl, info); + if (err >= 0) + subs_in = snd_rawmidi_info_get_subdevices_count(info); + else + subs_in = 0; + + snd_rawmidi_info_set_stream(info, SND_RAWMIDI_STREAM_OUTPUT); + err = snd_ctl_rawmidi_info(ctl, info); + if (err >= 0) + subs_out = snd_rawmidi_info_get_subdevices_count(info); + else + subs_out = 0; + + subs = subs_in > subs_out ? subs_in : subs_out; + if (!subs) + return; + + for (sub = 0; sub < subs; ++sub) { + snd_rawmidi_info_set_stream(info, sub < subs_in ? + SND_RAWMIDI_STREAM_INPUT : + SND_RAWMIDI_STREAM_OUTPUT); + snd_rawmidi_info_set_subdevice(info, sub); + err = snd_ctl_rawmidi_info(ctl, info); + if (err < 0) { + error("cannot get rawmidi information %d:%d:%d: %s\n", + card, device, sub, snd_strerror(err)); + return; + } + name = snd_rawmidi_info_get_name(info); + sub_name = snd_rawmidi_info_get_subdevice_name(info); + if (sub == 0 && sub_name[0] == '\0') { + printf("%c%c hw:%d,%d %s", + sub < subs_in ? 'I' : ' ', + sub < subs_out ? 'O' : ' ', + card, device, name); + if (subs > 1) + printf(" (%d subdevices)", subs); + putchar('\n'); + break; + } else { + printf("%c%c hw:%d,%d,%d %s\n", + sub < subs_in ? 'I' : ' ', + sub < subs_out ? 'O' : ' ', + card, device, sub, sub_name); + } + } +} + +static void list_card_devices(int card) +{ + snd_ctl_t *ctl; + char name[32]; + int device; + int err; + + sprintf(name, "hw:%d", card); + if ((err = snd_ctl_open(&ctl, name, 0)) < 0) { + error("cannot open control for card %d: %s", card, snd_strerror(err)); + return; + } + device = -1; + for (;;) { + if ((err = snd_ctl_rawmidi_next_device(ctl, &device)) < 0) { + error("cannot determine device number: %s", snd_strerror(err)); + break; + } + if (device < 0) + break; + list_device(ctl, card, device); + } + snd_ctl_close(ctl); +} + +static void device_list(void) +{ + int card, err; + + card = -1; + if ((err = snd_card_next(&card)) < 0) { + error("cannot determine card number: %s", snd_strerror(err)); + return; + } + if (card < 0) { + error("no sound card found"); + return; + } + puts("Dir Device Name"); + do { + list_card_devices(card); + if ((err = snd_card_next(&card)) < 0) { + error("cannot determine card number: %s", snd_strerror(err)); + break; + } + } while (card >= 0); +} + +static void rawmidi_list(void) +{ + snd_output_t *output; + snd_config_t *config; + int err; + + if ((err = snd_config_update()) < 0) { + error("snd_config_update failed: %s", snd_strerror(err)); + return; + } + if ((err = snd_output_stdio_attach(&output, stdout, 0)) < 0) { + error("snd_output_stdio_attach failed: %s", snd_strerror(err)); + return; + } + if (snd_config_search(snd_config, "rawmidi", &config) >= 0) { + puts("RawMIDI list:"); + snd_config_save(config, output); + } + snd_output_close(output); +} + +static int send_midi_interleaved(void) +{ + int err; + char *data = send_data; + size_t buffer_size; + snd_rawmidi_params_t *param; + snd_rawmidi_status_t *st; + + snd_rawmidi_status_alloca(&st); + + snd_rawmidi_params_alloca(¶m); + snd_rawmidi_params_current(output, param); + buffer_size = snd_rawmidi_params_get_buffer_size(param); + + while (data < (send_data + send_data_length)) { + int len = send_data + send_data_length - data; + char *temp; + + if (data > send_data) { + snd_rawmidi_status(output, st); + do { + /* 320 µs per byte as noted in Page 1 of MIDI spec */ + usleep((buffer_size - snd_rawmidi_status_get_avail(st)) * 320); + snd_rawmidi_status(output, st); + } while(snd_rawmidi_status_get_avail(st) < buffer_size); + usleep(sysex_interval * 1000); + } + + /* find end of SysEx */ + if ((temp = memchr(data, 0xf7, len)) != NULL) + len = temp - data + 1; + + if ((err = snd_rawmidi_write(output, data, len)) < 0) + return err; + + data += len; + } + + return 0; +} + +static void load_file(void) +{ + int fd; + off_t length; + + fd = open(send_file_name, O_RDONLY); + if (fd == -1) { + error("cannot open %s - %s", send_file_name, strerror(errno)); + return; + } + length = lseek(fd, 0, SEEK_END); + if (length == (off_t)-1) { + error("cannot determine length of %s: %s", send_file_name, strerror(errno)); + goto _error; + } + send_data = my_malloc(length); + lseek(fd, 0, SEEK_SET); + if (read(fd, send_data, length) != length) { + error("cannot read from %s: %s", send_file_name, strerror(errno)); + goto _error; + } + if (length >= 4 && !memcmp(send_data, "MThd", 4)) { + error("%s is a Standard MIDI File; use aplaymidi to send it", send_file_name); + goto _error; + } + send_data_length = length; + goto _exit; +_error: + free(send_data); + send_data = NULL; +_exit: + close(fd); +} + +static int hex_value(char c) +{ + if ('0' <= c && c <= '9') + return c - '0'; + if ('A' <= c && c <= 'F') + return c - 'A' + 10; + if ('a' <= c && c <= 'f') + return c - 'a' + 10; + error("invalid character %c", c); + return -1; +} + +static void parse_data(void) +{ + const char *p; + int i, value; + + send_data = my_malloc(strlen(send_hex)); /* guesstimate */ + i = 0; + value = -1; /* value is >= 0 when the first hex digit of a byte has been read */ + for (p = send_hex; *p; ++p) { + int digit; + if (isspace((unsigned char)*p)) { + if (value >= 0) { + send_data[i++] = value; + value = -1; + } + continue; + } + digit = hex_value(*p); + if (digit < 0) { + send_data = NULL; + return; + } + if (value < 0) { + value = digit; + } else { + send_data[i++] = (value << 4) | digit; + value = -1; + } + } + if (value >= 0) + send_data[i++] = value; + send_data_length = i; +} + +/* + * prints MIDI commands, formatting them nicely + */ +static void print_byte(unsigned char byte) +{ + static enum { + STATE_UNKNOWN, + STATE_1PARAM, + STATE_1PARAM_CONTINUE, + STATE_2PARAM_1, + STATE_2PARAM_2, + STATE_2PARAM_1_CONTINUE, + STATE_SYSEX + } state = STATE_UNKNOWN; + int newline = 0; + + if (byte >= 0xf8) + newline = 1; + else if (byte >= 0xf0) { + newline = 1; + switch (byte) { + case 0xf0: + state = STATE_SYSEX; + break; + case 0xf1: + case 0xf3: + state = STATE_1PARAM; + break; + case 0xf2: + state = STATE_2PARAM_1; + break; + case 0xf4: + case 0xf5: + case 0xf6: + state = STATE_UNKNOWN; + break; + case 0xf7: + newline = state != STATE_SYSEX; + state = STATE_UNKNOWN; + break; + } + } else if (byte >= 0x80) { + newline = 1; + if (byte >= 0xc0 && byte <= 0xdf) + state = STATE_1PARAM; + else + state = STATE_2PARAM_1; + } else /* b < 0x80 */ { + int running_status = 0; + newline = state == STATE_UNKNOWN; + switch (state) { + case STATE_1PARAM: + state = STATE_1PARAM_CONTINUE; + break; + case STATE_1PARAM_CONTINUE: + running_status = 1; + break; + case STATE_2PARAM_1: + state = STATE_2PARAM_2; + break; + case STATE_2PARAM_2: + state = STATE_2PARAM_1_CONTINUE; + break; + case STATE_2PARAM_1_CONTINUE: + running_status = 1; + state = STATE_2PARAM_2; + break; + default: + break; + } + if (running_status) + fputs("\n ", stdout); + } + printf("%c%02X", newline ? '\n' : ' ', byte); +} + +static void sig_handler(int dummy) +{ + stop = 1; +} + +static void add_send_hex_data(const char *str) +{ + int length; + char *s; + + length = (send_hex ? strlen(send_hex) + 1 : 0) + strlen(str) + 1; + s = my_malloc(length); + if (send_hex) { + strcpy(s, send_hex); + strcat(s, " "); + } else { + s[0] = '\0'; + } + strcat(s, str); + free(send_hex); + send_hex = s; +} + +int main(int argc, char *argv[]) +{ + static const char short_options[] = "hVlLp:s:r:S::dt:aci:"; + static const struct option long_options[] = { + {"help", 0, NULL, 'h'}, + {"version", 0, NULL, 'V'}, + {"list-devices", 0, NULL, 'l'}, + {"list-rawmidis", 0, NULL, 'L'}, + {"port", 1, NULL, 'p'}, + {"send", 1, NULL, 's'}, + {"receive", 1, NULL, 'r'}, + {"send-hex", 2, NULL, 'S'}, + {"dump", 0, NULL, 'd'}, + {"timeout", 1, NULL, 't'}, + {"active-sensing", 0, NULL, 'a'}, + {"clock", 0, NULL, 'c'}, + {"sysex-interval", 1, NULL, 'i'}, + {0} + }; + int c, err, ok = 0; + int ignore_active_sensing = 1; + int ignore_clock = 1; + int do_send_hex = 0; + struct itimerspec itimerspec = { .it_interval = { 0, 0 } }; + + while ((c = getopt_long(argc, argv, short_options, + long_options, NULL)) != -1) { + switch (c) { + case 'h': + usage(); + return 0; + case 'V': + version(); + return 0; + case 'l': + do_device_list = 1; + break; + case 'L': + do_rawmidi_list = 1; + break; + case 'p': + port_name = optarg; + break; + case 's': + send_file_name = optarg; + break; + case 'r': + receive_file_name = optarg; + break; + case 'S': + do_send_hex = 1; + if (optarg) + add_send_hex_data(optarg); + break; + case 'd': + dump = 1; + break; + case 't': + if (optarg) + timeout = atof(optarg); + break; + case 'a': + ignore_active_sensing = 0; + break; + case 'c': + ignore_clock = 0; + break; + case 'i': + sysex_interval = atoi(optarg); + break; + default: + error("Try `amidi --help' for more information."); + return 1; + } + } + if (do_send_hex) { + /* data for -S can be specified as multiple arguments */ + if (!send_hex && !argv[optind]) { + error("Please specify some data for --send-hex."); + return 1; + } + for (; argv[optind]; ++optind) + add_send_hex_data(argv[optind]); + } else { + if (argv[optind]) { + error("%s is not an option.", argv[optind]); + return 1; + } + } + + if (do_rawmidi_list) + rawmidi_list(); + if (do_device_list) + device_list(); + if (do_rawmidi_list || do_device_list) + return 0; + + if (!send_file_name && !receive_file_name && !send_hex && !dump) { + error("Please specify at least one of --send, --receive, --send-hex, or --dump."); + return 1; + } + if (send_file_name && send_hex) { + error("--send and --send-hex cannot be specified at the same time."); + return 1; + } + + if (send_file_name) + load_file(); + else if (send_hex) + parse_data(); + if ((send_file_name || send_hex) && !send_data) + return 1; + + if (receive_file_name) { + receive_file = creat(receive_file_name, 0666); + if (receive_file == -1) { + error("cannot create %s: %s", receive_file_name, strerror(errno)); + return -1; + } + } else { + receive_file = -1; + } + + if (receive_file_name || dump) + inputp = &input; + else + inputp = NULL; + if (send_data) + outputp = &output; + else + outputp = NULL; + + if ((err = snd_rawmidi_open(inputp, outputp, port_name, SND_RAWMIDI_NONBLOCK)) < 0) { + error("cannot open port \"%s\": %s", port_name, snd_strerror(err)); + goto _exit2; + } + + if (inputp) + snd_rawmidi_read(input, NULL, 0); /* trigger reading */ + + if (send_data) { + if ((err = snd_rawmidi_nonblock(output, 0)) < 0) { + error("cannot set blocking mode: %s", snd_strerror(err)); + goto _exit; + } + if (!sysex_interval) { + if ((err = snd_rawmidi_write(output, send_data, send_data_length)) < 0) { + error("cannot send data: %s", snd_strerror(err)); + return err; + } + } else { + if ((err = send_midi_interleaved()) < 0) { + error("cannot send data: %s", snd_strerror(err)); + return err; + } + } + } + + if (inputp) { + int read = 0; + int npfds; + struct pollfd *pfds; + + npfds = 1 + snd_rawmidi_poll_descriptors_count(input); + pfds = alloca(npfds * sizeof(struct pollfd)); + + if (timeout > 0) { + pfds[0].fd = timerfd_create(CLOCK_MONOTONIC, 0); + if (pfds[0].fd == -1) { + error("cannot create timer: %s", strerror(errno)); + goto _exit; + } + pfds[0].events = POLLIN; + } else { + pfds[0].fd = -1; + } + + snd_rawmidi_poll_descriptors(input, &pfds[1], npfds - 1); + + signal(SIGINT, sig_handler); + + if (timeout > 0) { + float timeout_int; + + itimerspec.it_value.tv_nsec = modff(timeout, &timeout_int) * NSEC_PER_SEC; + itimerspec.it_value.tv_sec = timeout_int; + err = timerfd_settime(pfds[0].fd, 0, &itimerspec, NULL); + if (err < 0) { + error("cannot set timer: %s", strerror(errno)); + goto _exit; + } + } + for (;;) { + unsigned char buf[256]; + int i, length; + unsigned short revents; + + err = poll(pfds, npfds, -1); + if (stop || (err < 0 && errno == EINTR)) + break; + if (err < 0) { + error("poll failed: %s", strerror(errno)); + break; + } + + err = snd_rawmidi_poll_descriptors_revents(input, &pfds[1], npfds - 1, &revents); + if (err < 0) { + error("cannot get poll events: %s", snd_strerror(errno)); + break; + } + if (revents & (POLLERR | POLLHUP)) + break; + if (!(revents & POLLIN)) { + if (pfds[0].revents & POLLIN) + break; + continue; + } + + err = snd_rawmidi_read(input, buf, sizeof(buf)); + if (err == -EAGAIN) + continue; + if (err < 0) { + error("cannot read from port \"%s\": %s", port_name, snd_strerror(err)); + break; + } + length = 0; + for (i = 0; i < err; ++i) + if ((buf[i] != MIDI_CMD_COMMON_CLOCK && + buf[i] != MIDI_CMD_COMMON_SENSING) || + (buf[i] == MIDI_CMD_COMMON_CLOCK && !ignore_clock) || + (buf[i] == MIDI_CMD_COMMON_SENSING && !ignore_active_sensing)) + buf[length++] = buf[i]; + if (length == 0) + continue; + read += length; + + if (receive_file != -1) + write(receive_file, buf, length); + if (dump) { + for (i = 0; i < length; ++i) + print_byte(buf[i]); + fflush(stdout); + } + + if (timeout > 0) { + err = timerfd_settime(pfds[0].fd, 0, &itimerspec, NULL); + if (err < 0) { + error("cannot set timer: %s", strerror(errno)); + break; + } + } + } + if (isatty(fileno(stdout))) + printf("\n%d bytes read\n", read); + } + + ok = 1; +_exit: + if (inputp) + snd_rawmidi_close(input); + if (outputp) + snd_rawmidi_close(output); +_exit2: + if (receive_file != -1) + close(receive_file); + return !ok; +} diff --git a/amixer/Makefile.am b/amixer/Makefile.am new file mode 100644 index 0000000..b4526ca --- /dev/null +++ b/amixer/Makefile.am @@ -0,0 +1,11 @@ +AM_CFLAGS = -D_GNU_SOURCE +AM_CPPFLAGS = -I$(top_srcdir)/include +LDADD = -lm +# LDFLAGS = -static +# CFLAGS += -g -Wall + +bin_PROGRAMS = amixer +amixer_SOURCES = amixer.c ../alsamixer/volume_mapping.c +noinst_HEADERS = amixer.h +man_MANS = amixer.1 +EXTRA_DIST = amixer.1 diff --git a/amixer/Makefile.in b/amixer/Makefile.in new file mode 100644 index 0000000..8d10466 --- /dev/null +++ b/amixer/Makefile.in @@ -0,0 +1,747 @@ +# Makefile.in generated by automake 1.16.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994-2018 Free Software Foundation, Inc. + +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + + +VPATH = @srcdir@ +am__is_gnu_make = { \ + if test -z '$(MAKELEVEL)'; then \ + false; \ + elif test -n '$(MAKE_HOST)'; then \ + true; \ + elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ + true; \ + else \ + false; \ + fi; \ +} +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + esac; \ + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +bin_PROGRAMS = amixer$(EXEEXT) +subdir = amixer +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/gettext.m4 \ + $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/lib-ld.m4 \ + $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ + $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \ + $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/acinclude.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +DIST_COMMON = $(srcdir)/Makefile.am $(noinst_HEADERS) \ + $(am__DIST_COMMON) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/include/aconfig.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +am__installdirs = "$(DESTDIR)$(bindir)" "$(DESTDIR)$(man1dir)" +PROGRAMS = $(bin_PROGRAMS) +am_amixer_OBJECTS = amixer.$(OBJEXT) volume_mapping.$(OBJEXT) +amixer_OBJECTS = $(am_amixer_OBJECTS) +amixer_LDADD = $(LDADD) +amixer_DEPENDENCIES = +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__maybe_remake_depfiles = depfiles +am__depfiles_remade = ./$(DEPDIR)/amixer.Po \ + ./$(DEPDIR)/volume_mapping.Po +am__mv = mv -f +AM_V_lt = $(am__v_lt_@AM_V@) +am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) +am__v_lt_0 = --silent +am__v_lt_1 = +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +AM_V_CC = $(am__v_CC_@AM_V@) +am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) +am__v_CC_0 = @echo " CC " $@; +am__v_CC_1 = +CCLD = $(CC) +LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_CCLD = $(am__v_CCLD_@AM_V@) +am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) +am__v_CCLD_0 = @echo " CCLD " $@; +am__v_CCLD_1 = +SOURCES = $(amixer_SOURCES) +DIST_SOURCES = $(amixer_SOURCES) +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; +am__vpath_adj = case $$p in \ + $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ + *) f=$$p;; \ + esac; +am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; +am__install_max = 40 +am__nobase_strip_setup = \ + srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` +am__nobase_strip = \ + for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" +am__nobase_list = $(am__nobase_strip_setup); \ + for p in $$list; do echo "$$p $$p"; done | \ + sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ + $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ + if (++n[$$2] == $(am__install_max)) \ + { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ + END { for (dir in files) print dir, files[dir] }' +am__base_list = \ + sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ + sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' +am__uninstall_files_from_dir = { \ + test -z "$$files" \ + || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ + || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ + $(am__cd) "$$dir" && rm -f $$files; }; \ + } +man1dir = $(mandir)/man1 +NROFF = nroff +MANS = $(man_MANS) +HEADERS = $(noinst_HEADERS) +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) +# Read a list of newline-separated strings from the standard input, +# and print each of them once, without duplicates. Input order is +# *not* preserved. +am__uniquify_input = $(AWK) '\ + BEGIN { nonempty = 0; } \ + { items[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in items) print i; }; } \ +' +# Make sure the list of sources is unique. This is necessary because, +# e.g., the same source file might be shared among _SOURCES variables +# for different programs/libraries. +am__define_uniq_tagged_files = \ + list='$(am__tagged_files)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | $(am__uniquify_input)` +ETAGS = etags +CTAGS = ctags +am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/depcomp +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +ALSACTL_DAEMONSWITCH = @ALSACTL_DAEMONSWITCH@ +ALSACTL_PIDFILE_DIR = @ALSACTL_PIDFILE_DIR@ +ALSA_CFLAGS = @ALSA_CFLAGS@ +ALSA_LIBS = @ALSA_LIBS@ +ALSA_TOPOLOGY_LIBS = @ALSA_TOPOLOGY_LIBS@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +ASOUND_LOCK_DIR = @ASOUND_LOCK_DIR@ +ASOUND_STATE_DIR = @ASOUND_STATE_DIR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CURSESINC = @CURSESINC@ +CURSESLIB = @CURSESLIB@ +CURSES_CFLAGS = @CURSES_CFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +FFTW_CFLAGS = @FFTW_CFLAGS@ +FFTW_INC = @FFTW_INC@ +FFTW_LIB = @FFTW_LIB@ +GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ +GMSGFMT = @GMSGFMT@ +GMSGFMT_015 = @GMSGFMT_015@ +GREP = @GREP@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +INTLLIBS = @INTLLIBS@ +INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@ +LDFLAGS = @LDFLAGS@ +LIBICONV = @LIBICONV@ +LIBINTL = @LIBINTL@ +LIBOBJS = @LIBOBJS@ +LIBRT = @LIBRT@ +LIBS = @LIBS@ +LN_S = @LN_S@ +LTLIBICONV = @LTLIBICONV@ +LTLIBINTL = @LTLIBINTL@ +LTLIBOBJS = @LTLIBOBJS@ +MAINT = @MAINT@ +MAKEINFO = @MAKEINFO@ +MKDIR_P = @MKDIR_P@ +MSGFMT = @MSGFMT@ +MSGFMT_015 = @MSGFMT_015@ +MSGMERGE = @MSGMERGE@ +NCURSESW_CFLAGS = @NCURSESW_CFLAGS@ +NCURSESW_LIBS = @NCURSESW_LIBS@ +NCURSES_CFLAGS = @NCURSES_CFLAGS@ +NCURSES_LIBS = @NCURSES_LIBS@ +OBJEXT = @OBJEXT@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ +POSUB = @POSUB@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +SND_UTIL_MAJOR = @SND_UTIL_MAJOR@ +SND_UTIL_MINOR = @SND_UTIL_MINOR@ +SND_UTIL_SUBMINOR = @SND_UTIL_SUBMINOR@ +SND_UTIL_VERSION = @SND_UTIL_VERSION@ +STRIP = @STRIP@ +SYSTEMD_CFLAGS = @SYSTEMD_CFLAGS@ +SYSTEMD_LIBS = @SYSTEMD_LIBS@ +TESTSOUND = @TESTSOUND@ +USE_NLS = @USE_NLS@ +VERSION = @VERSION@ +XGETTEXT = @XGETTEXT@ +XGETTEXT_015 = @XGETTEXT_015@ +XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_CC = @ac_ct_CC@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +mydatadir = @mydatadir@ +ncurses5_config = @ncurses5_config@ +ncursesw5_config = @ncursesw5_config@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +rst2man_available = @rst2man_available@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +systemdsystemunitdir = @systemdsystemunitdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +udevrulesdir = @udevrulesdir@ +xmlto_available = @xmlto_available@ +AM_CFLAGS = -D_GNU_SOURCE +AM_CPPFLAGS = -I$(top_srcdir)/include +LDADD = -lm +amixer_SOURCES = amixer.c ../alsamixer/volume_mapping.c +noinst_HEADERS = amixer.h +man_MANS = amixer.1 +EXTRA_DIST = amixer.1 +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .o .obj +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign amixer/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --foreign amixer/Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): +install-binPROGRAMS: $(bin_PROGRAMS) + @$(NORMAL_INSTALL) + @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(bindir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(bindir)" || exit 1; \ + fi; \ + for p in $$list; do echo "$$p $$p"; done | \ + sed 's/$(EXEEXT)$$//' | \ + while read p p1; do if test -f $$p \ + ; then echo "$$p"; echo "$$p"; else :; fi; \ + done | \ + sed -e 'p;s,.*/,,;n;h' \ + -e 's|.*|.|' \ + -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \ + sed 'N;N;N;s,\n, ,g' | \ + $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \ + { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \ + if ($$2 == $$4) files[d] = files[d] " " $$1; \ + else { print "f", $$3 "/" $$4, $$1; } } \ + END { for (d in files) print "f", d, files[d] }' | \ + while read type dir files; do \ + if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \ + test -z "$$files" || { \ + echo " $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(bindir)$$dir'"; \ + $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \ + } \ + ; done + +uninstall-binPROGRAMS: + @$(NORMAL_UNINSTALL) + @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ + files=`for p in $$list; do echo "$$p"; done | \ + sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \ + -e 's/$$/$(EXEEXT)/' \ + `; \ + test -n "$$list" || exit 0; \ + echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \ + cd "$(DESTDIR)$(bindir)" && rm -f $$files + +clean-binPROGRAMS: + -test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS) + +amixer$(EXEEXT): $(amixer_OBJECTS) $(amixer_DEPENDENCIES) $(EXTRA_amixer_DEPENDENCIES) + @rm -f amixer$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(amixer_OBJECTS) $(amixer_LDADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/amixer.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/volume_mapping.Po@am__quote@ # am--include-marker + +$(am__depfiles_remade): + @$(MKDIR_P) $(@D) + @echo '# dummy' >$@-t && $(am__mv) $@-t $@ + +am--depfiles: $(am__depfiles_remade) + +.c.o: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< + +.c.obj: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` + +volume_mapping.o: ../alsamixer/volume_mapping.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT volume_mapping.o -MD -MP -MF $(DEPDIR)/volume_mapping.Tpo -c -o volume_mapping.o `test -f '../alsamixer/volume_mapping.c' || echo '$(srcdir)/'`../alsamixer/volume_mapping.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/volume_mapping.Tpo $(DEPDIR)/volume_mapping.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='../alsamixer/volume_mapping.c' object='volume_mapping.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o volume_mapping.o `test -f '../alsamixer/volume_mapping.c' || echo '$(srcdir)/'`../alsamixer/volume_mapping.c + +volume_mapping.obj: ../alsamixer/volume_mapping.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT volume_mapping.obj -MD -MP -MF $(DEPDIR)/volume_mapping.Tpo -c -o volume_mapping.obj `if test -f '../alsamixer/volume_mapping.c'; then $(CYGPATH_W) '../alsamixer/volume_mapping.c'; else $(CYGPATH_W) '$(srcdir)/../alsamixer/volume_mapping.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/volume_mapping.Tpo $(DEPDIR)/volume_mapping.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='../alsamixer/volume_mapping.c' object='volume_mapping.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o volume_mapping.obj `if test -f '../alsamixer/volume_mapping.c'; then $(CYGPATH_W) '../alsamixer/volume_mapping.c'; else $(CYGPATH_W) '$(srcdir)/../alsamixer/volume_mapping.c'; fi` +install-man1: $(man_MANS) + @$(NORMAL_INSTALL) + @list1=''; \ + list2='$(man_MANS)'; \ + test -n "$(man1dir)" \ + && test -n "`echo $$list1$$list2`" \ + || exit 0; \ + echo " $(MKDIR_P) '$(DESTDIR)$(man1dir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(man1dir)" || exit 1; \ + { for i in $$list1; do echo "$$i"; done; \ + if test -n "$$list2"; then \ + for i in $$list2; do echo "$$i"; done \ + | sed -n '/\.1[a-z]*$$/p'; \ + fi; \ + } | while read p; do \ + if test -f $$p; then d=; else d="$(srcdir)/"; fi; \ + echo "$$d$$p"; echo "$$p"; \ + done | \ + sed -e 'n;s,.*/,,;p;h;s,.*\.,,;s,^[^1][0-9a-z]*$$,1,;x' \ + -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,' | \ + sed 'N;N;s,\n, ,g' | { \ + list=; while read file base inst; do \ + if test "$$base" = "$$inst"; then list="$$list $$file"; else \ + echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man1dir)/$$inst'"; \ + $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man1dir)/$$inst" || exit $$?; \ + fi; \ + done; \ + for i in $$list; do echo "$$i"; done | $(am__base_list) | \ + while read files; do \ + test -z "$$files" || { \ + echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(man1dir)'"; \ + $(INSTALL_DATA) $$files "$(DESTDIR)$(man1dir)" || exit $$?; }; \ + done; } + +uninstall-man1: + @$(NORMAL_UNINSTALL) + @list=''; test -n "$(man1dir)" || exit 0; \ + files=`{ for i in $$list; do echo "$$i"; done; \ + l2='$(man_MANS)'; for i in $$l2; do echo "$$i"; done | \ + sed -n '/\.1[a-z]*$$/p'; \ + } | sed -e 's,.*/,,;h;s,.*\.,,;s,^[^1][0-9a-z]*$$,1,;x' \ + -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,'`; \ + dir='$(DESTDIR)$(man1dir)'; $(am__uninstall_files_from_dir) + +ID: $(am__tagged_files) + $(am__define_uniq_tagged_files); mkid -fID $$unique +tags: tags-am +TAGS: tags + +tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + set x; \ + here=`pwd`; \ + $(am__define_uniq_tagged_files); \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: ctags-am + +CTAGS: ctags +ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + $(am__define_uniq_tagged_files); \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" +cscopelist: cscopelist-am + +cscopelist-am: $(am__tagged_files) + list='$(am__tagged_files)'; \ + case "$(srcdir)" in \ + [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ + *) sdir=$(subdir)/$(srcdir) ;; \ + esac; \ + for i in $$list; do \ + if test -f "$$i"; then \ + echo "$(subdir)/$$i"; \ + else \ + echo "$$sdir/$$i"; \ + fi; \ + done >> $(top_builddir)/cscope.files + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) distdir-am + +distdir-am: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(PROGRAMS) $(MANS) $(HEADERS) +installdirs: + for dir in "$(DESTDIR)$(bindir)" "$(DESTDIR)$(man1dir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ + done +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-binPROGRAMS clean-generic mostlyclean-am + +distclean: distclean-am + -rm -f ./$(DEPDIR)/amixer.Po + -rm -f ./$(DEPDIR)/volume_mapping.Po + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: install-man + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: install-binPROGRAMS + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: install-man1 + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -f ./$(DEPDIR)/amixer.Po + -rm -f ./$(DEPDIR)/volume_mapping.Po + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-binPROGRAMS uninstall-man + +uninstall-man: uninstall-man1 + +.MAKE: install-am install-strip + +.PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-am clean \ + clean-binPROGRAMS clean-generic cscopelist-am ctags ctags-am \ + distclean distclean-compile distclean-generic distclean-tags \ + distdir dvi dvi-am html html-am info info-am install \ + install-am install-binPROGRAMS install-data install-data-am \ + install-dvi install-dvi-am install-exec install-exec-am \ + install-html install-html-am install-info install-info-am \ + install-man install-man1 install-pdf install-pdf-am install-ps \ + install-ps-am install-strip installcheck installcheck-am \ + installdirs maintainer-clean maintainer-clean-generic \ + mostlyclean mostlyclean-compile mostlyclean-generic pdf pdf-am \ + ps ps-am tags tags-am uninstall uninstall-am \ + uninstall-binPROGRAMS uninstall-man uninstall-man1 + +.PRECIOUS: Makefile + + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/amixer/amixer.1 b/amixer/amixer.1 new file mode 100644 index 0000000..76007d2 --- /dev/null +++ b/amixer/amixer.1 @@ -0,0 +1,158 @@ +.TH AMIXER 1 "11 Aug 2000" +.SH NAME +amixer \- command-line mixer for ALSA soundcard driver +.SH SYNOPSIS +\fBamixer\fP [\fI\-option\fP] [\fIcmd\fP] +.SH DESCRIPTION +\fBamixer\fP allows command\-line control of the mixer for the ALSA +soundcard driver. +\fBamixer\fP supports multiple soundcards. + +\fBamixer\fR with no arguments will display the current mixer settings +for the default soundcard and device. This is a good way to see a list +of the simple mixer controls you can use. + +.SH COMMANDS + +.TP +\fIhelp\fP +Shows syntax. + +.TP +\fIinfo\fP +Shows the information about a mixer device. + +.TP +\fIscontrols\fP +Shows a complete list of simple mixer controls. + +.TP +\fIscontents\fP +Shows a complete list of simple mixer controls with their contents. + +.TP +\fIset\fP or \fIsset\fP <\fISCONTROL\fP> <\fIPARAMETER\fP> ... +Sets the simple mixer control contents. The parameter can be the volume +either as a percentage from 0% to 100% with \fI%\fP suffix, +a dB gain with \fIdB\fP suffix (like \-12.5dB), or an exact hardware value. +The dB gain can be used only for the mixer elements with available +dB information. +When plus(+) or minus(\-) letter is appended after +volume value, the volume is incremented or decremented from the current +value, respectively. + +The parameters \fIcap, nocap, mute, unmute, toggle\fP are used to +change capture (recording) and muting for the group specified. + +The optional modifiers can be put as extra parameters to specify +the stream direction or channels to apply. +The modifiers \fIplayback\fP and \fIcapture\fP specify the stream, +and the modifiers \fIfront, rear, center, woofer\fP are used to specify +channels to be changed. + +A simple mixer control must be specified. Only one device can be controlled +at a time. + +.TP +\fIget\fP or \fIsget\fP <\fISCONTROL\fP> +Shows the simple mixer control contents. + +A simple mixer control must be specified. Only one device can be controlled +at a time. + +.TP +\fIcontrols\fP +Shows a complete list of card controls. + +.TP +\fIcontents\fP +Shows a complete list of card controls with their contents. + +.TP +\fIcset\fP <\fICONTROL\fP> <\fIPARAMETER\fP> ... +Sets the card control contents. The identifier has these components: iface, +name, index, device, subdevice, numid. The next argument specifies the value +of control. + +.TP +\fIcget\fP <\fICONTROL\fP> +Shows the card control contents. The identifier has same syntax as for +the \fIcset\fP command. + +.SH OPTIONS + +.TP +\fI\-c\fP card + +Select the card number to control. The device name created from this +parameter has syntax 'hw:N' where N is specified card number. + +.TP +\fI\-D\fP device + +Select the device name to control. The default control name is 'default'. + +.TP +\fI\-s\fP | \fI\-\-stdin\fP + +Read from stdin and execute the command on each line sequentially. +When this option is given, the command in command\-line arguments is ignored. + +Only sset and cset are accepted. Other commands are ignored. +The commands to unmatched ids are ignored without errors too. + +.TP +\fI\-h\fP +Help: show syntax. + +.TP +\fI\-q\fP +Quiet mode. Do not show results of changes. + +.TP +\fI\-R\fP +Use the raw value for evaluating the percentage representation. +This is the default mode. + +.TP +\fI\-M\fP +Use the mapped volume for evaluating the percentage representation +like \fBalsamixer\fR, to be more natural for human ear. + +.SH EXAMPLES + +.TP +\fBamixer \-c 1 sset Line,0 80%,40% unmute cap\fR +will set the second soundcard's left line input volume to 80% and +right line input to 40%, unmute it, and select it as a source for +capture (recording).\fR + +.TP +\fBamixer \-c 1 \-\- sset Master playback \-20dB\fR +will set the master volume of the second card to \-20dB. If the master +has multiple channels, all channels are set to the same value. + +.TP +\fBamixer \-c 1 set PCM 2dB+\fR +will increase the PCM volume of the second card with 2dB. When both +playback and capture volumes exist, this is applied to both volumes. + +.TP +\fBamixer \-c 2 cset iface=MIXER,name='Line Playback Volume",index=1 40%\fR +will set the third soundcard's second line playback volume(s) to 40% + +.TP +\fBamixer \-c 2 cset numid=34 40%\fR +will set the 34th soundcard element to 40% + +.SH SEE ALSO +\fB +alsamixer(1) +\fP + +.SH BUGS +None known. + +.SH AUTHOR +\fBamixer\fP is by Jaroslav Kysela . +This document is by Paul Winkler and Jaroslav Kysela . diff --git a/amixer/amixer.c b/amixer/amixer.c new file mode 100644 index 0000000..b3b9b48 --- /dev/null +++ b/amixer/amixer.c @@ -0,0 +1,1902 @@ +/* + * ALSA command line mixer utility + * Copyright (c) 1999-2000 by Jaroslav Kysela + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "amixer.h" +#include "../alsamixer/volume_mapping.h" + +#define LEVEL_BASIC (1<<0) +#define LEVEL_INACTIVE (1<<1) +#define LEVEL_ID (1<<2) + +static int quiet = 0; +static int debugflag = 0; +static int no_check = 0; +static int smixer_level = 0; +static int ignore_error = 0; +static struct snd_mixer_selem_regopt smixer_options; +static char card[64] = "default"; + +static void error(const char *fmt,...) +{ + va_list va; + + va_start(va, fmt); + fprintf(stderr, "amixer: "); + vfprintf(stderr, fmt, va); + fprintf(stderr, "\n"); + va_end(va); +} + +static int help(void) +{ + printf("Usage: amixer [command]\n"); + printf("\nAvailable options:\n"); + printf(" -h,--help this help\n"); + printf(" -c,--card N select the card\n"); + printf(" -D,--device N select the device, default '%s'\n", card); + printf(" -d,--debug debug mode\n"); + printf(" -n,--nocheck do not perform range checking\n"); + printf(" -v,--version print version of this program\n"); + printf(" -q,--quiet be quiet\n"); + printf(" -i,--inactive show also inactive controls\n"); + printf(" -a,--abstract L select abstraction level (none or basic)\n"); + printf(" -s,--stdin Read and execute commands from stdin sequentially\n"); + printf(" -R,--raw-volume Use the raw value (default)\n"); + printf(" -M,--mapped-volume Use the mapped volume\n"); + printf("\nAvailable commands:\n"); + printf(" scontrols show all mixer simple controls\n"); + printf(" scontents show contents of all mixer simple controls (default command)\n"); + printf(" sset sID P set contents for one mixer simple control\n"); + printf(" sget sID get contents for one mixer simple control\n"); + printf(" controls show all controls for given card\n"); + printf(" contents show contents of all controls for given card\n"); + printf(" cset cID P set control contents for one control\n"); + printf(" cget cID get control contents for one control\n"); + return 0; +} + +static int info(void) +{ + int err; + snd_ctl_t *handle; + snd_mixer_t *mhandle; + snd_ctl_card_info_t *info; + snd_ctl_elem_list_t *clist; + snd_ctl_card_info_alloca(&info); + snd_ctl_elem_list_alloca(&clist); + + if ((err = snd_ctl_open(&handle, card, 0)) < 0) { + error("Control device %s open error: %s", card, snd_strerror(err)); + return err; + } + + if ((err = snd_ctl_card_info(handle, info)) < 0) { + error("Control device %s hw info error: %s", card, snd_strerror(err)); + return err; + } + printf("Card %s '%s'/'%s'\n", card, snd_ctl_card_info_get_id(info), + snd_ctl_card_info_get_longname(info)); + printf(" Mixer name : '%s'\n", snd_ctl_card_info_get_mixername(info)); + printf(" Components : '%s'\n", snd_ctl_card_info_get_components(info)); + if ((err = snd_ctl_elem_list(handle, clist)) < 0) { + error("snd_ctl_elem_list failure: %s", snd_strerror(err)); + } else { + printf(" Controls : %i\n", snd_ctl_elem_list_get_count(clist)); + } + snd_ctl_close(handle); + if ((err = snd_mixer_open(&mhandle, 0)) < 0) { + error("Mixer open error: %s", snd_strerror(err)); + return err; + } + if (smixer_level == 0 && (err = snd_mixer_attach(mhandle, card)) < 0) { + error("Mixer attach %s error: %s", card, snd_strerror(err)); + snd_mixer_close(mhandle); + return err; + } + if ((err = snd_mixer_selem_register(mhandle, smixer_level > 0 ? &smixer_options : NULL, NULL)) < 0) { + error("Mixer register error: %s", snd_strerror(err)); + snd_mixer_close(mhandle); + return err; + } + err = snd_mixer_load(mhandle); + if (err < 0) { + error("Mixer load %s error: %s", card, snd_strerror(err)); + snd_mixer_close(mhandle); + return err; + } + printf(" Simple ctrls : %i\n", snd_mixer_get_count(mhandle)); + snd_mixer_close(mhandle); + return 0; +} + +static const char *control_type(snd_ctl_elem_info_t *info) +{ + return snd_ctl_elem_type_name(snd_ctl_elem_info_get_type(info)); +} + +static const char *control_access(snd_ctl_elem_info_t *info) +{ + static char result[10]; + char *res = result; + + *res++ = snd_ctl_elem_info_is_readable(info) ? 'r' : '-'; + *res++ = snd_ctl_elem_info_is_writable(info) ? 'w' : '-'; + *res++ = snd_ctl_elem_info_is_inactive(info) ? 'i' : '-'; + *res++ = snd_ctl_elem_info_is_volatile(info) ? 'v' : '-'; + *res++ = snd_ctl_elem_info_is_locked(info) ? 'l' : '-'; + *res++ = snd_ctl_elem_info_is_tlv_readable(info) ? 'R' : '-'; + *res++ = snd_ctl_elem_info_is_tlv_writable(info) ? 'W' : '-'; + *res++ = snd_ctl_elem_info_is_tlv_commandable(info) ? 'C' : '-'; + *res++ = '\0'; + return result; +} + +#define check_range(val, min, max) \ + (no_check ? (val) : ((val < min) ? (min) : (val > max) ? (max) : (val))) +#if 0 +static int convert_range(int val, int omin, int omax, int nmin, int nmax) +{ + int orange = omax - omin, nrange = nmax - nmin; + + if (orange == 0) + return 0; + return rint((((double)nrange * ((double)val - (double)omin)) + ((double)orange / 2.0)) / ((double)orange + (double)nmin)); +} +#endif + +#if 0 +static int convert_db_range(int val, int omin, int omax, int nmin, int nmax) +{ + int orange = omax - omin, nrange = nmax - nmin; + + if (orange == 0) + return 0; + return rint((((double)nrange * ((double)val - (double)omin)) + ((double)orange / 2.0)) / (double)orange + (double)nmin); +} +#endif + +/* Fuction to convert from volume to percentage. val = volume */ + +static int convert_prange(long val, long min, long max) +{ + long range = max - min; + int tmp; + + if (range == 0) + return min; + val -= min; + tmp = rint((double)val/(double)range * 100); + return tmp; +} + +/* Function to convert from percentage to volume. perc = percentage */ +static long convert_prange1(long perc, long min, long max) +{ + long tmp; + + tmp = rint((double)perc * (double)(max - min) * 0.01); + if (tmp == 0 && perc > 0) + tmp++; + return tmp + min; +} + +struct volume_ops { + int (*get_range)(snd_mixer_elem_t *elem, long *min, long *max); + int (*get)(snd_mixer_elem_t *elem, snd_mixer_selem_channel_id_t c, + long *value); + int (*set)(snd_mixer_elem_t *elem, snd_mixer_selem_channel_id_t c, + long value, int dir); +}; + +enum { VOL_RAW, VOL_DB, VOL_MAP }; + +struct volume_ops_set { + int (*has_volume)(snd_mixer_elem_t *elem); + struct volume_ops v[3]; +}; + +static int set_playback_dB(snd_mixer_elem_t *elem, + snd_mixer_selem_channel_id_t c, long value, int dir) +{ + return snd_mixer_selem_set_playback_dB(elem, c, value, dir); +} + +static int set_capture_dB(snd_mixer_elem_t *elem, + snd_mixer_selem_channel_id_t c, long value, int dir) +{ + return snd_mixer_selem_set_capture_dB(elem, c, value, dir); +} + +static int set_playback_raw_volume(snd_mixer_elem_t *elem, + snd_mixer_selem_channel_id_t c, + long value, int dir) +{ + return snd_mixer_selem_set_playback_volume(elem, c, value); +} + +static int set_capture_raw_volume(snd_mixer_elem_t *elem, + snd_mixer_selem_channel_id_t c, + long value, int dir) +{ + return snd_mixer_selem_set_capture_volume(elem, c, value); +} + +/* FIXME: normalize to int32 space to be compatible with other types */ +#define MAP_VOL_RES (INT32_MAX / 100) + +static int get_mapped_volume_range(snd_mixer_elem_t *elem, + long *pmin, long *pmax) +{ + *pmin = 0; + *pmax = MAP_VOL_RES; + return 0; +} + +static int get_playback_mapped_volume(snd_mixer_elem_t *elem, + snd_mixer_selem_channel_id_t c, + long *value) +{ + *value = (rint)(get_normalized_playback_volume(elem, c) * MAP_VOL_RES); + return 0; +} + +static int set_playback_mapped_volume(snd_mixer_elem_t *elem, + snd_mixer_selem_channel_id_t c, + long value, int dir) +{ + return set_normalized_playback_volume(elem, c, + (double)value / MAP_VOL_RES, dir); +} + +static int get_capture_mapped_volume(snd_mixer_elem_t *elem, + snd_mixer_selem_channel_id_t c, + long *value) +{ + *value = (rint)(get_normalized_capture_volume(elem, c) * MAP_VOL_RES); + return 0; +} + +static int set_capture_mapped_volume(snd_mixer_elem_t *elem, + snd_mixer_selem_channel_id_t c, + long value, int dir) +{ + return set_normalized_capture_volume(elem, c, + (double)value / MAP_VOL_RES, dir); +} + +static const struct volume_ops_set vol_ops[2] = { + { + .has_volume = snd_mixer_selem_has_playback_volume, + .v = {{ snd_mixer_selem_get_playback_volume_range, + snd_mixer_selem_get_playback_volume, + set_playback_raw_volume }, + { snd_mixer_selem_get_playback_dB_range, + snd_mixer_selem_get_playback_dB, + set_playback_dB }, + { get_mapped_volume_range, + get_playback_mapped_volume, + set_playback_mapped_volume }, + }, + }, + { + .has_volume = snd_mixer_selem_has_capture_volume, + .v = {{ snd_mixer_selem_get_capture_volume_range, + snd_mixer_selem_get_capture_volume, + set_capture_raw_volume }, + { snd_mixer_selem_get_capture_dB_range, + snd_mixer_selem_get_capture_dB, + set_capture_dB }, + { get_mapped_volume_range, + get_capture_mapped_volume, + set_capture_mapped_volume }, + }, + }, +}; + +static int std_vol_type = VOL_RAW; + +static int set_volume_simple(snd_mixer_elem_t *elem, + snd_mixer_selem_channel_id_t chn, + char **ptr, int dir) +{ + long val, orig, pmin, pmax; + char *p = *ptr, *s; + int invalid = 0, percent = 0, err = 0; + int vol_type; + double scale = 1.0; + int correct = 0; + + if (! vol_ops[dir].has_volume(elem)) + invalid = 1; + + if (*p == ':') + p++; + if (*p == '\0' || (!isdigit(*p) && *p != '-')) + goto skip; + + s = p; + val = strtol(s, &p, 10); + if (*p == '.') { + p++; + strtol(p, &p, 10); + } + if (*p == '%') { + vol_type = std_vol_type; + percent = 1; + p++; + } else if (toupper(p[0]) == 'D' && toupper(p[1]) == 'B') { + vol_type = VOL_DB; + p += 2; + scale = 100; + } else { + vol_type = VOL_RAW; + } + + if (*p && !strchr(",:+-", *p)) + invalid = 1; + + val = (long)(strtod(s, NULL) * scale); + if (vol_ops[dir].v[vol_type].get_range(elem, &pmin, &pmax) < 0) + invalid = 1; + if (percent) + val = (long)convert_prange1(val, pmin, pmax); + if (*p == '+' || *p == '-') { + if (! invalid) { + if (vol_ops[dir].v[vol_type].get(elem, chn, &orig) < 0) + invalid = 1; + if (*p == '+') { + val = orig + val; + correct = 1; + } else { + val = orig - val; + correct = -1; + } + } + p++; + } + + if (*p && !strchr(",:", *p)) + invalid = 1; + + if (! invalid) { + val = check_range(val, pmin, pmax); + err = vol_ops[dir].v[vol_type].set(elem, chn, val, correct); + } + skip: + if (*p == ',') + p++; + *ptr = p; + return err ? err : (invalid ? -ENOENT : 0); +} + +static int get_bool_simple(char **ptr, char *str, int invert, int orig) +{ + if (**ptr == ':') + (*ptr)++; + if (!strncasecmp(*ptr, str, strlen(str))) { + orig = 1 ^ (invert ? 1 : 0); + while (**ptr != '\0' && **ptr != ',' && **ptr != ':') + (*ptr)++; + } + if (**ptr == ',' || **ptr == ':') + (*ptr)++; + return orig; +} + +static int simple_skip_word(char **ptr, char *str) +{ + char *xptr = *ptr; + if (*xptr == ':') + xptr++; + if (!strncasecmp(xptr, str, strlen(str))) { + while (*xptr != '\0' && *xptr != ',' && *xptr != ':') + xptr++; + if (*xptr == ',' || *xptr == ':') + xptr++; + *ptr = xptr; + return 1; + } + return 0; +} + +static void show_control_id(snd_ctl_elem_id_t *id) +{ + char *str; + + str = snd_ctl_ascii_elem_id_get(id); + if (str) + printf("%s", str); + free(str); +} + +static void print_spaces(unsigned int spaces) +{ + while (spaces-- > 0) + putc(' ', stdout); +} + +static void print_dB(long dB) +{ + if (dB < 0) { + printf("-%li.%02lidB", -dB / 100, -dB % 100); + } else { + printf("%li.%02lidB", dB / 100, dB % 100); + } +} + +static void decode_tlv(unsigned int spaces, unsigned int *tlv, unsigned int tlv_size) +{ + unsigned int type = tlv[0]; + unsigned int size; + unsigned int idx = 0; + const char *chmap_type = NULL; + int lf = 1; + + if (tlv_size < 2 * sizeof(unsigned int)) { + printf("TLV size error!\n"); + return; + } + print_spaces(spaces); + printf("| "); + type = tlv[idx++]; + size = tlv[idx++]; + tlv_size -= 2 * sizeof(unsigned int); + if (size > tlv_size) { + printf("TLV size error (%u, %u, %u)!\n", type, size, tlv_size); + return; + } + switch (type) { + case SND_CTL_TLVT_CONTAINER: + printf("container\n"); + size += sizeof(unsigned int) -1; + size /= sizeof(unsigned int); + while (idx < size) { + if (tlv[idx+1] > (size - idx) * sizeof(unsigned int)) { + printf("TLV size error in compound!\n"); + return; + } + decode_tlv(spaces + 2, tlv + idx, tlv[idx+1] + 8); + idx += 2 + (tlv[idx+1] + sizeof(unsigned int) - 1) / sizeof(unsigned int); + } + lf = 0; + break; + case SND_CTL_TLVT_DB_SCALE: + printf("dBscale-"); + if (size != 2 * sizeof(unsigned int)) { + while (size > 0) { + printf("0x%08x,", tlv[idx++]); + size -= sizeof(unsigned int); + } + } else { + printf("min="); + print_dB((int)tlv[2]); + printf(",step="); + print_dB(tlv[3] & 0xffff); + printf(",mute=%i", (tlv[3] >> 16) & 1); + } + break; +#ifdef SND_CTL_TLVT_DB_LINEAR + case SND_CTL_TLVT_DB_LINEAR: + printf("dBlinear-"); + if (size != 2 * sizeof(unsigned int)) { + while (size > 0) { + printf("0x%08x,", tlv[idx++]); + size -= sizeof(unsigned int); + } + } else { + printf("min="); + print_dB((int)tlv[2]); + printf(",max="); + print_dB((int)tlv[3]); + } + break; +#endif +#ifdef SND_CTL_TLVT_DB_RANGE + case SND_CTL_TLVT_DB_RANGE: + printf("dBrange-\n"); + if ((size % (6 * sizeof(unsigned int))) != 0) { + while (size > 0) { + printf("0x%08x,", tlv[idx++]); + size -= sizeof(unsigned int); + } + break; + } + while (size > 0) { + print_spaces(spaces + 2); + printf("rangemin=%i,", tlv[idx++]); + printf(",rangemax=%i\n", tlv[idx++]); + decode_tlv(spaces + 4, tlv + idx, 4 * sizeof(unsigned int)); + idx += 4; + size -= 6 * sizeof(unsigned int); + } + break; +#endif +#ifdef SND_CTL_TLVT_DB_MINMAX + case SND_CTL_TLVT_DB_MINMAX: + case SND_CTL_TLVT_DB_MINMAX_MUTE: + if (type == SND_CTL_TLVT_DB_MINMAX_MUTE) + printf("dBminmaxmute-"); + else + printf("dBminmax-"); + if (size != 2 * sizeof(unsigned int)) { + while (size > 0) { + printf("0x%08x,", tlv[idx++]); + size -= sizeof(unsigned int); + } + } else { + printf("min="); + print_dB((int)tlv[2]); + printf(",max="); + print_dB((int)tlv[3]); + } + break; +#endif +#ifdef SND_CTL_TLVT_CHMAP_FIXED + case SND_CTL_TLVT_CHMAP_FIXED: + chmap_type = "fixed"; + /* Fall through */ + case SND_CTL_TLVT_CHMAP_VAR: + if (!chmap_type) + chmap_type = "variable"; + /* Fall through */ + case SND_CTL_TLVT_CHMAP_PAIRED: + if (!chmap_type) + chmap_type = "paired"; + printf("chmap-%s=", chmap_type); + + while (size > 0) { + printf("%s", snd_pcm_chmap_name(tlv[idx++])); + size -= sizeof(unsigned int); + if (size > 0) + printf(","); + } + break; +#endif + default: + printf("unk-%u-", type); + while (size > 0) { + printf("0x%08x,", tlv[idx++]); + size -= sizeof(unsigned int); + } + break; + } + if (lf) + putc('\n', stdout); +} + +static int show_control(const char *space, snd_hctl_elem_t *elem, + int level) +{ + int err; + unsigned int item, idx, count, *tlv; + snd_ctl_elem_type_t type; + snd_ctl_elem_id_t *id; + snd_ctl_elem_info_t *info; + snd_ctl_elem_value_t *control; + snd_aes_iec958_t iec958; + snd_ctl_elem_id_alloca(&id); + snd_ctl_elem_info_alloca(&info); + snd_ctl_elem_value_alloca(&control); + if ((err = snd_hctl_elem_info(elem, info)) < 0) { + error("Control %s snd_hctl_elem_info error: %s\n", card, snd_strerror(err)); + return err; + } + if (level & LEVEL_ID) { + snd_hctl_elem_get_id(elem, id); + show_control_id(id); + printf("\n"); + } + count = snd_ctl_elem_info_get_count(info); + type = snd_ctl_elem_info_get_type(info); + printf("%s; type=%s,access=%s,values=%u", space, control_type(info), control_access(info), count); + switch (type) { + case SND_CTL_ELEM_TYPE_INTEGER: + printf(",min=%li,max=%li,step=%li\n", + snd_ctl_elem_info_get_min(info), + snd_ctl_elem_info_get_max(info), + snd_ctl_elem_info_get_step(info)); + break; + case SND_CTL_ELEM_TYPE_INTEGER64: + printf(",min=%lli,max=%lli,step=%lli\n", + snd_ctl_elem_info_get_min64(info), + snd_ctl_elem_info_get_max64(info), + snd_ctl_elem_info_get_step64(info)); + break; + case SND_CTL_ELEM_TYPE_ENUMERATED: + { + unsigned int items = snd_ctl_elem_info_get_items(info); + printf(",items=%u\n", items); + for (item = 0; item < items; item++) { + snd_ctl_elem_info_set_item(info, item); + if ((err = snd_hctl_elem_info(elem, info)) < 0) { + error("Control %s element info error: %s\n", card, snd_strerror(err)); + return err; + } + printf("%s; Item #%u '%s'\n", space, item, snd_ctl_elem_info_get_item_name(info)); + } + break; + } + default: + printf("\n"); + break; + } + if (level & LEVEL_BASIC) { + if (!snd_ctl_elem_info_is_readable(info)) + goto __skip_read; + if ((err = snd_hctl_elem_read(elem, control)) < 0) { + error("Control %s element read error: %s\n", card, snd_strerror(err)); + return err; + } + printf("%s: values=", space); + for (idx = 0; idx < count; idx++) { + if (idx > 0) + printf(","); + switch (type) { + case SND_CTL_ELEM_TYPE_BOOLEAN: + printf("%s", snd_ctl_elem_value_get_boolean(control, idx) ? "on" : "off"); + break; + case SND_CTL_ELEM_TYPE_INTEGER: + printf("%li", snd_ctl_elem_value_get_integer(control, idx)); + break; + case SND_CTL_ELEM_TYPE_INTEGER64: + printf("%lli", snd_ctl_elem_value_get_integer64(control, idx)); + break; + case SND_CTL_ELEM_TYPE_ENUMERATED: + printf("%u", snd_ctl_elem_value_get_enumerated(control, idx)); + break; + case SND_CTL_ELEM_TYPE_BYTES: + printf("0x%02x", snd_ctl_elem_value_get_byte(control, idx)); + break; + case SND_CTL_ELEM_TYPE_IEC958: + snd_ctl_elem_value_get_iec958(control, &iec958); + printf("[AES0=0x%02x AES1=0x%02x AES2=0x%02x AES3=0x%02x]", + iec958.status[0], iec958.status[1], + iec958.status[2], iec958.status[3]); + break; + default: + printf("?"); + break; + } + } + printf("\n"); + __skip_read: + if (!snd_ctl_elem_info_is_tlv_readable(info)) + goto __skip_tlv; + /* skip ASoC ext bytes controls that may have huge binary TLV data */ + if (type == SND_CTL_ELEM_TYPE_BYTES && + !snd_ctl_elem_info_is_readable(info) && + !snd_ctl_elem_info_is_writable(info)) { + printf("%s; ASoC TLV Byte control, skipping bytes dump\n", space); + goto __skip_tlv; + } + + tlv = malloc(4096); + if ((err = snd_hctl_elem_tlv_read(elem, tlv, 4096)) < 0) { + error("Control %s element TLV read error: %s\n", card, snd_strerror(err)); + free(tlv); + return err; + } + decode_tlv(strlen(space), tlv, 4096); + free(tlv); + } + __skip_tlv: + return 0; +} + +static int controls(int level) +{ + int err; + snd_hctl_t *handle; + snd_hctl_elem_t *elem; + snd_ctl_elem_id_t *id; + snd_ctl_elem_info_t *info; + snd_ctl_elem_id_alloca(&id); + snd_ctl_elem_info_alloca(&info); + + if ((err = snd_hctl_open(&handle, card, 0)) < 0) { + error("Control %s open error: %s", card, snd_strerror(err)); + return err; + } + if ((err = snd_hctl_load(handle)) < 0) { + error("Control %s local error: %s\n", card, snd_strerror(err)); + return err; + } + for (elem = snd_hctl_first_elem(handle); elem; elem = snd_hctl_elem_next(elem)) { + if ((err = snd_hctl_elem_info(elem, info)) < 0) { + error("Control %s snd_hctl_elem_info error: %s\n", card, snd_strerror(err)); + return err; + } + if (!(level & LEVEL_INACTIVE) && snd_ctl_elem_info_is_inactive(info)) + continue; + snd_hctl_elem_get_id(elem, id); + show_control_id(id); + printf("\n"); + if (level & LEVEL_BASIC) + show_control(" ", elem, 1); + } + snd_hctl_close(handle); + return 0; +} + +static void show_selem_volume(snd_mixer_elem_t *elem, + snd_mixer_selem_channel_id_t chn, int dir, + long min, long max) +{ + long raw, val; + vol_ops[dir].v[VOL_RAW].get(elem, chn, &raw); + if (std_vol_type == VOL_RAW) + val = convert_prange(raw, min, max); + else { + vol_ops[dir].v[std_vol_type].get(elem, chn, &val); + val = convert_prange(val, 0, MAP_VOL_RES); + } + printf(" %li [%li%%]", raw, val); + if (!vol_ops[dir].v[VOL_DB].get(elem, chn, &val)) { + printf(" ["); + print_dB(val); + printf("]"); + } +} + +static int show_selem(snd_mixer_t *handle, snd_mixer_selem_id_t *id, const char *space, int level) +{ + snd_mixer_selem_channel_id_t chn; + long pmin = 0, pmax = 0; + long cmin = 0, cmax = 0; + int psw, csw; + int pmono, cmono, mono_ok = 0; + snd_mixer_elem_t *elem; + + elem = snd_mixer_find_selem(handle, id); + if (!elem) { + error("Mixer %s simple element not found", card); + return -ENOENT; + } + + if (level & LEVEL_BASIC) { + printf("%sCapabilities:", space); + if (snd_mixer_selem_has_common_volume(elem)) { + printf(" volume"); + if (snd_mixer_selem_has_playback_volume_joined(elem)) + printf(" volume-joined"); + } else { + if (snd_mixer_selem_has_playback_volume(elem)) { + printf(" pvolume"); + if (snd_mixer_selem_has_playback_volume_joined(elem)) + printf(" pvolume-joined"); + } + if (snd_mixer_selem_has_capture_volume(elem)) { + printf(" cvolume"); + if (snd_mixer_selem_has_capture_volume_joined(elem)) + printf(" cvolume-joined"); + } + } + if (snd_mixer_selem_has_common_switch(elem)) { + printf(" switch"); + if (snd_mixer_selem_has_playback_switch_joined(elem)) + printf(" switch-joined"); + } else { + if (snd_mixer_selem_has_playback_switch(elem)) { + printf(" pswitch"); + if (snd_mixer_selem_has_playback_switch_joined(elem)) + printf(" pswitch-joined"); + } + if (snd_mixer_selem_has_capture_switch(elem)) { + printf(" cswitch"); + if (snd_mixer_selem_has_capture_switch_joined(elem)) + printf(" cswitch-joined"); + if (snd_mixer_selem_has_capture_switch_exclusive(elem)) + printf(" cswitch-exclusive"); + } + } + if (snd_mixer_selem_is_enum_playback(elem)) { + printf(" penum"); + } else if (snd_mixer_selem_is_enum_capture(elem)) { + printf(" cenum"); + } else if (snd_mixer_selem_is_enumerated(elem)) { + printf(" enum"); + } + printf("\n"); + if (snd_mixer_selem_is_enumerated(elem)) { + int i, items; + unsigned int idx; + /* + * See snd_ctl_elem_init_enum_names() in + * sound/core/control.c. + */ + char itemname[64]; + items = snd_mixer_selem_get_enum_items(elem); + printf(" Items:"); + for (i = 0; i < items; i++) { + snd_mixer_selem_get_enum_item_name(elem, i, sizeof(itemname) - 1, itemname); + printf(" '%s'", itemname); + } + printf("\n"); + for (i = 0; !snd_mixer_selem_get_enum_item(elem, i, &idx); i++) { + snd_mixer_selem_get_enum_item_name(elem, idx, sizeof(itemname) - 1, itemname); + printf(" Item%d: '%s'\n", i, itemname); + } + return 0; /* no more thing to do */ + } + if (snd_mixer_selem_has_capture_switch_exclusive(elem)) + printf("%sCapture exclusive group: %i\n", space, + snd_mixer_selem_get_capture_group(elem)); + if (snd_mixer_selem_has_playback_volume(elem) || + snd_mixer_selem_has_playback_switch(elem)) { + printf("%sPlayback channels:", space); + if (snd_mixer_selem_is_playback_mono(elem)) { + printf(" Mono"); + } else { + int first = 1; + for (chn = 0; chn <= SND_MIXER_SCHN_LAST; chn++){ + if (!snd_mixer_selem_has_playback_channel(elem, chn)) + continue; + if (!first) + printf(" -"); + printf(" %s", snd_mixer_selem_channel_name(chn)); + first = 0; + } + } + printf("\n"); + } + if (snd_mixer_selem_has_capture_volume(elem) || + snd_mixer_selem_has_capture_switch(elem)) { + printf("%sCapture channels:", space); + if (snd_mixer_selem_is_capture_mono(elem)) { + printf(" Mono"); + } else { + int first = 1; + for (chn = 0; chn <= SND_MIXER_SCHN_LAST; chn++){ + if (!snd_mixer_selem_has_capture_channel(elem, chn)) + continue; + if (!first) + printf(" -"); + printf(" %s", snd_mixer_selem_channel_name(chn)); + first = 0; + } + } + printf("\n"); + } + if (snd_mixer_selem_has_playback_volume(elem) || + snd_mixer_selem_has_capture_volume(elem)) { + printf("%sLimits:", space); + if (snd_mixer_selem_has_common_volume(elem)) { + snd_mixer_selem_get_playback_volume_range(elem, &pmin, &pmax); + snd_mixer_selem_get_capture_volume_range(elem, &cmin, &cmax); + printf(" %li - %li", pmin, pmax); + } else { + if (snd_mixer_selem_has_playback_volume(elem)) { + snd_mixer_selem_get_playback_volume_range(elem, &pmin, &pmax); + printf(" Playback %li - %li", pmin, pmax); + } + if (snd_mixer_selem_has_capture_volume(elem)) { + snd_mixer_selem_get_capture_volume_range(elem, &cmin, &cmax); + printf(" Capture %li - %li", cmin, cmax); + } + } + printf("\n"); + } + pmono = snd_mixer_selem_has_playback_channel(elem, SND_MIXER_SCHN_MONO) && + (snd_mixer_selem_is_playback_mono(elem) || + (!snd_mixer_selem_has_playback_volume(elem) && + !snd_mixer_selem_has_playback_switch(elem))); + cmono = snd_mixer_selem_has_capture_channel(elem, SND_MIXER_SCHN_MONO) && + (snd_mixer_selem_is_capture_mono(elem) || + (!snd_mixer_selem_has_capture_volume(elem) && + !snd_mixer_selem_has_capture_switch(elem))); +#if 0 + printf("pmono = %i, cmono = %i (%i, %i, %i, %i)\n", pmono, cmono, + snd_mixer_selem_has_capture_channel(elem, SND_MIXER_SCHN_MONO), + snd_mixer_selem_is_capture_mono(elem), + snd_mixer_selem_has_capture_volume(elem), + snd_mixer_selem_has_capture_switch(elem)); +#endif + if (pmono || cmono) { + if (!mono_ok) { + printf("%s%s:", space, "Mono"); + mono_ok = 1; + } + if (snd_mixer_selem_has_common_volume(elem)) { + show_selem_volume(elem, SND_MIXER_SCHN_MONO, 0, pmin, pmax); + } + if (snd_mixer_selem_has_common_switch(elem)) { + snd_mixer_selem_get_playback_switch(elem, SND_MIXER_SCHN_MONO, &psw); + printf(" [%s]", psw ? "on" : "off"); + } + } + if (pmono && snd_mixer_selem_has_playback_channel(elem, SND_MIXER_SCHN_MONO)) { + int title = 0; + if (!mono_ok) { + printf("%s%s:", space, "Mono"); + mono_ok = 1; + } + if (!snd_mixer_selem_has_common_volume(elem)) { + if (snd_mixer_selem_has_playback_volume(elem)) { + printf(" Playback"); + title = 1; + show_selem_volume(elem, SND_MIXER_SCHN_MONO, 0, pmin, pmax); + } + } + if (!snd_mixer_selem_has_common_switch(elem)) { + if (snd_mixer_selem_has_playback_switch(elem)) { + if (!title) + printf(" Playback"); + snd_mixer_selem_get_playback_switch(elem, SND_MIXER_SCHN_MONO, &psw); + printf(" [%s]", psw ? "on" : "off"); + } + } + } + if (cmono && snd_mixer_selem_has_capture_channel(elem, SND_MIXER_SCHN_MONO)) { + int title = 0; + if (!mono_ok) { + printf("%s%s:", space, "Mono"); + mono_ok = 1; + } + if (!snd_mixer_selem_has_common_volume(elem)) { + if (snd_mixer_selem_has_capture_volume(elem)) { + printf(" Capture"); + title = 1; + show_selem_volume(elem, SND_MIXER_SCHN_MONO, 1, cmin, cmax); + } + } + if (!snd_mixer_selem_has_common_switch(elem)) { + if (snd_mixer_selem_has_capture_switch(elem)) { + if (!title) + printf(" Capture"); + snd_mixer_selem_get_capture_switch(elem, SND_MIXER_SCHN_MONO, &csw); + printf(" [%s]", csw ? "on" : "off"); + } + } + } + if (pmono || cmono) + printf("\n"); + if (!pmono || !cmono) { + for (chn = 0; chn <= SND_MIXER_SCHN_LAST; chn++) { + if ((pmono || !snd_mixer_selem_has_playback_channel(elem, chn)) && + (cmono || !snd_mixer_selem_has_capture_channel(elem, chn))) + continue; + printf("%s%s:", space, snd_mixer_selem_channel_name(chn)); + if (!pmono && !cmono && snd_mixer_selem_has_common_volume(elem)) { + show_selem_volume(elem, chn, 0, pmin, pmax); + } + if (!pmono && !cmono && snd_mixer_selem_has_common_switch(elem)) { + snd_mixer_selem_get_playback_switch(elem, chn, &psw); + printf(" [%s]", psw ? "on" : "off"); + } + if (!pmono && snd_mixer_selem_has_playback_channel(elem, chn)) { + int title = 0; + if (!snd_mixer_selem_has_common_volume(elem)) { + if (snd_mixer_selem_has_playback_volume(elem)) { + printf(" Playback"); + title = 1; + show_selem_volume(elem, chn, 0, pmin, pmax); + } + } + if (!snd_mixer_selem_has_common_switch(elem)) { + if (snd_mixer_selem_has_playback_switch(elem)) { + if (!title) + printf(" Playback"); + snd_mixer_selem_get_playback_switch(elem, chn, &psw); + printf(" [%s]", psw ? "on" : "off"); + } + } + } + if (!cmono && snd_mixer_selem_has_capture_channel(elem, chn)) { + int title = 0; + if (!snd_mixer_selem_has_common_volume(elem)) { + if (snd_mixer_selem_has_capture_volume(elem)) { + printf(" Capture"); + title = 1; + show_selem_volume(elem, chn, 1, cmin, cmax); + } + } + if (!snd_mixer_selem_has_common_switch(elem)) { + if (snd_mixer_selem_has_capture_switch(elem)) { + if (!title) + printf(" Capture"); + snd_mixer_selem_get_capture_switch(elem, chn, &csw); + printf(" [%s]", csw ? "on" : "off"); + } + } + } + printf("\n"); + } + } + } + return 0; +} + +static int selems(int level) +{ + int err; + snd_mixer_t *handle; + snd_mixer_selem_id_t *sid; + snd_mixer_elem_t *elem; + snd_mixer_selem_id_alloca(&sid); + + if ((err = snd_mixer_open(&handle, 0)) < 0) { + error("Mixer %s open error: %s", card, snd_strerror(err)); + return err; + } + if (smixer_level == 0 && (err = snd_mixer_attach(handle, card)) < 0) { + error("Mixer attach %s error: %s", card, snd_strerror(err)); + snd_mixer_close(handle); + return err; + } + if ((err = snd_mixer_selem_register(handle, smixer_level > 0 ? &smixer_options : NULL, NULL)) < 0) { + error("Mixer register error: %s", snd_strerror(err)); + snd_mixer_close(handle); + return err; + } + err = snd_mixer_load(handle); + if (err < 0) { + error("Mixer %s load error: %s", card, snd_strerror(err)); + snd_mixer_close(handle); + return err; + } + for (elem = snd_mixer_first_elem(handle); elem; elem = snd_mixer_elem_next(elem)) { + snd_mixer_selem_get_id(elem, sid); + if (!(level & LEVEL_INACTIVE) && !snd_mixer_selem_is_active(elem)) + continue; + printf("Simple mixer control '%s',%i\n", snd_mixer_selem_id_get_name(sid), snd_mixer_selem_id_get_index(sid)); + show_selem(handle, sid, " ", level); + } + snd_mixer_close(handle); + return 0; +} + +static int parse_simple_id(const char *str, snd_mixer_selem_id_t *sid) +{ + int c, size; + char buf[128]; + char *ptr = buf; + + while (*str == ' ' || *str == '\t') + str++; + if (!(*str)) + return -EINVAL; + size = 1; /* for '\0' */ + if (*str != '"' && *str != '\'') { + while (*str && *str != ',') { + if (size < (int)sizeof(buf)) { + *ptr++ = *str; + size++; + } + str++; + } + } else { + c = *str++; + while (*str && *str != c) { + if (size < (int)sizeof(buf)) { + *ptr++ = *str; + size++; + } + str++; + } + if (*str == c) + str++; + } + if (*str == '\0') { + snd_mixer_selem_id_set_index(sid, 0); + *ptr = 0; + goto _set; + } + if (*str != ',') + return -EINVAL; + *ptr = 0; /* terminate the string */ + str++; + if (!isdigit(*str)) + return -EINVAL; + snd_mixer_selem_id_set_index(sid, atoi(str)); + _set: + snd_mixer_selem_id_set_name(sid, buf); + return 0; +} + +static int cset(int argc, char *argv[], int roflag, int keep_handle) +{ + int err; + static snd_ctl_t *handle = NULL; + snd_ctl_elem_info_t *info; + snd_ctl_elem_id_t *id; + snd_ctl_elem_value_t *control; + snd_ctl_elem_info_alloca(&info); + snd_ctl_elem_id_alloca(&id); + snd_ctl_elem_value_alloca(&control); + + if (argc < 1) { + fprintf(stderr, "Specify a full control identifier: [[iface=,][name='name',][index=,][device=,][subdevice=]]|[numid=]\n"); + return -EINVAL; + } + if (snd_ctl_ascii_elem_id_parse(id, argv[0])) { + fprintf(stderr, "Wrong control identifier: %s\n", argv[0]); + return -EINVAL; + } + if (debugflag) { + printf("VERIFY ID: "); + show_control_id(id); + printf("\n"); + } + if (handle == NULL && + (err = snd_ctl_open(&handle, card, 0)) < 0) { + error("Control %s open error: %s\n", card, snd_strerror(err)); + return err; + } + snd_ctl_elem_info_set_id(info, id); + if ((err = snd_ctl_elem_info(handle, info)) < 0) { + if (ignore_error) + return 0; + error("Cannot find the given element from control %s\n", card); + if (! keep_handle) { + snd_ctl_close(handle); + handle = NULL; + } + return err; + } + snd_ctl_elem_info_get_id(info, id); /* FIXME: Remove it when hctl find works ok !!! */ + if (!roflag) { + snd_ctl_elem_value_set_id(control, id); + if ((err = snd_ctl_elem_read(handle, control)) < 0) { + if (ignore_error) + return 0; + error("Cannot read the given element from control %s\n", card); + if (! keep_handle) { + snd_ctl_close(handle); + handle = NULL; + } + return err; + } + err = snd_ctl_ascii_value_parse(handle, control, info, argv[1]); + if (err < 0) { + if (!ignore_error) + error("Control %s parse error: %s\n", card, snd_strerror(err)); + if (!keep_handle) { + snd_ctl_close(handle); + handle = NULL; + } + return ignore_error ? 0 : err; + } + if ((err = snd_ctl_elem_write(handle, control)) < 0) { + if (!ignore_error) + error("Control %s element write error: %s\n", card, snd_strerror(err)); + if (!keep_handle) { + snd_ctl_close(handle); + handle = NULL; + } + return ignore_error ? 0 : err; + } + } + if (! keep_handle) { + snd_ctl_close(handle); + handle = NULL; + } + if (!quiet) { + snd_hctl_t *hctl; + snd_hctl_elem_t *elem; + if ((err = snd_hctl_open(&hctl, card, 0)) < 0) { + error("Control %s open error: %s\n", card, snd_strerror(err)); + return err; + } + if ((err = snd_hctl_load(hctl)) < 0) { + error("Control %s load error: %s\n", card, snd_strerror(err)); + return err; + } + elem = snd_hctl_find_elem(hctl, id); + if (elem) + show_control(" ", elem, LEVEL_BASIC | LEVEL_ID); + else + printf("Could not find the specified element\n"); + snd_hctl_close(hctl); + } + return 0; +} + +typedef struct channel_mask { + char *name; + unsigned int mask; +} channel_mask_t; +static const channel_mask_t chanmask[] = { + {"frontleft", 1 << SND_MIXER_SCHN_FRONT_LEFT}, + {"frontright", 1 << SND_MIXER_SCHN_FRONT_RIGHT}, + {"frontcenter", 1 << SND_MIXER_SCHN_FRONT_CENTER}, + {"front", ((1 << SND_MIXER_SCHN_FRONT_LEFT) | + (1 << SND_MIXER_SCHN_FRONT_RIGHT))}, + {"center", 1 << SND_MIXER_SCHN_FRONT_CENTER}, + {"rearleft", 1 << SND_MIXER_SCHN_REAR_LEFT}, + {"rearright", 1 << SND_MIXER_SCHN_REAR_RIGHT}, + {"rear", ((1 << SND_MIXER_SCHN_REAR_LEFT) | + (1 << SND_MIXER_SCHN_REAR_RIGHT))}, + {"woofer", 1 << SND_MIXER_SCHN_WOOFER}, + {NULL, 0} +}; + +static unsigned int channels_mask(char **arg, unsigned int def) +{ + const channel_mask_t *c; + + for (c = chanmask; c->name; c++) { + if (strncasecmp(*arg, c->name, strlen(c->name)) == 0) { + while (**arg != '\0' && **arg != ',' && **arg != ' ' && **arg != '\t') + (*arg)++; + if (**arg == ',' || **arg == ' ' || **arg == '\t') + (*arg)++; + return c->mask; + } + } + return def; +} + +static unsigned int dir_mask(char **arg, unsigned int def) +{ + int findend = 0; + + if (strncasecmp(*arg, "playback", 8) == 0) + def = findend = 1; + else if (strncasecmp(*arg, "capture", 8) == 0) + def = findend = 2; + if (findend) { + while (**arg != '\0' && **arg != ',' && **arg != ' ' && **arg != '\t') + (*arg)++; + if (**arg == ',' || **arg == ' ' || **arg == '\t') + (*arg)++; + } + return def; +} + +static int get_enum_item_index(snd_mixer_elem_t *elem, char **ptrp) +{ + char *ptr = *ptrp; + int items, i, len; + + /* See snd_ctl_elem_init_enum_names() in sound/core/control.c. */ + char name[64]; + + items = snd_mixer_selem_get_enum_items(elem); + if (items <= 0) + return -1; + + for (i = 0; i < items; i++) { + if (snd_mixer_selem_get_enum_item_name(elem, i, sizeof(name)-1, name) < 0) + continue; + + len = strlen(name); + if (! strncmp(name, ptr, len)) { + if (! ptr[len] || ptr[len] == ',' || ptr[len] == '\n') { + ptr += len; + *ptrp = ptr; + return i; + } + } + } + return -1; +} + +static int sset_enum(snd_mixer_elem_t *elem, unsigned int argc, char **argv) +{ + unsigned int idx, item = 0; + int check_flag = ignore_error ? 0 : -1; + + for (idx = 1; idx < argc; idx++) { + char *ptr = argv[idx]; + while (*ptr) { + int ival = get_enum_item_index(elem, &ptr); + if (ival < 0) + return check_flag; + if (snd_mixer_selem_set_enum_item(elem, item++, ival) >= 0) + check_flag = 1; + /* skip separators */ + while (*ptr == ',' || isspace(*ptr)) + ptr++; + } + } + return check_flag; +} + +static int sset_channels(snd_mixer_elem_t *elem, unsigned int argc, char **argv) +{ + unsigned int channels = ~0U; + unsigned int dir = 3, okflag = 3; + unsigned int idx; + snd_mixer_selem_channel_id_t chn; + int check_flag = ignore_error ? 0 : -1; + + for (idx = 1; idx < argc; idx++) { + char *ptr = argv[idx], *optr; + int multi, firstchn = 1; + channels = channels_mask(&ptr, channels); + if (*ptr == '\0') + continue; + dir = dir_mask(&ptr, dir); + if (*ptr == '\0') + continue; + multi = (strchr(ptr, ',') != NULL); + optr = ptr; + for (chn = 0; chn <= SND_MIXER_SCHN_LAST; chn++) { + char *sptr = NULL; + int ival; + + if (!(channels & (1 << chn))) + continue; + + if ((dir & 1) && snd_mixer_selem_has_playback_channel(elem, chn)) { + sptr = ptr; + if (!strncmp(ptr, "mute", 4) && snd_mixer_selem_has_playback_switch(elem)) { + snd_mixer_selem_get_playback_switch(elem, chn, &ival); + if (snd_mixer_selem_set_playback_switch(elem, chn, get_bool_simple(&ptr, "mute", 1, ival)) >= 0) + check_flag = 1; + } else if (!strncmp(ptr, "off", 3) && snd_mixer_selem_has_playback_switch(elem)) { + snd_mixer_selem_get_playback_switch(elem, chn, &ival); + if (snd_mixer_selem_set_playback_switch(elem, chn, get_bool_simple(&ptr, "off", 1, ival)) >= 0) + check_flag = 1; + } else if (!strncmp(ptr, "unmute", 6) && snd_mixer_selem_has_playback_switch(elem)) { + snd_mixer_selem_get_playback_switch(elem, chn, &ival); + if (snd_mixer_selem_set_playback_switch(elem, chn, get_bool_simple(&ptr, "unmute", 0, ival)) >= 0) + check_flag = 1; + } else if (!strncmp(ptr, "on", 2) && snd_mixer_selem_has_playback_switch(elem)) { + snd_mixer_selem_get_playback_switch(elem, chn, &ival); + if (snd_mixer_selem_set_playback_switch(elem, chn, get_bool_simple(&ptr, "on", 0, ival)) >= 0) + check_flag = 1; + } else if (!strncmp(ptr, "toggle", 6) && snd_mixer_selem_has_playback_switch(elem)) { + if (firstchn || !snd_mixer_selem_has_playback_switch_joined(elem)) { + snd_mixer_selem_get_playback_switch(elem, chn, &ival); + if (snd_mixer_selem_set_playback_switch(elem, chn, (ival ? 1 : 0) ^ 1) >= 0) + check_flag = 1; + } + simple_skip_word(&ptr, "toggle"); + } else if (isdigit(*ptr) || *ptr == '-' || *ptr == '+') { + if (set_volume_simple(elem, chn, &ptr, 0) >= 0) + check_flag = 1; + } else if (simple_skip_word(&ptr, "cap") || simple_skip_word(&ptr, "rec") || + simple_skip_word(&ptr, "nocap") || simple_skip_word(&ptr, "norec")) { + /* nothing */ + } else { + okflag &= ~1; + } + } + if ((dir & 2) && snd_mixer_selem_has_capture_channel(elem, chn)) { + if (sptr != NULL) + ptr = sptr; + sptr = ptr; + if (!strncmp(ptr, "cap", 3) && snd_mixer_selem_has_capture_switch(elem)) { + snd_mixer_selem_get_capture_switch(elem, chn, &ival); + if (snd_mixer_selem_set_capture_switch(elem, chn, get_bool_simple(&ptr, "cap", 0, ival)) >= 0) + check_flag = 1; + } else if (!strncmp(ptr, "rec", 3) && snd_mixer_selem_has_capture_switch(elem)) { + snd_mixer_selem_get_capture_switch(elem, chn, &ival); + if (snd_mixer_selem_set_capture_switch(elem, chn, get_bool_simple(&ptr, "rec", 0, ival)) >= 0) + check_flag = 1; + } else if (!strncmp(ptr, "nocap", 5) && snd_mixer_selem_has_capture_switch(elem)) { + snd_mixer_selem_get_capture_switch(elem, chn, &ival); + if (snd_mixer_selem_set_capture_switch(elem, chn, get_bool_simple(&ptr, "nocap", 1, ival)) >= 0) + check_flag = 1; + } else if (!strncmp(ptr, "norec", 5) && snd_mixer_selem_has_capture_switch(elem)) { + snd_mixer_selem_get_capture_switch(elem, chn, &ival); + if (snd_mixer_selem_set_capture_switch(elem, chn, get_bool_simple(&ptr, "norec", 1, ival)) >= 0) + check_flag = 1; + } else if (!strncmp(ptr, "toggle", 6) && snd_mixer_selem_has_capture_switch(elem)) { + if (firstchn || !snd_mixer_selem_has_capture_switch_joined(elem)) { + snd_mixer_selem_get_capture_switch(elem, chn, &ival); + if (snd_mixer_selem_set_capture_switch(elem, chn, (ival ? 1 : 0) ^ 1) >= 0) + check_flag = 1; + } + simple_skip_word(&ptr, "toggle"); + } else if (isdigit(*ptr) || *ptr == '-' || *ptr == '+') { + if (set_volume_simple(elem, chn, &ptr, 1) >= 0) + check_flag = 1; + } else if (simple_skip_word(&ptr, "mute") || simple_skip_word(&ptr, "off") || + simple_skip_word(&ptr, "unmute") || simple_skip_word(&ptr, "on")) { + /* nothing */ + } else { + okflag &= ~2; + } + } + if (okflag == 0) { + if (debugflag) { + if (dir & 1) + error("Unknown playback setup '%s'..", ptr); + if (dir & 2) + error("Unknown capture setup '%s'..", ptr); + } + return 0; /* just skip it */ + } + if (!multi) + ptr = optr; + firstchn = 0; + } + } + return check_flag; +} + +static int sset(unsigned int argc, char *argv[], int roflag, int keep_handle) +{ + int err = 0; + static snd_mixer_t *handle = NULL; + snd_mixer_elem_t *elem; + snd_mixer_selem_id_t *sid; + snd_mixer_selem_id_alloca(&sid); + + if (argc < 1) { + fprintf(stderr, "Specify a scontrol identifier: 'name',index\n"); + return 1; + } + if (parse_simple_id(argv[0], sid)) { + fprintf(stderr, "Wrong scontrol identifier: %s\n", argv[0]); + return 1; + } + if (!roflag && argc < 2) { + fprintf(stderr, "Specify what you want to set...\n"); + return 1; + } + if (handle == NULL) { + if ((err = snd_mixer_open(&handle, 0)) < 0) { + error("Mixer %s open error: %s\n", card, snd_strerror(err)); + return err; + } + if (smixer_level == 0 && (err = snd_mixer_attach(handle, card)) < 0) { + error("Mixer attach %s error: %s", card, snd_strerror(err)); + snd_mixer_close(handle); + handle = NULL; + return err; + } + if ((err = snd_mixer_selem_register(handle, smixer_level > 0 ? &smixer_options : NULL, NULL)) < 0) { + error("Mixer register error: %s", snd_strerror(err)); + snd_mixer_close(handle); + handle = NULL; + return err; + } + err = snd_mixer_load(handle); + if (err < 0) { + error("Mixer %s load error: %s", card, snd_strerror(err)); + snd_mixer_close(handle); + handle = NULL; + return err; + } + } + elem = snd_mixer_find_selem(handle, sid); + if (!elem) { + if (ignore_error) + return 0; + error("Unable to find simple control '%s',%i\n", snd_mixer_selem_id_get_name(sid), snd_mixer_selem_id_get_index(sid)); + snd_mixer_close(handle); + handle = NULL; + return -ENOENT; + } + if (!roflag) { + /* enum control */ + if (snd_mixer_selem_is_enumerated(elem)) + err = sset_enum(elem, argc, argv); + else + err = sset_channels(elem, argc, argv); + + if (!err) + goto done; + if (err < 0) { + error("Invalid command!"); + goto done; + } + } + if (!quiet) { + printf("Simple mixer control '%s',%i\n", snd_mixer_selem_id_get_name(sid), snd_mixer_selem_id_get_index(sid)); + show_selem(handle, sid, " ", 1); + } + done: + if (! keep_handle) { + snd_mixer_close(handle); + handle = NULL; + } + return err < 0 ? 1 : 0; +} + +static void events_info(snd_hctl_elem_t *helem) +{ + snd_ctl_elem_id_t *id; + snd_ctl_elem_id_alloca(&id); + snd_hctl_elem_get_id(helem, id); + printf("event info: "); + show_control_id(id); + printf("\n"); +} + +static void events_value(snd_hctl_elem_t *helem) +{ + snd_ctl_elem_id_t *id; + snd_ctl_elem_id_alloca(&id); + snd_hctl_elem_get_id(helem, id); + printf("event value: "); + show_control_id(id); + printf("\n"); +} + +static void events_remove(snd_hctl_elem_t *helem) +{ + snd_ctl_elem_id_t *id; + snd_ctl_elem_id_alloca(&id); + snd_hctl_elem_get_id(helem, id); + printf("event remove: "); + show_control_id(id); + printf("\n"); +} + +static int element_callback(snd_hctl_elem_t *elem, unsigned int mask) +{ + if (mask == SND_CTL_EVENT_MASK_REMOVE) { + events_remove(elem); + return 0; + } + if (mask & SND_CTL_EVENT_MASK_INFO) + events_info(elem); + if (mask & SND_CTL_EVENT_MASK_VALUE) + events_value(elem); + return 0; +} + +static void events_add(snd_hctl_elem_t *helem) +{ + snd_ctl_elem_id_t *id; + snd_ctl_elem_id_alloca(&id); + snd_hctl_elem_get_id(helem, id); + printf("event add: "); + show_control_id(id); + printf("\n"); + snd_hctl_elem_set_callback(helem, element_callback); +} + +static int ctl_callback(snd_hctl_t *ctl, unsigned int mask, + snd_hctl_elem_t *elem) +{ + if (mask & SND_CTL_EVENT_MASK_ADD) + events_add(elem); + return 0; +} + +static int events(int argc ATTRIBUTE_UNUSED, char *argv[] ATTRIBUTE_UNUSED) +{ + snd_hctl_t *handle; + snd_hctl_elem_t *helem; + int err; + + if ((err = snd_hctl_open(&handle, card, 0)) < 0) { + error("Control %s open error: %s\n", card, snd_strerror(err)); + return err; + } + snd_hctl_set_callback(handle, ctl_callback); + if ((err = snd_hctl_load(handle)) < 0) { + error("Control %s hbuild error: %s\n", card, snd_strerror(err)); + return err; + } + for (helem = snd_hctl_first_elem(handle); helem; helem = snd_hctl_elem_next(helem)) { + snd_hctl_elem_set_callback(helem, element_callback); + } + printf("Ready to listen...\n"); + while (1) { + int res = snd_hctl_wait(handle, -1); + if (res >= 0) { + printf("Poll ok: %i\n", res); + res = snd_hctl_handle_events(handle); + assert(res > 0); + } + } + snd_hctl_close(handle); + return 0; +} + +static void sevents_value(snd_mixer_selem_id_t *sid) +{ + printf("event value: '%s',%i\n", snd_mixer_selem_id_get_name(sid), snd_mixer_selem_id_get_index(sid)); +} + +static void sevents_info(snd_mixer_selem_id_t *sid) +{ + printf("event info: '%s',%i\n", snd_mixer_selem_id_get_name(sid), snd_mixer_selem_id_get_index(sid)); +} + +static void sevents_remove(snd_mixer_selem_id_t *sid) +{ + printf("event remove: '%s',%i\n", snd_mixer_selem_id_get_name(sid), snd_mixer_selem_id_get_index(sid)); +} + +static int melem_event(snd_mixer_elem_t *elem, unsigned int mask) +{ + snd_mixer_selem_id_t *sid; + snd_mixer_selem_id_alloca(&sid); + snd_mixer_selem_get_id(elem, sid); + if (mask == SND_CTL_EVENT_MASK_REMOVE) { + sevents_remove(sid); + return 0; + } + if (mask & SND_CTL_EVENT_MASK_INFO) + sevents_info(sid); + if (mask & SND_CTL_EVENT_MASK_VALUE) + sevents_value(sid); + return 0; +} + +static void sevents_add(snd_mixer_elem_t *elem) +{ + snd_mixer_selem_id_t *sid; + snd_mixer_selem_id_alloca(&sid); + snd_mixer_selem_get_id(elem, sid); + printf("event add: '%s',%i\n", snd_mixer_selem_id_get_name(sid), snd_mixer_selem_id_get_index(sid)); + snd_mixer_elem_set_callback(elem, melem_event); +} + +static int mixer_event(snd_mixer_t *mixer, unsigned int mask, + snd_mixer_elem_t *elem) +{ + if (mask & SND_CTL_EVENT_MASK_ADD) + sevents_add(elem); + return 0; +} + +static int sevents(int argc ATTRIBUTE_UNUSED, char *argv[] ATTRIBUTE_UNUSED) +{ + snd_mixer_t *handle; + int err; + + if ((err = snd_mixer_open(&handle, 0)) < 0) { + error("Mixer %s open error: %s", card, snd_strerror(err)); + return err; + } + if (smixer_level == 0 && (err = snd_mixer_attach(handle, card)) < 0) { + error("Mixer attach %s error: %s", card, snd_strerror(err)); + snd_mixer_close(handle); + return err; + } + if ((err = snd_mixer_selem_register(handle, smixer_level > 0 ? &smixer_options : NULL, NULL)) < 0) { + error("Mixer register error: %s", snd_strerror(err)); + snd_mixer_close(handle); + return err; + } + snd_mixer_set_callback(handle, mixer_event); + err = snd_mixer_load(handle); + if (err < 0) { + error("Mixer %s load error: %s", card, snd_strerror(err)); + snd_mixer_close(handle); + return err; + } + + printf("Ready to listen...\n"); + while (1) { + int res; + res = snd_mixer_wait(handle, -1); + if (res >= 0) { + printf("Poll ok: %i\n", res); + res = snd_mixer_handle_events(handle); + assert(res >= 0); + } + } + snd_mixer_close(handle); + return 0; +} + +/* + * split a line into tokens + * the content in the line buffer is modified + */ +static int split_line(char *buf, char **token, int max_token) +{ + char *dst; + int n, esc, quote; + + for (n = 0; n < max_token; n++) { + while (isspace(*buf)) + buf++; + if (! *buf || *buf == '\n') + return n; + /* skip comments */ + if (*buf == '#' || *buf == '!') + return n; + esc = 0; + quote = 0; + token[n] = buf; + for (dst = buf; *buf && *buf != '\n'; buf++) { + if (esc) + esc = 0; + else if (isspace(*buf) && !quote) { + buf++; + break; + } else if (*buf == '\\') { + esc = 1; + continue; + } else if (*buf == '\'' || *buf == '"') { + if (! quote) { + quote = *buf; + continue; + } else if (*buf == quote) { + quote = 0; + continue; + } + } + *dst++ = *buf; + } + *dst = 0; + } + return n; +} + +#define MAX_ARGS 32 + +static int exec_stdin(void) +{ + int narg; + char buf[256], *args[MAX_ARGS]; + int err = 0; + + /* quiet = 1; */ + ignore_error = 1; + + while (fgets(buf, sizeof(buf), stdin)) { + narg = split_line(buf, args, MAX_ARGS); + if (narg > 0) { + if (!strcmp(args[0], "sset") || !strcmp(args[0], "set")) + err = sset(narg - 1, args + 1, 0, 1); + else if (!strcmp(args[0], "cset")) + err = cset(narg - 1, args + 1, 0, 1); + if (err < 0) + return 1; + } + } + return 0; +} + + +int main(int argc, char *argv[]) +{ + int morehelp, level = 0; + int read_stdin = 0; + static const struct option long_option[] = + { + {"help", 0, NULL, 'h'}, + {"card", 1, NULL, 'c'}, + {"device", 1, NULL, 'D'}, + {"quiet", 0, NULL, 'q'}, + {"inactive", 0, NULL, 'i'}, + {"debug", 0, NULL, 'd'}, + {"nocheck", 0, NULL, 'n'}, + {"version", 0, NULL, 'v'}, + {"abstract", 1, NULL, 'a'}, + {"stdin", 0, NULL, 's'}, + {"raw-volume", 0, NULL, 'R'}, + {"mapped-volume", 0, NULL, 'M'}, + {NULL, 0, NULL, 0}, + }; + + morehelp = 0; + while (1) { + int c; + + if ((c = getopt_long(argc, argv, "hc:D:qidnva:sRM", long_option, NULL)) < 0) + break; + switch (c) { + case 'h': + help(); + return 0; + case 'c': + { + int i; + i = snd_card_get_index(optarg); + if (i >= 0 && i < 32) + sprintf(card, "hw:%i", i); + else { + fprintf(stderr, "Invalid card number.\n"); + morehelp++; + } + } + break; + case 'D': + strncpy(card, optarg, sizeof(card)-1); + card[sizeof(card)-1] = '\0'; + break; + case 'q': + quiet = 1; + break; + case 'i': + level |= LEVEL_INACTIVE; + break; + case 'd': + debugflag = 1; + break; + case 'n': + no_check = 1; + break; + case 'v': + printf("amixer version " SND_UTIL_VERSION_STR "\n"); + return 1; + case 'a': + smixer_level = 1; + memset(&smixer_options, 0, sizeof(smixer_options)); + smixer_options.ver = 1; + if (!strcmp(optarg, "none")) + smixer_options.abstract = SND_MIXER_SABSTRACT_NONE; + else if (!strcmp(optarg, "basic")) + smixer_options.abstract = SND_MIXER_SABSTRACT_BASIC; + else { + fprintf(stderr, "Select correct abstraction level (none or basic)...\n"); + morehelp++; + } + break; + case 's': + read_stdin = 1; + break; + case 'R': + std_vol_type = VOL_RAW; + break; + case 'M': + std_vol_type = VOL_MAP; + break; + default: + fprintf(stderr, "Invalid switch or option needs an argument.\n"); + morehelp++; + } + } + if (morehelp) { + help(); + return 1; + } + smixer_options.device = card; + + if (read_stdin) + return exec_stdin(); + + if (argc - optind <= 0) { + return selems(LEVEL_BASIC | level) ? 1 : 0; + } + if (!strcmp(argv[optind], "help")) { + return help() ? 1 : 0; + } else if (!strcmp(argv[optind], "info")) { + return info() ? 1 : 0; + } else if (!strcmp(argv[optind], "controls")) { + return controls(level) ? 1 : 0; + } else if (!strcmp(argv[optind], "contents")) { + return controls(LEVEL_BASIC | level) ? 1 : 0; + } else if (!strcmp(argv[optind], "scontrols") || !strcmp(argv[optind], "simple")) { + return selems(level) ? 1 : 0; + } else if (!strcmp(argv[optind], "scontents")) { + return selems(LEVEL_BASIC | level) ? 1 : 0; + } else if (!strcmp(argv[optind], "sset") || !strcmp(argv[optind], "set")) { + return sset(argc - optind - 1, argc - optind > 1 ? argv + optind + 1 : NULL, 0, 0) ? 1 : 0; + } else if (!strcmp(argv[optind], "sget") || !strcmp(argv[optind], "get")) { + return sset(argc - optind - 1, argc - optind > 1 ? argv + optind + 1 : NULL, 1, 0) ? 1 : 0; + } else if (!strcmp(argv[optind], "cset")) { + return cset(argc - optind - 1, argc - optind > 1 ? argv + optind + 1 : NULL, 0, 0) ? 1 : 0; + } else if (!strcmp(argv[optind], "cget")) { + return cset(argc - optind - 1, argc - optind > 1 ? argv + optind + 1 : NULL, 1, 0) ? 1 : 0; + } else if (!strcmp(argv[optind], "events")) { + return events(argc - optind - 1, argc - optind > 1 ? argv + optind + 1 : NULL); + } else if (!strcmp(argv[optind], "sevents")) { + return sevents(argc - optind - 1, argc - optind > 1 ? argv + optind + 1 : NULL); + } else { + fprintf(stderr, "amixer: Unknown command '%s'...\n", argv[optind]); + } + + return 0; +} diff --git a/amixer/amixer.h b/amixer/amixer.h new file mode 100644 index 0000000..af97628 --- /dev/null +++ b/amixer/amixer.h @@ -0,0 +1,21 @@ +/* + * ALSA command line mixer utility + * Copyright (c) 1999 by Jaroslav Kysela + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + */ + +#include "../include/version.h" diff --git a/aplay/Makefile.am b/aplay/Makefile.am new file mode 100644 index 0000000..c3256e9 --- /dev/null +++ b/aplay/Makefile.am @@ -0,0 +1,31 @@ +LIBRT = @LIBRT@ + +AM_CPPFLAGS = -I$(top_srcdir)/include +LDADD = $(LIBINTL) $(LIBRT) + +# debug flags +#LDFLAGS = -static +#LDADD += -ldl + +bin_PROGRAMS = aplay +man_MANS = aplay.1 arecord.1 +noinst_HEADERS = formats.h + +EXTRA_DIST = aplay.1 arecord.1 +EXTRA_CLEAN = arecord + +arecord: aplay + rm -f arecord + $(LN_S) $< $@ + +arecord.1: aplay.1 + rm -f arecord.1 + $(LN_S) $< $@ + +install-exec-hook: arecord + rm -f $(DESTDIR)$(bindir)/arecord + (cd $(DESTDIR)$(bindir) && $(LN_S) aplay arecord) + +install-data-hook: + rm -f $(DESTDIR)$(mandir)/man1/arecord.1 + (cd $(DESTDIR)$(mandir)/man1 && $(LN_S) aplay.1 arecord.1) diff --git a/aplay/Makefile.in b/aplay/Makefile.in new file mode 100644 index 0000000..b3306bc --- /dev/null +++ b/aplay/Makefile.in @@ -0,0 +1,744 @@ +# Makefile.in generated by automake 1.16.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994-2018 Free Software Foundation, Inc. + +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + + +VPATH = @srcdir@ +am__is_gnu_make = { \ + if test -z '$(MAKELEVEL)'; then \ + false; \ + elif test -n '$(MAKE_HOST)'; then \ + true; \ + elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ + true; \ + else \ + false; \ + fi; \ +} +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + esac; \ + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +bin_PROGRAMS = aplay$(EXEEXT) +subdir = aplay +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/gettext.m4 \ + $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/lib-ld.m4 \ + $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ + $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \ + $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/acinclude.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +DIST_COMMON = $(srcdir)/Makefile.am $(noinst_HEADERS) \ + $(am__DIST_COMMON) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/include/aconfig.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +am__installdirs = "$(DESTDIR)$(bindir)" "$(DESTDIR)$(man1dir)" +PROGRAMS = $(bin_PROGRAMS) +aplay_SOURCES = aplay.c +aplay_OBJECTS = aplay.$(OBJEXT) +aplay_LDADD = $(LDADD) +am__DEPENDENCIES_1 = +aplay_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__maybe_remake_depfiles = depfiles +am__depfiles_remade = ./$(DEPDIR)/aplay.Po +am__mv = mv -f +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +AM_V_CC = $(am__v_CC_@AM_V@) +am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) +am__v_CC_0 = @echo " CC " $@; +am__v_CC_1 = +CCLD = $(CC) +LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_CCLD = $(am__v_CCLD_@AM_V@) +am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) +am__v_CCLD_0 = @echo " CCLD " $@; +am__v_CCLD_1 = +SOURCES = aplay.c +DIST_SOURCES = aplay.c +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; +am__vpath_adj = case $$p in \ + $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ + *) f=$$p;; \ + esac; +am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; +am__install_max = 40 +am__nobase_strip_setup = \ + srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` +am__nobase_strip = \ + for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" +am__nobase_list = $(am__nobase_strip_setup); \ + for p in $$list; do echo "$$p $$p"; done | \ + sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ + $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ + if (++n[$$2] == $(am__install_max)) \ + { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ + END { for (dir in files) print dir, files[dir] }' +am__base_list = \ + sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ + sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' +am__uninstall_files_from_dir = { \ + test -z "$$files" \ + || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ + || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ + $(am__cd) "$$dir" && rm -f $$files; }; \ + } +man1dir = $(mandir)/man1 +NROFF = nroff +MANS = $(man_MANS) +HEADERS = $(noinst_HEADERS) +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) +# Read a list of newline-separated strings from the standard input, +# and print each of them once, without duplicates. Input order is +# *not* preserved. +am__uniquify_input = $(AWK) '\ + BEGIN { nonempty = 0; } \ + { items[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in items) print i; }; } \ +' +# Make sure the list of sources is unique. This is necessary because, +# e.g., the same source file might be shared among _SOURCES variables +# for different programs/libraries. +am__define_uniq_tagged_files = \ + list='$(am__tagged_files)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | $(am__uniquify_input)` +ETAGS = etags +CTAGS = ctags +am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/depcomp +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +ALSACTL_DAEMONSWITCH = @ALSACTL_DAEMONSWITCH@ +ALSACTL_PIDFILE_DIR = @ALSACTL_PIDFILE_DIR@ +ALSA_CFLAGS = @ALSA_CFLAGS@ +ALSA_LIBS = @ALSA_LIBS@ +ALSA_TOPOLOGY_LIBS = @ALSA_TOPOLOGY_LIBS@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +ASOUND_LOCK_DIR = @ASOUND_LOCK_DIR@ +ASOUND_STATE_DIR = @ASOUND_STATE_DIR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CURSESINC = @CURSESINC@ +CURSESLIB = @CURSESLIB@ +CURSES_CFLAGS = @CURSES_CFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +FFTW_CFLAGS = @FFTW_CFLAGS@ +FFTW_INC = @FFTW_INC@ +FFTW_LIB = @FFTW_LIB@ +GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ +GMSGFMT = @GMSGFMT@ +GMSGFMT_015 = @GMSGFMT_015@ +GREP = @GREP@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +INTLLIBS = @INTLLIBS@ +INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@ +LDFLAGS = @LDFLAGS@ +LIBICONV = @LIBICONV@ +LIBINTL = @LIBINTL@ +LIBOBJS = @LIBOBJS@ +LIBRT = @LIBRT@ +LIBS = @LIBS@ +LN_S = @LN_S@ +LTLIBICONV = @LTLIBICONV@ +LTLIBINTL = @LTLIBINTL@ +LTLIBOBJS = @LTLIBOBJS@ +MAINT = @MAINT@ +MAKEINFO = @MAKEINFO@ +MKDIR_P = @MKDIR_P@ +MSGFMT = @MSGFMT@ +MSGFMT_015 = @MSGFMT_015@ +MSGMERGE = @MSGMERGE@ +NCURSESW_CFLAGS = @NCURSESW_CFLAGS@ +NCURSESW_LIBS = @NCURSESW_LIBS@ +NCURSES_CFLAGS = @NCURSES_CFLAGS@ +NCURSES_LIBS = @NCURSES_LIBS@ +OBJEXT = @OBJEXT@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ +POSUB = @POSUB@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +SND_UTIL_MAJOR = @SND_UTIL_MAJOR@ +SND_UTIL_MINOR = @SND_UTIL_MINOR@ +SND_UTIL_SUBMINOR = @SND_UTIL_SUBMINOR@ +SND_UTIL_VERSION = @SND_UTIL_VERSION@ +STRIP = @STRIP@ +SYSTEMD_CFLAGS = @SYSTEMD_CFLAGS@ +SYSTEMD_LIBS = @SYSTEMD_LIBS@ +TESTSOUND = @TESTSOUND@ +USE_NLS = @USE_NLS@ +VERSION = @VERSION@ +XGETTEXT = @XGETTEXT@ +XGETTEXT_015 = @XGETTEXT_015@ +XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_CC = @ac_ct_CC@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +mydatadir = @mydatadir@ +ncurses5_config = @ncurses5_config@ +ncursesw5_config = @ncursesw5_config@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +rst2man_available = @rst2man_available@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +systemdsystemunitdir = @systemdsystemunitdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +udevrulesdir = @udevrulesdir@ +xmlto_available = @xmlto_available@ +AM_CPPFLAGS = -I$(top_srcdir)/include +LDADD = $(LIBINTL) $(LIBRT) +man_MANS = aplay.1 arecord.1 +noinst_HEADERS = formats.h +EXTRA_DIST = aplay.1 arecord.1 +EXTRA_CLEAN = arecord +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .o .obj +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign aplay/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --foreign aplay/Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): +install-binPROGRAMS: $(bin_PROGRAMS) + @$(NORMAL_INSTALL) + @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(bindir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(bindir)" || exit 1; \ + fi; \ + for p in $$list; do echo "$$p $$p"; done | \ + sed 's/$(EXEEXT)$$//' | \ + while read p p1; do if test -f $$p \ + ; then echo "$$p"; echo "$$p"; else :; fi; \ + done | \ + sed -e 'p;s,.*/,,;n;h' \ + -e 's|.*|.|' \ + -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \ + sed 'N;N;N;s,\n, ,g' | \ + $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \ + { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \ + if ($$2 == $$4) files[d] = files[d] " " $$1; \ + else { print "f", $$3 "/" $$4, $$1; } } \ + END { for (d in files) print "f", d, files[d] }' | \ + while read type dir files; do \ + if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \ + test -z "$$files" || { \ + echo " $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(bindir)$$dir'"; \ + $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \ + } \ + ; done + +uninstall-binPROGRAMS: + @$(NORMAL_UNINSTALL) + @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ + files=`for p in $$list; do echo "$$p"; done | \ + sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \ + -e 's/$$/$(EXEEXT)/' \ + `; \ + test -n "$$list" || exit 0; \ + echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \ + cd "$(DESTDIR)$(bindir)" && rm -f $$files + +clean-binPROGRAMS: + -test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS) + +aplay$(EXEEXT): $(aplay_OBJECTS) $(aplay_DEPENDENCIES) $(EXTRA_aplay_DEPENDENCIES) + @rm -f aplay$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(aplay_OBJECTS) $(aplay_LDADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/aplay.Po@am__quote@ # am--include-marker + +$(am__depfiles_remade): + @$(MKDIR_P) $(@D) + @echo '# dummy' >$@-t && $(am__mv) $@-t $@ + +am--depfiles: $(am__depfiles_remade) + +.c.o: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< + +.c.obj: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` +install-man1: $(man_MANS) + @$(NORMAL_INSTALL) + @list1=''; \ + list2='$(man_MANS)'; \ + test -n "$(man1dir)" \ + && test -n "`echo $$list1$$list2`" \ + || exit 0; \ + echo " $(MKDIR_P) '$(DESTDIR)$(man1dir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(man1dir)" || exit 1; \ + { for i in $$list1; do echo "$$i"; done; \ + if test -n "$$list2"; then \ + for i in $$list2; do echo "$$i"; done \ + | sed -n '/\.1[a-z]*$$/p'; \ + fi; \ + } | while read p; do \ + if test -f $$p; then d=; else d="$(srcdir)/"; fi; \ + echo "$$d$$p"; echo "$$p"; \ + done | \ + sed -e 'n;s,.*/,,;p;h;s,.*\.,,;s,^[^1][0-9a-z]*$$,1,;x' \ + -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,' | \ + sed 'N;N;s,\n, ,g' | { \ + list=; while read file base inst; do \ + if test "$$base" = "$$inst"; then list="$$list $$file"; else \ + echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man1dir)/$$inst'"; \ + $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man1dir)/$$inst" || exit $$?; \ + fi; \ + done; \ + for i in $$list; do echo "$$i"; done | $(am__base_list) | \ + while read files; do \ + test -z "$$files" || { \ + echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(man1dir)'"; \ + $(INSTALL_DATA) $$files "$(DESTDIR)$(man1dir)" || exit $$?; }; \ + done; } + +uninstall-man1: + @$(NORMAL_UNINSTALL) + @list=''; test -n "$(man1dir)" || exit 0; \ + files=`{ for i in $$list; do echo "$$i"; done; \ + l2='$(man_MANS)'; for i in $$l2; do echo "$$i"; done | \ + sed -n '/\.1[a-z]*$$/p'; \ + } | sed -e 's,.*/,,;h;s,.*\.,,;s,^[^1][0-9a-z]*$$,1,;x' \ + -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,'`; \ + dir='$(DESTDIR)$(man1dir)'; $(am__uninstall_files_from_dir) + +ID: $(am__tagged_files) + $(am__define_uniq_tagged_files); mkid -fID $$unique +tags: tags-am +TAGS: tags + +tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + set x; \ + here=`pwd`; \ + $(am__define_uniq_tagged_files); \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: ctags-am + +CTAGS: ctags +ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + $(am__define_uniq_tagged_files); \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" +cscopelist: cscopelist-am + +cscopelist-am: $(am__tagged_files) + list='$(am__tagged_files)'; \ + case "$(srcdir)" in \ + [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ + *) sdir=$(subdir)/$(srcdir) ;; \ + esac; \ + for i in $$list; do \ + if test -f "$$i"; then \ + echo "$(subdir)/$$i"; \ + else \ + echo "$$sdir/$$i"; \ + fi; \ + done >> $(top_builddir)/cscope.files + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) distdir-am + +distdir-am: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(PROGRAMS) $(MANS) $(HEADERS) +installdirs: + for dir in "$(DESTDIR)$(bindir)" "$(DESTDIR)$(man1dir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ + done +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-binPROGRAMS clean-generic mostlyclean-am + +distclean: distclean-am + -rm -f ./$(DEPDIR)/aplay.Po + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: install-man + @$(NORMAL_INSTALL) + $(MAKE) $(AM_MAKEFLAGS) install-data-hook +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: install-binPROGRAMS + @$(NORMAL_INSTALL) + $(MAKE) $(AM_MAKEFLAGS) install-exec-hook +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: install-man1 + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -f ./$(DEPDIR)/aplay.Po + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-binPROGRAMS uninstall-man + +uninstall-man: uninstall-man1 + +.MAKE: install-am install-data-am install-exec-am install-strip + +.PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-am clean \ + clean-binPROGRAMS clean-generic cscopelist-am ctags ctags-am \ + distclean distclean-compile distclean-generic distclean-tags \ + distdir dvi dvi-am html html-am info info-am install \ + install-am install-binPROGRAMS install-data install-data-am \ + install-data-hook install-dvi install-dvi-am install-exec \ + install-exec-am install-exec-hook install-html install-html-am \ + install-info install-info-am install-man install-man1 \ + install-pdf install-pdf-am install-ps install-ps-am \ + install-strip installcheck installcheck-am installdirs \ + maintainer-clean maintainer-clean-generic mostlyclean \ + mostlyclean-compile mostlyclean-generic pdf pdf-am ps ps-am \ + tags tags-am uninstall uninstall-am uninstall-binPROGRAMS \ + uninstall-man uninstall-man1 + +.PRECIOUS: Makefile + + +arecord: aplay + rm -f arecord + $(LN_S) $< $@ + +arecord.1: aplay.1 + rm -f arecord.1 + $(LN_S) $< $@ + +install-exec-hook: arecord + rm -f $(DESTDIR)$(bindir)/arecord + (cd $(DESTDIR)$(bindir) && $(LN_S) aplay arecord) + +install-data-hook: + rm -f $(DESTDIR)$(mandir)/man1/arecord.1 + (cd $(DESTDIR)$(mandir)/man1 && $(LN_S) aplay.1 arecord.1) + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/aplay/aplay.1 b/aplay/aplay.1 new file mode 100644 index 0000000..3bba59d --- /dev/null +++ b/aplay/aplay.1 @@ -0,0 +1,267 @@ +.TH APLAY 1 "1 January 2010" +.SH NAME +arecord, aplay \- command\-line sound recorder and player for ALSA +soundcard driver +.SH SYNOPSIS +\fBarecord\fP [\fIflags\fP] [filename] +.br +\fBaplay\fP [\fIflags\fP] [filename [filename]] ... + +.SH DESCRIPTION +\fBarecord\fP is a command\-line soundfile recorder for the ALSA soundcard +driver. It supports several file formats and multiple soundcards with +multiple devices. If recording with interleaved mode samples the file is +automatically split before the 2GB filesize. + +\fBaplay\fP is much the same, only it plays instead of recording. For +supported soundfile formats, the sampling rate, bit depth, and so +forth can be automatically determined from the soundfile header. + +If filename is not specified, the standard output or input is used. The \fBaplay\fP utility accepts multiple filenames. + +.SH OPTIONS +.TP +\fI\-h, \-\-help\fP +Help: show syntax. +.TP +\fI\-\-version\fP +Print current version. +.TP +\fI\-l, \-\-list\-devices\fP +List all soundcards and digital audio devices +.TP +\fI\-L, \-\-list\-pcms\fP +List all PCMs defined +.TP +\fI\-D, \-\-device=NAME\fP +Select PCM by name +.TP +\fI\-q \-\-quiet\fP +Quiet mode. Suppress messages (not sound :)) +.TP +\fI\-t, \-\-file\-type TYPE\fP +File type (voc, wav, raw or au). +If this parameter is omitted the WAVE format is used. +.TP +\fI\-c, \-\-channels=#\fP +The number of channels. +The default is one channel. +Valid values are 1 through 32. +.TP +\fI\-f \-\-format=FORMAT\fP +Sample format +.br +Recognized sample formats are: S8 U8 S16_LE S16_BE U16_LE U16_BE S24_LE +S24_BE U24_LE U24_BE S32_LE S32_BE U32_LE U32_BE FLOAT_LE FLOAT_BE +FLOAT64_LE FLOAT64_BE IEC958_SUBFRAME_LE IEC958_SUBFRAME_BE MU_LAW +A_LAW IMA_ADPCM MPEG GSM SPECIAL S24_3LE S24_3BE U24_3LE U24_3BE S20_3LE +S20_3BE U20_3LE U20_3BE S18_3LE S18_3BE U18_3LE +.br +Some of these may not be available on selected hardware +.br +The available format shortcuts are: +.nf +\-f cd (16 bit little endian, 44100, stereo) [\-f S16_LE \-c2 \-r44100] +\-f cdr (16 bit big endian, 44100, stereo) [\-f S16_BE \-c2 \-r44100] +\-f dat (16 bit little endian, 48000, stereo) [\-f S16_LE \-c2 \-r48000] +.fi +If no format is given U8 is used. +.TP +\fI\-r, \-\-rate=#\fP +Sampling rate in Hertz. The default rate is 8000 Hertz. +If the value specified is less than 300, it is taken as the rate in kilohertz. +Valid values are 2000 through 192000 Hertz. +.TP +\fI\-d, \-\-duration=#\fP +Interrupt after # seconds. +A value of zero means infinity. +The default is zero, so if this option is omitted then the record/playback process will run until it is killed. +Either '-d' or '-s' option is available exclusively. +.TP +\fI\-s, \-\-samples=#\fP +Interrupt after transmission of # PCM frames. +A value of zero means infinity. +The default is zero, so if this options is omitted then the record/playback process will run until it is killed. +Either '-d' or '-s' option is available exclusively. +.TP +\fI\-M, \-\-mmap\fP +Use memory\-mapped (mmap) I/O mode for the audio stream. +If this option is not set, the read/write I/O mode will be used. +.TP +\fI\-N, \-\-nonblock\fP +Open the audio device in non\-blocking mode. If the device is busy the program will exit immediately. +If this option is not set the program will block until the audio device is available again. +.TP +\fI\-F, \-\-period\-time=#\fP +Distance between interrupts is # microseconds. +If no period time and no period size is given then a quarter of the buffer time is set. +.TP +\fI\-B, \-\-buffer\-time=#\fP +Buffer duration is # microseconds +If no buffer time and no buffer size is given then the maximal allowed buffer time but not more than 500ms is set. +.TP +\fI\-\-period\-size=#\fP +Distance between interrupts is # frames +If no period size and no period time is given then a quarter of the buffer size is set. +.TP +\fI\-\-buffer\-size=#\fP +Buffer duration is # frames +If no buffer time and no buffer size is given then the maximal allowed buffer time but not more than 500ms is set. +.TP +\fI\-A, \-\-avail\-min=#\fP +Min available space for wakeup is # microseconds +.TP +\fI\-R, \-\-start\-delay=#\fP +Delay for automatic PCM start is # microseconds +(relative to buffer size if <= 0) +.TP +\fI\-T, \-\-stop\-delay=#\fP +Delay for automatic PCM stop is # microseconds from xrun +.TP +\fI\-v, \-\-verbose\fP +Show PCM structure and setup. +This option is accumulative. The VU meter is displayed when this +is given twice or three times. +.TP +\fI\-V, \-\-vumeter=TYPE\fP +Specifies the VU\-meter type, either \fIstereo\fP or \fImono\fP. +The stereo VU\-meter is available only for 2\-channel stereo samples +with interleaved format. +.TP +\fI\-I, \-\-separate\-channels\fP +One file for each channel. This option disables max\-file\-time +and use\-strftime, and ignores SIGUSR1. The stereo VU meter is +not available with separate channels. +.TP +\fI\-P\fP +Playback. This is the default if the program is invoked +by typing aplay. +.TP +\fI\-C\fP +Record. This is the default if the program is invoked +by typing arecord. +.TP +\fI\-i, \-\-interactive\fP +Allow interactive operation via stdin. +Currently only pause/resume via space or enter key is implemented. +.TP +\fI-m, \-\-chmap=ch1,ch2,...\fP +Give the channel map to override or follow. Pass channel position +strings like \fIFL\fP, \fIFR\fP, etc. + +If a device supports the override of the channel map, \fBaplay\fP +tries to pass the given channel map. +If it doesn't support the channel map override but still it provides +the channel map information, \fBaplay\fP tries to rearrange the +channel order in the buffer to match with the returned channel map +from the device. +.TP +\fI\-\-disable\-resample\fP +Disable automatic rate resample. +.TP +\fI\-\-disable\-channels\fP +Disable automatic channel conversions. +.TP +\fI\-\-disable\-format\fP +Disable automatic format conversions. +.TP +\fI\-\-disable\-softvol\fP +Disable software volume control (softvol). +.TP +\fI\-\-test\-position\fP +Test ring buffer position. +.TP +\fI\-\-test\-coef=\fP +Test coefficient for ring buffer position; default is 8. +Expression for validation is: coef * (buffer_size / 2). +Minimum value is 1. +.TP +\fI\-\-test\-nowait\fP +Do not wait for the ring buffer \(hy eats the whole CPU. +.TP +\fI\-\-max\-file\-time\fP +While recording, when the output file has been accumulating +sound for this long, +close it and open a new output file. Default is the maximum +size supported by the file format: 2 GiB for WAV files. +This option has no effect if \-\-separate\-channels is +specified. +.TP +\fI\-\-process\-id\-file \fP +aplay writes its process ID here, so other programs can +send signals to it. +.TP +\fI\-\-use\-strftime\fP +When recording, interpret %\-codes in the file name parameter using +the strftime facility whenever the output file is opened. The +important strftime codes are: %Y is the year, %m month, %d day of +the month, %H hour, %M minute and %S second. In addition, %v is +the file number, starting at 1. When this option is specified, +intermediate directories for the output file are created automatically. +This option has no effect if \-\-separate\-channels is specified. +.TP +\fI\-\-dump\-hw\-params\fP +Dump hw_params of the device preconfigured status to stderr. The dump +lists capabilities of the selected device such as supported formats, +sampling rates, numbers of channels, period and buffer bytes/sizes/times. +For raw device hw:X this option basically lists hardware capabilities of +the soundcard. +.TP +\fI\-\-fatal\-errors\fP +Disables recovery attempts when errors (e.g. xrun) are encountered; the +aplay process instead aborts immediately. + +.SH SIGNALS +When recording, SIGINT, SIGTERM and SIGABRT will close the output +file and exit. SIGUSR1 will close the output file, open a new one, +and continue recording. However, SIGUSR1 does not work with +\-\-separate\-channels. + +.SH EXAMPLES + +.TP +\fBaplay \-c 1 \-t raw \-r 22050 \-f mu_law foobar\fR +will play the raw file "foobar" as a +22050\-Hz, mono, 8\-bit, Mu\-Law .au file. + +.TP +\fBarecord \-d 10 \-f cd \-t wav \-D copy foobar.wav\fP +will record foobar.wav as a 10\-second, CD\-quality wave file, using the +PCM "copy" (which might be defined in the user's .asoundrc file as: +.nf +pcm.copy { + type plug + slave { + pcm hw + } + route_policy copy +} +.fi + +.TP +\fBarecord \-t wav \-\-max\-file\-time 30 mon.wav\fP +Record from the default audio source in monaural, 8,000 samples +per second, 8 bits per sample. Start a new file every +30 seconds. File names are mon\-nn.wav, where nn increases +from 01. The file after mon\-99.wav is mon\-100.wav. + +.TP +\fBarecord \-f cd \-t wav \-\-max\-file\-time 3600 \-\-use-strftime %Y/%m/%d/listen-%H-%M-%v.wav\fP +Record in stereo from the default audio source. Create a new file +every hour. The files are placed in directories based on their start dates +and have names which include their start times and file numbers. + +.SH SEE ALSO +\fB +alsamixer(1), +amixer(1) +\fP + +.SH BUGS +Note that .aiff files are not currently supported. + +.SH AUTHOR +\fBarecord\fP and \fBaplay\fP are by Jaroslav Kysela +This document is by Paul Winkler . +Updated for Alsa 0.9 by James Tappin + diff --git a/aplay/aplay.c b/aplay/aplay.c new file mode 100644 index 0000000..0a65ad6 --- /dev/null +++ b/aplay/aplay.c @@ -0,0 +1,3437 @@ +/* + * aplay.c - plays and records + * + * CREATIVE LABS CHANNEL-files + * Microsoft WAVE-files + * SPARC AUDIO .AU-files + * Raw Data + * + * Copyright (c) by Jaroslav Kysela + * Based on vplay program by Michael Beck + * + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + */ + +#define _GNU_SOURCE +#include "aconfig.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "gettext.h" +#include "formats.h" +#include "version.h" + +#define ABS(a) (a) < 0 ? -(a) : (a) + +#ifdef SND_CHMAP_API_VERSION +#define CONFIG_SUPPORT_CHMAP 1 +#endif + +#ifndef LLONG_MAX +#define LLONG_MAX 9223372036854775807LL +#endif + +#ifndef le16toh +#include +#define le16toh(x) __le16_to_cpu(x) +#define be16toh(x) __be16_to_cpu(x) +#define le32toh(x) __le32_to_cpu(x) +#define be32toh(x) __be32_to_cpu(x) +#endif + +#define DEFAULT_FORMAT SND_PCM_FORMAT_U8 +#define DEFAULT_SPEED 8000 + +#define FORMAT_DEFAULT -1 +#define FORMAT_RAW 0 +#define FORMAT_VOC 1 +#define FORMAT_WAVE 2 +#define FORMAT_AU 3 + +/* global data */ + +static snd_pcm_sframes_t (*readi_func)(snd_pcm_t *handle, void *buffer, snd_pcm_uframes_t size); +static snd_pcm_sframes_t (*writei_func)(snd_pcm_t *handle, const void *buffer, snd_pcm_uframes_t size); +static snd_pcm_sframes_t (*readn_func)(snd_pcm_t *handle, void **bufs, snd_pcm_uframes_t size); +static snd_pcm_sframes_t (*writen_func)(snd_pcm_t *handle, void **bufs, snd_pcm_uframes_t size); + +enum { + VUMETER_NONE, + VUMETER_MONO, + VUMETER_STEREO +}; + +static char *command; +static snd_pcm_t *handle; +static struct { + snd_pcm_format_t format; + unsigned int channels; + unsigned int rate; +} hwparams, rhwparams; +static int timelimit = 0; +static int sampleslimit = 0; +static int quiet_mode = 0; +static int file_type = FORMAT_DEFAULT; +static int open_mode = 0; +static snd_pcm_stream_t stream = SND_PCM_STREAM_PLAYBACK; +static int mmap_flag = 0; +static int interleaved = 1; +static int nonblock = 0; +static volatile sig_atomic_t in_aborting = 0; +static u_char *audiobuf = NULL; +static snd_pcm_uframes_t chunk_size = 0; +static unsigned period_time = 0; +static unsigned buffer_time = 0; +static snd_pcm_uframes_t period_frames = 0; +static snd_pcm_uframes_t buffer_frames = 0; +static int avail_min = -1; +static int start_delay = 0; +static int stop_delay = 0; +static int monotonic = 0; +static int interactive = 0; +static int can_pause = 0; +static int fatal_errors = 0; +static int verbose = 0; +static int vumeter = VUMETER_NONE; +static int buffer_pos = 0; +static size_t significant_bits_per_sample, bits_per_sample, bits_per_frame; +static size_t chunk_bytes; +static int test_position = 0; +static int test_coef = 8; +static int test_nowait = 0; +static snd_output_t *log; +static long long max_file_size = 0; +static int max_file_time = 0; +static int use_strftime = 0; +volatile static int recycle_capture_file = 0; +static long term_c_lflag = -1; +static int dump_hw_params = 0; + +static int fd = -1; +static off64_t pbrec_count = LLONG_MAX, fdcount; +static int vocmajor, vocminor; + +static char *pidfile_name = NULL; +FILE *pidf = NULL; +static int pidfile_written = 0; + +#ifdef CONFIG_SUPPORT_CHMAP +static snd_pcm_chmap_t *channel_map = NULL; /* chmap to override */ +static unsigned int *hw_map = NULL; /* chmap to follow */ +#endif + +/* needed prototypes */ + +static void done_stdin(void); + +static void playback(char *filename); +static void capture(char *filename); +static void playbackv(char **filenames, unsigned int count); +static void capturev(char **filenames, unsigned int count); + +static void begin_voc(int fd, size_t count); +static void end_voc(int fd); +static void begin_wave(int fd, size_t count); +static void end_wave(int fd); +static void begin_au(int fd, size_t count); +static void end_au(int fd); + +static void suspend(void); + +static const struct fmt_capture { + void (*start) (int fd, size_t count); + void (*end) (int fd); + char *what; + long long max_filesize; +} fmt_rec_table[] = { + { NULL, NULL, N_("raw data"), LLONG_MAX }, + { begin_voc, end_voc, N_("VOC"), 16000000LL }, + /* FIXME: can WAV handle exactly 2GB or less than it? */ + { begin_wave, end_wave, N_("WAVE"), 2147483648LL }, + { begin_au, end_au, N_("Sparc Audio"), LLONG_MAX } +}; + +#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95) +#define error(...) do {\ + fprintf(stderr, "%s: %s:%d: ", command, __func__, __LINE__); \ + fprintf(stderr, __VA_ARGS__); \ + putc('\n', stderr); \ +} while (0) +#else +#define error(args...) do {\ + fprintf(stderr, "%s: %s:%d: ", command, __func__, __LINE__); \ + fprintf(stderr, ##args); \ + putc('\n', stderr); \ +} while (0) +#endif + +static void usage(char *command) +{ + snd_pcm_format_t k; + printf( +_("Usage: %s [OPTION]... [FILE]...\n" +"\n" +"-h, --help help\n" +" --version print current version\n" +"-l, --list-devices list all soundcards and digital audio devices\n" +"-L, --list-pcms list device names\n" +"-D, --device=NAME select PCM by name\n" +"-q, --quiet quiet mode\n" +"-t, --file-type TYPE file type (voc, wav, raw or au)\n" +"-c, --channels=# channels\n" +"-f, --format=FORMAT sample format (case insensitive)\n" +"-r, --rate=# sample rate\n" +"-d, --duration=# interrupt after # seconds\n" +"-s, --samples=# interrupt after # samples per channel\n" +"-M, --mmap mmap stream\n" +"-N, --nonblock nonblocking mode\n" +"-F, --period-time=# distance between interrupts is # microseconds\n" +"-B, --buffer-time=# buffer duration is # microseconds\n" +" --period-size=# distance between interrupts is # frames\n" +" --buffer-size=# buffer duration is # frames\n" +"-A, --avail-min=# min available space for wakeup is # microseconds\n" +"-R, --start-delay=# delay for automatic PCM start is # microseconds \n" +" (relative to buffer size if <= 0)\n" +"-T, --stop-delay=# delay for automatic PCM stop is # microseconds from xrun\n" +"-v, --verbose show PCM structure and setup (accumulative)\n" +"-V, --vumeter=TYPE enable VU meter (TYPE: mono or stereo)\n" +"-I, --separate-channels one file for each channel\n" +"-i, --interactive allow interactive operation from stdin\n" +"-m, --chmap=ch1,ch2,.. Give the channel map to override or follow\n" +" --disable-resample disable automatic rate resample\n" +" --disable-channels disable automatic channel conversions\n" +" --disable-format disable automatic format conversions\n" +" --disable-softvol disable software volume control (softvol)\n" +" --test-position test ring buffer position\n" +" --test-coef=# test coefficient for ring buffer position (default 8)\n" +" expression for validation is: coef * (buffer_size / 2)\n" +" --test-nowait do not wait for ring buffer - eats whole CPU\n" +" --max-file-time=# start another output file when the old file has recorded\n" +" for this many seconds\n" +" --process-id-file write the process ID here\n" +" --use-strftime apply the strftime facility to the output file name\n" +" --dump-hw-params dump hw_params of the device\n" +" --fatal-errors treat all errors as fatal\n" + ) + , command); + printf(_("Recognized sample formats are:")); + for (k = 0; k <= SND_PCM_FORMAT_LAST; ++k) { + const char *s = snd_pcm_format_name(k); + if (s) + printf(" %s", s); + } + printf(_("\nSome of these may not be available on selected hardware\n")); + printf(_("The available format shortcuts are:\n")); + printf(_("-f cd (16 bit little endian, 44100, stereo)\n")); + printf(_("-f cdr (16 bit big endian, 44100, stereo)\n")); + printf(_("-f dat (16 bit little endian, 48000, stereo)\n")); +} + +static void device_list(void) +{ + snd_ctl_t *handle; + int card, err, dev, idx; + snd_ctl_card_info_t *info; + snd_pcm_info_t *pcminfo; + snd_ctl_card_info_alloca(&info); + snd_pcm_info_alloca(&pcminfo); + + card = -1; + if (snd_card_next(&card) < 0 || card < 0) { + error(_("no soundcards found...")); + return; + } + printf(_("**** List of %s Hardware Devices ****\n"), + snd_pcm_stream_name(stream)); + while (card >= 0) { + char name[32]; + sprintf(name, "hw:%d", card); + if ((err = snd_ctl_open(&handle, name, 0)) < 0) { + error("control open (%i): %s", card, snd_strerror(err)); + goto next_card; + } + if ((err = snd_ctl_card_info(handle, info)) < 0) { + error("control hardware info (%i): %s", card, snd_strerror(err)); + snd_ctl_close(handle); + goto next_card; + } + dev = -1; + while (1) { + unsigned int count; + if (snd_ctl_pcm_next_device(handle, &dev)<0) + error("snd_ctl_pcm_next_device"); + if (dev < 0) + break; + snd_pcm_info_set_device(pcminfo, dev); + snd_pcm_info_set_subdevice(pcminfo, 0); + snd_pcm_info_set_stream(pcminfo, stream); + if ((err = snd_ctl_pcm_info(handle, pcminfo)) < 0) { + if (err != -ENOENT) + error("control digital audio info (%i): %s", card, snd_strerror(err)); + continue; + } + printf(_("card %i: %s [%s], device %i: %s [%s]\n"), + card, snd_ctl_card_info_get_id(info), snd_ctl_card_info_get_name(info), + dev, + snd_pcm_info_get_id(pcminfo), + snd_pcm_info_get_name(pcminfo)); + count = snd_pcm_info_get_subdevices_count(pcminfo); + printf( _(" Subdevices: %i/%i\n"), + snd_pcm_info_get_subdevices_avail(pcminfo), count); + for (idx = 0; idx < (int)count; idx++) { + snd_pcm_info_set_subdevice(pcminfo, idx); + if ((err = snd_ctl_pcm_info(handle, pcminfo)) < 0) { + error("control digital audio playback info (%i): %s", card, snd_strerror(err)); + } else { + printf(_(" Subdevice #%i: %s\n"), + idx, snd_pcm_info_get_subdevice_name(pcminfo)); + } + } + } + snd_ctl_close(handle); + next_card: + if (snd_card_next(&card) < 0) { + error("snd_card_next"); + break; + } + } +} + +static void pcm_list(void) +{ + void **hints, **n; + char *name, *descr, *descr1, *io; + const char *filter; + + if (snd_device_name_hint(-1, "pcm", &hints) < 0) + return; + n = hints; + filter = stream == SND_PCM_STREAM_CAPTURE ? "Input" : "Output"; + while (*n != NULL) { + name = snd_device_name_get_hint(*n, "NAME"); + descr = snd_device_name_get_hint(*n, "DESC"); + io = snd_device_name_get_hint(*n, "IOID"); + if (io != NULL && strcmp(io, filter) != 0) + goto __end; + printf("%s\n", name); + if ((descr1 = descr) != NULL) { + printf(" "); + while (*descr1) { + if (*descr1 == '\n') + printf("\n "); + else + putchar(*descr1); + descr1++; + } + putchar('\n'); + } + __end: + if (name != NULL) + free(name); + if (descr != NULL) + free(descr); + if (io != NULL) + free(io); + n++; + } + snd_device_name_free_hint(hints); +} + +static void version(void) +{ + printf("%s: version " SND_UTIL_VERSION_STR " by Jaroslav Kysela \n", command); +} + +/* + * Subroutine to clean up before exit. + */ +static void prg_exit(int code) +{ + done_stdin(); + if (handle) + snd_pcm_close(handle); + if (pidfile_written) + remove (pidfile_name); + exit(code); +} + +static void signal_handler(int sig) +{ + if (in_aborting) + return; + + in_aborting = 1; + if (verbose==2) + putchar('\n'); + if (!quiet_mode) + fprintf(stderr, _("Aborted by signal %s...\n"), strsignal(sig)); + if (handle) + snd_pcm_abort(handle); + if (sig == SIGABRT) { + /* do not call snd_pcm_close() and abort immediately */ + handle = NULL; + prg_exit(EXIT_FAILURE); + } + signal(sig, SIG_DFL); +} + +/* call on SIGUSR1 signal. */ +static void signal_handler_recycle (int sig) +{ + /* flag the capture loop to start a new output file */ + recycle_capture_file = 1; +} + +enum { + OPT_VERSION = 1, + OPT_PERIOD_SIZE, + OPT_BUFFER_SIZE, + OPT_DISABLE_RESAMPLE, + OPT_DISABLE_CHANNELS, + OPT_DISABLE_FORMAT, + OPT_DISABLE_SOFTVOL, + OPT_TEST_POSITION, + OPT_TEST_COEF, + OPT_TEST_NOWAIT, + OPT_MAX_FILE_TIME, + OPT_PROCESS_ID_FILE, + OPT_USE_STRFTIME, + OPT_DUMP_HWPARAMS, + OPT_FATAL_ERRORS, +}; + +/* + * make sure we write all bytes or return an error + */ +static ssize_t xwrite(int fd, const void *buf, size_t count) +{ + ssize_t written; + size_t offset = 0; + + while (offset < count) { + written = write(fd, (char *)buf + offset, count - offset); + if (written <= 0) + return written; + + offset += written; + }; + + return offset; +} + +static long parse_long(const char *str, int *err) +{ + long val; + char *endptr; + + errno = 0; + val = strtol(str, &endptr, 0); + + if (errno != 0 || *endptr != '\0') + *err = -1; + else + *err = 0; + + return val; +} + +int main(int argc, char *argv[]) +{ + int duration_or_sample = 0; + int option_index; + static const char short_options[] = "hnlLD:qt:c:f:r:d:s:MNF:A:R:T:B:vV:IPCi" +#ifdef CONFIG_SUPPORT_CHMAP + "m:" +#endif + ; + static const struct option long_options[] = { + {"help", 0, 0, 'h'}, + {"version", 0, 0, OPT_VERSION}, + {"list-devnames", 0, 0, 'n'}, + {"list-devices", 0, 0, 'l'}, + {"list-pcms", 0, 0, 'L'}, + {"device", 1, 0, 'D'}, + {"quiet", 0, 0, 'q'}, + {"file-type", 1, 0, 't'}, + {"channels", 1, 0, 'c'}, + {"format", 1, 0, 'f'}, + {"rate", 1, 0, 'r'}, + {"duration", 1, 0 ,'d'}, + {"samples", 1, 0, 's'}, + {"mmap", 0, 0, 'M'}, + {"nonblock", 0, 0, 'N'}, + {"period-time", 1, 0, 'F'}, + {"period-size", 1, 0, OPT_PERIOD_SIZE}, + {"avail-min", 1, 0, 'A'}, + {"start-delay", 1, 0, 'R'}, + {"stop-delay", 1, 0, 'T'}, + {"buffer-time", 1, 0, 'B'}, + {"buffer-size", 1, 0, OPT_BUFFER_SIZE}, + {"verbose", 0, 0, 'v'}, + {"vumeter", 1, 0, 'V'}, + {"separate-channels", 0, 0, 'I'}, + {"playback", 0, 0, 'P'}, + {"capture", 0, 0, 'C'}, + {"disable-resample", 0, 0, OPT_DISABLE_RESAMPLE}, + {"disable-channels", 0, 0, OPT_DISABLE_CHANNELS}, + {"disable-format", 0, 0, OPT_DISABLE_FORMAT}, + {"disable-softvol", 0, 0, OPT_DISABLE_SOFTVOL}, + {"test-position", 0, 0, OPT_TEST_POSITION}, + {"test-coef", 1, 0, OPT_TEST_COEF}, + {"test-nowait", 0, 0, OPT_TEST_NOWAIT}, + {"max-file-time", 1, 0, OPT_MAX_FILE_TIME}, + {"process-id-file", 1, 0, OPT_PROCESS_ID_FILE}, + {"use-strftime", 0, 0, OPT_USE_STRFTIME}, + {"interactive", 0, 0, 'i'}, + {"dump-hw-params", 0, 0, OPT_DUMP_HWPARAMS}, + {"fatal-errors", 0, 0, OPT_FATAL_ERRORS}, +#ifdef CONFIG_SUPPORT_CHMAP + {"chmap", 1, 0, 'm'}, +#endif + {0, 0, 0, 0} + }; + char *pcm_name = "default"; + int tmp, err, c; + int do_device_list = 0, do_pcm_list = 0; + snd_pcm_info_t *info; + FILE *direction; + +#ifdef ENABLE_NLS + setlocale(LC_ALL, ""); + textdomain(PACKAGE); +#endif + + snd_pcm_info_alloca(&info); + + err = snd_output_stdio_attach(&log, stderr, 0); + assert(err >= 0); + + command = argv[0]; + file_type = FORMAT_DEFAULT; + if (strstr(argv[0], "arecord")) { + stream = SND_PCM_STREAM_CAPTURE; + file_type = FORMAT_WAVE; + command = "arecord"; + start_delay = 1; + direction = stdout; + } else if (strstr(argv[0], "aplay")) { + stream = SND_PCM_STREAM_PLAYBACK; + command = "aplay"; + direction = stdin; + } else { + error(_("command should be named either arecord or aplay")); + return 1; + } + + if (isatty(fileno(direction)) && (argc == 1)) { + usage(command); + return 1; + } + + chunk_size = -1; + rhwparams.format = DEFAULT_FORMAT; + rhwparams.rate = DEFAULT_SPEED; + rhwparams.channels = 1; + + while ((c = getopt_long(argc, argv, short_options, long_options, &option_index)) != -1) { + switch (c) { + case 'h': + usage(command); + return 0; + case OPT_VERSION: + version(); + return 0; + case 'l': + do_device_list = 1; + break; + case 'L': + do_pcm_list = 1; + break; + case 'D': + pcm_name = optarg; + break; + case 'q': + quiet_mode = 1; + break; + case 't': + if (strcasecmp(optarg, "raw") == 0) + file_type = FORMAT_RAW; + else if (strcasecmp(optarg, "voc") == 0) + file_type = FORMAT_VOC; + else if (strcasecmp(optarg, "wav") == 0) + file_type = FORMAT_WAVE; + else if (strcasecmp(optarg, "au") == 0 || strcasecmp(optarg, "sparc") == 0) + file_type = FORMAT_AU; + else { + error(_("unrecognized file format %s"), optarg); + return 1; + } + break; + case 'c': + rhwparams.channels = parse_long(optarg, &err); + if (err < 0) { + error(_("invalid channels argument '%s'"), optarg); + return 1; + } + if (rhwparams.channels < 1 || rhwparams.channels > 256) { + error(_("value %i for channels is invalid"), rhwparams.channels); + return 1; + } + break; + case 'f': + if (strcasecmp(optarg, "cd") == 0 || strcasecmp(optarg, "cdr") == 0) { + if (strcasecmp(optarg, "cdr") == 0) + rhwparams.format = SND_PCM_FORMAT_S16_BE; + else + rhwparams.format = file_type == FORMAT_AU ? SND_PCM_FORMAT_S16_BE : SND_PCM_FORMAT_S16_LE; + rhwparams.rate = 44100; + rhwparams.channels = 2; + } else if (strcasecmp(optarg, "dat") == 0) { + rhwparams.format = file_type == FORMAT_AU ? SND_PCM_FORMAT_S16_BE : SND_PCM_FORMAT_S16_LE; + rhwparams.rate = 48000; + rhwparams.channels = 2; + } else { + rhwparams.format = snd_pcm_format_value(optarg); + if (rhwparams.format == SND_PCM_FORMAT_UNKNOWN) { + error(_("wrong extended format '%s'"), optarg); + prg_exit(EXIT_FAILURE); + } + } + break; + case 'r': + tmp = parse_long(optarg, &err); + if (err < 0) { + error(_("invalid rate argument '%s'"), optarg); + return 1; + } + if (tmp < 1000) + tmp *= 1000; + rhwparams.rate = tmp; + if (tmp < 2000 || tmp > 768000) { + error(_("bad speed value %i"), tmp); + return 1; + } + break; + case 'd': + if (duration_or_sample) { + error(_("duration and samples arguments cannot be used together")); + return 1; + } + timelimit = parse_long(optarg, &err); + if (err < 0) { + error(_("invalid duration argument '%s'"), optarg); + return 1; + } + duration_or_sample = 1; + break; + case 's': + if (duration_or_sample) { + error(_("samples and duration arguments cannot be used together")); + return 1; + } + sampleslimit = parse_long(optarg, &err); + if (err < 0) { + error(_("invalid samples argument '%s'"), optarg); + return 1; + } + duration_or_sample = 1; + break; + case 'N': + nonblock = 1; + open_mode |= SND_PCM_NONBLOCK; + break; + case 'F': + period_time = parse_long(optarg, &err); + if (err < 0) { + error(_("invalid period time argument '%s'"), optarg); + return 1; + } + break; + case 'B': + buffer_time = parse_long(optarg, &err); + if (err < 0) { + error(_("invalid buffer time argument '%s'"), optarg); + return 1; + } + break; + case OPT_PERIOD_SIZE: + period_frames = parse_long(optarg, &err); + if (err < 0) { + error(_("invalid period size argument '%s'"), optarg); + return 1; + } + break; + case OPT_BUFFER_SIZE: + buffer_frames = parse_long(optarg, &err); + if (err < 0) { + error(_("invalid buffer size argument '%s'"), optarg); + return 1; + } + break; + case 'A': + avail_min = parse_long(optarg, &err); + if (err < 0) { + error(_("invalid min available space argument '%s'"), optarg); + return 1; + } + break; + case 'R': + start_delay = parse_long(optarg, &err); + if (err < 0) { + error(_("invalid start delay argument '%s'"), optarg); + return 1; + } + break; + case 'T': + stop_delay = parse_long(optarg, &err); + if (err < 0) { + error(_("invalid stop delay argument '%s'"), optarg); + return 1; + } + break; + case 'v': + verbose++; + if (verbose > 1 && !vumeter) + vumeter = VUMETER_MONO; + break; + case 'V': + if (*optarg == 's') + vumeter = VUMETER_STEREO; + else if (*optarg == 'm') + vumeter = VUMETER_MONO; + else + vumeter = VUMETER_NONE; + break; + case 'M': + mmap_flag = 1; + break; + case 'I': + interleaved = 0; + break; + case 'P': + stream = SND_PCM_STREAM_PLAYBACK; + command = "aplay"; + break; + case 'C': + stream = SND_PCM_STREAM_CAPTURE; + command = "arecord"; + start_delay = 1; + if (file_type == FORMAT_DEFAULT) + file_type = FORMAT_WAVE; + break; + case 'i': + interactive = 1; + break; + case OPT_DISABLE_RESAMPLE: + open_mode |= SND_PCM_NO_AUTO_RESAMPLE; + break; + case OPT_DISABLE_CHANNELS: + open_mode |= SND_PCM_NO_AUTO_CHANNELS; + break; + case OPT_DISABLE_FORMAT: + open_mode |= SND_PCM_NO_AUTO_FORMAT; + break; + case OPT_DISABLE_SOFTVOL: + open_mode |= SND_PCM_NO_SOFTVOL; + break; + case OPT_TEST_POSITION: + test_position = 1; + break; + case OPT_TEST_COEF: + test_coef = parse_long(optarg, &err); + if (err < 0) { + error(_("invalid test coef argument '%s'"), optarg); + return 1; + } + if (test_coef < 1) + test_coef = 1; + break; + case OPT_TEST_NOWAIT: + test_nowait = 1; + break; + case OPT_MAX_FILE_TIME: + max_file_time = parse_long(optarg, &err); + if (err < 0) { + error(_("invalid max file time argument '%s'"), optarg); + return 1; + } + break; + case OPT_PROCESS_ID_FILE: + pidfile_name = optarg; + break; + case OPT_USE_STRFTIME: + use_strftime = 1; + break; + case OPT_DUMP_HWPARAMS: + dump_hw_params = 1; + break; + case OPT_FATAL_ERRORS: + fatal_errors = 1; + break; +#ifdef CONFIG_SUPPORT_CHMAP + case 'm': + channel_map = snd_pcm_chmap_parse_string(optarg); + if (!channel_map) { + fprintf(stderr, _("Unable to parse channel map string: %s\n"), optarg); + return 1; + } + break; +#endif + default: + fprintf(stderr, _("Try `%s --help' for more information.\n"), command); + return 1; + } + } + + if (do_device_list) { + if (do_pcm_list) pcm_list(); + device_list(); + goto __end; + } else if (do_pcm_list) { + pcm_list(); + goto __end; + } + + err = snd_pcm_open(&handle, pcm_name, stream, open_mode); + if (err < 0) { + error(_("audio open error: %s"), snd_strerror(err)); + return 1; + } + + if ((err = snd_pcm_info(handle, info)) < 0) { + error(_("info error: %s"), snd_strerror(err)); + return 1; + } + + if (nonblock) { + err = snd_pcm_nonblock(handle, 1); + if (err < 0) { + error(_("nonblock setting error: %s"), snd_strerror(err)); + return 1; + } + } + + chunk_size = 1024; + hwparams = rhwparams; + + audiobuf = (u_char *)malloc(1024); + if (audiobuf == NULL) { + error(_("not enough memory")); + return 1; + } + + if (mmap_flag) { + writei_func = snd_pcm_mmap_writei; + readi_func = snd_pcm_mmap_readi; + writen_func = snd_pcm_mmap_writen; + readn_func = snd_pcm_mmap_readn; + } else { + writei_func = snd_pcm_writei; + readi_func = snd_pcm_readi; + writen_func = snd_pcm_writen; + readn_func = snd_pcm_readn; + } + + if (pidfile_name) { + errno = 0; + pidf = fopen (pidfile_name, "w"); + if (pidf) { + (void)fprintf (pidf, "%d\n", getpid()); + fclose(pidf); + pidfile_written = 1; + } else { + error(_("Cannot create process ID file %s: %s"), + pidfile_name, strerror (errno)); + return 1; + } + } + + signal(SIGINT, signal_handler); + signal(SIGTERM, signal_handler); + signal(SIGABRT, signal_handler); + signal(SIGUSR1, signal_handler_recycle); + if (interleaved) { + if (optind > argc - 1) { + if (stream == SND_PCM_STREAM_PLAYBACK) + playback(NULL); + else + capture(NULL); + } else { + while (optind <= argc - 1) { + if (stream == SND_PCM_STREAM_PLAYBACK) + playback(argv[optind++]); + else + capture(argv[optind++]); + } + } + } else { + if (stream == SND_PCM_STREAM_PLAYBACK) + playbackv(&argv[optind], argc - optind); + else + capturev(&argv[optind], argc - optind); + } + if (verbose==2) + putchar('\n'); + snd_pcm_close(handle); + handle = NULL; + free(audiobuf); + __end: + snd_output_close(log); + snd_config_update_free_global(); + prg_exit(EXIT_SUCCESS); + /* avoid warning */ + return EXIT_SUCCESS; +} + +/* + * Safe read (for pipes) + */ + +static ssize_t safe_read(int fd, void *buf, size_t count) +{ + ssize_t result = 0, res; + + while (count > 0 && !in_aborting) { + if ((res = read(fd, buf, count)) == 0) + break; + if (res < 0) + return result > 0 ? result : res; + count -= res; + result += res; + buf = (char *)buf + res; + } + return result; +} + +/* + * Test, if it is a .VOC file and return >=0 if ok (this is the length of rest) + * < 0 if not + */ +static int test_vocfile(void *buffer) +{ + VocHeader *vp = buffer; + + if (!memcmp(vp->magic, VOC_MAGIC_STRING, 20)) { + vocminor = LE_SHORT(vp->version) & 0xFF; + vocmajor = LE_SHORT(vp->version) / 256; + if (LE_SHORT(vp->version) != (0x1233 - LE_SHORT(vp->coded_ver))) + return -2; /* coded version mismatch */ + return LE_SHORT(vp->headerlen) - sizeof(VocHeader); /* 0 mostly */ + } + return -1; /* magic string fail */ +} + +/* + * helper for test_wavefile + */ + +static size_t test_wavefile_read(int fd, u_char *buffer, size_t *size, size_t reqsize, int line) +{ + if (*size >= reqsize) + return *size; + if ((size_t)safe_read(fd, buffer + *size, reqsize - *size) != reqsize - *size) { + error(_("read error (called from line %i)"), line); + prg_exit(EXIT_FAILURE); + } + return *size = reqsize; +} + +#define check_wavefile_space(buffer, len, blimit) \ + if (len > blimit) { \ + blimit = len; \ + if ((buffer = realloc(buffer, blimit)) == NULL) { \ + error(_("not enough memory")); \ + prg_exit(EXIT_FAILURE); \ + } \ + } + +/* + * test, if it's a .WAV file, > 0 if ok (and set the speed, stereo etc.) + * == 0 if not + * Value returned is bytes to be discarded. + */ +static ssize_t test_wavefile(int fd, u_char *_buffer, size_t size) +{ + WaveHeader *h = (WaveHeader *)_buffer; + u_char *buffer = NULL; + size_t blimit = 0; + WaveFmtBody *f; + WaveChunkHeader *c; + u_int type, len; + unsigned short format, channels; + int big_endian, native_format; + + if (size < sizeof(WaveHeader)) + return -1; + if (h->magic == WAV_RIFF) + big_endian = 0; + else if (h->magic == WAV_RIFX) + big_endian = 1; + else + return -1; + if (h->type != WAV_WAVE) + return -1; + + if (size > sizeof(WaveHeader)) { + check_wavefile_space(buffer, size - sizeof(WaveHeader), blimit); + memcpy(buffer, _buffer + sizeof(WaveHeader), size - sizeof(WaveHeader)); + } + size -= sizeof(WaveHeader); + while (1) { + check_wavefile_space(buffer, sizeof(WaveChunkHeader), blimit); + test_wavefile_read(fd, buffer, &size, sizeof(WaveChunkHeader), __LINE__); + c = (WaveChunkHeader*)buffer; + type = c->type; + len = TO_CPU_INT(c->length, big_endian); + len += len % 2; + if (size > sizeof(WaveChunkHeader)) + memmove(buffer, buffer + sizeof(WaveChunkHeader), size - sizeof(WaveChunkHeader)); + size -= sizeof(WaveChunkHeader); + if (type == WAV_FMT) + break; + check_wavefile_space(buffer, len, blimit); + test_wavefile_read(fd, buffer, &size, len, __LINE__); + if (size > len) + memmove(buffer, buffer + len, size - len); + size -= len; + } + + if (len < sizeof(WaveFmtBody)) { + error(_("unknown length of 'fmt ' chunk (read %u, should be %u at least)"), + len, (u_int)sizeof(WaveFmtBody)); + prg_exit(EXIT_FAILURE); + } + check_wavefile_space(buffer, len, blimit); + test_wavefile_read(fd, buffer, &size, len, __LINE__); + f = (WaveFmtBody*) buffer; + format = TO_CPU_SHORT(f->format, big_endian); + if (format == WAV_FMT_EXTENSIBLE) { + WaveFmtExtensibleBody *fe = (WaveFmtExtensibleBody*)buffer; + if (len < sizeof(WaveFmtExtensibleBody)) { + error(_("unknown length of extensible 'fmt ' chunk (read %u, should be %u at least)"), + len, (u_int)sizeof(WaveFmtExtensibleBody)); + prg_exit(EXIT_FAILURE); + } + if (memcmp(fe->guid_tag, WAV_GUID_TAG, 14) != 0) { + error(_("wrong format tag in extensible 'fmt ' chunk")); + prg_exit(EXIT_FAILURE); + } + format = TO_CPU_SHORT(fe->guid_format, big_endian); + } + if (format != WAV_FMT_PCM && + format != WAV_FMT_IEEE_FLOAT) { + error(_("can't play WAVE-file format 0x%04x which is not PCM or FLOAT encoded"), format); + prg_exit(EXIT_FAILURE); + } + channels = TO_CPU_SHORT(f->channels, big_endian); + if (channels < 1) { + error(_("can't play WAVE-files with %d tracks"), channels); + prg_exit(EXIT_FAILURE); + } + hwparams.channels = channels; + switch (TO_CPU_SHORT(f->bit_p_spl, big_endian)) { + case 8: + if (hwparams.format != DEFAULT_FORMAT && + hwparams.format != SND_PCM_FORMAT_U8) + fprintf(stderr, _("Warning: format is changed to U8\n")); + hwparams.format = SND_PCM_FORMAT_U8; + break; + case 16: + if (big_endian) + native_format = SND_PCM_FORMAT_S16_BE; + else + native_format = SND_PCM_FORMAT_S16_LE; + if (hwparams.format != DEFAULT_FORMAT && + hwparams.format != native_format) + fprintf(stderr, _("Warning: format is changed to %s\n"), + snd_pcm_format_name(native_format)); + hwparams.format = native_format; + break; + case 24: + switch (TO_CPU_SHORT(f->byte_p_spl, big_endian) / hwparams.channels) { + case 3: + if (big_endian) + native_format = SND_PCM_FORMAT_S24_3BE; + else + native_format = SND_PCM_FORMAT_S24_3LE; + if (hwparams.format != DEFAULT_FORMAT && + hwparams.format != native_format) + fprintf(stderr, _("Warning: format is changed to %s\n"), + snd_pcm_format_name(native_format)); + hwparams.format = native_format; + break; + case 4: + if (big_endian) + native_format = SND_PCM_FORMAT_S24_BE; + else + native_format = SND_PCM_FORMAT_S24_LE; + if (hwparams.format != DEFAULT_FORMAT && + hwparams.format != native_format) + fprintf(stderr, _("Warning: format is changed to %s\n"), + snd_pcm_format_name(native_format)); + hwparams.format = native_format; + break; + default: + error(_(" can't play WAVE-files with sample %d bits in %d bytes wide (%d channels)"), + TO_CPU_SHORT(f->bit_p_spl, big_endian), + TO_CPU_SHORT(f->byte_p_spl, big_endian), + hwparams.channels); + prg_exit(EXIT_FAILURE); + } + break; + case 32: + if (format == WAV_FMT_PCM) { + if (big_endian) + native_format = SND_PCM_FORMAT_S32_BE; + else + native_format = SND_PCM_FORMAT_S32_LE; + hwparams.format = native_format; + } else if (format == WAV_FMT_IEEE_FLOAT) { + if (big_endian) + native_format = SND_PCM_FORMAT_FLOAT_BE; + else + native_format = SND_PCM_FORMAT_FLOAT_LE; + hwparams.format = native_format; + } + break; + default: + error(_(" can't play WAVE-files with sample %d bits wide"), + TO_CPU_SHORT(f->bit_p_spl, big_endian)); + prg_exit(EXIT_FAILURE); + } + hwparams.rate = TO_CPU_INT(f->sample_fq, big_endian); + + if (size > len) + memmove(buffer, buffer + len, size - len); + size -= len; + + while (1) { + u_int type, len; + + check_wavefile_space(buffer, sizeof(WaveChunkHeader), blimit); + test_wavefile_read(fd, buffer, &size, sizeof(WaveChunkHeader), __LINE__); + c = (WaveChunkHeader*)buffer; + type = c->type; + len = TO_CPU_INT(c->length, big_endian); + if (size > sizeof(WaveChunkHeader)) + memmove(buffer, buffer + sizeof(WaveChunkHeader), size - sizeof(WaveChunkHeader)); + size -= sizeof(WaveChunkHeader); + if (type == WAV_DATA) { + if (len < pbrec_count && len < 0x7ffffffe) + pbrec_count = len; + if (size > 0) + memcpy(_buffer, buffer, size); + free(buffer); + return size; + } + len += len % 2; + check_wavefile_space(buffer, len, blimit); + test_wavefile_read(fd, buffer, &size, len, __LINE__); + if (size > len) + memmove(buffer, buffer + len, size - len); + size -= len; + } + + /* shouldn't be reached */ + return -1; +} + +/* + + */ + +static int test_au(int fd, void *buffer) +{ + AuHeader *ap = buffer; + + if (ap->magic != AU_MAGIC) + return -1; + if (BE_INT(ap->hdr_size) > 128 || BE_INT(ap->hdr_size) < 24) + return -1; + pbrec_count = BE_INT(ap->data_size); + switch (BE_INT(ap->encoding)) { + case AU_FMT_ULAW: + if (hwparams.format != DEFAULT_FORMAT && + hwparams.format != SND_PCM_FORMAT_MU_LAW) + fprintf(stderr, _("Warning: format is changed to MU_LAW\n")); + hwparams.format = SND_PCM_FORMAT_MU_LAW; + break; + case AU_FMT_LIN8: + if (hwparams.format != DEFAULT_FORMAT && + hwparams.format != SND_PCM_FORMAT_U8) + fprintf(stderr, _("Warning: format is changed to U8\n")); + hwparams.format = SND_PCM_FORMAT_U8; + break; + case AU_FMT_LIN16: + if (hwparams.format != DEFAULT_FORMAT && + hwparams.format != SND_PCM_FORMAT_S16_BE) + fprintf(stderr, _("Warning: format is changed to S16_BE\n")); + hwparams.format = SND_PCM_FORMAT_S16_BE; + break; + default: + return -1; + } + hwparams.rate = BE_INT(ap->sample_rate); + if (hwparams.rate < 2000 || hwparams.rate > 256000) + return -1; + hwparams.channels = BE_INT(ap->channels); + if (hwparams.channels < 1 || hwparams.channels > 256) + return -1; + if ((size_t)safe_read(fd, (char *)buffer + sizeof(AuHeader), BE_INT(ap->hdr_size) - sizeof(AuHeader)) != BE_INT(ap->hdr_size) - sizeof(AuHeader)) { + error(_("read error")); + prg_exit(EXIT_FAILURE); + } + return 0; +} + +static void show_available_sample_formats(snd_pcm_hw_params_t* params) +{ + snd_pcm_format_t format; + + fprintf(stderr, "Available formats:\n"); + for (format = 0; format <= SND_PCM_FORMAT_LAST; format++) { + if (snd_pcm_hw_params_test_format(handle, params, format) == 0) + fprintf(stderr, "- %s\n", snd_pcm_format_name(format)); + } +} + +#ifdef CONFIG_SUPPORT_CHMAP +static int setup_chmap(void) +{ + snd_pcm_chmap_t *chmap = channel_map; + char mapped[hwparams.channels]; + snd_pcm_chmap_t *hw_chmap; + unsigned int ch, i; + int err; + + if (!chmap) + return 0; + + if (chmap->channels != hwparams.channels) { + error(_("Channel numbers don't match between hw_params and channel map")); + return -1; + } + err = snd_pcm_set_chmap(handle, chmap); + if (!err) + return 0; + + hw_chmap = snd_pcm_get_chmap(handle); + if (!hw_chmap) { + fprintf(stderr, _("Warning: unable to get channel map\n")); + return 0; + } + + if (hw_chmap->channels == chmap->channels && + !memcmp(hw_chmap, chmap, 4 * (chmap->channels + 1))) { + /* maps are identical, so no need to convert */ + free(hw_chmap); + return 0; + } + + hw_map = calloc(hwparams.channels, sizeof(int)); + if (!hw_map) { + error(_("not enough memory")); + free(hw_chmap); + return -1; + } + + memset(mapped, 0, sizeof(mapped)); + for (ch = 0; ch < hw_chmap->channels; ch++) { + if (chmap->pos[ch] == hw_chmap->pos[ch]) { + mapped[ch] = 1; + hw_map[ch] = ch; + continue; + } + for (i = 0; i < hw_chmap->channels; i++) { + if (!mapped[i] && chmap->pos[ch] == hw_chmap->pos[i]) { + mapped[i] = 1; + hw_map[ch] = i; + break; + } + } + if (i >= hw_chmap->channels) { + char buf[256]; + error(_("Channel %d doesn't match with hw_params"), ch); + snd_pcm_chmap_print(hw_chmap, sizeof(buf), buf); + fprintf(stderr, "hardware chmap = %s\n", buf); + free(hw_chmap); + return -1; + } + } + free(hw_chmap); + return 0; +} +#else +#define setup_chmap() 0 +#endif + +static void set_params(void) +{ + snd_pcm_hw_params_t *params; + snd_pcm_sw_params_t *swparams; + snd_pcm_uframes_t buffer_size; + int err; + size_t n; + unsigned int rate; + snd_pcm_uframes_t start_threshold, stop_threshold; + snd_pcm_hw_params_alloca(¶ms); + snd_pcm_sw_params_alloca(&swparams); + err = snd_pcm_hw_params_any(handle, params); + if (err < 0) { + error(_("Broken configuration for this PCM: no configurations available")); + prg_exit(EXIT_FAILURE); + } + if (dump_hw_params) { + fprintf(stderr, _("HW Params of device \"%s\":\n"), + snd_pcm_name(handle)); + fprintf(stderr, "--------------------\n"); + snd_pcm_hw_params_dump(params, log); + fprintf(stderr, "--------------------\n"); + } + if (mmap_flag) { + snd_pcm_access_mask_t *mask = alloca(snd_pcm_access_mask_sizeof()); + snd_pcm_access_mask_none(mask); + snd_pcm_access_mask_set(mask, SND_PCM_ACCESS_MMAP_INTERLEAVED); + snd_pcm_access_mask_set(mask, SND_PCM_ACCESS_MMAP_NONINTERLEAVED); + snd_pcm_access_mask_set(mask, SND_PCM_ACCESS_MMAP_COMPLEX); + err = snd_pcm_hw_params_set_access_mask(handle, params, mask); + } else if (interleaved) + err = snd_pcm_hw_params_set_access(handle, params, + SND_PCM_ACCESS_RW_INTERLEAVED); + else + err = snd_pcm_hw_params_set_access(handle, params, + SND_PCM_ACCESS_RW_NONINTERLEAVED); + if (err < 0) { + error(_("Access type not available")); + prg_exit(EXIT_FAILURE); + } + err = snd_pcm_hw_params_set_format(handle, params, hwparams.format); + if (err < 0) { + error(_("Sample format non available")); + show_available_sample_formats(params); + prg_exit(EXIT_FAILURE); + } + err = snd_pcm_hw_params_set_channels(handle, params, hwparams.channels); + if (err < 0) { + error(_("Channels count non available")); + prg_exit(EXIT_FAILURE); + } + +#if 0 + err = snd_pcm_hw_params_set_periods_min(handle, params, 2); + assert(err >= 0); +#endif + rate = hwparams.rate; + err = snd_pcm_hw_params_set_rate_near(handle, params, &hwparams.rate, 0); + assert(err >= 0); + if ((float)rate * 1.05 < hwparams.rate || (float)rate * 0.95 > hwparams.rate) { + if (!quiet_mode) { + char plugex[64]; + const char *pcmname = snd_pcm_name(handle); + fprintf(stderr, _("Warning: rate is not accurate (requested = %iHz, got = %iHz)\n"), rate, hwparams.rate); + if (! pcmname || strchr(snd_pcm_name(handle), ':')) + *plugex = 0; + else + snprintf(plugex, sizeof(plugex), "(-Dplug:%s)", + snd_pcm_name(handle)); + fprintf(stderr, _(" please, try the plug plugin %s\n"), + plugex); + } + } + rate = hwparams.rate; + if (buffer_time == 0 && buffer_frames == 0) { + err = snd_pcm_hw_params_get_buffer_time_max(params, + &buffer_time, 0); + assert(err >= 0); + if (buffer_time > 500000) + buffer_time = 500000; + } + if (period_time == 0 && period_frames == 0) { + if (buffer_time > 0) + period_time = buffer_time / 4; + else + period_frames = buffer_frames / 4; + } + if (period_time > 0) + err = snd_pcm_hw_params_set_period_time_near(handle, params, + &period_time, 0); + else + err = snd_pcm_hw_params_set_period_size_near(handle, params, + &period_frames, 0); + assert(err >= 0); + if (buffer_time > 0) { + err = snd_pcm_hw_params_set_buffer_time_near(handle, params, + &buffer_time, 0); + } else { + err = snd_pcm_hw_params_set_buffer_size_near(handle, params, + &buffer_frames); + } + assert(err >= 0); + monotonic = snd_pcm_hw_params_is_monotonic(params); + can_pause = snd_pcm_hw_params_can_pause(params); + err = snd_pcm_hw_params(handle, params); + if (err < 0) { + error(_("Unable to install hw params:")); + snd_pcm_hw_params_dump(params, log); + prg_exit(EXIT_FAILURE); + } + snd_pcm_hw_params_get_period_size(params, &chunk_size, 0); + snd_pcm_hw_params_get_buffer_size(params, &buffer_size); + if (chunk_size == buffer_size) { + error(_("Can't use period equal to buffer size (%lu == %lu)"), + chunk_size, buffer_size); + prg_exit(EXIT_FAILURE); + } + err = snd_pcm_sw_params_current(handle, swparams); + if (err < 0) { + error(_("Unable to get current sw params.")); + prg_exit(EXIT_FAILURE); + } + if (avail_min < 0) + n = chunk_size; + else + n = (double) rate * avail_min / 1000000; + err = snd_pcm_sw_params_set_avail_min(handle, swparams, n); + + /* round up to closest transfer boundary */ + n = buffer_size; + if (start_delay <= 0) { + start_threshold = n + (double) rate * start_delay / 1000000; + } else + start_threshold = (double) rate * start_delay / 1000000; + if (start_threshold < 1) + start_threshold = 1; + if (start_threshold > n) + start_threshold = n; + err = snd_pcm_sw_params_set_start_threshold(handle, swparams, start_threshold); + assert(err >= 0); + if (stop_delay <= 0) + stop_threshold = buffer_size + (double) rate * stop_delay / 1000000; + else + stop_threshold = (double) rate * stop_delay / 1000000; + err = snd_pcm_sw_params_set_stop_threshold(handle, swparams, stop_threshold); + assert(err >= 0); + + if (snd_pcm_sw_params(handle, swparams) < 0) { + error(_("unable to install sw params:")); + snd_pcm_sw_params_dump(swparams, log); + prg_exit(EXIT_FAILURE); + } + + if (setup_chmap()) + prg_exit(EXIT_FAILURE); + + if (verbose) + snd_pcm_dump(handle, log); + + bits_per_sample = snd_pcm_format_physical_width(hwparams.format); + significant_bits_per_sample = snd_pcm_format_width(hwparams.format); + bits_per_frame = bits_per_sample * hwparams.channels; + chunk_bytes = chunk_size * bits_per_frame / 8; + audiobuf = realloc(audiobuf, chunk_bytes); + if (audiobuf == NULL) { + error(_("not enough memory")); + prg_exit(EXIT_FAILURE); + } + // fprintf(stderr, "real chunk_size = %i, frags = %i, total = %i\n", chunk_size, setup.buf.block.frags, setup.buf.block.frags * chunk_size); + + /* stereo VU-meter isn't always available... */ + if (vumeter == VUMETER_STEREO) { + if (hwparams.channels != 2 || !interleaved || verbose > 2) + vumeter = VUMETER_MONO; + } + + /* show mmap buffer arragment */ + if (mmap_flag && verbose) { + const snd_pcm_channel_area_t *areas; + snd_pcm_uframes_t offset, size = chunk_size; + int i; + err = snd_pcm_mmap_begin(handle, &areas, &offset, &size); + if (err < 0) { + error(_("snd_pcm_mmap_begin problem: %s"), snd_strerror(err)); + prg_exit(EXIT_FAILURE); + } + for (i = 0; i < hwparams.channels; i++) + fprintf(stderr, "mmap_area[%i] = %p,%u,%u (%u)\n", i, areas[i].addr, areas[i].first, areas[i].step, snd_pcm_format_physical_width(hwparams.format)); + /* not required, but for sure */ + snd_pcm_mmap_commit(handle, offset, 0); + } + + buffer_frames = buffer_size; /* for position test */ +} + +static void init_stdin(void) +{ + struct termios term; + long flags; + + if (!interactive) + return; + if (!isatty(fileno(stdin))) { + interactive = 0; + return; + } + tcgetattr(fileno(stdin), &term); + term_c_lflag = term.c_lflag; + if (fd == fileno(stdin)) + return; + flags = fcntl(fileno(stdin), F_GETFL); + if (flags < 0 || fcntl(fileno(stdin), F_SETFL, flags|O_NONBLOCK) < 0) + fprintf(stderr, _("stdin O_NONBLOCK flag setup failed\n")); + term.c_lflag &= ~ICANON; + tcsetattr(fileno(stdin), TCSANOW, &term); +} + +static void done_stdin(void) +{ + struct termios term; + + if (!interactive) + return; + if (fd == fileno(stdin) || term_c_lflag == -1) + return; + tcgetattr(fileno(stdin), &term); + term.c_lflag = term_c_lflag; + tcsetattr(fileno(stdin), TCSANOW, &term); +} + +static void do_pause(void) +{ + int err; + unsigned char b; + + if (!can_pause) { + fprintf(stderr, _("\rPAUSE command ignored (no hw support)\n")); + return; + } + if (snd_pcm_state(handle) == SND_PCM_STATE_SUSPENDED) + suspend(); + + err = snd_pcm_pause(handle, 1); + if (err < 0) { + error(_("pause push error: %s"), snd_strerror(err)); + return; + } + while (1) { + while (read(fileno(stdin), &b, 1) != 1); + if (b == ' ' || b == '\r') { + while (read(fileno(stdin), &b, 1) == 1); + if (snd_pcm_state(handle) == SND_PCM_STATE_SUSPENDED) + suspend(); + err = snd_pcm_pause(handle, 0); + if (err < 0) + error(_("pause release error: %s"), snd_strerror(err)); + return; + } + } +} + +static void check_stdin(void) +{ + unsigned char b; + + if (!interactive) + return; + if (fd != fileno(stdin)) { + while (read(fileno(stdin), &b, 1) == 1) { + if (b == ' ' || b == '\r') { + while (read(fileno(stdin), &b, 1) == 1); + fprintf(stderr, _("\r=== PAUSE === ")); + fflush(stderr); + do_pause(); + fprintf(stderr, " \r"); + fflush(stderr); + } + } + } +} + +#ifndef timersub +#define timersub(a, b, result) \ +do { \ + (result)->tv_sec = (a)->tv_sec - (b)->tv_sec; \ + (result)->tv_usec = (a)->tv_usec - (b)->tv_usec; \ + if ((result)->tv_usec < 0) { \ + --(result)->tv_sec; \ + (result)->tv_usec += 1000000; \ + } \ +} while (0) +#endif + +#ifndef timermsub +#define timermsub(a, b, result) \ +do { \ + (result)->tv_sec = (a)->tv_sec - (b)->tv_sec; \ + (result)->tv_nsec = (a)->tv_nsec - (b)->tv_nsec; \ + if ((result)->tv_nsec < 0) { \ + --(result)->tv_sec; \ + (result)->tv_nsec += 1000000000L; \ + } \ +} while (0) +#endif + +/* I/O error handler */ +static void xrun(void) +{ + snd_pcm_status_t *status; + int res; + + snd_pcm_status_alloca(&status); + if ((res = snd_pcm_status(handle, status))<0) { + error(_("status error: %s"), snd_strerror(res)); + prg_exit(EXIT_FAILURE); + } + if (snd_pcm_status_get_state(status) == SND_PCM_STATE_XRUN) { + if (fatal_errors) { + error(_("fatal %s: %s"), + stream == SND_PCM_STREAM_PLAYBACK ? _("underrun") : _("overrun"), + snd_strerror(res)); + prg_exit(EXIT_FAILURE); + } + if (monotonic) { +#ifdef HAVE_CLOCK_GETTIME + struct timespec now, diff, tstamp; + clock_gettime(CLOCK_MONOTONIC, &now); + snd_pcm_status_get_trigger_htstamp(status, &tstamp); + timermsub(&now, &tstamp, &diff); + fprintf(stderr, _("%s!!! (at least %.3f ms long)\n"), + stream == SND_PCM_STREAM_PLAYBACK ? _("underrun") : _("overrun"), + diff.tv_sec * 1000 + diff.tv_nsec / 1000000.0); +#else + fprintf(stderr, "%s !!!\n", _("underrun")); +#endif + } else { + struct timeval now, diff, tstamp; + gettimeofday(&now, 0); + snd_pcm_status_get_trigger_tstamp(status, &tstamp); + timersub(&now, &tstamp, &diff); + fprintf(stderr, _("%s!!! (at least %.3f ms long)\n"), + stream == SND_PCM_STREAM_PLAYBACK ? _("underrun") : _("overrun"), + diff.tv_sec * 1000 + diff.tv_usec / 1000.0); + } + if (verbose) { + fprintf(stderr, _("Status:\n")); + snd_pcm_status_dump(status, log); + } + if ((res = snd_pcm_prepare(handle))<0) { + error(_("xrun: prepare error: %s"), snd_strerror(res)); + prg_exit(EXIT_FAILURE); + } + return; /* ok, data should be accepted again */ + } if (snd_pcm_status_get_state(status) == SND_PCM_STATE_DRAINING) { + if (verbose) { + fprintf(stderr, _("Status(DRAINING):\n")); + snd_pcm_status_dump(status, log); + } + if (stream == SND_PCM_STREAM_CAPTURE) { + fprintf(stderr, _("capture stream format change? attempting recover...\n")); + if ((res = snd_pcm_prepare(handle))<0) { + error(_("xrun(DRAINING): prepare error: %s"), snd_strerror(res)); + prg_exit(EXIT_FAILURE); + } + return; + } + } + if (verbose) { + fprintf(stderr, _("Status(R/W):\n")); + snd_pcm_status_dump(status, log); + } + error(_("read/write error, state = %s"), snd_pcm_state_name(snd_pcm_status_get_state(status))); + prg_exit(EXIT_FAILURE); +} + +/* I/O suspend handler */ +static void suspend(void) +{ + int res; + + if (!quiet_mode) { + fprintf(stderr, _("Suspended. Trying resume. ")); fflush(stderr); + } + while ((res = snd_pcm_resume(handle)) == -EAGAIN) + sleep(1); /* wait until suspend flag is released */ + if (res < 0) { + if (!quiet_mode) { + fprintf(stderr, _("Failed. Restarting stream. ")); fflush(stderr); + } + if ((res = snd_pcm_prepare(handle)) < 0) { + error(_("suspend: prepare error: %s"), snd_strerror(res)); + prg_exit(EXIT_FAILURE); + } + } + if (!quiet_mode) + fprintf(stderr, _("Done.\n")); +} + +static void print_vu_meter_mono(int perc, int maxperc) +{ + const int bar_length = 50; + char line[80]; + int val; + + for (val = 0; val <= perc * bar_length / 100 && val < bar_length; val++) + line[val] = '#'; + for (; val <= maxperc * bar_length / 100 && val < bar_length; val++) + line[val] = ' '; + line[val] = '+'; + for (++val; val <= bar_length; val++) + line[val] = ' '; + if (maxperc > 99) + sprintf(line + val, "| MAX"); + else + sprintf(line + val, "| %02i%%", maxperc); + fputs(line, stderr); + if (perc > 100) + fprintf(stderr, _(" !clip ")); +} + +static void print_vu_meter_stereo(int *perc, int *maxperc) +{ + const int bar_length = 35; + char line[80]; + int c; + + memset(line, ' ', sizeof(line) - 1); + line[bar_length + 3] = '|'; + + for (c = 0; c < 2; c++) { + int p = perc[c] * bar_length / 100; + char tmp[4]; + if (p > bar_length) + p = bar_length; + if (c) + memset(line + bar_length + 6 + 1, '#', p); + else + memset(line + bar_length - p - 1, '#', p); + p = maxperc[c] * bar_length / 100; + if (p > bar_length) + p = bar_length; + if (c) + line[bar_length + 6 + 1 + p] = '+'; + else + line[bar_length - p - 1] = '+'; + if (ABS(maxperc[c]) > 99) + sprintf(tmp, "MAX"); + else + sprintf(tmp, "%02d%%", maxperc[c]); + if (c) + memcpy(line + bar_length + 3 + 1, tmp, 3); + else + memcpy(line + bar_length, tmp, 3); + } + line[bar_length * 2 + 6 + 2] = 0; + fputs(line, stderr); +} + +static void print_vu_meter(signed int *perc, signed int *maxperc) +{ + if (vumeter == VUMETER_STEREO) + print_vu_meter_stereo(perc, maxperc); + else + print_vu_meter_mono(*perc, *maxperc); +} + +/* peak handler */ +static void compute_max_peak(u_char *data, size_t samples) +{ + signed int val, max, perc[2], max_peak[2]; + static int run = 0; + size_t osamples = samples; + int format_little_endian = snd_pcm_format_little_endian(hwparams.format); + int ichans, c; + + if (vumeter == VUMETER_STEREO) + ichans = 2; + else + ichans = 1; + + memset(max_peak, 0, sizeof(max_peak)); + switch (bits_per_sample) { + case 8: { + signed char *valp = (signed char *)data; + signed char mask = snd_pcm_format_silence(hwparams.format); + c = 0; + while (samples-- > 0) { + val = *valp++ ^ mask; + val = abs(val); + if (max_peak[c] < val) + max_peak[c] = val; + if (vumeter == VUMETER_STEREO) + c = !c; + } + break; + } + case 16: { + signed short *valp = (signed short *)data; + signed short mask = snd_pcm_format_silence_16(hwparams.format); + signed short sval; + + c = 0; + while (samples-- > 0) { + if (format_little_endian) + sval = le16toh(*valp); + else + sval = be16toh(*valp); + sval = abs(sval) ^ mask; + if (max_peak[c] < sval) + max_peak[c] = sval; + valp++; + if (vumeter == VUMETER_STEREO) + c = !c; + } + break; + } + case 24: { + unsigned char *valp = data; + signed int mask = snd_pcm_format_silence_32(hwparams.format); + + c = 0; + while (samples-- > 0) { + if (format_little_endian) { + val = valp[0] | (valp[1]<<8) | (valp[2]<<16); + } else { + val = (valp[0]<<16) | (valp[1]<<8) | valp[2]; + } + /* Correct signed bit in 32-bit value */ + if (val & (1<<(bits_per_sample-1))) { + val |= 0xff<<24; /* Negate upper bits too */ + } + val = abs(val) ^ mask; + if (max_peak[c] < val) + max_peak[c] = val; + valp += 3; + if (vumeter == VUMETER_STEREO) + c = !c; + } + break; + } + case 32: { + signed int *valp = (signed int *)data; + signed int mask = snd_pcm_format_silence_32(hwparams.format); + + c = 0; + while (samples-- > 0) { + if (format_little_endian) + val = le32toh(*valp); + else + val = be32toh(*valp); + val = abs(val) ^ mask; + if (max_peak[c] < val) + max_peak[c] = val; + valp++; + if (vumeter == VUMETER_STEREO) + c = !c; + } + break; + } + default: + if (run == 0) { + fprintf(stderr, _("Unsupported bit size %d.\n"), (int)bits_per_sample); + run = 1; + } + return; + } + max = 1 << (significant_bits_per_sample-1); + if (max <= 0) + max = 0x7fffffff; + + for (c = 0; c < ichans; c++) { + if (bits_per_sample > 16) + perc[c] = max_peak[c] / (max / 100); + else + perc[c] = max_peak[c] * 100 / max; + } + + if (interleaved && verbose <= 2) { + static int maxperc[2]; + static time_t t=0; + const time_t tt=time(NULL); + if(tt>t) { + t=tt; + maxperc[0] = 0; + maxperc[1] = 0; + } + for (c = 0; c < ichans; c++) + if (perc[c] > maxperc[c]) + maxperc[c] = perc[c]; + + putc('\r', stderr); + print_vu_meter(perc, maxperc); + fflush(stderr); + } + else if (verbose==3) { + fprintf(stderr, _("Max peak (%li samples): 0x%08x "), (long)osamples, max_peak[0]); + for (val = 0; val < 20; val++) + if (val <= perc[0] / 5) + putc('#', stderr); + else + putc(' ', stderr); + fprintf(stderr, " %i%%\n", perc[0]); + fflush(stderr); + } +} + +static void do_test_position(void) +{ + static long counter = 0; + static time_t tmr = -1; + time_t now; + static float availsum, delaysum, samples; + static snd_pcm_sframes_t maxavail, maxdelay; + static snd_pcm_sframes_t minavail, mindelay; + static snd_pcm_sframes_t badavail = 0, baddelay = 0; + snd_pcm_sframes_t outofrange; + snd_pcm_sframes_t avail, delay; + int err; + + err = snd_pcm_avail_delay(handle, &avail, &delay); + if (err < 0) + return; + outofrange = (test_coef * (snd_pcm_sframes_t)buffer_frames) / 2; + if (avail > outofrange || avail < -outofrange || + delay > outofrange || delay < -outofrange) { + badavail = avail; baddelay = delay; + availsum = delaysum = samples = 0; + maxavail = maxdelay = 0; + minavail = mindelay = buffer_frames * 16; + fprintf(stderr, _("Suspicious buffer position (%li total): " + "avail = %li, delay = %li, buffer = %li\n"), + ++counter, (long)avail, (long)delay, (long)buffer_frames); + } else if (verbose) { + time(&now); + if (tmr == (time_t) -1) { + tmr = now; + availsum = delaysum = samples = 0; + maxavail = maxdelay = 0; + minavail = mindelay = buffer_frames * 16; + } + if (avail > maxavail) + maxavail = avail; + if (delay > maxdelay) + maxdelay = delay; + if (avail < minavail) + minavail = avail; + if (delay < mindelay) + mindelay = delay; + availsum += avail; + delaysum += delay; + samples++; + if (avail != 0 && now != tmr) { + fprintf(stderr, "BUFPOS: avg%li/%li " + "min%li/%li max%li/%li (%li) (%li:%li/%li)\n", + (long)(availsum / samples), + (long)(delaysum / samples), + (long)minavail, (long)mindelay, + (long)maxavail, (long)maxdelay, + (long)buffer_frames, + counter, badavail, baddelay); + tmr = now; + } + } +} + +/* + */ +#ifdef CONFIG_SUPPORT_CHMAP +static u_char *remap_data(u_char *data, size_t count) +{ + static u_char *tmp, *src, *dst; + static size_t tmp_size; + size_t sample_bytes = bits_per_sample / 8; + size_t step = bits_per_frame / 8; + size_t chunk_bytes; + unsigned int ch, i; + + if (!hw_map) + return data; + + chunk_bytes = count * bits_per_frame / 8; + if (tmp_size < chunk_bytes) { + free(tmp); + tmp = malloc(chunk_bytes); + if (!tmp) { + error(_("not enough memory")); + exit(1); + } + tmp_size = count; + } + + src = data; + dst = tmp; + for (i = 0; i < count; i++) { + for (ch = 0; ch < hwparams.channels; ch++) { + memcpy(dst, src + sample_bytes * hw_map[ch], + sample_bytes); + dst += sample_bytes; + } + src += step; + } + return tmp; +} + +static u_char **remap_datav(u_char **data, size_t count) +{ + static u_char **tmp; + unsigned int ch; + + if (!hw_map) + return data; + + if (!tmp) { + tmp = malloc(sizeof(*tmp) * hwparams.channels); + if (!tmp) { + error(_("not enough memory")); + exit(1); + } + for (ch = 0; ch < hwparams.channels; ch++) + tmp[ch] = data[hw_map[ch]]; + } + return tmp; +} +#else +#define remap_data(data, count) (data) +#define remap_datav(data, count) (data) +#endif + +/* + * write function + */ + +static ssize_t pcm_write(u_char *data, size_t count) +{ + ssize_t r; + ssize_t result = 0; + + if (count < chunk_size) { + snd_pcm_format_set_silence(hwparams.format, data + count * bits_per_frame / 8, (chunk_size - count) * hwparams.channels); + count = chunk_size; + } + data = remap_data(data, count); + while (count > 0 && !in_aborting) { + if (test_position) + do_test_position(); + check_stdin(); + r = writei_func(handle, data, count); + if (test_position) + do_test_position(); + if (r == -EAGAIN || (r >= 0 && (size_t)r < count)) { + if (!test_nowait) + snd_pcm_wait(handle, 100); + } else if (r == -EPIPE) { + xrun(); + } else if (r == -ESTRPIPE) { + suspend(); + } else if (r < 0) { + error(_("write error: %s"), snd_strerror(r)); + prg_exit(EXIT_FAILURE); + } + if (r > 0) { + if (vumeter) + compute_max_peak(data, r * hwparams.channels); + result += r; + count -= r; + data += r * bits_per_frame / 8; + } + } + return result; +} + +static ssize_t pcm_writev(u_char **data, unsigned int channels, size_t count) +{ + ssize_t r; + size_t result = 0; + + if (count != chunk_size) { + unsigned int channel; + size_t offset = count; + size_t remaining = chunk_size - count; + for (channel = 0; channel < channels; channel++) + snd_pcm_format_set_silence(hwparams.format, data[channel] + offset * bits_per_sample / 8, remaining); + count = chunk_size; + } + data = remap_datav(data, count); + while (count > 0 && !in_aborting) { + unsigned int channel; + void *bufs[channels]; + size_t offset = result; + for (channel = 0; channel < channels; channel++) + bufs[channel] = data[channel] + offset * bits_per_sample / 8; + if (test_position) + do_test_position(); + check_stdin(); + r = writen_func(handle, bufs, count); + if (test_position) + do_test_position(); + if (r == -EAGAIN || (r >= 0 && (size_t)r < count)) { + if (!test_nowait) + snd_pcm_wait(handle, 100); + } else if (r == -EPIPE) { + xrun(); + } else if (r == -ESTRPIPE) { + suspend(); + } else if (r < 0) { + error(_("writev error: %s"), snd_strerror(r)); + prg_exit(EXIT_FAILURE); + } + if (r > 0) { + if (vumeter) { + for (channel = 0; channel < channels; channel++) + compute_max_peak(data[channel], r); + } + result += r; + count -= r; + } + } + return result; +} + +/* + * read function + */ + +static ssize_t pcm_read(u_char *data, size_t rcount) +{ + ssize_t r; + size_t result = 0; + size_t count = rcount; + + if (count != chunk_size) { + count = chunk_size; + } + + while (count > 0) { + if (in_aborting) + goto abort; + if (test_position) + do_test_position(); + check_stdin(); + r = readi_func(handle, data, count); + if (test_position) + do_test_position(); + if (r == -EAGAIN || (r >= 0 && (size_t)r < count)) { + if (!test_nowait) + snd_pcm_wait(handle, 100); + } else if (r == -EPIPE) { + xrun(); + } else if (r == -ESTRPIPE) { + suspend(); + } else if (r < 0) { + error(_("read error: %s"), snd_strerror(r)); + prg_exit(EXIT_FAILURE); + } + if (r > 0) { + if (vumeter) + compute_max_peak(data, r * hwparams.channels); + result += r; + count -= r; + data += r * bits_per_frame / 8; + } + } +abort: + return rcount; +} + +static ssize_t pcm_readv(u_char **data, unsigned int channels, size_t rcount) +{ + ssize_t r; + size_t result = 0; + size_t count = rcount; + + if (count != chunk_size) { + count = chunk_size; + } + + while (count > 0) { + if (in_aborting) + goto abort; + unsigned int channel; + void *bufs[channels]; + size_t offset = result; + for (channel = 0; channel < channels; channel++) + bufs[channel] = data[channel] + offset * bits_per_sample / 8; + if (test_position) + do_test_position(); + check_stdin(); + r = readn_func(handle, bufs, count); + if (test_position) + do_test_position(); + if (r == -EAGAIN || (r >= 0 && (size_t)r < count)) { + if (!test_nowait) + snd_pcm_wait(handle, 100); + } else if (r == -EPIPE) { + xrun(); + } else if (r == -ESTRPIPE) { + suspend(); + } else if (r < 0) { + error(_("readv error: %s"), snd_strerror(r)); + prg_exit(EXIT_FAILURE); + } + if (r > 0) { + if (vumeter) { + for (channel = 0; channel < channels; channel++) + compute_max_peak(data[channel], r); + } + result += r; + count -= r; + } + } +abort: + return rcount; +} + +/* + * ok, let's play a .voc file + */ + +static ssize_t voc_pcm_write(u_char *data, size_t count) +{ + ssize_t result = count, r; + size_t size; + + while (count > 0 && !in_aborting) { + size = count; + if (size > chunk_bytes - buffer_pos) + size = chunk_bytes - buffer_pos; + memcpy(audiobuf + buffer_pos, data, size); + data += size; + count -= size; + buffer_pos += size; + if ((size_t)buffer_pos == chunk_bytes) { + if ((size_t)(r = pcm_write(audiobuf, chunk_size)) != chunk_size) + return r; + buffer_pos = 0; + } + } + return result; +} + +static void voc_write_silence(unsigned x) +{ + unsigned l; + u_char *buf; + + buf = (u_char *) malloc(chunk_bytes); + if (buf == NULL) { + error(_("can't allocate buffer for silence")); + return; /* not fatal error */ + } + snd_pcm_format_set_silence(hwparams.format, buf, chunk_size * hwparams.channels); + while (x > 0 && !in_aborting) { + l = x; + if (l > chunk_size) + l = chunk_size; + if (voc_pcm_write(buf, l) != (ssize_t)l) { + error(_("write error")); + prg_exit(EXIT_FAILURE); + } + x -= l; + } + free(buf); +} + +static void voc_pcm_flush(void) +{ + if (buffer_pos > 0) { + size_t b; + if (snd_pcm_format_set_silence(hwparams.format, audiobuf + buffer_pos, chunk_bytes - buffer_pos * 8 / bits_per_sample) < 0) + fprintf(stderr, _("voc_pcm_flush - silence error")); + b = chunk_size; + if (pcm_write(audiobuf, b) != (ssize_t)b) + error(_("voc_pcm_flush error")); + } + snd_pcm_nonblock(handle, 0); + snd_pcm_drain(handle); + snd_pcm_nonblock(handle, nonblock); +} + +static void voc_play(int fd, int ofs, char *name) +{ + int l; + VocBlockType *bp; + VocVoiceData *vd; + VocExtBlock *eb; + size_t nextblock, in_buffer; + u_char *data, *buf; + char was_extended = 0, output = 0; + u_short *sp, repeat = 0; + off64_t filepos = 0; + +#define COUNT(x) nextblock -= x; in_buffer -= x; data += x +#define COUNT1(x) in_buffer -= x; data += x + + data = buf = (u_char *)malloc(64 * 1024); + buffer_pos = 0; + if (data == NULL) { + error(_("malloc error")); + prg_exit(EXIT_FAILURE); + } + if (!quiet_mode) { + fprintf(stderr, _("Playing Creative Labs Channel file '%s'...\n"), name); + } + /* first we waste the rest of header, ugly but we don't need seek */ + while (ofs > (ssize_t)chunk_bytes) { + if ((size_t)safe_read(fd, buf, chunk_bytes) != chunk_bytes) { + error(_("read error")); + prg_exit(EXIT_FAILURE); + } + ofs -= chunk_bytes; + } + if (ofs) { + if (safe_read(fd, buf, ofs) != ofs) { + error(_("read error")); + prg_exit(EXIT_FAILURE); + } + } + hwparams.format = DEFAULT_FORMAT; + hwparams.channels = 1; + hwparams.rate = DEFAULT_SPEED; + set_params(); + + in_buffer = nextblock = 0; + while (!in_aborting) { + Fill_the_buffer: /* need this for repeat */ + if (in_buffer < 32) { + /* move the rest of buffer to pos 0 and fill the buf up */ + if (in_buffer) + memcpy(buf, data, in_buffer); + data = buf; + if ((l = safe_read(fd, buf + in_buffer, chunk_bytes - in_buffer)) > 0) + in_buffer += l; + else if (!in_buffer) { + /* the file is truncated, so simulate 'Terminator' + and reduce the datablock for safe landing */ + nextblock = buf[0] = 0; + if (l == -1) { + perror(name); + prg_exit(EXIT_FAILURE); + } + } + } + while (!nextblock) { /* this is a new block */ + if (in_buffer < sizeof(VocBlockType)) + goto __end; + bp = (VocBlockType *) data; + COUNT1(sizeof(VocBlockType)); + nextblock = VOC_DATALEN(bp); + if (output && !quiet_mode) + fprintf(stderr, "\n"); /* write /n after ASCII-out */ + output = 0; + switch (bp->type) { + case 0: +#if 0 + d_printf("Terminator\n"); +#endif + return; /* VOC-file stop */ + case 1: + vd = (VocVoiceData *) data; + COUNT1(sizeof(VocVoiceData)); + /* we need a SYNC, before we can set new SPEED, STEREO ... */ + + if (!was_extended) { + hwparams.rate = (int) (vd->tc); + hwparams.rate = 1000000 / (256 - hwparams.rate); +#if 0 + d_printf("Channel data %d Hz\n", dsp_speed); +#endif + if (vd->pack) { /* /dev/dsp can't it */ + error(_("can't play packed .voc files")); + return; + } + if (hwparams.channels == 2) /* if we are in Stereo-Mode, switch back */ + hwparams.channels = 1; + } else { /* there was extended block */ + hwparams.channels = 2; + was_extended = 0; + } + set_params(); + break; + case 2: /* nothing to do, pure data */ +#if 0 + d_printf("Channel continuation\n"); +#endif + break; + case 3: /* a silence block, no data, only a count */ + sp = (u_short *) data; + COUNT1(sizeof(u_short)); + hwparams.rate = (int) (*data); + COUNT1(1); + hwparams.rate = 1000000 / (256 - hwparams.rate); + set_params(); +#if 0 + { + size_t silence; + silence = (((size_t) * sp) * 1000) / hwparams.rate; + d_printf("Silence for %d ms\n", (int) silence); + } +#endif + voc_write_silence(*sp); + break; + case 4: /* a marker for syncronisation, no effect */ + sp = (u_short *) data; + COUNT1(sizeof(u_short)); +#if 0 + d_printf("Marker %d\n", *sp); +#endif + break; + case 5: /* ASCII text, we copy to stderr */ + output = 1; +#if 0 + d_printf("ASCII - text :\n"); +#endif + break; + case 6: /* repeat marker, says repeatcount */ + /* my specs don't say it: maybe this can be recursive, but + I don't think somebody use it */ + repeat = *(u_short *) data; + COUNT1(sizeof(u_short)); +#if 0 + d_printf("Repeat loop %d times\n", repeat); +#endif + if (filepos >= 0) { /* if < 0, one seek fails, why test another */ + if ((filepos = lseek64(fd, 0, 1)) < 0) { + error(_("can't play loops; %s isn't seekable\n"), name); + repeat = 0; + } else { + filepos -= in_buffer; /* set filepos after repeat */ + } + } else { + repeat = 0; + } + break; + case 7: /* ok, lets repeat that be rewinding tape */ + if (repeat) { + if (repeat != 0xFFFF) { +#if 0 + d_printf("Repeat loop %d\n", repeat); +#endif + --repeat; + } +#if 0 + else + d_printf("Neverending loop\n"); +#endif + lseek64(fd, filepos, 0); + in_buffer = 0; /* clear the buffer */ + goto Fill_the_buffer; + } +#if 0 + else + d_printf("End repeat loop\n"); +#endif + break; + case 8: /* the extension to play Stereo, I have SB 1.0 :-( */ + was_extended = 1; + eb = (VocExtBlock *) data; + COUNT1(sizeof(VocExtBlock)); + hwparams.rate = (int) (eb->tc); + hwparams.rate = 256000000L / (65536 - hwparams.rate); + hwparams.channels = eb->mode == VOC_MODE_STEREO ? 2 : 1; + if (hwparams.channels == 2) + hwparams.rate = hwparams.rate >> 1; + if (eb->pack) { /* /dev/dsp can't it */ + error(_("can't play packed .voc files")); + return; + } +#if 0 + d_printf("Extended block %s %d Hz\n", + (eb->mode ? "Stereo" : "Mono"), dsp_speed); +#endif + break; + default: + error(_("unknown blocktype %d. terminate."), bp->type); + return; + } /* switch (bp->type) */ + } /* while (! nextblock) */ + /* put nextblock data bytes to dsp */ + l = in_buffer; + if (nextblock < (size_t)l) + l = nextblock; + if (l) { + if (output && !quiet_mode) { + if (xwrite(2, data, l) != l) { /* to stderr */ + error(_("write error")); + prg_exit(EXIT_FAILURE); + } + } else { + if (voc_pcm_write(data, l) != l) { + error(_("write error")); + prg_exit(EXIT_FAILURE); + } + } + COUNT(l); + } + } /* while(1) */ + __end: + voc_pcm_flush(); + free(buf); +} +/* that was a big one, perhaps somebody split it :-) */ + +/* setting the globals for playing raw data */ +static void init_raw_data(void) +{ + hwparams = rhwparams; +} + +/* calculate the data count to read from/to dsp */ +static off64_t calc_count(void) +{ + off64_t count; + + if (timelimit == 0) + if (sampleslimit == 0) + count = pbrec_count; + else + count = snd_pcm_format_size(hwparams.format, sampleslimit * hwparams.channels); + else { + count = snd_pcm_format_size(hwparams.format, hwparams.rate * hwparams.channels); + count *= (off64_t)timelimit; + } + return count < pbrec_count ? count : pbrec_count; +} + +/* write a .VOC-header */ +static void begin_voc(int fd, size_t cnt) +{ + VocHeader vh; + VocBlockType bt; + VocVoiceData vd; + VocExtBlock eb; + + memcpy(vh.magic, VOC_MAGIC_STRING, 20); + vh.headerlen = LE_SHORT(sizeof(VocHeader)); + vh.version = LE_SHORT(VOC_ACTUAL_VERSION); + vh.coded_ver = LE_SHORT(0x1233 - VOC_ACTUAL_VERSION); + + if (xwrite(fd, &vh, sizeof(VocHeader)) != sizeof(VocHeader)) { + error(_("write error")); + prg_exit(EXIT_FAILURE); + } + if (hwparams.channels > 1) { + /* write an extended block */ + bt.type = 8; + bt.datalen = 4; + bt.datalen_m = bt.datalen_h = 0; + if (xwrite(fd, &bt, sizeof(VocBlockType)) != sizeof(VocBlockType)) { + error(_("write error")); + prg_exit(EXIT_FAILURE); + } + eb.tc = LE_SHORT(65536 - 256000000L / (hwparams.rate << 1)); + eb.pack = 0; + eb.mode = 1; + if (xwrite(fd, &eb, sizeof(VocExtBlock)) != sizeof(VocExtBlock)) { + error(_("write error")); + prg_exit(EXIT_FAILURE); + } + } + bt.type = 1; + cnt += sizeof(VocVoiceData); /* Channel_data block follows */ + bt.datalen = (u_char) (cnt & 0xFF); + bt.datalen_m = (u_char) ((cnt & 0xFF00) >> 8); + bt.datalen_h = (u_char) ((cnt & 0xFF0000) >> 16); + if (xwrite(fd, &bt, sizeof(VocBlockType)) != sizeof(VocBlockType)) { + error(_("write error")); + prg_exit(EXIT_FAILURE); + } + vd.tc = (u_char) (256 - (1000000 / hwparams.rate)); + vd.pack = 0; + if (xwrite(fd, &vd, sizeof(VocVoiceData)) != sizeof(VocVoiceData)) { + error(_("write error")); + prg_exit(EXIT_FAILURE); + } +} + +/* write a WAVE-header */ +static void begin_wave(int fd, size_t cnt) +{ + WaveHeader h; + WaveFmtBody f; + WaveChunkHeader cf, cd; + int bits; + u_int tmp; + u_short tmp2; + + /* WAVE cannot handle greater than 32bit (signed?) int */ + if (cnt == (size_t)-2) + cnt = 0x7fffff00; + + bits = 8; + switch ((unsigned long) hwparams.format) { + case SND_PCM_FORMAT_U8: + bits = 8; + break; + case SND_PCM_FORMAT_S16_LE: + bits = 16; + break; + case SND_PCM_FORMAT_S32_LE: + case SND_PCM_FORMAT_FLOAT_LE: + bits = 32; + break; + case SND_PCM_FORMAT_S24_LE: + case SND_PCM_FORMAT_S24_3LE: + bits = 24; + break; + default: + error(_("Wave doesn't support %s format..."), snd_pcm_format_name(hwparams.format)); + prg_exit(EXIT_FAILURE); + } + h.magic = WAV_RIFF; + tmp = cnt + sizeof(WaveHeader) + sizeof(WaveChunkHeader) + sizeof(WaveFmtBody) + sizeof(WaveChunkHeader) - 8; + h.length = LE_INT(tmp); + h.type = WAV_WAVE; + + cf.type = WAV_FMT; + cf.length = LE_INT(16); + + if (hwparams.format == SND_PCM_FORMAT_FLOAT_LE) + f.format = LE_SHORT(WAV_FMT_IEEE_FLOAT); + else + f.format = LE_SHORT(WAV_FMT_PCM); + f.channels = LE_SHORT(hwparams.channels); + f.sample_fq = LE_INT(hwparams.rate); +#if 0 + tmp2 = (samplesize == 8) ? 1 : 2; + f.byte_p_spl = LE_SHORT(tmp2); + tmp = dsp_speed * hwparams.channels * (u_int) tmp2; +#else + tmp2 = hwparams.channels * snd_pcm_format_physical_width(hwparams.format) / 8; + f.byte_p_spl = LE_SHORT(tmp2); + tmp = (u_int) tmp2 * hwparams.rate; +#endif + f.byte_p_sec = LE_INT(tmp); + f.bit_p_spl = LE_SHORT(bits); + + cd.type = WAV_DATA; + cd.length = LE_INT(cnt); + + if (xwrite(fd, &h, sizeof(WaveHeader)) != sizeof(WaveHeader) || + xwrite(fd, &cf, sizeof(WaveChunkHeader)) != sizeof(WaveChunkHeader) || + xwrite(fd, &f, sizeof(WaveFmtBody)) != sizeof(WaveFmtBody) || + xwrite(fd, &cd, sizeof(WaveChunkHeader)) != sizeof(WaveChunkHeader)) { + error(_("write error")); + prg_exit(EXIT_FAILURE); + } +} + +/* write a Au-header */ +static void begin_au(int fd, size_t cnt) +{ + AuHeader ah; + + ah.magic = AU_MAGIC; + ah.hdr_size = BE_INT(24); + ah.data_size = BE_INT(cnt); + switch ((unsigned long) hwparams.format) { + case SND_PCM_FORMAT_MU_LAW: + ah.encoding = BE_INT(AU_FMT_ULAW); + break; + case SND_PCM_FORMAT_U8: + ah.encoding = BE_INT(AU_FMT_LIN8); + break; + case SND_PCM_FORMAT_S16_BE: + ah.encoding = BE_INT(AU_FMT_LIN16); + break; + default: + error(_("Sparc Audio doesn't support %s format..."), snd_pcm_format_name(hwparams.format)); + prg_exit(EXIT_FAILURE); + } + ah.sample_rate = BE_INT(hwparams.rate); + ah.channels = BE_INT(hwparams.channels); + if (xwrite(fd, &ah, sizeof(AuHeader)) != sizeof(AuHeader)) { + error(_("write error")); + prg_exit(EXIT_FAILURE); + } +} + +/* closing .VOC */ +static void end_voc(int fd) +{ + off64_t length_seek; + VocBlockType bt; + size_t cnt; + char dummy = 0; /* Write a Terminator */ + + if (xwrite(fd, &dummy, 1) != 1) { + error(_("write error")); + prg_exit(EXIT_FAILURE); + } + length_seek = sizeof(VocHeader); + if (hwparams.channels > 1) + length_seek += sizeof(VocBlockType) + sizeof(VocExtBlock); + bt.type = 1; + cnt = fdcount; + cnt += sizeof(VocVoiceData); /* Channel_data block follows */ + if (cnt > 0x00ffffff) + cnt = 0x00ffffff; + bt.datalen = (u_char) (cnt & 0xFF); + bt.datalen_m = (u_char) ((cnt & 0xFF00) >> 8); + bt.datalen_h = (u_char) ((cnt & 0xFF0000) >> 16); + if (lseek64(fd, length_seek, SEEK_SET) == length_seek) + xwrite(fd, &bt, sizeof(VocBlockType)); +} + +static void end_wave(int fd) +{ /* only close output */ + WaveChunkHeader cd; + off64_t length_seek; + off64_t filelen; + u_int rifflen; + + length_seek = sizeof(WaveHeader) + + sizeof(WaveChunkHeader) + + sizeof(WaveFmtBody); + cd.type = WAV_DATA; + cd.length = fdcount > 0x7fffffff ? LE_INT(0x7fffffff) : LE_INT(fdcount); + filelen = fdcount + 2*sizeof(WaveChunkHeader) + sizeof(WaveFmtBody) + 4; + rifflen = filelen > 0x7fffffff ? LE_INT(0x7fffffff) : LE_INT(filelen); + if (lseek64(fd, 4, SEEK_SET) == 4) + xwrite(fd, &rifflen, 4); + if (lseek64(fd, length_seek, SEEK_SET) == length_seek) + xwrite(fd, &cd, sizeof(WaveChunkHeader)); +} + +static void end_au(int fd) +{ /* only close output */ + AuHeader ah; + off64_t length_seek; + + length_seek = (char *)&ah.data_size - (char *)&ah; + ah.data_size = fdcount > 0xffffffff ? 0xffffffff : BE_INT(fdcount); + if (lseek64(fd, length_seek, SEEK_SET) == length_seek) + xwrite(fd, &ah.data_size, sizeof(ah.data_size)); +} + +static void header(int rtype, char *name) +{ + if (!quiet_mode) { + if (! name) + name = (stream == SND_PCM_STREAM_PLAYBACK) ? "stdout" : "stdin"; + fprintf(stderr, "%s %s '%s' : ", + (stream == SND_PCM_STREAM_PLAYBACK) ? _("Playing") : _("Recording"), + gettext(fmt_rec_table[rtype].what), + name); + fprintf(stderr, "%s, ", snd_pcm_format_description(hwparams.format)); + fprintf(stderr, _("Rate %d Hz, "), hwparams.rate); + if (hwparams.channels == 1) + fprintf(stderr, _("Mono")); + else if (hwparams.channels == 2) + fprintf(stderr, _("Stereo")); + else + fprintf(stderr, _("Channels %i"), hwparams.channels); + fprintf(stderr, "\n"); + } +} + +/* playing raw data */ + +static void playback_go(int fd, size_t loaded, off64_t count, int rtype, char *name) +{ + int l, r; + off64_t written = 0; + off64_t c; + + header(rtype, name); + set_params(); + + while (loaded > chunk_bytes && written < count && !in_aborting) { + if (pcm_write(audiobuf + written, chunk_size) <= 0) + return; + written += chunk_bytes; + loaded -= chunk_bytes; + } + if (written > 0 && loaded > 0) + memmove(audiobuf, audiobuf + written, loaded); + + l = loaded; + while (written < count && !in_aborting) { + do { + c = count - written; + if (c > chunk_bytes) + c = chunk_bytes; + + /* c < l, there is more data loaded + * then we actually need to write + */ + if (c < l) + l = c; + + c -= l; + + if (c == 0) + break; + r = safe_read(fd, audiobuf + l, c); + if (r < 0) { + perror(name); + prg_exit(EXIT_FAILURE); + } + fdcount += r; + if (r == 0) + break; + l += r; + } while ((size_t)l < chunk_bytes); + l = l * 8 / bits_per_frame; + r = pcm_write(audiobuf, l); + if (r != l) + break; + r = r * bits_per_frame / 8; + written += r; + l = 0; + } + snd_pcm_nonblock(handle, 0); + snd_pcm_drain(handle); + snd_pcm_nonblock(handle, nonblock); +} + +static int read_header(int *loaded, int header_size) +{ + int ret; + struct stat buf; + + ret = fstat(fd, &buf); + if (ret < 0) { + perror("fstat"); + prg_exit(EXIT_FAILURE); + } + + /* don't be adventurous, get out if file size is smaller than + * requested header size */ + if ((buf.st_mode & S_IFMT) == S_IFREG && + buf.st_size < header_size) + return -1; + + if (*loaded < header_size) { + header_size -= *loaded; + ret = safe_read(fd, audiobuf + *loaded, header_size); + if (ret != header_size) { + error(_("read error")); + prg_exit(EXIT_FAILURE); + } + *loaded += header_size; + } + return 0; +} + +static int playback_au(char *name, int *loaded) +{ + if (read_header(loaded, sizeof(AuHeader)) < 0) + return -1; + + if (test_au(fd, audiobuf) < 0) + return -1; + + rhwparams.format = hwparams.format; + pbrec_count = calc_count(); + playback_go(fd, *loaded - sizeof(AuHeader), pbrec_count, FORMAT_AU, name); + + return 0; +} + +static int playback_voc(char *name, int *loaded) +{ + int ofs; + + if (read_header(loaded, sizeof(VocHeader)) < 0) + return -1; + + if ((ofs = test_vocfile(audiobuf)) < 0) + return -1; + + pbrec_count = calc_count(); + voc_play(fd, ofs, name); + + return 0; +} + +static int playback_wave(char *name, int *loaded) +{ + ssize_t dtawave; + + if (read_header(loaded, sizeof(WaveHeader)) < 0) + return -1; + + if ((dtawave = test_wavefile(fd, audiobuf, *loaded)) < 0) + return -1; + + pbrec_count = calc_count(); + playback_go(fd, dtawave, pbrec_count, FORMAT_WAVE, name); + + return 0; +} + +static int playback_raw(char *name, int *loaded) +{ + init_raw_data(); + pbrec_count = calc_count(); + playback_go(fd, *loaded, pbrec_count, FORMAT_RAW, name); + + return 0; +} + +/* + * let's play or capture it (capture_type says VOC/WAVE/raw) + */ + +static void playback(char *name) +{ + int loaded = 0; + + pbrec_count = LLONG_MAX; + fdcount = 0; + if (!name || !strcmp(name, "-")) { + fd = fileno(stdin); + name = "stdin"; + } else { + init_stdin(); + if ((fd = open(name, O_RDONLY, 0)) == -1) { + perror(name); + prg_exit(EXIT_FAILURE); + } + } + + switch(file_type) { + case FORMAT_AU: + playback_au(name, &loaded); + break; + case FORMAT_VOC: + playback_voc(name, &loaded); + break; + case FORMAT_WAVE: + playback_wave(name, &loaded); + break; + case FORMAT_RAW: + playback_raw(name, &loaded); + break; + default: + /* parse the file header */ + if (playback_au(name, &loaded) < 0 && + playback_voc(name, &loaded) < 0 && + playback_wave(name, &loaded) < 0) + playback_raw(name, &loaded); /* should be raw data */ + break; + } + + if (fd != fileno(stdin)) + close(fd); +} + +/** + * mystrftime + * + * Variant of strftime(3) that supports additional format + * specifiers in the format string. + * + * Parameters: + * + * s - destination string + * max - max number of bytes to write + * userformat - format string + * tm - time information + * filenumber - the number of the file, starting at 1 + * + * Returns: number of bytes written to the string s + */ +size_t mystrftime(char *s, size_t max, const char *userformat, + const struct tm *tm, const int filenumber) +{ + char formatstring[PATH_MAX] = ""; + char tempstring[PATH_MAX] = ""; + char *format, *tempstr; + const char *pos_userformat; + + format = formatstring; + + /* if mystrftime is called with userformat = NULL we return a zero length string */ + if (userformat == NULL) { + *s = '\0'; + return 0; + } + + for (pos_userformat = userformat; *pos_userformat; ++pos_userformat) { + if (*pos_userformat == '%') { + tempstr = tempstring; + tempstr[0] = '\0'; + switch (*++pos_userformat) { + + case '\0': // end of string + --pos_userformat; + break; + + case 'v': // file number + sprintf(tempstr, "%02d", filenumber); + break; + + default: // All other codes will be handled by strftime + *format++ = '%'; + *format++ = *pos_userformat; + continue; + } + + /* If a format specifier was found and used, copy the result. */ + if (tempstr[0]) { + while ((*format = *tempstr++) != '\0') + ++format; + continue; + } + } + + /* For any other character than % we simply copy the character */ + *format++ = *pos_userformat; + } + + *format = '\0'; + format = formatstring; + return strftime(s, max, format, tm); +} + +static int new_capture_file(char *name, char *namebuf, size_t namelen, + int filecount) +{ + char *s; + char buf[PATH_MAX-10]; + time_t t; + struct tm *tmp; + + if (use_strftime) { + t = time(NULL); + tmp = localtime(&t); + if (tmp == NULL) { + perror("localtime"); + prg_exit(EXIT_FAILURE); + } + if (mystrftime(namebuf, namelen, name, tmp, filecount+1) == 0) { + fprintf(stderr, "mystrftime returned 0"); + prg_exit(EXIT_FAILURE); + } + return filecount; + } + + /* get a copy of the original filename */ + strncpy(buf, name, sizeof(buf)); + buf[sizeof(buf)-1] = '\0'; + + /* separate extension from filename */ + s = buf + strlen(buf); + while (s > buf && *s != '.' && *s != '/') + --s; + if (*s == '.') + *s++ = 0; + else if (*s == '/') + s = buf + strlen(buf); + + /* upon first jump to this if block rename the first file */ + if (filecount == 1) { + if (*s) + snprintf(namebuf, namelen, "%s-01.%s", buf, s); + else + snprintf(namebuf, namelen, "%s-01", buf); + remove(namebuf); + rename(name, namebuf); + filecount = 2; + } + + /* name of the current file */ + if (*s) + snprintf(namebuf, namelen, "%s-%02i.%s", buf, filecount, s); + else + snprintf(namebuf, namelen, "%s-%02i", buf, filecount); + + return filecount; +} + +/** + * create_path + * + * This function creates a file path, like mkdir -p. + * + * Parameters: + * + * path - the path to create + * + * Returns: 0 on success, -1 on failure + * On failure, a message has been printed to stderr. + */ +int create_path(const char *path) +{ + char *start; + mode_t mode = S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH; + + if (path[0] == '/') + start = strchr(path + 1, '/'); + else + start = strchr(path, '/'); + + while (start) { + char *buffer = strdup(path); + buffer[start-path] = 0x00; + + if (mkdir(buffer, mode) == -1 && errno != EEXIST) { + fprintf(stderr, "Problem creating directory %s", buffer); + perror(" "); + free(buffer); + return -1; + } + free(buffer); + start = strchr(start + 1, '/'); + } + return 0; +} + +static int safe_open(const char *name) +{ + int fd; + + fd = open(name, O_WRONLY | O_CREAT, 0644); + if (fd == -1) { + if (errno != ENOENT || !use_strftime) + return -1; + if (create_path(name) == 0) + fd = open(name, O_WRONLY | O_CREAT, 0644); + } + return fd; +} + +static void capture(char *orig_name) +{ + int tostdout=0; /* boolean which describes output stream */ + int filecount=0; /* number of files written */ + char *name = orig_name; /* current filename */ + char namebuf[PATH_MAX+2]; + off64_t count, rest; /* number of bytes to capture */ + struct stat statbuf; + + /* get number of bytes to capture */ + count = calc_count(); + if (count == 0) + count = LLONG_MAX; + /* compute the number of bytes per file */ + max_file_size = (long long) max_file_time * + snd_pcm_format_size(hwparams.format, + hwparams.rate * hwparams.channels); + /* WAVE-file should be even (I'm not sure), but wasting one byte + isn't a problem (this can only be in 8 bit mono) */ + if (count < LLONG_MAX) + count += count % 2; + else + count -= count % 2; + + /* display verbose output to console */ + header(file_type, name); + + /* setup sound hardware */ + set_params(); + + /* write to stdout? */ + if (!name || !strcmp(name, "-")) { + fd = fileno(stdout); + name = "stdout"; + tostdout = 1; + if (count > fmt_rec_table[file_type].max_filesize) + count = fmt_rec_table[file_type].max_filesize; + } + init_stdin(); + + do { + /* open a file to write */ + if (!tostdout) { + /* upon the second file we start the numbering scheme */ + if (filecount || use_strftime) { + filecount = new_capture_file(orig_name, namebuf, + sizeof(namebuf), + filecount); + name = namebuf; + } + + /* open a new file */ + if (!lstat(name, &statbuf)) { + if (S_ISREG(statbuf.st_mode)) + remove(name); + } + fd = safe_open(name); + if (fd < 0) { + perror(name); + prg_exit(EXIT_FAILURE); + } + filecount++; + } + + rest = count; + if (rest > fmt_rec_table[file_type].max_filesize) + rest = fmt_rec_table[file_type].max_filesize; + if (max_file_size && (rest > max_file_size)) + rest = max_file_size; + + /* setup sample header */ + if (fmt_rec_table[file_type].start) + fmt_rec_table[file_type].start(fd, rest); + + /* capture */ + fdcount = 0; + while (rest > 0 && recycle_capture_file == 0 && !in_aborting) { + size_t c = (rest <= (off64_t)chunk_bytes) ? + (size_t)rest : chunk_bytes; + size_t f = c * 8 / bits_per_frame; + size_t read = pcm_read(audiobuf, f); + size_t save; + if (read != f) + in_aborting = 1; + save = read * bits_per_frame / 8; + if (xwrite(fd, audiobuf, save) != save) { + perror(name); + in_aborting = 1; + break; + } + count -= c; + rest -= c; + fdcount += c; + } + + /* re-enable SIGUSR1 signal */ + if (recycle_capture_file) { + recycle_capture_file = 0; + signal(SIGUSR1, signal_handler_recycle); + } + + /* finish sample container */ + if (!tostdout) { + if (fmt_rec_table[file_type].end) + fmt_rec_table[file_type].end(fd); + close(fd); + fd = -1; + } + + if (in_aborting) + prg_exit(EXIT_FAILURE); + + /* repeat the loop when format is raw without timelimit or + * requested counts of data are recorded + */ + } while ((file_type == FORMAT_RAW && !timelimit && !sampleslimit) || count > 0); +} + +static void playbackv_go(int* fds, unsigned int channels, size_t loaded, off64_t count, int rtype, char **names) +{ + int r; + size_t vsize; + + unsigned int channel; + u_char *bufs[channels]; + + header(rtype, names[0]); + set_params(); + + vsize = chunk_bytes / channels; + + // Not yet implemented + assert(loaded == 0); + + for (channel = 0; channel < channels; ++channel) + bufs[channel] = audiobuf + vsize * channel; + + while (count > 0 && !in_aborting) { + size_t c = 0; + size_t expected = count / channels; + if (expected > vsize) + expected = vsize; + do { + r = safe_read(fds[0], bufs[0], expected); + if (r < 0) { + perror(names[channel]); + prg_exit(EXIT_FAILURE); + } + for (channel = 1; channel < channels; ++channel) { + if (safe_read(fds[channel], bufs[channel], r) != r) { + perror(names[channel]); + prg_exit(EXIT_FAILURE); + } + } + if (r == 0) + break; + c += r; + } while (c < expected); + c = c * 8 / bits_per_sample; + r = pcm_writev(bufs, channels, c); + if ((size_t)r != c) + break; + r = r * bits_per_frame / 8; + count -= r; + } + snd_pcm_nonblock(handle, 0); + snd_pcm_drain(handle); + snd_pcm_nonblock(handle, nonblock); +} + +static void capturev_go(int* fds, unsigned int channels, off64_t count, int rtype, char **names) +{ + size_t c; + ssize_t r; + unsigned int channel; + size_t vsize; + u_char *bufs[channels]; + + header(rtype, names[0]); + set_params(); + + vsize = chunk_bytes / channels; + + for (channel = 0; channel < channels; ++channel) + bufs[channel] = audiobuf + vsize * channel; + + while (count > 0 && !in_aborting) { + size_t rv; + c = count; + if (c > chunk_bytes) + c = chunk_bytes; + c = c * 8 / bits_per_frame; + if ((size_t)(r = pcm_readv(bufs, channels, c)) != c) + break; + rv = r * bits_per_sample / 8; + for (channel = 0; channel < channels; ++channel) { + if ((size_t)xwrite(fds[channel], bufs[channel], rv) != rv) { + perror(names[channel]); + prg_exit(EXIT_FAILURE); + } + } + r = r * bits_per_frame / 8; + count -= r; + fdcount += r; + } +} + +static void playbackv(char **names, unsigned int count) +{ + int ret = 0; + unsigned int channel; + unsigned int channels = rhwparams.channels; + int alloced = 0; + int fds[channels]; + for (channel = 0; channel < channels; ++channel) + fds[channel] = -1; + + if (count == 1 && channels > 1) { + size_t len = strlen(names[0]); + char format[1024]; + memcpy(format, names[0], len); + strcpy(format + len, ".%d"); + len += 4; + names = malloc(sizeof(*names) * channels); + for (channel = 0; channel < channels; ++channel) { + names[channel] = malloc(len); + sprintf(names[channel], format, channel); + } + alloced = 1; + } else if (count != channels) { + error(_("You need to specify %u files"), channels); + prg_exit(EXIT_FAILURE); + } + + for (channel = 0; channel < channels; ++channel) { + fds[channel] = open(names[channel], O_RDONLY, 0); + if (fds[channel] < 0) { + perror(names[channel]); + ret = EXIT_FAILURE; + goto __end; + } + } + /* should be raw data */ + init_raw_data(); + pbrec_count = calc_count(); + playbackv_go(fds, channels, 0, pbrec_count, FORMAT_RAW, names); + + __end: + for (channel = 0; channel < channels; ++channel) { + if (fds[channel] >= 0) + close(fds[channel]); + if (alloced) + free(names[channel]); + } + if (alloced) + free(names); + if (ret) + prg_exit(ret); +} + +static void capturev(char **names, unsigned int count) +{ + int ret = 0; + unsigned int channel; + unsigned int channels = rhwparams.channels; + int alloced = 0; + int fds[channels]; + for (channel = 0; channel < channels; ++channel) + fds[channel] = -1; + + if (count == 1) { + size_t len = strlen(names[0]); + char format[1024]; + memcpy(format, names[0], len); + strcpy(format + len, ".%d"); + len += 4; + names = malloc(sizeof(*names) * channels); + for (channel = 0; channel < channels; ++channel) { + names[channel] = malloc(len); + sprintf(names[channel], format, channel); + } + alloced = 1; + } else if (count != channels) { + error(_("You need to specify %d files"), channels); + prg_exit(EXIT_FAILURE); + } + + for (channel = 0; channel < channels; ++channel) { + fds[channel] = open(names[channel], O_WRONLY + O_CREAT, 0644); + if (fds[channel] < 0) { + perror(names[channel]); + ret = EXIT_FAILURE; + goto __end; + } + } + /* should be raw data */ + init_raw_data(); + pbrec_count = calc_count(); + capturev_go(fds, channels, pbrec_count, FORMAT_RAW, names); + + __end: + for (channel = 0; channel < channels; ++channel) { + if (fds[channel] >= 0) + close(fds[channel]); + if (alloced) + free(names[channel]); + } + if (alloced) + free(names); + if (ret) + prg_exit(ret); +} diff --git a/aplay/arecord.1 b/aplay/arecord.1 new file mode 100644 index 0000000..3bba59d --- /dev/null +++ b/aplay/arecord.1 @@ -0,0 +1,267 @@ +.TH APLAY 1 "1 January 2010" +.SH NAME +arecord, aplay \- command\-line sound recorder and player for ALSA +soundcard driver +.SH SYNOPSIS +\fBarecord\fP [\fIflags\fP] [filename] +.br +\fBaplay\fP [\fIflags\fP] [filename [filename]] ... + +.SH DESCRIPTION +\fBarecord\fP is a command\-line soundfile recorder for the ALSA soundcard +driver. It supports several file formats and multiple soundcards with +multiple devices. If recording with interleaved mode samples the file is +automatically split before the 2GB filesize. + +\fBaplay\fP is much the same, only it plays instead of recording. For +supported soundfile formats, the sampling rate, bit depth, and so +forth can be automatically determined from the soundfile header. + +If filename is not specified, the standard output or input is used. The \fBaplay\fP utility accepts multiple filenames. + +.SH OPTIONS +.TP +\fI\-h, \-\-help\fP +Help: show syntax. +.TP +\fI\-\-version\fP +Print current version. +.TP +\fI\-l, \-\-list\-devices\fP +List all soundcards and digital audio devices +.TP +\fI\-L, \-\-list\-pcms\fP +List all PCMs defined +.TP +\fI\-D, \-\-device=NAME\fP +Select PCM by name +.TP +\fI\-q \-\-quiet\fP +Quiet mode. Suppress messages (not sound :)) +.TP +\fI\-t, \-\-file\-type TYPE\fP +File type (voc, wav, raw or au). +If this parameter is omitted the WAVE format is used. +.TP +\fI\-c, \-\-channels=#\fP +The number of channels. +The default is one channel. +Valid values are 1 through 32. +.TP +\fI\-f \-\-format=FORMAT\fP +Sample format +.br +Recognized sample formats are: S8 U8 S16_LE S16_BE U16_LE U16_BE S24_LE +S24_BE U24_LE U24_BE S32_LE S32_BE U32_LE U32_BE FLOAT_LE FLOAT_BE +FLOAT64_LE FLOAT64_BE IEC958_SUBFRAME_LE IEC958_SUBFRAME_BE MU_LAW +A_LAW IMA_ADPCM MPEG GSM SPECIAL S24_3LE S24_3BE U24_3LE U24_3BE S20_3LE +S20_3BE U20_3LE U20_3BE S18_3LE S18_3BE U18_3LE +.br +Some of these may not be available on selected hardware +.br +The available format shortcuts are: +.nf +\-f cd (16 bit little endian, 44100, stereo) [\-f S16_LE \-c2 \-r44100] +\-f cdr (16 bit big endian, 44100, stereo) [\-f S16_BE \-c2 \-r44100] +\-f dat (16 bit little endian, 48000, stereo) [\-f S16_LE \-c2 \-r48000] +.fi +If no format is given U8 is used. +.TP +\fI\-r, \-\-rate=#\fP +Sampling rate in Hertz. The default rate is 8000 Hertz. +If the value specified is less than 300, it is taken as the rate in kilohertz. +Valid values are 2000 through 192000 Hertz. +.TP +\fI\-d, \-\-duration=#\fP +Interrupt after # seconds. +A value of zero means infinity. +The default is zero, so if this option is omitted then the record/playback process will run until it is killed. +Either '-d' or '-s' option is available exclusively. +.TP +\fI\-s, \-\-samples=#\fP +Interrupt after transmission of # PCM frames. +A value of zero means infinity. +The default is zero, so if this options is omitted then the record/playback process will run until it is killed. +Either '-d' or '-s' option is available exclusively. +.TP +\fI\-M, \-\-mmap\fP +Use memory\-mapped (mmap) I/O mode for the audio stream. +If this option is not set, the read/write I/O mode will be used. +.TP +\fI\-N, \-\-nonblock\fP +Open the audio device in non\-blocking mode. If the device is busy the program will exit immediately. +If this option is not set the program will block until the audio device is available again. +.TP +\fI\-F, \-\-period\-time=#\fP +Distance between interrupts is # microseconds. +If no period time and no period size is given then a quarter of the buffer time is set. +.TP +\fI\-B, \-\-buffer\-time=#\fP +Buffer duration is # microseconds +If no buffer time and no buffer size is given then the maximal allowed buffer time but not more than 500ms is set. +.TP +\fI\-\-period\-size=#\fP +Distance between interrupts is # frames +If no period size and no period time is given then a quarter of the buffer size is set. +.TP +\fI\-\-buffer\-size=#\fP +Buffer duration is # frames +If no buffer time and no buffer size is given then the maximal allowed buffer time but not more than 500ms is set. +.TP +\fI\-A, \-\-avail\-min=#\fP +Min available space for wakeup is # microseconds +.TP +\fI\-R, \-\-start\-delay=#\fP +Delay for automatic PCM start is # microseconds +(relative to buffer size if <= 0) +.TP +\fI\-T, \-\-stop\-delay=#\fP +Delay for automatic PCM stop is # microseconds from xrun +.TP +\fI\-v, \-\-verbose\fP +Show PCM structure and setup. +This option is accumulative. The VU meter is displayed when this +is given twice or three times. +.TP +\fI\-V, \-\-vumeter=TYPE\fP +Specifies the VU\-meter type, either \fIstereo\fP or \fImono\fP. +The stereo VU\-meter is available only for 2\-channel stereo samples +with interleaved format. +.TP +\fI\-I, \-\-separate\-channels\fP +One file for each channel. This option disables max\-file\-time +and use\-strftime, and ignores SIGUSR1. The stereo VU meter is +not available with separate channels. +.TP +\fI\-P\fP +Playback. This is the default if the program is invoked +by typing aplay. +.TP +\fI\-C\fP +Record. This is the default if the program is invoked +by typing arecord. +.TP +\fI\-i, \-\-interactive\fP +Allow interactive operation via stdin. +Currently only pause/resume via space or enter key is implemented. +.TP +\fI-m, \-\-chmap=ch1,ch2,...\fP +Give the channel map to override or follow. Pass channel position +strings like \fIFL\fP, \fIFR\fP, etc. + +If a device supports the override of the channel map, \fBaplay\fP +tries to pass the given channel map. +If it doesn't support the channel map override but still it provides +the channel map information, \fBaplay\fP tries to rearrange the +channel order in the buffer to match with the returned channel map +from the device. +.TP +\fI\-\-disable\-resample\fP +Disable automatic rate resample. +.TP +\fI\-\-disable\-channels\fP +Disable automatic channel conversions. +.TP +\fI\-\-disable\-format\fP +Disable automatic format conversions. +.TP +\fI\-\-disable\-softvol\fP +Disable software volume control (softvol). +.TP +\fI\-\-test\-position\fP +Test ring buffer position. +.TP +\fI\-\-test\-coef=\fP +Test coefficient for ring buffer position; default is 8. +Expression for validation is: coef * (buffer_size / 2). +Minimum value is 1. +.TP +\fI\-\-test\-nowait\fP +Do not wait for the ring buffer \(hy eats the whole CPU. +.TP +\fI\-\-max\-file\-time\fP +While recording, when the output file has been accumulating +sound for this long, +close it and open a new output file. Default is the maximum +size supported by the file format: 2 GiB for WAV files. +This option has no effect if \-\-separate\-channels is +specified. +.TP +\fI\-\-process\-id\-file \fP +aplay writes its process ID here, so other programs can +send signals to it. +.TP +\fI\-\-use\-strftime\fP +When recording, interpret %\-codes in the file name parameter using +the strftime facility whenever the output file is opened. The +important strftime codes are: %Y is the year, %m month, %d day of +the month, %H hour, %M minute and %S second. In addition, %v is +the file number, starting at 1. When this option is specified, +intermediate directories for the output file are created automatically. +This option has no effect if \-\-separate\-channels is specified. +.TP +\fI\-\-dump\-hw\-params\fP +Dump hw_params of the device preconfigured status to stderr. The dump +lists capabilities of the selected device such as supported formats, +sampling rates, numbers of channels, period and buffer bytes/sizes/times. +For raw device hw:X this option basically lists hardware capabilities of +the soundcard. +.TP +\fI\-\-fatal\-errors\fP +Disables recovery attempts when errors (e.g. xrun) are encountered; the +aplay process instead aborts immediately. + +.SH SIGNALS +When recording, SIGINT, SIGTERM and SIGABRT will close the output +file and exit. SIGUSR1 will close the output file, open a new one, +and continue recording. However, SIGUSR1 does not work with +\-\-separate\-channels. + +.SH EXAMPLES + +.TP +\fBaplay \-c 1 \-t raw \-r 22050 \-f mu_law foobar\fR +will play the raw file "foobar" as a +22050\-Hz, mono, 8\-bit, Mu\-Law .au file. + +.TP +\fBarecord \-d 10 \-f cd \-t wav \-D copy foobar.wav\fP +will record foobar.wav as a 10\-second, CD\-quality wave file, using the +PCM "copy" (which might be defined in the user's .asoundrc file as: +.nf +pcm.copy { + type plug + slave { + pcm hw + } + route_policy copy +} +.fi + +.TP +\fBarecord \-t wav \-\-max\-file\-time 30 mon.wav\fP +Record from the default audio source in monaural, 8,000 samples +per second, 8 bits per sample. Start a new file every +30 seconds. File names are mon\-nn.wav, where nn increases +from 01. The file after mon\-99.wav is mon\-100.wav. + +.TP +\fBarecord \-f cd \-t wav \-\-max\-file\-time 3600 \-\-use-strftime %Y/%m/%d/listen-%H-%M-%v.wav\fP +Record in stereo from the default audio source. Create a new file +every hour. The files are placed in directories based on their start dates +and have names which include their start times and file numbers. + +.SH SEE ALSO +\fB +alsamixer(1), +amixer(1) +\fP + +.SH BUGS +Note that .aiff files are not currently supported. + +.SH AUTHOR +\fBarecord\fP and \fBaplay\fP are by Jaroslav Kysela +This document is by Paul Winkler . +Updated for Alsa 0.9 by James Tappin + diff --git a/aplay/formats.h b/aplay/formats.h new file mode 100644 index 0000000..ac0a2b0 --- /dev/null +++ b/aplay/formats.h @@ -0,0 +1,134 @@ +#ifndef FORMATS_H +#define FORMATS_H 1 + +#include +#include + +/* Definitions for .VOC files */ + +#define VOC_MAGIC_STRING "Creative Voice File\x1A" +#define VOC_ACTUAL_VERSION 0x010A +#define VOC_SAMPLESIZE 8 + +#define VOC_MODE_MONO 0 +#define VOC_MODE_STEREO 1 + +#define VOC_DATALEN(bp) ((u_long)(bp->datalen) | \ + ((u_long)(bp->datalen_m) << 8) | \ + ((u_long)(bp->datalen_h) << 16) ) + +typedef struct voc_header { + u_char magic[20]; /* must be MAGIC_STRING */ + u_short headerlen; /* Headerlength, should be 0x1A */ + u_short version; /* VOC-file version */ + u_short coded_ver; /* 0x1233-version */ +} VocHeader; + +typedef struct voc_blocktype { + u_char type; + u_char datalen; /* low-byte */ + u_char datalen_m; /* medium-byte */ + u_char datalen_h; /* high-byte */ +} VocBlockType; + +typedef struct voc_voice_data { + u_char tc; + u_char pack; +} VocVoiceData; + +typedef struct voc_ext_block { + u_short tc; + u_char pack; + u_char mode; +} VocExtBlock; + +/* Definitions for Microsoft WAVE format */ + +#if __BYTE_ORDER == __LITTLE_ENDIAN +#define COMPOSE_ID(a,b,c,d) ((a) | ((b)<<8) | ((c)<<16) | ((d)<<24)) +#define LE_SHORT(v) (v) +#define LE_INT(v) (v) +#define BE_SHORT(v) bswap_16(v) +#define BE_INT(v) bswap_32(v) +#elif __BYTE_ORDER == __BIG_ENDIAN +#define COMPOSE_ID(a,b,c,d) ((d) | ((c)<<8) | ((b)<<16) | ((a)<<24)) +#define LE_SHORT(v) bswap_16(v) +#define LE_INT(v) bswap_32(v) +#define BE_SHORT(v) (v) +#define BE_INT(v) (v) +#else +#error "Wrong endian" +#endif + +/* Note: the following macros evaluate the parameter v twice */ +#define TO_CPU_SHORT(v, be) \ + ((be) ? BE_SHORT(v) : LE_SHORT(v)) +#define TO_CPU_INT(v, be) \ + ((be) ? BE_INT(v) : LE_INT(v)) + +#define WAV_RIFF COMPOSE_ID('R','I','F','F') +#define WAV_RIFX COMPOSE_ID('R','I','F','X') +#define WAV_WAVE COMPOSE_ID('W','A','V','E') +#define WAV_FMT COMPOSE_ID('f','m','t',' ') +#define WAV_DATA COMPOSE_ID('d','a','t','a') + +/* WAVE fmt block constants from Microsoft mmreg.h header */ +#define WAV_FMT_PCM 0x0001 +#define WAV_FMT_IEEE_FLOAT 0x0003 +#define WAV_FMT_DOLBY_AC3_SPDIF 0x0092 +#define WAV_FMT_EXTENSIBLE 0xfffe + +/* Used with WAV_FMT_EXTENSIBLE format */ +#define WAV_GUID_TAG "\x00\x00\x00\x00\x10\x00\x80\x00\x00\xAA\x00\x38\x9B\x71" + +/* it's in chunks like .voc and AMIGA iff, but my source say there + are in only in this combination, so I combined them in one header; + it works on all WAVE-file I have + */ +typedef struct { + u_int magic; /* 'RIFF' */ + u_int length; /* filelen */ + u_int type; /* 'WAVE' */ +} WaveHeader; + +typedef struct { + u_short format; /* see WAV_FMT_* */ + u_short channels; + u_int sample_fq; /* frequence of sample */ + u_int byte_p_sec; + u_short byte_p_spl; /* samplesize; 1 or 2 bytes */ + u_short bit_p_spl; /* 8, 12 or 16 bit */ +} WaveFmtBody; + +typedef struct { + WaveFmtBody format; + u_short ext_size; + u_short bit_p_spl; + u_int channel_mask; + u_short guid_format; /* WAV_FMT_* */ + u_char guid_tag[14]; /* WAV_GUID_TAG */ +} WaveFmtExtensibleBody; + +typedef struct { + u_int type; /* 'data' */ + u_int length; /* samplecount */ +} WaveChunkHeader; + +/* Definitions for Sparc .au header */ + +#define AU_MAGIC COMPOSE_ID('.','s','n','d') + +#define AU_FMT_ULAW 1 +#define AU_FMT_LIN8 2 +#define AU_FMT_LIN16 3 + +typedef struct au_header { + u_int magic; /* '.snd' */ + u_int hdr_size; /* size of header (min 24) */ + u_int data_size; /* size of data */ + u_int encoding; /* see to AU_FMT_XXXX */ + u_int sample_rate; /* sample rate */ + u_int channels; /* number of channels (voices) */ +} AuHeader; + +#endif /* FORMATS */ diff --git a/axfer/Makefile.am b/axfer/Makefile.am new file mode 100644 index 0000000..a00176c --- /dev/null +++ b/axfer/Makefile.am @@ -0,0 +1,72 @@ +bin_PROGRAMS = \ + axfer + +man_MANS = \ + axfer.1 \ + axfer-list.1 \ + axfer-transfer.1 + +# To include headers for gettext and version. +AM_CPPFLAGS = \ + -I$(top_srcdir)/include + +# Unit tests. +SUBDIRS = \ + test + +LIBRT = @LIBRT@ +LDADD = \ + $(LIBINTL) \ + $(LIBRT) + +noinst_HEADERS = \ + misc.h \ + subcmd.h \ + container.h \ + mapper.h \ + xfer.h \ + xfer-libasound.h \ + frame-cache.h + waiter.h + +axfer_SOURCES = \ + misc.h \ + subcmd.h \ + main.c \ + subcmd-list.c \ + container.h \ + container.c \ + container-riff-wave.c \ + container-au.c \ + container-voc.c \ + container-raw.c \ + mapper.h \ + mapper.c \ + mapper-single.c \ + mapper-multiple.c \ + xfer.h \ + xfer.c \ + xfer-options.c \ + xfer-libasound.h \ + xfer-libasound.c \ + frame-cache.h \ + frame-cache.c \ + xfer-libasound-irq-rw.c \ + subcmd-transfer.c \ + xfer-libasound-irq-mmap.c \ + waiter.h \ + waiter.c \ + waiter-poll.c \ + waiter-select.c \ + waiter-epoll.c \ + xfer-libasound-timer-mmap.c + +if HAVE_FFADO +axfer_SOURCES += xfer-libffado.c +LDADD += -lffado +endif + +EXTRA_DIST = \ + axfer.1 \ + axfer-list.1 \ + axfer-transfer.1 diff --git a/axfer/Makefile.in b/axfer/Makefile.in new file mode 100644 index 0000000..b25a28e --- /dev/null +++ b/axfer/Makefile.in @@ -0,0 +1,978 @@ +# Makefile.in generated by automake 1.16.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994-2018 Free Software Foundation, Inc. + +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + + +VPATH = @srcdir@ +am__is_gnu_make = { \ + if test -z '$(MAKELEVEL)'; then \ + false; \ + elif test -n '$(MAKE_HOST)'; then \ + true; \ + elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ + true; \ + else \ + false; \ + fi; \ +} +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + esac; \ + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +bin_PROGRAMS = axfer$(EXEEXT) +@HAVE_FFADO_TRUE@am__append_1 = xfer-libffado.c +@HAVE_FFADO_TRUE@am__append_2 = -lffado +subdir = axfer +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/gettext.m4 \ + $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/lib-ld.m4 \ + $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ + $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \ + $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/acinclude.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +DIST_COMMON = $(srcdir)/Makefile.am $(noinst_HEADERS) \ + $(am__DIST_COMMON) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/include/aconfig.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +am__installdirs = "$(DESTDIR)$(bindir)" "$(DESTDIR)$(man1dir)" +PROGRAMS = $(bin_PROGRAMS) +am__axfer_SOURCES_DIST = misc.h subcmd.h main.c subcmd-list.c \ + container.h container.c container-riff-wave.c container-au.c \ + container-voc.c container-raw.c mapper.h mapper.c \ + mapper-single.c mapper-multiple.c xfer.h xfer.c xfer-options.c \ + xfer-libasound.h xfer-libasound.c frame-cache.h frame-cache.c \ + xfer-libasound-irq-rw.c subcmd-transfer.c \ + xfer-libasound-irq-mmap.c waiter.h waiter.c waiter-poll.c \ + waiter-select.c waiter-epoll.c xfer-libasound-timer-mmap.c \ + xfer-libffado.c +@HAVE_FFADO_TRUE@am__objects_1 = xfer-libffado.$(OBJEXT) +am_axfer_OBJECTS = main.$(OBJEXT) subcmd-list.$(OBJEXT) \ + container.$(OBJEXT) container-riff-wave.$(OBJEXT) \ + container-au.$(OBJEXT) container-voc.$(OBJEXT) \ + container-raw.$(OBJEXT) mapper.$(OBJEXT) \ + mapper-single.$(OBJEXT) mapper-multiple.$(OBJEXT) \ + xfer.$(OBJEXT) xfer-options.$(OBJEXT) xfer-libasound.$(OBJEXT) \ + frame-cache.$(OBJEXT) xfer-libasound-irq-rw.$(OBJEXT) \ + subcmd-transfer.$(OBJEXT) xfer-libasound-irq-mmap.$(OBJEXT) \ + waiter.$(OBJEXT) waiter-poll.$(OBJEXT) waiter-select.$(OBJEXT) \ + waiter-epoll.$(OBJEXT) xfer-libasound-timer-mmap.$(OBJEXT) \ + $(am__objects_1) +axfer_OBJECTS = $(am_axfer_OBJECTS) +axfer_LDADD = $(LDADD) +am__DEPENDENCIES_1 = +axfer_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \ + $(am__DEPENDENCIES_1) +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__maybe_remake_depfiles = depfiles +am__depfiles_remade = ./$(DEPDIR)/container-au.Po \ + ./$(DEPDIR)/container-raw.Po \ + ./$(DEPDIR)/container-riff-wave.Po \ + ./$(DEPDIR)/container-voc.Po ./$(DEPDIR)/container.Po \ + ./$(DEPDIR)/frame-cache.Po ./$(DEPDIR)/main.Po \ + ./$(DEPDIR)/mapper-multiple.Po ./$(DEPDIR)/mapper-single.Po \ + ./$(DEPDIR)/mapper.Po ./$(DEPDIR)/subcmd-list.Po \ + ./$(DEPDIR)/subcmd-transfer.Po ./$(DEPDIR)/waiter-epoll.Po \ + ./$(DEPDIR)/waiter-poll.Po ./$(DEPDIR)/waiter-select.Po \ + ./$(DEPDIR)/waiter.Po ./$(DEPDIR)/xfer-libasound-irq-mmap.Po \ + ./$(DEPDIR)/xfer-libasound-irq-rw.Po \ + ./$(DEPDIR)/xfer-libasound-timer-mmap.Po \ + ./$(DEPDIR)/xfer-libasound.Po ./$(DEPDIR)/xfer-libffado.Po \ + ./$(DEPDIR)/xfer-options.Po ./$(DEPDIR)/xfer.Po +am__mv = mv -f +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +AM_V_CC = $(am__v_CC_@AM_V@) +am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) +am__v_CC_0 = @echo " CC " $@; +am__v_CC_1 = +CCLD = $(CC) +LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_CCLD = $(am__v_CCLD_@AM_V@) +am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) +am__v_CCLD_0 = @echo " CCLD " $@; +am__v_CCLD_1 = +SOURCES = $(axfer_SOURCES) +DIST_SOURCES = $(am__axfer_SOURCES_DIST) +RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \ + ctags-recursive dvi-recursive html-recursive info-recursive \ + install-data-recursive install-dvi-recursive \ + install-exec-recursive install-html-recursive \ + install-info-recursive install-pdf-recursive \ + install-ps-recursive install-recursive installcheck-recursive \ + installdirs-recursive pdf-recursive ps-recursive \ + tags-recursive uninstall-recursive +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; +am__vpath_adj = case $$p in \ + $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ + *) f=$$p;; \ + esac; +am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; +am__install_max = 40 +am__nobase_strip_setup = \ + srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` +am__nobase_strip = \ + for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" +am__nobase_list = $(am__nobase_strip_setup); \ + for p in $$list; do echo "$$p $$p"; done | \ + sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ + $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ + if (++n[$$2] == $(am__install_max)) \ + { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ + END { for (dir in files) print dir, files[dir] }' +am__base_list = \ + sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ + sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' +am__uninstall_files_from_dir = { \ + test -z "$$files" \ + || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ + || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ + $(am__cd) "$$dir" && rm -f $$files; }; \ + } +man1dir = $(mandir)/man1 +NROFF = nroff +MANS = $(man_MANS) +HEADERS = $(noinst_HEADERS) +RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ + distclean-recursive maintainer-clean-recursive +am__recursive_targets = \ + $(RECURSIVE_TARGETS) \ + $(RECURSIVE_CLEAN_TARGETS) \ + $(am__extra_recursive_targets) +AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \ + distdir distdir-am +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) +# Read a list of newline-separated strings from the standard input, +# and print each of them once, without duplicates. Input order is +# *not* preserved. +am__uniquify_input = $(AWK) '\ + BEGIN { nonempty = 0; } \ + { items[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in items) print i; }; } \ +' +# Make sure the list of sources is unique. This is necessary because, +# e.g., the same source file might be shared among _SOURCES variables +# for different programs/libraries. +am__define_uniq_tagged_files = \ + list='$(am__tagged_files)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | $(am__uniquify_input)` +ETAGS = etags +CTAGS = ctags +DIST_SUBDIRS = $(SUBDIRS) +am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/depcomp +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +am__relativize = \ + dir0=`pwd`; \ + sed_first='s,^\([^/]*\)/.*$$,\1,'; \ + sed_rest='s,^[^/]*/*,,'; \ + sed_last='s,^.*/\([^/]*\)$$,\1,'; \ + sed_butlast='s,/*[^/]*$$,,'; \ + while test -n "$$dir1"; do \ + first=`echo "$$dir1" | sed -e "$$sed_first"`; \ + if test "$$first" != "."; then \ + if test "$$first" = ".."; then \ + dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \ + dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \ + else \ + first2=`echo "$$dir2" | sed -e "$$sed_first"`; \ + if test "$$first2" = "$$first"; then \ + dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \ + else \ + dir2="../$$dir2"; \ + fi; \ + dir0="$$dir0"/"$$first"; \ + fi; \ + fi; \ + dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \ + done; \ + reldir="$$dir2" +ACLOCAL = @ACLOCAL@ +ALSACTL_DAEMONSWITCH = @ALSACTL_DAEMONSWITCH@ +ALSACTL_PIDFILE_DIR = @ALSACTL_PIDFILE_DIR@ +ALSA_CFLAGS = @ALSA_CFLAGS@ +ALSA_LIBS = @ALSA_LIBS@ +ALSA_TOPOLOGY_LIBS = @ALSA_TOPOLOGY_LIBS@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +ASOUND_LOCK_DIR = @ASOUND_LOCK_DIR@ +ASOUND_STATE_DIR = @ASOUND_STATE_DIR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CURSESINC = @CURSESINC@ +CURSESLIB = @CURSESLIB@ +CURSES_CFLAGS = @CURSES_CFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +FFTW_CFLAGS = @FFTW_CFLAGS@ +FFTW_INC = @FFTW_INC@ +FFTW_LIB = @FFTW_LIB@ +GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ +GMSGFMT = @GMSGFMT@ +GMSGFMT_015 = @GMSGFMT_015@ +GREP = @GREP@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +INTLLIBS = @INTLLIBS@ +INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@ +LDFLAGS = @LDFLAGS@ +LIBICONV = @LIBICONV@ +LIBINTL = @LIBINTL@ +LIBOBJS = @LIBOBJS@ +LIBRT = @LIBRT@ +LIBS = @LIBS@ +LN_S = @LN_S@ +LTLIBICONV = @LTLIBICONV@ +LTLIBINTL = @LTLIBINTL@ +LTLIBOBJS = @LTLIBOBJS@ +MAINT = @MAINT@ +MAKEINFO = @MAKEINFO@ +MKDIR_P = @MKDIR_P@ +MSGFMT = @MSGFMT@ +MSGFMT_015 = @MSGFMT_015@ +MSGMERGE = @MSGMERGE@ +NCURSESW_CFLAGS = @NCURSESW_CFLAGS@ +NCURSESW_LIBS = @NCURSESW_LIBS@ +NCURSES_CFLAGS = @NCURSES_CFLAGS@ +NCURSES_LIBS = @NCURSES_LIBS@ +OBJEXT = @OBJEXT@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ +POSUB = @POSUB@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +SND_UTIL_MAJOR = @SND_UTIL_MAJOR@ +SND_UTIL_MINOR = @SND_UTIL_MINOR@ +SND_UTIL_SUBMINOR = @SND_UTIL_SUBMINOR@ +SND_UTIL_VERSION = @SND_UTIL_VERSION@ +STRIP = @STRIP@ +SYSTEMD_CFLAGS = @SYSTEMD_CFLAGS@ +SYSTEMD_LIBS = @SYSTEMD_LIBS@ +TESTSOUND = @TESTSOUND@ +USE_NLS = @USE_NLS@ +VERSION = @VERSION@ +XGETTEXT = @XGETTEXT@ +XGETTEXT_015 = @XGETTEXT_015@ +XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_CC = @ac_ct_CC@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +mydatadir = @mydatadir@ +ncurses5_config = @ncurses5_config@ +ncursesw5_config = @ncursesw5_config@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +rst2man_available = @rst2man_available@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +systemdsystemunitdir = @systemdsystemunitdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +udevrulesdir = @udevrulesdir@ +xmlto_available = @xmlto_available@ +man_MANS = \ + axfer.1 \ + axfer-list.1 \ + axfer-transfer.1 + + +# To include headers for gettext and version. +AM_CPPFLAGS = \ + -I$(top_srcdir)/include + + +# Unit tests. +SUBDIRS = \ + test + +LDADD = $(LIBINTL) $(LIBRT) $(am__append_2) +noinst_HEADERS = \ + misc.h \ + subcmd.h \ + container.h \ + mapper.h \ + xfer.h \ + xfer-libasound.h \ + frame-cache.h + +axfer_SOURCES = misc.h subcmd.h main.c subcmd-list.c container.h \ + container.c container-riff-wave.c container-au.c \ + container-voc.c container-raw.c mapper.h mapper.c \ + mapper-single.c mapper-multiple.c xfer.h xfer.c xfer-options.c \ + xfer-libasound.h xfer-libasound.c frame-cache.h frame-cache.c \ + xfer-libasound-irq-rw.c subcmd-transfer.c \ + xfer-libasound-irq-mmap.c waiter.h waiter.c waiter-poll.c \ + waiter-select.c waiter-epoll.c xfer-libasound-timer-mmap.c \ + $(am__append_1) +EXTRA_DIST = \ + axfer.1 \ + axfer-list.1 \ + axfer-transfer.1 + +all: all-recursive + +.SUFFIXES: +.SUFFIXES: .c .o .obj +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign axfer/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --foreign axfer/Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): +install-binPROGRAMS: $(bin_PROGRAMS) + @$(NORMAL_INSTALL) + @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(bindir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(bindir)" || exit 1; \ + fi; \ + for p in $$list; do echo "$$p $$p"; done | \ + sed 's/$(EXEEXT)$$//' | \ + while read p p1; do if test -f $$p \ + ; then echo "$$p"; echo "$$p"; else :; fi; \ + done | \ + sed -e 'p;s,.*/,,;n;h' \ + -e 's|.*|.|' \ + -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \ + sed 'N;N;N;s,\n, ,g' | \ + $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \ + { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \ + if ($$2 == $$4) files[d] = files[d] " " $$1; \ + else { print "f", $$3 "/" $$4, $$1; } } \ + END { for (d in files) print "f", d, files[d] }' | \ + while read type dir files; do \ + if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \ + test -z "$$files" || { \ + echo " $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(bindir)$$dir'"; \ + $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \ + } \ + ; done + +uninstall-binPROGRAMS: + @$(NORMAL_UNINSTALL) + @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ + files=`for p in $$list; do echo "$$p"; done | \ + sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \ + -e 's/$$/$(EXEEXT)/' \ + `; \ + test -n "$$list" || exit 0; \ + echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \ + cd "$(DESTDIR)$(bindir)" && rm -f $$files + +clean-binPROGRAMS: + -test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS) + +axfer$(EXEEXT): $(axfer_OBJECTS) $(axfer_DEPENDENCIES) $(EXTRA_axfer_DEPENDENCIES) + @rm -f axfer$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(axfer_OBJECTS) $(axfer_LDADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/container-au.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/container-raw.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/container-riff-wave.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/container-voc.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/container.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/frame-cache.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/main.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mapper-multiple.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mapper-single.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mapper.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/subcmd-list.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/subcmd-transfer.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/waiter-epoll.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/waiter-poll.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/waiter-select.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/waiter.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xfer-libasound-irq-mmap.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xfer-libasound-irq-rw.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xfer-libasound-timer-mmap.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xfer-libasound.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xfer-libffado.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xfer-options.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xfer.Po@am__quote@ # am--include-marker + +$(am__depfiles_remade): + @$(MKDIR_P) $(@D) + @echo '# dummy' >$@-t && $(am__mv) $@-t $@ + +am--depfiles: $(am__depfiles_remade) + +.c.o: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< + +.c.obj: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` +install-man1: $(man_MANS) + @$(NORMAL_INSTALL) + @list1=''; \ + list2='$(man_MANS)'; \ + test -n "$(man1dir)" \ + && test -n "`echo $$list1$$list2`" \ + || exit 0; \ + echo " $(MKDIR_P) '$(DESTDIR)$(man1dir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(man1dir)" || exit 1; \ + { for i in $$list1; do echo "$$i"; done; \ + if test -n "$$list2"; then \ + for i in $$list2; do echo "$$i"; done \ + | sed -n '/\.1[a-z]*$$/p'; \ + fi; \ + } | while read p; do \ + if test -f $$p; then d=; else d="$(srcdir)/"; fi; \ + echo "$$d$$p"; echo "$$p"; \ + done | \ + sed -e 'n;s,.*/,,;p;h;s,.*\.,,;s,^[^1][0-9a-z]*$$,1,;x' \ + -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,' | \ + sed 'N;N;s,\n, ,g' | { \ + list=; while read file base inst; do \ + if test "$$base" = "$$inst"; then list="$$list $$file"; else \ + echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man1dir)/$$inst'"; \ + $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man1dir)/$$inst" || exit $$?; \ + fi; \ + done; \ + for i in $$list; do echo "$$i"; done | $(am__base_list) | \ + while read files; do \ + test -z "$$files" || { \ + echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(man1dir)'"; \ + $(INSTALL_DATA) $$files "$(DESTDIR)$(man1dir)" || exit $$?; }; \ + done; } + +uninstall-man1: + @$(NORMAL_UNINSTALL) + @list=''; test -n "$(man1dir)" || exit 0; \ + files=`{ for i in $$list; do echo "$$i"; done; \ + l2='$(man_MANS)'; for i in $$l2; do echo "$$i"; done | \ + sed -n '/\.1[a-z]*$$/p'; \ + } | sed -e 's,.*/,,;h;s,.*\.,,;s,^[^1][0-9a-z]*$$,1,;x' \ + -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,'`; \ + dir='$(DESTDIR)$(man1dir)'; $(am__uninstall_files_from_dir) + +# This directory's subdirectories are mostly independent; you can cd +# into them and run 'make' without going through this Makefile. +# To change the values of 'make' variables: instead of editing Makefiles, +# (1) if the variable is set in 'config.status', edit 'config.status' +# (which will cause the Makefiles to be regenerated when you run 'make'); +# (2) otherwise, pass the desired values on the 'make' command line. +$(am__recursive_targets): + @fail=; \ + if $(am__make_keepgoing); then \ + failcom='fail=yes'; \ + else \ + failcom='exit 1'; \ + fi; \ + dot_seen=no; \ + target=`echo $@ | sed s/-recursive//`; \ + case "$@" in \ + distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ + *) list='$(SUBDIRS)' ;; \ + esac; \ + for subdir in $$list; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + dot_seen=yes; \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || eval $$failcom; \ + done; \ + if test "$$dot_seen" = "no"; then \ + $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ + fi; test -z "$$fail" + +ID: $(am__tagged_files) + $(am__define_uniq_tagged_files); mkid -fID $$unique +tags: tags-recursive +TAGS: tags + +tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + set x; \ + here=`pwd`; \ + if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ + include_option=--etags-include; \ + empty_fix=.; \ + else \ + include_option=--include; \ + empty_fix=; \ + fi; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test ! -f $$subdir/TAGS || \ + set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \ + fi; \ + done; \ + $(am__define_uniq_tagged_files); \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: ctags-recursive + +CTAGS: ctags +ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + $(am__define_uniq_tagged_files); \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" +cscopelist: cscopelist-recursive + +cscopelist-am: $(am__tagged_files) + list='$(am__tagged_files)'; \ + case "$(srcdir)" in \ + [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ + *) sdir=$(subdir)/$(srcdir) ;; \ + esac; \ + for i in $$list; do \ + if test -f "$$i"; then \ + echo "$(subdir)/$$i"; \ + else \ + echo "$$sdir/$$i"; \ + fi; \ + done >> $(top_builddir)/cscope.files + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) distdir-am + +distdir-am: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done + @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + $(am__make_dryrun) \ + || test -d "$(distdir)/$$subdir" \ + || $(MKDIR_P) "$(distdir)/$$subdir" \ + || exit 1; \ + dir1=$$subdir; dir2="$(distdir)/$$subdir"; \ + $(am__relativize); \ + new_distdir=$$reldir; \ + dir1=$$subdir; dir2="$(top_distdir)"; \ + $(am__relativize); \ + new_top_distdir=$$reldir; \ + echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \ + echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \ + ($(am__cd) $$subdir && \ + $(MAKE) $(AM_MAKEFLAGS) \ + top_distdir="$$new_top_distdir" \ + distdir="$$new_distdir" \ + am__remove_distdir=: \ + am__skip_length_check=: \ + am__skip_mode_fix=: \ + distdir) \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-recursive +all-am: Makefile $(PROGRAMS) $(MANS) $(HEADERS) +installdirs: installdirs-recursive +installdirs-am: + for dir in "$(DESTDIR)$(bindir)" "$(DESTDIR)$(man1dir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ + done +install: install-recursive +install-exec: install-exec-recursive +install-data: install-data-recursive +uninstall: uninstall-recursive + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-recursive +install-strip: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-recursive + +clean-am: clean-binPROGRAMS clean-generic mostlyclean-am + +distclean: distclean-recursive + -rm -f ./$(DEPDIR)/container-au.Po + -rm -f ./$(DEPDIR)/container-raw.Po + -rm -f ./$(DEPDIR)/container-riff-wave.Po + -rm -f ./$(DEPDIR)/container-voc.Po + -rm -f ./$(DEPDIR)/container.Po + -rm -f ./$(DEPDIR)/frame-cache.Po + -rm -f ./$(DEPDIR)/main.Po + -rm -f ./$(DEPDIR)/mapper-multiple.Po + -rm -f ./$(DEPDIR)/mapper-single.Po + -rm -f ./$(DEPDIR)/mapper.Po + -rm -f ./$(DEPDIR)/subcmd-list.Po + -rm -f ./$(DEPDIR)/subcmd-transfer.Po + -rm -f ./$(DEPDIR)/waiter-epoll.Po + -rm -f ./$(DEPDIR)/waiter-poll.Po + -rm -f ./$(DEPDIR)/waiter-select.Po + -rm -f ./$(DEPDIR)/waiter.Po + -rm -f ./$(DEPDIR)/xfer-libasound-irq-mmap.Po + -rm -f ./$(DEPDIR)/xfer-libasound-irq-rw.Po + -rm -f ./$(DEPDIR)/xfer-libasound-timer-mmap.Po + -rm -f ./$(DEPDIR)/xfer-libasound.Po + -rm -f ./$(DEPDIR)/xfer-libffado.Po + -rm -f ./$(DEPDIR)/xfer-options.Po + -rm -f ./$(DEPDIR)/xfer.Po + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-recursive + +dvi-am: + +html: html-recursive + +html-am: + +info: info-recursive + +info-am: + +install-data-am: install-man + +install-dvi: install-dvi-recursive + +install-dvi-am: + +install-exec-am: install-binPROGRAMS + +install-html: install-html-recursive + +install-html-am: + +install-info: install-info-recursive + +install-info-am: + +install-man: install-man1 + +install-pdf: install-pdf-recursive + +install-pdf-am: + +install-ps: install-ps-recursive + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-recursive + -rm -f ./$(DEPDIR)/container-au.Po + -rm -f ./$(DEPDIR)/container-raw.Po + -rm -f ./$(DEPDIR)/container-riff-wave.Po + -rm -f ./$(DEPDIR)/container-voc.Po + -rm -f ./$(DEPDIR)/container.Po + -rm -f ./$(DEPDIR)/frame-cache.Po + -rm -f ./$(DEPDIR)/main.Po + -rm -f ./$(DEPDIR)/mapper-multiple.Po + -rm -f ./$(DEPDIR)/mapper-single.Po + -rm -f ./$(DEPDIR)/mapper.Po + -rm -f ./$(DEPDIR)/subcmd-list.Po + -rm -f ./$(DEPDIR)/subcmd-transfer.Po + -rm -f ./$(DEPDIR)/waiter-epoll.Po + -rm -f ./$(DEPDIR)/waiter-poll.Po + -rm -f ./$(DEPDIR)/waiter-select.Po + -rm -f ./$(DEPDIR)/waiter.Po + -rm -f ./$(DEPDIR)/xfer-libasound-irq-mmap.Po + -rm -f ./$(DEPDIR)/xfer-libasound-irq-rw.Po + -rm -f ./$(DEPDIR)/xfer-libasound-timer-mmap.Po + -rm -f ./$(DEPDIR)/xfer-libasound.Po + -rm -f ./$(DEPDIR)/xfer-libffado.Po + -rm -f ./$(DEPDIR)/xfer-options.Po + -rm -f ./$(DEPDIR)/xfer.Po + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-recursive + +mostlyclean-am: mostlyclean-compile mostlyclean-generic + +pdf: pdf-recursive + +pdf-am: + +ps: ps-recursive + +ps-am: + +uninstall-am: uninstall-binPROGRAMS uninstall-man + +uninstall-man: uninstall-man1 + +.MAKE: $(am__recursive_targets) install-am install-strip + +.PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am \ + am--depfiles check check-am clean clean-binPROGRAMS \ + clean-generic cscopelist-am ctags ctags-am distclean \ + distclean-compile distclean-generic distclean-tags distdir dvi \ + dvi-am html html-am info info-am install install-am \ + install-binPROGRAMS install-data install-data-am install-dvi \ + install-dvi-am install-exec install-exec-am install-html \ + install-html-am install-info install-info-am install-man \ + install-man1 install-pdf install-pdf-am install-ps \ + install-ps-am install-strip installcheck installcheck-am \ + installdirs installdirs-am maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-compile \ + mostlyclean-generic pdf pdf-am ps ps-am tags tags-am uninstall \ + uninstall-am uninstall-binPROGRAMS uninstall-man \ + uninstall-man1 + +.PRECIOUS: Makefile + + waiter.h + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/axfer/axfer-list.1 b/axfer/axfer-list.1 new file mode 100644 index 0000000..306d928 --- /dev/null +++ b/axfer/axfer-list.1 @@ -0,0 +1,86 @@ +.TH AXFER\-LIST 1 "28 November 2018" "alsa\-utils" + +.SH NAME +axfer\-list \- dump lists of available sound devices and nodes to transfer audio +data frame. + +.SH SYNOPSIS + +.B axfer list +.I direction target + +direction = +.B capture +| +.B playback + +target = +.B device +| +.B pcm + +.SH DESCRIPTION +The +.B list +subcommand of +.B axfer +dumps lists of available nodes to +transfer audio data frame. At present, the subcommand is helpful just for +libasound backend of +.B transfer +subcommand. + +.SH OPTIONS + +.SS Direction + +.TP +.B capture +Operates for capture transmission. + +.TP +.B playback +Operates for playback transmission. + +.SS Target + +.TP +.B device +Dumps a list of all soundcards and digital audio devices available in +.I libasound +backend for +.I tranfer +subcommand. + +.TP +.B pcm +Dumps a list of all PCM nodes available in alsa\-lib configuration space in +.I libasound +backend for +.I transfer +subcommand. + +.SH COMPATIBILITY TO APLAY + +Options of +.I \-l +, +.I \-\-list-devices +are handled as +.I device +operation. Options of +.I \-L +, +.I \-\-list-pcms +are handled as +.I pcm +operation. + +.SH SEE ALSO +.B axfer(1), +.B axfer\-transfer(1), +.B alsamixer(1), +.B amixer(1) + +.SH AUTHOR +Takashi Sakamoto diff --git a/axfer/axfer-transfer.1 b/axfer/axfer-transfer.1 new file mode 100644 index 0000000..2dd0a21 --- /dev/null +++ b/axfer/axfer-transfer.1 @@ -0,0 +1,1009 @@ +.TH AXFER\-TRANSFER 1 "28 November 2018" "alsa\-utils" + +.SH NAME +axfer\-transfer \- transferrer of audio data frame for sound devices and nodes. + +.SH SYNOPSIS + +.B axfer transfer +.I direction +[ +.I common\-options +] [ +.I backend\-options +] [ +.I filepath +] + +.B axfer transfer +.I direction +[ +.I common\-options +] [ +.I backend\-options +] +.I \-I +| +.I \-\-separate\-channels filepath ... + +direction = +.B capture +| +.B playback + +common\-options = ( read +.I OPTIONS +section ) + +backend\-options = ( read +.I OPTIONS +section ) + +filepaths = ( read +.I OPTIONS +section ) + +.SH DESCRIPTION +The +.B transfer +subcommand of +.B axfer +performs transmission of audio data frames for devices available in supported +backends. This program is essentially designed to use alsa\-lib APIs +(libasound backend) to handle sound devices supported by Linux sound subsystem +(ALSA). + +.SH OPTIONS + +.SS Direction + +.TP +.B capture +Operates for capture transmission. + +.TP +.B playback +Operates for playback transmission. + +.SS Filepath + +Filepath is handled as a path relative to current working directory of run time +if it\(aqs not full path from root directory. + +The standard input or output is used if filepath is not specified or given as +.I \(aq\-\(aq +\&. + +For playback transmission, container format of given +.I filepath +is detected automatically and metadata is used for parameters of sample format, +channels, rate, duration. If nothing detected, content of given file path is +handled as raw data. In this case, the parameters should be indicated as +options. + +Multiple +.I filepaths +are allowed with +.I \-I +| +.I \-\-separate\-channels +option. In this case, standard input and output is not available. The same +.I filepath +is not allowed except for paths listed below: + \- /dev/null + \- /dev/zero + \- /dev/full + \- /dev/random + \- /dev/urandom + +.SS Common options + +.TP +.B \-h, \-\-help +Print help messages and finish run time. + +.TP +.B \-q, \-\-quiet +Quiet mode. Suppress messages (not sound :)) + +.TP +.B \-v, \-\-verbose +Verbose mode. Runtime dumps supplemental information according to the number of +this option given in command line. + +.TP +.B \-d, \-\-duration=# +Interrupt after # seconds. A value of zero means infinity. The default is zero, +so if this option is omitted then the transmission process will run until it is +killed. Either +.I \-d +or +.I \-s +option is available exclusively. + +.TP +.B \-s, \-\-samples=# +Interrupt after transmission of # number of data frames. A value of zero means +infinity. The default is zero, so if this options is omitted then the +transmission process will run until it is killed. Either +.I \-d +or +.I \-s +option is available exclusively. + +.TP +.B \-f, \-\-format=FORMAT +Indicate format of audio sample. This is required for capture transmission, or +playback transmission with files including raw audio data. + +Available sample format is listed below: + - [S8|U8|S16|U16|S32|U32][_LE|_BE] + - [S24|U24][_LE|_BE] + - FLOAT[_LE|_BE] + - FLOAT64[_LE|_BE] + - IEC958_SUBFRAME[_LE|_BE] + - MU_LAW + - A_LAW + - [S20|U20][_LE|_BE] + - [S24|U24][_3LE|_3BE] + - [S20|U20][_3LE|_3BE] + - [S18|U18][_3LE|_3BE] + - DSD_U8 + - DSD_[U16|U32][_LE|_BE] + +If endian\-ness is omitted, host endian\-ness is used. + +Some special formats are available: + - cd (16 bit little endian, 44100, stereo) [= \-f S16_LE \-c 2 \-r 44100] + - cdr (16 bit big endian, 44100, stereo) [= \-f S16_BE \-c 2 \-f 44100] + - dat (16 bit little endian, 48000, stereo) [= \-f S16_LE \-c 2 \-r 48000] + +If omitted, +.I U8 +is used as a default. Actual available formats are restricted by each +transmission backend. + +Unavailable sample format is listed below. These format has size of data frame +unaligned to byte unit. + + - IMA_ADPCM + - MPEG + - GSM + - SPECIAL + - G723_24 + - G723_24_1B + - G723_40 + - G723_40_1B + +.TP +.B \-c, \-\-channels=# +Indicate the number of audio data samples per frame. This is required for +capture transmission, or playback transmission with files including raw audio +data. The value should be between +.I 1 to +.I 256 +\&. If omitted, +.I 1 +is used as a default. + +.TP +.B \-r, \-\-rate=# +Indicate the number of audio data frame per second. This is required for +capture transmission, or playback transmission with files including raw audio +data. If the value is less than +.I 1000 +, it\(aqs interpreted by +.I kHz +unit. The value should be between +.I 2000 +and +.I 192000 +\&. If omitted, +.I 8000 +is used as a default. + +.TP +.B \-t, \-\-file\-type=TYPE +Indicate the type of file. This is required for capture transmission. Available +types are listed below: + - wav: Microsoft/IBM RIFF/Wave format + - au, sparc: Sparc AU format + - voc: Creative Tech. voice format + - raw: raw data + +When nothing is indicated, for capture transmission, the type is decided +according to suffix of +.I filepath +, and +.I raw +type is used for fallback. + +.TP +.B \-I, \-\-separate\-channels +Indicate this option when several files are going to be handled. For capture +transmission, if one filepath is given as +.I filepath +, a list of +.I filepaths +is generated in a formula \(aq\-[.suffix]\(aq. +The suffix is omitted when raw format of container is used. + +.TP +.B \-\-dump\-hw\-params +Dump hardware parameters and finish run time if backend supports it. + +.TP +.B \-\-xfer\-backend=BACKEND +Select backend of transmission from a list below. The default is libasound. +.br + - libasound + - libffado (optional if compiled) + +.SS Backend options for libasound + +.TP +.B \-D, \-\-device=NODE + +This option is used to select PCM node in libasound configuration space. +Available nodes are listed by +.I pcm +operation of +.I list +subcommand. + +.TP +.B \-N, \-\-nonblock + +With this option, PCM substream is opened in non\-blocking mode. When audio +data frame is not available in buffer of the PCM substream, I/O operation +immediately returns without blocking process. This option implicitly uses +.I \-\-waiter\-type +option as well to prevent heavy consumption of CPU time. + +.TP +.B \-M, \-\-mmap + +With this option, audio data frame is processed directly in buffer of PCM +substream if selected node supports this operation. Without the option, +temporary buffers are used to copy audio data frame for buffer of PCM substream. +This option implicitly uses +.I \-\-waiter\-type +option as well to prevent heavy consumption of CPU time. + +.TP +.B \-F, \-\-period\-size=# + +This option configures given value to +.I period_size +hardware parameter of PCM substream. The parameter indicates the number of audio +data frame per period in buffer of the PCM substream. Actual number is decided +as a result of interaction between each implementation of PCM plugin chained +from the selected PCM node, and in\-kernel driver or PCM I/O plugins. + +Ideally, the same amount of audio data frame as the value should be handled in +one I/O operation. Actually, it is not, depending on implementation of the PCM +plugins, in\-kernel driver, PCM I/O plugins and scheduling model. For \(aqhw\(aq +PCM plugin in \(aqirq\(aq scheduling model, the value is used to decide +intervals of hardware interrupt, thus the same amount of audio data frame as +the value is expected to be available for one I/O operation. + +.TP +.B \-\-period\-time=# + +This option configures given value to +.I period_time +hardware parameter of PCM substream. This option is similar to +.I \-\-period\-size +option, however its unit is micro\-second. + +.TP +.B \-B, \-\-buffer\-size=# + +This option configures given value to +.I buffer_size +hardware parameter of PCM substream. The parameter indicates the number of audio +data frame in buffer of PCM substream. Actual number is decided as a result of +interaction between each implementation of PCM plugin chained from the selected +PCM node, and in\-kernel driver or PCM I/O plugins. + +Ideally, this is multiples of the number of audio data frame per period, thus +the size of period. Actually, it is not, depending on implementation of the PCM +plugins, in\-kernel driver and PCM I/O plugins. + +.TP +.B \-\-buffer\-time=# + +This option configures given value to +.I buffer_time +hardware parameter of PCM substream. This option is similar to +.I \-\-buffer\-size +option, however its unit is micro\-second. + +.TP +.B \-\-waiter\-type=TYPE + +This option indicates the type of waiter for event notification. At present, +four types are available; +.I default +, +.I select +, +.I poll +and +.I epoll +\&. With +.I default +type, \(aqsnd_pcm_wait()\(aq is used. With +.I select +type, \(aqselect(2)\(aq system call is used. With +.I poll +type, \(aqpoll(2)\(aq system call is used. With +.I epoll +type, Linux\-specific \(aqepoll(7)\(aq system call is used. + +This option should correspond to one of +.I \-\-nonblock +or +.I \-\-mmap +options, or +.I timer +value of +.I \-\-sched\-model +option. +Neither this option nor +.I \-\-test\-nowait +is available at the same time. + +.TP +.B \-\-sched\-model=MODEL + +This option selects scheduling model for process of this program. One of +.I irq +or +.I timer +is available. In detail, please read \(aqSCHEDULING MODEL\(aq section. + +When nothing specified, +.I irq +model is used. + +.TP +.B \-A, \-\-avail\-min=# + +This option configures given value to +.I avail\-min +software parameter of PCM substream. In blocking mode, the value is used as +threshold of the number of available audio data frames in buffer of PCM +substream to wake up process blocked by I/O operation. In non\-blocking mode, +any I/O operation returns \-EAGAIN until the available number of audio data frame reaches the threshold. + +This option has an effect in cases neither +.I \-\-mmap +nor +.I timer +value of +.I \-\-sched\-model +option is used. + +.TP +.B \-R, \-\-start\-delay=# + +This option configures given value to +.I start_threshold +software parameter of PCM substream. The value is used as threshold to start +PCM substream automatically. At present, this option has an effect in cases +neither +.I \-\-mmap +nor +.I timer +value of +.I \-\-sched\-model +option is used. + +For playback transmission, when the number of accumulated audio data frame +in buffer of PCM substream to which this program writes out reaches the +threshold, the PCM substream starts automatically without an explicit call of +.I snd_pcm_start() +to the PCM substream. + +For capture transmission, this option is useless. The number of +accumulated audio data frame is not increased without an explicit call of +.I snd_pcm_start() +to the PCM substream. + +This option has an effect in cases neither +.I \-\-mmap +nor +.I timer +value of +.I \-\-sched\-model +option is used. + +.TP +.B \-T, \-\-stop\-delay=# + +This option configures given value to +.I stop_threshold +software parameter of PCM substream. The value is used as threshold to stop PCM +substream automatically. At present, this option has an effect in cases neither +.I \-\-mmap +nor +.I timer +value of +.I \-\-sched\-model +option is used. + +For capture transmission, when the number of accumulated audio data frame +in buffer of PCM substream to which a driver or alsa\-lib PCM plugins write +reaches the threshold, the PCM substream stops automatically without an explicit +call of +.I snd_pcm_stop() +to the PCM substream. This is a case that this program leaves the audio data +frames without reading for a while. + +For playback transmission, when the number available audio data frame in buffer +of PCM substream from which a driver or alsa\-lib PCM plugins read reaches the +threshold, the PCM substream stops automatically without an explicit call of +.I snd_pcm_stop() +to the PCM substream. This is a case that this program leaves the audio data +frames without writing for a while. + +This option has an effect in cases neither +.I \-\-mmap +nor +.I timer +value of +.I \-\-sched\-model +option is used. + +.TP +.B \-\-disable\-resample + +This option has an effect for \(aqplug\(aq plugin in alsa\-lib to suppress +conversion of sampling rate for audio data frame. + +.TP +.B \-\-disable\-channels + +This option has an effect for \(aqplug\(aq plugin in alsa\-lib to suppress +conversion of channels for audio data frame. + +.TP +.B \-\-disable\-format + +This option has an effect for \(aqplug\(aq plugin in alsa\-lib to suppress +conversion of sample format for audio data frame. + +.TP +.B \-\-disable\-softvol + +This option has an effect for \(aqsoftvol\(aq plugin in alsa\-lib to suppress +conversion of samples for audio data frame via additional control element. + +.TP +.B \-\-fatal\-errors + +This option suppresses recovery operation from XRUN state of running PCM +substream, then process of this program is going to finish as usual. + +.TP +.B \-\-test\-nowait + +This option disables any waiter for I/O event notification. I/O operations are +iterated till any of audio data frame is available. The option brings heavy +load in consumption of CPU time. + +.SS Backend options for libffado + +This backend is automatically available when configure script detects +.I ffado_streaming_init() +symbol in libffado shared object. + +.TP +.B \-p, \-\-port=# + +This option uses given value to decide which 1394 OHCI controller is used to +communicate. When Linux system has two 1394 OHCI controllers, +.I 0 +or +.I 1 +are available. Neither this option nor +.I \-g +is available at the same time. If nothing specified, libffado performs to +communicate to units on IEEE 1394 bus managed by all of 1394 OHCI controller available in Linux system. + +.TP +.B \-n, \-\-node=# + +This option uses given value to decide which unit is used to communicate. This +option requires +.I \-p +option to indicate which 1394 OHCI controller is used to communicate to the +specified unit. + +.TP +.B \-g, \-\-guid=HEXADECIMAL + +This option uses given value to decide a target unit to communicate. The value +should be prefixed with '0x' and consists of hexadecimal literal letters +(0\-9, a\-f, A\-F). Neither this option nor +.I \-p +is available at the same time. If nothing specified, libffado performs to +communicate to units on IEEE 1394 bus managed by all of 1394 OHCI controller +available in Linux system. + +.TP +.B \-\-frames\-per\-period=# + +This option uses given value to decide the number of audio data frame in one +read/write operation. The operation is blocked till the number of available +audio data frame exceeds the given value. As a default, 512 audio data frames +is used. + +.TP +.B \-\-periods\-per\-buffer=# + +This option uses given value to decide the size of intermediate buffer between +this program and libffado. As a default, 2 periods per buffer is used. + +.TP +.B \-\-slave + +This option allows this program to run slave mode. In this mode, libffado +adds unit directory into configuration ROM of 1394 OHCI controller where Linux +system runs. The unit directory can be found by the other node on the same bus. +Linux system running on the node can transfer isochronous packet with audio +data frame to the unit. This program can receive the packet and demultiplex the +audio data frame. + +.TP +.B \-\-snoop + +This option allows this program to run snoop mode. In this mode, libffado +listens isochronous channels to which device transfers isochronous packet. When +isochronous communication starts by any unit on the same bus, the packets can +be handled by this program. + +.TP +.B \-\-sched\-priority=# + +This option executes +.I pthread_setschedparam() +in a call of +.I ffado_streaming_init() +to configure +scheduling policy and given value as its priority for threads related to +isochronous communication. +The given value should be within +.I RLIMIT_RTPRIO +parameter of process. Please read +.I getrlimit(2) +for details. + +.SH POSIX SIGNALS +During transmission, +.I SIGINT +and +.I SIGTERM +will close handled files and PCM substream to be going to finish run time. + +.I SIGTSTP +will suspend PCM substream and +.I SIGCONT +will resume it. No XRUNs are expected. With libffado backend, the suspend/resume +is not supported and runtime is aboeted immediately. + +The other signals perform default behaviours. + +.SH EXAMPLES + +.PP +.in +4n +.EX +.B $ axfer transfer playback \-d 1 something +.EE +.in +.PP + +The above will transfer audio data frame in \(aqsomething\(aq file for playback +during 1 second. The sample format is detected automatically as a result to +parse \(aqsomething\(aq as long as it\(aqs compliant to one of Microsoft/IBM +RIFF/Wave, Sparc AU, Creative Tech. voice formats. If nothing detected, +.I \-r +, +.I \-c +and +.I \-f +should be given, +or +.I \-f +should be given with special format. + +.PP +.in +4n +.EX +.B $ axfer transfer playback \-r 22050 \-c 1 \-f S16_LE \-t raw something +.EE +.in +.PP + +The above will transfer audio data frame in \(aqsomething\(aq file including no +information of sample format, as sample format of 22050 Hz, monaural, signed 16 +bit little endian PCM for playback. The transmission continues till catching +.I SIGINT +from keyboard or +.I SIGTERM +by +.I kill(1) +\&. + +.PP +.in +4n +.EX +.B $ axfer transfer capture \-d 10 \-f cd something.wav +.EE +.in +.PP + +The above will transfer audio data frame to \(aqsomething.wav\(aq file as +sample format of 44.1 kHz, 2 channels, signed 16 bit little endian PCM, during +10 seconds. The file format is Microsoft/IBM RIFF/Wave according to suffix of +the given +.I filepath +\&. + +.PP +.in +4n +.EX +.B $ axfer transfer capture \-s 1024 \-r 48000 \-c 2 \-f S32_BE \-I \-t au channels +.EE +.in +.PP + +The above will transfer audio data frame as sample format of 48.0 kHz, 2 +channels, signed 32 bit big endian PCM for 1,024 number of data frames to files +named \(aqchannels\-1.au\(aq and \(aqchannels\-2.au\(aq. + +.SH SCHEDULING MODEL + +In a design of ALSA PCM core, runtime of PCM substream supports two modes; +.I period\-wakeup +and +.I no\-period\-wakeup. +These two modes are for different scheduling models. + +.SS IRQ\-based scheduling model + +As a default, +.I period\-wakeup +mode is used. In this mode, in\-kernel drivers should operate hardware to +generate periodical notification for transmission of audio data frame. The +interval of notification is equivalent to the same amount of audio data frame +as one period of buffer, against actual time. + +In a handler assigned to the notification, a helper function of ALSA PCM core +is called to update a position to head of hardware transmission, then compare +it with a position to head of application operation to judge overrun/underrun +(XRUN) and to wake up blocked processes. + +For this purpose, hardware IRQ of controller for serial audio bus such as +Inter\-IC sound is typically used. In this case, the controller generates the +IRQ according to transmission on the serial audio bus. In the handler assigned +to the IRQ, direct media access (DMA) transmission is requested between +dedicated host memory and device memory. + +If target hardware doesn't support this kind of mechanism, the periodical +notification should be emulated by any timer; e.g. hrtimer, kernel timer. +External PCM plugins generated by PCM plugin SDK in alsa\-lib should also +emulate the above behaviour. + +In this mode, PCM applications are programmed according to typical way of I/O +operations. They execute blocking system calls to read/write audio data frame +in buffer of PCM substream, or blocking system calls to wait until any audio +data frame is available. In +.I axfer +, this is called +.I IRQ\-based +scheduling model and a default behaviour. Users can explicitly configure this +mode by usage of +.I \-\-sched\-model +option with +.I irq +value. + +.SS Timer\-based scheduling model + +The +.I no\-period\-wakeup +mode is an optional mode of runtime of PCM substream. The mode assumes a +specific feature of hardware and assist of in\-kernel driver and PCM +applications. In this mode, in\-kernel drivers don't operate hardware to +generate periodical notification for transmission of audio data frame. +The hardware should automatically continue transmission of audio data frame +without periodical operation of the drivers; e.g. according to auto\-triggered +DMA transmission, a chain of registered descriptors. + +In this mode, nothing wakes up blocked processes, therefore PCM applications +should be programmed without any blocking operation. For this reason, this mode +is enabled when the PCM applications explicitly configure hardware parameter to +runtime of PCM substream, to prevent disorder of existing applications. +Additionally, nothing maintains timing for transmission of audio data frame, +therefore the PCM applications should voluntarily handle any timer to queue +audio data frame in buffer of the PCM substream for lapse of time. Furthermore, +instead of driver, the PCM application should call a helper function of ALSA +PCM core to update a position to head of hardware transmission and to check +XRUN. + +In +.I axfer +, this is called +.I timer\-based +scheduling model and available as long as hardware/driver assists +.I no\-period\-wakeup +runtime. Users should explicitly set this mode by usage of +.I \-\-sched\-model +option with +.I timer +value. + +In the scheduling model, PCM applications need to care of available space on +PCM buffer by lapse of time, typically by yielding CPU and wait for +rescheduling. For the yielding, timeout is calculated for preferable amount of +PCM frames to process. This is convenient to a kind of applications, like sound +servers. when an I/O thread of the server wait for the timeout, the other +threads can process audio data frames for server clients. Furthermore, with +usage of rewinding/forwarding, applications can achieve low latency between +transmission position and handling position even if they uses large size of +PCM buffers. + +.SS Advantages and issues + +Ideally, timer\-based scheduling model has some advantages than IRQ\-based +scheduling model. At first, no interrupt context runs for PCM substream. The +PCM substream is handled in any process context only. No need to care of race +conditions between IRQ and process contexts. This reduces some concerns for +some developers of drivers and applications. Secondary, CPU time is not used +for handlers on the interrupt context. The CPU time can be dedicated for the +other tasks. This is good in a point of Time Sharing System. Thirdly, hardware +is not configured to generate interrupts. This is good in a point of reduction +of overall power consumption possibly. + +In either scheduling model, the hardware should allow drivers to read the +number of audio data frame transferred between the dedicated memory and the +device memory for audio serial bus. However, in timer\-based scheduling model, +fine granularity and accuracy of the value is important. Actually hardware +performs transmission between dedicated memory and device memory for a small +batch of audio data frames or bytes. In a view of PCM applications, the +granularity in current transmission is required to decide correct timeout for +each I/O operation. As of Linux kernel v4.21, ALSA PCM interface between +kernel/userspace has no feature to report it. + +.SH COMPATIBILITY TO APLAY + +The +.B transfer +subcommand of +.B axfer +is designed to keep compatibility to aplay(1). However some options below are +not compatible due to several technical reasons. + +.TP +.I \-I, \-\-separate\-channels +This option is supported just for files to store audio data frames corresponding +to each channel. In aplay(1) implementation, this option has an additional +effect to use PCM buffer aligned to non\-interleaved order if a target device +supports. As of 2018, PCM buffer of non\-interleaved order is hardly used by +sound devices. + +.TP +.I \-A, \-\-avail\-min=# +This option indicates threshold to wake up blocked process in a unit of +audio data frame. Against aplay(1) implementation, this option has no effect +with +.I \-\-mmap +option as well as +.I timer +of +.I \-\-sched\-model +option. + +.TP +.I \-R, \-\-start\-delay=# +This option indicates threshold to start prepared PCM substream in a unit of +audio data frame. Against aplay(1) implementation, this option has no effect +with +.I \-\-mmap +option as well as +.I timer +of +.I \-\-sched\-model +option. + +.TP +.I \-T, \-\-stop\-delay=# +This option indicates threshold to stop running PCM substream in a unit of +audio data frame. Against aplay(1) implementation, this option has no effect +with +.I \-\-mmap +option as well as +.I timer +of +.I \-\-sched\-model +option. + +.TP +.I \-\-max\-file\-time=# +This option is unsupported. In aplay(1) implementation, the option has an +effect for capture transmission to save files up to the same number of data +frames as the given value by second unit, or the maximum number of data frames +supported by used file format. When reaching to the limitation, used file is +closed, then new file is opened and audio data frames are written. However, this +option requires extra handling of files and shall increase complexity of main +loop of axfer. + +.TP +.I \-\-use\-strftime=FORMAT +This option is unsupported. In aplay(1) implementation, the option has an effect +for capture transmission to generate file paths according to given format in +which some extra formats are available as well as formats supported by +strftime(3). However, this option requires extra string processing for file +paths and it\(aqs bothersome if written in C language. + +.TP +.I \-\-process\-id\-file=FILEPATH +This option is unsupported. In aplay(1) implementation, the option has an effect +to create a file for given value and write out process ID to it. This file +allows users to get process ID and send any POSIX signal to aplay process. +However, this idea has some troubles for file locking when multiple aplay +processes run with the same file. + +.TP +.I \-V, \-\-vumeter=TYPE +This option is not supported at present. In aplay(1) implementation, this option +has an effect to occupy stdout with some terminal control characters and display +vumeter for monaural and stereo channels. However, some problems lay; this +feature is just for audio data frames with PCM format, this feature brings +disorder of terminal after aborting, stdout is not available for pipeline. + +.TP +.I \-i, \-\-interactive +This option is not supported at present. In aplay(1) implementation, this option +has an effect to occupy stdin for key input and suspend/resume PCM substream +according to pushed enter key. However, this feature requires an additional +input handling in main loop and leave bothersome operation to maintain PCM +substream. + +.TP +.I \-m, \-\-chmap=CH1,CH2,... +ALSA PCM core and control core doesn't support this feature, therefore +remapping should be done in userspace. This brings overhead to align audio +data frames, especially for mmap operation. Furthermore, as of alsa-lib v1.1.8, +some plugins don't support this feature expectedly, thus this option is a lack +of transparent operation. At present, this option is not supported yet not to +confuse users. + +.TP +.I SIGTSTP, SIGCONT +This performs suspend/resume of PCM substream. In aplay(1) implementation, +these operations bring XRUN state to the substream, and suspend/resume is done +in interactive mode in the above. Some developers use the signal for recovery +test from XRUN. At present, no alternative is supported for the test. + +.TP +.I SIGUSR1 +This is not supported. In aplay(1) implementation, this signal is assigned to a +handler to close a current file to store audio data frame and open a new file +to continue processing. However, as well as +.I \-\-max\-file\-time +option, this option should increase complexity of main loop of axfer. + +.SH DESIGN + +.SS Modular structure + +This program consists of three modules; +.I xfer +, +.I mapper +and +.I container +\&. +Each module has an abstraction layer to enable actual implementation. + +.nf + -------- ---------- ------------- +device <-> | xfer | <-> | mapper | <-> | container | <-> file + -------- ---------- ------------- + libasound single wav + libffado multiple au + voc + raw +.fi + +The +.I xfer +module performs actual transmission to devices and nodes. The module can have +several transmission backends. As a default backend, +.I libasound +backend is used to perform transmission via alsa\-lib APIs. The module allows +each backend to parse own command line options. + +The +.I container +module performs to read/write audio data frame via descriptor for file/stream +of multimedia container or raw data. The module automatically detect type of +multimedia container and parse parameters in its metadata of data header. At +present, three types of multimedia containers are supported; Microsoft/IBM +RIFF/Wave ( +.I wav +), Sparc AU ( +.I au +) and Creative Technology voice ( +.I voc +). Additionally, a special container is prepared for raw audio data ( +.I raw +). + +The +.I mapper +module handles buffer layout and alignment for transmission of audio data frame. +The module has two implementations; +.I single +and +.I multiple +\&. +The +.I single +backend uses one container to construct the buffer. The +.I multiple +backend uses several containers to construct it. + +.SS Care of copying audio data frame + +Between the +.I xfer +module and +.I mapper +module, a pointer to buffer including audio data frames is passed. This buffer +has two shapes for interleaved and non\-interleaved order. For the former, the +pointer points to one buffer. For the latter, the pointer points to an array in +which each element points to one buffer. Between the +.I mapper +module and +.I container +module, a pointer to one buffer is passed because supported media containers +including raw type store audio data frames in interleaved order. + +In passing audio data frame between the modules, axfer is programmed to avoid +copying between a buffer to another buffer as much as possible. For example, in +some scenarios below, no copying occurs between modules. + + - xfer(mmap/interleaved), mapper(single), container(any) + - xfer(mmap/non\-interleaved), mapper(multiple), containers(any) + +.SS Unit test + +For each of the +.I mapper +and +.I container +module, unit test is available. To run the tests, execute below command: + +.nf +$ make test +.fi + +Each test iterates writing to file and reading to the file for many times and it +takes long time to finish. Please take care of the execution time if running on +any CI environment. + +.SH SEE ALSO +\fB +axfer(1), +axfer\-list(1), +alsamixer(1), +amixer(1) +\fP + +.SH AUTHOR +Takashi Sakamoto diff --git a/axfer/axfer.1 b/axfer/axfer.1 new file mode 100644 index 0000000..3ae9c8e --- /dev/null +++ b/axfer/axfer.1 @@ -0,0 +1,139 @@ +.TH AXFER 1 "28 November 2018" "alsa\-utils" + +.SH NAME +axfer \- command\-line sound recorder and player for sound devices and nodes +supported by Linux sound subsystem (Advanced Linux Sound Architecture, also +known as ALSA). + +.SH SYNOPSYS + +.B axfer +.I subcommand direction options + +subcommand = +.B transfer +| +.B list +| +.B version +| +.B help + +direction = +.B capture +| +.B playback + +options = ( depends on +.I subcommand +) + +.SH DESCRIPTION +The +.B axfer +is a command\-line recorder and player to transfer audio data frame between +sound devices/nodes and files/stdin/stdout. + +.SH OPTIONS + +.SS Subcommand + +.TP +.B transfer +Performs transmission of audio data frame. Its detail is described in +.B axfer\-transfer(1) +manual. + +.TP +.B list +Dumps lists of available sound devices and nodes. Its detail is described in +.B axfer\-list(1) +manual. + +.TP +.B version +Prints version of this application (as the same version as alsa\-utils package). + +.TP +.B help +Prints a short message about subcommands for users to enter this application. + +.SS Direction + +.TP +.B capture +Operates for capture transmission. + +.TP +.B playback +Operates for playback transmission. + +.SH EXIT STATUS + +.I EXIT_SUCCESS +(0) if run time successfully finished, else +.I EXIT_FAILURE +(1). + +.SH UNIT TEST + +This program has unit tests for internal implementation. Please refer to the +manual of +.I axfer-transfer +for details. + +.SH COMPATIBILITY TO APLAY + +The +.I axfer +is designed to be compatible to aplay(1) as much as possible. In command line, +executions of aplay/arecord files under $PATH runs axfer with compatibility +mode if filesystem has symbolic link from the aplay/arecord to axfer. + +.PP +.in +4n +.EX +$ ln \-s aplay axfer +$ ln \-s arecord axfer +.EE +.in +.PP + +.SS A string to which arg[0] points +When args[0] in run time points to string ended with \(aqaplay\(aq, it has the +same meaning of +.I playback +direction. When it points to string ended with \(aqarecord\(aq, it has the same +meaning of +.I capture +direction. + +.SS Options acknowledged as list subcommand +Options of +.I \-l +, +.I \-\-list\-devices +, +.I \-L +, +.I \-\-list\-pcms +are acknowledged as +.I list +subcommand. Without them, the run time performs +.I transfer +subcommand. + +.SH REPORTING BUGS +Report any bugs to mailing list of ALSA community + where the development and maintenance is +primarily done. Bug tracking service of alsa\-utils repository on github.com is +also available. + +.SH SEE ALSO +.B axfer\-transfer(1), +.B axfer\-list(1), +.B alsamixer(1), +.B amixer(1) + +.SH AUTHOR +Takashi Sakamoto diff --git a/axfer/container-au.c b/axfer/container-au.c new file mode 100644 index 0000000..6459b16 --- /dev/null +++ b/axfer/container-au.c @@ -0,0 +1,203 @@ +// SPDX-License-Identifier: GPL-2.0 +// +// container-au.c - a parser/builder for a container of Sun Audio File. +// +// Copyright (c) 2018 Takashi Sakamoto +// +// Licensed under the terms of the GNU General Public License, version 2. + +#include "container.h" +#include "misc.h" + +// Not portable to all of UNIX platforms. +#include + +// Reference: +// * http://pubs.opengroup.org/external/auformat.html + +#define AU_MAGIC ".snd" +#define UNKNOWN_SIZE UINT32_MAX + +enum code_id { + CODE_ID_CCIT_MU_LAW_BE = 0x01, + CODE_ID_GENERIC_MBLA_S8 = 0x02, + CODE_ID_GENERIC_MBLA_S16_BE = 0x03, + CODE_ID_GENERIC_MBLA_S32_BE = 0x05, + CODE_ID_IEEE754_FLOAT_S32_BE = 0x06, + CODE_ID_IEEE754_DOUBLE_S64_BE = 0x07, + CODE_ID_CCIT_ADPCM_G721_4BIT_BE = 0x17, + CODE_ID_CCIT_ADPCM_G723_3BIT_BE = 0x19, + CODE_ID_CCIT_A_LAW_BE = 0x1b, +}; + +struct format_map { + enum code_id code_id; + snd_pcm_format_t format; +}; + +static const struct format_map format_maps[] = { + {CODE_ID_GENERIC_MBLA_S8, SND_PCM_FORMAT_S8}, + {CODE_ID_GENERIC_MBLA_S16_BE, SND_PCM_FORMAT_S16_BE}, + {CODE_ID_GENERIC_MBLA_S32_BE, SND_PCM_FORMAT_S32_BE}, + {CODE_ID_IEEE754_FLOAT_S32_BE, SND_PCM_FORMAT_FLOAT_BE}, + {CODE_ID_IEEE754_DOUBLE_S64_BE, SND_PCM_FORMAT_FLOAT64_BE}, + // CODE_ID_CCIT_ADPCM_G721_4BIT_BE is not supported by ALSA. + // CODE_ID_CCIT_ADPCM_G723_3BIT_BE is not supported due to width of + // its sample. + {CODE_ID_CCIT_A_LAW_BE, SND_PCM_FORMAT_A_LAW}, + {CODE_ID_CCIT_MU_LAW_BE, SND_PCM_FORMAT_MU_LAW}, +}; + +struct container_header { + uint8_t magic[4]; + uint32_t hdr_size; + uint32_t data_size; + uint32_t code_id; + uint32_t frames_per_second; + uint32_t samples_per_frame; +}; + +struct container_annotation { + uint32_t chunks[0]; +}; + +struct parser_state { + enum code_id code_id; + unsigned int samples_per_frame; + unsigned int bytes_per_sample; +}; + +static int au_parser_pre_process(struct container_context *cntr, + snd_pcm_format_t *format, + unsigned int *samples_per_frame, + unsigned int *frames_per_second, + uint64_t *byte_count) +{ + struct parser_state *state = cntr->private_data; + struct container_header header; + enum code_id code_id; + int i; + int err; + + // Parse header. 4 bytes are enough to detect supported containers. + memcpy(&header.magic, cntr->magic, sizeof(cntr->magic)); + err = container_recursive_read(cntr, + (char *)&header + sizeof(cntr->magic), + sizeof(header) - sizeof(cntr->magic)); + if (err < 0) + return err; + if (cntr->eof) + return 0; + + if (memcmp(header.magic, AU_MAGIC, sizeof(header.magic)) != 0) + return -EINVAL; + if (be32toh(header.hdr_size) != sizeof(struct container_header)) + return -EINVAL; + + code_id = be32toh(header.code_id); + for (i = 0; i < ARRAY_SIZE(format_maps); ++i) { + if (format_maps[i].code_id == code_id) + break; + } + if (i == ARRAY_SIZE(format_maps)) + return -EINVAL; + *format = format_maps[i].format; + *frames_per_second = be32toh(header.frames_per_second); + *samples_per_frame = be32toh(header.samples_per_frame); + + state->code_id = code_id; + state->samples_per_frame = *samples_per_frame; + state->bytes_per_sample = snd_pcm_format_physical_width(*format) / 8; + + *byte_count = be32toh(header.data_size); + + return 0; +} + +struct builder_state { + unsigned int bytes_per_sample; + unsigned int samples_per_frame; + unsigned int frames_per_second; + enum code_id code_id; +}; + +static void build_container_header(struct builder_state *state, + struct container_header *header, + unsigned int frames_per_second, + uint64_t byte_count) +{ + memcpy(header->magic, AU_MAGIC, sizeof(header->magic)); + header->hdr_size = htobe32(sizeof(struct container_header)); + header->data_size = htobe32(byte_count); + header->code_id = htobe32(state->code_id); + header->frames_per_second = htobe32(frames_per_second); + header->samples_per_frame = htobe32(state->samples_per_frame); +} + +static int write_container_header(struct container_context *cntr, + uint64_t byte_count) +{ + struct builder_state *state = cntr->private_data; + struct container_header header; + + build_container_header(state, &header, state->frames_per_second, + byte_count); + + return container_recursive_write(cntr, &header, sizeof(header)); +} + +static int au_builder_pre_process(struct container_context *cntr, + snd_pcm_format_t *format, + unsigned int *samples_per_frame, + unsigned int *frames_per_second, + uint64_t *byte_count) +{ + struct builder_state *status = cntr->private_data; + int i; + + for (i = 0; i < ARRAY_SIZE(format_maps); ++i) { + if (format_maps[i].format == *format) + break; + } + if (i == ARRAY_SIZE(format_maps)) + return -EINVAL; + + status->code_id = format_maps[i].code_id; + status->bytes_per_sample = snd_pcm_format_physical_width(*format) / 8; + status->frames_per_second = *frames_per_second; + status->samples_per_frame = *samples_per_frame; + + return write_container_header(cntr, *byte_count); +} + +static int au_builder_post_process(struct container_context *cntr, + uint64_t handled_byte_count) +{ + int err; + + err = container_seek_offset(cntr, 0); + if (err < 0) + return err; + + return write_container_header(cntr, handled_byte_count); +} + +const struct container_parser container_parser_au = { + .format = CONTAINER_FORMAT_AU, + .magic = AU_MAGIC, + .max_size = UINT32_MAX, + .ops = { + .pre_process = au_parser_pre_process, + }, + .private_size = sizeof(struct parser_state), +}; + +const struct container_builder container_builder_au = { + .format = CONTAINER_FORMAT_AU, + .max_size = UINT32_MAX, + .ops = { + .pre_process = au_builder_pre_process, + .post_process = au_builder_post_process, + }, + .private_size = sizeof(struct builder_state), +}; diff --git a/axfer/container-raw.c b/axfer/container-raw.c new file mode 100644 index 0000000..9b0022e --- /dev/null +++ b/axfer/container-raw.c @@ -0,0 +1,66 @@ +// SPDX-License-Identifier: GPL-2.0 +// +// container-raw.c - a parser/builder for a container with raw data frame. +// +// Copyright (c) 2018 Takashi Sakamoto +// +// Licensed under the terms of the GNU General Public License, version 2. + +#include "container.h" +#include "misc.h" + +#include +#include +#include + +static int raw_builder_pre_process(struct container_context *cntr, + snd_pcm_format_t *sample_format, + unsigned int *samples_per_frame, + unsigned int *frames_per_second, + uint64_t *byte_count) +{ + *byte_count = UINT64_MAX; + + return 0; +} + +static int raw_parser_pre_process(struct container_context *cntr, + snd_pcm_format_t *sample_format, + unsigned int *samples_per_frame, + unsigned int *frames_per_second, + uint64_t *byte_count) +{ + struct stat buf = {0}; + int err; + + if (cntr->stdio) { + *byte_count = UINT64_MAX; + return 0; + } + + err = fstat(cntr->fd, &buf); + if (err < 0) + return err; + + *byte_count = buf.st_size; + if (*byte_count == 0) + *byte_count = UINT64_MAX; + + return 0; +} + +const struct container_parser container_parser_raw = { + .format = CONTAINER_FORMAT_RAW, + .max_size = UINT64_MAX, + .ops = { + .pre_process = raw_parser_pre_process, + }, +}; + +const struct container_builder container_builder_raw = { + .format = CONTAINER_FORMAT_RAW, + .max_size = UINT64_MAX, + .ops = { + .pre_process = raw_builder_pre_process, + }, +}; diff --git a/axfer/container-riff-wave.c b/axfer/container-riff-wave.c new file mode 100644 index 0000000..d68401d --- /dev/null +++ b/axfer/container-riff-wave.c @@ -0,0 +1,574 @@ +// SPDX-License-Identifier: GPL-2.0 +// +// container-riff-wave.c - a parser/builder for a container of RIFF/Wave File. +// +// Copyright (c) 2018 Takashi Sakamoto +// +// Licensed under the terms of the GNU General Public License, version 2. + +#include "container.h" +#include "misc.h" + +// Not portable to all of UNIX platforms. +#include + +// References: +// - 'Resource Interchange File Format (RIFF)' at msdn.microsoft.com +// - 'Multiple channel audio data and WAVE files' at msdn.microsoft.com +// - RFC 2361 'WAVE and AVI Codec Registries' at ietf.org +// - 'mmreg.h' in Wine project +// - 'mmreg.h' in ReactOS project + +#define RIFF_MAGIC "RIF" // A common part. + +#define RIFF_CHUNK_ID_LE "RIFF" +#define RIFF_CHUNK_ID_BE "RIFX" +#define RIFF_FORM_WAVE "WAVE" +#define FMT_SUBCHUNK_ID "fmt " +#define DATA_SUBCHUNK_ID "data" + +// See 'WAVE and AVI Codec Registries (Historic Registry)' in 'iana.org'. +// https://www.iana.org/assignments/wave-avi-codec-registry/ +enum wave_format { + WAVE_FORMAT_PCM = 0x0001, + WAVE_FORMAT_ADPCM = 0x0002, + WAVE_FORMAT_IEEE_FLOAT = 0x0003, + WAVE_FORMAT_ALAW = 0x0006, + WAVE_FORMAT_MULAW = 0x0007, + WAVE_FORMAT_G723_ADPCM = 0x0014, + // The others are not supported. +}; + +struct format_map { + enum wave_format wformat; + snd_pcm_format_t format; +}; + +static const struct format_map format_maps[] = { + {WAVE_FORMAT_PCM, SND_PCM_FORMAT_U8}, + {WAVE_FORMAT_PCM, SND_PCM_FORMAT_S16_LE}, + {WAVE_FORMAT_PCM, SND_PCM_FORMAT_S16_BE}, + {WAVE_FORMAT_PCM, SND_PCM_FORMAT_S24_LE}, + {WAVE_FORMAT_PCM, SND_PCM_FORMAT_S24_BE}, + {WAVE_FORMAT_PCM, SND_PCM_FORMAT_S32_LE}, + {WAVE_FORMAT_PCM, SND_PCM_FORMAT_S32_BE}, + {WAVE_FORMAT_PCM, SND_PCM_FORMAT_S24_3LE}, + {WAVE_FORMAT_PCM, SND_PCM_FORMAT_S24_3BE}, + {WAVE_FORMAT_PCM, SND_PCM_FORMAT_S20_3LE}, + {WAVE_FORMAT_PCM, SND_PCM_FORMAT_S20_3BE}, + {WAVE_FORMAT_PCM, SND_PCM_FORMAT_S18_3LE}, + {WAVE_FORMAT_PCM, SND_PCM_FORMAT_S18_3BE}, + {WAVE_FORMAT_IEEE_FLOAT, SND_PCM_FORMAT_FLOAT_LE}, + {WAVE_FORMAT_IEEE_FLOAT, SND_PCM_FORMAT_FLOAT_BE}, + {WAVE_FORMAT_IEEE_FLOAT, SND_PCM_FORMAT_FLOAT64_LE}, + {WAVE_FORMAT_IEEE_FLOAT, SND_PCM_FORMAT_FLOAT64_BE}, + {WAVE_FORMAT_ALAW, SND_PCM_FORMAT_A_LAW}, + {WAVE_FORMAT_MULAW, SND_PCM_FORMAT_MU_LAW}, + // Below sample formats are not currently supported, due to width of + // its sample. + // - WAVE_FORMAT_ADPCM + // - WAVE_FORMAT_G723_ADPCM + // - WAVE_FORMAT_G723_ADPCM + // - WAVE_FORMAT_G723_ADPCM + // - WAVE_FORMAT_G723_ADPCM +}; + +struct riff_chunk { + uint8_t id[4]; + uint32_t size; + + uint8_t data[0]; +}; + +struct riff_chunk_data { + uint8_t id[4]; + + uint8_t subchunks[0]; +}; + +struct riff_subchunk { + uint8_t id[4]; + uint32_t size; + + uint8_t data[0]; +}; + +struct wave_fmt_subchunk { + uint8_t id[4]; + uint32_t size; + + uint16_t format; + uint16_t samples_per_frame; + uint32_t frames_per_second; + uint32_t average_bytes_per_second; + uint16_t bytes_per_frame; + uint16_t bits_per_sample; + uint8_t extension[0]; +}; + +struct wave_data_subchunk { + uint8_t id[4]; + uint32_t size; + + uint8_t frames[0]; +}; + +struct parser_state { + bool be; + enum wave_format format; + unsigned int samples_per_frame; + unsigned int frames_per_second; + unsigned int average_bytes_per_second; + unsigned int bytes_per_frame; + unsigned int bytes_per_sample; + unsigned int avail_bits_in_sample; + unsigned int byte_count; +}; + +static int parse_riff_chunk_header(struct parser_state *state, + struct riff_chunk *chunk, + uint64_t *byte_count) +{ + if (!memcmp(chunk->id, RIFF_CHUNK_ID_BE, sizeof(chunk->id))) + state->be = true; + else if (!memcmp(chunk->id, RIFF_CHUNK_ID_LE, sizeof(chunk->id))) + state->be = false; + else + return -EINVAL; + + if (state->be) + *byte_count = be32toh(chunk->size); + else + *byte_count = le32toh(chunk->size); + + return 0; +} + +static int parse_riff_chunk(struct container_context *cntr, + uint64_t *byte_count) +{ + struct parser_state *state = cntr->private_data; + union { + struct riff_chunk chunk; + struct riff_chunk_data chunk_data; + } buf = {0}; + int err; + + // Chunk header. 4 bytes were alread read to detect container type. + memcpy(buf.chunk.id, cntr->magic, sizeof(cntr->magic)); + err = container_recursive_read(cntr, + (char *)&buf.chunk + sizeof(cntr->magic), + sizeof(buf.chunk) - sizeof(cntr->magic)); + if (err < 0) + return err; + if (cntr->eof) + return 0; + + err = parse_riff_chunk_header(state, &buf.chunk, byte_count); + if (err < 0) + return err; + + // Chunk data header. + err = container_recursive_read(cntr, &buf, sizeof(buf.chunk_data)); + if (err < 0) + return err; + if (cntr->eof) + return 0; + + if (memcmp(buf.chunk_data.id, RIFF_FORM_WAVE, + sizeof(buf.chunk_data.id))) + return -EINVAL; + + return 0; +} + +static int parse_wave_fmt_subchunk(struct parser_state *state, + struct wave_fmt_subchunk *subchunk) +{ + if (state->be) { + state->format = be16toh(subchunk->format); + state->samples_per_frame = be16toh(subchunk->samples_per_frame); + state->frames_per_second = be32toh(subchunk->frames_per_second); + state->average_bytes_per_second = + be32toh(subchunk->average_bytes_per_second); + state->bytes_per_frame = be16toh(subchunk->bytes_per_frame); + state->avail_bits_in_sample = + be16toh(subchunk->bits_per_sample); + } else { + state->format = le16toh(subchunk->format); + state->samples_per_frame = le16toh(subchunk->samples_per_frame); + state->frames_per_second = le32toh(subchunk->frames_per_second); + state->average_bytes_per_second = + le32toh(subchunk->average_bytes_per_second); + state->bytes_per_frame = le16toh(subchunk->bytes_per_frame); + state->avail_bits_in_sample = + le16toh(subchunk->bits_per_sample); + } + + if (state->average_bytes_per_second != + state->bytes_per_frame * state->frames_per_second) + return -EINVAL; + + return 0; +} + +static int parse_wave_data_subchunk(struct parser_state *state, + struct wave_data_subchunk *subchunk) +{ + if (state->be) + state->byte_count = be32toh(subchunk->size); + else + state->byte_count = le32toh(subchunk->size); + + return 0; +} + +static int parse_wave_subchunk(struct container_context *cntr) +{ + union { + struct riff_subchunk subchunk; + struct wave_fmt_subchunk fmt_subchunk; + struct wave_data_subchunk data_subchunk; + } buf = {0}; + enum { + SUBCHUNK_TYPE_UNKNOWN = -1, + SUBCHUNK_TYPE_FMT, + SUBCHUNK_TYPE_DATA, + } subchunk_type; + struct parser_state *state = cntr->private_data; + unsigned int required_size; + unsigned int subchunk_data_size; + int err; + + while (1) { + err = container_recursive_read(cntr, &buf, + sizeof(buf.subchunk)); + if (err < 0) + return err; + if (cntr->eof) + return 0; + + // Calculate the size of subchunk data. + if (state->be) + subchunk_data_size = be32toh(buf.subchunk.size); + else + subchunk_data_size = le32toh(buf.subchunk.size); + + // Detect type of subchunk. + if (!memcmp(buf.subchunk.id, FMT_SUBCHUNK_ID, + sizeof(buf.subchunk.id))) { + subchunk_type = SUBCHUNK_TYPE_FMT; + } else if (!memcmp(buf.subchunk.id, DATA_SUBCHUNK_ID, + sizeof(buf.subchunk.id))) { + subchunk_type = SUBCHUNK_TYPE_DATA; + } else { + subchunk_type = SUBCHUNK_TYPE_UNKNOWN; + } + + if (subchunk_type != SUBCHUNK_TYPE_UNKNOWN) { + // Parse data of this subchunk. + if (subchunk_type == SUBCHUNK_TYPE_FMT) { + required_size = + sizeof(struct wave_fmt_subchunk) - + sizeof(struct riff_chunk); + } else { + required_size = + sizeof(struct wave_data_subchunk)- + sizeof(struct riff_chunk); + } + + if (subchunk_data_size < required_size) + return -EINVAL; + + err = container_recursive_read(cntr, &buf.subchunk.data, + required_size); + if (err < 0) + return err; + if (cntr->eof) + return 0; + subchunk_data_size -= required_size; + + if (subchunk_type == SUBCHUNK_TYPE_FMT) { + err = parse_wave_fmt_subchunk(state, + &buf.fmt_subchunk); + } else if (subchunk_type == SUBCHUNK_TYPE_DATA) { + err = parse_wave_data_subchunk(state, + &buf.data_subchunk); + } + if (err < 0) + return err; + + // Found frame data. + if (subchunk_type == SUBCHUNK_TYPE_DATA) + break; + } + + // Go to next subchunk. + while (subchunk_data_size > 0) { + unsigned int consume; + + if (subchunk_data_size > sizeof(buf)) + consume = sizeof(buf); + else + consume = subchunk_data_size; + + err = container_recursive_read(cntr, &buf, consume); + if (err < 0) + return err; + if (cntr->eof) + return 0; + subchunk_data_size -= consume; + } + } + + return 0; +} + +static int parse_riff_wave_format(struct container_context *cntr) +{ + uint64_t byte_count; + int err; + + err = parse_riff_chunk(cntr, &byte_count); + if (err < 0) + return err; + + err = parse_wave_subchunk(cntr); + if (err < 0) + return err; + + return 0; +} + +static int wave_parser_pre_process(struct container_context *cntr, + snd_pcm_format_t *format, + unsigned int *samples_per_frame, + unsigned int *frames_per_second, + uint64_t *byte_count) +{ + struct parser_state *state = cntr->private_data; + int phys_width; + const struct format_map *map; + int i; + int err; + + err = parse_riff_wave_format(cntr); + if (err < 0) + return err; + + phys_width = 8 * state->average_bytes_per_second / + state->samples_per_frame / state->frames_per_second; + + for (i = 0; i < ARRAY_SIZE(format_maps); ++i) { + map = &format_maps[i]; + if (state->format != map->wformat) + continue; + if (state->avail_bits_in_sample != + snd_pcm_format_width(map->format)) + continue; + if (phys_width != snd_pcm_format_physical_width(map->format)) + continue; + + if (state->be && snd_pcm_format_big_endian(map->format) != 1) + continue; + + break; + } + if (i == ARRAY_SIZE(format_maps)) + return -EINVAL; + + // Set parameters. + *format = format_maps[i].format; + *samples_per_frame = state->samples_per_frame; + *frames_per_second = state->frames_per_second; + *byte_count = state->byte_count; + + return 0; +} + +struct builder_state { + bool be; + enum wave_format format; + unsigned int avail_bits_in_sample; + unsigned int bytes_per_sample; + unsigned int samples_per_frame; + unsigned int frames_per_second; +}; + +static void build_riff_chunk_header(struct riff_chunk *chunk, + uint64_t byte_count, bool be) +{ + uint64_t data_size = sizeof(struct riff_chunk_data) + + sizeof(struct wave_fmt_subchunk) + + sizeof(struct wave_data_subchunk) + byte_count; + + if (be) { + memcpy(chunk->id, RIFF_CHUNK_ID_BE, sizeof(chunk->id)); + chunk->size = htobe32(data_size); + } else { + memcpy(chunk->id, RIFF_CHUNK_ID_LE, sizeof(chunk->id)); + chunk->size = htole32(data_size); + } +} + +static void build_subchunk_header(struct riff_subchunk *subchunk, + const char *const form, uint64_t size, + bool be) +{ + memcpy(subchunk->id, form, sizeof(subchunk->id)); + if (be) + subchunk->size = htobe32(size); + else + subchunk->size = htole32(size); +} + +static void build_wave_format_subchunk(struct wave_fmt_subchunk *subchunk, + struct builder_state *state) +{ + unsigned int bytes_per_frame = + state->bytes_per_sample * state->samples_per_frame; + unsigned int average_bytes_per_second = state->bytes_per_sample * + state->samples_per_frame * state->frames_per_second; + uint64_t size; + + // No extensions. + size = sizeof(struct wave_fmt_subchunk) - sizeof(struct riff_subchunk); + build_subchunk_header((struct riff_subchunk *)subchunk, FMT_SUBCHUNK_ID, + size, state->be); + + if (state->be) { + subchunk->format = htobe16(state->format); + subchunk->samples_per_frame = htobe16(state->samples_per_frame); + subchunk->frames_per_second = htobe32(state->frames_per_second); + subchunk->average_bytes_per_second = + htobe32(average_bytes_per_second); + subchunk->bytes_per_frame = htobe16(bytes_per_frame); + subchunk->bits_per_sample = + htobe16(state->avail_bits_in_sample); + } else { + subchunk->format = htole16(state->format); + subchunk->samples_per_frame = htole16(state->samples_per_frame); + subchunk->frames_per_second = htole32(state->frames_per_second); + subchunk->average_bytes_per_second = + htole32(average_bytes_per_second); + subchunk->bytes_per_frame = htole16(bytes_per_frame); + subchunk->bits_per_sample = + htole16(state->avail_bits_in_sample); + } +} + +static void build_wave_data_subchunk(struct wave_data_subchunk *subchunk, + uint64_t byte_count, bool be) +{ + build_subchunk_header((struct riff_subchunk *)subchunk, + DATA_SUBCHUNK_ID, byte_count, be); +} + +static int write_riff_chunk_for_wave(struct container_context *cntr, + uint64_t byte_count) +{ + struct builder_state *state = cntr->private_data; + union { + struct riff_chunk chunk; + struct riff_chunk_data chunk_data; + struct wave_fmt_subchunk fmt_subchunk; + struct wave_data_subchunk data_subchunk; + } buf = {0}; + uint64_t total_byte_count; + int err; + + // Chunk header. + total_byte_count = sizeof(struct riff_chunk_data) + + sizeof(struct wave_fmt_subchunk) + + sizeof(struct wave_data_subchunk); + if (byte_count > cntr->max_size - total_byte_count) + total_byte_count = cntr->max_size; + else + total_byte_count += byte_count; + build_riff_chunk_header(&buf.chunk, total_byte_count, state->be); + err = container_recursive_write(cntr, &buf, sizeof(buf.chunk)); + if (err < 0) + return err; + + // Chunk data header. + memcpy(buf.chunk_data.id, RIFF_FORM_WAVE, sizeof(buf.chunk_data.id)); + err = container_recursive_write(cntr, &buf, sizeof(buf.chunk_data)); + if (err < 0) + return err; + + // A subchunk in the chunk data for WAVE format. + build_wave_format_subchunk(&buf.fmt_subchunk, state); + err = container_recursive_write(cntr, &buf, sizeof(buf.fmt_subchunk)); + if (err < 0) + return err; + + // A subchunk in the chunk data for WAVE data. + build_wave_data_subchunk(&buf.data_subchunk, byte_count, state->be); + return container_recursive_write(cntr, &buf, sizeof(buf.data_subchunk)); +} + +static int wave_builder_pre_process(struct container_context *cntr, + snd_pcm_format_t *format, + unsigned int *samples_per_frame, + unsigned int *frames_per_second, + uint64_t *byte_count) +{ + struct builder_state *state = cntr->private_data; + int i; + + // Validate parameters. + for (i = 0; i < ARRAY_SIZE(format_maps); ++i) { + if (format_maps[i].format == *format) + break; + } + if (i == ARRAY_SIZE(format_maps)) + return -EINVAL; + + state->format = format_maps[i].wformat; + state->avail_bits_in_sample = snd_pcm_format_width(*format); + state->bytes_per_sample = snd_pcm_format_physical_width(*format) / 8; + state->samples_per_frame = *samples_per_frame; + state->frames_per_second = *frames_per_second; + + state->be = (snd_pcm_format_big_endian(*format) == 1); + + return write_riff_chunk_for_wave(cntr, *byte_count); +} + +static int wave_builder_post_process(struct container_context *cntr, + uint64_t handled_byte_count) +{ + int err; + + err = container_seek_offset(cntr, 0); + if (err < 0) + return err; + + return write_riff_chunk_for_wave(cntr, handled_byte_count); +} + +const struct container_parser container_parser_riff_wave = { + .format = CONTAINER_FORMAT_RIFF_WAVE, + .magic = RIFF_MAGIC, + .max_size = UINT32_MAX - + sizeof(struct riff_chunk_data) - + sizeof(struct wave_fmt_subchunk) - + sizeof(struct wave_data_subchunk), + .ops = { + .pre_process = wave_parser_pre_process, + }, + .private_size = sizeof(struct parser_state), +}; + +const struct container_builder container_builder_riff_wave = { + .format = CONTAINER_FORMAT_RIFF_WAVE, + .max_size = UINT32_MAX - + sizeof(struct riff_chunk_data) - + sizeof(struct wave_fmt_subchunk) - + sizeof(struct wave_data_subchunk), + .ops = { + .pre_process = wave_builder_pre_process, + .post_process = wave_builder_post_process, + }, + .private_size = sizeof(struct builder_state), +}; diff --git a/axfer/container-voc.c b/axfer/container-voc.c new file mode 100644 index 0000000..ec0cfff --- /dev/null +++ b/axfer/container-voc.c @@ -0,0 +1,835 @@ +// SPDX-License-Identifier: GPL-2.0 +// +// container-voc.c - a parser/builder for a container of Creative Voice File. +// +// Copyright (c) 2018 Takashi Sakamoto +// +// Licensed under the terms of the GNU General Public License, version 2. + +#include "container.h" +#include "misc.h" + +// Not portable to all of UNIX platforms. +#include + +// References: +// - http://sox.sourceforge.net/ + +#define VOC_MAGIC "Creative Voice File\x1a" +#define VOC_VERSION_1_10 0x010a +#define VOC_VERSION_1_20 0x0114 + +enum block_type { + BLOCK_TYPE_TERMINATOR = 0x00, + BLOCK_TYPE_V110_DATA = 0x01, + BLOCK_TYPE_CONTINUOUS_DATA = 0x02, + BLOCK_TYPE_SILENCE = 0x03, + BLOCK_TYPE_MARKER = 0x04, + BLOCK_TYPE_STRING = 0x05, + BLOCK_TYPE_REPEAT_START = 0x06, + BLOCK_TYPE_REPEAT_END = 0x07, + BLOCK_TYPE_EXTENDED_V110_FORMAT = 0x08, + BLOCK_TYPE_V120_DATA = 0x09, +}; + +enum code_id { + // Version 1.10. + CODE_ID_GENERIC_MBLA_U8 = 0x00, + CODE_ID_CREATIVE_ADPCM_8BIT_TO_4BIT_LE = 0x01, + CODE_ID_CREATIVE_ADPCM_8BIT_TO_3BIT_LE = 0x02, + CODE_ID_CREATIVE_ADPCM_8BIT_TO_2BIT_LE = 0x03, + // Version 1.20. + CODE_ID_GENERIC_MBLA_S16_LE = 0x04, + CODE_ID_CCIT_A_LAW_LE = 0x06, + CODE_ID_CCIT_MU_LAW_LE = 0x07, + CODE_ID_CREATIVE_ADPCM_16BIT_TO_4BIT_LE = 0x2000, +}; + +struct format_map { + unsigned int minimal_version; + enum code_id code_id; + snd_pcm_format_t format; +}; + +static const struct format_map format_maps[] = { + {VOC_VERSION_1_10, CODE_ID_GENERIC_MBLA_U8, SND_PCM_FORMAT_U8}, + {VOC_VERSION_1_20, CODE_ID_GENERIC_MBLA_S16_LE, SND_PCM_FORMAT_S16_LE}, + {VOC_VERSION_1_20, CODE_ID_CCIT_A_LAW_LE, SND_PCM_FORMAT_A_LAW}, + {VOC_VERSION_1_20, CODE_ID_CCIT_MU_LAW_LE, SND_PCM_FORMAT_MU_LAW}, + // The other formats are not supported by ALSA. +}; + +struct container_header { + uint8_t magic[20]; + uint16_t hdr_size; + uint16_t version; + uint16_t version_compr; +}; + +// A format for data blocks except for terminator type. +struct block_header { + uint8_t type; + uint8_t size[3]; + + uint8_t data[0]; +}; + +// Data block for terminator type has an exceptional format. +struct block_terminator { + uint8_t type; +}; + +struct time_const { + unsigned int frames_per_second; + uint16_t code; +}; + +static const struct time_const v110_time_consts[] = { + {5512, 74}, + {8000, 130}, + {11025, 165}, + {16000, 193}, + {22050, 210}, + {32000, 224}, + {44100, 233}, + {48000, 235}, + {64000, 240}, + // Time constant for the upper sampling rate is not identical. +}; + +static const struct time_const ex_v110_time_consts[] = { + {5512, 19092}, + {8000, 33536}, + {11025, 42317}, + {16000, 49536}, + {22050, 53927}, + {32000, 57536}, + {44100, 59732}, + {48000, 60203}, + {64000, 61536}, + {88200, 62634}, + {96000, 62870}, + {176400, 64085}, + {192000, 64203}, + // This support up to 192.0 kHz. The rest is for cases with 2ch. + {352800, 64811}, + {384000, 64870}, +}; + +// v1.10 format: +// - monaural. +// - frames_per_second = 1,000,000 / (256 - time_const) +struct block_v110_data { + uint8_t type; + uint8_t size[3]; // Equals to (2 + the size of frames). + + uint8_t time_const; + uint8_t code_id; + uint8_t frames[0]; // Aligned to little-endian. +}; + +struct block_continuous_data { + uint8_t type; + uint8_t size[3]; // Equals to the size of frames. + + uint8_t frames[0]; // Aligned to little-endian. +}; + +// v1.10 format: +// - monaural. +// - frames_per_second = 1,000,000 / (256 - time_const). +struct block_silence { + uint8_t type; + uint8_t size[3]; // Equals to 3. + + uint16_t frame_count; + uint8_t time_const; +}; + +struct block_marker { + uint8_t type; + uint8_t size[3]; // Equals to 2. + + uint16_t mark; +}; + +struct block_string { + uint8_t type; + uint8_t size[3]; // Equals to the length of string with 0x00. + + uint8_t chars[0]; +}; + +struct block_repeat_start { + uint8_t type; + uint8_t size[3]; // Equals to 2. + + uint16_t count; +}; + +struct block_repeat_end { + uint8_t type; + uint8_t size[3]; // Equals to 0. +}; + +// Extended v1.10 format: +// - manaural/stereo. +// - frames_per_second = +// 256,000,000 / (samples_per_frame * (65536 - time_const)). +// - Appear just before v110_data block. +struct block_extended_v110_format { + uint8_t type; + uint8_t size[3]; // Equals to 4. + + uint16_t time_const; + uint8_t code_id; + uint8_t ch_mode; // 0 is monaural, 1 is stereo. +}; + +// v1.20 format: +// - monaural/stereo. +// - 8/16 bits_per_sample. +// - time_const is not used. +// - code_id is extended. +struct block_v120_format { + uint8_t type; + uint8_t size[3]; // Equals to (12 + ). + + uint32_t frames_per_second; + uint8_t bits_per_sample; + uint8_t samples_per_frame; + uint16_t code_id; + uint8_t reserved[4]; + + uint8_t frames[0]; // Aligned to little-endian. +}; + +// Aligned to little endian order but 24 bits field. +static uint32_t parse_block_data_size(uint8_t fields[3]) +{ + return (fields[2] << 16) | (fields[1] << 8) | fields[0]; +} + +static void build_block_data_size(uint8_t fields[3], unsigned int size) +{ + fields[0] = (size & 0x0000ff); + fields[1] = (size & 0x00ff00) >> 8; + fields[2] = (size & 0xff0000) >> 16; +} + +static int build_time_constant(unsigned int frames_per_second, + unsigned int samples_per_frame, uint16_t *code, + bool extended) +{ + int i; + + // 16 bits are available for this purpose. + if (extended) { + if (samples_per_frame > 2) + return -EINVAL; + frames_per_second *= samples_per_frame; + + for (i = 0; i < ARRAY_SIZE(ex_v110_time_consts); ++i) { + if (ex_v110_time_consts[i].frames_per_second == + frames_per_second) + break; + } + if (i < ARRAY_SIZE(ex_v110_time_consts) && + frames_per_second <= 192000) { + *code = ex_v110_time_consts[i].code; + } else { + *code = 65536 - 256000000 / frames_per_second; + } + } else { + if (samples_per_frame != 1) + return -EINVAL; + + for (i = 0; i < ARRAY_SIZE(v110_time_consts); ++i) { + if (v110_time_consts[i].frames_per_second == + frames_per_second) + break; + } + // Should be within 8 bit. + if (i < ARRAY_SIZE(v110_time_consts)) + *code = (uint8_t)v110_time_consts[i].code; + else + *code = 256 - 1000000 / frames_per_second; + } + + return 0; +} + +static unsigned int parse_time_constant(uint16_t code, + unsigned int samples_per_frame, + unsigned int *frames_per_second, + bool extended) +{ + int i; + + if (extended) { + if (samples_per_frame > 2) + return -EINVAL; + + for (i = 0; i < ARRAY_SIZE(ex_v110_time_consts); ++i) { + if (ex_v110_time_consts[i].code == code || + ex_v110_time_consts[i].code - 1 == code) + break; + } + if (i < ARRAY_SIZE(ex_v110_time_consts)) { + *frames_per_second = + ex_v110_time_consts[i].frames_per_second / + samples_per_frame; + } else { + *frames_per_second = 256000000 / samples_per_frame / + (65536 - code); + } + } else { + if (samples_per_frame != 1) + return -EINVAL; + + for (i = 0; i < ARRAY_SIZE(v110_time_consts); ++i) { + if (v110_time_consts[i].code == code || + v110_time_consts[i].code - 1 == code) + break; + } + if (i < ARRAY_SIZE(v110_time_consts)) { + *frames_per_second = + v110_time_consts[i].frames_per_second; + } else { + *frames_per_second = 1000000 / (256 - code); + } + } + + return 0; +} + +struct parser_state { + unsigned int version; + bool extended; + + unsigned int frames_per_second; + unsigned int samples_per_frame; + unsigned int bytes_per_sample; + enum code_id code_id; + uint32_t byte_count; +}; + +static int parse_container_header(struct parser_state *state, + struct container_header *header) +{ + uint16_t hdr_size; + uint16_t version; + uint16_t version_compr; + + hdr_size = le16toh(header->hdr_size); + version = le16toh(header->version); + version_compr = le16toh(header->version_compr); + + if (memcmp(header->magic, VOC_MAGIC, sizeof(header->magic))) + return -EIO; + + if (hdr_size != sizeof(*header)) + return -EIO; + + if (version_compr != 0x1234 + ~version) + return -EIO; + + if (version != VOC_VERSION_1_10 && version != VOC_VERSION_1_20) + return -EIO; + + state->version = version; + + return 0; +} + +static bool check_code_id(uint8_t code_id, unsigned int version) +{ + int i; + + for (i = 0; i < ARRAY_SIZE(format_maps); ++i) { + if (code_id != format_maps[i].code_id) + continue; + if (version >= format_maps[i].minimal_version) + return true; + } + + return false; +} + +static int parse_v120_format_block(struct parser_state *state, + struct block_v120_format *block) +{ + state->frames_per_second = le32toh(block->frames_per_second); + state->bytes_per_sample = block->bits_per_sample / 8; + state->samples_per_frame = block->samples_per_frame; + state->code_id = le16toh(block->code_id); + state->byte_count = parse_block_data_size(block->size) - 12; + + if (!check_code_id(state->code_id, VOC_VERSION_1_20)) + return -EIO; + + return 0; +} + +static int parse_extended_v110_format(struct parser_state *state, + struct block_extended_v110_format *block) +{ + unsigned int time_const; + unsigned int frames_per_second; + int err; + + state->code_id = block->code_id; + if (!check_code_id(state->code_id, VOC_VERSION_1_10)) + return -EIO; + + if (block->ch_mode == 0) + state->samples_per_frame = 1; + else if (block->ch_mode == 1) + state->samples_per_frame = 2; + else + return -EIO; + + time_const = le16toh(block->time_const); + err = parse_time_constant(time_const, state->samples_per_frame, + &frames_per_second, true); + if (err < 0) + return err; + state->frames_per_second = frames_per_second; + + state->extended = true; + + return 0; +} + +static int parse_v110_data(struct parser_state *state, + struct block_v110_data *block) +{ + unsigned int time_const; + unsigned int frames_per_second; + int err; + + if (!state->extended) { + state->code_id = block->code_id; + if (!check_code_id(state->code_id, VOC_VERSION_1_10)) + return -EIO; + + time_const = block->time_const; + err = parse_time_constant(time_const, 1, &frames_per_second, + false); + if (err < 0) + return err; + state->frames_per_second = frames_per_second; + state->samples_per_frame = 1; + } + + state->bytes_per_sample = 1; + state->byte_count = parse_block_data_size(block->size) - 2; + + return 0; +} + +static int detect_container_version(struct container_context *cntr) +{ + struct parser_state *state = cntr->private_data; + struct container_header header = {0}; + int err; + + // 4 bytes were alread read to detect container type. + memcpy(&header.magic, cntr->magic, sizeof(cntr->magic)); + err = container_recursive_read(cntr, + (char *)&header + sizeof(cntr->magic), + sizeof(header) - sizeof(cntr->magic)); + if (err < 0) + return err; + if (cntr->eof) + return 0; + + return parse_container_header(state, &header); +} + +static int allocate_for_block_cache(struct container_context *cntr, + struct block_header *header, void **buf) +{ + uint32_t block_size; + char *cache; + int err; + + if (header->type == BLOCK_TYPE_V110_DATA) + block_size = sizeof(struct block_v110_data); + else if (header->type == BLOCK_TYPE_CONTINUOUS_DATA) + block_size = sizeof(struct block_continuous_data); + else if (header->type == BLOCK_TYPE_EXTENDED_V110_FORMAT) + block_size = sizeof(struct block_extended_v110_format); + else if (header->type == BLOCK_TYPE_V120_DATA) + block_size = sizeof(struct block_v120_format); + else + block_size = parse_block_data_size(header->size); + + cache = malloc(block_size); + if (cache == NULL) + return -ENOMEM; + memset(cache, 0, block_size); + + memcpy(cache, header, sizeof(*header)); + err = container_recursive_read(cntr, cache + sizeof(*header), + block_size - sizeof(*header)); + if (err < 0) { + free(cache); + return err; + } + if (cntr->eof) { + free(cache); + return 0; + } + + *buf = cache; + + return 0; +} + +static int cache_data_block(struct container_context *cntr, + struct block_header *header, void **buf) +{ + int err; + + // Check type of this block. + err = container_recursive_read(cntr, &header->type, + sizeof(header->type)); + if (err < 0) + return err; + if (cntr->eof) + return 0; + + if (header->type > BLOCK_TYPE_V120_DATA) + return -EIO; + if (header->type == BLOCK_TYPE_TERMINATOR) + return 0; + + // Check size of this block. If the block includes a batch of data, + err = container_recursive_read(cntr, &header->size, + sizeof(header->size)); + if (err < 0) + return err; + if (cntr->eof) + return 0; + + return allocate_for_block_cache(cntr, header, buf); +} + +static int detect_format_block(struct container_context *cntr) +{ + struct parser_state *state = cntr->private_data; + struct block_header header; + void *buf; + int err; + +again: + buf = NULL; + err = cache_data_block(cntr, &header, &buf); + if (err < 0) + return err; + if (buf) { + if (header.type == BLOCK_TYPE_EXTENDED_V110_FORMAT) { + err = parse_extended_v110_format(state, buf); + } else if (header.type == BLOCK_TYPE_V120_DATA) { + err = parse_v120_format_block(state, buf); + } else if (header.type == BLOCK_TYPE_V110_DATA) { + err = parse_v110_data(state, buf); + } else { + free(buf); + goto again; + } + + free(buf); + + if (err < 0) + return err; + } + + // Expect to detect block_v110_data. + if (header.type == BLOCK_TYPE_EXTENDED_V110_FORMAT) + goto again; + + return 0; +} + +static int voc_parser_pre_process(struct container_context *cntr, + snd_pcm_format_t *format, + unsigned int *samples_per_frame, + unsigned int *frames_per_second, + uint64_t *byte_count) +{ + struct parser_state *state = cntr->private_data; + int i; + int err; + + err = detect_container_version(cntr); + if (err < 0) + return err; + + err = detect_format_block(cntr); + if (err < 0) + return err; + + for (i = 0; i < ARRAY_SIZE(format_maps); ++i) { + if (format_maps[i].code_id == state->code_id) + break; + } + if (i == ARRAY_SIZE(format_maps)) + return -EINVAL; + + *format = format_maps[i].format; + *samples_per_frame = state->samples_per_frame; + *frames_per_second = state->frames_per_second; + + // This program handles PCM frames in this data block only. + *byte_count = state->byte_count; + + return 0; +} + +struct builder_state { + unsigned int version; + bool extended; + enum code_id code_id; + + unsigned int samples_per_frame; + unsigned int bytes_per_sample; +}; + +static int write_container_header(struct container_context *cntr, + struct container_header *header) +{ + struct builder_state *state = cntr->private_data; + + // Process container header. + memcpy(header->magic, VOC_MAGIC, sizeof(header->magic)); + header->hdr_size = htole16(sizeof(*header)); + header->version = htole16(state->version); + header->version_compr = htole16(0x1234 + ~state->version); + + return container_recursive_write(cntr, header, sizeof(*header)); +} + +static int write_v120_format_block(struct container_context *cntr, + struct block_v120_format *block, + unsigned int frames_per_second, + uint64_t byte_count) +{ + struct builder_state *state = cntr->private_data; + + block->type = BLOCK_TYPE_V120_DATA; + build_block_data_size(block->size, 12 + byte_count); + + block->frames_per_second = htole32(frames_per_second); + block->bits_per_sample = state->bytes_per_sample * 8; + block->samples_per_frame = state->samples_per_frame; + block->code_id = htole16(state->code_id); + + return container_recursive_write(cntr, block, sizeof(*block)); +} + +static int write_extended_v110_format_block(struct container_context *cntr, + unsigned int frames_per_second, + struct block_extended_v110_format *block) +{ + struct builder_state *state = cntr->private_data; + uint16_t time_const; + int err; + + block->type = BLOCK_TYPE_EXTENDED_V110_FORMAT; + build_block_data_size(block->size, 4); + + // 16 bits are available for this purpose. + err = build_time_constant(frames_per_second, state->samples_per_frame, + &time_const, true); + if (err < 0) + return err; + block->time_const = htole16(time_const); + block->code_id = htole16(state->code_id); + + if (state->samples_per_frame == 1) + block->ch_mode = 0; + else + block->ch_mode = 1; + + return container_recursive_write(cntr, block, sizeof(*block)); +} + +static int write_v110_format_block(struct container_context *cntr, + struct block_v110_data *block, + unsigned int frames_per_second, + uint64_t byte_count) +{ + struct builder_state *state = cntr->private_data; + uint16_t time_const; + int err; + + block->type = BLOCK_TYPE_V110_DATA; + build_block_data_size(block->size, 2 + byte_count); + + // These fields were obsoleted by extension. + err = build_time_constant(frames_per_second, 1, &time_const, false); + if (err < 0) + return err; + block->time_const = (uint8_t)time_const; + block->code_id = state->code_id; + return container_recursive_write(cntr, block, sizeof(*block)); +} + +static int write_data_blocks(struct container_context *cntr, + unsigned int frames_per_second, + uint64_t byte_count) +{ + union { + struct container_header header; + struct block_v110_data v110_data; + struct block_extended_v110_format extended_v110_format; + struct block_v120_format v120_format; + } buf = {0}; + struct builder_state *state = cntr->private_data; + int err; + + err = write_container_header(cntr, &buf.header); + if (err < 0) + return err; + + if (state->version == VOC_VERSION_1_20) { + err = write_v120_format_block(cntr, &buf.v120_format, + frames_per_second, byte_count); + } else { + if (state->extended) { + err = write_extended_v110_format_block(cntr, + frames_per_second, + &buf.extended_v110_format); + if (err < 0) + return err; + } + err = write_v110_format_block(cntr, &buf.v110_data, + frames_per_second, byte_count); + } + + return err; +} + +static int voc_builder_pre_process(struct container_context *cntr, + snd_pcm_format_t *format, + unsigned int *samples_per_frame, + unsigned int *frames_per_second, + uint64_t *byte_count) +{ + struct builder_state *state = cntr->private_data; + int i; + + // Validate parameters. + for (i = 0; i < ARRAY_SIZE(format_maps); ++i) { + if (format_maps[i].format == *format) + break; + } + if (i == ARRAY_SIZE(format_maps)) + return -EINVAL; + state->code_id = format_maps[i].code_id; + + // Decide container version. + if (*samples_per_frame > 2) + state->version = VOC_VERSION_1_20; + else + state->version = format_maps[i].minimal_version; + if (state->version == VOC_VERSION_1_10) { + if (*samples_per_frame == 2) { + for (i = 0; + i < ARRAY_SIZE(ex_v110_time_consts); ++i) { + if (ex_v110_time_consts[i].frames_per_second == + *frames_per_second) + break; + } + if (i == ARRAY_SIZE(ex_v110_time_consts)) + state->version = VOC_VERSION_1_20; + else + state->extended = true; + } else { + for (i = 0; i < ARRAY_SIZE(v110_time_consts); ++i) { + if (v110_time_consts[i].frames_per_second == + *frames_per_second) + break; + } + if (i == ARRAY_SIZE(v110_time_consts)) + state->version = VOC_VERSION_1_20; + } + } + + state->bytes_per_sample = snd_pcm_format_physical_width(*format) / 8; + state->samples_per_frame = *samples_per_frame; + + return write_data_blocks(cntr, *frames_per_second, *byte_count); +} + +static int write_block_terminator(struct container_context *cntr) +{ + struct block_terminator block = {0}; + + block.type = BLOCK_TYPE_TERMINATOR; + return container_recursive_write(cntr, &block, sizeof(block)); +} + +static int write_data_size(struct container_context *cntr, uint64_t byte_count) +{ + struct builder_state *state = cntr->private_data; + off64_t offset; + uint8_t size_field[3]; + int err; + + offset = sizeof(struct container_header) + sizeof(uint8_t); + if (state->version == VOC_VERSION_1_10 && state->extended) + offset += sizeof(struct block_extended_v110_format); + err = container_seek_offset(cntr, offset); + if (err < 0) + return err; + + if (state->version == VOC_VERSION_1_10) + offset = 2; + else + offset = 12; + + if (byte_count > cntr->max_size - offset) + byte_count = cntr->max_size; + else + byte_count += offset; + build_block_data_size(size_field, byte_count); + + return container_recursive_write(cntr, &size_field, sizeof(size_field)); +} + +static int voc_builder_post_process(struct container_context *cntr, + uint64_t handled_byte_count) +{ + int err; + + err = write_block_terminator(cntr); + if (err < 0) + return err; + + return write_data_size(cntr, handled_byte_count); +} + +const struct container_parser container_parser_voc = { + .format = CONTAINER_FORMAT_VOC, + .magic = VOC_MAGIC, + .max_size = 0xffffff - // = UINT24_MAX. + sizeof(struct block_terminator), + .ops = { + .pre_process = voc_parser_pre_process, + }, + .private_size = sizeof(struct parser_state), +}; + +const struct container_builder container_builder_voc = { + .format = CONTAINER_FORMAT_VOC, + .max_size = 0xffffff - // = UINT24_MAX. + sizeof(struct block_terminator), + .ops = { + .pre_process = voc_builder_pre_process, + .post_process = voc_builder_post_process, + }, + .private_size = sizeof(struct builder_state), +}; diff --git a/axfer/container.c b/axfer/container.c new file mode 100644 index 0000000..566acd0 --- /dev/null +++ b/axfer/container.c @@ -0,0 +1,472 @@ +// SPDX-License-Identifier: GPL-2.0 +// +// container.c - an interface of parser/builder for formatted files. +// +// Copyright (c) 2018 Takashi Sakamoto +// +// Licensed under the terms of the GNU General Public License, version 2. + +#include "container.h" +#include "misc.h" + +#include +#include +#include +#include +#include + +static const char *const cntr_type_labels[] = { + [CONTAINER_TYPE_PARSER] = "parser", + [CONTAINER_TYPE_BUILDER] = "builder", +}; + +static const char *const cntr_format_labels[] = { + [CONTAINER_FORMAT_RIFF_WAVE] = "riff/wave", + [CONTAINER_FORMAT_AU] = "au", + [CONTAINER_FORMAT_VOC] = "voc", + [CONTAINER_FORMAT_RAW] = "raw", +}; + +static const char *const suffixes[] = { + [CONTAINER_FORMAT_RIFF_WAVE] = ".wav", + [CONTAINER_FORMAT_AU] = ".au", + [CONTAINER_FORMAT_VOC] = ".voc", + [CONTAINER_FORMAT_RAW] = "", +}; + +const char *const container_suffix_from_format(enum container_format format) +{ + return suffixes[format]; +} + +int container_recursive_read(struct container_context *cntr, void *buf, + unsigned int byte_count) +{ + char *dst = buf; + ssize_t result; + size_t consumed = 0; + + while (consumed < byte_count && !cntr->interrupted) { + result = read(cntr->fd, dst + consumed, byte_count - consumed); + if (result < 0) { + // This descriptor was configured with non-blocking + // mode. EINTR is not cought when get any interrupts. + if (cntr->interrupted) + return -EINTR; + if (errno == EAGAIN) + continue; + return -errno; + } + // Reach EOF. + if (result == 0) { + cntr->eof = true; + return 0; + } + + consumed += result; + } + + return 0; +} + +int container_recursive_write(struct container_context *cntr, void *buf, + unsigned int byte_count) +{ + char *src = buf; + ssize_t result; + size_t consumed = 0; + + while (consumed < byte_count && !cntr->interrupted) { + result = write(cntr->fd, src + consumed, byte_count - consumed); + if (result < 0) { + // This descriptor was configured with non-blocking + // mode. EINTR is not cought when get any interrupts. + if (cntr->interrupted) + return -EINTR; + if (errno == EAGAIN) + continue; + return -errno; + } + + consumed += result; + } + + return 0; +} + +enum container_format container_format_from_path(const char *path) +{ + const char *suffix; + const char *pos; + int i; + + for (i = 0; i < ARRAY_SIZE(suffixes); ++i) { + suffix = suffixes[i]; + + // Check last part of the string. + pos = path + strlen(path) - strlen(suffix); + if (!strcmp(pos, suffix)) + return i; + } + + // Unsupported. + return CONTAINER_FORMAT_RAW; +} + +int container_seek_offset(struct container_context *cntr, off64_t offset) +{ + off64_t pos; + + pos = lseek64(cntr->fd, offset, SEEK_SET); + if (pos < 0) + return -errno; + if (pos != offset) + return -EIO; + + return 0; +} + +// To avoid blocking execution at system call iteration after receiving UNIX +// signals. +static int set_nonblock_flag(int fd) +{ + int flags; + + flags = fcntl(fd, F_GETFL); + if (flags < 0) + return -errno; + + flags |= O_NONBLOCK; + if (fcntl(fd, F_SETFL, flags) < 0) + return -errno; + + return 0; +} + +int container_parser_init(struct container_context *cntr, + const char *const path, unsigned int verbose) +{ + const struct container_parser *parsers[] = { + [CONTAINER_FORMAT_RIFF_WAVE] = &container_parser_riff_wave, + [CONTAINER_FORMAT_AU] = &container_parser_au, + [CONTAINER_FORMAT_VOC] = &container_parser_voc, + }; + const struct container_parser *parser; + unsigned int size; + int i; + int err; + + assert(cntr); + assert(path); + assert(path[0] != '\0'); + + // Detect forgotten to destruct. + assert(cntr->fd == 0); + assert(cntr->private_data == NULL); + + memset(cntr, 0, sizeof(*cntr)); + + // Open a target descriptor. + if (!strcmp(path, "-")) { + cntr->fd = fileno(stdin); + if (isatty(cntr->fd)) { + fprintf(stderr, + "A terminal is referred for standard input. " + "Output from any process or shell redirection " + "should be referred instead.\n"); + return -EIO; + } + err = set_nonblock_flag(cntr->fd); + if (err < 0) + return err; + cntr->stdio = true; + } else { + cntr->fd = open(path, O_RDONLY | O_NONBLOCK); + if (cntr->fd < 0) + return -errno; + } + + // 4 bytes are enough to detect supported containers. + err = container_recursive_read(cntr, cntr->magic, sizeof(cntr->magic)); + if (err < 0) + return err; + for (i = 0; i < ARRAY_SIZE(parsers); ++i) { + parser = parsers[i]; + size = strlen(parser->magic); + if (size > 4) + size = 4; + if (!strncmp(cntr->magic, parser->magic, size)) + break; + } + + // Don't forget that the first 4 bytes were already read for magic + // bytes. + cntr->magic_handled = false; + + // Unless detected, use raw container. + if (i == ARRAY_SIZE(parsers)) + parser = &container_parser_raw; + + // Allocate private data for the parser. + if (parser->private_size > 0) { + cntr->private_data = malloc(parser->private_size); + if (cntr->private_data == NULL) + return -ENOMEM; + memset(cntr->private_data, 0, parser->private_size); + } + + cntr->type = CONTAINER_TYPE_PARSER; + cntr->process_bytes = container_recursive_read; + cntr->format = parser->format; + cntr->ops = &parser->ops; + cntr->max_size = parser->max_size; + cntr->verbose = verbose; + + return 0; +} + +int container_builder_init(struct container_context *cntr, + const char *const path, enum container_format format, + unsigned int verbose) +{ + const struct container_builder *builders[] = { + [CONTAINER_FORMAT_RIFF_WAVE] = &container_builder_riff_wave, + [CONTAINER_FORMAT_AU] = &container_builder_au, + [CONTAINER_FORMAT_VOC] = &container_builder_voc, + [CONTAINER_FORMAT_RAW] = &container_builder_raw, + }; + const struct container_builder *builder; + int err; + + assert(cntr); + assert(path); + assert(path[0] != '\0'); + + // Detect forgotten to destruct. + assert(cntr->fd == 0); + assert(cntr->private_data == NULL); + + memset(cntr, 0, sizeof(*cntr)); + + // Open a target descriptor. + if (path == NULL || *path == '\0') + return -EINVAL; + if (!strcmp(path, "-")) { + cntr->fd = fileno(stdout); + if (isatty(cntr->fd)) { + fprintf(stderr, + "A terminal is referred for standard output. " + "Input to any process or shell redirection " + "should be referred instead.\n"); + return -EIO; + } + err = set_nonblock_flag(cntr->fd); + if (err < 0) + return err; + cntr->stdio = true; + } else { + cntr->fd = open(path, O_RDWR | O_NONBLOCK | O_CREAT | O_TRUNC, + 0644); + if (cntr->fd < 0) + return -errno; + } + + builder = builders[format]; + + // Allocate private data for the builder. + if (builder->private_size > 0) { + cntr->private_data = malloc(builder->private_size); + if (cntr->private_data == NULL) + return -ENOMEM; + memset(cntr->private_data, 0, builder->private_size); + } + + cntr->type = CONTAINER_TYPE_BUILDER; + cntr->process_bytes = container_recursive_write; + cntr->format = builder->format; + cntr->ops = &builder->ops; + cntr->max_size = builder->max_size; + cntr->verbose = verbose; + + return 0; +} + +int container_context_pre_process(struct container_context *cntr, + snd_pcm_format_t *format, + unsigned int *samples_per_frame, + unsigned int *frames_per_second, + uint64_t *frame_count) +{ + uint64_t byte_count = 0; + unsigned int bytes_per_frame; + int err; + + assert(cntr); + assert(format); + assert(samples_per_frame); + assert(frames_per_second); + assert(frame_count); + + if (cntr->type == CONTAINER_TYPE_BUILDER) + byte_count = cntr->max_size; + + if (cntr->ops->pre_process) { + err = cntr->ops->pre_process(cntr, format, samples_per_frame, + frames_per_second, &byte_count); + if (err < 0) + return err; + if (cntr->eof) + return 0; + } + + if (cntr->format == CONTAINER_FORMAT_RAW) { + if (*format == SND_PCM_FORMAT_UNKNOWN || + *samples_per_frame == 0 || *frames_per_second == 0) { + fprintf(stderr, + "Any file format is not detected. Need to " + "indicate all of sample format, channels and " + "rate explicitly.\n"); + return -EINVAL; + } + } + assert(*format >= SND_PCM_FORMAT_S8); + assert(*format <= SND_PCM_FORMAT_LAST); + assert(*samples_per_frame > 0); + assert(*frames_per_second > 0); + assert(byte_count > 0); + + cntr->bytes_per_sample = snd_pcm_format_physical_width(*format) / 8; + cntr->samples_per_frame = *samples_per_frame; + cntr->frames_per_second = *frames_per_second; + + bytes_per_frame = cntr->bytes_per_sample * *samples_per_frame; + *frame_count = byte_count / bytes_per_frame; + cntr->max_size -= cntr->max_size / bytes_per_frame; + + if (cntr->verbose > 0) { + fprintf(stderr, "Container: %s\n", + cntr_type_labels[cntr->type]); + fprintf(stderr, " format: %s\n", + cntr_format_labels[cntr->format]); + fprintf(stderr, " sample format: %s\n", + snd_pcm_format_name(*format)); + fprintf(stderr, " bytes/sample: %u\n", + cntr->bytes_per_sample); + fprintf(stderr, " samples/frame: %u\n", + cntr->samples_per_frame); + fprintf(stderr, " frames/second: %u\n", + cntr->frames_per_second); + if (cntr->type == CONTAINER_TYPE_PARSER) { + fprintf(stderr, " frames: %" PRIu64 "\n", + *frame_count); + } else { + fprintf(stderr, " max frames: %" PRIu64 "\n", + *frame_count); + } + } + + return 0; +} + +int container_context_process_frames(struct container_context *cntr, + void *frame_buffer, + unsigned int *frame_count) +{ + char *buf = frame_buffer; + unsigned int bytes_per_frame; + unsigned int byte_count; + unsigned int target_byte_count; + int err; + + assert(cntr); + assert(!cntr->eof); + assert(frame_buffer); + assert(frame_count); + + bytes_per_frame = cntr->bytes_per_sample * cntr->samples_per_frame; + target_byte_count = *frame_count * bytes_per_frame; + + // A parser of cotainers already read first 4 bytes to detect format + // of container, however they includes PCM frames when any format was + // undetected. Surely to write out them. + byte_count = target_byte_count; + if (cntr->format == CONTAINER_FORMAT_RAW && + cntr->type == CONTAINER_TYPE_PARSER && !cntr->magic_handled) { + memcpy(buf, cntr->magic, sizeof(cntr->magic)); + buf += sizeof(cntr->magic); + byte_count -= sizeof(cntr->magic); + cntr->magic_handled = true; + } + + // Each container has limitation for its volume for sample data. + if (cntr->handled_byte_count > cntr->max_size - byte_count) + byte_count = cntr->max_size - cntr->handled_byte_count; + + // All of supported containers include interleaved PCM frames. + // TODO: process frames for truncate case. + err = cntr->process_bytes(cntr, buf, byte_count); + if (err < 0) { + *frame_count = 0; + return err; + } + + cntr->handled_byte_count += target_byte_count; + if (cntr->handled_byte_count == cntr->max_size) + cntr->eof = true; + + *frame_count = target_byte_count / bytes_per_frame; + + return 0; +} + +int container_context_post_process(struct container_context *cntr, + uint64_t *frame_count) +{ + int err = 0; + + assert(cntr); + assert(frame_count); + + if (cntr->verbose && cntr->handled_byte_count > 0) { + fprintf(stderr, " Handled bytes: %" PRIu64 "\n", + cntr->handled_byte_count); + } + + // NOTE* we cannot seek when using standard input/output. + if (!cntr->stdio && cntr->ops && cntr->ops->post_process) { + // Usually, need to write out processed bytes in container + // header even it this program is interrupted. + cntr->interrupted = false; + + err = cntr->ops->post_process(cntr, cntr->handled_byte_count); + } + + // Ensure to perform write-back from disk cache. + if (cntr->type == CONTAINER_TYPE_BUILDER) + fsync(cntr->fd); + + if (err < 0) + return err; + + if (cntr->bytes_per_sample == 0 || cntr->samples_per_frame == 0) { + *frame_count = 0; + } else { + *frame_count = cntr->handled_byte_count / + cntr->bytes_per_sample / + cntr->samples_per_frame; + } + + return 0; +} + +void container_context_destroy(struct container_context *cntr) +{ + assert(cntr); + + close(cntr->fd); + if (cntr->private_data) + free(cntr->private_data); + + cntr->fd = 0; + cntr->private_data = NULL; +} diff --git a/axfer/container.h b/axfer/container.h new file mode 100644 index 0000000..cb64816 --- /dev/null +++ b/axfer/container.h @@ -0,0 +1,126 @@ +// SPDX-License-Identifier: GPL-2.0 +// +// container.h - an interface of parser/builder for formatted files. +// +// Copyright (c) 2018 Takashi Sakamoto +// +// Licensed under the terms of the GNU General Public License, version 2. + +#ifndef __ALSA_UTILS_AXFER_CONTAINER__H_ +#define __ALSA_UTILS_AXFER_CONTAINER__H_ + +#define _LARGEFILE64_SOURCE +#include +#include + +#include +#include + +#include + +enum container_type { + CONTAINER_TYPE_PARSER = 0, + CONTAINER_TYPE_BUILDER, + CONTAINER_TYPE_COUNT, +}; + +enum container_format { + CONTAINER_FORMAT_RIFF_WAVE = 0, + CONTAINER_FORMAT_AU, + CONTAINER_FORMAT_VOC, + CONTAINER_FORMAT_RAW, + CONTAINER_FORMAT_COUNT, +}; + +struct container_ops; + +struct container_context { + enum container_type type; + int fd; + int (*process_bytes)(struct container_context *cntr, + void *buffer, unsigned int byte_count); + bool magic_handled; + bool eof; + bool interrupted; + bool stdio; + + enum container_format format; + uint64_t max_size; + char magic[4]; + const struct container_ops *ops; + void *private_data; + + // Available after pre-process. + unsigned int bytes_per_sample; + unsigned int samples_per_frame; + unsigned int frames_per_second; + + unsigned int verbose; + uint64_t handled_byte_count; +}; + +const char *const container_suffix_from_format(enum container_format format); +enum container_format container_format_from_path(const char *path); +int container_parser_init(struct container_context *cntr, + const char *const path, unsigned int verbose); +int container_builder_init(struct container_context *cntr, + const char *const path, enum container_format format, + unsigned int verbose); +void container_context_destroy(struct container_context *cntr); +int container_context_pre_process(struct container_context *cntr, + snd_pcm_format_t *format, + unsigned int *samples_per_frame, + unsigned int *frames_per_second, + uint64_t *frame_count); +int container_context_process_frames(struct container_context *cntr, + void *frame_buffer, + unsigned int *frame_count); +int container_context_post_process(struct container_context *cntr, + uint64_t *frame_count); + +// For internal use in 'container' module. + +struct container_ops { + int (*pre_process)(struct container_context *cntr, + snd_pcm_format_t *format, + unsigned int *samples_per_frame, + unsigned int *frames_per_second, + uint64_t *byte_count); + int (*post_process)(struct container_context *cntr, + uint64_t handled_byte_count); +}; +struct container_parser { + enum container_format format; + const char *const magic; + uint64_t max_size; + struct container_ops ops; + unsigned int private_size; +}; + +struct container_builder { + enum container_format format; + const char *const suffix; + uint64_t max_size; + struct container_ops ops; + unsigned int private_size; +}; + +int container_recursive_read(struct container_context *cntr, void *buf, + unsigned int byte_count); +int container_recursive_write(struct container_context *cntr, void *buf, + unsigned int byte_count); +int container_seek_offset(struct container_context *cntr, off64_t offset); + +extern const struct container_parser container_parser_riff_wave; +extern const struct container_builder container_builder_riff_wave; + +extern const struct container_parser container_parser_au; +extern const struct container_builder container_builder_au; + +extern const struct container_parser container_parser_voc; +extern const struct container_builder container_builder_voc; + +extern const struct container_parser container_parser_raw; +extern const struct container_builder container_builder_raw; + +#endif diff --git a/axfer/frame-cache.c b/axfer/frame-cache.c new file mode 100644 index 0000000..417c1e6 --- /dev/null +++ b/axfer/frame-cache.c @@ -0,0 +1,113 @@ +// SPDX-License-Identifier: GPL-2.0 +// +// frame-cache.c - maintainer of cache for data frame. +// +// Copyright (c) 2018 Takashi Sakamoto +// +// Licensed under the terms of the GNU General Public License, version 2. + +#include "frame-cache.h" + +static void align_frames_in_i(struct frame_cache *cache, + unsigned int consumed_count) +{ + char *buf = cache->buf; + unsigned int offset; + unsigned int size; + + cache->remained_count -= consumed_count; + + offset = cache->bytes_per_sample * cache->samples_per_frame * + consumed_count; + size = cache->bytes_per_sample * cache->samples_per_frame * + cache->remained_count; + memmove(buf, buf + offset, size); + + cache->buf_ptr = buf + size; +} + +static void align_frames_in_n(struct frame_cache *cache, + unsigned int consumed_count) +{ + char **bufs = cache->buf; + char **buf_ptrs = cache->buf_ptr; + unsigned int offset; + unsigned int size; + int i; + + cache->remained_count -= consumed_count; + + for (i = 0; i < cache->samples_per_frame; ++i) { + offset = cache->bytes_per_sample * consumed_count; + size = cache->bytes_per_sample * cache->remained_count; + memmove(bufs[i], bufs[i] + offset, size); + buf_ptrs[i] = bufs[i] + size; + } +} + +int frame_cache_init(struct frame_cache *cache, snd_pcm_access_t access, + unsigned int bytes_per_sample, + unsigned int samples_per_frame, + unsigned int frames_per_cache) +{ + cache->access = access; + cache->remained_count = 0; + cache->bytes_per_sample = bytes_per_sample; + cache->samples_per_frame = samples_per_frame; + cache->frames_per_cache = frames_per_cache; + + if (access == SND_PCM_ACCESS_RW_INTERLEAVED) + cache->align_frames = align_frames_in_i; + else if (access == SND_PCM_ACCESS_RW_NONINTERLEAVED) + cache->align_frames = align_frames_in_n; + else + return -EINVAL; + + if (access == SND_PCM_ACCESS_RW_INTERLEAVED) { + char *buf; + + buf = calloc(frames_per_cache, + bytes_per_sample * samples_per_frame); + if (buf == NULL) + goto nomem; + cache->buf = buf; + cache->buf_ptr = buf; + } else { + char **bufs = calloc(samples_per_frame, sizeof(*bufs)); + char **buf_ptrs = calloc(samples_per_frame, sizeof(*buf_ptrs)); + int i; + + cache->buf = bufs; + cache->buf_ptr = buf_ptrs; + if (bufs == NULL || buf_ptrs == NULL) + goto nomem; + for (i = 0; i < samples_per_frame; ++i) { + bufs[i] = calloc(frames_per_cache, bytes_per_sample); + if (bufs[i] == NULL) + goto nomem; + buf_ptrs[i] = bufs[i]; + } + } + + + return 0; + +nomem: + frame_cache_destroy(cache); + return -ENOMEM; +} + +void frame_cache_destroy(struct frame_cache *cache) +{ + if (cache->access == SND_PCM_ACCESS_RW_NONINTERLEAVED) { + char **bufs = cache->buf; + if (bufs) { + int i; + for (i = 0; i < cache->samples_per_frame; ++i) + free(bufs[i]); + } + free(cache->buf_ptr); + } + free(cache->buf); + memset(cache, 0, sizeof(*cache)); +} diff --git a/axfer/frame-cache.h b/axfer/frame-cache.h new file mode 100644 index 0000000..7191333 --- /dev/null +++ b/axfer/frame-cache.h @@ -0,0 +1,47 @@ +// SPDX-License-Identifier: GPL-2.0 +// +// frame-cache.h - maintainer of cache for data frame. +// +// Copyright (c) 2018 Takashi Sakamoto +// +// Licensed under the terms of the GNU General Public License, version 2. + +#include + +struct frame_cache { + void *buf; + void *buf_ptr; + + unsigned int remained_count; + + snd_pcm_access_t access; + unsigned int bytes_per_sample; + unsigned int samples_per_frame; + unsigned int frames_per_cache; + + void (*align_frames)(struct frame_cache *cache, + unsigned int consumed_count); +}; + +int frame_cache_init(struct frame_cache *cache, snd_pcm_access_t access, + unsigned int bytes_per_sample, + unsigned int samples_per_frame, + unsigned int frames_per_cache); +void frame_cache_destroy(struct frame_cache *cache); + +static inline unsigned int frame_cache_get_count(struct frame_cache *cache) +{ + return cache->remained_count; +} + +static inline void frame_cache_increase_count(struct frame_cache *cache, + unsigned int frame_count) +{ + cache->remained_count += frame_count; +} + +static inline void frame_cache_reduce(struct frame_cache *cache, + unsigned int consumed_count) +{ + cache->align_frames(cache, consumed_count); +} diff --git a/axfer/main.c b/axfer/main.c new file mode 100644 index 0000000..21d3b4a --- /dev/null +++ b/axfer/main.c @@ -0,0 +1,287 @@ +// SPDX-License-Identifier: GPL-2.0 +// main.c - an entry point for this program. +// +// Copyright (c) 2018 Takashi Sakamoto +// +// Originally written as 'aplay', by Michael Beck and Jaroslav Kysela. +// +// Licensed under the terms of the GNU General Public License, version 2. + +#include "subcmd.h" +#include "misc.h" + +#include "version.h" + +#include +#include +#include +#include + +enum subcmds { + SUBCMD_TRANSFER = 0, + SUBCMD_LIST, + SUBCMD_HELP, + SUBCMD_VERSION, +}; + +char *arg_duplicate_string(const char *str, int *err) +{ + char *ptr; + + // For safe. + if (strlen(str) > 1024) { + *err = -EINVAL; + return NULL; + } + + ptr = strdup(str); + if (ptr == NULL) + *err = -ENOMEM; + + return ptr; +} + +long arg_parse_decimal_num(const char *str, int *err) +{ + long val; + char *endptr; + + errno = 0; + val = strtol(str, &endptr, 0); + if (errno > 0) { + *err = -errno; + return 0; + } + if (*endptr != '\0') { + *err = -EINVAL; + return 0; + } + + return val; +} + +static void print_version(const char *const cmdname) +{ + printf("%s: version %s\n", cmdname, SND_UTIL_VERSION_STR); +} + +static void print_help(void) +{ + printf( +"Usage:\n" +" axfer transfer DIRECTION OPTIONS\n" +" axfer list DIRECTION OPTIONS\n" +" axfer version\n" +" axfer help\n" +"\n" +" where:\n" +" DIRECTION = capture | playback\n" +" OPTIONS = -h | --help | (subcommand specific)\n" + ); +} + +// Backward compatibility to aplay(1). +static bool decide_subcmd(int argc, char *const *argv, enum subcmds *subcmd) +{ + static const struct { + const char *const name; + enum subcmds subcmd; + } long_opts[] = { + {"--list-devices", SUBCMD_LIST}, + {"--list-pcms", SUBCMD_LIST}, + {"--help", SUBCMD_HELP}, + {"--version", SUBCMD_VERSION}, + }; + static const struct { + unsigned char c; + enum subcmds subcmd; + } short_opts[] = { + {'l', SUBCMD_LIST}, + {'L', SUBCMD_LIST}, + {'h', SUBCMD_HELP}, + }; + char *pos; + int i, j; + + if (argc == 1) + return false; + + // Original command system. For long options. + for (i = 0; i < ARRAY_SIZE(long_opts); ++i) { + for (j = 0; j < argc; ++j) { + if (!strcmp(long_opts[i].name, argv[j])) { + *subcmd = long_opts[i].subcmd; + return true; + } + } + } + + // Original command system. For short options. + for (i = 1; i < argc; ++i) { + // Pick up short options only. + if (argv[i][0] != '-' || argv[i][0] == '\0' || + argv[i][1] == '-' || argv[i][1] == '\0') + continue; + for (pos = argv[i]; *pos != '\0'; ++pos) { + for (j = 0; j < ARRAY_SIZE(short_opts); ++j) { + if (*pos == short_opts[j].c) { + *subcmd = short_opts[j].subcmd; + return true; + } + } + } + } + + return false; +} + +// Backward compatibility to aplay(1). +static bool decide_direction(int argc, char *const *argv, + snd_pcm_stream_t *direction) +{ + static const struct { + const char *const name; + snd_pcm_stream_t direction; + } long_opts[] = { + {"--capture", SND_PCM_STREAM_CAPTURE}, + {"--playback", SND_PCM_STREAM_PLAYBACK}, + }; + static const struct { + unsigned char c; + snd_pcm_stream_t direction; + } short_opts[] = { + {'C', SND_PCM_STREAM_CAPTURE}, + {'P', SND_PCM_STREAM_PLAYBACK}, + }; + static const char *const aliases[] = { + [SND_PCM_STREAM_CAPTURE] = "arecord", + [SND_PCM_STREAM_PLAYBACK] = "aplay", + }; + int i, j; + char *pos; + + // Original command system. For long options. + for (i = 0; i < ARRAY_SIZE(long_opts); ++i) { + for (j = 0; j < argc; ++j) { + if (!strcmp(long_opts[i].name, argv[j])) { + *direction = long_opts[i].direction; + return true; + } + } + } + + // Original command system. For short options. + for (i = 1; i < argc; ++i) { + // Pick up short options only. + if (argv[i][0] != '-' || argv[i][0] == '\0' || + argv[i][1] == '-' || argv[i][1] == '\0') + continue; + for (pos = argv[i]; *pos != '\0'; ++pos) { + for (j = 0; j < ARRAY_SIZE(short_opts); ++j) { + if (*pos == short_opts[j].c) { + *direction = short_opts[j].direction; + return true; + } + } + } + } + + // If not decided yet, judge according to command name. + for (i = 0; i < ARRAY_SIZE(aliases); ++i) { + for (pos = argv[0] + strlen(argv[0]); pos != argv[0]; --pos) { + if (strstr(pos, aliases[i]) != NULL) { + *direction = i; + return true; + } + } + } + + return false; +} + +static bool detect_subcmd(int argc, char *const *argv, enum subcmds *subcmd) +{ + static const char *const subcmds[] = { + [SUBCMD_TRANSFER] = "transfer", + [SUBCMD_LIST] = "list", + [SUBCMD_HELP] = "help", + [SUBCMD_VERSION] = "version", + }; + int i; + + if (argc < 2) + return false; + + for (i = 0; i < ARRAY_SIZE(subcmds); ++i) { + if (!strcmp(argv[1], subcmds[i])) { + *subcmd = i; + return true; + } + } + + return false; +} + +static bool detect_direction(int argc, char *const *argv, + snd_pcm_stream_t *direction) +{ + if (argc < 3) + return false; + + if (!strcmp(argv[2], "capture")) { + *direction = SND_PCM_STREAM_CAPTURE; + return true; + } + + if (!strcmp(argv[2], "playback")) { + *direction = SND_PCM_STREAM_PLAYBACK; + return true; + } + + return false; +} + +int main(int argc, char *const *argv) +{ + snd_pcm_stream_t direction; + enum subcmds subcmd; + int err = 0; + + // For compatibility to aplay(1) implementation. + if (strstr(argv[0], "arecord") == argv[0] + strlen(argv[0]) - 7 || + strstr(argv[0], "aplay") == argv[0] + strlen(argv[0]) - 5) { + if (!decide_direction(argc, argv, &direction)) + direction = SND_PCM_STREAM_PLAYBACK; + if (!decide_subcmd(argc, argv, &subcmd)) + subcmd = SUBCMD_TRANSFER; + } else { + // The first option should be one of subcommands. + if (!detect_subcmd(argc, argv, &subcmd)) + subcmd = SUBCMD_HELP; + // The second option should be either 'capture' or 'direction' + // if subcommand is neither 'version' nor 'help'. + if (subcmd != SUBCMD_VERSION && subcmd != SUBCMD_HELP) { + if (!detect_direction(argc, argv, &direction)) { + subcmd = SUBCMD_HELP; + } else { + // argv[0] is needed for unparsed option to use + // getopt_long(3). + argc -= 2; + argv += 2; + } + } + } + + if (subcmd == SUBCMD_TRANSFER) + err = subcmd_transfer(argc, argv, direction); + else if (subcmd == SUBCMD_LIST) + err = subcmd_list(argc, argv, direction); + else if (subcmd == SUBCMD_VERSION) + print_version(argv[0]); + else + print_help(); + if (err < 0) + return EXIT_FAILURE; + + return EXIT_SUCCESS; +} diff --git a/axfer/mapper-multiple.c b/axfer/mapper-multiple.c new file mode 100644 index 0000000..00569af --- /dev/null +++ b/axfer/mapper-multiple.c @@ -0,0 +1,259 @@ +// SPDX-License-Identifier: GPL-2.0 +// +// mapper-multiple.c - a muxer/demuxer for multiple containers. +// +// Copyright (c) 2018 Takashi Sakamoto +// +// Licensed under the terms of the GNU General Public License, version 2. + +#include "mapper.h" +#include "misc.h" + +struct multiple_state { + void (*align_frames)(void *frame_buf, unsigned int frame_count, + char **buf, unsigned int bytes_per_sample, + struct container_context *cntrs, + unsigned int cntr_count); + char **bufs; + unsigned int cntr_count; +}; + +static void align_to_i(void *frame_buf, unsigned int frame_count, + char **src_bufs, unsigned int bytes_per_sample, + struct container_context *cntrs, unsigned int cntr_count) +{ + char *dst = frame_buf; + char *src; + unsigned int dst_pos; + unsigned int src_pos; + struct container_context *cntr; + int i, j; + + // src: first channel in each of interleaved buffers in containers => + // dst:interleaved. + for (i = 0; i < cntr_count; ++i) { + src = src_bufs[i]; + cntr = cntrs + i; + + for (j = 0; j < frame_count; ++j) { + // Use first src channel for each of dst channel. + src_pos = bytes_per_sample * cntr->samples_per_frame * j; + dst_pos = bytes_per_sample * (cntr_count * j + i); + + memcpy(dst + dst_pos, src + src_pos, bytes_per_sample); + } + } +} + +static void align_from_i(void *frame_buf, unsigned int frame_count, + char **dst_bufs, unsigned int bytes_per_sample, + struct container_context *cntrs, + unsigned int cntr_count) +{ + char *src = frame_buf; + char *dst; + unsigned int src_pos; + unsigned int dst_pos; + struct container_context *cntr; + int i, j; + + for (i = 0; i < cntr_count; ++i) { + dst = dst_bufs[i]; + cntr = cntrs + i; + + for (j = 0; j < frame_count; ++j) { + // Use first src channel for each of dst channel. + src_pos = bytes_per_sample * (cntr_count * j + i); + dst_pos = bytes_per_sample * cntr->samples_per_frame * j; + + memcpy(dst + dst_pos, src + src_pos, bytes_per_sample); + } + } +} + +static int multiple_pre_process(struct mapper_context *mapper, + struct container_context *cntrs, + unsigned int cntr_count) +{ + struct multiple_state *state = mapper->private_data; + struct container_context *cntr; + int i; + + // Additionally, format of samples in the containers should be the same + // as the format in PCM substream. + for (i = 0; i < cntr_count; ++i) { + cntr = cntrs + i; + if (mapper->bytes_per_sample != cntr->bytes_per_sample) + return -EINVAL; + } + state->cntr_count = cntr_count; + + // Decide method to align frames. + if (mapper->type == MAPPER_TYPE_DEMUXER) { + if (mapper->access == SND_PCM_ACCESS_RW_INTERLEAVED || + mapper->access == SND_PCM_ACCESS_MMAP_INTERLEAVED) + state->align_frames = align_from_i; + else if (mapper->access == SND_PCM_ACCESS_RW_NONINTERLEAVED || + mapper->access == SND_PCM_ACCESS_MMAP_NONINTERLEAVED) + state->align_frames = NULL; + else + return -EINVAL; + } else { + if (mapper->access == SND_PCM_ACCESS_RW_INTERLEAVED || + mapper->access == SND_PCM_ACCESS_MMAP_INTERLEAVED) + state->align_frames = align_to_i; + else if (mapper->access == SND_PCM_ACCESS_RW_NONINTERLEAVED || + mapper->access == SND_PCM_ACCESS_MMAP_NONINTERLEAVED) + state->align_frames = NULL; + else + return -EINVAL; + } + + if (state->align_frames) { + // Furthermore, in demuxer case, each container should be + // configured to store one sample per frame. + if (mapper->type == MAPPER_TYPE_DEMUXER) { + for (i = 0; i < cntr_count; ++i) { + cntr = cntrs + i; + if (cntr->samples_per_frame != 1) + return -EINVAL; + } + } + + state->bufs = calloc(cntr_count, sizeof(char *)); + if (state->bufs == NULL) + return -ENOMEM; + + for (i = 0; i < cntr_count; ++i) { + unsigned int bytes_per_buffer; + + // Allocate intermediate buffer as the same size as a + // period for each of containers. + cntr = cntrs + i; + + bytes_per_buffer = mapper->bytes_per_sample * + cntr->samples_per_frame * + mapper->frames_per_buffer; + + state->bufs[i] = malloc(bytes_per_buffer); + if (state->bufs[i] == NULL) + return -ENOMEM; + memset(state->bufs[i], 0, bytes_per_buffer); + } + } + + return 0; +} + +static int process_containers(char **src_bufs, unsigned int *frame_count, + struct container_context *cntrs, + unsigned int cntr_count) +{ + struct container_context *cntr; + char *src; + int i; + int err = 0; + + // TODO: arrangement for *frame_count. + for (i = 0; i < cntr_count; ++i) { + cntr = &cntrs[i]; + src = src_bufs[i]; + + err = container_context_process_frames(cntr, src, frame_count); + if (err < 0) + break; + } + + return err; +} + +static int multiple_muxer_process_frames(struct mapper_context *mapper, + void *frame_buf, + unsigned int *frame_count, + struct container_context *cntrs, + unsigned int cntr_count) +{ + struct multiple_state *state = mapper->private_data; + char **src_bufs; + int err; + + // If need to align PCM frames, process PCM frames to the intermediate + // buffer once. + if (!state->align_frames) { + // The most likely. + src_bufs = frame_buf; + } else { + src_bufs = state->bufs; + } + err = process_containers(src_bufs, frame_count, cntrs, cntr_count); + if (err < 0) + return err; + + // Unlikely. + if (src_bufs != frame_buf && *frame_count > 0) { + state->align_frames(frame_buf, *frame_count, src_bufs, + mapper->bytes_per_sample, cntrs, + cntr_count); + } + + return 0; +} + +static int multiple_demuxer_process_frames(struct mapper_context *mapper, + void *frame_buf, + unsigned int *frame_count, + struct container_context *cntrs, + unsigned int cntr_count) +{ + struct multiple_state *state = mapper->private_data; + char **dst_bufs; + + // If need to align PCM frames, process PCM frames to the intermediate + // buffer once. + if (!state->align_frames) { + // The most likely. + dst_bufs = frame_buf; + } else { + dst_bufs = state->bufs; + state->align_frames(frame_buf, *frame_count, dst_bufs, + mapper->bytes_per_sample, cntrs, + cntr_count); + } + + return process_containers(dst_bufs, frame_count, cntrs, cntr_count); +} + +static void multiple_post_process(struct mapper_context *mapper) +{ + struct multiple_state *state = mapper->private_data; + int i; + + if (state->bufs) { + for (i = 0; i < state->cntr_count; ++i) { + if (state->bufs[i]) + free(state->bufs[i]); + } + free(state->bufs); + } + + state->bufs = NULL; + state->align_frames = NULL; +} + +const struct mapper_data mapper_muxer_multiple = { + .ops = { + .pre_process = multiple_pre_process, + .process_frames = multiple_muxer_process_frames, + .post_process = multiple_post_process, + }, + .private_size = sizeof(struct multiple_state), +}; + +const struct mapper_data mapper_demuxer_multiple = { + .ops = { + .pre_process = multiple_pre_process, + .process_frames = multiple_demuxer_process_frames, + .post_process = multiple_post_process, + }, + .private_size = sizeof(struct multiple_state), +}; diff --git a/axfer/mapper-single.c b/axfer/mapper-single.c new file mode 100644 index 0000000..aa8aa19 --- /dev/null +++ b/axfer/mapper-single.c @@ -0,0 +1,191 @@ +// SPDX-License-Identifier: GPL-2.0 +// +// mapper-single.c - a muxer/demuxer for single containers. +// +// Copyright (c) 2018 Takashi Sakamoto +// +// Licensed under the terms of the GNU General Public License, version 2. + +#include "mapper.h" +#include "misc.h" + +struct single_state { + void (*align_frames)(void *frame_buf, unsigned int frame_count, + char *buf, unsigned int bytes_per_sample, + unsigned int samples_per_frame); + char *buf; +}; + +static void align_to_vector(void *frame_buf, unsigned int frame_count, + char *src, unsigned int bytes_per_sample, + unsigned samples_per_frame) +{ + char **dst_bufs = frame_buf; + char *dst; + unsigned int src_pos; + unsigned int dst_pos; + int i, j; + + // src: interleaved => dst: a set of interleaved buffers. + for (i = 0; i < samples_per_frame; ++i) { + dst = dst_bufs[i]; + for (j = 0; j < frame_count; ++j) { + src_pos = bytes_per_sample * (samples_per_frame * j + i); + dst_pos = bytes_per_sample * j; + + memcpy(dst + dst_pos, src + src_pos, bytes_per_sample); + } + } +} + +static void align_from_vector(void *frame_buf, unsigned int frame_count, + char *dst, unsigned int bytes_per_sample, + unsigned int samples_per_frame) +{ + char **src_bufs = frame_buf; + char *src; + unsigned int dst_pos; + unsigned int src_pos; + int i, j; + + // src: a set of interleaved buffers => dst:interleaved. + for (i = 0; i < samples_per_frame; ++i) { + src = src_bufs[i]; + for (j = 0; j < frame_count; ++j) { + src_pos = bytes_per_sample * j; + dst_pos = bytes_per_sample * (samples_per_frame * j + i); + + memcpy(dst + dst_pos, src + src_pos, bytes_per_sample); + } + } +} + +static int single_pre_process(struct mapper_context *mapper, + struct container_context *cntrs, + unsigned int cntr_count) +{ + struct single_state *state = mapper->private_data; + unsigned int bytes_per_buffer; + + if (cntrs->bytes_per_sample != mapper->bytes_per_sample || + cntrs->samples_per_frame != mapper->samples_per_frame) + return -EINVAL; + + // Decide method to align frames. + if (mapper->type == MAPPER_TYPE_DEMUXER) { + if (mapper->access == SND_PCM_ACCESS_RW_NONINTERLEAVED || + mapper->access == SND_PCM_ACCESS_MMAP_NONINTERLEAVED) + state->align_frames = align_from_vector; + else if (mapper->access == SND_PCM_ACCESS_RW_INTERLEAVED || + mapper->access == SND_PCM_ACCESS_MMAP_INTERLEAVED) + state->align_frames = NULL; + else + return -EINVAL; + } else { + if (mapper->access == SND_PCM_ACCESS_RW_NONINTERLEAVED || + mapper->access == SND_PCM_ACCESS_MMAP_NONINTERLEAVED) + state->align_frames = align_to_vector; + else if (mapper->access == SND_PCM_ACCESS_RW_INTERLEAVED || + mapper->access == SND_PCM_ACCESS_MMAP_INTERLEAVED) + state->align_frames = NULL; + else + return -EINVAL; + } + + if (state->align_frames) { + // Allocate intermediate buffer as the same size as a period. + bytes_per_buffer = mapper->bytes_per_sample * + mapper->samples_per_frame * + mapper->frames_per_buffer; + state->buf = malloc(bytes_per_buffer); + if (state->buf == NULL) + return -ENOMEM; + memset(state->buf, 0, bytes_per_buffer); + } + + return 0; +} + +static int single_muxer_process_frames(struct mapper_context *mapper, + void *frame_buf, + unsigned int *frame_count, + struct container_context *cntrs, + unsigned int cntr_count) +{ + struct single_state *state = mapper->private_data; + void *src; + int err; + + // If need to align PCM frames, process PCM frames to the intermediate + // buffer once. + if (!state->align_frames) { + // The most likely. + src = frame_buf; + } else { + src = state->buf; + } + err = container_context_process_frames(cntrs, src, frame_count); + if (err < 0) + return err; + + // Unlikely. + if (src != frame_buf && *frame_count > 0) + state->align_frames(frame_buf, *frame_count, src, + mapper->bytes_per_sample, + mapper->samples_per_frame); + + return 0; +} + +static int single_demuxer_process_frames(struct mapper_context *mapper, + void *frame_buf, + unsigned int *frame_count, + struct container_context *cntrs, + unsigned int cntr_count) +{ + struct single_state *state = mapper->private_data; + void *dst; + + // If need to align PCM frames, process PCM frames to the intermediate + // buffer once. + if (!state->align_frames) { + // The most likely. + dst = frame_buf; + } else { + state->align_frames(frame_buf, *frame_count, state->buf, + mapper->bytes_per_sample, + mapper->samples_per_frame); + dst = state->buf; + } + + return container_context_process_frames(cntrs, dst, frame_count); +} + +static void single_post_process(struct mapper_context *mapper) +{ + struct single_state *state = mapper->private_data; + + if (state->buf) + free(state->buf); + + state->buf = NULL; + state->align_frames = NULL; +} + +const struct mapper_data mapper_muxer_single = { + .ops = { + .pre_process = single_pre_process, + .process_frames = single_muxer_process_frames, + .post_process = single_post_process, + }, + .private_size = sizeof(struct single_state), +}; + +const struct mapper_data mapper_demuxer_single = { + .ops = { + .pre_process = single_pre_process, + .process_frames = single_demuxer_process_frames, + .post_process = single_post_process, + }, + .private_size = sizeof(struct single_state), +}; diff --git a/axfer/mapper.c b/axfer/mapper.c new file mode 100644 index 0000000..4c3f0e3 --- /dev/null +++ b/axfer/mapper.c @@ -0,0 +1,150 @@ +// SPDX-License-Identifier: GPL-2.0 +// +// mapper.c - an interface of muxer/demuxer between buffer with data frames and +// formatted files. +// +// Copyright (c) 2018 Takashi Sakamoto +// +// Licensed under the terms of the GNU General Public License, version 2. + +#include "mapper.h" +#include "misc.h" + +#include + +static const char *const mapper_type_labels[] = { + [MAPPER_TYPE_MUXER] = "muxer", + [MAPPER_TYPE_DEMUXER] = "demuxer", +}; + +static const char *const mapper_target_labels[] = { + [MAPPER_TARGET_SINGLE] = "single", + [MAPPER_TARGET_MULTIPLE] = "multiple", +}; + +int mapper_context_init(struct mapper_context *mapper, + enum mapper_type type, unsigned int cntr_count, + unsigned int verbose) +{ + const struct mapper_data *data = NULL; + + assert(mapper); + assert(cntr_count > 0); + + // Detect forgotten to destruct. + assert(mapper->private_data == NULL); + + memset(mapper, 0, sizeof(*mapper)); + + if (type == MAPPER_TYPE_MUXER) { + if (cntr_count == 1) { + data = &mapper_muxer_single; + mapper->target = MAPPER_TARGET_SINGLE; + } else { + data = &mapper_muxer_multiple; + mapper->target = MAPPER_TARGET_MULTIPLE; + } + } else { + if (cntr_count == 1) { + data = &mapper_demuxer_single; + mapper->target = MAPPER_TARGET_SINGLE; + } else { + data = &mapper_demuxer_multiple; + mapper->target = MAPPER_TARGET_MULTIPLE; + } + } + + mapper->ops = &data->ops; + mapper->type = type; + + mapper->private_data = malloc(data->private_size); + if (mapper->private_data == NULL) + return -ENOMEM; + memset(mapper->private_data, 0, data->private_size); + + mapper->cntr_count = cntr_count; + mapper->verbose = verbose; + + return 0; +} + +int mapper_context_pre_process(struct mapper_context *mapper, + snd_pcm_access_t access, + unsigned int bytes_per_sample, + unsigned int samples_per_frame, + unsigned int frames_per_buffer, + struct container_context *cntrs) +{ + int err; + + assert(mapper); + assert(access >= SND_PCM_ACCESS_MMAP_INTERLEAVED); + assert(access <= SND_PCM_ACCESS_RW_NONINTERLEAVED); + assert(bytes_per_sample > 0); + assert(samples_per_frame > 0); + assert(cntrs); + + // The purpose of multiple target is to mux/demux each channels to/from + // containers. + if (mapper->target == MAPPER_TARGET_MULTIPLE && + samples_per_frame != mapper->cntr_count) + return -EINVAL; + + mapper->access = access; + mapper->bytes_per_sample = bytes_per_sample; + mapper->samples_per_frame = samples_per_frame; + mapper->frames_per_buffer = frames_per_buffer; + + err = mapper->ops->pre_process(mapper, cntrs, mapper->cntr_count); + if (err < 0) + return err; + + if (mapper->verbose > 0) { + fprintf(stderr, "Mapper: %s\n", + mapper_type_labels[mapper->type]); + fprintf(stderr, " target: %s\n", + mapper_target_labels[mapper->target]); + fprintf(stderr, " access: %s\n", + snd_pcm_access_name(mapper->access)); + fprintf(stderr, " bytes/sample: %u\n", + mapper->bytes_per_sample); + fprintf(stderr, " samples/frame: %u\n", + mapper->samples_per_frame); + fprintf(stderr, " frames/buffer: %lu\n", + mapper->frames_per_buffer); + } + + return 0; +} + +int mapper_context_process_frames(struct mapper_context *mapper, + void *frame_buffer, + unsigned int *frame_count, + struct container_context *cntrs) +{ + assert(mapper); + assert(frame_buffer); + assert(frame_count); + assert(*frame_count <= mapper->frames_per_buffer); + assert(cntrs); + + return mapper->ops->process_frames(mapper, frame_buffer, frame_count, + cntrs, mapper->cntr_count); +} + +void mapper_context_post_process(struct mapper_context *mapper) +{ + assert(mapper); + + if (mapper->ops && mapper->ops->post_process) + mapper->ops->post_process(mapper); +} + +void mapper_context_destroy(struct mapper_context *mapper) +{ + assert(mapper); + + if (mapper->private_data) + free(mapper->private_data); + mapper->private_data = NULL; +} diff --git a/axfer/mapper.h b/axfer/mapper.h new file mode 100644 index 0000000..58b6118 --- /dev/null +++ b/axfer/mapper.h @@ -0,0 +1,87 @@ +// SPDX-License-Identifier: GPL-2.0 +// +// mapper.h - an interface of muxer/demuxer between buffer with data frames and +// formatted files. +// +// Copyright (c) 2018 Takashi Sakamoto +// +// Licensed under the terms of the GNU General Public License, version 2. + +#ifndef __ALSA_UTILS_AXFER_MAPPER__H_ +#define __ALSA_UTILS_AXFER_MAPPER__H_ + +#include "container.h" + +enum mapper_type { + MAPPER_TYPE_MUXER = 0, + MAPPER_TYPE_DEMUXER, + MAPPER_TYPE_COUNT, +}; + +enum mapper_target { + MAPPER_TARGET_SINGLE = 0, + MAPPER_TARGET_MULTIPLE, + MAPPER_TARGET_COUNT, +}; + +struct mapper_ops; + +struct mapper_context { + enum mapper_type type; + enum mapper_target target; + const struct mapper_ops *ops; + unsigned int private_size; + + void *private_data; + unsigned int cntr_count; + + // A part of parameters of PCM substream. + snd_pcm_access_t access; + unsigned int bytes_per_sample; + unsigned int samples_per_frame; + snd_pcm_uframes_t frames_per_buffer; + + unsigned int verbose; +}; + +int mapper_context_init(struct mapper_context *mapper, + enum mapper_type type, unsigned int cntr_count, + unsigned int verbose); +int mapper_context_pre_process(struct mapper_context *mapper, + snd_pcm_access_t access, + unsigned int bytes_per_sample, + unsigned int samples_per_frame, + unsigned int frames_per_buffer, + struct container_context *cntrs); +int mapper_context_process_frames(struct mapper_context *mapper, + void *frame_buffer, + unsigned int *frame_count, + struct container_context *cntrs); +void mapper_context_post_process(struct mapper_context *mapper); +void mapper_context_destroy(struct mapper_context *mapper); + +// For internal use in 'mapper' module. + +struct mapper_ops { + int (*pre_process)(struct mapper_context *mapper, + struct container_context *cntrs, + unsigned int cntr_count); + int (*process_frames)(struct mapper_context *mapper, + void *frame_buffer, unsigned int *frame_count, + struct container_context *cntrs, + unsigned int cntr_count); + void (*post_process)(struct mapper_context *mapper); +}; + +struct mapper_data { + struct mapper_ops ops; + unsigned int private_size; +}; + +extern const struct mapper_data mapper_muxer_single; +extern const struct mapper_data mapper_demuxer_single; + +extern const struct mapper_data mapper_muxer_multiple; +extern const struct mapper_data mapper_demuxer_multiple; + +#endif diff --git a/axfer/misc.h b/axfer/misc.h new file mode 100644 index 0000000..5f27d28 --- /dev/null +++ b/axfer/misc.h @@ -0,0 +1,19 @@ +// SPDX-License-Identifier: GPL-2.0 +// +// misc.h - a header file for miscellaneous tools. +// +// Copyright (c) 2018 Takashi Sakamoto +// +// Licensed under the terms of the GNU General Public License, version 2. + +#ifndef __ALSA_UTILS_AXFER_MISC__H_ +#define __ALSA_UTILS_AXFER_MISC__H_ + +#include + +#define ARRAY_SIZE(array) (sizeof(array)/sizeof(array[0])) + +char *arg_duplicate_string(const char *str, int *err); +long arg_parse_decimal_num(const char *str, int *err); + +#endif diff --git a/axfer/subcmd-list.c b/axfer/subcmd-list.c new file mode 100644 index 0000000..359f73f --- /dev/null +++ b/axfer/subcmd-list.c @@ -0,0 +1,273 @@ +// SPDX-License-Identifier: GPL-2.0 +// +// subcmd-list.c - operations for list sub command. +// +// Copyright (c) 2018 Takashi Sakamoto +// +// Licensed under the terms of the GNU General Public License, version 2. + +#include "subcmd.h" +#include "misc.h" + +#include +#include + +enum list_op { + LIST_OP_DEVICE = 0, + LIST_OP_PCM, + LIST_OP_HELP, +}; + +static int dump_device(snd_ctl_t *handle, const char *id, const char *name, + snd_pcm_stream_t direction, snd_pcm_info_t *info) +{ + unsigned int count; + int i; + int err; + + printf("card %i: %s [%s], device %i: %s [%s]\n", + snd_pcm_info_get_card(info), id, name, + snd_pcm_info_get_device(info), snd_pcm_info_get_id(info), + snd_pcm_info_get_name(info)); + + count = snd_pcm_info_get_subdevices_count(info); + printf(" Subdevices: %i/%u\n", + snd_pcm_info_get_subdevices_avail(info), count); + + for (i = 0; i < count; ++i) { + snd_pcm_info_set_subdevice(info, i); + + err = snd_ctl_pcm_info(handle, info); + if (err < 0) { + printf("control digital audio playback info (%i): %s", + snd_pcm_info_get_card(info), snd_strerror(err)); + continue; + } + + printf(" Subdevice #%i: %s\n", + i, snd_pcm_info_get_subdevice_name(info)); + } + + return 0; +} + +static int dump_devices(snd_ctl_t *handle, const char *id, const char *name, + snd_pcm_stream_t direction) +{ + snd_pcm_info_t *info; + int device = -1; + int err; + + err = snd_pcm_info_malloc(&info); + if (err < 0) + return err; + + while (1) { + err = snd_ctl_pcm_next_device(handle, &device); + if (err < 0) + break; + if (device < 0) + break; + + snd_pcm_info_set_device(info, device); + snd_pcm_info_set_subdevice(info, 0); + snd_pcm_info_set_stream(info, direction); + err = snd_ctl_pcm_info(handle, info); + if (err < 0) + continue; + + err = dump_device(handle, id, name, direction, info); + if (err < 0) + break; + } + + free(info); + return err; +} + +static int list_devices(snd_pcm_stream_t direction) +{ + int card = -1; + char name[32]; + snd_ctl_t *handle; + snd_ctl_card_info_t *info; + int err; + + err = snd_ctl_card_info_malloc(&info); + if (err < 0) + return err; + + // Not found. + if (snd_card_next(&card) < 0 || card < 0) + goto end; + + printf("**** List of %s Hardware Devices ****\n", + snd_pcm_stream_name(direction)); + + while (card >= 0) { + sprintf(name, "hw:%d", card); + err = snd_ctl_open(&handle, name, 0); + if (err < 0) { + printf("control open (%i): %s", + card, snd_strerror(err)); + } else { + err = snd_ctl_card_info(handle, info); + if (err < 0) { + printf("control hardware info (%i): %s", + card, snd_strerror(err)); + } else { + err = dump_devices(handle, + snd_ctl_card_info_get_id(info), + snd_ctl_card_info_get_name(info), + direction); + } + snd_ctl_close(handle); + } + + if (err < 0) + break; + + // Go to next. + if (snd_card_next(&card) < 0) { + printf("snd_card_next"); + break; + } + } +end: + free(info); + return err; +} + +static int list_pcms(snd_pcm_stream_t direction) +{ + static const char *const filters[] = { + [SND_PCM_STREAM_CAPTURE] = "Input", + [SND_PCM_STREAM_PLAYBACK] = "Output", + }; + const char *filter; + void **hints; + void **n; + char *io; + char *name; + char *desc; + + if (snd_device_name_hint(-1, "pcm", &hints) < 0) + return -EINVAL; + + filter = filters[direction]; + + for (n = hints; *n != NULL; ++n) { + io = snd_device_name_get_hint(*n, "IOID"); + if (io != NULL && strcmp(io, filter) != 0) { + free(io); + continue; + } + + name = snd_device_name_get_hint(*n, "NAME"); + desc = snd_device_name_get_hint(*n, "DESC"); + + printf("%s\n", name); + if (desc == NULL) { + free(name); + free(desc); + continue; + } + + + printf(" "); + while (*desc) { + if (*desc == '\n') + printf("\n "); + else + putchar(*desc); + desc++; + } + putchar('\n'); + } + + snd_device_name_free_hint(hints); + + return 0; +} + +static void print_help(void) +{ + printf( +"Usage:\n" +" axfer list DIRECTION TARGET\n" +"\n" +" where:\n" +" DIRECTION = capture | playback\n" +" TARGET = device | pcm\n" + ); +} + +// Backward compatibility to aplay(1). +static bool decide_operation(int argc, char *const *argv, enum list_op *op) +{ + static const char *s_opts = "hlL"; + static const struct option l_opts[] = { + {"list-devices", 0, NULL, 'l'}, + {"list-pcms", 0, NULL, 'L'}, + {NULL, 0, NULL, 0} + }; + + optind = 0; + opterr = 0; + while (1) { + int c = getopt_long(argc, argv, s_opts, l_opts, NULL); + if (c < 0) + break; + if (c == 'l') { + *op = LIST_OP_DEVICE; + return true; + } + if (c == 'L') { + *op = LIST_OP_PCM; + return true; + } + } + + return false; +} + +static int detect_operation(int argc, char *const *argv, enum list_op *op) +{ + static const char *const ops[] = { + [LIST_OP_DEVICE] = "device", + [LIST_OP_PCM] = "pcm", + }; + int i; + + if (argc < 2) + return false; + + for (i = 0; i < ARRAY_SIZE(ops); ++i) { + if (!strcmp(argv[1], ops[i])) { + *op = i; + return true; + } + } + + return false; +} + +int subcmd_list(int argc, char *const *argv, snd_pcm_stream_t direction) +{ + enum list_op op = LIST_OP_HELP; + int err = 0; + + // Renewed command system. + if (!detect_operation(argc, argv, &op) && + !decide_operation(argc, argv, &op)) + err = -EINVAL; + + if (op == LIST_OP_DEVICE) + err = list_devices(direction); + else if (op == LIST_OP_PCM) + err = list_pcms(direction); + else + print_help(); + + return err; +} diff --git a/axfer/subcmd-transfer.c b/axfer/subcmd-transfer.c new file mode 100644 index 0000000..8746e6f --- /dev/null +++ b/axfer/subcmd-transfer.c @@ -0,0 +1,462 @@ +// SPDX-License-Identifier: GPL-2.0 +// +// subcmd-transfer.c - operations for transfer sub command. +// +// Copyright (c) 2018 Takashi Sakamoto +// +// Licensed under the terms of the GNU General Public License, version 2. + +#include "xfer.h" +#include "subcmd.h" +#include "misc.h" + +#include +#include + +struct context { + struct xfer_context xfer; + struct mapper_context mapper; + struct container_context *cntrs; + unsigned int cntr_count; + + // NOTE: To handling Unix signal. + bool interrupted; + int signal; +}; + +// NOTE: To handling Unix signal. +static struct context *ctx_ptr; + +static void handle_unix_signal_for_finish(int sig) +{ + int i; + + for (i = 0; i < ctx_ptr->cntr_count; ++i) + ctx_ptr->cntrs[i].interrupted = true; + + ctx_ptr->signal = sig; + ctx_ptr->interrupted = true; +} + +static void handle_unix_signal_for_suspend(int sig) +{ + sigset_t curr, prev; + struct sigaction sa = {0}; + + // 1. suspend substream. + xfer_context_pause(&ctx_ptr->xfer, true); + + // 2. Prepare for default handler(SIG_DFL) of SIGTSTP to stop this + // process. + if (sigaction(SIGTSTP, NULL, &sa) < 0) { + fprintf(stderr, "sigaction(2)\n"); + exit(EXIT_FAILURE); + } + if (sa.sa_handler == SIG_ERR) + exit(EXIT_FAILURE); + if (sa.sa_handler == handle_unix_signal_for_suspend) + sa.sa_handler = SIG_DFL; + if (sigaction(SIGTSTP, &sa, NULL) < 0) { + fprintf(stderr, "sigaction(2)\n"); + exit(EXIT_FAILURE); + } + + // Queue SIGTSTP. + raise(SIGTSTP); + + // Release the queued signal from being blocked. This causes an + // additional interrupt for the default handler. + sigemptyset(&curr); + sigaddset(&curr, SIGTSTP); + if (sigprocmask(SIG_UNBLOCK, &curr, &prev) < 0) { + fprintf(stderr, "sigprocmask(2)\n"); + exit(EXIT_FAILURE); + } + + // 3. SIGCONT is cought and rescheduled. Recover blocking status of + // UNIX signals. + if (sigprocmask(SIG_SETMASK, &prev, NULL) < 0) { + fprintf(stderr, "sigprocmask(2)\n"); + exit(EXIT_FAILURE); + } + + // Reconfigure this handler for SIGTSTP, instead of default one. + sigemptyset(&sa.sa_mask); + sa.sa_flags = SA_RESTART; + sa.sa_handler = handle_unix_signal_for_suspend; + if (sigaction(SIGTSTP, &sa, NULL) < 0) { + fprintf(stderr, "sigaction(2)\n"); + exit(EXIT_FAILURE); + } + + // 4. Continue the PCM substream. + xfer_context_pause(&ctx_ptr->xfer, false); +} + +static int prepare_signal_handler(struct context *ctx) +{ + struct sigaction sa = {0}; + + sigemptyset(&sa.sa_mask); + sa.sa_flags = 0; + sa.sa_handler = handle_unix_signal_for_finish; + + if (sigaction(SIGINT, &sa, NULL) < 0) + return -errno; + if (sigaction(SIGTERM, &sa, NULL) < 0) + return -errno; + + sigemptyset(&sa.sa_mask); + sa.sa_flags = 0; + sa.sa_handler = handle_unix_signal_for_suspend; + if (sigaction(SIGTSTP, &sa, NULL) < 0) + return -errno; + + ctx_ptr = ctx; + + return 0; +} + +static int context_init(struct context *ctx, snd_pcm_stream_t direction, + int argc, char *const *argv) +{ + const char *xfer_type_literal; + enum xfer_type xfer_type; + int i; + + // Decide transfer backend before option parser runs. + xfer_type_literal = NULL; + for (i = 0; i < argc; ++i) { + if (strstr(argv[i], "--xfer-type") != argv[i]) + continue; + xfer_type_literal = argv[i] + 12; + } + if (xfer_type_literal == NULL) { + xfer_type = XFER_TYPE_LIBASOUND; + } else { + xfer_type = xfer_type_from_label(xfer_type_literal); + if (xfer_type == XFER_TYPE_UNSUPPORTED) { + fprintf(stderr, "The '%s' xfer type is not supported\n", + xfer_type_literal); + return -EINVAL; + } + } + + // Initialize transfer. + return xfer_context_init(&ctx->xfer, xfer_type, direction, argc, argv); +} + +static int capture_pre_process(struct context *ctx, snd_pcm_access_t *access, + snd_pcm_uframes_t *frames_per_buffer, + uint64_t *total_frame_count) +{ + snd_pcm_format_t sample_format = SND_PCM_FORMAT_UNKNOWN; + unsigned int samples_per_frame = 0; + unsigned int frames_per_second = 0; + unsigned int channels; + int i; + int err; + + err = xfer_context_pre_process(&ctx->xfer, &sample_format, + &samples_per_frame, &frames_per_second, + access, frames_per_buffer); + if (err < 0) + return err; + + // Prepare for containers. + ctx->cntrs = calloc(ctx->xfer.path_count, sizeof(*ctx->cntrs)); + if (ctx->cntrs == NULL) + return -ENOMEM; + ctx->cntr_count = ctx->xfer.path_count; + + if (ctx->cntr_count > 1) + channels = 1; + else + channels = samples_per_frame; + + *total_frame_count = 0; + for (i = 0; i < ctx->cntr_count; ++i) { + uint64_t frame_count; + + err = container_builder_init(ctx->cntrs + i, + ctx->xfer.paths[i], + ctx->xfer.cntr_format, + ctx->xfer.verbose > 1); + if (err < 0) + return err; + + err = container_context_pre_process(ctx->cntrs + i, + &sample_format, &channels, + &frames_per_second, + &frame_count); + if (err < 0) + return err; + + if (*total_frame_count == 0) + *total_frame_count = frame_count; + if (frame_count < *total_frame_count) + *total_frame_count = frame_count; + } + + return 0; +} + +static int playback_pre_process(struct context *ctx, snd_pcm_access_t *access, + snd_pcm_uframes_t *frames_per_buffer, + uint64_t *total_frame_count) +{ + snd_pcm_format_t sample_format = SND_PCM_FORMAT_UNKNOWN; + unsigned int samples_per_frame = 0; + unsigned int frames_per_second = 0; + int i; + int err; + + // Prepare for containers. + ctx->cntrs = calloc(ctx->xfer.path_count, sizeof(*ctx->cntrs)); + if (ctx->cntrs == NULL) + return -ENOMEM; + ctx->cntr_count = ctx->xfer.path_count; + + for (i = 0; i < ctx->cntr_count; ++i) { + snd_pcm_format_t format; + unsigned int channels; + unsigned int rate; + uint64_t frame_count; + + err = container_parser_init(ctx->cntrs + i, + ctx->xfer.paths[i], + ctx->xfer.verbose > 1); + if (err < 0) + return err; + + if (i == 0) { + // For a raw container. + format = ctx->xfer.sample_format; + channels = ctx->xfer.samples_per_frame; + rate = ctx->xfer.frames_per_second; + } else { + format = sample_format; + channels = samples_per_frame; + rate = frames_per_second; + } + + err = container_context_pre_process(ctx->cntrs + i, &format, + &channels, &rate, + &frame_count); + if (err < 0) + return err; + + if (format == SND_PCM_FORMAT_UNKNOWN || channels == 0 || + rate == 0) { + fprintf(stderr, + "Sample format, channels and rate should be " + "indicated for given files.\n"); + return -EINVAL; + } + + if (i == 0) { + sample_format = format; + samples_per_frame = channels; + frames_per_second = rate; + *total_frame_count = frame_count; + } else { + if (format != sample_format) { + fprintf(stderr, + "When using several files, they " + "should include the same sample " + "format.\n"); + return -EINVAL; + } + + // No need to check channels to handle multiple + // containers. + if (rate != frames_per_second) { + fprintf(stderr, + "When using several files, they " + "should include samples at the same " + "sampling rate.\n"); + return -EINVAL; + } + if (frame_count < *total_frame_count) + *total_frame_count = frame_count; + } + } + + if (ctx->cntr_count > 1) + samples_per_frame = ctx->cntr_count; + + // Configure hardware with these parameters. + return xfer_context_pre_process(&ctx->xfer, &sample_format, + &samples_per_frame, &frames_per_second, + access, frames_per_buffer); +} + +static int context_pre_process(struct context *ctx, snd_pcm_stream_t direction, + uint64_t *total_frame_count) +{ + snd_pcm_access_t access; + snd_pcm_uframes_t frames_per_buffer = 0; + unsigned int bytes_per_sample = 0; + enum mapper_type mapper_type; + int err; + + if (direction == SND_PCM_STREAM_CAPTURE) { + mapper_type = MAPPER_TYPE_DEMUXER; + err = capture_pre_process(ctx, &access, &frames_per_buffer, + total_frame_count); + } else { + mapper_type = MAPPER_TYPE_MUXER; + err = playback_pre_process(ctx, &access, &frames_per_buffer, + total_frame_count); + } + if (err < 0) + return err; + + // Prepare for mapper. + err = mapper_context_init(&ctx->mapper, mapper_type, ctx->cntr_count, + ctx->xfer.verbose > 1); + if (err < 0) + return err; + + bytes_per_sample = + snd_pcm_format_physical_width(ctx->xfer.sample_format) / 8; + if (bytes_per_sample <= 0) + return -ENXIO; + err = mapper_context_pre_process(&ctx->mapper, access, bytes_per_sample, + ctx->xfer.samples_per_frame, + frames_per_buffer, ctx->cntrs); + if (err < 0) + return err; + + xfer_options_calculate_duration(&ctx->xfer, total_frame_count); + + return 0; +} + +static int context_process_frames(struct context *ctx, + snd_pcm_stream_t direction, + uint64_t expected_frame_count, + uint64_t *actual_frame_count) +{ + bool verbose = ctx->xfer.verbose > 2; + unsigned int frame_count; + int i; + int err = 0; + + if (!ctx->xfer.quiet) { + fprintf(stderr, + "%s: Format '%s', Rate %u Hz, Channels ", + snd_pcm_stream_name(direction), + snd_pcm_format_description(ctx->xfer.sample_format), + ctx->xfer.frames_per_second); + if (ctx->xfer.samples_per_frame == 1) + fprintf(stderr, "'monaural'"); + else if (ctx->xfer.samples_per_frame == 2) + fprintf(stderr, "'Stereo'"); + else + fprintf(stderr, "%u", ctx->xfer.samples_per_frame); + fprintf(stderr, "\n"); + } + + *actual_frame_count = 0; + while (!ctx->interrupted) { + struct container_context *cntr; + + // Tell remains to expected frame count. + frame_count = expected_frame_count - *actual_frame_count; + err = xfer_context_process_frames(&ctx->xfer, &ctx->mapper, + ctx->cntrs, &frame_count); + if (err < 0) { + if (err == -EAGAIN || err == -EINTR) + continue; + break; + } + if (verbose) { + fprintf(stderr, + " handled: %u\n", frame_count); + } + for (i = 0; i < ctx->cntr_count; ++i) { + cntr = &ctx->cntrs[i]; + if (cntr->eof) + break; + } + if (i < ctx->cntr_count) + break; + + *actual_frame_count += frame_count; + if (*actual_frame_count >= expected_frame_count) + break; + } + + if (!ctx->xfer.quiet) { + fprintf(stderr, + "%s: Expected %" PRIu64 "frames, " + "Actual %" PRIu64 "frames\n", + snd_pcm_stream_name(direction), expected_frame_count, + *actual_frame_count); + if (ctx->interrupted) { + fprintf(stderr, "Aborted by signal: %s\n", + strsignal(ctx->signal)); + return 0; + } + } + + return err; +} + +static void context_post_process(struct context *ctx, + uint64_t accumulated_frame_count) +{ + uint64_t total_frame_count; + int i; + + xfer_context_post_process(&ctx->xfer); + + if (ctx->cntrs) { + for (i = 0; i < ctx->cntr_count; ++i) { + container_context_post_process(ctx->cntrs + i, + &total_frame_count); + container_context_destroy(ctx->cntrs + i); + } + free(ctx->cntrs); + } + + mapper_context_post_process(&ctx->mapper); + mapper_context_destroy(&ctx->mapper); +} + +static void context_destroy(struct context *ctx) +{ + xfer_context_destroy(&ctx->xfer); +} + +int subcmd_transfer(int argc, char *const *argv, snd_pcm_stream_t direction) +{ + struct context ctx = {0}; + uint64_t expected_frame_count = 0; + uint64_t actual_frame_count = 0; + int err = 0; + + err = prepare_signal_handler(&ctx); + if (err < 0) + return err; + + err = context_init(&ctx, direction, argc, argv); + if (err < 0) + goto end; + if (ctx.xfer.help || ctx.xfer.dump_hw_params) + goto end; + + err = context_pre_process(&ctx, direction, &expected_frame_count); + if (err < 0) + goto end; + + err = context_process_frames(&ctx, direction, expected_frame_count, + &actual_frame_count); +end: + context_post_process(&ctx, actual_frame_count); + + context_destroy(&ctx); + + return err; +} diff --git a/axfer/subcmd.h b/axfer/subcmd.h new file mode 100644 index 0000000..5ffe1e4 --- /dev/null +++ b/axfer/subcmd.h @@ -0,0 +1,18 @@ +// SPDX-License-Identifier: GPL-2.0 +// +// subcmd.h - a header for each sub-commands. +// +// Copyright (c) 2018 Takashi Sakamoto +// +// Licensed under the terms of the GNU General Public License, version 2. + +#ifndef __ALSA_UTILS_AXFER_SUBCMD__H_ +#define __ALSA_UTILS_AXFER_SUBCMD__H_ + +#include + +int subcmd_list(int argc, char *const *argv, snd_pcm_stream_t direction); + +int subcmd_transfer(int argc, char *const *argv, snd_pcm_stream_t direction); + +#endif diff --git a/axfer/test/Makefile.am b/axfer/test/Makefile.am new file mode 100644 index 0000000..6521134 --- /dev/null +++ b/axfer/test/Makefile.am @@ -0,0 +1,33 @@ +TESTS = \ + container-test \ + mapper-test + +check_PROGRAMS = \ + container-test \ + mapper-test + +container_test_SOURCES = \ + ../container.h \ + ../container.c \ + ../container-riff-wave.c \ + ../container-au.c \ + ../container-voc.c \ + ../container-raw.c \ + generator.c \ + generator.h \ + container-test.c + +mapper_test_SOURCES = \ + ../container.h \ + ../container.c \ + ../container-riff-wave.c \ + ../container-au.c \ + ../container-voc.c \ + ../container-raw.c \ + ../mapper.h \ + ../mapper.c \ + ../mapper-single.c \ + ../mapper-multiple.c \ + generator.c \ + generator.h \ + mapper-test.c diff --git a/axfer/test/Makefile.in b/axfer/test/Makefile.in new file mode 100644 index 0000000..d120eb5 --- /dev/null +++ b/axfer/test/Makefile.in @@ -0,0 +1,1167 @@ +# Makefile.in generated by automake 1.16.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994-2018 Free Software Foundation, Inc. + +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ +VPATH = @srcdir@ +am__is_gnu_make = { \ + if test -z '$(MAKELEVEL)'; then \ + false; \ + elif test -n '$(MAKE_HOST)'; then \ + true; \ + elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ + true; \ + else \ + false; \ + fi; \ +} +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + esac; \ + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +TESTS = container-test$(EXEEXT) mapper-test$(EXEEXT) +check_PROGRAMS = container-test$(EXEEXT) mapper-test$(EXEEXT) +subdir = axfer/test +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/gettext.m4 \ + $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/lib-ld.m4 \ + $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ + $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \ + $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/acinclude.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/include/aconfig.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +am_container_test_OBJECTS = container.$(OBJEXT) \ + container-riff-wave.$(OBJEXT) container-au.$(OBJEXT) \ + container-voc.$(OBJEXT) container-raw.$(OBJEXT) \ + generator.$(OBJEXT) container-test.$(OBJEXT) +container_test_OBJECTS = $(am_container_test_OBJECTS) +container_test_LDADD = $(LDADD) +am_mapper_test_OBJECTS = container.$(OBJEXT) \ + container-riff-wave.$(OBJEXT) container-au.$(OBJEXT) \ + container-voc.$(OBJEXT) container-raw.$(OBJEXT) \ + mapper.$(OBJEXT) mapper-single.$(OBJEXT) \ + mapper-multiple.$(OBJEXT) generator.$(OBJEXT) \ + mapper-test.$(OBJEXT) +mapper_test_OBJECTS = $(am_mapper_test_OBJECTS) +mapper_test_LDADD = $(LDADD) +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__maybe_remake_depfiles = depfiles +am__depfiles_remade = ./$(DEPDIR)/container-au.Po \ + ./$(DEPDIR)/container-raw.Po \ + ./$(DEPDIR)/container-riff-wave.Po \ + ./$(DEPDIR)/container-test.Po ./$(DEPDIR)/container-voc.Po \ + ./$(DEPDIR)/container.Po ./$(DEPDIR)/generator.Po \ + ./$(DEPDIR)/mapper-multiple.Po ./$(DEPDIR)/mapper-single.Po \ + ./$(DEPDIR)/mapper-test.Po ./$(DEPDIR)/mapper.Po +am__mv = mv -f +AM_V_lt = $(am__v_lt_@AM_V@) +am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) +am__v_lt_0 = --silent +am__v_lt_1 = +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +AM_V_CC = $(am__v_CC_@AM_V@) +am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) +am__v_CC_0 = @echo " CC " $@; +am__v_CC_1 = +CCLD = $(CC) +LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_CCLD = $(am__v_CCLD_@AM_V@) +am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) +am__v_CCLD_0 = @echo " CCLD " $@; +am__v_CCLD_1 = +SOURCES = $(container_test_SOURCES) $(mapper_test_SOURCES) +DIST_SOURCES = $(container_test_SOURCES) $(mapper_test_SOURCES) +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) +# Read a list of newline-separated strings from the standard input, +# and print each of them once, without duplicates. Input order is +# *not* preserved. +am__uniquify_input = $(AWK) '\ + BEGIN { nonempty = 0; } \ + { items[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in items) print i; }; } \ +' +# Make sure the list of sources is unique. This is necessary because, +# e.g., the same source file might be shared among _SOURCES variables +# for different programs/libraries. +am__define_uniq_tagged_files = \ + list='$(am__tagged_files)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | $(am__uniquify_input)` +ETAGS = etags +CTAGS = ctags +am__tty_colors_dummy = \ + mgn= red= grn= lgn= blu= brg= std=; \ + am__color_tests=no +am__tty_colors = { \ + $(am__tty_colors_dummy); \ + if test "X$(AM_COLOR_TESTS)" = Xno; then \ + am__color_tests=no; \ + elif test "X$(AM_COLOR_TESTS)" = Xalways; then \ + am__color_tests=yes; \ + elif test "X$$TERM" != Xdumb && { test -t 1; } 2>/dev/null; then \ + am__color_tests=yes; \ + fi; \ + if test $$am__color_tests = yes; then \ + red=''; \ + grn=''; \ + lgn=''; \ + blu=''; \ + mgn=''; \ + brg=''; \ + std=''; \ + fi; \ +} +am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; +am__vpath_adj = case $$p in \ + $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ + *) f=$$p;; \ + esac; +am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; +am__install_max = 40 +am__nobase_strip_setup = \ + srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` +am__nobase_strip = \ + for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" +am__nobase_list = $(am__nobase_strip_setup); \ + for p in $$list; do echo "$$p $$p"; done | \ + sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ + $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ + if (++n[$$2] == $(am__install_max)) \ + { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ + END { for (dir in files) print dir, files[dir] }' +am__base_list = \ + sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ + sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' +am__uninstall_files_from_dir = { \ + test -z "$$files" \ + || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ + || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ + $(am__cd) "$$dir" && rm -f $$files; }; \ + } +am__recheck_rx = ^[ ]*:recheck:[ ]* +am__global_test_result_rx = ^[ ]*:global-test-result:[ ]* +am__copy_in_global_log_rx = ^[ ]*:copy-in-global-log:[ ]* +# A command that, given a newline-separated list of test names on the +# standard input, print the name of the tests that are to be re-run +# upon "make recheck". +am__list_recheck_tests = $(AWK) '{ \ + recheck = 1; \ + while ((rc = (getline line < ($$0 ".trs"))) != 0) \ + { \ + if (rc < 0) \ + { \ + if ((getline line2 < ($$0 ".log")) < 0) \ + recheck = 0; \ + break; \ + } \ + else if (line ~ /$(am__recheck_rx)[nN][Oo]/) \ + { \ + recheck = 0; \ + break; \ + } \ + else if (line ~ /$(am__recheck_rx)[yY][eE][sS]/) \ + { \ + break; \ + } \ + }; \ + if (recheck) \ + print $$0; \ + close ($$0 ".trs"); \ + close ($$0 ".log"); \ +}' +# A command that, given a newline-separated list of test names on the +# standard input, create the global log from their .trs and .log files. +am__create_global_log = $(AWK) ' \ +function fatal(msg) \ +{ \ + print "fatal: making $@: " msg | "cat >&2"; \ + exit 1; \ +} \ +function rst_section(header) \ +{ \ + print header; \ + len = length(header); \ + for (i = 1; i <= len; i = i + 1) \ + printf "="; \ + printf "\n\n"; \ +} \ +{ \ + copy_in_global_log = 1; \ + global_test_result = "RUN"; \ + while ((rc = (getline line < ($$0 ".trs"))) != 0) \ + { \ + if (rc < 0) \ + fatal("failed to read from " $$0 ".trs"); \ + if (line ~ /$(am__global_test_result_rx)/) \ + { \ + sub("$(am__global_test_result_rx)", "", line); \ + sub("[ ]*$$", "", line); \ + global_test_result = line; \ + } \ + else if (line ~ /$(am__copy_in_global_log_rx)[nN][oO]/) \ + copy_in_global_log = 0; \ + }; \ + if (copy_in_global_log) \ + { \ + rst_section(global_test_result ": " $$0); \ + while ((rc = (getline line < ($$0 ".log"))) != 0) \ + { \ + if (rc < 0) \ + fatal("failed to read from " $$0 ".log"); \ + print line; \ + }; \ + printf "\n"; \ + }; \ + close ($$0 ".trs"); \ + close ($$0 ".log"); \ +}' +# Restructured Text title. +am__rst_title = { sed 's/.*/ & /;h;s/./=/g;p;x;s/ *$$//;p;g' && echo; } +# Solaris 10 'make', and several other traditional 'make' implementations, +# pass "-e" to $(SHELL), and POSIX 2008 even requires this. Work around it +# by disabling -e (using the XSI extension "set +e") if it's set. +am__sh_e_setup = case $$- in *e*) set +e;; esac +# Default flags passed to test drivers. +am__common_driver_flags = \ + --color-tests "$$am__color_tests" \ + --enable-hard-errors "$$am__enable_hard_errors" \ + --expect-failure "$$am__expect_failure" +# To be inserted before the command running the test. Creates the +# directory for the log if needed. Stores in $dir the directory +# containing $f, in $tst the test, in $log the log. Executes the +# developer- defined test setup AM_TESTS_ENVIRONMENT (if any), and +# passes TESTS_ENVIRONMENT. Set up options for the wrapper that +# will run the test scripts (or their associated LOG_COMPILER, if +# thy have one). +am__check_pre = \ +$(am__sh_e_setup); \ +$(am__vpath_adj_setup) $(am__vpath_adj) \ +$(am__tty_colors); \ +srcdir=$(srcdir); export srcdir; \ +case "$@" in \ + */*) am__odir=`echo "./$@" | sed 's|/[^/]*$$||'`;; \ + *) am__odir=.;; \ +esac; \ +test "x$$am__odir" = x"." || test -d "$$am__odir" \ + || $(MKDIR_P) "$$am__odir" || exit $$?; \ +if test -f "./$$f"; then dir=./; \ +elif test -f "$$f"; then dir=; \ +else dir="$(srcdir)/"; fi; \ +tst=$$dir$$f; log='$@'; \ +if test -n '$(DISABLE_HARD_ERRORS)'; then \ + am__enable_hard_errors=no; \ +else \ + am__enable_hard_errors=yes; \ +fi; \ +case " $(XFAIL_TESTS) " in \ + *[\ \ ]$$f[\ \ ]* | *[\ \ ]$$dir$$f[\ \ ]*) \ + am__expect_failure=yes;; \ + *) \ + am__expect_failure=no;; \ +esac; \ +$(AM_TESTS_ENVIRONMENT) $(TESTS_ENVIRONMENT) +# A shell command to get the names of the tests scripts with any registered +# extension removed (i.e., equivalently, the names of the test logs, with +# the '.log' extension removed). The result is saved in the shell variable +# '$bases'. This honors runtime overriding of TESTS and TEST_LOGS. Sadly, +# we cannot use something simpler, involving e.g., "$(TEST_LOGS:.log=)", +# since that might cause problem with VPATH rewrites for suffix-less tests. +# See also 'test-harness-vpath-rewrite.sh' and 'test-trs-basic.sh'. +am__set_TESTS_bases = \ + bases='$(TEST_LOGS)'; \ + bases=`for i in $$bases; do echo $$i; done | sed 's/\.log$$//'`; \ + bases=`echo $$bases` +RECHECK_LOGS = $(TEST_LOGS) +AM_RECURSIVE_TARGETS = check recheck +TEST_SUITE_LOG = test-suite.log +TEST_EXTENSIONS = @EXEEXT@ .test +LOG_DRIVER = $(SHELL) $(top_srcdir)/test-driver +LOG_COMPILE = $(LOG_COMPILER) $(AM_LOG_FLAGS) $(LOG_FLAGS) +am__set_b = \ + case '$@' in \ + */*) \ + case '$*' in \ + */*) b='$*';; \ + *) b=`echo '$@' | sed 's/\.log$$//'`; \ + esac;; \ + *) \ + b='$*';; \ + esac +am__test_logs1 = $(TESTS:=.log) +am__test_logs2 = $(am__test_logs1:@EXEEXT@.log=.log) +TEST_LOGS = $(am__test_logs2:.test.log=.log) +TEST_LOG_DRIVER = $(SHELL) $(top_srcdir)/test-driver +TEST_LOG_COMPILE = $(TEST_LOG_COMPILER) $(AM_TEST_LOG_FLAGS) \ + $(TEST_LOG_FLAGS) +am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/depcomp \ + $(top_srcdir)/test-driver +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +ALSACTL_DAEMONSWITCH = @ALSACTL_DAEMONSWITCH@ +ALSACTL_PIDFILE_DIR = @ALSACTL_PIDFILE_DIR@ +ALSA_CFLAGS = @ALSA_CFLAGS@ +ALSA_LIBS = @ALSA_LIBS@ +ALSA_TOPOLOGY_LIBS = @ALSA_TOPOLOGY_LIBS@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +ASOUND_LOCK_DIR = @ASOUND_LOCK_DIR@ +ASOUND_STATE_DIR = @ASOUND_STATE_DIR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CURSESINC = @CURSESINC@ +CURSESLIB = @CURSESLIB@ +CURSES_CFLAGS = @CURSES_CFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +FFTW_CFLAGS = @FFTW_CFLAGS@ +FFTW_INC = @FFTW_INC@ +FFTW_LIB = @FFTW_LIB@ +GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ +GMSGFMT = @GMSGFMT@ +GMSGFMT_015 = @GMSGFMT_015@ +GREP = @GREP@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +INTLLIBS = @INTLLIBS@ +INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@ +LDFLAGS = @LDFLAGS@ +LIBICONV = @LIBICONV@ +LIBINTL = @LIBINTL@ +LIBOBJS = @LIBOBJS@ +LIBRT = @LIBRT@ +LIBS = @LIBS@ +LN_S = @LN_S@ +LTLIBICONV = @LTLIBICONV@ +LTLIBINTL = @LTLIBINTL@ +LTLIBOBJS = @LTLIBOBJS@ +MAINT = @MAINT@ +MAKEINFO = @MAKEINFO@ +MKDIR_P = @MKDIR_P@ +MSGFMT = @MSGFMT@ +MSGFMT_015 = @MSGFMT_015@ +MSGMERGE = @MSGMERGE@ +NCURSESW_CFLAGS = @NCURSESW_CFLAGS@ +NCURSESW_LIBS = @NCURSESW_LIBS@ +NCURSES_CFLAGS = @NCURSES_CFLAGS@ +NCURSES_LIBS = @NCURSES_LIBS@ +OBJEXT = @OBJEXT@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ +POSUB = @POSUB@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +SND_UTIL_MAJOR = @SND_UTIL_MAJOR@ +SND_UTIL_MINOR = @SND_UTIL_MINOR@ +SND_UTIL_SUBMINOR = @SND_UTIL_SUBMINOR@ +SND_UTIL_VERSION = @SND_UTIL_VERSION@ +STRIP = @STRIP@ +SYSTEMD_CFLAGS = @SYSTEMD_CFLAGS@ +SYSTEMD_LIBS = @SYSTEMD_LIBS@ +TESTSOUND = @TESTSOUND@ +USE_NLS = @USE_NLS@ +VERSION = @VERSION@ +XGETTEXT = @XGETTEXT@ +XGETTEXT_015 = @XGETTEXT_015@ +XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_CC = @ac_ct_CC@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +mydatadir = @mydatadir@ +ncurses5_config = @ncurses5_config@ +ncursesw5_config = @ncursesw5_config@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +rst2man_available = @rst2man_available@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +systemdsystemunitdir = @systemdsystemunitdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +udevrulesdir = @udevrulesdir@ +xmlto_available = @xmlto_available@ +container_test_SOURCES = \ + ../container.h \ + ../container.c \ + ../container-riff-wave.c \ + ../container-au.c \ + ../container-voc.c \ + ../container-raw.c \ + generator.c \ + generator.h \ + container-test.c + +mapper_test_SOURCES = \ + ../container.h \ + ../container.c \ + ../container-riff-wave.c \ + ../container-au.c \ + ../container-voc.c \ + ../container-raw.c \ + ../mapper.h \ + ../mapper.c \ + ../mapper-single.c \ + ../mapper-multiple.c \ + generator.c \ + generator.h \ + mapper-test.c + +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .log .o .obj .test .test$(EXEEXT) .trs +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign axfer/test/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --foreign axfer/test/Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): + +clean-checkPROGRAMS: + -test -z "$(check_PROGRAMS)" || rm -f $(check_PROGRAMS) + +container-test$(EXEEXT): $(container_test_OBJECTS) $(container_test_DEPENDENCIES) $(EXTRA_container_test_DEPENDENCIES) + @rm -f container-test$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(container_test_OBJECTS) $(container_test_LDADD) $(LIBS) + +mapper-test$(EXEEXT): $(mapper_test_OBJECTS) $(mapper_test_DEPENDENCIES) $(EXTRA_mapper_test_DEPENDENCIES) + @rm -f mapper-test$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(mapper_test_OBJECTS) $(mapper_test_LDADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/container-au.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/container-raw.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/container-riff-wave.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/container-test.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/container-voc.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/container.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/generator.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mapper-multiple.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mapper-single.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mapper-test.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mapper.Po@am__quote@ # am--include-marker + +$(am__depfiles_remade): + @$(MKDIR_P) $(@D) + @echo '# dummy' >$@-t && $(am__mv) $@-t $@ + +am--depfiles: $(am__depfiles_remade) + +.c.o: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< + +.c.obj: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` + +container.o: ../container.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT container.o -MD -MP -MF $(DEPDIR)/container.Tpo -c -o container.o `test -f '../container.c' || echo '$(srcdir)/'`../container.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/container.Tpo $(DEPDIR)/container.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='../container.c' object='container.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o container.o `test -f '../container.c' || echo '$(srcdir)/'`../container.c + +container.obj: ../container.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT container.obj -MD -MP -MF $(DEPDIR)/container.Tpo -c -o container.obj `if test -f '../container.c'; then $(CYGPATH_W) '../container.c'; else $(CYGPATH_W) '$(srcdir)/../container.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/container.Tpo $(DEPDIR)/container.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='../container.c' object='container.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o container.obj `if test -f '../container.c'; then $(CYGPATH_W) '../container.c'; else $(CYGPATH_W) '$(srcdir)/../container.c'; fi` + +container-riff-wave.o: ../container-riff-wave.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT container-riff-wave.o -MD -MP -MF $(DEPDIR)/container-riff-wave.Tpo -c -o container-riff-wave.o `test -f '../container-riff-wave.c' || echo '$(srcdir)/'`../container-riff-wave.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/container-riff-wave.Tpo $(DEPDIR)/container-riff-wave.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='../container-riff-wave.c' object='container-riff-wave.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o container-riff-wave.o `test -f '../container-riff-wave.c' || echo '$(srcdir)/'`../container-riff-wave.c + +container-riff-wave.obj: ../container-riff-wave.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT container-riff-wave.obj -MD -MP -MF $(DEPDIR)/container-riff-wave.Tpo -c -o container-riff-wave.obj `if test -f '../container-riff-wave.c'; then $(CYGPATH_W) '../container-riff-wave.c'; else $(CYGPATH_W) '$(srcdir)/../container-riff-wave.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/container-riff-wave.Tpo $(DEPDIR)/container-riff-wave.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='../container-riff-wave.c' object='container-riff-wave.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o container-riff-wave.obj `if test -f '../container-riff-wave.c'; then $(CYGPATH_W) '../container-riff-wave.c'; else $(CYGPATH_W) '$(srcdir)/../container-riff-wave.c'; fi` + +container-au.o: ../container-au.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT container-au.o -MD -MP -MF $(DEPDIR)/container-au.Tpo -c -o container-au.o `test -f '../container-au.c' || echo '$(srcdir)/'`../container-au.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/container-au.Tpo $(DEPDIR)/container-au.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='../container-au.c' object='container-au.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o container-au.o `test -f '../container-au.c' || echo '$(srcdir)/'`../container-au.c + +container-au.obj: ../container-au.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT container-au.obj -MD -MP -MF $(DEPDIR)/container-au.Tpo -c -o container-au.obj `if test -f '../container-au.c'; then $(CYGPATH_W) '../container-au.c'; else $(CYGPATH_W) '$(srcdir)/../container-au.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/container-au.Tpo $(DEPDIR)/container-au.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='../container-au.c' object='container-au.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o container-au.obj `if test -f '../container-au.c'; then $(CYGPATH_W) '../container-au.c'; else $(CYGPATH_W) '$(srcdir)/../container-au.c'; fi` + +container-voc.o: ../container-voc.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT container-voc.o -MD -MP -MF $(DEPDIR)/container-voc.Tpo -c -o container-voc.o `test -f '../container-voc.c' || echo '$(srcdir)/'`../container-voc.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/container-voc.Tpo $(DEPDIR)/container-voc.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='../container-voc.c' object='container-voc.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o container-voc.o `test -f '../container-voc.c' || echo '$(srcdir)/'`../container-voc.c + +container-voc.obj: ../container-voc.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT container-voc.obj -MD -MP -MF $(DEPDIR)/container-voc.Tpo -c -o container-voc.obj `if test -f '../container-voc.c'; then $(CYGPATH_W) '../container-voc.c'; else $(CYGPATH_W) '$(srcdir)/../container-voc.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/container-voc.Tpo $(DEPDIR)/container-voc.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='../container-voc.c' object='container-voc.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o container-voc.obj `if test -f '../container-voc.c'; then $(CYGPATH_W) '../container-voc.c'; else $(CYGPATH_W) '$(srcdir)/../container-voc.c'; fi` + +container-raw.o: ../container-raw.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT container-raw.o -MD -MP -MF $(DEPDIR)/container-raw.Tpo -c -o container-raw.o `test -f '../container-raw.c' || echo '$(srcdir)/'`../container-raw.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/container-raw.Tpo $(DEPDIR)/container-raw.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='../container-raw.c' object='container-raw.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o container-raw.o `test -f '../container-raw.c' || echo '$(srcdir)/'`../container-raw.c + +container-raw.obj: ../container-raw.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT container-raw.obj -MD -MP -MF $(DEPDIR)/container-raw.Tpo -c -o container-raw.obj `if test -f '../container-raw.c'; then $(CYGPATH_W) '../container-raw.c'; else $(CYGPATH_W) '$(srcdir)/../container-raw.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/container-raw.Tpo $(DEPDIR)/container-raw.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='../container-raw.c' object='container-raw.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o container-raw.obj `if test -f '../container-raw.c'; then $(CYGPATH_W) '../container-raw.c'; else $(CYGPATH_W) '$(srcdir)/../container-raw.c'; fi` + +mapper.o: ../mapper.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT mapper.o -MD -MP -MF $(DEPDIR)/mapper.Tpo -c -o mapper.o `test -f '../mapper.c' || echo '$(srcdir)/'`../mapper.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/mapper.Tpo $(DEPDIR)/mapper.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='../mapper.c' object='mapper.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o mapper.o `test -f '../mapper.c' || echo '$(srcdir)/'`../mapper.c + +mapper.obj: ../mapper.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT mapper.obj -MD -MP -MF $(DEPDIR)/mapper.Tpo -c -o mapper.obj `if test -f '../mapper.c'; then $(CYGPATH_W) '../mapper.c'; else $(CYGPATH_W) '$(srcdir)/../mapper.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/mapper.Tpo $(DEPDIR)/mapper.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='../mapper.c' object='mapper.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o mapper.obj `if test -f '../mapper.c'; then $(CYGPATH_W) '../mapper.c'; else $(CYGPATH_W) '$(srcdir)/../mapper.c'; fi` + +mapper-single.o: ../mapper-single.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT mapper-single.o -MD -MP -MF $(DEPDIR)/mapper-single.Tpo -c -o mapper-single.o `test -f '../mapper-single.c' || echo '$(srcdir)/'`../mapper-single.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/mapper-single.Tpo $(DEPDIR)/mapper-single.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='../mapper-single.c' object='mapper-single.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o mapper-single.o `test -f '../mapper-single.c' || echo '$(srcdir)/'`../mapper-single.c + +mapper-single.obj: ../mapper-single.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT mapper-single.obj -MD -MP -MF $(DEPDIR)/mapper-single.Tpo -c -o mapper-single.obj `if test -f '../mapper-single.c'; then $(CYGPATH_W) '../mapper-single.c'; else $(CYGPATH_W) '$(srcdir)/../mapper-single.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/mapper-single.Tpo $(DEPDIR)/mapper-single.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='../mapper-single.c' object='mapper-single.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o mapper-single.obj `if test -f '../mapper-single.c'; then $(CYGPATH_W) '../mapper-single.c'; else $(CYGPATH_W) '$(srcdir)/../mapper-single.c'; fi` + +mapper-multiple.o: ../mapper-multiple.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT mapper-multiple.o -MD -MP -MF $(DEPDIR)/mapper-multiple.Tpo -c -o mapper-multiple.o `test -f '../mapper-multiple.c' || echo '$(srcdir)/'`../mapper-multiple.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/mapper-multiple.Tpo $(DEPDIR)/mapper-multiple.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='../mapper-multiple.c' object='mapper-multiple.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o mapper-multiple.o `test -f '../mapper-multiple.c' || echo '$(srcdir)/'`../mapper-multiple.c + +mapper-multiple.obj: ../mapper-multiple.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT mapper-multiple.obj -MD -MP -MF $(DEPDIR)/mapper-multiple.Tpo -c -o mapper-multiple.obj `if test -f '../mapper-multiple.c'; then $(CYGPATH_W) '../mapper-multiple.c'; else $(CYGPATH_W) '$(srcdir)/../mapper-multiple.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/mapper-multiple.Tpo $(DEPDIR)/mapper-multiple.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='../mapper-multiple.c' object='mapper-multiple.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o mapper-multiple.obj `if test -f '../mapper-multiple.c'; then $(CYGPATH_W) '../mapper-multiple.c'; else $(CYGPATH_W) '$(srcdir)/../mapper-multiple.c'; fi` + +ID: $(am__tagged_files) + $(am__define_uniq_tagged_files); mkid -fID $$unique +tags: tags-am +TAGS: tags + +tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + set x; \ + here=`pwd`; \ + $(am__define_uniq_tagged_files); \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: ctags-am + +CTAGS: ctags +ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + $(am__define_uniq_tagged_files); \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" +cscopelist: cscopelist-am + +cscopelist-am: $(am__tagged_files) + list='$(am__tagged_files)'; \ + case "$(srcdir)" in \ + [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ + *) sdir=$(subdir)/$(srcdir) ;; \ + esac; \ + for i in $$list; do \ + if test -f "$$i"; then \ + echo "$(subdir)/$$i"; \ + else \ + echo "$$sdir/$$i"; \ + fi; \ + done >> $(top_builddir)/cscope.files + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +# Recover from deleted '.trs' file; this should ensure that +# "rm -f foo.log; make foo.trs" re-run 'foo.test', and re-create +# both 'foo.log' and 'foo.trs'. Break the recipe in two subshells +# to avoid problems with "make -n". +.log.trs: + rm -f $< $@ + $(MAKE) $(AM_MAKEFLAGS) $< + +# Leading 'am--fnord' is there to ensure the list of targets does not +# expand to empty, as could happen e.g. with make check TESTS=''. +am--fnord $(TEST_LOGS) $(TEST_LOGS:.log=.trs): $(am__force_recheck) +am--force-recheck: + @: + +$(TEST_SUITE_LOG): $(TEST_LOGS) + @$(am__set_TESTS_bases); \ + am__f_ok () { test -f "$$1" && test -r "$$1"; }; \ + redo_bases=`for i in $$bases; do \ + am__f_ok $$i.trs && am__f_ok $$i.log || echo $$i; \ + done`; \ + if test -n "$$redo_bases"; then \ + redo_logs=`for i in $$redo_bases; do echo $$i.log; done`; \ + redo_results=`for i in $$redo_bases; do echo $$i.trs; done`; \ + if $(am__make_dryrun); then :; else \ + rm -f $$redo_logs && rm -f $$redo_results || exit 1; \ + fi; \ + fi; \ + if test -n "$$am__remaking_logs"; then \ + echo "fatal: making $(TEST_SUITE_LOG): possible infinite" \ + "recursion detected" >&2; \ + elif test -n "$$redo_logs"; then \ + am__remaking_logs=yes $(MAKE) $(AM_MAKEFLAGS) $$redo_logs; \ + fi; \ + if $(am__make_dryrun); then :; else \ + st=0; \ + errmsg="fatal: making $(TEST_SUITE_LOG): failed to create"; \ + for i in $$redo_bases; do \ + test -f $$i.trs && test -r $$i.trs \ + || { echo "$$errmsg $$i.trs" >&2; st=1; }; \ + test -f $$i.log && test -r $$i.log \ + || { echo "$$errmsg $$i.log" >&2; st=1; }; \ + done; \ + test $$st -eq 0 || exit 1; \ + fi + @$(am__sh_e_setup); $(am__tty_colors); $(am__set_TESTS_bases); \ + ws='[ ]'; \ + results=`for b in $$bases; do echo $$b.trs; done`; \ + test -n "$$results" || results=/dev/null; \ + all=` grep "^$$ws*:test-result:" $$results | wc -l`; \ + pass=` grep "^$$ws*:test-result:$$ws*PASS" $$results | wc -l`; \ + fail=` grep "^$$ws*:test-result:$$ws*FAIL" $$results | wc -l`; \ + skip=` grep "^$$ws*:test-result:$$ws*SKIP" $$results | wc -l`; \ + xfail=`grep "^$$ws*:test-result:$$ws*XFAIL" $$results | wc -l`; \ + xpass=`grep "^$$ws*:test-result:$$ws*XPASS" $$results | wc -l`; \ + error=`grep "^$$ws*:test-result:$$ws*ERROR" $$results | wc -l`; \ + if test `expr $$fail + $$xpass + $$error` -eq 0; then \ + success=true; \ + else \ + success=false; \ + fi; \ + br='==================='; br=$$br$$br$$br$$br; \ + result_count () \ + { \ + if test x"$$1" = x"--maybe-color"; then \ + maybe_colorize=yes; \ + elif test x"$$1" = x"--no-color"; then \ + maybe_colorize=no; \ + else \ + echo "$@: invalid 'result_count' usage" >&2; exit 4; \ + fi; \ + shift; \ + desc=$$1 count=$$2; \ + if test $$maybe_colorize = yes && test $$count -gt 0; then \ + color_start=$$3 color_end=$$std; \ + else \ + color_start= color_end=; \ + fi; \ + echo "$${color_start}# $$desc $$count$${color_end}"; \ + }; \ + create_testsuite_report () \ + { \ + result_count $$1 "TOTAL:" $$all "$$brg"; \ + result_count $$1 "PASS: " $$pass "$$grn"; \ + result_count $$1 "SKIP: " $$skip "$$blu"; \ + result_count $$1 "XFAIL:" $$xfail "$$lgn"; \ + result_count $$1 "FAIL: " $$fail "$$red"; \ + result_count $$1 "XPASS:" $$xpass "$$red"; \ + result_count $$1 "ERROR:" $$error "$$mgn"; \ + }; \ + { \ + echo "$(PACKAGE_STRING): $(subdir)/$(TEST_SUITE_LOG)" | \ + $(am__rst_title); \ + create_testsuite_report --no-color; \ + echo; \ + echo ".. contents:: :depth: 2"; \ + echo; \ + for b in $$bases; do echo $$b; done \ + | $(am__create_global_log); \ + } >$(TEST_SUITE_LOG).tmp || exit 1; \ + mv $(TEST_SUITE_LOG).tmp $(TEST_SUITE_LOG); \ + if $$success; then \ + col="$$grn"; \ + else \ + col="$$red"; \ + test x"$$VERBOSE" = x || cat $(TEST_SUITE_LOG); \ + fi; \ + echo "$${col}$$br$${std}"; \ + echo "$${col}Testsuite summary for $(PACKAGE_STRING)$${std}"; \ + echo "$${col}$$br$${std}"; \ + create_testsuite_report --maybe-color; \ + echo "$$col$$br$$std"; \ + if $$success; then :; else \ + echo "$${col}See $(subdir)/$(TEST_SUITE_LOG)$${std}"; \ + if test -n "$(PACKAGE_BUGREPORT)"; then \ + echo "$${col}Please report to $(PACKAGE_BUGREPORT)$${std}"; \ + fi; \ + echo "$$col$$br$$std"; \ + fi; \ + $$success || exit 1 + +check-TESTS: $(check_PROGRAMS) + @list='$(RECHECK_LOGS)'; test -z "$$list" || rm -f $$list + @list='$(RECHECK_LOGS:.log=.trs)'; test -z "$$list" || rm -f $$list + @test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG) + @set +e; $(am__set_TESTS_bases); \ + log_list=`for i in $$bases; do echo $$i.log; done`; \ + trs_list=`for i in $$bases; do echo $$i.trs; done`; \ + log_list=`echo $$log_list`; trs_list=`echo $$trs_list`; \ + $(MAKE) $(AM_MAKEFLAGS) $(TEST_SUITE_LOG) TEST_LOGS="$$log_list"; \ + exit $$?; +recheck: all $(check_PROGRAMS) + @test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG) + @set +e; $(am__set_TESTS_bases); \ + bases=`for i in $$bases; do echo $$i; done \ + | $(am__list_recheck_tests)` || exit 1; \ + log_list=`for i in $$bases; do echo $$i.log; done`; \ + log_list=`echo $$log_list`; \ + $(MAKE) $(AM_MAKEFLAGS) $(TEST_SUITE_LOG) \ + am__force_recheck=am--force-recheck \ + TEST_LOGS="$$log_list"; \ + exit $$? +container-test.log: container-test$(EXEEXT) + @p='container-test$(EXEEXT)'; \ + b='container-test'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +mapper-test.log: mapper-test$(EXEEXT) + @p='mapper-test$(EXEEXT)'; \ + b='mapper-test'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +.test.log: + @p='$<'; \ + $(am__set_b); \ + $(am__check_pre) $(TEST_LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_TEST_LOG_DRIVER_FLAGS) $(TEST_LOG_DRIVER_FLAGS) -- $(TEST_LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +@am__EXEEXT_TRUE@.test$(EXEEXT).log: +@am__EXEEXT_TRUE@ @p='$<'; \ +@am__EXEEXT_TRUE@ $(am__set_b); \ +@am__EXEEXT_TRUE@ $(am__check_pre) $(TEST_LOG_DRIVER) --test-name "$$f" \ +@am__EXEEXT_TRUE@ --log-file $$b.log --trs-file $$b.trs \ +@am__EXEEXT_TRUE@ $(am__common_driver_flags) $(AM_TEST_LOG_DRIVER_FLAGS) $(TEST_LOG_DRIVER_FLAGS) -- $(TEST_LOG_COMPILE) \ +@am__EXEEXT_TRUE@ "$$tst" $(AM_TESTS_FD_REDIRECT) + +distdir: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) distdir-am + +distdir-am: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am + $(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS) + $(MAKE) $(AM_MAKEFLAGS) check-TESTS +check: check-am +all-am: Makefile +installdirs: +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + -test -z "$(TEST_LOGS)" || rm -f $(TEST_LOGS) + -test -z "$(TEST_LOGS:.log=.trs)" || rm -f $(TEST_LOGS:.log=.trs) + -test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG) + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-checkPROGRAMS clean-generic mostlyclean-am + +distclean: distclean-am + -rm -f ./$(DEPDIR)/container-au.Po + -rm -f ./$(DEPDIR)/container-raw.Po + -rm -f ./$(DEPDIR)/container-riff-wave.Po + -rm -f ./$(DEPDIR)/container-test.Po + -rm -f ./$(DEPDIR)/container-voc.Po + -rm -f ./$(DEPDIR)/container.Po + -rm -f ./$(DEPDIR)/generator.Po + -rm -f ./$(DEPDIR)/mapper-multiple.Po + -rm -f ./$(DEPDIR)/mapper-single.Po + -rm -f ./$(DEPDIR)/mapper-test.Po + -rm -f ./$(DEPDIR)/mapper.Po + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -f ./$(DEPDIR)/container-au.Po + -rm -f ./$(DEPDIR)/container-raw.Po + -rm -f ./$(DEPDIR)/container-riff-wave.Po + -rm -f ./$(DEPDIR)/container-test.Po + -rm -f ./$(DEPDIR)/container-voc.Po + -rm -f ./$(DEPDIR)/container.Po + -rm -f ./$(DEPDIR)/generator.Po + -rm -f ./$(DEPDIR)/mapper-multiple.Po + -rm -f ./$(DEPDIR)/mapper-single.Po + -rm -f ./$(DEPDIR)/mapper-test.Po + -rm -f ./$(DEPDIR)/mapper.Po + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: + +.MAKE: check-am install-am install-strip + +.PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-TESTS \ + check-am clean clean-checkPROGRAMS clean-generic cscopelist-am \ + ctags ctags-am distclean distclean-compile distclean-generic \ + distclean-tags distdir dvi dvi-am html html-am info info-am \ + install install-am install-data install-data-am install-dvi \ + install-dvi-am install-exec install-exec-am install-html \ + install-html-am install-info install-info-am install-man \ + install-pdf install-pdf-am install-ps install-ps-am \ + install-strip installcheck installcheck-am installdirs \ + maintainer-clean maintainer-clean-generic mostlyclean \ + mostlyclean-compile mostlyclean-generic pdf pdf-am ps ps-am \ + recheck tags tags-am uninstall uninstall-am + +.PRECIOUS: Makefile + + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/axfer/test/container-test.c b/axfer/test/container-test.c new file mode 100644 index 0000000..9b30ae3 --- /dev/null +++ b/axfer/test/container-test.c @@ -0,0 +1,299 @@ +// SPDX-License-Identifier: GPL-2.0 +// +// container-io.c - a unit test for parser/builder of supported containers. +// +// Copyright (c) 2018 Takashi Sakamoto +// +// Licensed under the terms of the GNU General Public License, version 2. + +#include "../container.h" +#include "../misc.h" + +#include "generator.h" + +#include +#include +#include + +#include + +struct container_trial { + enum container_format format; + + struct container_context cntr; + bool verbose; +}; + +static void test_builder(struct container_context *cntr, + enum container_format format, const char *const name, + snd_pcm_access_t access, + snd_pcm_format_t sample_format, + unsigned int samples_per_frame, + unsigned int frames_per_second, + void *frame_buffer, unsigned int frame_count, + bool verbose) +{ + snd_pcm_format_t sample; + unsigned int channels; + unsigned int rate; + uint64_t max_frame_count; + unsigned int handled_frame_count; + uint64_t total_frame_count; + int err; + + err = container_builder_init(cntr, name, format, verbose); + assert(err == 0); + + sample = sample_format; + channels = samples_per_frame; + rate = frames_per_second; + max_frame_count = 0; + err = container_context_pre_process(cntr, &sample, &channels, &rate, + &max_frame_count); + assert(err == 0); + assert(sample == sample_format); + assert(channels == samples_per_frame); + assert(rate == frames_per_second); + assert(max_frame_count > 0); + + handled_frame_count = frame_count; + err = container_context_process_frames(cntr, frame_buffer, + &handled_frame_count); + assert(err == 0); + assert(handled_frame_count > 0); + assert(handled_frame_count <= frame_count); + + total_frame_count = 0; + err = container_context_post_process(cntr, &total_frame_count); + assert(err == 0); + assert(total_frame_count == frame_count); + + container_context_destroy(cntr); +} + +static void test_parser(struct container_context *cntr, + enum container_format format, const char *const name, + snd_pcm_access_t access, snd_pcm_format_t sample_format, + unsigned int samples_per_frame, + unsigned int frames_per_second, + void *frame_buffer, unsigned int frame_count, + bool verbose) +{ + snd_pcm_format_t sample; + unsigned int channels; + unsigned int rate; + uint64_t total_frame_count; + unsigned int handled_frame_count; + int err; + + err = container_parser_init(cntr, name, verbose); + assert(err == 0); + + sample = sample_format; + channels = samples_per_frame; + rate = frames_per_second; + total_frame_count = 0; + err = container_context_pre_process(cntr, &sample, &channels, &rate, + &total_frame_count); + assert(err == 0); + assert(sample == sample_format); + assert(channels == samples_per_frame); + assert(rate == frames_per_second); + assert(total_frame_count == frame_count); + + handled_frame_count = total_frame_count; + err = container_context_process_frames(cntr, frame_buffer, + &handled_frame_count); + assert(err == 0); + assert(handled_frame_count == frame_count); + + total_frame_count = 0; + err = container_context_post_process(cntr, &total_frame_count); + assert(err == 0); + assert(total_frame_count == handled_frame_count); + + container_context_destroy(cntr); +} + +static int callback(struct test_generator *gen, snd_pcm_access_t access, + snd_pcm_format_t sample_format, + unsigned int samples_per_frame, void *frame_buffer, + unsigned int frame_count) +{ + static const unsigned int entries[] = { + [0] = 44100, + [1] = 48000, + [2] = 88200, + [3] = 96000, + [4] = 176400, + [5] = 192000, + }; + struct container_trial *trial = gen->private_data; + unsigned int frames_per_second; + const char *const name = "hoge"; + unsigned int size; + void *buf; + int i; + int err = 0; + + size = frame_count * samples_per_frame * + snd_pcm_format_physical_width(sample_format) / 8; + buf = malloc(size); + if (buf == NULL) + return -ENOMEM; + + // Remove a result of a previous trial. + unlink(name); + + for (i = 0; i < ARRAY_SIZE(entries); ++i) { + frames_per_second = entries[i]; + + test_builder(&trial->cntr, trial->format, name, access, + sample_format, samples_per_frame, + frames_per_second, frame_buffer, frame_count, + trial->verbose); + + test_parser(&trial->cntr, trial->format, name, access, + sample_format, samples_per_frame, frames_per_second, + buf, frame_count, trial->verbose); + + err = memcmp(buf, frame_buffer, size); + assert(err == 0); + + unlink(name); + } + + free(buf); + + return 0; +} + +int main(int argc, const char *argv[]) +{ + static const uint64_t sample_format_masks[] = { + [CONTAINER_FORMAT_RIFF_WAVE] = + (1ull << SND_PCM_FORMAT_U8) | + (1ull << SND_PCM_FORMAT_S16_LE) | + (1ull << SND_PCM_FORMAT_S16_BE) | + (1ull << SND_PCM_FORMAT_S24_LE) | + (1ull << SND_PCM_FORMAT_S24_BE) | + (1ull << SND_PCM_FORMAT_S32_LE) | + (1ull << SND_PCM_FORMAT_S32_BE) | + (1ull << SND_PCM_FORMAT_FLOAT_LE) | + (1ull << SND_PCM_FORMAT_FLOAT_BE) | + (1ull << SND_PCM_FORMAT_FLOAT64_LE) | + (1ull << SND_PCM_FORMAT_FLOAT64_BE) | + (1ull << SND_PCM_FORMAT_MU_LAW) | + (1ull << SND_PCM_FORMAT_A_LAW) | + (1ull << SND_PCM_FORMAT_S24_3LE) | + (1ull << SND_PCM_FORMAT_S24_3BE) | + (1ull << SND_PCM_FORMAT_S20_3LE) | + (1ull << SND_PCM_FORMAT_S20_3BE) | + (1ull << SND_PCM_FORMAT_S18_3LE) | + (1ull << SND_PCM_FORMAT_S18_3BE), + [CONTAINER_FORMAT_AU] = + (1ull << SND_PCM_FORMAT_S8) | + (1ull << SND_PCM_FORMAT_S16_BE) | + (1ull << SND_PCM_FORMAT_S32_BE) | + (1ull << SND_PCM_FORMAT_FLOAT_BE) | + (1ull << SND_PCM_FORMAT_FLOAT64_BE) | + (1ull << SND_PCM_FORMAT_MU_LAW) | + (1ull << SND_PCM_FORMAT_A_LAW), + [CONTAINER_FORMAT_VOC] = + (1ull << SND_PCM_FORMAT_U8) | + (1ull << SND_PCM_FORMAT_S16_LE) | + (1ull << SND_PCM_FORMAT_MU_LAW) | + (1ull << SND_PCM_FORMAT_A_LAW), + [CONTAINER_FORMAT_RAW] = + (1ull << SND_PCM_FORMAT_S8) | + (1ull << SND_PCM_FORMAT_U8) | + (1ull << SND_PCM_FORMAT_S16_LE) | + (1ull << SND_PCM_FORMAT_S16_BE) | + (1ull << SND_PCM_FORMAT_U16_LE) | + (1ull << SND_PCM_FORMAT_U16_BE) | + (1ull << SND_PCM_FORMAT_S24_LE) | + (1ull << SND_PCM_FORMAT_S24_BE) | + (1ull << SND_PCM_FORMAT_U24_LE) | + (1ull << SND_PCM_FORMAT_U24_BE) | + (1ull << SND_PCM_FORMAT_S32_LE) | + (1ull << SND_PCM_FORMAT_S32_BE) | + (1ull << SND_PCM_FORMAT_U32_LE) | + (1ull << SND_PCM_FORMAT_U32_BE) | + (1ull << SND_PCM_FORMAT_FLOAT_LE) | + (1ull << SND_PCM_FORMAT_FLOAT_BE) | + (1ull << SND_PCM_FORMAT_FLOAT64_LE) | + (1ull << SND_PCM_FORMAT_FLOAT64_BE) | + (1ull << SND_PCM_FORMAT_IEC958_SUBFRAME_LE) | + (1ull << SND_PCM_FORMAT_IEC958_SUBFRAME_BE) | + (1ull << SND_PCM_FORMAT_MU_LAW) | + (1ull << SND_PCM_FORMAT_A_LAW) | + (1ull << SND_PCM_FORMAT_S24_3LE) | + (1ull << SND_PCM_FORMAT_S24_3BE) | + (1ull << SND_PCM_FORMAT_U24_3LE) | + (1ull << SND_PCM_FORMAT_U24_3BE) | + (1ull << SND_PCM_FORMAT_S20_3LE) | + (1ull << SND_PCM_FORMAT_S20_3BE) | + (1ull << SND_PCM_FORMAT_U20_3LE) | + (1ull << SND_PCM_FORMAT_U20_3BE) | + (1ull << SND_PCM_FORMAT_S18_3LE) | + (1ull << SND_PCM_FORMAT_S18_3BE) | + (1ull << SND_PCM_FORMAT_U18_3LE) | + (1ull << SND_PCM_FORMAT_U18_3BE) | + (1ull << SND_PCM_FORMAT_DSD_U8) | + (1ull << SND_PCM_FORMAT_DSD_U16_LE) | + (1ull << SND_PCM_FORMAT_DSD_U32_LE) | + (1ull << SND_PCM_FORMAT_DSD_U16_BE) | + (1ull << SND_PCM_FORMAT_DSD_U32_BE), + }; + static const uint64_t access_mask = + (1ull << SND_PCM_ACCESS_MMAP_INTERLEAVED) | + (1ull << SND_PCM_ACCESS_RW_INTERLEAVED); + struct test_generator gen = {0}; + struct container_trial *trial; + int i; + int begin; + int end; + bool verbose; + int err; + + if (argc > 1) { + char *term; + begin = strtol(argv[1], &term, 10); + if (errno || *term != '\0') + return EXIT_FAILURE; + if (begin < CONTAINER_FORMAT_RIFF_WAVE && + begin > CONTAINER_FORMAT_RAW) + return -EXIT_FAILURE; + end = begin + 1; + verbose = true; + } else { + begin = CONTAINER_FORMAT_RIFF_WAVE; + end = CONTAINER_FORMAT_RAW + 1; + verbose = false; + } + + for (i = begin; i < end; ++i) { + err = generator_context_init(&gen, access_mask, + sample_format_masks[i], + 1, 128, 23, 4500, 1024, + sizeof(struct container_trial)); + if (err >= 0) { + trial = gen.private_data; + trial->format = i; + trial->verbose = verbose; + err = generator_context_run(&gen, callback); + } + + generator_context_destroy(&gen); + + if (err < 0) + break; + } + + if (err < 0) { + printf("%s\n", strerror(-err)); + return EXIT_FAILURE; + } + + return EXIT_SUCCESS; +} diff --git a/axfer/test/generator.c b/axfer/test/generator.c new file mode 100644 index 0000000..bde8c5f --- /dev/null +++ b/axfer/test/generator.c @@ -0,0 +1,260 @@ +// SPDX-License-Identifier: GPL-2.0 +// +// allocator.h - a header of a generator for test with buffers of PCM frames. +// +// Copyright (c) 2018 Takashi Sakamoto +// +// Licensed under the terms of the GNU General Public License, version 2. + +#include "generator.h" + +#include + +#include +#include +#include + +#include + +int generator_context_init(struct test_generator *gen, + uint64_t access_mask, uint64_t sample_format_mask, + unsigned int min_samples_per_frame, + unsigned int max_samples_per_frame, + unsigned int min_frame_count, + unsigned int max_frame_count, + unsigned int step_frame_count, + unsigned int private_size) +{ + gen->fd = open("/dev/urandom", O_RDONLY); + if (gen->fd < 0) + return -errno; + + gen->private_data = malloc(private_size); + if (gen->private_data == NULL) + return -ENOMEM; + memset(gen->private_data, 0, private_size); + + gen->access_mask = access_mask; + gen->sample_format_mask = sample_format_mask; + gen->min_samples_per_frame = min_samples_per_frame; + gen->max_samples_per_frame = max_samples_per_frame; + gen->min_frame_count = min_frame_count; + gen->max_frame_count = max_frame_count; + gen->step_frame_count = step_frame_count; + + return 0; +} + +static void *allocate_buf(snd_pcm_access_t access, + snd_pcm_format_t sample_format, + unsigned int samples_per_frame, + unsigned int frame_count) +{ + unsigned int bytes_per_sample; + + bytes_per_sample = snd_pcm_format_physical_width(sample_format) / 8; + + return calloc(samples_per_frame * frame_count, bytes_per_sample); +} + +static void *allocate_vector(snd_pcm_access_t access, + snd_pcm_format_t sample_format, + unsigned int samples_per_frame, + unsigned int frame_count) +{ + unsigned int bytes_per_sample; + char **bufs; + int i; + + bytes_per_sample = snd_pcm_format_physical_width(sample_format) / 8; + + bufs = calloc(samples_per_frame, sizeof(char *)); + if (bufs == NULL) + return NULL; + + for (i = 0; i < samples_per_frame; ++i) { + bufs[i] = calloc(frame_count, bytes_per_sample); + if (bufs[i] == NULL) { + for (; i >= 0; --i) + free(bufs[i]); + free(bufs); + return NULL; + } + } + + return bufs; +} + +static int fill_buf(int fd, void *frame_buffer, snd_pcm_access_t access, + snd_pcm_format_t sample_format, + unsigned int samples_per_frame, unsigned int frame_count) +{ + unsigned int size; + int len; + + size = snd_pcm_format_physical_width(sample_format) / 8 * + samples_per_frame * frame_count; + while (size > 0) { + len = read(fd, frame_buffer, size); + if (len < 0) + return len; + size -= len; + } + + return 0; +} + +static int fill_vector(int fd, void *frame_buffer, snd_pcm_access_t access, + snd_pcm_format_t sample_format, + unsigned int samples_per_frame, unsigned int frame_count) +{ + char **bufs = frame_buffer; + unsigned int size; + int len; + int i; + + for (i = 0; i < samples_per_frame; ++i) { + size = frame_count * + snd_pcm_format_physical_width(sample_format) / 8; + + while (size > 0) { + len = read(fd, bufs[i], size); + if (len < 0) + return len; + size -= len; + } + } + + return 0; +} + +static void deallocate_buf(void *frame_buffer, unsigned int samples_per_frame) +{ + free(frame_buffer); +} + +static void deallocate_vector(void *frame_buffer, + unsigned int samples_per_frame) +{ + char **bufs = frame_buffer; + int i; + + for (i = 0; i < samples_per_frame; ++i) + free(bufs[i]); + + free(bufs); +} + +static int test_frame_count(struct test_generator *gen, + snd_pcm_access_t access, + snd_pcm_format_t sample_format, + unsigned int samples_per_frame) +{ + void *(*allocator)(snd_pcm_access_t access, + snd_pcm_format_t sample_format, + unsigned int samples_per_frame, + unsigned int frame_count); + int (*fill)(int fd, void *frame_buffer, snd_pcm_access_t access, + snd_pcm_format_t sample_format, + unsigned int samples_per_frame, unsigned int frame_count); + void (*deallocator)(void *frame_buffer, unsigned int samples_per_frame); + void *frame_buffer; + int i; + int err = 0; + + if (access != SND_PCM_ACCESS_RW_NONINTERLEAVED) { + allocator = allocate_buf; + fill = fill_buf; + deallocator = deallocate_buf; + } else { + allocator = allocate_vector; + fill = fill_vector; + deallocator = deallocate_vector; + } + + frame_buffer = allocator(access, sample_format, samples_per_frame, + gen->max_frame_count); + if (frame_buffer == NULL) + return -ENOMEM; + + err = fill(gen->fd, frame_buffer, access, sample_format, + samples_per_frame, gen->max_frame_count); + if (err < 0) + goto end; + + + for (i = gen->min_frame_count; + i <= gen->max_frame_count; i += gen->step_frame_count) { + err = gen->cb(gen, access ,sample_format, samples_per_frame, + frame_buffer, i); + if (err < 0) + break; + } +end: + deallocator(frame_buffer, samples_per_frame); + + return err; +} + +static int test_samples_per_frame(struct test_generator *gen, + snd_pcm_access_t access, + snd_pcm_format_t sample_format) +{ + int i; + int err = 0; + + for (i = gen->min_samples_per_frame; + i <= gen->max_samples_per_frame; ++i) { + err = test_frame_count(gen, access, sample_format, i); + if (err < 0) + break; + } + + return err; +} + +static int test_sample_format(struct test_generator *gen, + snd_pcm_access_t access) +{ + int i; + int err = 0; + + for (i = 0; i <= SND_PCM_FORMAT_LAST; ++i) { + if (!((1ull << i) & gen->sample_format_mask)) + continue; + + err = test_samples_per_frame(gen, access, i); + if (err < 0) + break; + } + + return err; +} + +static int test_access(struct test_generator *gen) +{ + int i; + int err = 0; + + for (i = 0; i <= SND_PCM_ACCESS_LAST; ++i) { + if (!((1ull << i) & gen->access_mask)) + continue; + + err = test_sample_format(gen, i); + if (err < 0) + break; + } + return err; +} + +int generator_context_run(struct test_generator *gen, generator_cb_t cb) +{ + gen->cb = cb; + return test_access(gen); +} + +void generator_context_destroy(struct test_generator *gen) +{ + free(gen->private_data); + close(gen->fd); +} diff --git a/axfer/test/generator.h b/axfer/test/generator.h new file mode 100644 index 0000000..c35ed98 --- /dev/null +++ b/axfer/test/generator.h @@ -0,0 +1,47 @@ +// SPDX-License-Identifier: GPL-2.0 +// +// generator.c - a generator for test with buffers of PCM frames. +// +// Copyright (c) 2018 Takashi Sakamoto +// +// Licensed under the terms of the GNU General Public License, version 2. + +#ifndef __ALSA_UTILS_AXFER_TEST_GENERATOR__H_ +#define __ALSA_UTILS_AXFER_TEST_GENERATOR__H_ + +#include +#include + +struct test_generator; +typedef int (*generator_cb_t)(struct test_generator *gen, + snd_pcm_access_t access, + snd_pcm_format_t sample_format, + unsigned int samples_per_frame, + void *frame_buffer, unsigned int frame_count); + +struct test_generator { + int fd; + uint64_t access_mask; + uint64_t sample_format_mask; + unsigned int min_samples_per_frame; + unsigned int max_samples_per_frame; + unsigned int min_frame_count; + unsigned int max_frame_count; + unsigned int step_frame_count; + + generator_cb_t cb; + void *private_data; +}; + +int generator_context_init(struct test_generator *gen, + uint64_t access_mask, uint64_t sample_format_mask, + unsigned int min_samples_per_frame, + unsigned int max_samples_per_frame, + unsigned int min_frame_count, + unsigned int max_frame_count, + unsigned int step_frame_count, + unsigned int private_size); +int generator_context_run(struct test_generator *gen, generator_cb_t cb); +void generator_context_destroy(struct test_generator *gen); + +#endif diff --git a/axfer/test/mapper-test.c b/axfer/test/mapper-test.c new file mode 100644 index 0000000..f0376c7 --- /dev/null +++ b/axfer/test/mapper-test.c @@ -0,0 +1,493 @@ +// SPDX-License-Identifier: GPL-2.0 +// +// mapper-io.c - a unit test for muxer/demuxer for PCM frames on buffer. +// +// Copyright (c) 2018 Takashi Sakamoto +// +// Licensed under the terms of the GNU General Public License, version 2. + +#include "../mapper.h" +#include "../misc.h" + +#include "generator.h" + +#include +#include +#include + +#include + +struct mapper_trial { + enum container_format cntr_format; + struct container_context *cntrs; + + char **paths; + + struct mapper_context mapper; + bool verbose; +}; + +static void test_demuxer(struct mapper_context *mapper, snd_pcm_access_t access, + unsigned int bytes_per_sample, + unsigned int samples_per_frame, + unsigned int frames_per_buffer, + void *frame_buffer, unsigned int frame_count, + struct container_context *cntrs, + unsigned int cntr_count, bool verbose) +{ + unsigned int total_frame_count; + int err; + + err = mapper_context_init(mapper, MAPPER_TYPE_DEMUXER, cntr_count, + verbose); + assert(err == 0); + + err = mapper_context_pre_process(mapper, access, bytes_per_sample, + samples_per_frame, frames_per_buffer, + cntrs); + assert(err == 0); + + total_frame_count = frame_count; + err = mapper_context_process_frames(mapper, frame_buffer, + &total_frame_count, cntrs); + assert(err == 0); + assert(total_frame_count == frame_count); + + mapper_context_post_process(mapper); + mapper_context_destroy(mapper); +} + +static int test_demux(struct mapper_trial *trial, snd_pcm_access_t access, + snd_pcm_format_t sample_format, + unsigned int samples_per_frame, + unsigned int frames_per_second, + unsigned int frames_per_buffer, + void *frame_buffer, unsigned int frame_count, + unsigned int cntr_count) +{ + struct container_context *cntrs = trial->cntrs; + char **paths = trial->paths; + enum container_format cntr_format = trial->cntr_format; + unsigned int bytes_per_sample; + uint64_t total_frame_count; + int i; + int err = 0; + + for (i = 0; i < cntr_count; ++i) { + snd_pcm_format_t format; + unsigned int channels; + unsigned int rate; + + err = container_builder_init(cntrs + i, paths[i], cntr_format, + 0); + if (err < 0) + goto end; + + format = sample_format; + rate = frames_per_second; + total_frame_count = frame_count; + if (cntr_count > 1) + channels = 1; + else + channels = samples_per_frame; + err = container_context_pre_process(cntrs + i, &format, + &channels, &rate, + &total_frame_count); + if (err < 0) + goto end; + assert(format == sample_format); + assert(rate == frames_per_second); + assert(total_frame_count >= 0); + if (cntr_count > 1) + assert(channels == 1); + else + assert(channels == samples_per_frame); + } + + bytes_per_sample = snd_pcm_format_physical_width(sample_format) / 8; + test_demuxer(&trial->mapper, access, bytes_per_sample, + samples_per_frame, frames_per_buffer, frame_buffer, + frame_count, cntrs, cntr_count, trial->verbose); + + for (i = 0; i < cntr_count; ++i) { + container_context_post_process(cntrs + i, &total_frame_count); + assert(total_frame_count == frame_count); + } +end: + for (i = 0; i < cntr_count; ++i) + container_context_destroy(cntrs + i); + + return err; +} + +static void test_muxer(struct mapper_context *mapper, snd_pcm_access_t access, + unsigned int bytes_per_sample, + unsigned int samples_per_frame, + unsigned int frames_per_buffer, + void *frame_buffer, unsigned int frame_count, + struct container_context *cntrs, + unsigned int cntr_count, bool verbose) +{ + unsigned int total_frame_count; + int err; + + err = mapper_context_init(mapper, MAPPER_TYPE_MUXER, cntr_count, + verbose); + assert(err == 0); + + err = mapper_context_pre_process(mapper, access, bytes_per_sample, + samples_per_frame, frames_per_buffer, + cntrs); + assert(err == 0); + + total_frame_count = frame_count; + err = mapper_context_process_frames(mapper, frame_buffer, + &total_frame_count, cntrs); + assert(err == 0); + assert(total_frame_count == frame_count); + + mapper_context_post_process(mapper); + mapper_context_destroy(mapper); +} + +static int test_mux(struct mapper_trial *trial, snd_pcm_access_t access, + snd_pcm_format_t sample_format, + unsigned int samples_per_frame, + unsigned int frames_per_second, + unsigned int frames_per_buffer, + void *frame_buffer, unsigned int frame_count, + unsigned int cntr_count) +{ + struct container_context *cntrs = trial->cntrs; + char **paths = trial->paths; + unsigned int bytes_per_sample; + uint64_t total_frame_count; + int i; + int err = 0; + + for (i = 0; i < cntr_count; ++i) { + snd_pcm_format_t format; + unsigned int channels; + unsigned int rate; + + err = container_parser_init(cntrs + i, paths[i], 0); + if (err < 0) + goto end; + + format = sample_format; + rate = frames_per_second; + if (cntr_count > 1) + channels = 1; + else + channels = samples_per_frame; + err = container_context_pre_process(cntrs + i, &format, + &channels, &rate, + &total_frame_count); + if (err < 0) + goto end; + + assert(format == sample_format); + assert(rate == frames_per_second); + assert(total_frame_count == frame_count); + if (cntr_count > 1) + assert(channels == 1); + else + assert(channels == samples_per_frame); + } + + bytes_per_sample = snd_pcm_format_physical_width(sample_format) / 8; + test_muxer(&trial->mapper, access, bytes_per_sample, samples_per_frame, + frames_per_buffer, frame_buffer, frame_count, cntrs, + cntr_count, trial->verbose); + + for (i = 0; i < cntr_count; ++i) { + container_context_post_process(cntrs + i, &total_frame_count); + assert(total_frame_count == frame_count); + } +end: + for (i = 0; i < cntr_count; ++i) + container_context_destroy(cntrs + i); + + return err; +} + +static int test_mapper(struct mapper_trial *trial, snd_pcm_access_t access, + snd_pcm_format_t sample_format, + unsigned int samples_per_frame, + unsigned int frames_per_second, void *frame_buffer, + void *check_buffer, unsigned int frame_count, + unsigned int cntr_count) +{ + unsigned int frames_per_buffer; + int i; + int err; + + // Use a buffer aligned by typical size of page frame. + frames_per_buffer = ((frame_count + 4096) / 4096) * 4096; + + err = test_demux(trial, access, sample_format, samples_per_frame, + frames_per_second, frames_per_buffer, frame_buffer, + frame_count, cntr_count); + if (err < 0) + goto end; + + err = test_mux(trial, access, sample_format, samples_per_frame, + frames_per_second, frames_per_buffer, check_buffer, + frame_count, cntr_count); +end: + for (i = 0; i < cntr_count; ++i) + unlink(trial->paths[i]); + + return err; +} + +static int test_i_buf(struct mapper_trial *trial, snd_pcm_access_t access, + snd_pcm_format_t sample_format, + unsigned int samples_per_frame, + unsigned int frames_per_second, void *frame_buffer, + unsigned int frame_count, unsigned int cntr_count) +{ + unsigned int size; + char *buf; + int err; + + size = frame_count * samples_per_frame * + snd_pcm_format_physical_width(sample_format) / 8; + buf = malloc(size); + if (buf == 0) + return -ENOMEM; + memset(buf, 0, size); + + // Test multiple target. + err = test_mapper(trial, access, sample_format, samples_per_frame, + frames_per_second, frame_buffer, buf, + frame_count, cntr_count); + if (err < 0) + goto end; + err = memcmp(frame_buffer, buf, size); + assert(err == 0); + + // Test single target. + err = test_mapper(trial, access, sample_format, samples_per_frame, + frames_per_second, frame_buffer, buf, + frame_count, 1); + if (err < 0) + goto end; + err = memcmp(frame_buffer, buf, size); + assert(err == 0); +end: + free(buf); + + return err; +} + +static int test_vector(struct mapper_trial *trial, snd_pcm_access_t access, + snd_pcm_format_t sample_format, + unsigned int samples_per_frame, + unsigned int frames_per_second, void *frame_buffer, + unsigned int frame_count, unsigned int cntr_count) +{ + unsigned int size; + char **bufs; + int i; + int err; + + bufs = calloc(cntr_count, sizeof(*bufs)); + if (bufs == NULL) + return -ENOMEM; + + size = frame_count * snd_pcm_format_physical_width(sample_format) / 8; + + for (i = 0; i < cntr_count; ++i) { + bufs[i] = malloc(size); + if (bufs[i] == NULL) { + err = -ENOMEM; + goto end; + } + memset(bufs[i], 0, size); + } + + // Test multiple target. + err = test_mapper(trial, access, sample_format, samples_per_frame, + frames_per_second, frame_buffer, bufs, + frame_count, cntr_count); + if (err < 0) + goto end; + for (i = 0; i < cntr_count; ++i) { + char **target = frame_buffer; + err = memcmp(target[i], bufs[i], size); + assert(err == 0); + } + + // Test single target. + err = test_mapper(trial, access, sample_format, samples_per_frame, + frames_per_second, frame_buffer, bufs, + frame_count, 1); + if (err < 0) + goto end; + for (i = 0; i < cntr_count; ++i) { + char **target = frame_buffer; + err = memcmp(target[i], bufs[i], size); + assert(err == 0); + } +end: + for (i = 0; i < cntr_count; ++i) { + if (bufs[i]) + free(bufs[i]); + } + free(bufs); + + return err; +} + +static int test_n_buf(struct mapper_trial *trial, snd_pcm_access_t access, + snd_pcm_format_t sample_format, + unsigned int samples_per_frame, + unsigned int frames_per_second, void *frame_buffer, + unsigned int frame_count, unsigned int cntr_count) +{ + char *test_buf = frame_buffer; + unsigned int size; + char **test_vec; + int i; + int err; + + size = frame_count * snd_pcm_format_physical_width(sample_format) / 8; + + test_vec = calloc(cntr_count * 2, sizeof(*test_vec)); + if (test_vec == NULL) + return -ENOMEM; + + for (i = 0; i < cntr_count; ++i) + test_vec[i] = test_buf + size * i; + + err = test_vector(trial, access, sample_format, samples_per_frame, + frames_per_second, test_vec, frame_count, cntr_count); + free(test_vec); + + return err; +} + +static int callback(struct test_generator *gen, snd_pcm_access_t access, + snd_pcm_format_t sample_format, + unsigned int samples_per_frame, void *frame_buffer, + unsigned int frame_count) +{ + + int (*handler)(struct mapper_trial *trial, snd_pcm_access_t access, + snd_pcm_format_t sample_format, + unsigned int samples_per_frame, + unsigned int frames_per_second, void *frame_buffer, + unsigned int frame_count, unsigned int cntr_count); + struct mapper_trial *trial = gen->private_data; + + if (access == SND_PCM_ACCESS_RW_NONINTERLEAVED) + handler = test_vector; + else if (access == SND_PCM_ACCESS_MMAP_NONINTERLEAVED) + handler = test_n_buf; + else + handler = test_i_buf; + + return handler(trial, access, sample_format, samples_per_frame, 48000, + frame_buffer, frame_count, samples_per_frame); +}; + +int main(int argc, const char *argv[]) +{ + // Test 8/16/18/20/24/32/64 bytes per sample. + static const uint64_t sample_format_mask = + (1ull << SND_PCM_FORMAT_U8) | + (1ull << SND_PCM_FORMAT_S16_LE) | + (1ull << SND_PCM_FORMAT_S18_3LE) | + (1ull << SND_PCM_FORMAT_S20_3LE) | + (1ull << SND_PCM_FORMAT_S24_LE) | + (1ull << SND_PCM_FORMAT_S32_LE) | + (1ull << SND_PCM_FORMAT_FLOAT64_LE); + uint64_t access_mask; + struct test_generator gen = {0}; + struct mapper_trial *trial; + struct container_context *cntrs; + unsigned int samples_per_frame; + char **paths = NULL; + snd_pcm_access_t access; + bool verbose; + int i; + int err; + + // Test up to 32 channels. + samples_per_frame = 32; + cntrs = calloc(samples_per_frame, sizeof(*cntrs)); + if (cntrs == NULL) + return -ENOMEM; + + paths = calloc(samples_per_frame, sizeof(*paths)); + if (paths == NULL) { + err = -ENOMEM; + goto end; + } + for (i = 0; i < samples_per_frame; ++i) { + paths[i] = malloc(8); + if (paths[i] == NULL) { + err = -ENOMEM; + goto end; + } + snprintf(paths[i], 8, "hoge%d", i); + } + + if (argc > 1) { + char *term; + access = strtol(argv[1], &term, 10); + if (errno != 0 || *term != '\0') { + err = -EINVAL;; + goto end; + } + if (access < SND_PCM_ACCESS_MMAP_INTERLEAVED && + access > SND_PCM_ACCESS_RW_NONINTERLEAVED) { + err = -EINVAL; + goto end; + } + if (access == SND_PCM_ACCESS_MMAP_COMPLEX) { + err = -EINVAL; + goto end; + } + + access_mask = 1ull << access; + verbose = true; + } else { + access_mask = (1ull << SND_PCM_ACCESS_MMAP_INTERLEAVED) | + (1ull << SND_PCM_ACCESS_MMAP_NONINTERLEAVED) | + (1ull << SND_PCM_ACCESS_RW_INTERLEAVED) | + (1ull << SND_PCM_ACCESS_RW_NONINTERLEAVED); + verbose = false; + } + + err = generator_context_init(&gen, access_mask, sample_format_mask, + 1, samples_per_frame, + 23, 4500, 1024, + sizeof(struct mapper_trial)); + if (err < 0) + goto end; + + trial = gen.private_data; + trial->cntrs = cntrs; + trial->cntr_format = CONTAINER_FORMAT_RIFF_WAVE; + trial->paths = paths; + trial->verbose = verbose; + err = generator_context_run(&gen, callback); + + generator_context_destroy(&gen); +end: + if (paths) { + for (i = 0; i < samples_per_frame; ++i) + free(paths[i]); + free(paths); + } + free(cntrs); + + if (err < 0) { + printf("%s\n", strerror(-err)); + return EXIT_FAILURE; + } + + return EXIT_SUCCESS; +} diff --git a/axfer/waiter-epoll.c b/axfer/waiter-epoll.c new file mode 100644 index 0000000..8f084f1 --- /dev/null +++ b/axfer/waiter-epoll.c @@ -0,0 +1,107 @@ +// SPDX-License-Identifier: GPL-2.0 +// +// waiter-epoll.c - Waiter for event notification by epoll(7). +// +// Copyright (c) 2018 Takashi Sakamoto +// +// Licensed under the terms of the GNU General Public License, version 2. + +#include "waiter.h" +#include "misc.h" + +#include +#include +#include +#include +#include +#include + +struct epoll_state { + int epfd; + struct epoll_event *events; + unsigned int ev_count; +}; + +static int epoll_prepare(struct waiter_context *waiter) +{ + struct epoll_state *state = waiter->private_data; + int i; + + state->ev_count = waiter->pfd_count; + state->events = calloc(state->ev_count, sizeof(*state->events)); + if (state->events == NULL) + return -ENOMEM; + + state->epfd = epoll_create(1); + if (state->epfd < 0) + return -errno; + + for (i = 0; i < waiter->pfd_count; ++i) { + struct epoll_event ev = { + .data.fd = waiter->pfds[i].fd, + .events = waiter->pfds[i].events, + }; + if (epoll_ctl(state->epfd, EPOLL_CTL_ADD, ev.data.fd, &ev) < 0) + return -errno; + } + + return 0; +} + +static int epoll_wait_event(struct waiter_context *waiter, int timeout_msec) +{ + struct epoll_state *state = waiter->private_data; + unsigned int ev_count; + int i, j; + int err; + + memset(state->events, 0, state->ev_count * sizeof(*state->events)); + err = epoll_wait(state->epfd, state->events, state->ev_count, + timeout_msec); + if (err < 0) + return -errno; + ev_count = (unsigned int)err; + + if (ev_count > 0) { + // Reconstruct data of pollfd structure. + for (i = 0; i < ev_count; ++i) { + struct epoll_event *ev = &state->events[i]; + for (j = 0; j < waiter->pfd_count; ++j) { + if (waiter->pfds[i].fd == ev->data.fd) { + waiter->pfds[i].revents = ev->events; + break; + } + } + } + } + + return ev_count; +} + +static void epoll_release(struct waiter_context *waiter) +{ + struct epoll_state *state = waiter->private_data; + int i; + + for (i = 0; i < waiter->pfd_count; ++i) { + int fd = waiter->pfds[i].fd; + epoll_ctl(state->epfd, EPOLL_CTL_DEL, fd, NULL); + } + + free(state->events); + state->events = NULL; + + close(state->epfd); + + state->ev_count = 0; + state->epfd = 0; +} + +const struct waiter_data waiter_epoll = { + .ops = { + .prepare = epoll_prepare, + .wait_event = epoll_wait_event, + .release = epoll_release, + }, + .private_size = sizeof(struct epoll_state), +}; diff --git a/axfer/waiter-poll.c b/axfer/waiter-poll.c new file mode 100644 index 0000000..61aa1a0 --- /dev/null +++ b/axfer/waiter-poll.c @@ -0,0 +1,45 @@ +// SPDX-License-Identifier: GPL-2.0 +// +// waiter-poll.c - Waiter for event notification by poll(2). +// +// Copyright (c) 2018 Takashi Sakamoto +// +// Licensed under the terms of the GNU General Public License, version 2. + +#include "waiter.h" +#include "misc.h" + +#include +#include +#include + +static int poll_prepare(struct waiter_context *waiter) +{ + // Nothing to do because an instance of waiter has required data. + return 0; +} + +static int poll_wait_event(struct waiter_context *waiter, int timeout_msec) +{ + int err; + + err = poll(waiter->pfds, waiter->pfd_count, timeout_msec); + if (err < 0) + return -errno; + + return err; +} + +static void poll_release(struct waiter_context *waiter) +{ + // Nothing to do because an instance of waiter has required data. + return; +} + +const struct waiter_data waiter_poll = { + .ops = { + .prepare = poll_prepare, + .wait_event = poll_wait_event, + .release = poll_release, + }, +}; diff --git a/axfer/waiter-select.c b/axfer/waiter-select.c new file mode 100644 index 0000000..97b1e5a --- /dev/null +++ b/axfer/waiter-select.c @@ -0,0 +1,109 @@ +// SPDX-License-Identifier: GPL-2.0 +// +// waiter-select.c - Waiter for event notification by select(2). +// +// Copyright (c) 2018 Takashi Sakamoto +// +// Licensed under the terms of the GNU General Public License, version 2. + +#include "waiter.h" + +#include +#include +#include +#include +#include + +// Except for POLLERR. +#ifdef POLLRDNORM +// This program is for userspace compliant to POSIX 2008 (IEEE 1003.1:2008). +// This is the default compliance level since glibc-2.12 or later. +# define POLLIN_SET (POLLRDNORM | POLLRDBAND | POLLIN | POLLHUP) +# define POLLOUT_SET (POLLWRBAND | POLLWRNORM | POLLOUT) +#else +// However it's allowed to be for old compliance levels. +# define POLLIN_SET (POLLIN | POLLHUP) +# define POLLOUT_SET (POLLOUT) +#endif +#define POLLEX_SET (POLLPRI) + + +struct select_state { + fd_set rfds_rd; + fd_set rfds_wr; + fd_set rfds_ex; +}; + +static int select_prepare(struct waiter_context *waiter) +{ + return 0; +} + +static int select_wait_event(struct waiter_context *waiter, int timeout_msec) +{ + struct select_state *state = waiter->private_data; + struct pollfd *pfd; + int fd_max; + struct timeval tv, *tv_ptr; + int i; + int err; + + FD_ZERO(&state->rfds_rd); + FD_ZERO(&state->rfds_wr); + FD_ZERO(&state->rfds_ex); + + fd_max = 0; + for (i = 0; i < waiter->pfd_count; ++i) { + pfd = &waiter->pfds[i]; + + if (pfd->events & POLLIN_SET) + FD_SET(pfd->fd, &state->rfds_rd); + if (pfd->events & POLLOUT_SET) + FD_SET(pfd->fd, &state->rfds_wr); + if (pfd->events & POLLEX_SET) + FD_SET(pfd->fd, &state->rfds_ex); + if (pfd->fd > fd_max) + fd_max = pfd->fd; + } + + if (timeout_msec < 0) { + tv_ptr = NULL; + } else { + tv.tv_sec = 0; + tv.tv_usec = timeout_msec * 1000; + tv_ptr = &tv; + } + + err = select(fd_max + 1, &state->rfds_rd, &state->rfds_wr, + &state->rfds_ex, tv_ptr); + if (err < 0) + return -errno; + + for (i = 0; i < waiter->pfd_count; ++i) { + pfd = &waiter->pfds[i]; + + pfd->revents = 0; + if (FD_ISSET(pfd->fd, &state->rfds_rd)) + pfd->revents |= POLLIN; + if (FD_ISSET(pfd->fd, &state->rfds_wr)) + pfd->revents |= POLLOUT; + if (FD_ISSET(pfd->fd, &state->rfds_ex)) + pfd->revents |= POLLHUP; + } + + return err; +} + +static void select_release(struct waiter_context *waiter) +{ + return; +} + +const struct waiter_data waiter_select = { + .ops = { + .prepare = select_prepare, + .wait_event = select_wait_event, + .release = select_release, + }, + .private_size = sizeof(struct select_state), +}; diff --git a/axfer/waiter.c b/axfer/waiter.c new file mode 100644 index 0000000..1e9c811 --- /dev/null +++ b/axfer/waiter.c @@ -0,0 +1,104 @@ +// SPDX-License-Identifier: GPL-2.0 +// +// waiter.c - I/O event waiter. +// +// Copyright (c) 2018 Takashi Sakamoto +// +// Licensed under the terms of the GNU General Public License, version 2. + +#include "waiter.h" + +#include +#include +#include + +#include "misc.h" + +static const char *const waiter_type_labels[] = { + [WAITER_TYPE_DEFAULT] = "default", + [WAITER_TYPE_POLL] = "poll", + [WAITER_TYPE_SELECT] = "select", + [WAITER_TYPE_EPOLL] = "epoll", +}; + +enum waiter_type waiter_type_from_label(const char *label) +{ + int i; + + for (i = 0; i < ARRAY_SIZE(waiter_type_labels); ++i) { + if (!strcmp(waiter_type_labels[i], label)) + return i; + } + + return WAITER_TYPE_DEFAULT; +} + +const char *waiter_label_from_type(enum waiter_type type) +{ + return waiter_type_labels[type]; +} + +int waiter_context_init(struct waiter_context *waiter, + enum waiter_type type, unsigned int pfd_count) +{ + struct { + enum waiter_type type; + const struct waiter_data *waiter; + } entries[] = { + {WAITER_TYPE_POLL, &waiter_poll}, + {WAITER_TYPE_SELECT, &waiter_select}, + {WAITER_TYPE_EPOLL, &waiter_epoll}, + }; + int i; + + if (pfd_count == 0) + return -EINVAL; + + for (i = 0; i < ARRAY_SIZE(entries); ++i) { + if (entries[i].type == type) + break; + } + if (i == ARRAY_SIZE(entries)) + return -EINVAL; + + waiter->private_data = malloc(entries[i].waiter->private_size); + if (waiter->private_data == NULL) + return -ENOMEM; + memset(waiter->private_data, 0, entries[i].waiter->private_size); + + waiter->type = type; + waiter->ops = &entries[i].waiter->ops; + + waiter->pfds = calloc(pfd_count, sizeof(*waiter->pfds)); + if (waiter->pfds == NULL) + return -ENOMEM; + waiter->pfd_count = pfd_count; + + return 0; +} + +int waiter_context_prepare(struct waiter_context *waiter) +{ + return waiter->ops->prepare(waiter); +} + +int waiter_context_wait_event(struct waiter_context *waiter, + int timeout_msec) +{ + return waiter->ops->wait_event(waiter, timeout_msec); +} + +void waiter_context_release(struct waiter_context *waiter) +{ + waiter->ops->release(waiter); +} + +void waiter_context_destroy(struct waiter_context *waiter) +{ + if (waiter->pfds) + free(waiter->pfds); + waiter->pfd_count = 0; + if (waiter->private_data) + free(waiter->private_data); + waiter->private_data = NULL; +} diff --git a/axfer/waiter.h b/axfer/waiter.h new file mode 100644 index 0000000..db18e33 --- /dev/null +++ b/axfer/waiter.h @@ -0,0 +1,61 @@ +// SPDX-License-Identifier: GPL-2.0 +// +// waiter.h - a header for I/O event waiter. +// +// Copyright (c) 2018 Takashi Sakamoto +// +// Licensed under the terms of the GNU General Public License, version 2. + +#ifndef __ALSA_UTILS_AXFER_WAITER__H_ +#define __ALSA_UTILS_AXFER_WAITER__H_ + +#include + +enum waiter_type { + WAITER_TYPE_DEFAULT = 0, + WAITER_TYPE_POLL, + WAITER_TYPE_SELECT, + WAITER_TYPE_EPOLL, + WAITER_TYPE_COUNT, +}; + +struct waiter_ops; + +struct waiter_context { + enum waiter_type type; + const struct waiter_ops *ops; + void *private_data; + + struct pollfd *pfds; + unsigned int pfd_count; +}; + +enum waiter_type waiter_type_from_label(const char *label); +const char *waiter_label_from_type(enum waiter_type type); + +int waiter_context_init(struct waiter_context *waiter, + enum waiter_type type, unsigned int pfd_count); +int waiter_context_prepare(struct waiter_context *waiter); +int waiter_context_wait_event(struct waiter_context *waiter, + int timeout_msec); +void waiter_context_release(struct waiter_context *waiter); +void waiter_context_destroy(struct waiter_context *waiter); + +// For internal use in 'waiter' module. + +struct waiter_ops { + int (*prepare)(struct waiter_context *waiter); + int (*wait_event)(struct waiter_context *waiter, int timeout_msec); + void (*release)(struct waiter_context *waiter); +}; + +struct waiter_data { + struct waiter_ops ops; + unsigned int private_size; +}; + +extern const struct waiter_data waiter_poll; +extern const struct waiter_data waiter_select; +extern const struct waiter_data waiter_epoll; + +#endif diff --git a/axfer/xfer-libasound-irq-mmap.c b/axfer/xfer-libasound-irq-mmap.c new file mode 100644 index 0000000..386e741 --- /dev/null +++ b/axfer/xfer-libasound-irq-mmap.c @@ -0,0 +1,301 @@ +// SPDX-License-Identifier: GPL-2.0 +// +// xfer-libasound-irq-mmap.c - IRQ-based scheduling model for mmap operation. +// +// Copyright (c) 2018 Takashi Sakamoto +// +// Licensed under the terms of the GNU General Public License, version 2. + +#include "xfer-libasound.h" +#include "misc.h" + +struct map_layout { + snd_pcm_status_t *status; + + char **vector; + unsigned int samples_per_frame; +}; + +static int irq_mmap_pre_process(struct libasound_state *state) +{ + struct map_layout *layout = state->private_data; + snd_pcm_access_t access; + snd_pcm_uframes_t frame_offset; + snd_pcm_uframes_t avail = 0; + int i; + int err; + + err = snd_pcm_status_malloc(&layout->status); + if (err < 0) + return err; + + err = snd_pcm_hw_params_get_access(state->hw_params, &access); + if (err < 0) + return err; + + err = snd_pcm_hw_params_get_channels(state->hw_params, + &layout->samples_per_frame); + if (err < 0) + return err; + + if (access == SND_PCM_ACCESS_MMAP_NONINTERLEAVED) { + layout->vector = calloc(layout->samples_per_frame, + sizeof(*layout->vector)); + if (layout->vector == NULL) + return err; + } + + if (state->verbose) { + const snd_pcm_channel_area_t *areas; + err = snd_pcm_mmap_begin(state->handle, &areas, &frame_offset, + &avail); + if (err < 0) + return err; + + logging(state, "attributes for mapped page frame:\n"); + for (i = 0; i < layout->samples_per_frame; ++i) { + const snd_pcm_channel_area_t *area = areas + i; + + logging(state, " sample number: %d\n", i); + logging(state, " address: %p\n", area->addr); + logging(state, " bits for offset: %u\n", area->first); + logging(state, " bits/frame: %u\n", area->step); + } + logging(state, "\n"); + } + + return 0; +} + +static int irq_mmap_process_frames(struct libasound_state *state, + unsigned int *frame_count, + struct mapper_context *mapper, + struct container_context *cntrs) +{ + struct map_layout *layout = state->private_data; + const snd_pcm_channel_area_t *areas; + snd_pcm_uframes_t frame_offset; + snd_pcm_uframes_t avail; + unsigned int avail_count; + void *frame_buf; + snd_pcm_sframes_t consumed_count; + int err; + + if (state->use_waiter) { + unsigned int msec_per_buffer; + unsigned short revents; + + // Wait during msec equivalent to all audio data frames in + // buffer instead of period, for safe. + err = snd_pcm_hw_params_get_buffer_time(state->hw_params, + &msec_per_buffer, NULL); + if (err < 0) + return err; + msec_per_buffer /= 1000; + + // Wait for hardware IRQ when no avail space in buffer. + err = xfer_libasound_wait_event(state, msec_per_buffer, + &revents); + if (err == -ETIMEDOUT) { + logging(state, + "No event occurs for PCM substream during %u " + "msec. The implementaion of kernel driver or " + "userland backend causes this issue.\n", + msec_per_buffer); + return err; + } + if (err < 0) + return err; + if (revents & POLLERR) { + // TODO: error reporting? + return -EIO; + } + if (!(revents & (POLLIN | POLLOUT))) + return -EAGAIN; + + // When rescheduled, current position of data transmission was + // queried to actual hardware by a handler of IRQ. No need to + // perform it; e.g. ioctl(2) with SNDRV_PCM_IOCTL_HWSYNC. + } + + // Sync cache in user space to data in kernel space to calculate avail + // frames according to the latest positions on PCM buffer. + // + // This has an additional advantage to handle libasound PCM plugins. + // Most of libasound PCM plugins perform resampling in .avail_update() + // callback for capture PCM substream, then update positions on buffer. + // + // MEMO: either snd_pcm_avail_update() and snd_pcm_mmap_begin() can + // return the same number of available frames. + avail = snd_pcm_avail_update(state->handle); + if ((snd_pcm_sframes_t)avail < 0) + return (int)avail; + if (*frame_count < avail) + avail = *frame_count; + + err = snd_pcm_mmap_begin(state->handle, &areas, &frame_offset, &avail); + if (err < 0) + return err; + + // Trim according up to expected frame count. + if (*frame_count < avail) + avail_count = *frame_count; + else + avail_count = (unsigned int)avail; + + // TODO: Perhaps, the complex layout can be supported as a variation of + // vector type. However, there's no driver with this layout. + if (layout->vector == NULL) { + char *buf; + buf = areas[0].addr; + buf += snd_pcm_frames_to_bytes(state->handle, frame_offset); + frame_buf = buf; + } else { + int i; + for (i = 0; i < layout->samples_per_frame; ++i) { + layout->vector[i] = areas[i].addr; + layout->vector[i] += snd_pcm_samples_to_bytes( + state->handle, frame_offset); + } + frame_buf = layout->vector; + } + + err = mapper_context_process_frames(mapper, frame_buf, &avail_count, + cntrs); + if (err < 0) + return err; + if (avail_count == 0) { + *frame_count = 0; + return 0; + } + + consumed_count = snd_pcm_mmap_commit(state->handle, frame_offset, + avail_count); + if (consumed_count < 0) + return (int)consumed_count; + if (consumed_count != avail_count) + logging(state, "A bug of access plugin for this PCM node.\n"); + + *frame_count = consumed_count; + + return 0; +} + +static int irq_mmap_r_process_frames(struct libasound_state *state, + unsigned *frame_count, + struct mapper_context *mapper, + struct container_context *cntrs) +{ + struct map_layout *layout = state->private_data; + snd_pcm_state_t s; + int err; + + // To querying current status of hardware, we need to care of + // synchronization between 3 levels: + // 1. status to actual hardware by driver. + // 2. status data in kernel space. + // 3. status data in user space. + // + // Kernel driver query 1 and sync 2, according to requests of some + // ioctl(2) commands. For synchronization between 2 and 3, ALSA PCM core + // supports mmap(2) operation on cache coherent architectures, some + // ioctl(2) commands on cache incoherent architecture. In usage of the + // former mechanism, we need to care of concurrent access by IRQ context + // and process context to the mapped page frame. + // In a call of ioctl(2) with SNDRV_PCM_IOCTL_STATUS and + // SNDRV_PCM_IOCTL_STATUS_EXT, the above care is needless because + // mapped page frame is unused regardless of architectures in a point of + // cache coherency. + err = snd_pcm_status(state->handle, layout->status); + if (err < 0) + goto error; + s = snd_pcm_status_get_state(layout->status); + + // TODO: if reporting something, do here with the status data. + + // For capture direction, need to start stream explicitly. + if (s != SND_PCM_STATE_RUNNING) { + if (s != SND_PCM_STATE_PREPARED) { + err = -EPIPE; + goto error; + } + + err = snd_pcm_start(state->handle); + if (err < 0) + goto error; + } + + err = irq_mmap_process_frames(state, frame_count, mapper, cntrs); + if (err < 0) + goto error; + + return 0; +error: + *frame_count = 0; + return err; +} + +static int irq_mmap_w_process_frames(struct libasound_state *state, + unsigned *frame_count, + struct mapper_context *mapper, + struct container_context *cntrs) +{ + struct map_layout *layout = state->private_data; + snd_pcm_state_t s; + int err; + + // Read my comment in 'irq_mmap_r_process_frames(). + err = snd_pcm_status(state->handle, layout->status); + if (err < 0) + goto error; + s = snd_pcm_status_get_state(layout->status); + + // TODO: if reporting something, do here with the status data. + + err = irq_mmap_process_frames(state, frame_count, mapper, cntrs); + if (err < 0) + goto error; + + // Need to start playback stream explicitly + if (s != SND_PCM_STATE_RUNNING) { + if (s != SND_PCM_STATE_PREPARED) { + err = -EPIPE; + goto error; + } + + err = snd_pcm_start(state->handle); + if (err < 0) + goto error; + } + + return 0; +error: + *frame_count = 0; + return err; +} + +static void irq_mmap_post_process(struct libasound_state *state) +{ + struct map_layout *layout = state->private_data; + + if (layout->status) + snd_pcm_status_free(layout->status); + layout->status = NULL; + + free(layout->vector); + layout->vector = NULL; +} + +const struct xfer_libasound_ops xfer_libasound_irq_mmap_w_ops = { + .pre_process = irq_mmap_pre_process, + .process_frames = irq_mmap_w_process_frames, + .post_process = irq_mmap_post_process, + .private_size = sizeof(struct map_layout), +}; + +const struct xfer_libasound_ops xfer_libasound_irq_mmap_r_ops = { + .pre_process = irq_mmap_pre_process, + .process_frames = irq_mmap_r_process_frames, + .post_process = irq_mmap_post_process, + .private_size = sizeof(struct map_layout), +}; diff --git a/axfer/xfer-libasound-irq-rw.c b/axfer/xfer-libasound-irq-rw.c new file mode 100644 index 0000000..6ed1927 --- /dev/null +++ b/axfer/xfer-libasound-irq-rw.c @@ -0,0 +1,438 @@ +// SPDX-License-Identifier: GPL-2.0 +// +// xfer-libasound-irq-rw.c - IRQ-based scheduling model for read/write operation. +// +// Copyright (c) 2018 Takashi Sakamoto +// +// Licensed under the terms of the GNU General Public License, version 2. + +#include "xfer-libasound.h" +#include "misc.h" +#include "frame-cache.h" + +struct rw_closure { + snd_pcm_access_t access; + int (*process_frames)(struct libasound_state *state, + snd_pcm_state_t status, unsigned int *frame_count, + struct mapper_context *mapper, + struct container_context *cntrs); + struct frame_cache cache; +}; + +static int wait_for_avail(struct libasound_state *state) +{ + unsigned int msec_per_buffer; + unsigned short revents; + unsigned short event; + int err; + + // Wait during msec equivalent to all audio data frames in buffer + // instead of period, for safe. + err = snd_pcm_hw_params_get_buffer_time(state->hw_params, + &msec_per_buffer, NULL); + if (err < 0) + return err; + msec_per_buffer /= 1000; + + // Wait for hardware IRQ when no available space. + err = xfer_libasound_wait_event(state, msec_per_buffer, &revents); + if (err < 0) + return err; + + // TODO: error reporting. + if (revents & POLLERR) + return -EIO; + + if (snd_pcm_stream(state->handle) == SND_PCM_STREAM_CAPTURE) + event = POLLIN; + else + event = POLLOUT; + + if (!(revents & event)) + return -EAGAIN; + + return 0; +} + +static int read_frames(struct libasound_state *state, unsigned int *frame_count, + unsigned int avail_count, struct mapper_context *mapper, + struct container_context *cntrs) +{ + struct rw_closure *closure = state->private_data; + snd_pcm_sframes_t handled_frame_count; + unsigned int consumed_count; + int err; + + // Trim according up to expected frame count. + if (*frame_count < avail_count) + avail_count = *frame_count; + + // Cache required amount of frames. + if (avail_count > frame_cache_get_count(&closure->cache)) { + avail_count -= frame_cache_get_count(&closure->cache); + + // Execute write operation according to the shape of buffer. + // These operations automatically start the substream. + if (closure->access == SND_PCM_ACCESS_RW_INTERLEAVED) { + handled_frame_count = snd_pcm_readi(state->handle, + closure->cache.buf_ptr, + avail_count); + } else { + handled_frame_count = snd_pcm_readn(state->handle, + closure->cache.buf_ptr, + avail_count); + } + if (handled_frame_count < 0) { + err = handled_frame_count; + return err; + } + frame_cache_increase_count(&closure->cache, handled_frame_count); + avail_count = frame_cache_get_count(&closure->cache); + } + + // Write out to file descriptors. + consumed_count = avail_count; + err = mapper_context_process_frames(mapper, closure->cache.buf, + &consumed_count, cntrs); + if (err < 0) + return err; + + frame_cache_reduce(&closure->cache, consumed_count); + + *frame_count = consumed_count; + + return 0; +} + +static int r_process_frames_blocking(struct libasound_state *state, + snd_pcm_state_t status, + unsigned int *frame_count, + struct mapper_context *mapper, + struct container_context *cntrs) +{ + snd_pcm_sframes_t avail; + snd_pcm_uframes_t avail_count; + int err = 0; + + if (status == SND_PCM_STATE_RUNNING) { + // Check available space on the buffer. + avail = snd_pcm_avail(state->handle); + if (avail < 0) { + err = avail; + goto error; + } + avail_count = (snd_pcm_uframes_t)avail; + + if (avail_count == 0) { + // Request data frames so that blocking is just + // released. + err = snd_pcm_sw_params_get_avail_min(state->sw_params, + &avail_count); + if (err < 0) + goto error; + } + } else { + // Request data frames so that the PCM substream starts. + snd_pcm_uframes_t frame_count; + err = snd_pcm_sw_params_get_start_threshold(state->sw_params, + &frame_count); + if (err < 0) + goto error; + + avail_count = (unsigned int)frame_count; + } + + err = read_frames(state, frame_count, avail_count, mapper, cntrs); + if (err < 0) + goto error; + + return 0; +error: + *frame_count = 0; + return err; +} + +static int r_process_frames_nonblocking(struct libasound_state *state, + snd_pcm_state_t status, + unsigned int *frame_count, + struct mapper_context *mapper, + struct container_context *cntrs) +{ + snd_pcm_sframes_t avail; + snd_pcm_uframes_t avail_count; + int err = 0; + + if (status != SND_PCM_STATE_RUNNING) { + err = snd_pcm_start(state->handle); + if (err < 0) + goto error; + } + + if (state->use_waiter) { + err = wait_for_avail(state); + if (err < 0) + goto error; + } + + // Check available space on the buffer. + avail = snd_pcm_avail(state->handle); + if (avail < 0) { + err = avail; + goto error; + } + avail_count = (snd_pcm_uframes_t)avail; + + if (avail_count == 0) { + // Let's go to a next iteration. + err = 0; + goto error; + } + + err = read_frames(state, frame_count, avail_count, mapper, cntrs); + if (err < 0) + goto error; + + return 0; +error: + *frame_count = 0; + return err; +} + +static int write_frames(struct libasound_state *state, + unsigned int *frame_count, unsigned int avail_count, + struct mapper_context *mapper, + struct container_context *cntrs) +{ + struct rw_closure *closure = state->private_data; + snd_pcm_uframes_t consumed_count; + snd_pcm_sframes_t handled_frame_count; + int err; + + // Trim according up to expected frame count. + if (*frame_count < avail_count) + avail_count = *frame_count; + + // Cache required amount of frames. + if (avail_count > frame_cache_get_count(&closure->cache)) { + avail_count -= frame_cache_get_count(&closure->cache); + + // Read frames to transfer. + err = mapper_context_process_frames(mapper, + closure->cache.buf_ptr, &avail_count, cntrs); + if (err < 0) + return err; + frame_cache_increase_count(&closure->cache, avail_count); + avail_count = frame_cache_get_count(&closure->cache); + } + + // Execute write operation according to the shape of buffer. These + // operations automatically start the stream. + consumed_count = avail_count; + if (closure->access == SND_PCM_ACCESS_RW_INTERLEAVED) { + handled_frame_count = snd_pcm_writei(state->handle, + closure->cache.buf, consumed_count); + } else { + handled_frame_count = snd_pcm_writen(state->handle, + closure->cache.buf, consumed_count); + } + if (handled_frame_count < 0) { + err = handled_frame_count; + return err; + } + + consumed_count = handled_frame_count; + frame_cache_reduce(&closure->cache, consumed_count); + + *frame_count = consumed_count; + + return 0; +} + +static int w_process_frames_blocking(struct libasound_state *state, + snd_pcm_state_t status, + unsigned int *frame_count, + struct mapper_context *mapper, + struct container_context *cntrs) +{ + snd_pcm_sframes_t avail; + unsigned int avail_count; + int err; + + if (status == SND_PCM_STATE_RUNNING) { + // Check available space on the buffer. + avail = snd_pcm_avail(state->handle); + if (avail < 0) { + err = avail; + goto error; + } + avail_count = (unsigned int)avail; + + if (avail_count == 0) { + // Fill with data frames so that blocking is just + // released. + snd_pcm_uframes_t avail_min; + err = snd_pcm_sw_params_get_avail_min(state->sw_params, + &avail_min); + if (err < 0) + goto error; + avail_count = (unsigned int)avail_min; + } + } else { + snd_pcm_uframes_t frames_for_start_threshold; + snd_pcm_uframes_t frames_per_period; + + // Fill with data frames so that the PCM substream starts. + err = snd_pcm_sw_params_get_start_threshold(state->sw_params, + &frames_for_start_threshold); + if (err < 0) + goto error; + + // But the above number can be too small and cause XRUN because + // I/O operation is done per period. + err = snd_pcm_hw_params_get_period_size(state->hw_params, + &frames_per_period, NULL); + if (err < 0) + goto error; + + // Use larger one to prevent from both of XRUN and successive + // blocking. + if (frames_for_start_threshold > frames_per_period) + avail_count = (unsigned int)frames_for_start_threshold; + else + avail_count = (unsigned int)frames_per_period; + } + + err = write_frames(state, frame_count, avail_count, mapper, cntrs); + if (err < 0) + goto error; + + return 0; +error: + *frame_count = 0; + return err; +} + +static int w_process_frames_nonblocking(struct libasound_state *state, + snd_pcm_state_t status, + unsigned int *frame_count, + struct mapper_context *mapper, + struct container_context *cntrs) +{ + snd_pcm_sframes_t avail; + unsigned int avail_count; + int err; + + if (state->use_waiter) { + err = wait_for_avail(state); + if (err < 0) + goto error; + } + + // Check available space on the buffer. + avail = snd_pcm_avail(state->handle); + if (avail < 0) { + err = avail; + goto error; + } + avail_count = (unsigned int)avail; + + if (avail_count == 0) { + // Let's go to a next iteration. + err = 0; + goto error; + } + + err = write_frames(state, frame_count, avail_count, mapper, cntrs); + if (err < 0) + goto error; + + // NOTE: The substream starts automatically when the accumulated number + // of queued data frame exceeds start_threshold. + + return 0; +error: + *frame_count = 0; + return err; +} + +static int irq_rw_pre_process(struct libasound_state *state) +{ + struct rw_closure *closure = state->private_data; + snd_pcm_format_t format; + snd_pcm_uframes_t frames_per_buffer; + int bytes_per_sample; + unsigned int samples_per_frame; + int err; + + err = snd_pcm_hw_params_get_format(state->hw_params, &format); + if (err < 0) + return err; + bytes_per_sample = snd_pcm_format_physical_width(format) / 8; + if (bytes_per_sample <= 0) + return -ENXIO; + + err = snd_pcm_hw_params_get_channels(state->hw_params, + &samples_per_frame); + if (err < 0) + return err; + + err = snd_pcm_hw_params_get_buffer_size(state->hw_params, + &frames_per_buffer); + if (err < 0) + return err; + + err = snd_pcm_hw_params_get_access(state->hw_params, &closure->access); + if (err < 0) + return err; + + err = frame_cache_init(&closure->cache, closure->access, + bytes_per_sample, samples_per_frame, + frames_per_buffer); + if (err < 0) + return err; + + if (snd_pcm_stream(state->handle) == SND_PCM_STREAM_CAPTURE) { + if (state->nonblock) + closure->process_frames = r_process_frames_nonblocking; + else + closure->process_frames = r_process_frames_blocking; + } else { + if (state->nonblock) + closure->process_frames = w_process_frames_nonblocking; + else + closure->process_frames = w_process_frames_blocking; + } + + return 0; +} + +static int irq_rw_process_frames(struct libasound_state *state, + unsigned int *frame_count, + struct mapper_context *mapper, + struct container_context *cntrs) +{ + struct rw_closure *closure = state->private_data; + snd_pcm_state_t status; + + // Need to recover the stream. + status = snd_pcm_state(state->handle); + if (status != SND_PCM_STATE_RUNNING && status != SND_PCM_STATE_PREPARED) + return -EPIPE; + + // NOTE: Actually, status can be shift always. + return closure->process_frames(state, status, frame_count, mapper, cntrs); +} + +static void irq_rw_post_process(struct libasound_state *state) +{ + struct rw_closure *closure = state->private_data; + + frame_cache_destroy(&closure->cache); +} + +const struct xfer_libasound_ops xfer_libasound_irq_rw_ops = { + .pre_process = irq_rw_pre_process, + .process_frames = irq_rw_process_frames, + .post_process = irq_rw_post_process, + .private_size = sizeof(struct rw_closure), +}; diff --git a/axfer/xfer-libasound-timer-mmap.c b/axfer/xfer-libasound-timer-mmap.c new file mode 100644 index 0000000..ba26e29 --- /dev/null +++ b/axfer/xfer-libasound-timer-mmap.c @@ -0,0 +1,455 @@ +// SPDX-License-Identifier: GPL-2.0 +// +// xfer-libasound-irq-mmap.c - Timer-based scheduling model for mmap operation. +// +// Copyright (c) 2018 Takashi Sakamoto +// +// Licensed under the terms of the GNU General Public License, version 2. + +#include "xfer-libasound.h" +#include "misc.h" + +struct map_layout { + snd_pcm_status_t *status; + bool need_forward_or_rewind; + char **vector; + + unsigned int frames_per_second; + unsigned int samples_per_frame; + unsigned int frames_per_buffer; +}; + +static int timer_mmap_pre_process(struct libasound_state *state) +{ + struct map_layout *layout = state->private_data; + snd_pcm_access_t access; + snd_pcm_uframes_t frame_offset; + snd_pcm_uframes_t avail = 0; + snd_pcm_uframes_t frames_per_buffer; + int i; + int err; + + // This parameter, 'period event', is a software feature in alsa-lib. + // This switch a handler in 'hw' PCM plugin from irq-based one to + // timer-based one. This handler has two file descriptors for + // ALSA PCM character device and ALSA timer device. The latter is used + // to catch suspend/resume events as wakeup event. + err = snd_pcm_sw_params_set_period_event(state->handle, + state->sw_params, 1); + if (err < 0) + return err; + + err = snd_pcm_status_malloc(&layout->status); + if (err < 0) + return err; + + err = snd_pcm_hw_params_get_access(state->hw_params, &access); + if (err < 0) + return err; + + err = snd_pcm_hw_params_get_channels(state->hw_params, + &layout->samples_per_frame); + if (err < 0) + return err; + + err = snd_pcm_hw_params_get_rate(state->hw_params, + &layout->frames_per_second, NULL); + if (err < 0) + return err; + + err = snd_pcm_hw_params_get_buffer_size(state->hw_params, + &frames_per_buffer); + if (err < 0) + return err; + layout->frames_per_buffer = (unsigned int)frames_per_buffer; + + if (access == SND_PCM_ACCESS_MMAP_NONINTERLEAVED) { + layout->vector = calloc(layout->samples_per_frame, + sizeof(*layout->vector)); + if (layout->vector == NULL) + return err; + } + + if (state->verbose) { + const snd_pcm_channel_area_t *areas; + err = snd_pcm_mmap_begin(state->handle, &areas, &frame_offset, + &avail); + if (err < 0) + return err; + + logging(state, "attributes for mapped page frame:\n"); + for (i = 0; i < layout->samples_per_frame; ++i) { + const snd_pcm_channel_area_t *area = areas + i; + + logging(state, " sample number: %d\n", i); + logging(state, " address: %p\n", area->addr); + logging(state, " bits for offset: %u\n", area->first); + logging(state, " bits/frame: %u\n", area->step); + } + } + + return 0; +} + +static void *get_buffer(struct libasound_state *state, + const snd_pcm_channel_area_t *areas, + snd_pcm_uframes_t frame_offset) +{ + struct map_layout *layout = state->private_data; + void *frame_buf; + + if (layout->vector == NULL) { + char *buf; + buf = areas[0].addr; + buf += snd_pcm_frames_to_bytes(state->handle, frame_offset); + frame_buf = buf; + } else { + int i; + for (i = 0; i < layout->samples_per_frame; ++i) { + layout->vector[i] = areas[i].addr; + layout->vector[i] += snd_pcm_samples_to_bytes( + state->handle, frame_offset); + } + frame_buf = layout->vector; + } + + return frame_buf; +} + +static int timer_mmap_process_frames(struct libasound_state *state, + unsigned int *frame_count, + struct mapper_context *mapper, + struct container_context *cntrs) +{ + struct map_layout *layout = state->private_data; + snd_pcm_uframes_t planned_count; + snd_pcm_sframes_t avail; + snd_pcm_uframes_t avail_count; + const snd_pcm_channel_area_t *areas; + snd_pcm_uframes_t frame_offset; + void *frame_buf; + snd_pcm_sframes_t consumed_count; + int err; + + // Retrieve avail space on PCM buffer between kernel/user spaces. + // On cache incoherent architectures, still care of data + // synchronization. + avail = snd_pcm_avail_update(state->handle); + if (avail < 0) + return (int)avail; + + // Retrieve pointers of the buffer and left space up to the boundary. + avail_count = (snd_pcm_uframes_t)avail; + err = snd_pcm_mmap_begin(state->handle, &areas, &frame_offset, + &avail_count); + if (err < 0) + return err; + + // MEMO: Use the amount of data frames as you like. + planned_count = layout->frames_per_buffer * random() / RAND_MAX; + if (frame_offset + planned_count > layout->frames_per_buffer) + planned_count = layout->frames_per_buffer - frame_offset; + + // Trim up to expected frame count. + if (*frame_count < planned_count) + planned_count = *frame_count; + + // Yield this CPU till planned amount of frames become available. + if (avail_count < planned_count) { + unsigned short revents; + int timeout_msec; + + // TODO; precise granularity of timeout; e.g. ppoll(2). + // Furthermore, wrap up according to granularity of reported + // value for hw_ptr. + timeout_msec = ((planned_count - avail_count) * 1000 + + layout->frames_per_second - 1) / + layout->frames_per_second; + + // TODO: However, experimentally, the above is not enough to + // keep planned amount of frames when waking up. I don't know + // exactly the mechanism yet. + err = xfer_libasound_wait_event(state, timeout_msec, + &revents); + if (err < 0) + return err; + if (revents & POLLERR) { + // TODO: error reporting. + return -EIO; + } + if (!(revents & (POLLIN | POLLOUT))) + return -EAGAIN; + + // MEMO: Need to perform hwsync explicitly because hwptr is not + // synchronized to actual position of data frame transmission + // on hardware because IRQ handlers are not used in this + // scheduling strategy. + avail = snd_pcm_avail(state->handle); + if (avail < 0) + return (int)avail; + if (avail < planned_count) { + logging(state, + "Wake up but not enough space: %lu %lu %u\n", + planned_count, avail, timeout_msec); + planned_count = avail; + } + } + + // Let's process data frames. + *frame_count = planned_count; + frame_buf = get_buffer(state, areas, frame_offset); + err = mapper_context_process_frames(mapper, frame_buf, frame_count, + cntrs); + if (err < 0) + return err; + + consumed_count = snd_pcm_mmap_commit(state->handle, frame_offset, + *frame_count); + if (consumed_count != *frame_count) { + logging(state, + "A bug of 'hw' PCM plugin or driver for this PCM " + "node.\n"); + } + *frame_count = consumed_count; + + return 0; +} + +static int forward_appl_ptr(struct libasound_state *state) +{ + struct map_layout *layout = state->private_data; + snd_pcm_uframes_t forwardable_count; + snd_pcm_sframes_t forward_count; + + forward_count = snd_pcm_forwardable(state->handle); + if (forward_count < 0) + return (int)forward_count; + forwardable_count = forward_count; + + // No need to add safe-gurard because hwptr goes ahead. + forward_count = snd_pcm_forward(state->handle, forwardable_count); + if (forward_count < 0) + return (int)forward_count; + + if (state->verbose) { + logging(state, + " forwarded: %lu/%u\n", + forward_count, layout->frames_per_buffer); + } + + return 0; +} + +static int timer_mmap_r_process_frames(struct libasound_state *state, + unsigned *frame_count, + struct mapper_context *mapper, + struct container_context *cntrs) +{ + struct map_layout *layout = state->private_data; + snd_pcm_state_t s; + int err; + + // SNDRV_PCM_HW_PARAMS_NO_PERIOD_WAKEUP suppresses any IRQ to notify + // period elapse for data transmission, therefore no need to care of + // concurrent access by IRQ context and process context, unlike + // IRQ-based operations. + // Here, this is just to query current status to hardware, for later + // processing. + err = snd_pcm_status(state->handle, layout->status); + if (err < 0) + goto error; + s = snd_pcm_status_get_state(layout->status); + + // TODO: if reporting something, do here with the status data. + + if (s == SND_PCM_STATE_RUNNING) { + // Reduce delay between sampling on hardware and handling by + // this program. + if (layout->need_forward_or_rewind) { + err = forward_appl_ptr(state); + if (err < 0) + goto error; + layout->need_forward_or_rewind = false; + } + + err = timer_mmap_process_frames(state, frame_count, mapper, + cntrs); + if (err < 0) + goto error; + } else { + if (s == SND_PCM_STATE_PREPARED) { + // For capture direction, need to start stream + // explicitly. + err = snd_pcm_start(state->handle); + if (err < 0) + goto error; + layout->need_forward_or_rewind = true; + // Not yet. + *frame_count = 0; + } else { + err = -EPIPE; + goto error; + } + } + + return 0; +error: + *frame_count = 0; + return err; +} + +static int rewind_appl_ptr(struct libasound_state *state) +{ + struct map_layout *layout = state->private_data; + snd_pcm_uframes_t rewindable_count; + snd_pcm_sframes_t rewind_count; + + rewind_count = snd_pcm_rewindable(state->handle); + if (rewind_count < 0) + return (int)rewind_count; + rewindable_count = rewind_count; + + // If appl_ptr were rewound just to position of hw_ptr, at next time, + // hw_ptr could catch up appl_ptr. This is overrun. We need a space + // between these two pointers to prevent this XRUN. + // This space is largely affected by time to process data frames later. + // + // TODO: a generous way to estimate a good value. + if (rewindable_count < 32) + return 0; + rewindable_count -= 32; + + rewind_count = snd_pcm_rewind(state->handle, rewindable_count); + if (rewind_count < 0) + return (int)rewind_count; + + if (state->verbose) { + logging(state, + " rewound: %lu/%u\n", + rewind_count, layout->frames_per_buffer); + } + + return 0; +} + +static int fill_buffer_with_zero_samples(struct libasound_state *state) +{ + struct map_layout *layout = state->private_data; + const snd_pcm_channel_area_t *areas; + snd_pcm_uframes_t frame_offset; + snd_pcm_uframes_t avail_count; + snd_pcm_format_t sample_format; + snd_pcm_uframes_t consumed_count; + int err; + + err = snd_pcm_hw_params_get_buffer_size(state->hw_params, + &avail_count); + if (err < 0) + return err; + + err = snd_pcm_mmap_begin(state->handle, &areas, &frame_offset, + &avail_count); + if (err < 0) + return err; + + err = snd_pcm_hw_params_get_format(state->hw_params, &sample_format); + if (err < 0) + return err; + + err = snd_pcm_areas_silence(areas, frame_offset, + layout->samples_per_frame, avail_count, + sample_format); + if (err < 0) + return err; + + consumed_count = snd_pcm_mmap_commit(state->handle, frame_offset, + avail_count); + if (consumed_count != avail_count) + logging(state, "A bug of access plugin for this PCM node.\n"); + + return 0; +} + +static int timer_mmap_w_process_frames(struct libasound_state *state, + unsigned *frame_count, + struct mapper_context *mapper, + struct container_context *cntrs) +{ + struct map_layout *layout = state->private_data; + snd_pcm_state_t s; + int err; + + // Read my comment in 'timer_mmap_w_process_frames()'. + err = snd_pcm_status(state->handle, layout->status); + if (err < 0) + goto error; + s = snd_pcm_status_get_state(layout->status); + + // TODO: if reporting something, do here with the status data. + + if (s == SND_PCM_STATE_RUNNING) { + // Reduce delay between queueing by this program and presenting + // on hardware. + if (layout->need_forward_or_rewind) { + err = rewind_appl_ptr(state); + if (err < 0) + goto error; + layout->need_forward_or_rewind = false; + } + + err = timer_mmap_process_frames(state, frame_count, mapper, + cntrs); + if (err < 0) + goto error; + } else { + // Need to start playback stream explicitly + if (s == SND_PCM_STATE_PREPARED) { + err = fill_buffer_with_zero_samples(state); + if (err < 0) + goto error; + + err = snd_pcm_start(state->handle); + if (err < 0) + goto error; + + layout->need_forward_or_rewind = true; + // Not yet. + *frame_count = 0; + } else { + err = -EPIPE; + goto error; + } + } + + return 0; +error: + *frame_count = 0; + return err; +} + +static void timer_mmap_post_process(struct libasound_state *state) +{ + struct map_layout *layout = state->private_data; + + if (layout->status) + snd_pcm_status_free(layout->status); + layout->status = NULL; + + if (layout->vector) + free(layout->vector); + layout->vector = NULL; +} + +const struct xfer_libasound_ops xfer_libasound_timer_mmap_w_ops = { + .pre_process = timer_mmap_pre_process, + .process_frames = timer_mmap_w_process_frames, + .post_process = timer_mmap_post_process, + .private_size = sizeof(struct map_layout), +}; + +const struct xfer_libasound_ops xfer_libasound_timer_mmap_r_ops = { + .pre_process = timer_mmap_pre_process, + .process_frames = timer_mmap_r_process_frames, + .post_process = timer_mmap_post_process, + .private_size = sizeof(struct map_layout), +}; diff --git a/axfer/xfer-libasound.c b/axfer/xfer-libasound.c new file mode 100644 index 0000000..00ff028 --- /dev/null +++ b/axfer/xfer-libasound.c @@ -0,0 +1,934 @@ +// SPDX-License-Identifier: GPL-2.0 +// +// xfer-libasound.c - receive/transmit frames by alsa-lib. +// +// Copyright (c) 2018 Takashi Sakamoto +// +// Licensed under the terms of the GNU General Public License, version 2. + +#include "xfer-libasound.h" +#include "misc.h" + +static const char *const sched_model_labels [] = { + [SCHED_MODEL_IRQ] = "irq", + [SCHED_MODEL_TIMER] = "timer", +}; + +enum no_short_opts { + // 200 or later belong to non us-ascii character set. + OPT_PERIOD_SIZE = 200, + OPT_BUFFER_SIZE, + OPT_WAITER_TYPE, + OPT_SCHED_MODEL, + OPT_DISABLE_RESAMPLE, + OPT_DISABLE_CHANNELS, + OPT_DISABLE_FORMAT, + OPT_DISABLE_SOFTVOL, + OPT_FATAL_ERRORS, + OPT_TEST_NOWAIT, + // Obsoleted. + OPT_TEST_POSITION, + OPT_TEST_COEF, +}; + +#define S_OPTS "D:NMF:B:A:R:T:m:" +static const struct option l_opts[] = { + {"device", 1, 0, 'D'}, + {"nonblock", 0, 0, 'N'}, + {"mmap", 0, 0, 'M'}, + {"period-time", 1, 0, 'F'}, + {"buffer-time", 1, 0, 'B'}, + {"period-size", 1, 0, OPT_PERIOD_SIZE}, + {"buffer-size", 1, 0, OPT_BUFFER_SIZE}, + {"avail-min", 1, 0, 'A'}, + {"start-delay", 1, 0, 'R'}, + {"stop-delay", 1, 0, 'T'}, + {"waiter-type", 1, 0, OPT_WAITER_TYPE}, + {"sched-model", 1, 0, OPT_SCHED_MODEL}, + // For plugins in alsa-lib. + {"disable-resample", 0, 0, OPT_DISABLE_RESAMPLE}, + {"disable-channels", 0, 0, OPT_DISABLE_CHANNELS}, + {"disable-format", 0, 0, OPT_DISABLE_FORMAT}, + {"disable-softvol", 0, 0, OPT_DISABLE_SOFTVOL}, + // For debugging. + {"fatal-errors", 0, 0, OPT_FATAL_ERRORS}, + {"test-nowait", 0, 0, OPT_TEST_NOWAIT}, + // Obsoleted. + {"chmap", 1, 0, 'm'}, + {"test-position", 0, 0, OPT_TEST_POSITION}, + {"test-coef", 1, 0, OPT_TEST_COEF}, +}; + +static int xfer_libasound_init(struct xfer_context *xfer, + snd_pcm_stream_t direction) +{ + struct libasound_state *state = xfer->private_data; + int err; + + err = snd_output_stdio_attach(&state->log, stderr, 0); + if (err < 0) + return err; + + err = snd_pcm_hw_params_malloc(&state->hw_params); + if (err < 0) + return err; + + return snd_pcm_sw_params_malloc(&state->sw_params); +} + +static int xfer_libasound_parse_opt(struct xfer_context *xfer, int key, + const char *optarg) +{ + struct libasound_state *state = xfer->private_data; + int err = 0; + + if (key == 'D') + state->node_literal = arg_duplicate_string(optarg, &err); + else if (key == 'N') + state->nonblock = true; + else if (key == 'M') + state->mmap = true; + else if (key == 'F') + state->msec_per_period = arg_parse_decimal_num(optarg, &err); + else if (key == 'B') + state->msec_per_buffer = arg_parse_decimal_num(optarg, &err); + else if (key == OPT_PERIOD_SIZE) + state->frames_per_period = arg_parse_decimal_num(optarg, &err); + else if (key == OPT_BUFFER_SIZE) + state->frames_per_buffer = arg_parse_decimal_num(optarg, &err); + else if (key == 'A') + state->msec_for_avail_min = arg_parse_decimal_num(optarg, &err); + else if (key == 'R') + state->msec_for_start_threshold = arg_parse_decimal_num(optarg, &err); + else if (key == 'T') + state->msec_for_stop_threshold = arg_parse_decimal_num(optarg, &err); + else if (key == OPT_WAITER_TYPE) + state->waiter_type_literal = arg_duplicate_string(optarg, &err); + else if (key == OPT_SCHED_MODEL) + state->sched_model_literal = arg_duplicate_string(optarg, &err); + else if (key == OPT_DISABLE_RESAMPLE) + state->no_auto_resample = true; + else if (key == OPT_DISABLE_CHANNELS) + state->no_auto_channels = true; + else if (key == OPT_DISABLE_FORMAT) + state->no_auto_format = true; + else if (key == OPT_DISABLE_SOFTVOL) + state->no_softvol = true; + else if (key == 'm' || + key == OPT_TEST_POSITION || + key == OPT_TEST_COEF) + err = -EINVAL; + else if (key == OPT_FATAL_ERRORS) + state->finish_at_xrun = true; + else if (key == OPT_TEST_NOWAIT) + state->test_nowait = true; + else + err = -ENXIO; + + return err; +} + +int xfer_libasound_validate_opts(struct xfer_context *xfer) +{ + struct libasound_state *state = xfer->private_data; + int err = 0; + + state->verbose = xfer->verbose > 1; + + if (state->node_literal == NULL) { + state->node_literal = strdup("default"); + if (state->node_literal == NULL) + return -ENOMEM; + } + + if (state->mmap && state->nonblock) { + fprintf(stderr, + "An option for mmap operation should not be used with " + "nonblocking option.\n"); + return -EINVAL; + } + + if (state->test_nowait) { + if (!state->nonblock && !state->mmap) { + fprintf(stderr, + "An option for nowait test should be used with " + "nonblock or mmap options.\n"); + return -EINVAL; + } + } + + if (state->msec_per_period > 0 && state->msec_per_buffer > 0) { + if (state->msec_per_period > state->msec_per_buffer) { + state->msec_per_period = state->msec_per_buffer; + state->msec_per_buffer = 0; + } + } + + if (state->frames_per_period > 0 && state->frames_per_buffer > 0) { + if (state->frames_per_period > state->frames_per_buffer) { + state->frames_per_period = state->frames_per_buffer; + state->frames_per_buffer = 0; + } + } + + state->sched_model = SCHED_MODEL_IRQ; + if (state->sched_model_literal != NULL) { + if (!strcmp(state->sched_model_literal, "timer")) { + state->sched_model = SCHED_MODEL_TIMER; + state->mmap = true; + state->nonblock = true; + } + } + + if (state->waiter_type_literal != NULL) { + if (state->test_nowait) { + fprintf(stderr, + "An option for waiter type should not be " + "used with nowait test option.\n"); + return -EINVAL; + } + if (!state->nonblock && !state->mmap) { + fprintf(stderr, + "An option for waiter type should be used " + "with nonblock or mmap or timer-based " + "scheduling options.\n"); + return -EINVAL; + } + state->waiter_type = + waiter_type_from_label(state->waiter_type_literal); + } else { + state->waiter_type = WAITER_TYPE_DEFAULT; + } + + return err; +} + +static int set_access_hw_param(struct libasound_state *state) +{ + snd_pcm_access_mask_t *mask; + int err; + + err = snd_pcm_access_mask_malloc(&mask); + if (err < 0) + return err; + snd_pcm_access_mask_none(mask); + if (state->mmap) { + snd_pcm_access_mask_set(mask, SND_PCM_ACCESS_MMAP_INTERLEAVED); + snd_pcm_access_mask_set(mask, SND_PCM_ACCESS_MMAP_NONINTERLEAVED); + } else { + snd_pcm_access_mask_set(mask, SND_PCM_ACCESS_RW_INTERLEAVED); + snd_pcm_access_mask_set(mask, SND_PCM_ACCESS_RW_NONINTERLEAVED); + } + err = snd_pcm_hw_params_set_access_mask(state->handle, state->hw_params, + mask); + snd_pcm_access_mask_free(mask); + + return err; +} + +static int disable_period_wakeup(struct libasound_state *state) +{ + int err; + + if (snd_pcm_type(state->handle) != SND_PCM_TYPE_HW) { + logging(state, + "Timer-based scheduling is only available for 'hw' " + "PCM plugin.\n"); + return -ENXIO; + } + + if (!snd_pcm_hw_params_can_disable_period_wakeup(state->hw_params)) { + logging(state, + "This hardware doesn't support the mode of no-period-" + "wakeup. In this case, timer-based scheduling is not " + "available.\n"); + return -EIO; + } + + err = snd_pcm_hw_params_set_period_wakeup(state->handle, + state->hw_params, 0); + if (err < 0) { + logging(state, + "Fail to disable period wakeup so that the hardware " + "generates no IRQs during transmission of data " + "frames.\n"); + } + + return err; +} + +static int open_handle(struct xfer_context *xfer) +{ + struct libasound_state *state = xfer->private_data; + int mode = 0; + int err; + + if (state->nonblock) + mode |= SND_PCM_NONBLOCK; + if (state->no_auto_resample) + mode |= SND_PCM_NO_AUTO_RESAMPLE; + if (state->no_auto_channels) + mode |= SND_PCM_NO_AUTO_CHANNELS; + if (state->no_auto_format) + mode |= SND_PCM_NO_AUTO_FORMAT; + if (state->no_softvol) + mode |= SND_PCM_NO_SOFTVOL; + + err = snd_pcm_open(&state->handle, state->node_literal, xfer->direction, + mode); + if (err < 0) { + logging(state, "Fail to open libasound PCM node for %s: %s\n", + snd_pcm_stream_name(xfer->direction), + state->node_literal); + return err; + } + + if ((state->nonblock || state->mmap) && !state->test_nowait) + state->use_waiter = true; + + err = snd_pcm_hw_params_any(state->handle, state->hw_params); + if (err < 0) + return err; + + if (state->sched_model == SCHED_MODEL_TIMER) { + err = disable_period_wakeup(state); + if (err < 0) + return err; + } + + if (xfer->dump_hw_params) { + logging(state, "Available HW Params of node: %s\n", + snd_pcm_name(state->handle)); + snd_pcm_hw_params_dump(state->hw_params, state->log); + // TODO: there're more parameters which are not dumped by + // alsa-lib. + return 0; + } + + return set_access_hw_param(state); +} + +static int prepare_waiter(struct libasound_state *state) +{ + unsigned int pfd_count; + int err; + + // Nothing to do for dafault waiter (=snd_pcm_wait()). + if (state->waiter_type == WAITER_TYPE_DEFAULT) + return 0; + + err = snd_pcm_poll_descriptors_count(state->handle); + if (err < 0) + return err; + if (err == 0) + return -ENXIO; + pfd_count = (unsigned int)err; + + state->waiter = malloc(sizeof(*state->waiter)); + if (state->waiter == NULL) + return -ENOMEM; + + err = waiter_context_init(state->waiter, state->waiter_type, pfd_count); + if (err < 0) + return err; + + err = snd_pcm_poll_descriptors(state->handle, state->waiter->pfds, + pfd_count); + if (err < 0) + return err; + + return waiter_context_prepare(state->waiter); +} + +int xfer_libasound_wait_event(struct libasound_state *state, int timeout_msec, + unsigned short *revents) +{ + int count; + + if (state->waiter_type != WAITER_TYPE_DEFAULT) { + struct waiter_context *waiter = state->waiter; + int err; + + count = waiter_context_wait_event(waiter, timeout_msec); + if (count < 0) + return count; + if (count == 0 && timeout_msec > 0) + return -ETIMEDOUT; + + err = snd_pcm_poll_descriptors_revents(state->handle, + waiter->pfds, waiter->pfd_count, revents); + if (err < 0) + return err; + } else { + count = snd_pcm_wait(state->handle, timeout_msec); + if (count < 0) + return count; + if (count == 0 && timeout_msec > 0) + return -ETIMEDOUT; + + if (snd_pcm_stream(state->handle) == SND_PCM_STREAM_PLAYBACK) + *revents = POLLOUT; + else + *revents = POLLIN; + } + + return 0; +} + +static int configure_hw_params(struct libasound_state *state, + snd_pcm_format_t format, + unsigned int samples_per_frame, + unsigned int frames_per_second, + unsigned int msec_per_period, + unsigned int msec_per_buffer, + snd_pcm_uframes_t frames_per_period, + snd_pcm_uframes_t frames_per_buffer) +{ + int err; + + // Configure sample format. + if (format == SND_PCM_FORMAT_UNKNOWN) { + snd_pcm_format_mask_t *mask; + + err = snd_pcm_format_mask_malloc(&mask); + if (err < 0) + return err; + snd_pcm_hw_params_get_format_mask(state->hw_params, mask); + for (format = 0; format <= SND_PCM_FORMAT_LAST; ++format) { + if (snd_pcm_format_mask_test(mask, format)) + break; + } + snd_pcm_format_mask_free(mask); + if (format > SND_PCM_FORMAT_LAST) { + logging(state, + "Any sample format is not available.\n"); + return -EINVAL; + } + } + err = snd_pcm_hw_params_set_format(state->handle, state->hw_params, + format); + if (err < 0) { + logging(state, + "Sample format '%s' is not available: %s\n", + snd_pcm_format_name(format), snd_strerror(err)); + return err; + } + + // Configure channels. + if (samples_per_frame == 0) { + err = snd_pcm_hw_params_get_channels_min(state->hw_params, + &samples_per_frame); + if (err < 0) { + logging(state, + "Any channel number is not available.\n"); + return err; + } + } + err = snd_pcm_hw_params_set_channels(state->handle, state->hw_params, + samples_per_frame); + if (err < 0) { + logging(state, + "Channels count '%u' is not available: %s\n", + samples_per_frame, snd_strerror(err)); + return err; + } + + // Configure rate. + if (frames_per_second == 0) { + err = snd_pcm_hw_params_get_rate_min(state->hw_params, + &frames_per_second, NULL); + if (err < 0) { + logging(state, + "Any rate is not available.\n"); + return err; + } + + } + err = snd_pcm_hw_params_set_rate(state->handle, state->hw_params, + frames_per_second, 0); + if (err < 0) { + logging(state, + "Sampling rate '%u' is not available: %s\n", + frames_per_second, snd_strerror(err)); + return err; + } + + // Keep one of 'frames_per_buffer' and 'msec_per_buffer'. + if (frames_per_buffer == 0) { + if (msec_per_buffer == 0) { + err = snd_pcm_hw_params_get_buffer_time_max( + state->hw_params, &msec_per_buffer, NULL); + if (err < 0) { + logging(state, + "The maximum msec per buffer is not " + "available.\n"); + return err; + } + if (msec_per_buffer > 500000) + msec_per_buffer = 500000; + } + } else if (msec_per_buffer > 0) { + uint64_t msec; + + msec = 1000000 * frames_per_buffer / frames_per_second; + if (msec < msec_per_buffer) + msec_per_buffer = 0; + } + + // Keep one of 'frames_per_period' and 'msec_per_period'. + if (frames_per_period == 0) { + if (msec_per_period == 0) { + if (msec_per_buffer > 0) + msec_per_period = msec_per_buffer / 4; + else + frames_per_period = frames_per_buffer / 4; + } + } else if (msec_per_period > 0) { + uint64_t msec; + + msec = 1000000 * frames_per_period / frames_per_second; + if (msec < msec_per_period) + msec_per_period = 0; + } + + if (msec_per_period) { + err = snd_pcm_hw_params_set_period_time_near(state->handle, + state->hw_params, &msec_per_period, NULL); + if (err < 0) { + logging(state, + "Fail to configure period time: %u msec\n", + msec_per_period); + return err; + } + } else { + err = snd_pcm_hw_params_set_period_size_near(state->handle, + state->hw_params, &frames_per_period, NULL); + if (err < 0) { + logging(state, + "Fail to configure period size: %lu frames\n", + frames_per_period); + return err; + } + } + + if (msec_per_buffer) { + err = snd_pcm_hw_params_set_buffer_time_near(state->handle, + state->hw_params, &msec_per_buffer, NULL); + if (err < 0) { + logging(state, + "Fail to configure buffer time: %u msec\n", + msec_per_buffer); + return err; + } + } else { + err = snd_pcm_hw_params_set_buffer_size_near(state->handle, + state->hw_params, &frames_per_buffer); + if (err < 0) { + logging(state, + "Fail to configure buffer size: %lu frames\n", + frames_per_buffer); + return err; + } + } + + return snd_pcm_hw_params(state->handle, state->hw_params); +} + +static int retrieve_actual_hw_params(snd_pcm_hw_params_t *hw_params, + snd_pcm_format_t *format, + unsigned int *samples_per_frame, + unsigned int *frames_per_second, + snd_pcm_access_t *access, + snd_pcm_uframes_t *frames_per_buffer) +{ + int err; + + err = snd_pcm_hw_params_get_format(hw_params, format); + if (err < 0) + return err; + + err = snd_pcm_hw_params_get_channels(hw_params, + samples_per_frame); + if (err < 0) + return err; + + err = snd_pcm_hw_params_get_rate(hw_params, frames_per_second, + NULL); + if (err < 0) + return err; + + err = snd_pcm_hw_params_get_access(hw_params, access); + if (err < 0) + return err; + + return snd_pcm_hw_params_get_buffer_size(hw_params, frames_per_buffer); +} + +static int configure_sw_params(struct libasound_state *state, + unsigned int frames_per_second, + unsigned int frames_per_buffer, + unsigned int msec_for_avail_min, + unsigned int msec_for_start_threshold, + unsigned int msec_for_stop_threshold) +{ + snd_pcm_uframes_t frame_count; + int err; + + if (msec_for_avail_min > 0) { + frame_count = msec_for_avail_min * frames_per_second / 1000000; + if (frame_count == 0 || frame_count > frames_per_buffer) { + logging(state, + "The msec for 'avail_min' is too %s: %u " + "msec (%lu frames at %u).\n", + frame_count == 0 ? "small" : "large", + msec_for_avail_min, frame_count, + frames_per_second); + return -EINVAL; + } + err = snd_pcm_sw_params_set_avail_min(state->handle, + state->sw_params, frame_count); + if (err < 0) { + logging(state, + "Fail to configure 'avail-min'.\n"); + return -EINVAL; + } + } + + if (msec_for_start_threshold > 0) { + frame_count = msec_for_start_threshold * frames_per_second / + 1000000; + if (frame_count == 0 || frame_count > frames_per_buffer) { + logging(state, + "The msec for 'start-delay' is too %s: %u " + "msec (%lu frames at %u).\n", + frame_count == 0 ? "small" : "large", + msec_for_start_threshold, frame_count, + frames_per_second); + return -EINVAL; + } + err = snd_pcm_sw_params_set_start_threshold(state->handle, + state->sw_params, frame_count); + if (err < 0) { + logging(state, + "Fail to configure 'start-delay'.\n"); + return -EINVAL; + } + } + + if (msec_for_stop_threshold > 0) { + frame_count = msec_for_stop_threshold * frames_per_second / + 1000000; + if (frame_count == 0 || frame_count > frames_per_buffer) { + logging(state, + "The msec for 'stop-delay' is too %s: %u " + "msec (%lu frames at %u).\n", + frame_count == 0 ? "small" : "large", + msec_for_stop_threshold, frame_count, + frames_per_second); + return -EINVAL; + } + err = snd_pcm_sw_params_set_stop_threshold(state->handle, + state->sw_params, frame_count); + if (err < 0) { + logging(state, + "Fail to configure 'stop-delay'.\n"); + return -EINVAL; + } + } + + return snd_pcm_sw_params(state->handle, state->sw_params); +} + +static int xfer_libasound_pre_process(struct xfer_context *xfer, + snd_pcm_format_t *format, + unsigned int *samples_per_frame, + unsigned int *frames_per_second, + snd_pcm_access_t *access, + snd_pcm_uframes_t *frames_per_buffer) +{ + struct libasound_state *state = xfer->private_data; + unsigned int flag; + int err; + + err = open_handle(xfer); + if (err < 0) + return -ENXIO; + + err = configure_hw_params(state, *format, *samples_per_frame, + *frames_per_second, + state->msec_per_period, + state->msec_per_buffer, + state->frames_per_period, + state->frames_per_buffer); + if (err < 0) { + logging(state, "Current hardware parameters:\n"); + snd_pcm_hw_params_dump(state->hw_params, state->log); + return err; + } + + // Retrieve actual parameters. + err = retrieve_actual_hw_params(state->hw_params, format, + samples_per_frame, frames_per_second, + access, frames_per_buffer); + if (err < 0) + return err; + + // Query software parameters. + err = snd_pcm_sw_params_current(state->handle, state->sw_params); + if (err < 0) + return err; + + // Assign I/O operation. + err = snd_pcm_hw_params_get_period_wakeup(state->handle, + state->hw_params, &flag); + if (err < 0) + return err; + + if (flag) { + if (*access == SND_PCM_ACCESS_RW_INTERLEAVED || + *access == SND_PCM_ACCESS_RW_NONINTERLEAVED) { + state->ops = &xfer_libasound_irq_rw_ops; + } else if (*access == SND_PCM_ACCESS_MMAP_INTERLEAVED || + *access == SND_PCM_ACCESS_MMAP_NONINTERLEAVED) { + if (snd_pcm_stream(state->handle) == SND_PCM_STREAM_CAPTURE) + state->ops = &xfer_libasound_irq_mmap_r_ops; + else + state->ops = &xfer_libasound_irq_mmap_w_ops; + } else { + return -ENXIO; + } + } else { + if (*access == SND_PCM_ACCESS_MMAP_INTERLEAVED || + *access == SND_PCM_ACCESS_MMAP_NONINTERLEAVED) { + if (snd_pcm_stream(state->handle) == SND_PCM_STREAM_CAPTURE) + state->ops = &xfer_libasound_timer_mmap_r_ops; + else + state->ops = &xfer_libasound_timer_mmap_w_ops; + } else { + return -ENXIO; + } + } + + if (state->ops->private_size > 0) { + state->private_data = malloc(state->ops->private_size); + if (state->private_data == NULL) + return -ENOMEM; + memset(state->private_data, 0, state->ops->private_size); + } + + err = state->ops->pre_process(state); + if (err < 0) + return err; + + err = configure_sw_params(state, *frames_per_second, + *frames_per_buffer, + state->msec_for_avail_min, + state->msec_for_start_threshold, + state->msec_for_stop_threshold); + if (err < 0) { + logging(state, "Current software parameters:\n"); + snd_pcm_sw_params_dump(state->sw_params, state->log); + return err; + } + + if (xfer->verbose > 0) { + snd_pcm_dump(state->handle, state->log); + logging(state, "Scheduling model:\n"); + logging(state, " %s\n", sched_model_labels[state->sched_model]); + } + + if (state->use_waiter) { + // NOTE: This should be after configuring sw_params due to + // timer descriptor for time-based scheduling model. + err = prepare_waiter(state); + if (err < 0) + return err; + + if (xfer->verbose > 0) { + logging(state, "Waiter type:\n"); + logging(state, + " %s\n", + waiter_label_from_type(state->waiter_type)); + } + } + + return 0; +} + +static int xfer_libasound_process_frames(struct xfer_context *xfer, + unsigned int *frame_count, + struct mapper_context *mapper, + struct container_context *cntrs) +{ + struct libasound_state *state = xfer->private_data; + int err; + + if (state->handle == NULL) + return -ENXIO; + + err = state->ops->process_frames(state, frame_count, mapper, cntrs); + if (err < 0) { + if (err == -EAGAIN) + return err; + if (err == -EPIPE && !state->finish_at_xrun) { + // Recover the stream and continue processing + // immediately. In this program -EPIPE comes from + // libasound implementation instead of file I/O. + err = snd_pcm_prepare(state->handle); + } + + if (err < 0) { + // TODO: -EIO from libasound for hw PCM node means + // that IRQ disorder. This should be reported to help + // developers for drivers. + logging(state, "Fail to process frames: %s\n", + snd_strerror(err)); + } + } + + return err; +} + +static void xfer_libasound_pause(struct xfer_context *xfer, bool enable) +{ + struct libasound_state *state = xfer->private_data; + snd_pcm_state_t s = snd_pcm_state(state->handle); + int err; + + if (state->handle == NULL) + return; + + if (enable) { + if (s != SND_PCM_STATE_RUNNING) + return; + } else { + if (s != SND_PCM_STATE_PAUSED) + return; + } + + // Not supported. Leave the substream to enter XRUN state. + if (!snd_pcm_hw_params_can_pause(state->hw_params)) + return; + + err = snd_pcm_pause(state->handle, enable); + if (err < 0 && state->verbose) { + logging(state, "snd_pcm_pause(): %s\n", snd_strerror(err)); + } +} + +static void xfer_libasound_post_process(struct xfer_context *xfer) +{ + struct libasound_state *state = xfer->private_data; + snd_pcm_state_t pcm_state; + int err; + + if (state->handle == NULL) + return; + + pcm_state = snd_pcm_state(state->handle); + if (pcm_state != SND_PCM_STATE_OPEN && + pcm_state != SND_PCM_STATE_DISCONNECTED) { + if (snd_pcm_stream(state->handle) == SND_PCM_STREAM_CAPTURE || + state->ops == &xfer_libasound_timer_mmap_w_ops) { + err = snd_pcm_drop(state->handle); + if (err < 0) + logging(state, "snd_pcm_drop(): %s\n", + snd_strerror(err)); + } else { + // TODO: this is a bug in kernel land. + if (state->nonblock) + snd_pcm_nonblock(state->handle, 0); + err = snd_pcm_drain(state->handle); + if (state->nonblock) + snd_pcm_nonblock(state->handle, 1); + if (err < 0) + logging(state, "snd_pcm_drain(): %s\n", + snd_strerror(err)); + } + } + + err = snd_pcm_hw_free(state->handle); + if (err < 0) + logging(state, "snd_pcm_hw_free(): %s\n", snd_strerror(err)); + + snd_pcm_close(state->handle); + state->handle = NULL; + + if (state->ops && state->ops->post_process) + state->ops->post_process(state); + free(state->private_data); + state->private_data = NULL; + + // Free cache of content for configuration files so that memory leaks + // are not detected. + snd_config_update_free_global(); +} + +static void xfer_libasound_destroy(struct xfer_context *xfer) +{ + struct libasound_state *state = xfer->private_data; + + free(state->node_literal); + free(state->waiter_type_literal); + free(state->sched_model_literal); + state->node_literal = NULL; + state->waiter_type_literal = NULL; + state->sched_model_literal = NULL; + + if (state->hw_params) + snd_pcm_hw_params_free(state->hw_params); + if (state->sw_params) + snd_pcm_sw_params_free(state->sw_params); + state->hw_params = NULL; + state->sw_params = NULL; + + if (state->log) + snd_output_close(state->log); + state->log = NULL; +} + +static void xfer_libasound_help(struct xfer_context *xfer) +{ + printf( +" [BASICS]\n" +" -D, --device select node by name in coniguration space\n" +" -N, --nonblock nonblocking mode\n" +" -M, --mmap use mmap(2) for zero copying technique\n" +" -F, --period-time interval between interrupts (msec unit)\n" +" --period-size interval between interrupts (frame unit)\n" +" -B, --buffer-time size of buffer for frame(msec unit)\n" +" --buffer-size size of buffer for frame(frame unit)\n" +" --waiter-type type of waiter to handle available frames\n" +" --sched-model model of process scheduling\n" +" [SOFTWARE FEATURES]\n" +" -A, --avail-min threshold of frames to wake up process\n" +" -R, --start-delay threshold of frames to start PCM substream\n" +" -T, --stop-delay threshold of frames to stop PCM substream\n" +" [LIBASOUND PLUGIN OPTIONS]\n" +" --disable-resample disable rate conversion for plug plugin\n" +" --disable-channels disable channel conversion for plug plugin\n" +" --disable-format disable format conversion for plug plugin\n" +" --disable-softvol disable software volume for sofvol plugin\n" +" [DEBUG ASSISTANT]\n" +" --fatal-errors finish at XRUN\n" +" --test-nowait busy poll without any waiter\n" + ); +} + +const struct xfer_data xfer_libasound = { + .s_opts = S_OPTS, + .l_opts = l_opts, + .l_opts_count = ARRAY_SIZE(l_opts), + .ops = { + .init = xfer_libasound_init, + .parse_opt = xfer_libasound_parse_opt, + .validate_opts = xfer_libasound_validate_opts, + .pre_process = xfer_libasound_pre_process, + .process_frames = xfer_libasound_process_frames, + .pause = xfer_libasound_pause, + .post_process = xfer_libasound_post_process, + .destroy = xfer_libasound_destroy, + .help = xfer_libasound_help, + }, + .private_size = sizeof(struct libasound_state), +}; diff --git a/axfer/xfer-libasound.h b/axfer/xfer-libasound.h new file mode 100644 index 0000000..dfe8577 --- /dev/null +++ b/axfer/xfer-libasound.h @@ -0,0 +1,92 @@ +// SPDX-License-Identifier: GPL-2.0 +// +// xfer-libasound.h - a header for receiver/transmitter of frames by alsa-lib. +// +// Copyright (c) 2018 Takashi Sakamoto +// +// Licensed under the terms of the GNU General Public License, version 2. + +#ifndef __ALSA_UTILS_AXFER_XFER_LIBASOUND__H_ +#define __ALSA_UTILS_AXFER_XFER_LIBASOUND__H_ + +#include "xfer.h" +#include "waiter.h" + +#define logging(state, ...) \ + snd_output_printf(state->log, __VA_ARGS__) + +enum sched_model { + SCHED_MODEL_IRQ = 0, + SCHED_MODEL_TIMER, + SCHED_MODEL_COUNT, +}; + +struct xfer_libasound_ops; + +struct libasound_state { + snd_pcm_t *handle; + + snd_output_t *log; + snd_pcm_hw_params_t *hw_params; + snd_pcm_sw_params_t *sw_params; + + const struct xfer_libasound_ops *ops; + void *private_data; + + bool verbose; + + char *node_literal; + char *waiter_type_literal; + char *sched_model_literal; + + unsigned int msec_per_period; + unsigned int msec_per_buffer; + unsigned int frames_per_period; + unsigned int frames_per_buffer; + + unsigned int msec_for_avail_min; + unsigned int msec_for_start_threshold; + unsigned int msec_for_stop_threshold; + + bool finish_at_xrun:1; + bool nonblock:1; + bool mmap:1; + bool test_nowait:1; + bool no_auto_resample:1; + bool no_auto_channels:1; + bool no_auto_format:1; + bool no_softvol:1; + + bool use_waiter:1; + + enum waiter_type waiter_type; + struct waiter_context *waiter; + + // For scheduling type. + enum sched_model sched_model; +}; + +// For internal use in 'libasound' module. + +struct xfer_libasound_ops { + int (*pre_process)(struct libasound_state *state); + int (*process_frames)(struct libasound_state *state, + unsigned int *frame_count, + struct mapper_context *mapper, + struct container_context *cntrs); + void (*post_process)(struct libasound_state *state); + unsigned int private_size; +}; + +int xfer_libasound_wait_event(struct libasound_state *state, int timeout_msec, + unsigned short *revents); + +extern const struct xfer_libasound_ops xfer_libasound_irq_rw_ops; + +extern const struct xfer_libasound_ops xfer_libasound_irq_mmap_r_ops; +extern const struct xfer_libasound_ops xfer_libasound_irq_mmap_w_ops; + +extern const struct xfer_libasound_ops xfer_libasound_timer_mmap_w_ops; +extern const struct xfer_libasound_ops xfer_libasound_timer_mmap_r_ops; + +#endif diff --git a/axfer/xfer-libffado.c b/axfer/xfer-libffado.c new file mode 100644 index 0000000..6db835d --- /dev/null +++ b/axfer/xfer-libffado.c @@ -0,0 +1,570 @@ +// SPDX-License-Identifier: GPL-2.0 +// +// xfer-libffado.c - receive/transmit frames by libffado. +// +// Copyright (c) 2018 Takashi Sakamoto +// +// Licensed under the terms of the GNU General Public License, version 2. + +#include "xfer.h" +#include "misc.h" + +#include "frame-cache.h" + +#include +#include + +#include + +struct libffado_state { + ffado_device_t *handle; + enum ffado_direction direction; + + char *port_literal; + char *node_literal; + char *guid_literal; + unsigned int frames_per_period; + unsigned int periods_per_buffer; + unsigned int sched_priority; + bool slave_mode:1; + bool snoop_mode:1; + + unsigned int data_ch_count; + ffado_streaming_stream_type *data_ch_map; + + int (*process_frames)(struct xfer_context *xfer, + unsigned int *frame_count, + struct mapper_context *mapper, + struct container_context *cntrs); + + struct frame_cache cache; +}; + +enum no_short_opts { + OPT_FRAMES_PER_PERIOD = 200, + OPT_PERIODS_PER_BUFFER, + OPT_SLAVE_MODE, + OPT_SNOOP_MODE, + OPT_SCHED_PRIORITY, +}; + +#define S_OPTS "p:n:g:" +static const struct option l_opts[] = { + {"port", 1, 0, 'p'}, + {"node", 1, 0, 'n'}, + {"guid", 1, 0, 'g'}, + {"frames-per-period", 1, 0, OPT_FRAMES_PER_PERIOD}, + {"periods-per-buffer", 1, 0, OPT_PERIODS_PER_BUFFER}, + {"slave", 0, 0, OPT_SLAVE_MODE}, + {"snoop", 0, 0, OPT_SNOOP_MODE}, + {"sched-priority", 1, 0, OPT_SCHED_PRIORITY}, // to SCHED_FIFO +}; + +static int xfer_libffado_init(struct xfer_context *xfer, + snd_pcm_stream_t direction) +{ + struct libffado_state *state = xfer->private_data; + + if (direction == SND_PCM_STREAM_CAPTURE) + state->direction = FFADO_CAPTURE; + else if (direction == SND_PCM_STREAM_PLAYBACK) + state->direction = FFADO_PLAYBACK; + else + return -EINVAL; + + return 0; +} + +static int xfer_libffado_parse_opt(struct xfer_context *xfer, int key, + const char *optarg) +{ + struct libffado_state *state = xfer->private_data; + int err; + + if (key == 'p') + state->port_literal = arg_duplicate_string(optarg, &err); + else if (key == 'n') + state->node_literal = arg_duplicate_string(optarg, &err); + else if (key == 'g') + state->guid_literal = arg_duplicate_string(optarg, &err); + else if (key == OPT_FRAMES_PER_PERIOD) + state->frames_per_period = arg_parse_decimal_num(optarg, &err); + else if (key == OPT_PERIODS_PER_BUFFER) + state->periods_per_buffer = arg_parse_decimal_num(optarg, &err); + else if (key == OPT_SLAVE_MODE) + state->slave_mode = true; + else if (key == OPT_SNOOP_MODE) + state->snoop_mode = true; + else if (key == OPT_SCHED_PRIORITY) + state->sched_priority = arg_parse_decimal_num(optarg, &err); + else + err = -ENXIO; + + return err; +} + +static int validate_sched_priority(struct libffado_state *state) +{ + int val; + + val = sched_get_priority_max(SCHED_FIFO); + if (val < 0) + return -errno; + if (state->sched_priority > val) + return -EINVAL; + + val = sched_get_priority_min(SCHED_FIFO); + if (val < 0) + return -errno; + if (state->sched_priority < val) + return -EINVAL; + + return 0; +} + +static int xfer_libffado_validate_opts(struct xfer_context *xfer) +{ + struct libffado_state *state = xfer->private_data; + int err; + + if (state->node_literal != NULL) { + if (state->port_literal == NULL) { + fprintf(stderr, + "'n' option should correspond 'p' option.\n"); + return -EINVAL; + } + } + + if (state->port_literal != NULL && state->guid_literal != NULL) { + fprintf(stderr, + "Neither 'p' option nor 'g' option is available at the " + "same time.\n"); + return -EINVAL; + } + + if (state->guid_literal != NULL) { + if (strstr(state->guid_literal, "0x") != state->guid_literal) { + fprintf(stderr, + "A value of 'g' option should have '0x' as its " + "prefix for hexadecimal number.\n"); + return -EINVAL; + } + } + + if (state->slave_mode && state->snoop_mode) { + fprintf(stderr, "Neither slave mode nor snoop mode is available" + "at the same time.\n"); + return -EINVAL; + } + + if (state->sched_priority > 0) { + err = validate_sched_priority(state); + if (err < 0) + return err; + } + + if (state->frames_per_period == 0) + state->frames_per_period = 512; + if (state->periods_per_buffer == 0) + state->periods_per_buffer = 2; + + return 0; +} + +static int r_process_frames(struct xfer_context *xfer, + unsigned int *frame_count, + struct mapper_context *mapper, + struct container_context *cntrs) +{ + struct libffado_state *state = xfer->private_data; + unsigned int avail_count; + unsigned int bytes_per_frame; + unsigned int consumed_count; + int err; + + // Trim up to expected frame count. + avail_count = state->frames_per_period; + if (*frame_count < avail_count) + avail_count = *frame_count; + + // Cache required amount of frames. + if (avail_count > frame_cache_get_count(&state->cache)) { + int ch; + int pos; + + // Register buffers. + pos = 0; + bytes_per_frame = state->cache.bytes_per_sample * + state->cache.samples_per_frame; + for (ch = 0; ch < state->data_ch_count; ++ch) { + char *buf; + + if (state->data_ch_map[ch] != ffado_stream_type_audio) + continue; + + buf = state->cache.buf_ptr; + buf += ch * bytes_per_frame; + if (ffado_streaming_set_capture_stream_buffer(state->handle, + ch, buf)) + return -EIO; + ++pos; + } + + assert(pos == xfer->samples_per_frame); + + // Move data to the buffer from intermediate buffer. + if (!ffado_streaming_transfer_buffers(state->handle)) + return -EIO; + + frame_cache_increase_count(&state->cache, + state->frames_per_period); + } + + // Write out to file descriptors. + consumed_count = frame_cache_get_count(&state->cache); + err = mapper_context_process_frames(mapper, state->cache.buf, + &consumed_count, cntrs); + if (err < 0) + return err; + + frame_cache_reduce(&state->cache, consumed_count); + + *frame_count = consumed_count; + + return 0; +} + +static int w_process_frames(struct xfer_context *xfer, + unsigned int *frame_count, + struct mapper_context *mapper, + struct container_context *cntrs) +{ + struct libffado_state *state = xfer->private_data; + unsigned int avail_count; + int pos; + int ch; + unsigned int bytes_per_frame; + unsigned int consumed_count; + int err; + + // Trim up to expected frame_count. + avail_count = state->frames_per_period; + if (*frame_count < avail_count) + avail_count = *frame_count; + + // Cache required amount of frames. + if (avail_count > frame_cache_get_count(&state->cache)) { + avail_count -= frame_cache_get_count(&state->cache); + + err = mapper_context_process_frames(mapper, state->cache.buf_ptr, + &avail_count, cntrs); + if (err < 0) + return err; + frame_cache_increase_count(&state->cache, avail_count); + avail_count = state->cache.remained_count; + } + + // Register buffers. + pos = 0; + bytes_per_frame = state->cache.bytes_per_sample * + state->cache.samples_per_frame; + for (ch = 0; ch < state->data_ch_count; ++ch) { + char *buf; + + if (state->data_ch_map[ch] != ffado_stream_type_audio) + continue; + + buf = state->cache.buf; + buf += bytes_per_frame; + if (ffado_streaming_set_playback_stream_buffer(state->handle, + ch, buf)) + return -EIO; + ++pos; + } + + assert(pos == xfer->samples_per_frame); + + // Move data on the buffer for transmission. + if (!ffado_streaming_transfer_buffers(state->handle)) + return -EIO; + consumed_count = state->frames_per_period; + + frame_cache_reduce(&state->cache, consumed_count); + + *frame_count = consumed_count; + + return 0; +} + +static int open_handle(struct xfer_context *xfer, + unsigned int frames_per_second) +{ + struct libffado_state *state = xfer->private_data; + ffado_options_t options = {0}; + ffado_device_info_t info = {0}; + + char str[32] = {0}; + char *strings[1]; + + // Set target unit if given. + if (state->port_literal != NULL) { + if (state->node_literal != NULL) { + snprintf(str, sizeof(str), "hw:%s,%s", + state->port_literal, state->node_literal); + } else { + snprintf(str, sizeof(str), "hw:%s", + state->port_literal); + } + } else if (state->guid_literal != NULL) { + snprintf(str, sizeof(str), "guid:%s", state->guid_literal); + } + if (str[0] != '\0') { + info.nb_device_spec_strings = 1; + strings[0] = str; + info.device_spec_strings = strings; + } + + // Set common options. + options.sample_rate = frames_per_second; + options.period_size = state->frames_per_period; + options.nb_buffers = state->periods_per_buffer; + options.realtime = !!(state->sched_priority > 0); + options.packetizer_priority = state->sched_priority; + options.slave_mode = state->slave_mode; + options.snoop_mode = state->snoop_mode; + options.verbose = xfer->verbose; + + state->handle = ffado_streaming_init(info, options); + if (state->handle == NULL) + return -EINVAL; + + return 0; +} + +static int enable_mbla_data_ch(struct libffado_state *state, + unsigned int *samples_per_frame) +{ + int (*func_type)(ffado_device_t *handle, int pos); + int (*func_onoff)(ffado_device_t *handle, int pos, int on); + int count; + int ch; + + if (state->direction == FFADO_CAPTURE) { + func_type = ffado_streaming_get_capture_stream_type; + func_onoff = ffado_streaming_capture_stream_onoff; + count = ffado_streaming_get_nb_capture_streams(state->handle); + } else { + func_type = ffado_streaming_get_playback_stream_type; + func_onoff = ffado_streaming_playback_stream_onoff; + count = ffado_streaming_get_nb_playback_streams(state->handle); + } + if (count <= 0) + return -EIO; + + state->data_ch_map = calloc(count, sizeof(*state->data_ch_map)); + if (state->data_ch_map == NULL) + return -ENOMEM; + state->data_ch_count = count; + + // When a data ch is off, data in the ch is truncated. This helps to + // align PCM frames in interleaved order. + *samples_per_frame = 0; + for (ch = 0; ch < count; ++ch) { + int on; + + state->data_ch_map[ch] = func_type(state->handle, ch); + + on = !!(state->data_ch_map[ch] == ffado_stream_type_audio); + if (func_onoff(state->handle, ch, on)) + return -EIO; + if (on) + ++(*samples_per_frame); + } + + return 0; +} + +static int xfer_libffado_pre_process(struct xfer_context *xfer, + snd_pcm_format_t *format, + unsigned int *samples_per_frame, + unsigned int *frames_per_second, + snd_pcm_access_t *access, + snd_pcm_uframes_t *frames_per_buffer) +{ + struct libffado_state *state = xfer->private_data; + unsigned int channels; + int err; + + // Supported format of sample is 24 bit multi bit linear audio in + // AM824 format or the others. + if (state->direction == FFADO_CAPTURE) { + if (*format == SND_PCM_FORMAT_UNKNOWN) + *format = SND_PCM_FORMAT_S24; + } + if (*format != SND_PCM_FORMAT_S24) { + fprintf(stderr, + "A libffado backend supports S24 only.\n"); + return -EINVAL; + } + + // The backend requires the number of frames per second for its + // initialization. + if (state->direction == FFADO_CAPTURE) { + if (*frames_per_second == 0) + *frames_per_second = 48000; + } + if (*frames_per_second < 32000 || *frames_per_second > 192000) { + fprintf(stderr, + "A libffado backend supports sampling rate between " + "32000 and 192000, discretely.\n"); + return -EINVAL; + } + + err = open_handle(xfer, *frames_per_second); + if (err < 0) + return err; + + if (ffado_streaming_set_audio_datatype(state->handle, + ffado_audio_datatype_int24)) + return -EINVAL; + + // Decide buffer layout. + err = enable_mbla_data_ch(state, &channels); + if (err < 0) + return err; + + // This backend doesn't support resampling. + if (state->direction == FFADO_CAPTURE) { + if (*samples_per_frame == 0) + *samples_per_frame = channels; + } + if (*samples_per_frame != channels) { + fprintf(stderr, + "The number of samples per frame should be %u.\n", + channels); + return -EINVAL; + } + + // A buffer has interleaved-aligned PCM frames. + *access = SND_PCM_ACCESS_RW_INTERLEAVED; + *frames_per_buffer = + state->frames_per_period * state->periods_per_buffer; + + // Use cache for double number of frames per period. + err = frame_cache_init(&state->cache, *access, + snd_pcm_format_physical_width(*format) / 8, + *samples_per_frame, state->frames_per_period * 2); + if (err < 0) + return err; + + if (state->direction == FFADO_CAPTURE) + state->process_frames = r_process_frames; + else + state->process_frames = w_process_frames; + + if (ffado_streaming_prepare(state->handle)) + return -EIO; + + if (ffado_streaming_start(state->handle)) + return -EIO; + + return 0; +} + +static int xfer_libffado_process_frames(struct xfer_context *xfer, + unsigned int *frame_count, + struct mapper_context *mapper, + struct container_context *cntrs) +{ + struct libffado_state *state = xfer->private_data; + ffado_wait_response res; + int err; + + res = ffado_streaming_wait(state->handle); + if (res == ffado_wait_shutdown || res == ffado_wait_error) { + err = -EIO; + } else if (res == ffado_wait_xrun) { + // No way to recover in this backend. + err = -EPIPE; + } else if (res == ffado_wait_ok) { + err = state->process_frames(xfer, frame_count, mapper, cntrs); + } else { + err = -ENXIO; + } + + if (err < 0) + *frame_count = 0; + + return err; +} + +static void xfer_libffado_pause(struct xfer_context *xfer, bool enable) +{ + struct libffado_state *state = xfer->private_data; + + // This is an emergency avoidance because this backend doesn't support + // suspend/aresume operation. + if (enable) { + ffado_streaming_stop(state->handle); + ffado_streaming_finish(state->handle); + exit(EXIT_FAILURE); + } +} + +static void xfer_libffado_post_process(struct xfer_context *xfer) +{ + struct libffado_state *state = xfer->private_data; + + if (state->handle != NULL) { + ffado_streaming_stop(state->handle); + ffado_streaming_finish(state->handle); + } + + frame_cache_destroy(&state->cache); + free(state->data_ch_map); + state->data_ch_map = NULL; +} + +static void xfer_libffado_destroy(struct xfer_context *xfer) +{ + struct libffado_state *state = xfer->private_data; + + free(state->port_literal); + free(state->node_literal); + free(state->guid_literal); + state->port_literal = NULL; + state->node_literal = NULL; + state->guid_literal = NULL; +} + +static void xfer_libffado_help(struct xfer_context *xfer) +{ + printf( +" -p, --port decimal ID of port to decide 1394 OHCI controller for communication on IEEE 1394 bus\n" +" -n, --node decimal ID of node to decide unit on IEEE 1394 bus for transmission of audio data frame\n" +" -g, --guid hexadecimal ID for node on IEEE 1394 bus for transmission of audio data frame\n" +" --frames-per-period the number of audio data frame to handle one operation (frame unit)\n" +" --periods-per-bufer the number of periods in intermediate buffer between libffado (frame unit)\n" +" --slave receive frames from the other Linux system on IEEE 1394 bus running with libffado.\n" +" --snoop receive frames on packets of all isochronous channels.\n" +" --sched-priority set SCHED_FIFO with given priority. see RLIMIT_RTPRIO in getrlimit(2).\n" + ); +} + +const struct xfer_data xfer_libffado = { + .s_opts = S_OPTS, + .l_opts = l_opts, + .l_opts_count = ARRAY_SIZE(l_opts), + .ops = { + .init = xfer_libffado_init, + .parse_opt = xfer_libffado_parse_opt, + .validate_opts = xfer_libffado_validate_opts, + .pre_process = xfer_libffado_pre_process, + .process_frames = xfer_libffado_process_frames, + .pause = xfer_libffado_pause, + .post_process = xfer_libffado_post_process, + .destroy = xfer_libffado_destroy, + .help = xfer_libffado_help, + }, + .private_size = sizeof(struct libffado_state), +}; diff --git a/axfer/xfer-options.c b/axfer/xfer-options.c new file mode 100644 index 0000000..3740b16 --- /dev/null +++ b/axfer/xfer-options.c @@ -0,0 +1,627 @@ +// SPDX-License-Identifier: GPL-2.0 +// +// xfer-options.c - a parser of commandline options for xfer. +// +// Copyright (c) 2018 Takashi Sakamoto +// +// Licensed under the terms of the GNU General Public License, version 2. + +#include "xfer.h" +#include "misc.h" + +#include +#include +#include + +enum no_short_opts { + // 128 or later belong to non us-ascii character set. + OPT_XFER_TYPE = 128, + OPT_DUMP_HW_PARAMS, + OPT_PERIOD_SIZE, + OPT_BUFFER_SIZE, + // Obsoleted. + OPT_MAX_FILE_TIME, + OPT_USE_STRFTIME, + OPT_PROCESS_ID_FILE, +}; + +static void print_help() +{ + printf( +"Usage:\n" +" axfer transfer DIRECTION [ COMMON-OPTIONS ] [ BACKEND-OPTIONS ]\n" +"\n" +" where:\n" +" DIRECTION = capture | playback\n" +" COMMON-OPTIONS =\n" +" -h, --help help\n" +" -v, --verbose verbose\n" +" -q, --quiet quiet mode\n" +" -d, --duration=# interrupt after # seconds\n" +" -s, --samples=# interrupt after # frames\n" +" -f, --format=FORMAT sample format (case-insensitive)\n" +" -c, --channels=# channels\n" +" -r, --rate=# numeric sample rate in unit of Hz or kHz\n" +" -t, --file-type=TYPE file type (wav, au, sparc, voc or raw, case-insentive)\n" +" -I, --separate-channels one file for each channel\n" +" --dump-hw-params dump hw_params of the device\n" +" --xfer-type=BACKEND backend type (libasound, libffado)\n" + ); +} + +static int allocate_paths(struct xfer_context *xfer, char *const *paths, + unsigned int count) +{ + bool stdio = false; + int i; + + if (count == 0) { + stdio = true; + count = 1; + } + + xfer->paths = calloc(count, sizeof(xfer->paths[0])); + if (xfer->paths == NULL) + return -ENOMEM; + xfer->path_count = count; + + if (stdio) { + xfer->paths[0] = strndup("-", PATH_MAX); + if (xfer->paths[0] == NULL) + return -ENOMEM; + } else { + for (i = 0; i < count; ++i) { + xfer->paths[i] = strndup(paths[i], PATH_MAX); + if (xfer->paths[i] == NULL) + return -ENOMEM; + } + } + + return 0; +} + +static int verify_cntr_format(struct xfer_context *xfer) +{ + static const struct { + const char *const literal; + enum container_format cntr_format; + } *entry, entries[] = { + {"raw", CONTAINER_FORMAT_RAW}, + {"voc", CONTAINER_FORMAT_VOC}, + {"wav", CONTAINER_FORMAT_RIFF_WAVE}, + {"au", CONTAINER_FORMAT_AU}, + {"sparc", CONTAINER_FORMAT_AU}, + }; + int i; + + for (i = 0; i < ARRAY_SIZE(entries); ++i) { + entry = &entries[i]; + if (strcasecmp(xfer->cntr_format_literal, entry->literal)) + continue; + + xfer->cntr_format = entry->cntr_format; + return 0; + } + + fprintf(stderr, "unrecognized file format '%s'\n", + xfer->cntr_format_literal); + + return -EINVAL; +} + +// This should be called after 'verify_cntr_format()'. +static int verify_sample_format(struct xfer_context *xfer) +{ + static const struct { + const char *const literal; + unsigned int frames_per_second; + unsigned int samples_per_frame; + snd_pcm_format_t le_format; + snd_pcm_format_t be_format; + } *entry, entries[] = { + {"cd", 44100, 2, SND_PCM_FORMAT_S16_LE, SND_PCM_FORMAT_S16_BE}, + {"cdr", 44100, 2, SND_PCM_FORMAT_S16_LE, SND_PCM_FORMAT_S16_BE}, + {"dat", 48000, 2, SND_PCM_FORMAT_S16_LE, SND_PCM_FORMAT_S16_BE}, + }; + int i; + + xfer->sample_format = snd_pcm_format_value(xfer->sample_format_literal); + if (xfer->sample_format != SND_PCM_FORMAT_UNKNOWN) + return 0; + + for (i = 0; i < ARRAY_SIZE(entries); ++i) { + entry = &entries[i]; + if (strcmp(entry->literal, xfer->sample_format_literal)) + continue; + + if (xfer->frames_per_second > 0 && + xfer->frames_per_second != entry->frames_per_second) { + fprintf(stderr, + "'%s' format can't be used with rate except " + "for %u.\n", + entry->literal, entry->frames_per_second); + return -EINVAL; + } + + if (xfer->samples_per_frame > 0 && + xfer->samples_per_frame != entry->samples_per_frame) { + fprintf(stderr, + "'%s' format can't be used with channel except " + "for %u.\n", + entry->literal, entry->samples_per_frame); + return -EINVAL; + } + + xfer->frames_per_second = entry->frames_per_second; + xfer->samples_per_frame = entry->samples_per_frame; + if (xfer->cntr_format == CONTAINER_FORMAT_AU) + xfer->sample_format = entry->be_format; + else + xfer->sample_format = entry->le_format; + + return 0; + } + + fprintf(stderr, "wrong extended format '%s'\n", + xfer->sample_format_literal); + + return -EINVAL; +} + +static int validate_options(struct xfer_context *xfer) +{ + unsigned int val; + int err = 0; + + if (xfer->cntr_format_literal == NULL) { + if (xfer->direction == SND_PCM_STREAM_CAPTURE) { + // To stdout. + if (xfer->path_count == 1 && + !strcmp(xfer->paths[0], "-")) { + xfer->cntr_format = CONTAINER_FORMAT_RAW; + } else { + // Use first path as a representative. + xfer->cntr_format = container_format_from_path( + xfer->paths[0]); + } + } + // For playback, perform auto-detection. + } else { + err = verify_cntr_format(xfer); + } + if (err < 0) + return err; + + if (xfer->multiple_cntrs) { + if (!strcmp(xfer->paths[0], "-")) { + fprintf(stderr, + "An option for separated channels is not " + "available with stdin/stdout.\n"); + return -EINVAL; + } + + // For captured PCM frames, even if one path is given for + // container files, it can be used to generate several paths. + // For this purpose, please see + // 'xfer_options_fixup_paths()'. + if (xfer->direction == SND_PCM_STREAM_PLAYBACK) { + // Require several paths for containers. + if (xfer->path_count == 1) { + fprintf(stderr, + "An option for separated channels " + "requires several files to playback " + "PCM frames.\n"); + return -EINVAL; + } + } + } else { + // A single path is available only. + if (xfer->path_count > 1) { + fprintf(stderr, + "When using several files, an option for " + "sepatated channels is used with.\n"); + return -EINVAL; + } + } + + xfer->sample_format = SND_PCM_FORMAT_UNKNOWN; + if (xfer->sample_format_literal) { + err = verify_sample_format(xfer); + if (err < 0) + return err; + } + + val = xfer->frames_per_second; + if (xfer->frames_per_second == 0) + xfer->frames_per_second = 8000; + if (xfer->frames_per_second < 1000) + xfer->frames_per_second *= 1000; + if (xfer->frames_per_second < 2000 || + xfer->frames_per_second > 192000) { + fprintf(stderr, "bad speed value '%u'\n", val); + return -EINVAL; + } + + if (xfer->samples_per_frame > 0) { + if (xfer->samples_per_frame < 1 || + xfer->samples_per_frame > 256) { + fprintf(stderr, "invalid channels argument '%u'\n", + xfer->samples_per_frame); + return -EINVAL; + } + } + + return err; +} + +int xfer_options_parse_args(struct xfer_context *xfer, + const struct xfer_data *data, int argc, + char *const *argv) +{ + static const char *short_opts = "CPhvqd:s:f:c:r:t:IV:i"; + static const struct option long_opts[] = { + // For generic purposes. + {"capture", 0, 0, 'C'}, + {"playback", 0, 0, 'P'}, + {"xfer-type", 1, 0, OPT_XFER_TYPE}, + {"help", 0, 0, 'h'}, + {"verbose", 0, 0, 'v'}, + {"quiet", 0, 0, 'q'}, + {"duration", 1, 0, 'd'}, + {"samples", 1, 0, 's'}, + // For transfer backend. + {"format", 1, 0, 'f'}, + {"channels", 1, 0, 'c'}, + {"rate", 1, 0, 'r'}, + // For containers. + {"file-type", 1, 0, 't'}, + // For mapper. + {"separate-channels", 0, 0, 'I'}, + // For debugging. + {"dump-hw-params", 0, 0, OPT_DUMP_HW_PARAMS}, + // Obsoleted. + {"max-file-time", 1, 0, OPT_MAX_FILE_TIME}, + {"use-strftime", 0, 0, OPT_USE_STRFTIME}, + {"process-id-file", 1, 0, OPT_PROCESS_ID_FILE}, + {"vumeter", 1, 0, 'V'}, + {"interactive", 0, 0, 'i'}, + }; + char *s_opts; + struct option *l_opts; + int l_index; + int key; + int err = 0; + + // Concatenate short options. + s_opts = malloc(strlen(data->s_opts) + strlen(short_opts) + 1); + if (s_opts == NULL) + return -ENOMEM; + strcpy(s_opts, data->s_opts); + strcpy(s_opts + strlen(s_opts), short_opts); + s_opts[strlen(data->s_opts) + strlen(short_opts)] = '\0'; + + // Concatenate long options, including a sentinel. + l_opts = calloc(ARRAY_SIZE(long_opts) * data->l_opts_count + 1, + sizeof(*l_opts)); + if (l_opts == NULL) { + free(s_opts); + return -ENOMEM; + } + memcpy(l_opts, long_opts, ARRAY_SIZE(long_opts) * sizeof(*l_opts)); + memcpy(&l_opts[ARRAY_SIZE(long_opts)], data->l_opts, + data->l_opts_count * sizeof(*l_opts)); + + // Parse options. + l_index = 0; + optarg = NULL; + optind = 1; + opterr = 1; // use error output. + optopt = 0; + while (1) { + key = getopt_long(argc, argv, s_opts, l_opts, &l_index); + if (key < 0) + break; + else if (key == 'C') + ; // already parsed. + else if (key == 'P') + ; // already parsed. + else if (key == OPT_XFER_TYPE) + ; // already parsed. + else if (key == 'h') + xfer->help = true; + else if (key == 'v') + ++xfer->verbose; + else if (key == 'q') + xfer->quiet = true; + else if (key == 'd') + xfer->duration_seconds = arg_parse_decimal_num(optarg, &err); + else if (key == 's') + xfer->duration_frames = arg_parse_decimal_num(optarg, &err); + else if (key == 'f') + xfer->sample_format_literal = arg_duplicate_string(optarg, &err); + else if (key == 'c') + xfer->samples_per_frame = arg_parse_decimal_num(optarg, &err); + else if (key == 'r') + xfer->frames_per_second = arg_parse_decimal_num(optarg, &err); + else if (key == 't') + xfer->cntr_format_literal = arg_duplicate_string(optarg, &err); + else if (key == 'I') + xfer->multiple_cntrs = true; + else if (key == OPT_DUMP_HW_PARAMS) + xfer->dump_hw_params = true; + else if (key == '?') { + free(l_opts); + free(s_opts); + return -EINVAL; + } + else if (key == OPT_MAX_FILE_TIME || + key == OPT_USE_STRFTIME || + key == OPT_PROCESS_ID_FILE || + key == 'V' || + key == 'i') { + fprintf(stderr, + "An option '--%s' is obsoleted and has no " + "effect.\n", + l_opts[l_index].name); + err = -EINVAL; + } else { + err = xfer->ops->parse_opt(xfer, key, optarg); + if (err < 0 && err != -ENXIO) + break; + } + } + + free(l_opts); + free(s_opts); + + if (xfer->help) { + print_help(); + if (xfer->ops->help) { + printf("\n"); + printf(" BACKEND-OPTIONS (%s) =\n", + xfer_label_from_type(xfer->type)); + xfer->ops->help(xfer); + } + return 0; + } + + err = allocate_paths(xfer, argv + optind, argc - optind); + if (err < 0) + return err; + + return validate_options(xfer); +} + +void xfer_options_calculate_duration(struct xfer_context *xfer, + uint64_t *total_frame_count) +{ + uint64_t frame_count; + + if (xfer->duration_seconds > 0) { + frame_count = (uint64_t)xfer->duration_seconds * (uint64_t)xfer->frames_per_second; + if (frame_count < *total_frame_count) + *total_frame_count = frame_count; + } + + if (xfer->duration_frames > 0) { + frame_count = xfer->duration_frames; + if (frame_count < *total_frame_count) + *total_frame_count = frame_count; + } +} + +static const char *const allowed_duplication[] = { + "/dev/null", + "/dev/zero", + "/dev/full", + "/dev/random", + "/dev/urandom", +}; + +static int generate_path_with_suffix(struct xfer_context *xfer, + const char *template, unsigned int index, + const char *suffix) +{ + static const char *const single_format = "%s%s"; + static const char *const multiple_format = "%s-%i%s"; + unsigned int len; + + len = strlen(template) + strlen(suffix) + 1; + if (xfer->path_count > 1) + len += (unsigned int)log10(xfer->path_count) + 2; + + xfer->paths[index] = malloc(len); + if (xfer->paths[index] == NULL) + return -ENOMEM; + + if (xfer->path_count == 1) { + snprintf(xfer->paths[index], len, single_format, template, + suffix); + } else { + snprintf(xfer->paths[index], len, multiple_format, template, + index, suffix); + } + + return 0; +} + +static int generate_path_without_suffix(struct xfer_context *xfer, + const char *template, + unsigned int index, const char *suffix) +{ + static const char *const single_format = "%s"; + static const char *const multiple_format = "%s-%i"; + unsigned int len; + + len = strlen(template) + 1; + if (xfer->path_count > 1) + len += (unsigned int)log10(xfer->path_count) + 2; + + xfer->paths[index] = malloc(len); + if (xfer->paths[index] == NULL) + return -ENOMEM; + + if (xfer->path_count == 1) { + snprintf(xfer->paths[index], len, single_format, template); + } else { + snprintf(xfer->paths[index], len, multiple_format, template, + index); + } + + return 0; +} + +static int generate_path(struct xfer_context *xfer, char *template, + unsigned int index, const char *suffix) +{ + int (*generator)(struct xfer_context *xfer, const char *template, + unsigned int index, const char *suffix); + char *pos; + + if (strlen(suffix) > 0) { + pos = template + strlen(template) - strlen(suffix); + // Separate filename and suffix. + if (!strcmp(pos, suffix)) + *pos = '\0'; + } + + // Select handlers. + if (strlen(suffix) > 0) + generator = generate_path_with_suffix; + else + generator = generate_path_without_suffix; + + return generator(xfer, template, index, suffix); +} + +static int create_paths(struct xfer_context *xfer, unsigned int path_count) +{ + char *template; + const char *suffix; + int i, j; + int err = 0; + + // Can cause memory leak. + assert(xfer->path_count == 1); + assert(xfer->paths); + assert(xfer->paths[0]); + assert(xfer->paths[0][0] != '\0'); + + // Release at first. + template = xfer->paths[0]; + free(xfer->paths); + xfer->paths = NULL; + + // Allocate again. + xfer->paths = calloc(path_count, sizeof(*xfer->paths)); + if (xfer->paths == NULL) { + err = -ENOMEM; + goto end; + } + xfer->path_count = path_count; + + suffix = container_suffix_from_format(xfer->cntr_format); + + for (i = 0; i < xfer->path_count; ++i) { + // Some file names are allowed to be duplicated. + for (j = 0; j < ARRAY_SIZE(allowed_duplication); ++j) { + if (!strcmp(template, allowed_duplication[j])) + break; + } + if (j < ARRAY_SIZE(allowed_duplication)) + continue; + + err = generate_path(xfer, template, i, suffix); + if (err < 0) + break; + } +end: + free(template); + + return err; +} + +static int fixup_paths(struct xfer_context *xfer) +{ + const char *suffix; + char *template; + int i, j; + int err = 0; + + suffix = container_suffix_from_format(xfer->cntr_format); + + for (i = 0; i < xfer->path_count; ++i) { + // Some file names are allowed to be duplicated. + for (j = 0; j < ARRAY_SIZE(allowed_duplication); ++j) { + if (!strcmp(xfer->paths[i], allowed_duplication[j])) + break; + } + if (j < ARRAY_SIZE(allowed_duplication)) + continue; + + template = xfer->paths[i]; + xfer->paths[i] = NULL; + err = generate_path(xfer, template, i, suffix); + free(template); + if (err < 0) + break; + } + + return err; +} + +int xfer_options_fixup_paths(struct xfer_context *xfer) +{ + int i, j; + int err; + + if (xfer->path_count == 1) { + // Nothing to do for sign of stdin/stdout. + if (!strcmp(xfer->paths[0], "-")) + return 0; + if (!xfer->multiple_cntrs) + err = fixup_paths(xfer); + else + err = create_paths(xfer, xfer->samples_per_frame); + } else { + if (!xfer->multiple_cntrs) + return -EINVAL; + if (xfer->path_count != xfer->samples_per_frame) + return -EINVAL; + else + err = fixup_paths(xfer); + } + if (err < 0) + return err; + + // Check duplication of the paths. + for (i = 0; i < xfer->path_count - 1; ++i) { + // Some file names are allowed to be duplicated. + for (j = 0; j < ARRAY_SIZE(allowed_duplication); ++j) { + if (!strcmp(xfer->paths[i], allowed_duplication[j])) + break; + } + if (j < ARRAY_SIZE(allowed_duplication)) + continue; + + for (j = i + 1; j < xfer->path_count; ++j) { + if (!strcmp(xfer->paths[i], xfer->paths[j])) { + fprintf(stderr, + "Detect duplicated file names:\n"); + err = -EINVAL; + break; + } + } + if (j < xfer->path_count) + break; + } + + if (xfer->verbose > 1) + fprintf(stderr, "Handled file names:\n"); + if (err < 0 || xfer->verbose > 1) { + for (i = 0; i < xfer->path_count; ++i) + fprintf(stderr, " %d: %s\n", i, xfer->paths[i]); + } + + return err; +} diff --git a/axfer/xfer.c b/axfer/xfer.c new file mode 100644 index 0000000..6682b3b --- /dev/null +++ b/axfer/xfer.c @@ -0,0 +1,259 @@ +// SPDX-License-Identifier: GPL-2.0 +// +// xfer.c - receiver/transmiter of data frames. +// +// Copyright (c) 2018 Takashi Sakamoto +// +// Licensed under the terms of the GNU General Public License, version 2. + +#include "xfer.h" +#include "misc.h" + +#include + +static const char *const xfer_type_labels[] = { + [XFER_TYPE_LIBASOUND] = "libasound", +#if WITH_FFADO + [XFER_TYPE_LIBFFADO] = "libffado", +#endif +}; + +enum xfer_type xfer_type_from_label(const char *label) +{ + int i; + + for (i = 0; i < ARRAY_SIZE(xfer_type_labels); ++i) { + if (!strcmp(xfer_type_labels[i], label)) + return i; + } + + return XFER_TYPE_UNSUPPORTED; +} + +const char *xfer_label_from_type(enum xfer_type type) +{ + return xfer_type_labels[type]; +} + +int xfer_context_init(struct xfer_context *xfer, enum xfer_type type, + snd_pcm_stream_t direction, int argc, char *const *argv) +{ + struct { + enum xfer_type type; + const struct xfer_data *data; + } *entry, entries[] = { + {XFER_TYPE_LIBASOUND, &xfer_libasound}, +#if WITH_FFADO + {XFER_TYPE_LIBFFADO, &xfer_libffado}, +#endif + }; + int i; + int err; + + assert(xfer); + assert(direction >= SND_PCM_STREAM_PLAYBACK); + assert(direction <= SND_PCM_STREAM_CAPTURE); + + for (i = 0; i < ARRAY_SIZE(entries); ++i) { + if (entries[i].type == type) + break; + } + if (i == ARRAY_SIZE(entries)) + return -EINVAL; + entry = &entries[i]; + + xfer->direction = direction; + xfer->type = type; + xfer->ops = &entry->data->ops; + + xfer->private_data = malloc(entry->data->private_size); + if (xfer->private_data == NULL) + return -ENOMEM; + memset(xfer->private_data, 0, entry->data->private_size); + + err = xfer->ops->init(xfer, direction); + if (err < 0) + return err; + + err = xfer_options_parse_args(xfer, entry->data, argc, argv); + if (err < 0) + return err; + + return xfer->ops->validate_opts(xfer); +} + +void xfer_context_destroy(struct xfer_context *xfer) +{ + int i; + + assert(xfer); + + if (!xfer->ops) + return; + + if (xfer->ops->destroy) + xfer->ops->destroy(xfer); + if (xfer->private_data) + free(xfer->private_data); + + if (xfer->paths) { + for (i = 0; i < xfer->path_count; ++i) + free(xfer->paths[i]); + free(xfer->paths); + } + + xfer->paths = NULL; + + free(xfer->sample_format_literal); + xfer->sample_format_literal = NULL; + + free(xfer->cntr_format_literal); + xfer->cntr_format_literal = NULL; +} + +int xfer_context_pre_process(struct xfer_context *xfer, + snd_pcm_format_t *format, + unsigned int *samples_per_frame, + unsigned int *frames_per_second, + snd_pcm_access_t *access, + snd_pcm_uframes_t *frames_per_buffer) +{ + int err; + + assert(xfer); + assert(format); + assert(samples_per_frame); + assert(frames_per_second); + assert(access); + assert(frames_per_buffer); + + if (!xfer->ops) + return -ENXIO; + + if (xfer->direction == SND_PCM_STREAM_CAPTURE) { + // For capture direction, use values in options if given. + if (xfer->sample_format != SND_PCM_FORMAT_UNKNOWN) + *format = xfer->sample_format; + if (xfer->samples_per_frame > 0) + *samples_per_frame = xfer->samples_per_frame; + if (xfer->frames_per_second > 0) + *frames_per_second = xfer->frames_per_second; + } else if (xfer->direction == SND_PCM_STREAM_PLAYBACK) { + // For playback direction, check values in given options so that + // they don't mismatch to parameters from media container. + if (*format != xfer->sample_format) { + // Not initial value. + if (xfer->sample_format != SND_PCM_FORMAT_UNKNOWN) { + fprintf(stderr, + "Sample format mismatch: %s is given " + "but %s by files\n", + snd_pcm_format_name(xfer->sample_format), + snd_pcm_format_name(*format)); + return -EINVAL; + } + } + + if (*samples_per_frame != xfer->samples_per_frame) { + // Not initial value. + if (xfer->samples_per_frame > 0) { + fprintf(stderr, + "The number of channels mismatch: %u " + "is given but %u by files\n", + xfer->samples_per_frame, + *samples_per_frame); + return -EINVAL; + } + } + + if (*frames_per_second != xfer->frames_per_second) { + // Not initial value. + if (xfer->frames_per_second != 8000) { + fprintf(stderr, + "Sampling rate mismatch: %u is given " + "but %u by files\n", + xfer->frames_per_second, + *frames_per_second); + return -EINVAL; + } + } + } + + err = xfer->ops->pre_process(xfer, format, samples_per_frame, + frames_per_second, access, + frames_per_buffer); + if (err < 0) + return err; + + assert(*format >= SND_PCM_FORMAT_S8); + assert(*format <= SND_PCM_FORMAT_LAST); + assert(*samples_per_frame > 0); + assert(*frames_per_second > 0); + assert(*access >= SND_PCM_ACCESS_MMAP_INTERLEAVED); + assert(*access <= SND_PCM_ACCESS_LAST); + assert(*frames_per_buffer > 0); + + xfer->sample_format = *format; + xfer->samples_per_frame = *samples_per_frame; + xfer->frames_per_second = *frames_per_second; + + if (xfer->direction == SND_PCM_STREAM_CAPTURE) { + err = xfer_options_fixup_paths(xfer); + if (err < 0) + return err; + } + + if (xfer->verbose > 1) { + fprintf(stderr, "Transfer: %s\n", + xfer_type_labels[xfer->type]); + fprintf(stderr, " access: %s\n", + snd_pcm_access_name(*access)); + fprintf(stderr, " sample format: %s\n", + snd_pcm_format_name(*format)); + fprintf(stderr, " bytes/sample: %u\n", + snd_pcm_format_physical_width(*format) / 8); + fprintf(stderr, " samples/frame: %u\n", + *samples_per_frame); + fprintf(stderr, " frames/second: %u\n", + *frames_per_second); + fprintf(stderr, " frames/buffer: %lu\n", + *frames_per_buffer); + } + + return 0; +} + +int xfer_context_process_frames(struct xfer_context *xfer, + struct mapper_context *mapper, + struct container_context *cntrs, + unsigned int *frame_count) +{ + assert(xfer); + assert(mapper); + assert(cntrs); + assert(frame_count); + + if (!xfer->ops) + return -ENXIO; + + return xfer->ops->process_frames(xfer, frame_count, mapper, cntrs); +} + +void xfer_context_pause(struct xfer_context *xfer, bool enable) +{ + assert(xfer); + + if (!xfer->ops) + return; + + xfer->ops->pause(xfer, enable); +} + +void xfer_context_post_process(struct xfer_context *xfer) +{ + assert(xfer); + + if (!xfer->ops) + return; + + xfer->ops->post_process(xfer); +} diff --git a/axfer/xfer.h b/axfer/xfer.h new file mode 100644 index 0000000..24349cd --- /dev/null +++ b/axfer/xfer.h @@ -0,0 +1,117 @@ +// SPDX-License-Identifier: GPL-2.0 +// +// xfer.h - a header for receiver/transmiter of data frames. +// +// Copyright (c) 2018 Takashi Sakamoto +// +// Licensed under the terms of the GNU General Public License, version 2. + +#ifndef __ALSA_UTILS_AXFER_XFER__H_ +#define __ALSA_UTILS_AXFER_XFER__H_ + +#include "mapper.h" + +#include + +#include "aconfig.h" + +enum xfer_type { + XFER_TYPE_UNSUPPORTED = -1, + XFER_TYPE_LIBASOUND = 0, +#if WITH_FFADO + XFER_TYPE_LIBFFADO, +#endif + XFER_TYPE_COUNT, +}; + +struct xfer_ops; + +struct xfer_context { + snd_pcm_stream_t direction; + enum xfer_type type; + const struct xfer_ops *ops; + void *private_data; + + char *sample_format_literal; + char *cntr_format_literal; + unsigned int verbose; + unsigned int duration_seconds; + unsigned int duration_frames; + unsigned int frames_per_second; + unsigned int samples_per_frame; + bool help:1; + bool quiet:1; + bool dump_hw_params:1; + bool multiple_cntrs:1; // For mapper. + + snd_pcm_format_t sample_format; + + // For containers. + char **paths; + unsigned int path_count; + enum container_format cntr_format; +}; + +enum xfer_type xfer_type_from_label(const char *label); +const char *xfer_label_from_type(enum xfer_type type); + +int xfer_context_init(struct xfer_context *xfer, enum xfer_type type, + snd_pcm_stream_t direction, int argc, char *const *argv); +void xfer_context_destroy(struct xfer_context *xfer); +int xfer_context_pre_process(struct xfer_context *xfer, + snd_pcm_format_t *format, + unsigned int *samples_per_frame, + unsigned int *frames_per_second, + snd_pcm_access_t *access, + snd_pcm_uframes_t *frames_per_buffer); +int xfer_context_process_frames(struct xfer_context *xfer, + struct mapper_context *mapper, + struct container_context *cntrs, + unsigned int *frame_count); +void xfer_context_pause(struct xfer_context *xfer, bool enable); +void xfer_context_post_process(struct xfer_context *xfer); + +struct xfer_data; +int xfer_options_parse_args(struct xfer_context *xfer, + const struct xfer_data *data, int argc, + char *const *argv); +int xfer_options_fixup_paths(struct xfer_context *xfer); +void xfer_options_calculate_duration(struct xfer_context *xfer, + uint64_t *total_frame_count); + +// For internal use in 'xfer' module. + +struct xfer_ops { + int (*init)(struct xfer_context *xfer, snd_pcm_stream_t direction); + int (*parse_opt)(struct xfer_context *xfer, int key, const char *optarg); + int (*validate_opts)(struct xfer_context *xfer); + int (*pre_process)(struct xfer_context *xfer, snd_pcm_format_t *format, + unsigned int *samples_per_frame, + unsigned int *frames_per_second, + snd_pcm_access_t *access, + snd_pcm_uframes_t *frames_per_buffer); + int (*process_frames)(struct xfer_context *xfer, + unsigned int *frame_count, + struct mapper_context *mapper, + struct container_context *cntrs); + void (*post_process)(struct xfer_context *xfer); + void (*destroy)(struct xfer_context *xfer); + void (*pause)(struct xfer_context *xfer, bool enable); + void (*help)(struct xfer_context *xfer); +}; + +struct xfer_data { + const char *s_opts; + const struct option *l_opts; + unsigned int l_opts_count; + struct xfer_ops ops; + unsigned int private_size; +}; + +extern const struct xfer_data xfer_libasound; + +#if WITH_FFADO + extern const struct xfer_data xfer_libffado; +#endif + +#endif diff --git a/bat/Makefile.am b/bat/Makefile.am new file mode 100644 index 0000000..5151f77 --- /dev/null +++ b/bat/Makefile.am @@ -0,0 +1,36 @@ +SUBDIRS=tests +bin_PROGRAMS = alsabat +man_MANS = alsabat.1 +EXTRA_DIST = alsabat.1 alsabat-test.sh +sbin_SCRIPTS = alsabat-test.sh + +alsabat_SOURCES = \ + bat.c \ + common.c \ + signal.c \ + latencytest.c \ + convert.c + +noinst_HEADERS = \ + common.h \ + bat-signal.h \ + latencytest.h \ + convert.h + +if HAVE_LIBFFTW3 +alsabat_SOURCES += analyze.c +noinst_HEADERS += analyze.h +endif + +if HAVE_LIBTINYALSA +alsabat_SOURCES += tinyalsa.c +noinst_HEADERS += tinyalsa.h +else +alsabat_SOURCES += alsa.c +noinst_HEADERS += alsa.h +endif + +AM_CPPFLAGS = \ + -Wall -I$(top_srcdir)/include + +alsabat_LDADD = @FFTW_LIB@ diff --git a/bat/Makefile.in b/bat/Makefile.in new file mode 100644 index 0000000..e54169d --- /dev/null +++ b/bat/Makefile.in @@ -0,0 +1,924 @@ +# Makefile.in generated by automake 1.16.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994-2018 Free Software Foundation, Inc. + +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + + + +VPATH = @srcdir@ +am__is_gnu_make = { \ + if test -z '$(MAKELEVEL)'; then \ + false; \ + elif test -n '$(MAKE_HOST)'; then \ + true; \ + elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ + true; \ + else \ + false; \ + fi; \ +} +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + esac; \ + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +bin_PROGRAMS = alsabat$(EXEEXT) +@HAVE_LIBFFTW3_TRUE@am__append_1 = analyze.c +@HAVE_LIBFFTW3_TRUE@am__append_2 = analyze.h +@HAVE_LIBTINYALSA_TRUE@am__append_3 = tinyalsa.c +@HAVE_LIBTINYALSA_TRUE@am__append_4 = tinyalsa.h +@HAVE_LIBTINYALSA_FALSE@am__append_5 = alsa.c +@HAVE_LIBTINYALSA_FALSE@am__append_6 = alsa.h +subdir = bat +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/gettext.m4 \ + $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/lib-ld.m4 \ + $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ + $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \ + $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/acinclude.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +DIST_COMMON = $(srcdir)/Makefile.am $(am__noinst_HEADERS_DIST) \ + $(am__DIST_COMMON) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/include/aconfig.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +am__installdirs = "$(DESTDIR)$(bindir)" "$(DESTDIR)$(sbindir)" \ + "$(DESTDIR)$(man1dir)" +PROGRAMS = $(bin_PROGRAMS) +am__alsabat_SOURCES_DIST = bat.c common.c signal.c latencytest.c \ + convert.c analyze.c tinyalsa.c alsa.c +@HAVE_LIBFFTW3_TRUE@am__objects_1 = analyze.$(OBJEXT) +@HAVE_LIBTINYALSA_TRUE@am__objects_2 = tinyalsa.$(OBJEXT) +@HAVE_LIBTINYALSA_FALSE@am__objects_3 = alsa.$(OBJEXT) +am_alsabat_OBJECTS = bat.$(OBJEXT) common.$(OBJEXT) signal.$(OBJEXT) \ + latencytest.$(OBJEXT) convert.$(OBJEXT) $(am__objects_1) \ + $(am__objects_2) $(am__objects_3) +alsabat_OBJECTS = $(am_alsabat_OBJECTS) +alsabat_DEPENDENCIES = +am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; +am__vpath_adj = case $$p in \ + $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ + *) f=$$p;; \ + esac; +am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; +am__install_max = 40 +am__nobase_strip_setup = \ + srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` +am__nobase_strip = \ + for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" +am__nobase_list = $(am__nobase_strip_setup); \ + for p in $$list; do echo "$$p $$p"; done | \ + sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ + $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ + if (++n[$$2] == $(am__install_max)) \ + { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ + END { for (dir in files) print dir, files[dir] }' +am__base_list = \ + sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ + sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' +am__uninstall_files_from_dir = { \ + test -z "$$files" \ + || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ + || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ + $(am__cd) "$$dir" && rm -f $$files; }; \ + } +SCRIPTS = $(sbin_SCRIPTS) +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__maybe_remake_depfiles = depfiles +am__depfiles_remade = ./$(DEPDIR)/alsa.Po ./$(DEPDIR)/analyze.Po \ + ./$(DEPDIR)/bat.Po ./$(DEPDIR)/common.Po \ + ./$(DEPDIR)/convert.Po ./$(DEPDIR)/latencytest.Po \ + ./$(DEPDIR)/signal.Po ./$(DEPDIR)/tinyalsa.Po +am__mv = mv -f +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +AM_V_CC = $(am__v_CC_@AM_V@) +am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) +am__v_CC_0 = @echo " CC " $@; +am__v_CC_1 = +CCLD = $(CC) +LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_CCLD = $(am__v_CCLD_@AM_V@) +am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) +am__v_CCLD_0 = @echo " CCLD " $@; +am__v_CCLD_1 = +SOURCES = $(alsabat_SOURCES) +DIST_SOURCES = $(am__alsabat_SOURCES_DIST) +RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \ + ctags-recursive dvi-recursive html-recursive info-recursive \ + install-data-recursive install-dvi-recursive \ + install-exec-recursive install-html-recursive \ + install-info-recursive install-pdf-recursive \ + install-ps-recursive install-recursive installcheck-recursive \ + installdirs-recursive pdf-recursive ps-recursive \ + tags-recursive uninstall-recursive +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +man1dir = $(mandir)/man1 +NROFF = nroff +MANS = $(man_MANS) +am__noinst_HEADERS_DIST = common.h bat-signal.h latencytest.h \ + convert.h analyze.h tinyalsa.h alsa.h +HEADERS = $(noinst_HEADERS) +RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ + distclean-recursive maintainer-clean-recursive +am__recursive_targets = \ + $(RECURSIVE_TARGETS) \ + $(RECURSIVE_CLEAN_TARGETS) \ + $(am__extra_recursive_targets) +AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \ + distdir distdir-am +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) +# Read a list of newline-separated strings from the standard input, +# and print each of them once, without duplicates. Input order is +# *not* preserved. +am__uniquify_input = $(AWK) '\ + BEGIN { nonempty = 0; } \ + { items[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in items) print i; }; } \ +' +# Make sure the list of sources is unique. This is necessary because, +# e.g., the same source file might be shared among _SOURCES variables +# for different programs/libraries. +am__define_uniq_tagged_files = \ + list='$(am__tagged_files)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | $(am__uniquify_input)` +ETAGS = etags +CTAGS = ctags +DIST_SUBDIRS = $(SUBDIRS) +am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/depcomp +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +am__relativize = \ + dir0=`pwd`; \ + sed_first='s,^\([^/]*\)/.*$$,\1,'; \ + sed_rest='s,^[^/]*/*,,'; \ + sed_last='s,^.*/\([^/]*\)$$,\1,'; \ + sed_butlast='s,/*[^/]*$$,,'; \ + while test -n "$$dir1"; do \ + first=`echo "$$dir1" | sed -e "$$sed_first"`; \ + if test "$$first" != "."; then \ + if test "$$first" = ".."; then \ + dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \ + dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \ + else \ + first2=`echo "$$dir2" | sed -e "$$sed_first"`; \ + if test "$$first2" = "$$first"; then \ + dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \ + else \ + dir2="../$$dir2"; \ + fi; \ + dir0="$$dir0"/"$$first"; \ + fi; \ + fi; \ + dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \ + done; \ + reldir="$$dir2" +ACLOCAL = @ACLOCAL@ +ALSACTL_DAEMONSWITCH = @ALSACTL_DAEMONSWITCH@ +ALSACTL_PIDFILE_DIR = @ALSACTL_PIDFILE_DIR@ +ALSA_CFLAGS = @ALSA_CFLAGS@ +ALSA_LIBS = @ALSA_LIBS@ +ALSA_TOPOLOGY_LIBS = @ALSA_TOPOLOGY_LIBS@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +ASOUND_LOCK_DIR = @ASOUND_LOCK_DIR@ +ASOUND_STATE_DIR = @ASOUND_STATE_DIR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CURSESINC = @CURSESINC@ +CURSESLIB = @CURSESLIB@ +CURSES_CFLAGS = @CURSES_CFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +FFTW_CFLAGS = @FFTW_CFLAGS@ +FFTW_INC = @FFTW_INC@ +FFTW_LIB = @FFTW_LIB@ +GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ +GMSGFMT = @GMSGFMT@ +GMSGFMT_015 = @GMSGFMT_015@ +GREP = @GREP@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +INTLLIBS = @INTLLIBS@ +INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@ +LDFLAGS = @LDFLAGS@ +LIBICONV = @LIBICONV@ +LIBINTL = @LIBINTL@ +LIBOBJS = @LIBOBJS@ +LIBRT = @LIBRT@ +LIBS = @LIBS@ +LN_S = @LN_S@ +LTLIBICONV = @LTLIBICONV@ +LTLIBINTL = @LTLIBINTL@ +LTLIBOBJS = @LTLIBOBJS@ +MAINT = @MAINT@ +MAKEINFO = @MAKEINFO@ +MKDIR_P = @MKDIR_P@ +MSGFMT = @MSGFMT@ +MSGFMT_015 = @MSGFMT_015@ +MSGMERGE = @MSGMERGE@ +NCURSESW_CFLAGS = @NCURSESW_CFLAGS@ +NCURSESW_LIBS = @NCURSESW_LIBS@ +NCURSES_CFLAGS = @NCURSES_CFLAGS@ +NCURSES_LIBS = @NCURSES_LIBS@ +OBJEXT = @OBJEXT@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ +POSUB = @POSUB@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +SND_UTIL_MAJOR = @SND_UTIL_MAJOR@ +SND_UTIL_MINOR = @SND_UTIL_MINOR@ +SND_UTIL_SUBMINOR = @SND_UTIL_SUBMINOR@ +SND_UTIL_VERSION = @SND_UTIL_VERSION@ +STRIP = @STRIP@ +SYSTEMD_CFLAGS = @SYSTEMD_CFLAGS@ +SYSTEMD_LIBS = @SYSTEMD_LIBS@ +TESTSOUND = @TESTSOUND@ +USE_NLS = @USE_NLS@ +VERSION = @VERSION@ +XGETTEXT = @XGETTEXT@ +XGETTEXT_015 = @XGETTEXT_015@ +XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_CC = @ac_ct_CC@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +mydatadir = @mydatadir@ +ncurses5_config = @ncurses5_config@ +ncursesw5_config = @ncursesw5_config@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +rst2man_available = @rst2man_available@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +systemdsystemunitdir = @systemdsystemunitdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +udevrulesdir = @udevrulesdir@ +xmlto_available = @xmlto_available@ +SUBDIRS = tests +man_MANS = alsabat.1 +EXTRA_DIST = alsabat.1 alsabat-test.sh +sbin_SCRIPTS = alsabat-test.sh +alsabat_SOURCES = bat.c common.c signal.c latencytest.c convert.c \ + $(am__append_1) $(am__append_3) $(am__append_5) +noinst_HEADERS = common.h bat-signal.h latencytest.h convert.h \ + $(am__append_2) $(am__append_4) $(am__append_6) +AM_CPPFLAGS = \ + -Wall -I$(top_srcdir)/include + +alsabat_LDADD = @FFTW_LIB@ +all: all-recursive + +.SUFFIXES: +.SUFFIXES: .c .o .obj +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign bat/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --foreign bat/Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): +install-binPROGRAMS: $(bin_PROGRAMS) + @$(NORMAL_INSTALL) + @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(bindir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(bindir)" || exit 1; \ + fi; \ + for p in $$list; do echo "$$p $$p"; done | \ + sed 's/$(EXEEXT)$$//' | \ + while read p p1; do if test -f $$p \ + ; then echo "$$p"; echo "$$p"; else :; fi; \ + done | \ + sed -e 'p;s,.*/,,;n;h' \ + -e 's|.*|.|' \ + -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \ + sed 'N;N;N;s,\n, ,g' | \ + $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \ + { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \ + if ($$2 == $$4) files[d] = files[d] " " $$1; \ + else { print "f", $$3 "/" $$4, $$1; } } \ + END { for (d in files) print "f", d, files[d] }' | \ + while read type dir files; do \ + if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \ + test -z "$$files" || { \ + echo " $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(bindir)$$dir'"; \ + $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \ + } \ + ; done + +uninstall-binPROGRAMS: + @$(NORMAL_UNINSTALL) + @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ + files=`for p in $$list; do echo "$$p"; done | \ + sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \ + -e 's/$$/$(EXEEXT)/' \ + `; \ + test -n "$$list" || exit 0; \ + echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \ + cd "$(DESTDIR)$(bindir)" && rm -f $$files + +clean-binPROGRAMS: + -test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS) + +alsabat$(EXEEXT): $(alsabat_OBJECTS) $(alsabat_DEPENDENCIES) $(EXTRA_alsabat_DEPENDENCIES) + @rm -f alsabat$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(alsabat_OBJECTS) $(alsabat_LDADD) $(LIBS) +install-sbinSCRIPTS: $(sbin_SCRIPTS) + @$(NORMAL_INSTALL) + @list='$(sbin_SCRIPTS)'; test -n "$(sbindir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(sbindir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(sbindir)" || exit 1; \ + fi; \ + for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + if test -f "$$d$$p"; then echo "$$d$$p"; echo "$$p"; else :; fi; \ + done | \ + sed -e 'p;s,.*/,,;n' \ + -e 'h;s|.*|.|' \ + -e 'p;x;s,.*/,,;$(transform)' | sed 'N;N;N;s,\n, ,g' | \ + $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1; } \ + { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \ + if ($$2 == $$4) { files[d] = files[d] " " $$1; \ + if (++n[d] == $(am__install_max)) { \ + print "f", d, files[d]; n[d] = 0; files[d] = "" } } \ + else { print "f", d "/" $$4, $$1 } } \ + END { for (d in files) print "f", d, files[d] }' | \ + while read type dir files; do \ + if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \ + test -z "$$files" || { \ + echo " $(INSTALL_SCRIPT) $$files '$(DESTDIR)$(sbindir)$$dir'"; \ + $(INSTALL_SCRIPT) $$files "$(DESTDIR)$(sbindir)$$dir" || exit $$?; \ + } \ + ; done + +uninstall-sbinSCRIPTS: + @$(NORMAL_UNINSTALL) + @list='$(sbin_SCRIPTS)'; test -n "$(sbindir)" || exit 0; \ + files=`for p in $$list; do echo "$$p"; done | \ + sed -e 's,.*/,,;$(transform)'`; \ + dir='$(DESTDIR)$(sbindir)'; $(am__uninstall_files_from_dir) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/alsa.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/analyze.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bat.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/common.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/convert.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/latencytest.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/signal.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tinyalsa.Po@am__quote@ # am--include-marker + +$(am__depfiles_remade): + @$(MKDIR_P) $(@D) + @echo '# dummy' >$@-t && $(am__mv) $@-t $@ + +am--depfiles: $(am__depfiles_remade) + +.c.o: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< + +.c.obj: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` +install-man1: $(man_MANS) + @$(NORMAL_INSTALL) + @list1=''; \ + list2='$(man_MANS)'; \ + test -n "$(man1dir)" \ + && test -n "`echo $$list1$$list2`" \ + || exit 0; \ + echo " $(MKDIR_P) '$(DESTDIR)$(man1dir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(man1dir)" || exit 1; \ + { for i in $$list1; do echo "$$i"; done; \ + if test -n "$$list2"; then \ + for i in $$list2; do echo "$$i"; done \ + | sed -n '/\.1[a-z]*$$/p'; \ + fi; \ + } | while read p; do \ + if test -f $$p; then d=; else d="$(srcdir)/"; fi; \ + echo "$$d$$p"; echo "$$p"; \ + done | \ + sed -e 'n;s,.*/,,;p;h;s,.*\.,,;s,^[^1][0-9a-z]*$$,1,;x' \ + -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,' | \ + sed 'N;N;s,\n, ,g' | { \ + list=; while read file base inst; do \ + if test "$$base" = "$$inst"; then list="$$list $$file"; else \ + echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man1dir)/$$inst'"; \ + $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man1dir)/$$inst" || exit $$?; \ + fi; \ + done; \ + for i in $$list; do echo "$$i"; done | $(am__base_list) | \ + while read files; do \ + test -z "$$files" || { \ + echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(man1dir)'"; \ + $(INSTALL_DATA) $$files "$(DESTDIR)$(man1dir)" || exit $$?; }; \ + done; } + +uninstall-man1: + @$(NORMAL_UNINSTALL) + @list=''; test -n "$(man1dir)" || exit 0; \ + files=`{ for i in $$list; do echo "$$i"; done; \ + l2='$(man_MANS)'; for i in $$l2; do echo "$$i"; done | \ + sed -n '/\.1[a-z]*$$/p'; \ + } | sed -e 's,.*/,,;h;s,.*\.,,;s,^[^1][0-9a-z]*$$,1,;x' \ + -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,'`; \ + dir='$(DESTDIR)$(man1dir)'; $(am__uninstall_files_from_dir) + +# This directory's subdirectories are mostly independent; you can cd +# into them and run 'make' without going through this Makefile. +# To change the values of 'make' variables: instead of editing Makefiles, +# (1) if the variable is set in 'config.status', edit 'config.status' +# (which will cause the Makefiles to be regenerated when you run 'make'); +# (2) otherwise, pass the desired values on the 'make' command line. +$(am__recursive_targets): + @fail=; \ + if $(am__make_keepgoing); then \ + failcom='fail=yes'; \ + else \ + failcom='exit 1'; \ + fi; \ + dot_seen=no; \ + target=`echo $@ | sed s/-recursive//`; \ + case "$@" in \ + distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ + *) list='$(SUBDIRS)' ;; \ + esac; \ + for subdir in $$list; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + dot_seen=yes; \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || eval $$failcom; \ + done; \ + if test "$$dot_seen" = "no"; then \ + $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ + fi; test -z "$$fail" + +ID: $(am__tagged_files) + $(am__define_uniq_tagged_files); mkid -fID $$unique +tags: tags-recursive +TAGS: tags + +tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + set x; \ + here=`pwd`; \ + if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ + include_option=--etags-include; \ + empty_fix=.; \ + else \ + include_option=--include; \ + empty_fix=; \ + fi; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test ! -f $$subdir/TAGS || \ + set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \ + fi; \ + done; \ + $(am__define_uniq_tagged_files); \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: ctags-recursive + +CTAGS: ctags +ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + $(am__define_uniq_tagged_files); \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" +cscopelist: cscopelist-recursive + +cscopelist-am: $(am__tagged_files) + list='$(am__tagged_files)'; \ + case "$(srcdir)" in \ + [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ + *) sdir=$(subdir)/$(srcdir) ;; \ + esac; \ + for i in $$list; do \ + if test -f "$$i"; then \ + echo "$(subdir)/$$i"; \ + else \ + echo "$$sdir/$$i"; \ + fi; \ + done >> $(top_builddir)/cscope.files + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) distdir-am + +distdir-am: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done + @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + $(am__make_dryrun) \ + || test -d "$(distdir)/$$subdir" \ + || $(MKDIR_P) "$(distdir)/$$subdir" \ + || exit 1; \ + dir1=$$subdir; dir2="$(distdir)/$$subdir"; \ + $(am__relativize); \ + new_distdir=$$reldir; \ + dir1=$$subdir; dir2="$(top_distdir)"; \ + $(am__relativize); \ + new_top_distdir=$$reldir; \ + echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \ + echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \ + ($(am__cd) $$subdir && \ + $(MAKE) $(AM_MAKEFLAGS) \ + top_distdir="$$new_top_distdir" \ + distdir="$$new_distdir" \ + am__remove_distdir=: \ + am__skip_length_check=: \ + am__skip_mode_fix=: \ + distdir) \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-recursive +all-am: Makefile $(PROGRAMS) $(SCRIPTS) $(MANS) $(HEADERS) +installdirs: installdirs-recursive +installdirs-am: + for dir in "$(DESTDIR)$(bindir)" "$(DESTDIR)$(sbindir)" "$(DESTDIR)$(man1dir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ + done +install: install-recursive +install-exec: install-exec-recursive +install-data: install-data-recursive +uninstall: uninstall-recursive + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-recursive +install-strip: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-recursive + +clean-am: clean-binPROGRAMS clean-generic mostlyclean-am + +distclean: distclean-recursive + -rm -f ./$(DEPDIR)/alsa.Po + -rm -f ./$(DEPDIR)/analyze.Po + -rm -f ./$(DEPDIR)/bat.Po + -rm -f ./$(DEPDIR)/common.Po + -rm -f ./$(DEPDIR)/convert.Po + -rm -f ./$(DEPDIR)/latencytest.Po + -rm -f ./$(DEPDIR)/signal.Po + -rm -f ./$(DEPDIR)/tinyalsa.Po + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-recursive + +dvi-am: + +html: html-recursive + +html-am: + +info: info-recursive + +info-am: + +install-data-am: install-man + +install-dvi: install-dvi-recursive + +install-dvi-am: + +install-exec-am: install-binPROGRAMS install-sbinSCRIPTS + +install-html: install-html-recursive + +install-html-am: + +install-info: install-info-recursive + +install-info-am: + +install-man: install-man1 + +install-pdf: install-pdf-recursive + +install-pdf-am: + +install-ps: install-ps-recursive + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-recursive + -rm -f ./$(DEPDIR)/alsa.Po + -rm -f ./$(DEPDIR)/analyze.Po + -rm -f ./$(DEPDIR)/bat.Po + -rm -f ./$(DEPDIR)/common.Po + -rm -f ./$(DEPDIR)/convert.Po + -rm -f ./$(DEPDIR)/latencytest.Po + -rm -f ./$(DEPDIR)/signal.Po + -rm -f ./$(DEPDIR)/tinyalsa.Po + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-recursive + +mostlyclean-am: mostlyclean-compile mostlyclean-generic + +pdf: pdf-recursive + +pdf-am: + +ps: ps-recursive + +ps-am: + +uninstall-am: uninstall-binPROGRAMS uninstall-man \ + uninstall-sbinSCRIPTS + +uninstall-man: uninstall-man1 + +.MAKE: $(am__recursive_targets) install-am install-strip + +.PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am \ + am--depfiles check check-am clean clean-binPROGRAMS \ + clean-generic cscopelist-am ctags ctags-am distclean \ + distclean-compile distclean-generic distclean-tags distdir dvi \ + dvi-am html html-am info info-am install install-am \ + install-binPROGRAMS install-data install-data-am install-dvi \ + install-dvi-am install-exec install-exec-am install-html \ + install-html-am install-info install-info-am install-man \ + install-man1 install-pdf install-pdf-am install-ps \ + install-ps-am install-sbinSCRIPTS install-strip installcheck \ + installcheck-am installdirs installdirs-am maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-compile \ + mostlyclean-generic pdf pdf-am ps ps-am tags tags-am uninstall \ + uninstall-am uninstall-binPROGRAMS uninstall-man \ + uninstall-man1 uninstall-sbinSCRIPTS + +.PRECIOUS: Makefile + + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/bat/alsa.c b/bat/alsa.c new file mode 100644 index 0000000..0d0af0d --- /dev/null +++ b/bat/alsa.c @@ -0,0 +1,731 @@ +/* + * Copyright (C) 2013-2015 Intel Corporation + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + */ + +#include +#include +#include +#include +#include +#include + +#include + +#include "aconfig.h" +#include "gettext.h" + +#include "common.h" +#include "alsa.h" +#include "latencytest.h" + +struct pcm_container { + snd_pcm_t *handle; + snd_pcm_uframes_t period_size; + snd_pcm_uframes_t buffer_size; + snd_pcm_format_t format; + unsigned short channels; + size_t period_bytes; + size_t sample_bits; + size_t frame_bits; + char *buffer; +}; + +struct format_map_table { + enum _bat_pcm_format format_bat; + snd_pcm_format_t format_alsa; +}; + +static struct format_map_table map_tables[] = { + { BAT_PCM_FORMAT_UNKNOWN, SND_PCM_FORMAT_UNKNOWN }, + { BAT_PCM_FORMAT_U8, SND_PCM_FORMAT_U8 }, + { BAT_PCM_FORMAT_S16_LE, SND_PCM_FORMAT_S16_LE }, + { BAT_PCM_FORMAT_S24_3LE, SND_PCM_FORMAT_S24_3LE }, + { BAT_PCM_FORMAT_S32_LE, SND_PCM_FORMAT_S32_LE }, + { BAT_PCM_FORMAT_MAX, }, +}; + +static int format_convert(struct bat *bat, snd_pcm_format_t *fmt) +{ + struct format_map_table *t = map_tables; + + for (; t->format_bat != BAT_PCM_FORMAT_MAX; t++) { + if (t->format_bat == bat->format) { + *fmt = t->format_alsa; + return 0; + } + } + fprintf(bat->err, _("Invalid format!\n")); + return -EINVAL; +} + +static int set_snd_pcm_params(struct bat *bat, struct pcm_container *sndpcm) +{ + snd_pcm_hw_params_t *params; + snd_pcm_format_t format; + unsigned int buffer_time = 0; + unsigned int period_time = 0; + snd_pcm_uframes_t buffer_size = 0; + snd_pcm_uframes_t period_size = 0; + unsigned int rate; + int err; + const char *device_name = snd_pcm_name(sndpcm->handle); + + /* Convert common format to ALSA format */ + err = format_convert(bat, &format); + if (err != 0) + return err; + + /* Allocate a hardware parameters object. */ + snd_pcm_hw_params_alloca(¶ms); + + /* Fill it in with default values. */ + err = snd_pcm_hw_params_any(sndpcm->handle, params); + if (err < 0) { + fprintf(bat->err, _("Set parameter to device error: ")); + fprintf(bat->err, _("default params: %s: %s(%d)\n"), + device_name, snd_strerror(err), err); + return err; + } + + /* Set access mode */ + err = snd_pcm_hw_params_set_access(sndpcm->handle, params, + SND_PCM_ACCESS_RW_INTERLEAVED); + if (err < 0) { + fprintf(bat->err, _("Set parameter to device error: ")); + fprintf(bat->err, _("access type: %s: %s(%d)\n"), + device_name, snd_strerror(err), err); + return err; + } + + /* Set format */ + err = snd_pcm_hw_params_set_format(sndpcm->handle, params, format); + if (err < 0) { + fprintf(bat->err, _("Set parameter to device error: ")); + fprintf(bat->err, _("PCM format: %d %s: %s(%d)\n"), format, + device_name, snd_strerror(err), err); + return err; + } + + /* Set channels */ + err = snd_pcm_hw_params_set_channels(sndpcm->handle, + params, bat->channels); + if (err < 0) { + fprintf(bat->err, _("Set parameter to device error: ")); + fprintf(bat->err, _("channel number: %d %s: %s(%d)\n"), + bat->channels, + device_name, snd_strerror(err), err); + return err; + } + + /* Set sampling rate */ + rate = bat->rate; + err = snd_pcm_hw_params_set_rate_near(sndpcm->handle, + params, &bat->rate, + 0); + if (err < 0) { + fprintf(bat->err, _("Set parameter to device error: ")); + fprintf(bat->err, _("sample rate: %d %s: %s(%d)\n"), + bat->rate, + device_name, snd_strerror(err), err); + return err; + } + if ((float) rate * (1 + RATE_RANGE) < bat->rate + || (float) rate * (1 - RATE_RANGE) > bat->rate) { + fprintf(bat->err, _("Invalid parameters: sample rate: ")); + fprintf(bat->err, _("requested %dHz, got %dHz\n"), + rate, bat->rate); + return -EINVAL; + } + + if (bat->buffer_size > 0 && bat->period_size == 0) + bat->period_size = bat->buffer_size / DIV_BUFFERSIZE; + + if (bat->roundtriplatency && bat->buffer_size == 0) { + /* Set to minimum buffer size and period size + for latency test */ + if (snd_pcm_hw_params_get_buffer_size_min(params, + &buffer_size) < 0) { + fprintf(bat->err, + _("Get parameter from device error: ")); + fprintf(bat->err, _("buffer size min: %d %s: %s(%d)\n"), + (int) buffer_size, + device_name, snd_strerror(err), err); + return -EINVAL; + } + + if (snd_pcm_hw_params_get_period_size_min(params, + &period_size, 0) < 0) { + fprintf(bat->err, + _("Get parameter from device error: ")); + fprintf(bat->err, _("period size min: %d %s: %s(%d)\n"), + (int) period_size, + device_name, snd_strerror(err), err); + return -EINVAL; + } + bat->buffer_size = (int) buffer_size; + bat->period_size = (int) period_size; + } + + if (bat->buffer_size > 0) { + buffer_size = bat->buffer_size; + period_size = bat->period_size; + + fprintf(bat->log, _("Set period size: %d buffer size: %d\n"), + (int) period_size, (int) buffer_size); + + err = snd_pcm_hw_params_set_buffer_size_near(sndpcm->handle, + params, &buffer_size); + if (err < 0) { + fprintf(bat->err, _("Set parameter to device error: ")); + fprintf(bat->err, _("buffer size: %d %s: %s(%d)\n"), + (int) buffer_size, + device_name, snd_strerror(err), err); + return err; + } + + err = snd_pcm_hw_params_set_period_size_near(sndpcm->handle, + params, &period_size, 0); + if (err < 0) { + fprintf(bat->err, _("Set parameter to device error: ")); + fprintf(bat->err, _("period size: %d %s: %s(%d)\n"), + (int) period_size, + device_name, snd_strerror(err), err); + return err; + } + } else { + if (snd_pcm_hw_params_get_buffer_time_max(params, + &buffer_time, 0) < 0) { + fprintf(bat->err, + _("Get parameter from device error: ")); + fprintf(bat->err, _("buffer time: %d %s: %s(%d)\n"), + buffer_time, + device_name, snd_strerror(err), err); + return -EINVAL; + } + + if (buffer_time > MAX_BUFFERTIME) + buffer_time = MAX_BUFFERTIME; + + period_time = buffer_time / DIV_BUFFERTIME; + + /* Set buffer time and period time */ + err = snd_pcm_hw_params_set_buffer_time_near(sndpcm->handle, + params, &buffer_time, 0); + if (err < 0) { + fprintf(bat->err, _("Set parameter to device error: ")); + fprintf(bat->err, _("buffer time: %d %s: %s(%d)\n"), + buffer_time, + device_name, snd_strerror(err), err); + return err; + } + + err = snd_pcm_hw_params_set_period_time_near(sndpcm->handle, + params, &period_time, 0); + if (err < 0) { + fprintf(bat->err, _("Set parameter to device error: ")); + fprintf(bat->err, _("period time: %d %s: %s(%d)\n"), + period_time, + device_name, snd_strerror(err), err); + return err; + } + } + + /* Write the parameters to the driver */ + if (snd_pcm_hw_params(sndpcm->handle, params) < 0) { + fprintf(bat->err, _("Set parameter to device error: ")); + fprintf(bat->err, _("hw params: %s: %s(%d)\n"), + device_name, snd_strerror(err), err); + return -EINVAL; + } + + err = snd_pcm_hw_params_get_period_size(params, + &sndpcm->period_size, 0); + if (err < 0) { + fprintf(bat->err, _("Get parameter from device error: ")); + fprintf(bat->err, _("period size: %zd %s: %s(%d)\n"), + sndpcm->period_size, + device_name, snd_strerror(err), err); + return err; + } + + err = snd_pcm_hw_params_get_buffer_size(params, &sndpcm->buffer_size); + if (err < 0) { + fprintf(bat->err, _("Get parameter from device error: ")); + fprintf(bat->err, _("buffer size: %zd %s: %s(%d)\n"), + sndpcm->buffer_size, + device_name, snd_strerror(err), err); + return err; + } + + if (sndpcm->period_size == sndpcm->buffer_size) { + fprintf(bat->err, _("Invalid parameters: can't use period ")); + fprintf(bat->err, _("equal to buffer size (%zd)\n"), + sndpcm->period_size); + return -EINVAL; + } + + fprintf(bat->log, _("Get period size: %d buffer size: %d\n"), + (int) sndpcm->period_size, (int) sndpcm->buffer_size); + + err = snd_pcm_format_physical_width(format); + if (err < 0) { + fprintf(bat->err, _("Invalid parameters: ")); + fprintf(bat->err, _("snd_pcm_format_physical_width: %d\n"), + err); + return err; + } + sndpcm->sample_bits = err; + + sndpcm->frame_bits = sndpcm->sample_bits * bat->channels; + + /* Calculate the period bytes */ + sndpcm->period_bytes = sndpcm->period_size * sndpcm->frame_bits / 8; + sndpcm->buffer = (char *) malloc(sndpcm->period_bytes); + if (sndpcm->buffer == NULL) { + fprintf(bat->err, _("Not enough memory: size=%zd\n"), + sndpcm->period_bytes); + return -ENOMEM; + } + + return 0; +} + +static int write_to_pcm(const struct pcm_container *sndpcm, + int frames, struct bat *bat) +{ + int err; + int offset = 0; + int remain = frames; + + while (remain > 0) { + err = snd_pcm_writei(sndpcm->handle, sndpcm->buffer + offset, + remain); + if (err == -EAGAIN || (err >= 0 && err < frames)) { + snd_pcm_wait(sndpcm->handle, 500); + } else if (err == -EPIPE) { + fprintf(bat->err, _("Underrun: %s(%d)\n"), + snd_strerror(err), err); + if (bat->roundtriplatency) + bat->latency.xrun_error = true; + snd_pcm_prepare(sndpcm->handle); + } else if (err == -ESTRPIPE) { + while ((err = snd_pcm_resume(sndpcm->handle)) == -EAGAIN) + sleep(1); /* wait until resume flag is released */ + if (err < 0) + snd_pcm_prepare(sndpcm->handle); + } else if (err < 0) { + fprintf(bat->err, _("Write PCM device error: %s(%d)\n"), + snd_strerror(err), err); + return err; + } + + if (err > 0) { + remain -= err; + offset += err * sndpcm->frame_bits / 8; + } + } + + return 0; +} + +/** + * Process output data for latency test + */ +static int latencytest_process_output(struct pcm_container *sndpcm, + struct bat *bat) +{ + int err = 0; + int bytes = sndpcm->period_bytes; /* playback buffer size */ + int frames = sndpcm->period_size; /* frame count */ + + bat->latency.is_playing = true; + + while (1) { + /* generate output data */ + err = handleoutput(bat, sndpcm->buffer, bytes, frames); + if (err != 0) + break; + + err = write_to_pcm(sndpcm, frames, bat); + if (err != 0) + break; + + /* Xrun error, terminate the playback thread*/ + if (bat->latency.xrun_error == true) + break; + + if (bat->latency.state == LATENCY_STATE_COMPLETE_SUCCESS) + break; + + bat->periods_played++; + } + + bat->latency.is_playing = false; + + return err; +} + +static int write_to_pcm_loop(struct pcm_container *sndpcm, struct bat *bat) +{ + int err = 0; + int bytes = sndpcm->period_bytes; /* playback buffer size */ + int frames = bytes * 8 / sndpcm->frame_bits; /* frame count */ + FILE *fp = NULL; + int bytes_total = 0; + + if (bat->debugplay) { + fp = fopen(bat->debugplay, "wb"); + err = -errno; + if (fp == NULL) { + fprintf(bat->err, _("Cannot open file: %s %d\n"), + bat->debugplay, err); + return err; + } + /* leave space for wav header */ + if (fseek(fp, sizeof(struct wav_container), SEEK_SET) != 0) { + err = -errno; + fclose(fp); + return err; + } + } + + while (1) { + err = generate_input_data(bat, sndpcm->buffer, bytes, frames); + if (err != 0) + break; + + if (bat->debugplay) { + if (fwrite(sndpcm->buffer, 1, bytes, fp) != bytes) { + err = -EIO; + break; + } + bytes_total += bytes; + } + + bat->periods_played++; + if (bat->period_is_limited + && bat->periods_played >= bat->periods_total) + break; + + err = write_to_pcm(sndpcm, frames, bat); + if (err != 0) + break; + } + + if (bat->debugplay) { + update_wav_header(bat, fp, bytes_total); + fclose(fp); + } + + snd_pcm_drain(sndpcm->handle); + + return err; +} + +/** + * Play + */ +void *playback_alsa(struct bat *bat) +{ + int err = 0; + struct pcm_container sndpcm; + + fprintf(bat->log, _("Entering playback thread (ALSA).\n")); + + retval_play = 0; + memset(&sndpcm, 0, sizeof(sndpcm)); + + err = snd_pcm_open(&sndpcm.handle, bat->playback.device, + SND_PCM_STREAM_PLAYBACK, 0); + if (err != 0) { + fprintf(bat->err, _("Cannot open PCM playback device: ")); + fprintf(bat->err, _("%s(%d)\n"), snd_strerror(err), err); + retval_play = err; + goto exit1; + } + + err = set_snd_pcm_params(bat, &sndpcm); + if (err != 0) { + retval_play = err; + goto exit2; + } + + if (bat->playback.file == NULL) { + fprintf(bat->log, _("Playing generated audio sine wave")); + bat->sinus_duration == 0 ? + fprintf(bat->log, _(" endlessly\n")) : + fprintf(bat->log, _("\n")); + } else { + fprintf(bat->log, _("Playing input audio file: %s\n"), + bat->playback.file); + bat->fp = fopen(bat->playback.file, "rb"); + err = -errno; + if (bat->fp == NULL) { + fprintf(bat->err, _("Cannot open file: %s %d\n"), + bat->playback.file, err); + retval_play = err; + goto exit3; + } + /* Skip header */ + err = read_wav_header(bat, bat->playback.file, bat->fp, true); + if (err != 0) { + retval_play = err; + goto exit4; + } + } + + if (bat->roundtriplatency) + err = latencytest_process_output(&sndpcm, bat); + else + err = write_to_pcm_loop(&sndpcm, bat); + if (err < 0) { + retval_play = err; + goto exit4; + } + +exit4: + if (bat->playback.file) + fclose(bat->fp); +exit3: + free(sndpcm.buffer); +exit2: + snd_pcm_close(sndpcm.handle); +exit1: + pthread_exit(&retval_play); +} + +static int read_from_pcm(struct pcm_container *sndpcm, + int frames, struct bat *bat) +{ + int err = 0; + int offset = 0; + int remain = frames; + + while (remain > 0) { + err = snd_pcm_readi(sndpcm->handle, + sndpcm->buffer + offset, remain); + if (err == -EAGAIN || (err >= 0 && err < remain)) { + snd_pcm_wait(sndpcm->handle, 500); + } else if (err == -EPIPE) { + snd_pcm_prepare(sndpcm->handle); + fprintf(bat->err, _("Overrun: %s(%d)\n"), + snd_strerror(err), err); + if (bat->roundtriplatency) + bat->latency.xrun_error = true; + } else if (err == -ESTRPIPE) { + while ((err = snd_pcm_resume(sndpcm->handle)) == -EAGAIN) + sleep(1); /* wait until resume flag is released */ + if (err < 0) + snd_pcm_prepare(sndpcm->handle); + } else if (err < 0) { + fprintf(bat->err, _("Read PCM device error: %s(%d)\n"), + snd_strerror(err), err); + return err; + } + + if (err > 0) { + remain -= err; + offset += err * sndpcm->frame_bits / 8; + } + } + + return 0; +} + +static int read_from_pcm_loop(struct pcm_container *sndpcm, struct bat *bat) +{ + int err = 0; + FILE *fp = NULL; + int size, frames; + int bytes_read = 0; + int bytes_count = bat->frames * bat->frame_size; + int remain = bytes_count; + + remove(bat->capture.file); + fp = fopen(bat->capture.file, "wb"); + err = -errno; + if (fp == NULL) { + fprintf(bat->err, _("Cannot open file: %s %d\n"), + bat->capture.file, err); + return err; + } + /* leave space for file header */ + if (fseek(fp, sizeof(struct wav_container), SEEK_SET) != 0) { + err = -errno; + fclose(fp); + return err; + } + + while (remain > 0) { + size = (remain <= sndpcm->period_bytes) ? + remain : sndpcm->period_bytes; + frames = size * 8 / sndpcm->frame_bits; + + /* read a chunk from pcm device */ + err = read_from_pcm(sndpcm, frames, bat); + if (err != 0) + break; + + /* write the chunk to file */ + if (fwrite(sndpcm->buffer, 1, size, fp) != size) { + err = -EIO; + break; + } + + bytes_read += size; + remain -= size; + bat->periods_played++; + + if (bat->period_is_limited + && bat->periods_played >= bat->periods_total) + break; + } + + update_wav_header(bat, fp, bytes_read); + + fclose(fp); + return err; +} + +/** + * Process input data for latency test + */ +static int latencytest_process_input(struct pcm_container *sndpcm, + struct bat *bat) +{ + int err = 0; + FILE *fp = NULL; + int bytes_read = 0; + int frames = sndpcm->period_size; + int size = sndpcm->period_bytes; + int bytes_count = bat->frames * bat->frame_size; + + remove(bat->capture.file); + fp = fopen(bat->capture.file, "wb"); + err = -errno; + if (fp == NULL) { + fprintf(bat->err, _("Cannot open file: %s %d\n"), + bat->capture.file, err); + return err; + } + /* leave space for file header */ + if (fseek(fp, sizeof(struct wav_container), SEEK_SET) != 0) { + fclose(fp); + return err; + } + + bat->latency.is_capturing = true; + + while (bytes_read < bytes_count) { + /* read a chunk from pcm device */ + err = read_from_pcm(sndpcm, frames, bat); + if (err != 0) + break; + + /* Xrun error, terminate the capture thread*/ + if (bat->latency.xrun_error == true) + break; + + err = handleinput(bat, sndpcm->buffer, frames); + if (err != 0) + break; + + if (bat->latency.is_playing == false) + break; + + /* write the chunk to file */ + if (fwrite(sndpcm->buffer, 1, size, fp) != size) { + err = -EIO; + break; + } + + bytes_read += size; + } + + bat->latency.is_capturing = false; + + update_wav_header(bat, fp, bytes_read); + + fclose(fp); + return err; +} + + +static void pcm_cleanup(void *p) +{ + snd_pcm_close(p); +} + +/** + * Record + */ +void *record_alsa(struct bat *bat) +{ + int err = 0; + struct pcm_container sndpcm; + + pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, NULL); + + fprintf(bat->log, _("Entering capture thread (ALSA).\n")); + + retval_record = 0; + memset(&sndpcm, 0, sizeof(sndpcm)); + + err = snd_pcm_open(&sndpcm.handle, bat->capture.device, + SND_PCM_STREAM_CAPTURE, 0); + if (err != 0) { + fprintf(bat->err, _("Cannot open PCM capture device: ")); + fprintf(bat->err, _("%s(%d)\n"), snd_strerror(err), err); + retval_record = err; + goto exit1; + } + + err = set_snd_pcm_params(bat, &sndpcm); + if (err != 0) { + retval_record = err; + goto exit2; + } + + pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL); + pthread_setcanceltype(PTHREAD_CANCEL_DEFERRED, NULL); + pthread_cleanup_push(pcm_cleanup, sndpcm.handle); + pthread_cleanup_push(free, sndpcm.buffer); + + fprintf(bat->log, _("Recording ...\n")); + if (bat->roundtriplatency) + err = latencytest_process_input(&sndpcm, bat); + else + err = read_from_pcm_loop(&sndpcm, bat); + + pthread_cleanup_pop(0); + pthread_cleanup_pop(0); + + if (err != 0) { + retval_record = err; + goto exit3; + } + + /* Normally we will never reach this part of code (unless error in + * previous call) (before exit3) as this thread will be cancelled + * by end of play thread. Except in single line mode. */ + snd_pcm_drain(sndpcm.handle); + pthread_exit(&retval_record); + +exit3: + free(sndpcm.buffer); +exit2: + snd_pcm_close(sndpcm.handle); +exit1: + pthread_exit(&retval_record); +} diff --git a/bat/alsa.h b/bat/alsa.h new file mode 100644 index 0000000..d5c9972 --- /dev/null +++ b/bat/alsa.h @@ -0,0 +1,20 @@ +/* + * Copyright (C) 2013-2015 Intel Corporation + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + */ + +extern int retval_play; +extern int retval_record; + +void *playback_alsa(struct bat *); +void *record_alsa(struct bat *); diff --git a/bat/alsabat-test.sh b/bat/alsabat-test.sh new file mode 100755 index 0000000..bc3d512 --- /dev/null +++ b/bat/alsabat-test.sh @@ -0,0 +1,152 @@ +#!/bin/bash + +# default devices +dev_playback="default" +dev_capture="default" + +bin="alsabat" +commands="$bin -P $dev_playback -C $dev_capture" + +file_sin_mono="default_mono.wav" +file_sin_dual="default_dual.wav" +logdir="tmp" + +# frequency range of signal +maxfreq=16547 +minfreq=17 + +# sleep time and pause time +sleep_time=5 +pause_time=2 + +# features passes vs. features all +feature_pass=0 +feature_cnt=0 + +init_counter () { + feature_pass=0 + feature_all=0 +} + +evaluate_result () { + feature_cnt=$((feature_cnt+1)) + if [ $1 -eq 0 ]; then + feature_pass=$((feature_pass+1)) + echo "pass" + else + echo "fail" + fi +} + +print_result () { + echo "[$feature_pass/$feature_cnt] features passes." +} + +feature_test () { + echo "============================================" + echo "$feature_cnt: ALSA $2" + echo "-------------------------------------------" + echo "$commands $1 --log=$logdir/$feature_cnt.log" + $commands $1 --log=$logdir/$feature_cnt.log + evaluate_result $? + echo "$commands $1" >> $logdir/$((feature_cnt-1)).log +} + +feature_test_power () { + echo "============================================" + echo "$feature_cnt: ALSA $2" + echo "-------------------------------------------" + echo "$commands $1 --log=$logdir/$feature_cnt.log" + + # run alsabat in the background + nohup $commands $1 > $logdir/$feature_cnt.log 2>&1 & + sleep $pause_time + pid=`ps -aux |grep alsabat|head -1 |awk -F ' ' '{print $2}'` + + # stop the alsabat thread + kill -STOP $pid > /dev/null + sleep 4 + + # do system S3 + rtcwake -m mem -s $sleep_time + sleep $pause_time + + # resume the alasbat thread to run + kill -CONT $pid > /dev/null + + # wait for alsabat to complete the analysis + sleep $pause_time + cat $logdir/$feature_cnt.log |grep -i "Return value is 0" > /dev/null + evaluate_result $? + echo "$commands $1" >> $logdir/$((feature_cnt-1)).log +} + +# test items +feature_list_test () { + init_counter + + commands="$bin" + feature_test "-c1 --saveplay $file_sin_mono" \ + "generate mono wav file with default params" + feature_test "-c2 --saveplay $file_sin_dual" \ + "generate dual wav file with default params" + sleep 5 + feature_test "-P $dev_playback" "single line mode, playback" + feature_test "-C $dev_capture --standalone" "single line mode, capture" + + commands="$bin -P $dev_playback -C $dev_capture" + feature_test "--file $file_sin_mono" "play mono wav file and detect" + feature_test "--file $file_sin_dual" "play dual wav file and detect" + feature_test "-c1" "configurable channel number: 1" + feature_test "-c2 -F $minfreq:$maxfreq" "configurable channel number: 2" + feature_test "-r44100" "configurable sample rate: 44100" + feature_test "-r48000" "configurable sample rate: 48000" + feature_test "-n10000" "configurable duration: in samples" + feature_test "-n2.5s" "configurable duration: in seconds" + feature_test "-f U8" "configurable data format: U8" + feature_test "-f S16_LE" "configurable data format: S16_LE" + feature_test "-f S24_3LE" "configurable data format: S24_3LE" + feature_test "-f S32_LE" "configurable data format: S32_LE" + feature_test "-f cd" "configurable data format: cd" + feature_test "-f dat" "configurable data format: dat" + feature_test "-F $maxfreq --standalone" \ + "standalone mode: play and capture" + latestfile=`ls -t1 /tmp/bat.wav.* | head -n 1` + feature_test "--local -F $maxfreq --file $latestfile" \ + "local mode: analyze local file" + feature_test "--roundtriplatency" \ + "round trip latency test" + feature_test "--snr-db 26" \ + "noise detect threshold in SNR(dB)" + feature_test "--snr-pc 5" \ + "noise detect threshold in noise percentage(%)" + feature_test_power "-n5s" "power management: S3 test" + + print_result +} + +echo "*******************************************" +echo " BAT Test " +echo "-------------------------------------------" + +# get device +echo "usage:" +echo " $0 " +echo " $0 " + +if [ $# -eq 2 ]; then + dev_playback=$1 + dev_capture=$2 +elif [ $# -eq 1 ]; then + dev_playback=$1 + dev_capture=$1 +fi + +echo "current setting:" +echo " $0 $dev_playback $dev_capture" + +# run +mkdir -p $logdir +feature_list_test + +echo "*******************************************" diff --git a/bat/alsabat.1 b/bat/alsabat.1 new file mode 100644 index 0000000..67b6ca8 --- /dev/null +++ b/bat/alsabat.1 @@ -0,0 +1,185 @@ +.TH ALSABAT 1 "20th October 2015" +.SH NAME +alsabat \- command\-line sound tester for ALSA sound card driver + +.SH SYNOPSIS +\fBalsabat\fP [\fIflags\fP] + +.SH DESCRIPTION +\fBALSABAT(ALSA Basic Audio Tester)\fP is a simple command\-line utility +intended to help automate audio driver and sound server testing with little +human interaction. ALSABAT can be used to test audio quality, stress test +features and test audio before and after PM state changes. + +ALSABAT's design is relatively simple. ALSABAT plays an audio stream and +captures the same stream in either a digital or analog loop back. It then +compares the captured stream using a FFT to the original to determine if +the test case passes or fails. + +ALSABAT can either run wholly on the target machine being tested (standalone +mode) or can run as a client/server mode where by alsabat client runs on the +target and runs as a server on a separate tester machine. The client/server +mode still requires some manual interaction for synchronization, but this +is actively being developed for future releases. + +The hardware testing configuration may require the use of an analog cable +connecting target to tester machines or a cable to create an analog +loopback if no loopback mode is available on the sound hardware that is +being tested. +An analog loopback cable can be used to connect the "line in" to "line out" +jacks to create a loopback. If only headphone and mic jacks (or combo jack) +are available then the following simple circuit can be used to create an +analog loopback :- + +https://source.android.com/devices/audio/loopback.html + +If tinyalsa is installed in system, user can choose tinyalsa as backend lib +of alsabat, with configure option "--enable-alsabat-backend-tiny". + +.SH OPTIONS +.TP +\fI\-h, \-\-help\fP +Help: show syntax. +.TP +\fI\-D\fP +Select sound card to be tested by name. +.TP +\fI\-P\fP +Select the playback PCM device. +.TP +\fI\-C\fP +Select the capture PCM device. +.TP +\fI\-f\fP +Sample format +.br +Recognized sample formats are: U8 S16_LE S24_3LE S32_LE +.br +Some of these may not be available on selected hardware +.br +The available format shortcuts are: +.nf +\-f cd (16 bit little endian, 44100, stereo) [\-f S16_LE \-c2 \-r44100] +\-f dat (16 bit little endian, 48000, stereo) [\-f S16_LE \-c2 \-r48000] +.fi +If no format is given S16_LE is used. +.TP +\fI\-c\fP +The number of channels. The default is one channel. +Valid values at the moment are 1 or 2. +.TP +\fI\-r\fP +Sampling rate in Hertz. The default rate is 44100 Hertz. +Valid values depends on hardware support. +.TP +\fI\-n\fP +Duration of generated signal. +The value could be either of the two forms: +.br +1. Decimal integer, means number of frames; +.br +2. Floating point with suffix 's', means number of seconds. +.br +The default is 2 seconds. +.TP +\fI\-k\fP +Sigma k value for analysis. +.br +The analysis function reads data from WAV file, run FFT against the data +to get magnitude of frequency vectors, and then calculates the average +value and standard deviation of frequency vectors. After that, we define +a threshold: +.br +threshold = k * standard_deviation + mean_value +.br +Frequencies with amplitude larger than threshold will be recognized as a +peak, and the frequency with largest peak value will be recognized as a +detected frequency. +.br +ALSABAT then compares the detected frequency to target frequency, to +decide if the detecting passes or fails. +.br +The default value is 3.0. +.TP +\fI\-F\fP +Target frequency for signal generation and analysis, in Hertz. +The default is 997.0 Hertz. +Valid range is (DC_THRESHOLD, 40% * Sampling rate). +.TP +\fI\-p\fP +Total number of periods to play or capture. +.TP +\fI\-\-log=#\fP +Write stderr and stdout output to this log file. +.TP +\fI\-\-file=#\fP +Input WAV file for playback. +.TP +\fI\-\-saveplay=#\fP +Target WAV file to save capture test content. +.TP +\fI\-\-local\fP +Internal loopback mode. +Playback, capture and analysis internal to ALSABAT only. This is intended +for developers to test new ALSABAT features as no audio is routed outside +of ALSABAT. +.TP +\fI\-\-standalone\fP +Add support for standalone mode where ALSABAT will run on a different machine +to the one being tested. +In standalone mode, the sound data can be generated, playback and captured +just like in normal mode, but will not be analyzed. +The ALSABAT being built without libfftw3 support is always in standalone mode. +The ALSABAT in normal mode can also bypass data analysis using option +"--standalone". +.TP +\fI\-\-roundtriplatency\fP +Round trip latency test. +Audio latency is the time delay as an audio signal passes through a system. +There are many kinds of audio latency metrics. One useful metric is the +round trip latency, which is the sum of output latency and input latency. +.TP +\fI\-\-snr\-db=#\fP +Noise detection threshold in SNR (dB). 26dB indicates 5% noise in amplitude. +ALSABAT will return error if signal SNR is smaller than the threshold. +.TP +\fI\-\-snr\-pc=#\fP +Noise detection threshold in percentage of noise amplitude (%). +ALSABAT will return error if the noise amplitude is larger than the threshold. + +.SH EXAMPLES + +.TP +\fBalsabat \-P plughw:0,0 \-C plughw:0,0 \-c 2 \-f S32_LE \-F 250\fR +Generate and play a sine wave of 250 Hertz with 2 channel and S32_LE format, +and then capture and analyze. + +.TP +\fBalsabat \-P plughw:0,0 \-C plughw:0,0 \-\-file 500Hz.wav\fR +Play the RIFF WAV file "500Hz.wav" which contains 500 Hertz waveform LPCM +data, and then capture and analyze. + +.SH RETURN VALUE +.br +On success, returns 0. +.br +If no peak be detected, returns -1001; +.br +If only DC be detected, returns -1002; +.br +If peak frequency does not match with the target frequency, returns -1003. + +.SH SEE ALSO +\fB +aplay(1) +\fP + +.SH BUGS +Currently only support RIFF WAV format with PCM data. Please report any bugs to +the alsa-devel mailing list. + +.SH AUTHOR +\fBalsabat\fP is by Liam Girdwood , Bernard +Gautier and Han Lu . +This document is by Liam Girdwood and Han Lu +. diff --git a/bat/analyze.c b/bat/analyze.c new file mode 100644 index 0000000..211dfc1 --- /dev/null +++ b/bat/analyze.c @@ -0,0 +1,513 @@ +/* + * Copyright (C) 2013-2015 Intel Corporation + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + */ + +#include +#include +#include +#include +#include + +#include +#include + +#include "aconfig.h" +#include "gettext.h" + +#include "common.h" +#include "bat-signal.h" + +static void check_amplitude(struct bat *bat, float *buf) +{ + float sum, average, amplitude; + int i, percent; + + /* calculate average value */ + for (i = 0, sum = 0.0, average = 0.0; i < bat->frames; i++) + sum += buf[i]; + average = sum / bat->frames; + + /* calculate peak-to-average amplitude */ + for (i = 0, sum = 0.0; i < bat->frames; i++) + sum += fabsf(buf[i] - average); + amplitude = sum / bat->frames * M_PI / 2.0; + + /* calculate amplitude percentage against full range */ + percent = amplitude * 100 / ((1 << ((bat->sample_size << 3) - 1)) - 1); + + fprintf(bat->log, _("Amplitude: %.1f; Percentage: [%d]\n"), + amplitude, percent); + if (percent < 0) + fprintf(bat->err, _("ERROR: Amplitude can't be negative!\n")); + else if (percent < 1) + fprintf(bat->err, _("WARNING: Signal too weak!\n")); + else if (percent > 100) + fprintf(bat->err, _("WARNING: Signal overflow!\n")); +} + +/** + * + * @return 0 if peak detected at right frequency, + * 1 if peak detected somewhere else + * 2 if DC detected + */ +int check_peak(struct bat *bat, struct analyze *a, int end, int peak, float hz, + float mean, float p, int channel, int start) +{ + int err; + float hz_peak = (float) (peak) * hz; + float delta_rate = DELTA_RATE * bat->target_freq[channel]; + float delta_HZ = DELTA_HZ; + float tolerance = (delta_rate > delta_HZ) ? delta_rate : delta_HZ; + + fprintf(bat->log, _("Detected peak at %2.2f Hz of %2.2f dB\n"), hz_peak, + 10.0 * log10f(a->mag[peak] / mean)); + fprintf(bat->log, _(" Total %3.1f dB from %2.2f to %2.2f Hz\n"), + 10.0 * log10f(p / mean), start * hz, end * hz); + + if (hz_peak < DC_THRESHOLD) { + fprintf(bat->err, _(" WARNING: Found low peak %2.2f Hz,"), + hz_peak); + fprintf(bat->err, _(" very close to DC\n")); + err = FOUND_DC; + } else if (hz_peak < bat->target_freq[channel] - tolerance) { + fprintf(bat->err, _(" FAIL: Peak freq too low %2.2f Hz\n"), + hz_peak); + err = FOUND_WRONG_PEAK; + } else if (hz_peak > bat->target_freq[channel] + tolerance) { + fprintf(bat->err, _(" FAIL: Peak freq too high %2.2f Hz\n"), + hz_peak); + err = FOUND_WRONG_PEAK; + } else { + fprintf(bat->log, _(" PASS: Peak detected")); + fprintf(bat->log, _(" at target frequency\n")); + err = 0; + } + + return err; +} + +/** + * Search for main frequencies in fft results and compare it to target + */ +static int check(struct bat *bat, struct analyze *a, int channel) +{ + float hz = 1.0 / ((float) bat->frames / (float) bat->rate); + float mean = 0.0, t, sigma = 0.0, p = 0.0; + int i, start = -1, end = -1, peak = 0, signals = 0; + int err = 0, N = bat->frames / 2; + + /* calculate mean */ + for (i = 0; i < N; i++) + mean += a->mag[i]; + mean /= (float) N; + + /* calculate standard deviation */ + for (i = 0; i < N; i++) { + t = a->mag[i] - mean; + t *= t; + sigma += t; + } + sigma /= (float) N; + sigma = sqrtf(sigma); + + /* clip any data less than k sigma + mean */ + for (i = 0; i < N; i++) { + if (a->mag[i] > mean + bat->sigma_k * sigma) { + + /* find peak start points */ + if (start == -1) { + start = peak = end = i; + signals++; + } else { + if (a->mag[i] > a->mag[peak]) + peak = i; + end = i; + } + p += a->mag[i]; + } else if (start != -1) { + /* Check if peak is as expected */ + err |= check_peak(bat, a, end, peak, hz, mean, + p, channel, start); + end = start = -1; + if (signals == MAX_PEAKS) + break; + } + } + if (signals == 0) + err = -ENOPEAK; /* No peak detected */ + else if ((err == FOUND_DC) && (signals == 1)) + err = -EONLYDC; /* Only DC detected */ + else if ((err & FOUND_WRONG_PEAK) == FOUND_WRONG_PEAK) + err = -EBADPEAK; /* Bad peak detected */ + else + err = 0; /* Correct peak detected */ + + fprintf(bat->log, _("Detected at least %d signal(s) in total\n"), + signals); + + return err; +} + +static void calc_magnitude(struct bat *bat, struct analyze *a, int N) +{ + float r2, i2; + int i; + + for (i = 1; i < N / 2; i++) { + r2 = a->out[i] * a->out[i]; + i2 = a->out[N - i] * a->out[N - i]; + + a->mag[i] = sqrtf(r2 + i2); + } + a->mag[0] = 0.0; +} + +static int find_and_check_harmonics(struct bat *bat, struct analyze *a, + int channel) +{ + fftwf_plan p; + int err = -ENOMEM, N = bat->frames; + + /* Allocate FFT buffers */ + a->in = (float *) fftwf_malloc(sizeof(float) * bat->frames); + if (a->in == NULL) + goto out1; + + a->out = (float *) fftwf_malloc(sizeof(float) * bat->frames); + if (a->out == NULL) + goto out2; + + a->mag = (float *) fftwf_malloc(sizeof(float) * bat->frames); + if (a->mag == NULL) + goto out3; + + /* create FFT plan */ + p = fftwf_plan_r2r_1d(N, a->in, a->out, FFTW_R2HC, + FFTW_MEASURE | FFTW_PRESERVE_INPUT); + if (p == NULL) + goto out4; + + /* convert source PCM to floats */ + bat->convert_sample_to_float(a->buf, a->in, bat->frames); + + /* check amplitude */ + check_amplitude(bat, a->in); + + /* run FFT */ + fftwf_execute(p); + + /* FFT out is real and imaginary numbers - calc magnitude for each */ + calc_magnitude(bat, a, N); + + /* check data */ + err = check(bat, a, channel); + + fftwf_destroy_plan(p); + +out4: + fftwf_free(a->mag); +out3: + fftwf_free(a->out); +out2: + fftwf_free(a->in); +out1: + return err; +} + +static int calculate_noise_one_period(struct bat *bat, + struct noise_analyzer *na, float *src, + int length, int channel) +{ + int i, shift = 0; + float tmp, rms, gain, residual; + float a = 0.0, b = 1.0; + + /* step 1. phase compensation */ + + if (length < 2 * na->nsamples) + return -EINVAL; + + /* search for the beginning of a sine period */ + for (i = 0, tmp = 0.0, shift = -1; i < na->nsamples; i++) { + /* find i where src[i] >= 0 && src[i+1] < 0 */ + if (src[i] < 0.0) + continue; + if (src[i + 1] < 0.0) { + tmp = src[i] - src[i + 1]; + a = src[i] / tmp; + b = -src[i + 1] / tmp; + shift = i; + break; + } + } + + /* didn't find the beginning of a sine period */ + if (shift == -1) + return -EINVAL; + + /* shift sine waveform to source[0] = 0.0 */ + for (i = 0; i < na->nsamples; i++) + na->source[i] = a * src[i + shift + 1] + b * src[i + shift]; + + /* step 2. gain compensation */ + + /* calculate rms of signal amplitude */ + for (i = 0, tmp = 0.0; i < na->nsamples; i++) + tmp += na->source[i] * na->source[i]; + rms = sqrtf(tmp / na->nsamples); + + gain = na->rms_tgt / rms; + + for (i = 0; i < na->nsamples; i++) + na->source[i] *= gain; + + /* step 3. calculate snr in dB */ + + for (i = 0, tmp = 0.0, residual = 0.0; i < na->nsamples; i++) { + tmp = fabsf(na->target[i] - na->source[i]); + residual += tmp * tmp; + } + + tmp = na->rms_tgt / sqrtf(residual / na->nsamples); + na->snr_db = 20.0 * log10f(tmp); + + return 0; +} + +static int calculate_noise(struct bat *bat, float *src, int channel) +{ + int err = 0; + struct noise_analyzer na; + float freq = bat->target_freq[channel]; + float tmp, sum_snr_pc, avg_snr_pc, avg_snr_db; + int offset, i, cnt_noise, cnt_clean; + /* num of samples in each sine period */ + int nsamples = (int) ceilf(bat->rate / freq); + /* each section has 2 sine periods, the first one for locating + * and the second one for noise calculating */ + int nsamples_per_section = nsamples * 2; + /* all sine periods will be calculated except the first one */ + int nsection = bat->frames / nsamples - 1; + + fprintf(bat->log, _("samples per period: %d\n"), nsamples); + fprintf(bat->log, _("total sections to detect: %d\n"), nsection); + na.source = (float *)malloc(sizeof(float) * nsamples); + if (!na.source) { + err = -ENOMEM; + goto out1; + } + + na.target = (float *)malloc(sizeof(float) * nsamples); + if (!na.target) { + err = -ENOMEM; + goto out2; + } + + /* generate standard single-tone signal */ + err = generate_sine_wave_raw_mono(bat, na.target, freq, nsamples); + if (err < 0) + goto out3; + + na.nsamples = nsamples; + + /* calculate rms of standard signal */ + for (i = 0, tmp = 0.0; i < nsamples; i++) + tmp += na.target[i] * na.target[i]; + na.rms_tgt = sqrtf(tmp / nsamples); + + /* calculate average noise level */ + sum_snr_pc = 0.0; + cnt_clean = cnt_noise = 0; + for (i = 0, offset = 0; i < nsection; i++) { + na.snr_db = SNR_DB_INVALID; + + err = calculate_noise_one_period(bat, &na, src + offset, + nsamples_per_section, channel); + if (err < 0) + goto out3; + + if (na.snr_db > bat->snr_thd_db) { + cnt_clean++; + sum_snr_pc += 100.0 / powf(10.0, na.snr_db / 20.0); + } else { + cnt_noise++; + } + offset += nsamples; + } + + if (cnt_noise > 0) { + fprintf(bat->err, _("Noise detected at %d points.\n"), + cnt_noise); + err = -cnt_noise; + if (cnt_clean == 0) + goto out3; + } else { + fprintf(bat->log, _("No noise detected.\n")); + } + + avg_snr_pc = sum_snr_pc / cnt_clean; + avg_snr_db = 20.0 * log10f(100.0 / avg_snr_pc); + fprintf(bat->log, _("Average SNR is %.2f dB (%.2f %%) at %d points.\n"), + avg_snr_db, avg_snr_pc, cnt_clean); + +out3: + free(na.target); +out2: + free(na.source); +out1: + return err; +} + +static int find_and_check_noise(struct bat *bat, void *buf, int channel) +{ + int err = 0; + float *source; + + source = (float *)malloc(sizeof(float) * bat->frames); + if (!source) + return -ENOMEM; + + /* convert source PCM to floats */ + bat->convert_sample_to_float(buf, source, bat->frames); + + /* adjust waveform and calculate noise */ + err = calculate_noise(bat, source, channel); + + free(source); + return err; +} + +/** + * Convert interleaved samples from channels in samples from a single channel + */ +static int reorder_data(struct bat *bat) +{ + char *p, *new_bat_buf; + int ch, i, j; + + if (bat->channels == 1) + return 0; /* No need for reordering */ + + p = malloc(bat->frames * bat->frame_size); + new_bat_buf = p; + if (p == NULL) + return -ENOMEM; + + for (ch = 0; ch < bat->channels; ch++) { + for (j = 0; j < bat->frames; j++) { + for (i = 0; i < bat->sample_size; i++) { + *p++ = ((char *) (bat->buf))[j * bat->frame_size + + ch * bat->sample_size + i]; + } + } + } + + free(bat->buf); + bat->buf = new_bat_buf; + + return 0; +} + +/* truncate sample frames for faster FFT analysis process */ +static int truncate_frames(struct bat *bat) +{ + int shift = SHIFT_MAX; + + for (; shift > SHIFT_MIN; shift--) + if (bat->frames & (1 << shift)) { + bat->frames = 1 << shift; + return 0; + } + + return -EINVAL; +} + +int analyze_capture(struct bat *bat) +{ + int err = 0; + size_t items; + int c; + struct analyze a; + + err = truncate_frames(bat); + if (err < 0) { + fprintf(bat->err, _("Invalid frame number for analysis: %d\n"), + bat->frames); + return err; + } + + fprintf(bat->log, _("\nBAT analysis: signal has %d frames at %d Hz,"), + bat->frames, bat->rate); + fprintf(bat->log, _(" %d channels, %d bytes per sample.\n"), + bat->channels, bat->sample_size); + + bat->buf = malloc(bat->frames * bat->frame_size); + if (bat->buf == NULL) + return -ENOMEM; + + bat->fp = fopen(bat->capture.file, "rb"); + err = -errno; + if (bat->fp == NULL) { + fprintf(bat->err, _("Cannot open file: %s %d\n"), + bat->capture.file, err); + goto exit1; + } + + /* Skip header */ + err = read_wav_header(bat, bat->capture.file, bat->fp, true); + if (err != 0) + goto exit2; + + items = fread(bat->buf, bat->frame_size, bat->frames, bat->fp); + if (items != bat->frames) { + err = -EIO; + goto exit2; + } + + err = reorder_data(bat); + if (err != 0) + goto exit2; + + for (c = 0; c < bat->channels; c++) { + fprintf(bat->log, _("\nChannel %i - "), c + 1); + fprintf(bat->log, _("Checking for target frequency %2.2f Hz\n"), + bat->target_freq[c]); + a.buf = bat->buf + + c * bat->frames * bat->frame_size + / bat->channels; + if (!bat->standalone) { + err = find_and_check_harmonics(bat, &a, c); + if (err != 0) + goto exit2; + } + + if (snr_is_valid(bat->snr_thd_db)) { + fprintf(bat->log, _("\nChecking for SNR: ")); + fprintf(bat->log, _("Threshold is %.2f dB (%.2f%%)\n"), + bat->snr_thd_db, 100.0 + / powf(10.0, bat->snr_thd_db / 20.0)); + err = find_and_check_noise(bat, a.buf, c); + if (err != 0) + goto exit2; + } + } + +exit2: + fclose(bat->fp); +exit1: + free(bat->buf); + + return err; +} diff --git a/bat/analyze.h b/bat/analyze.h new file mode 100644 index 0000000..3fd03d4 --- /dev/null +++ b/bat/analyze.h @@ -0,0 +1,16 @@ +/* + * Copyright (C) 2013-2015 Intel Corporation + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + */ + +int analyze_capture(struct bat *); diff --git a/bat/bat-signal.h b/bat/bat-signal.h new file mode 100644 index 0000000..3c314a5 --- /dev/null +++ b/bat/bat-signal.h @@ -0,0 +1,31 @@ +/* + * Copyright (C) 2015 Caleb Crome + * Copyright (C) 2013-2015 Intel Corporation + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + */ + +/* + * Here's a generic sine wave generator that will work indefinitely + * for any frequency. + * + * Note: the state & phasor are stored as doubles (and updated as + * doubles) because after a million samples the magnitude drifts a + * bit. If we really need floats, it can be done with periodic + * renormalization of the state_real+state_imag magnitudes. + */ + +int sin_generator_init(struct sin_generator *, float, float, float); +float sin_generator_next_sample(struct sin_generator *); +void sin_generator_vfill(struct sin_generator *, float *, int); +int generate_sine_wave(struct bat *, int, void *); +int generate_sine_wave_raw_mono(struct bat *, float *, float, int); diff --git a/bat/bat.c b/bat/bat.c new file mode 100644 index 0000000..8645770 --- /dev/null +++ b/bat/bat.c @@ -0,0 +1,731 @@ +/* + * Copyright (C) 2013-2015 Intel Corporation + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "aconfig.h" +#include "gettext.h" +#include "version.h" + +#include "common.h" + +#ifdef HAVE_LIBTINYALSA +#include "tinyalsa.h" +#else +#include "alsa.h" +#endif +#include "convert.h" +#ifdef HAVE_LIBFFTW3F +#include "analyze.h" +#endif +#include "latencytest.h" + +/* get snr threshold in dB */ +static void get_snr_thd_db(struct bat *bat, char *thd) +{ + int err; + float thd_db; + char *ptrf; + + thd_db = strtof(thd, &ptrf); + err = -errno; + if (!snr_is_valid(thd_db)) { + fprintf(bat->err, _("Invalid threshold '%s':%d\n"), thd, err); + exit(EXIT_FAILURE); + } + bat->snr_thd_db = thd_db; +} + +/* get snr threshold in %, and convert to dB */ +static void get_snr_thd_pc(struct bat *bat, char *thd) +{ + int err; + float thd_pc; + char *ptrf; + + thd_pc = strtof(thd, &ptrf); + err = -errno; + if (thd_pc <= 0.0 || thd_pc >= 100.0) { + fprintf(bat->err, _("Invalid threshold '%s':%d\n"), thd, err); + exit(EXIT_FAILURE); + } + bat->snr_thd_db = 20.0 * log10f(100.0 / thd_pc); +} + +static int get_duration(struct bat *bat) +{ + int err; + float duration_f; + long duration_i; + char *ptrf, *ptri; + + duration_f = strtof(bat->narg, &ptrf); + err = -errno; + if (duration_f == HUGE_VALF || duration_f == -HUGE_VALF + || (duration_f == 0.0 && err != 0)) + goto err_exit; + + duration_i = strtol(bat->narg, &ptri, 10); + if (duration_i == LONG_MAX || duration_i == LONG_MIN) + goto err_exit; + + if (*ptrf == 's') + bat->frames = duration_f * bat->rate; + else if (*ptri == 0) + bat->frames = duration_i; + else + bat->frames = -1; + + if (bat->frames <= 0 || bat->frames > MAX_FRAMES) { + fprintf(bat->err, _("Invalid duration. Range: (0, %d(%fs))\n"), + MAX_FRAMES, (float)MAX_FRAMES / bat->rate); + return -EINVAL; + } + + return 0; + +err_exit: + fprintf(bat->err, _("Duration overflow/underflow: %d\n"), err); + + return err; +} + +static void get_sine_frequencies(struct bat *bat, char *freq) +{ + char *tmp1; + + tmp1 = strchr(freq, ':'); + if (tmp1 == NULL) { + bat->target_freq[1] = bat->target_freq[0] = atof(optarg); + } else { + *tmp1 = '\0'; + bat->target_freq[0] = atof(optarg); + bat->target_freq[1] = atof(tmp1 + 1); + } +} + +static void get_format(struct bat *bat, char *optarg) +{ + if (strcasecmp(optarg, "cd") == 0) { + bat->format = BAT_PCM_FORMAT_S16_LE; + bat->rate = 44100; + bat->channels = 2; + bat->sample_size = 2; + } else if (strcasecmp(optarg, "dat") == 0) { + bat->format = BAT_PCM_FORMAT_S16_LE; + bat->rate = 48000; + bat->channels = 2; + bat->sample_size = 2; + } else if (strcasecmp(optarg, "U8") == 0) { + bat->format = BAT_PCM_FORMAT_U8; + bat->sample_size = 1; + } else if (strcasecmp(optarg, "S16_LE") == 0) { + bat->format = BAT_PCM_FORMAT_S16_LE; + bat->sample_size = 2; + } else if (strcasecmp(optarg, "S24_3LE") == 0) { + bat->format = BAT_PCM_FORMAT_S24_3LE; + bat->sample_size = 3; + } else if (strcasecmp(optarg, "S32_LE") == 0) { + bat->format = BAT_PCM_FORMAT_S32_LE; + bat->sample_size = 4; + } else { + bat->format = BAT_PCM_FORMAT_UNKNOWN; + fprintf(bat->err, _("wrong extended format '%s'\n"), optarg); + exit(EXIT_FAILURE); + } +} + +static inline int thread_wait_completion(struct bat *bat, + pthread_t id, int **val) +{ + int err; + + err = pthread_join(id, (void **) val); + if (err) + pthread_cancel(id); + + return err; +} + +/* loopback test where we play sine wave and capture the same sine wave */ +static void test_loopback(struct bat *bat) +{ + pthread_t capture_id, playback_id; + int err; + int *thread_result_capture, *thread_result_playback; + + /* start playback */ + err = pthread_create(&playback_id, NULL, + (void *) bat->playback.fct, bat); + if (err != 0) { + fprintf(bat->err, _("Cannot create playback thread: %d\n"), + err); + exit(EXIT_FAILURE); + } + + /* TODO: use a pipe to signal stream start etc - i.e. to sync threads */ + /* Let some time for playing something before capturing */ + usleep(CAPTURE_DELAY * 1000); + + /* start capture */ + err = pthread_create(&capture_id, NULL, (void *) bat->capture.fct, bat); + if (err != 0) { + fprintf(bat->err, _("Cannot create capture thread: %d\n"), err); + pthread_cancel(playback_id); + exit(EXIT_FAILURE); + } + + /* wait for playback to complete */ + err = thread_wait_completion(bat, playback_id, &thread_result_playback); + if (err != 0) { + fprintf(bat->err, _("Cannot join playback thread: %d\n"), err); + free(thread_result_playback); + pthread_cancel(capture_id); + exit(EXIT_FAILURE); + } + + /* check playback status */ + if (*thread_result_playback != 0) { + fprintf(bat->err, _("Exit playback thread fail: %d\n"), + *thread_result_playback); + pthread_cancel(capture_id); + exit(EXIT_FAILURE); + } else { + fprintf(bat->log, _("Playback completed.\n")); + } + + /* now stop and wait for capture to finish */ + pthread_cancel(capture_id); + err = thread_wait_completion(bat, capture_id, &thread_result_capture); + if (err != 0) { + fprintf(bat->err, _("Cannot join capture thread: %d\n"), err); + free(thread_result_capture); + exit(EXIT_FAILURE); + } + + /* check if capture thread is canceled or not */ + if (thread_result_capture == PTHREAD_CANCELED) { + fprintf(bat->log, _("Capture canceled.\n")); + return; + } + + /* check capture status */ + if (*thread_result_capture != 0) { + fprintf(bat->err, _("Exit capture thread fail: %d\n"), + *thread_result_capture); + exit(EXIT_FAILURE); + } else { + fprintf(bat->log, _("Capture completed.\n")); + } +} + +/* single ended playback only test */ +static void test_playback(struct bat *bat) +{ + pthread_t playback_id; + int err; + int *thread_result; + + /* start playback */ + err = pthread_create(&playback_id, NULL, + (void *) bat->playback.fct, bat); + if (err != 0) { + fprintf(bat->err, _("Cannot create playback thread: %d\n"), + err); + exit(EXIT_FAILURE); + } + + /* wait for playback to complete */ + err = thread_wait_completion(bat, playback_id, &thread_result); + if (err != 0) { + fprintf(bat->err, _("Cannot join playback thread: %d\n"), err); + free(thread_result); + exit(EXIT_FAILURE); + } + + /* check playback status */ + if (*thread_result != 0) { + fprintf(bat->err, _("Exit playback thread fail: %d\n"), + *thread_result); + exit(EXIT_FAILURE); + } else { + fprintf(bat->log, _("Playback completed.\n")); + } +} + +/* single ended capture only test */ +static void test_capture(struct bat *bat) +{ + pthread_t capture_id; + int err; + int *thread_result; + + /* start capture */ + err = pthread_create(&capture_id, NULL, (void *) bat->capture.fct, bat); + if (err != 0) { + fprintf(bat->err, _("Cannot create capture thread: %d\n"), err); + exit(EXIT_FAILURE); + } + + /* TODO: stop capture */ + + /* wait for capture to complete */ + err = thread_wait_completion(bat, capture_id, &thread_result); + if (err != 0) { + fprintf(bat->err, _("Cannot join capture thread: %d\n"), err); + free(thread_result); + exit(EXIT_FAILURE); + } + + /* check playback status */ + if (*thread_result != 0) { + fprintf(bat->err, _("Exit capture thread fail: %d\n"), + *thread_result); + exit(EXIT_FAILURE); + } else { + fprintf(bat->log, _("Capture completed.\n")); + } +} + +static void usage(struct bat *bat) +{ + fprintf(bat->log, +_("Usage: alsabat [-options]...\n" +"\n" +" -h, --help this help\n" +" -D pcm device for both playback and capture\n" +" -P pcm device for playback\n" +" -C pcm device for capture\n" +" -f sample format\n" +" -c number of channels\n" +" -r sampling rate\n" +" -n frames to playback or capture\n" +" -k parameter for frequency detecting threshold\n" +" -F target frequency\n" +" -p total number of periods to play/capture\n" +" -B buffer size in frames\n" +" -E period size in frames\n" +" --log=# file that both stdout and strerr redirecting to\n" +" --file=# file for playback\n" +" --saveplay=# file that storing playback content, for debug\n" +" --local internal loop, set to bypass pcm hardware devices\n" +" --standalone standalone mode, to bypass analysis\n" +" --roundtriplatency round trip latency mode\n" +" --snr-db=# noise detect threshold, in SNR(dB)\n" +" --snr-pc=# noise detect threshold, in noise percentage(%%)\n" +)); + fprintf(bat->log, _("Recognized sample formats are: ")); + fprintf(bat->log, _("U8 S16_LE S24_3LE S32_LE\n")); + fprintf(bat->log, _("The available format shotcuts are:\n")); + fprintf(bat->log, _("-f cd (16 bit little endian, 44100, stereo)\n")); + fprintf(bat->log, _("-f dat (16 bit little endian, 48000, stereo)\n")); +} + +static void set_defaults(struct bat *bat) +{ + memset(bat, 0, sizeof(struct bat)); + + /* Set default values */ + bat->rate = 44100; + bat->frame_size = 2; + bat->sample_size = 2; + bat->format = BAT_PCM_FORMAT_S16_LE; + bat->convert_float_to_sample = convert_float_to_int16; + bat->convert_sample_to_float = convert_int16_to_float; + bat->frames = bat->rate * 2; + bat->target_freq[0] = 997.0; + bat->target_freq[1] = 997.0; + bat->sigma_k = 3.0; + bat->snr_thd_db = SNR_DB_INVALID; + bat->playback.device = NULL; + bat->capture.device = NULL; + bat->buf = NULL; + bat->local = false; + bat->buffer_size = 0; + bat->period_size = 0; + bat->roundtriplatency = false; +#ifdef HAVE_LIBTINYALSA + bat->channels = 2; + bat->playback.fct = &playback_tinyalsa; + bat->capture.fct = &record_tinyalsa; +#else + bat->channels = 1; + bat->playback.fct = &playback_alsa; + bat->capture.fct = &record_alsa; +#endif + bat->playback.mode = MODE_LOOPBACK; + bat->capture.mode = MODE_LOOPBACK; + bat->period_is_limited = false; + bat->log = stdout; + bat->err = stderr; +} + +static void parse_arguments(struct bat *bat, int argc, char *argv[]) +{ + int c, option_index, err; + static const char short_options[] = "D:P:C:f:n:F:c:r:s:k:p:B:E:lth"; + static const struct option long_options[] = { + {"help", 0, 0, 'h'}, + {"log", 1, 0, OPT_LOG}, + {"file", 1, 0, OPT_READFILE}, + {"saveplay", 1, 0, OPT_SAVEPLAY}, + {"local", 0, 0, OPT_LOCAL}, + {"standalone", 0, 0, OPT_STANDALONE}, + {"roundtriplatency", 0, 0, OPT_ROUNDTRIPLATENCY}, + {"snr-db", 1, 0, OPT_SNRTHD_DB}, + {"snr-pc", 1, 0, OPT_SNRTHD_PC}, + {0, 0, 0, 0} + }; + + while ((c = getopt_long(argc, argv, short_options, long_options, + &option_index)) != -1) { + switch (c) { + case OPT_LOG: + bat->logarg = optarg; + break; + case OPT_READFILE: + bat->playback.file = optarg; + break; + case OPT_SAVEPLAY: + bat->debugplay = optarg; + break; + case OPT_LOCAL: + bat->local = true; + break; + case OPT_STANDALONE: + bat->standalone = true; + break; + case OPT_ROUNDTRIPLATENCY: + bat->roundtriplatency = true; + break; + case OPT_SNRTHD_DB: + get_snr_thd_db(bat, optarg); + break; + case OPT_SNRTHD_PC: + get_snr_thd_pc(bat, optarg); + break; + case 'D': + if (bat->playback.device == NULL) + bat->playback.device = optarg; + if (bat->capture.device == NULL) + bat->capture.device = optarg; + break; + case 'P': + if (bat->capture.mode == MODE_SINGLE) + bat->capture.mode = MODE_LOOPBACK; + else + bat->playback.mode = MODE_SINGLE; + bat->playback.device = optarg; + break; + case 'C': + if (bat->playback.mode == MODE_SINGLE) + bat->playback.mode = MODE_LOOPBACK; + else + bat->capture.mode = MODE_SINGLE; + bat->capture.device = optarg; + break; + case 'n': + bat->narg = optarg; + break; + case 'F': + get_sine_frequencies(bat, optarg); + break; + case 'c': + bat->channels = atoi(optarg); + break; + case 'r': + bat->rate = atoi(optarg); + break; + case 'f': + get_format(bat, optarg); + break; + case 'k': + bat->sigma_k = atof(optarg); + break; + case 'p': + bat->periods_total = atoi(optarg); + bat->period_is_limited = true; + break; + case 'B': + err = atoi(optarg); + bat->buffer_size = err >= MIN_BUFFERSIZE + && err < MAX_BUFFERSIZE ? err : 0; + break; + case 'E': + err = atoi(optarg); + bat->period_size = err >= MIN_PERIODSIZE + && err < MAX_PERIODSIZE ? err : 0; + break; + case 'h': + default: + usage(bat); + exit(EXIT_SUCCESS); + } + } +} + +static int validate_options(struct bat *bat) +{ + int c; + float freq_low, freq_high; + + /* check if we have an input file for local mode */ + if ((bat->local == true) && (bat->capture.file == NULL)) { + fprintf(bat->err, _("no input file for local testing\n")); + return -EINVAL; + } + + /* check supported channels */ + if (bat->channels > MAX_CHANNELS || bat->channels < MIN_CHANNELS) { + fprintf(bat->err, _("%d channels not supported\n"), + bat->channels); + return -EINVAL; + } + + /* check single ended is in either playback or capture - not both */ + if ((bat->playback.mode == MODE_SINGLE) + && (bat->capture.mode == MODE_SINGLE)) { + fprintf(bat->err, _("single ended mode is simplex\n")); + return -EINVAL; + } + + /* check sine wave frequency range */ + freq_low = DC_THRESHOLD; + freq_high = bat->rate * RATE_FACTOR; + for (c = 0; c < bat->channels; c++) { + if (bat->target_freq[c] < freq_low + || bat->target_freq[c] > freq_high) { + fprintf(bat->err, _("sine wave frequency out of")); + fprintf(bat->err, _(" range: (%.1f, %.1f)\n"), + freq_low, freq_high); + return -EINVAL; + } + } + + return 0; +} + +static int bat_init(struct bat *bat) +{ + int err = 0; + int fd = 0; + char name[] = TEMP_RECORD_FILE_NAME; + + /* Determine logging to a file or stdout and stderr */ + if (bat->logarg) { + bat->log = NULL; + bat->log = fopen(bat->logarg, "wb"); + err = -errno; + if (bat->log == NULL) { + fprintf(bat->err, _("Cannot open file: %s %d\n"), + bat->logarg, err); + return err; + } + bat->err = bat->log; + } + + /* Determine duration of playback and/or capture */ + if (bat->narg) { + err = get_duration(bat); + if (err < 0) + return err; + } + + /* Set default playback and capture devices */ + if (bat->playback.device == NULL && bat->capture.device == NULL) + bat->playback.device = bat->capture.device = DEFAULT_DEV_NAME; + + /* Determine capture file */ + if (bat->local) { + bat->capture.file = bat->playback.file; + } else { + /* create temp file for sound record and analysis */ + fd = mkstemp(name); + err = -errno; + if (fd == -1) { + fprintf(bat->err, _("Fail to create record file: %d\n"), + err); + return err; + } + /* store file name which is dynamically created */ + bat->capture.file = strdup(name); + err = -errno; + if (bat->capture.file == NULL) + return err; + /* close temp file */ + close(fd); + } + + /* Initial for playback */ + if (bat->playback.file == NULL) { + /* No input file so we will generate our own sine wave */ + if (bat->frames) { + if (bat->playback.mode == MODE_SINGLE) { + /* Play nb of frames given by -n argument */ + bat->sinus_duration = bat->frames; + } else { + /* Play CAPTURE_DELAY msec + + * 150% of the nb of frames to be analyzed */ + bat->sinus_duration = bat->rate * + CAPTURE_DELAY / 1000; + bat->sinus_duration += + (bat->frames + bat->frames / 2); + } + } else { + /* Special case where we want to generate a sine wave + * endlessly without capturing */ + bat->sinus_duration = 0; + bat->playback.mode = MODE_SINGLE; + } + } else { + bat->fp = fopen(bat->playback.file, "rb"); + err = -errno; + if (bat->fp == NULL) { + fprintf(bat->err, _("Cannot open file: %s %d\n"), + bat->playback.file, err); + return err; + } + err = read_wav_header(bat, bat->playback.file, bat->fp, false); + fclose(bat->fp); + if (err != 0) + return err; + } + + bat->frame_size = bat->sample_size * bat->channels; + + /* Set conversion functions */ + switch (bat->sample_size) { + case 1: + bat->convert_float_to_sample = convert_float_to_uint8; + bat->convert_sample_to_float = convert_uint8_to_float; + break; + case 2: + bat->convert_float_to_sample = convert_float_to_int16; + bat->convert_sample_to_float = convert_int16_to_float; + break; + case 3: + bat->convert_float_to_sample = convert_float_to_int24; + bat->convert_sample_to_float = convert_int24_to_float; + break; + case 4: + bat->convert_float_to_sample = convert_float_to_int32; + bat->convert_sample_to_float = convert_int32_to_float; + break; + default: + fprintf(bat->err, _("Invalid PCM format: size=%d\n"), + bat->sample_size); + return -EINVAL; + } + + return err; +} + +int main(int argc, char *argv[]) +{ + struct bat bat; + int err = 0; + + set_defaults(&bat); + +#ifdef ENABLE_NLS + setlocale(LC_ALL, ""); + textdomain(PACKAGE); +#endif + + fprintf(bat.log, _("%s version %s\n\n"), PACKAGE_NAME, PACKAGE_VERSION); + + parse_arguments(&bat, argc, argv); + + err = bat_init(&bat); + if (err < 0) + goto out; + + err = validate_options(&bat); + if (err < 0) + goto out; + + /* round trip latency test thread */ + if (bat.roundtriplatency) { + while (1) { + fprintf(bat.log, + _("\nStart round trip latency\n")); + roundtrip_latency_init(&bat); + test_loopback(&bat); + + if (bat.latency.xrun_error == false) + break; + else { + /* Xrun error in playback or capture, + increase period size and try again */ + bat.period_size += bat.rate / 1000; + bat.buffer_size = + bat.period_size * DIV_BUFFERSIZE; + + /* terminate the test if period_size is + large enough */ + if (bat.period_size > bat.rate * 0.2) + break; + } + + /* Waiting 500ms and start the next round */ + usleep(CAPTURE_DELAY * 1000); + } + goto out; + } + + /* single line playback thread: playback only, no capture */ + if (bat.playback.mode == MODE_SINGLE) { + test_playback(&bat); + goto out; + } + + /* single line capture thread: capture only, no playback */ + if (bat.capture.mode == MODE_SINGLE) { + test_capture(&bat); + goto analyze; + } + + /* loopback thread: playback and capture in a loop */ + if (bat.local == false) + test_loopback(&bat); + +analyze: +#ifdef HAVE_LIBFFTW3F + if (!bat.standalone || snr_is_valid(bat.snr_thd_db)) + err = analyze_capture(&bat); +#else + fprintf(bat.log, _("No libfftw3 library. Exit without analysis.\n")); +#endif +out: + fprintf(bat.log, _("\nReturn value is %d\n"), err); + + if (bat.logarg) + fclose(bat.log); + if (!bat.local) + free(bat.capture.file); + + return err; +} diff --git a/bat/common.c b/bat/common.c new file mode 100644 index 0000000..339e749 --- /dev/null +++ b/bat/common.c @@ -0,0 +1,265 @@ +/* + * Copyright (C) 2013-2015 Intel Corporation + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + */ + +#include +#include +#include +#include +#include + +#include "aconfig.h" +#include "gettext.h" + +#include "common.h" +#include "alsa.h" +#include "bat-signal.h" + +int retval_play; +int retval_record; + +/* update chunk_fmt data to bat */ +static int update_fmt_to_bat(struct bat *bat, struct chunk_fmt *fmt) +{ + bat->channels = fmt->channels; + bat->rate = fmt->sample_rate; + bat->sample_size = fmt->sample_length / 8; + if (bat->sample_size > 4) { + fprintf(bat->err, _("Invalid format: sample size=%d\n"), + bat->sample_size); + return -EINVAL; + } + bat->frame_size = fmt->blocks_align; + + return 0; +} + +/* calculate frames and update to bat */ +static int update_frames_to_bat(struct bat *bat, + struct wav_chunk_header *header, FILE *fp) +{ + /* The number of analyzed captured frames is arbitrarily set to half of + the number of frames of the wav file or the number of frames of the + wav file when doing direct analysis (--local) */ + bat->frames = header->length / bat->frame_size; + if (!bat->local) + bat->frames /= 2; + + return 0; +} + +static int read_chunk_fmt(struct bat *bat, char *file, FILE *fp, bool skip, + struct wav_chunk_header *header) +{ + size_t err; + int header_skip; + struct chunk_fmt chunk_fmt; + + err = fread(&chunk_fmt, sizeof(chunk_fmt), 1, fp); + if (err != 1) { + fprintf(bat->err, _("Read chunk fmt error: %s:%zd\n"), + file, err); + return -EIO; + } + /* If the format header is larger, skip the rest */ + header_skip = header->length - sizeof(chunk_fmt); + if (header_skip > 0) { + err = fseek(fp, header_skip, SEEK_CUR); + if (err == -1) { + fprintf(bat->err, _("Seek fmt header error: %s:%zd\n"), + file, err); + return -EINVAL; + } + } + /* If the file is opened for playback, update BAT data; + If the file is opened for analysis, no update */ + if (skip == false) { + err = update_fmt_to_bat(bat, &chunk_fmt); + if (err != 0) + return err; + } + + return 0; +} + +int read_wav_header(struct bat *bat, char *file, FILE *fp, bool skip) +{ + struct wav_header riff_wave_header; + struct wav_chunk_header chunk_header; + int more_chunks = 1; + size_t err; + + /* Read header of RIFF wav file */ + err = fread(&riff_wave_header, sizeof(riff_wave_header), 1, fp); + if (err != 1) { + fprintf(bat->err, _("Read header error: %s:%zd\n"), file, err); + return -EIO; + } + if ((riff_wave_header.magic != WAV_RIFF) + || (riff_wave_header.type != WAV_WAVE)) { + fprintf(bat->err, _("%s is not a riff/wave file\n"), file); + return -EINVAL; + } + + /* Read chunks in RIFF wav file */ + do { + err = fread(&chunk_header, sizeof(chunk_header), 1, fp); + if (err != 1) { + fprintf(bat->err, _("Read chunk header error: ")); + fprintf(bat->err, _("%s:%zd\n"), file, err); + return -EIO; + } + + switch (chunk_header.type) { + case WAV_FMT: + /* WAV_FMT chunk, read and analyze */ + err = read_chunk_fmt(bat, file, fp, skip, + &chunk_header); + if (err != 0) + return err; + break; + case WAV_DATA: + /* WAV_DATA chunk, break looping */ + /* If the file is opened for playback, update BAT data; + If the file is opened for analysis, no update */ + if (skip == false) { + err = update_frames_to_bat(bat, &chunk_header, + fp); + if (err != 0) + return err; + } + /* Stop looking for chunks */ + more_chunks = 0; + break; + default: + /* Unknown chunk, skip bytes */ + err = fseek(fp, chunk_header.length, SEEK_CUR); + if (err == -1) { + fprintf(bat->err, _("Fail to skip unknown")); + fprintf(bat->err, _(" chunk of %s:%zd\n"), + file, err); + return -EINVAL; + } + } + } while (more_chunks); + + return 0; +} + +void prepare_wav_info(struct wav_container *wav, struct bat *bat) +{ + wav->header.magic = WAV_RIFF; + wav->header.type = WAV_WAVE; + wav->format.magic = WAV_FMT; + wav->format.fmt_size = 16; + wav->format.format = WAV_FORMAT_PCM; + wav->format.channels = bat->channels; + wav->format.sample_rate = bat->rate; + wav->format.sample_length = bat->sample_size * 8; + wav->format.blocks_align = bat->channels * bat->sample_size; + wav->format.bytes_p_second = wav->format.blocks_align * bat->rate; + wav->chunk.length = bat->frames * bat->frame_size; + wav->chunk.type = WAV_DATA; + wav->header.length = (wav->chunk.length) + sizeof(wav->chunk) + + sizeof(wav->format) + sizeof(wav->header) - 8; +} + +int write_wav_header(FILE *fp, struct wav_container *wav, struct bat *bat) +{ + int err = 0; + + err = fwrite(&wav->header, 1, sizeof(wav->header), fp); + if (err != sizeof(wav->header)) { + fprintf(bat->err, _("Write file error: header %d\n"), err); + return -EIO; + } + err = fwrite(&wav->format, 1, sizeof(wav->format), fp); + if (err != sizeof(wav->format)) { + fprintf(bat->err, _("Write file error: format %d\n"), err); + return -EIO; + } + err = fwrite(&wav->chunk, 1, sizeof(wav->chunk), fp); + if (err != sizeof(wav->chunk)) { + fprintf(bat->err, _("Write file error: chunk %d\n"), err); + return -EIO; + } + + return 0; +} + +/* update wav header when data size changed */ +int update_wav_header(struct bat *bat, FILE *fp, int bytes) +{ + int err = 0; + struct wav_container wav; + + prepare_wav_info(&wav, bat); + wav.chunk.length = bytes; + wav.header.length = (wav.chunk.length) + sizeof(wav.chunk) + + sizeof(wav.format) + sizeof(wav.header) - 8; + rewind(fp); + err = write_wav_header(fp, &wav, bat); + + return err; +} + +/* + * Generate buffer to be played either from input file or from generated data + * Return value + * <0 error + * 0 ok + * >0 break + */ +int generate_input_data(struct bat *bat, void *buffer, int bytes, int frames) +{ + int err; + static int load; + + if (bat->playback.file != NULL) { + /* From input file */ + load = 0; + + while (1) { + err = fread((char *)buffer + load, 1, bytes - load, bat->fp); + if (0 == err) { + if (feof(bat->fp)) { + fprintf(bat->log, + _("End of playing.\n")); + return 1; + } + } else if (err < bytes - load) { + if (ferror(bat->fp)) { + fprintf(bat->err, _("Read file error")); + fprintf(bat->err, _(": %d\n"), err); + return -EIO; + } + load += err; + } else { + break; + } + } + } else { + /* Generate sine wave */ + if ((bat->sinus_duration) && (load > bat->sinus_duration)) + return 1; + + err = generate_sine_wave(bat, frames, buffer); + if (err != 0) + return err; + + load += frames; + } + + return 0; +} diff --git a/bat/common.h b/bat/common.h new file mode 100644 index 0000000..1b07fbe --- /dev/null +++ b/bat/common.h @@ -0,0 +1,261 @@ +/* + * Copyright (C) 2013-2015 Intel Corporation + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + */ + +#define TEMP_RECORD_FILE_NAME "/tmp/bat.wav.XXXXXX" +#define DEFAULT_DEV_NAME "default" + +#define OPT_BASE 300 +#define OPT_LOG (OPT_BASE + 1) +#define OPT_READFILE (OPT_BASE + 2) +#define OPT_SAVEPLAY (OPT_BASE + 3) +#define OPT_LOCAL (OPT_BASE + 4) +#define OPT_STANDALONE (OPT_BASE + 5) +#define OPT_ROUNDTRIPLATENCY (OPT_BASE + 6) +#define OPT_SNRTHD_DB (OPT_BASE + 7) +#define OPT_SNRTHD_PC (OPT_BASE + 8) + +#define COMPOSE(a, b, c, d) ((a) | ((b)<<8) | ((c)<<16) | ((d)<<24)) +#define WAV_RIFF COMPOSE('R', 'I', 'F', 'F') +#define WAV_WAVE COMPOSE('W', 'A', 'V', 'E') +#define WAV_FMT COMPOSE('f', 'm', 't', ' ') +#define WAV_DATA COMPOSE('d', 'a', 't', 'a') +#define WAV_FORMAT_PCM 1 /* PCM WAVE file encoding */ + +#define MAX_CHANNELS 2 +#define MIN_CHANNELS 1 +#define MAX_PEAKS 10 +#define MAX_FRAMES (10 * 1024 * 1024) +/* Given in ms */ +#define CAPTURE_DELAY 500 +/* signal frequency should be less than samplerate * RATE_FACTOR */ +#define RATE_FACTOR 0.4 +/* valid range of samplerate: (1 - RATE_RANGE, 1 + RATE_RANGE) * samplerate */ +#define RATE_RANGE 0.05 +/* Given in us */ +#define MAX_BUFFERTIME 500000 +/* devide factor, was 4, changed to 8 to remove reduce capture overrun */ +#define DIV_BUFFERTIME 8 +/* margin to avoid sign inversion when generate sine wav */ +#define RANGE_FACTOR 0.95 +#define MAX_BUFFERSIZE 200000 +#define MIN_BUFFERSIZE 32 +#define MAX_PERIODSIZE 200000 +#define MIN_PERIODSIZE 32 +/* default period size for tinyalsa */ +#define TINYALSA_PERIODSIZE 1024 + +#define LATENCY_TEST_NUMBER 5 +#define LATENCY_TEST_TIME_LIMIT 25 +#define DIV_BUFFERSIZE 2 + +#define EBATBASE 1000 +#define ENOPEAK (EBATBASE + 1) +#define EONLYDC (EBATBASE + 2) +#define EBADPEAK (EBATBASE + 3) + +#define DC_THRESHOLD 7.01 + +/* tolerance of detected peak = max (DELTA_HZ, DELTA_RATE * target_freq). + * If DELTA_RATE is too high, BAT may not be able to recognize negative result; + * if too low, BAT may be too sensitive and results in uncecessary failure. */ +#define DELTA_RATE 0.005 +#define DELTA_HZ 1 + +#define FOUND_DC (1<<1) +#define FOUND_WRONG_PEAK (1<<0) + +/* Truncate sample frames to (1 << N), for faster FFT analysis process. The + * valid range of N is (SHIFT_MIN, SHIFT_MAX). When N increases, the analysis + * will be more time-consuming, and the result will be more accurate. */ +#define SHIFT_MAX (sizeof(int) * 8 - 2) +#define SHIFT_MIN 8 + +/* Define SNR range in dB. + * if the noise is equal to signal, SNR = 0.0dB; + * if the noise is zero, SNR is limited by RIFF wav data width: + * 8 bit --> 20.0 * log10f (powf(2.0, 8.0)) = 48.16 dB + * 16 bit --> 20.0 * log10f (powf(2.0, 16.0)) = 96.33 dB + * 24 bit --> 20.0 * log10f (powf(2.0, 24.0)) = 144.49 dB + * 32 bit --> 20.0 * log10f (powf(2.0, 32.0)) = 192.66 dB + * so define the SNR range (0.0, 200.0) dB, value out of range is invalid. */ +#define SNR_DB_INVALID -1.0 +#define SNR_DB_MIN 0.0 +#define SNR_DB_MAX 200.0 + +static inline bool snr_is_valid(float db) +{ + return (db > SNR_DB_MIN && db < SNR_DB_MAX); +} + +struct wav_header { + unsigned int magic; /* 'RIFF' */ + unsigned int length; /* file len */ + unsigned int type; /* 'WAVE' */ +}; + +struct wav_chunk_header { + unsigned int type; /* 'data' */ + unsigned int length; /* sample count */ +}; + +struct wav_fmt { + unsigned int magic; /* 'FMT '*/ + unsigned int fmt_size; /* 16 or 18 */ + unsigned short format; /* see WAV_FMT_* */ + unsigned short channels; + unsigned int sample_rate; /* Frequency of sample */ + unsigned int bytes_p_second; + unsigned short blocks_align; /* sample size; 1 or 2 bytes */ + unsigned short sample_length; /* 8, 12 or 16 bit */ +}; + +struct chunk_fmt { + unsigned short format; /* see WAV_FMT_* */ + unsigned short channels; + unsigned int sample_rate; /* Frequency of sample */ + unsigned int bytes_p_second; + unsigned short blocks_align; /* sample size; 1 or 2 bytes */ + unsigned short sample_length; /* 8, 12 or 16 bit */ +}; + +struct wav_container { + struct wav_header header; + struct wav_fmt format; + struct wav_chunk_header chunk; +}; + +struct bat; + +enum _bat_pcm_format { + BAT_PCM_FORMAT_UNKNOWN = -1, + BAT_PCM_FORMAT_S16_LE = 0, + BAT_PCM_FORMAT_S32_LE, + BAT_PCM_FORMAT_U8, + BAT_PCM_FORMAT_S24_3LE, + BAT_PCM_FORMAT_MAX +}; + +enum _bat_op_mode { + MODE_UNKNOWN = -1, + MODE_SINGLE = 0, + MODE_LOOPBACK, + MODE_LAST +}; + +enum latency_state { + LATENCY_STATE_COMPLETE_FAILURE = -1, + LATENCY_STATE_COMPLETE_SUCCESS = 0, + LATENCY_STATE_MEASURE_FOR_1_SECOND, + LATENCY_STATE_PLAY_AND_LISTEN, + LATENCY_STATE_WAITING, +}; + +struct pcm { + unsigned int card_tiny; + unsigned int device_tiny; + char *device; + char *file; + enum _bat_op_mode mode; + void *(*fct)(struct bat *); +}; + +struct sin_generator; + +struct sin_generator { + double state_real; + double state_imag; + double phasor_real; + double phasor_imag; + float frequency; + float sample_rate; + float magnitude; +}; + +struct roundtrip_latency { + int number; + enum latency_state state; + float result[LATENCY_TEST_NUMBER]; + int final_result; + int samples; + float sum; + int threshold; + int error; + bool is_capturing; + bool is_playing; + bool xrun_error; +}; + +struct noise_analyzer { + int nsamples; /* number of sample */ + float *source; /* single-tone to be analyzed */ + float *target; /* target single-tone as standard */ + float rms_tgt; /* rms of target single-tone */ + float snr_db; /* snr in dB */ +}; + +struct bat { + unsigned int rate; /* sampling rate */ + int channels; /* nb of channels */ + int frames; /* nb of frames */ + int frame_size; /* size of frame */ + int sample_size; /* size of sample */ + enum _bat_pcm_format format; /* PCM format */ + int buffer_size; /* buffer size in frames */ + int period_size; /* period size in frames */ + + float sigma_k; /* threshold for peak detection */ + float snr_thd_db; /* threshold for noise detection (dB) */ + float target_freq[MAX_CHANNELS]; + + int sinus_duration; /* number of frames for playback */ + char *narg; /* argument string of duration */ + char *logarg; /* path name of log file */ + char *debugplay; /* path name to store playback signal */ + bool standalone; /* enable to bypass analysis */ + bool roundtriplatency; /* enable round trip latency */ + + struct pcm playback; + struct pcm capture; + struct roundtrip_latency latency; + + unsigned int periods_played; + unsigned int periods_total; + bool period_is_limited; + + FILE *fp; + + FILE *log; + FILE *err; + + void (*convert_sample_to_float)(void *, float *, int); + void (*convert_float_to_sample)(float *, void *, int, int); + + void *buf; /* PCM Buffer */ + + bool local; /* true for internal test */ +}; + +struct analyze { + void *buf; + float *in; + float *out; + float *mag; +}; + +void prepare_wav_info(struct wav_container *, struct bat *); +int read_wav_header(struct bat *, char *, FILE *, bool); +int write_wav_header(FILE *, struct wav_container *, struct bat *); +int update_wav_header(struct bat *, FILE *, int); +int generate_input_data(struct bat *, void *, int, int); diff --git a/bat/convert.c b/bat/convert.c new file mode 100644 index 0000000..f555389 --- /dev/null +++ b/bat/convert.c @@ -0,0 +1,113 @@ +/* + * Copyright (C) 2013-2015 Intel Corporation + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + */ + +#include +#include +#include +#include + +void convert_uint8_to_float(void *buf, float *val, int samples) +{ + int i; + + for (i = 0; i < samples; i++) + val[i] = ((uint8_t *) buf)[i]; +} + +void convert_int16_to_float(void *buf, float *val, int samples) +{ + int i; + + for (i = 0; i < samples; i++) + val[i] = ((int16_t *) buf)[i]; +} + +void convert_int24_to_float(void *buf, float *val, int samples) +{ + int i; + int32_t tmp; + + for (i = 0; i < samples; i++) { + tmp = ((uint8_t *) buf)[i * 3 + 2] << 24; + tmp |= ((uint8_t *) buf)[i * 3 + 1] << 16; + tmp |= ((uint8_t *) buf)[i * 3] << 8; + tmp >>= 8; + val[i] = tmp; + } +} + +void convert_int32_to_float(void *buf, float *val, int samples) +{ + int i; + + for (i = 0; i < samples; i++) + val[i] = ((int32_t *) buf)[i]; +} + +void convert_float_to_uint8(float *val, void *buf, int samples, int channels) +{ + int i, c, idx; + + for (i = 0; i < samples; i++) { + for (c = 0; c < channels; c++) { + idx = i * channels + c; + ((uint8_t *) buf)[idx] = (uint8_t) val[idx]; + } + } +} + +void convert_float_to_int16(float *val, void *buf, int samples, int channels) +{ + int i, c, idx; + + for (i = 0; i < samples; i++) { + for (c = 0; c < channels; c++) { + idx = i * channels + c; + ((int16_t *) buf)[idx] = (int16_t) val[idx]; + } + } +} + +void convert_float_to_int24(float *val, void *buf, int samples, int channels) +{ + int i, c, idx_f, idx_i; + int32_t val_f_i; + + for (i = 0; i < samples; i++) { + for (c = 0; c < channels; c++) { + idx_f = i * channels + c; + idx_i = 3 * idx_f; + val_f_i = (int32_t) val[idx_f]; + ((int8_t *) buf)[idx_i + 0] = + (int8_t) (val_f_i & 0xff); + ((int8_t *) buf)[idx_i + 1] = + (int8_t) ((val_f_i >> 8) & 0xff); + ((int8_t *) buf)[idx_i + 2] = + (int8_t) ((val_f_i >> 16) & 0xff); + } + } +} + +void convert_float_to_int32(float *val, void *buf, int samples, int channels) +{ + int i, c, idx; + + for (i = 0; i < samples; i++) { + for (c = 0; c < channels; c++) { + idx = i * channels + c; + ((int32_t *) buf)[idx] = (int32_t) val[idx]; + } + } +} diff --git a/bat/convert.h b/bat/convert.h new file mode 100644 index 0000000..699c07a --- /dev/null +++ b/bat/convert.h @@ -0,0 +1,23 @@ +/* + * Copyright (C) 2013-2015 Intel Corporation + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + */ + +void convert_uint8_to_float(void *, float *, int); +void convert_int16_to_float(void *, float *, int); +void convert_int24_to_float(void *, float *, int); +void convert_int32_to_float(void *, float *, int); +void convert_float_to_uint8(float *, void *, int, int); +void convert_float_to_int16(float *, void *, int, int); +void convert_float_to_int24(float *, void *, int, int); +void convert_float_to_int32(float *, void *, int, int); diff --git a/bat/latencytest.c b/bat/latencytest.c new file mode 100644 index 0000000..ec3abe2 --- /dev/null +++ b/bat/latencytest.c @@ -0,0 +1,241 @@ +/* + * Copyright (C) 2013-2015 Intel Corporation + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + */ + +#include +#include +#include +#include +#include + +#include "common.h" +#include "bat-signal.h" +#include "gettext.h" + +/* How one measurement step works: + - Listen and measure the average loudness of the environment for 1 second. + - Create a threshold value 16 decibels higher than the average loudness. + - Begin playing a ~1000 Hz sine wave and start counting the samples elapsed. + - Stop counting and playing if the input's loudness is higher than the + threshold, as the output wave is probably coming back. + - Calculate the round trip audio latency value in milliseconds. */ + +static float sumaudio(struct bat *bat, short int *buffer, int frames) +{ + float sum = 0; + int n = 0; + + while (frames) { + frames--; + + for (n = 0; n < bat->channels; n++) { + sum += abs(buffer[0]); + buffer++; + } + } + + sum = sum / bat->channels; + + return sum; +} + +static void play_and_listen(struct bat *bat, void *buffer, int frames) +{ + int averageinput; + int n = 0; + float sum = 0; + float max = 0; + float min = 100000.0f; + short int *input; + int num = bat->latency.number; + + averageinput = (int) (sumaudio(bat, buffer, frames) / frames); + + /* The signal is above threshold + So our sine wave comes back on the input */ + if (averageinput > bat->latency.threshold) { + input = buffer; + + /* Check the location when it became loud enough */ + while (n < frames) { + if (*input++ > bat->latency.threshold) + break; + *input += bat->channels; + n++; + } + + /* Now we get the total round trip latency*/ + bat->latency.samples += n; + + /* Expect at least 1 buffer of round trip latency. */ + if (bat->latency.samples > frames) { + bat->latency.result[num - 1] = + (float) bat->latency.samples * 1000 / bat->rate; + fprintf(bat->log, + _("Test%d, round trip latency %dms\n"), + num, + (int) bat->latency.result[num - 1]); + + for (n = 0; n < num; n++) { + if (bat->latency.result[n] > max) + max = bat->latency.result[n]; + if (bat->latency.result[n] < min) + min = bat->latency.result[n]; + sum += bat->latency.result[n]; + } + + /* The maximum is higher than the minimum's double */ + if (max / min > 2.0f) { + bat->latency.state = + LATENCY_STATE_COMPLETE_FAILURE; + bat->latency.is_capturing = false; + return; + + /* Final results */ + } else if (num == LATENCY_TEST_NUMBER) { + bat->latency.final_result = + (int) (sum / LATENCY_TEST_NUMBER); + fprintf(bat->log, + _("Final round trip latency: %dms\n"), + bat->latency.final_result); + + bat->latency.state = + LATENCY_STATE_COMPLETE_SUCCESS; + bat->latency.is_capturing = false; + return; + + /* Next step */ + } else + bat->latency.state = LATENCY_STATE_WAITING; + + bat->latency.number++; + + } else + /* Happens when an early noise comes in */ + bat->latency.state = LATENCY_STATE_WAITING; + + } else { + /* Still listening */ + bat->latency.samples += frames; + + /* Do not listen to more than a second + Maybe too much background noise */ + if (bat->latency.samples > bat->rate) { + bat->latency.error++; + + if (bat->latency.error > LATENCY_TEST_NUMBER) { + fprintf(bat->err, + _("Could not detect signal.")); + fprintf(bat->err, + _("Too much background noise?\n")); + bat->latency.state = + LATENCY_STATE_COMPLETE_FAILURE; + bat->latency.is_capturing = false; + return; + } + + /* let's start over */ + bat->latency.state = LATENCY_STATE_WAITING; + } + } + + return; +} + +static void calculate_threshold(struct bat *bat) +{ + float average; + float reference; + + /* Calculate the average loudness of the environment and create + a threshold value 16 decibels higher than the average loudness */ + average = bat->latency.sum / bat->latency.samples / 32767.0f; + reference = 20.0f * log10f(average) + 16.0f; + bat->latency.threshold = (int) (powf(10.0f, reference / 20.0f) + * 32767.0f); +} + +void roundtrip_latency_init(struct bat *bat) +{ + bat->latency.number = 1; + bat->latency.state = LATENCY_STATE_MEASURE_FOR_1_SECOND; + bat->latency.final_result = 0; + bat->latency.samples = 0; + bat->latency.sum = 0; + bat->latency.threshold = 0; + bat->latency.is_capturing = false; + bat->latency.is_playing = false; + bat->latency.error = 0; + bat->latency.xrun_error = false; + bat->frames = LATENCY_TEST_TIME_LIMIT * bat->rate; + bat->periods_played = 0; +} + +int handleinput(struct bat *bat, void *buffer, int frames) +{ + switch (bat->latency.state) { + /* Measuring average loudness for 1 second */ + case LATENCY_STATE_MEASURE_FOR_1_SECOND: + bat->latency.sum += sumaudio(bat, buffer, frames); + bat->latency.samples += frames; + + /* 1 second elapsed */ + if (bat->latency.samples >= bat->rate) { + calculate_threshold(bat); + bat->latency.state = LATENCY_STATE_PLAY_AND_LISTEN; + bat->latency.samples = 0; + bat->latency.sum = 0; + } + break; + + /* Playing sine wave and listening if it comes back */ + case LATENCY_STATE_PLAY_AND_LISTEN: + play_and_listen(bat, buffer, frames); + break; + + /* Waiting 1 second */ + case LATENCY_STATE_WAITING: + bat->latency.samples += frames; + + if (bat->latency.samples > bat->rate) { + /* 1 second elapsed, start over */ + bat->latency.samples = 0; + bat->latency.state = LATENCY_STATE_MEASURE_FOR_1_SECOND; + } + break; + + default: + return 0; + } + + return 0; +} + +int handleoutput(struct bat *bat, void *buffer, int bytes, int frames) +{ + int err = 0; + + /* If capture completed, terminate the playback */ + if (bat->periods_played * frames > 2 * bat->rate + && bat->latency.is_capturing == false) + return bat->latency.state; + + if (bat->latency.state == LATENCY_STATE_PLAY_AND_LISTEN) + err = generate_sine_wave(bat, frames, buffer); + else + /* Output silence */ + memset(buffer, 0, bytes); + + return err; +} diff --git a/bat/latencytest.h b/bat/latencytest.h new file mode 100644 index 0000000..be5e661 --- /dev/null +++ b/bat/latencytest.h @@ -0,0 +1,17 @@ +/* + * Copyright (C) 2013-2015 Intel Corporation + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + */ +void roundtrip_latency_init(struct bat *); +int handleinput(struct bat *, void *, int); +int handleoutput(struct bat *, void *, int, int); diff --git a/bat/signal.c b/bat/signal.c new file mode 100644 index 0000000..c9b5c7b --- /dev/null +++ b/bat/signal.c @@ -0,0 +1,203 @@ +/* + * Copyright (C) 2015 Caleb Crome + * Copyright (C) 2013-2015 Intel Corporation + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + */ + +/* + * This is a general purpose sine wave generator that will stay stable + * for a long time, and with a little renormalization, could stay stay + * stable indefinitely + */ + +#include +#include +#include +#include +#include +#include +#include +#include + +#include "gettext.h" +#include "common.h" +#include "signal.h" + +/* + * Initialize the sine wave generator. + * sin_generator: gets initialized by this call. + * frequency: the frequency for the sine wave. must be < 0.5*sample_rate + * sample_rate: the sample rate... + * returns 0 on success, -1 on error. + */ +int sin_generator_init(struct sin_generator *sg, float magnitude, + float frequency, float sample_rate) +{ + /* angular frequency: cycles/sec / (samp/sec) * rad/cycle = rad/samp */ + float w = frequency / sample_rate * 2 * M_PI; + if (frequency >= sample_rate / 2) + return -1; + sg->phasor_real = cos(w); + sg->phasor_imag = sin(w); + sg->magnitude = magnitude; + sg->state_real = 0.0; + sg->state_imag = magnitude; + sg->frequency = frequency; + sg->sample_rate = sample_rate; + return 0; +} + +/* + * Generates the next sample in the sine wave. + * should be much faster than calling a sin function + * if it's inlined and optimized. + * + * returns the next value. no possibility of error. + */ +float sin_generator_next_sample(struct sin_generator *sg) +{ + /* get shorthand to pointers */ + const double pr = sg->phasor_real; + const double pi = sg->phasor_imag; + const double sr = sg->state_real; + const double si = sg->state_imag; + /* step the phasor -- complex multiply */ + sg->state_real = sr * pr - si * pi; + sg->state_imag = sr * pi + pr * si; + /* return the input value so sine wave starts at exactly 0.0 */ + return (float)sr; +} + +/* fills a vector with a sine wave */ +void sin_generator_vfill(struct sin_generator *sg, float *buf, int n) +{ + int i; + for (i = 0; i < n; i++) + *buf++ = sin_generator_next_sample(sg); +} + +static int reorder(struct bat *bat, float *val, int frames) +{ + float *new_buf = NULL; + int i, c, bytes; + + bytes = frames * bat->channels * sizeof(float); + + new_buf = (float *) malloc(bytes); + if (new_buf == NULL) { + fprintf(bat->err, _("Not enough memory.\n")); + return -ENOMEM; + } + + memcpy(new_buf, val, bytes); + for (i = 0; i < frames; i++) + for (c = 0; c < bat->channels; c++) + val[i * bat->channels + c] = + new_buf[c * frames + i]; + free(new_buf); + + return 0; +} + +static int adjust_waveform(struct bat *bat, float *val, int frames, + int channels) +{ + int i, nsamples, max; + float factor, offset = 0.0; + + switch (bat->format) { + case BAT_PCM_FORMAT_U8: + max = INT8_MAX; + offset = max; /* shift for unsigned format */ + break; + case BAT_PCM_FORMAT_S16_LE: + max = INT16_MAX; + break; + case BAT_PCM_FORMAT_S24_3LE: + max = (1 << 23) - 1; + break; + case BAT_PCM_FORMAT_S32_LE: + max = INT32_MAX; + break; + default: + fprintf(bat->err, _("Invalid PCM format: %d\n"), bat->format); + return -EINVAL; + } + + factor = max * RANGE_FACTOR; + nsamples = channels * frames; + + for (i = 0; i < nsamples; i++) + val[i] = val[i] * factor + offset; + + return 0; +} + +int generate_sine_wave(struct bat *bat, int frames, void *buf) +{ + int err = 0; + int c, nsamples; + float *sinus_f = NULL; + static struct sin_generator sg[MAX_CHANNELS]; + + nsamples = bat->channels * frames; + sinus_f = (float *) malloc(nsamples * sizeof(float)); + if (sinus_f == NULL) { + fprintf(bat->err, _("Not enough memory.\n")); + return -ENOMEM; + } + + for (c = 0; c < bat->channels; c++) { + /* initialize static struct at the first time */ + if (sg[c].frequency != bat->target_freq[c]) + sin_generator_init(&sg[c], 1.0, bat->target_freq[c], + bat->rate); + /* fill buffer for each channel */ + sin_generator_vfill(&sg[c], sinus_f + c * frames, frames); + } + + /* reorder samples to interleaved mode */ + err = reorder(bat, sinus_f, frames); + if (err != 0) + goto exit; + + /* adjust amplitude and offset of waveform */ + err = adjust_waveform(bat, sinus_f, frames, bat->channels); + if (err != 0) + goto exit; + + bat->convert_float_to_sample(sinus_f, buf, frames, bat->channels); + +exit: + free(sinus_f); + + return err; +} + +/* generate single channel sine waveform without sample conversion */ +int generate_sine_wave_raw_mono(struct bat *bat, float *buf, + float freq, int nsamples) +{ + int err = 0; + struct sin_generator sg; + + err = sin_generator_init(&sg, 1.0, freq, bat->rate); + if (err < 0) + return err; + sin_generator_vfill(&sg, buf, nsamples); + + /* adjust amplitude and offset of waveform */ + err = adjust_waveform(bat, buf, nsamples, 1); + + return err; +} diff --git a/bat/tests/Makefile.am b/bat/tests/Makefile.am new file mode 100644 index 0000000..d20eb3c --- /dev/null +++ b/bat/tests/Makefile.am @@ -0,0 +1,11 @@ +SUBDIRS=asound_state +alsabat_script_files = analog_audio_playback_and_capture.sh \ + dp_audio_playback.sh \ + dp_audio_subdevice_number.sh \ + hdmi_audio_playback.sh \ + hdmi_audio_subdevice_number.sh \ + map_test_case \ + README + +EXTRA_DIST = \ + $(alsabat_script_files) diff --git a/bat/tests/Makefile.in b/bat/tests/Makefile.in new file mode 100644 index 0000000..8361af1 --- /dev/null +++ b/bat/tests/Makefile.in @@ -0,0 +1,659 @@ +# Makefile.in generated by automake 1.16.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994-2018 Free Software Foundation, Inc. + +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ +VPATH = @srcdir@ +am__is_gnu_make = { \ + if test -z '$(MAKELEVEL)'; then \ + false; \ + elif test -n '$(MAKE_HOST)'; then \ + true; \ + elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ + true; \ + else \ + false; \ + fi; \ +} +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + esac; \ + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +subdir = bat/tests +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/gettext.m4 \ + $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/lib-ld.m4 \ + $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ + $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \ + $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/acinclude.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/include/aconfig.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = +SOURCES = +DIST_SOURCES = +RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \ + ctags-recursive dvi-recursive html-recursive info-recursive \ + install-data-recursive install-dvi-recursive \ + install-exec-recursive install-html-recursive \ + install-info-recursive install-pdf-recursive \ + install-ps-recursive install-recursive installcheck-recursive \ + installdirs-recursive pdf-recursive ps-recursive \ + tags-recursive uninstall-recursive +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ + distclean-recursive maintainer-clean-recursive +am__recursive_targets = \ + $(RECURSIVE_TARGETS) \ + $(RECURSIVE_CLEAN_TARGETS) \ + $(am__extra_recursive_targets) +AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \ + distdir distdir-am +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) +# Read a list of newline-separated strings from the standard input, +# and print each of them once, without duplicates. Input order is +# *not* preserved. +am__uniquify_input = $(AWK) '\ + BEGIN { nonempty = 0; } \ + { items[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in items) print i; }; } \ +' +# Make sure the list of sources is unique. This is necessary because, +# e.g., the same source file might be shared among _SOURCES variables +# for different programs/libraries. +am__define_uniq_tagged_files = \ + list='$(am__tagged_files)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | $(am__uniquify_input)` +ETAGS = etags +CTAGS = ctags +DIST_SUBDIRS = $(SUBDIRS) +am__DIST_COMMON = $(srcdir)/Makefile.in README +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +am__relativize = \ + dir0=`pwd`; \ + sed_first='s,^\([^/]*\)/.*$$,\1,'; \ + sed_rest='s,^[^/]*/*,,'; \ + sed_last='s,^.*/\([^/]*\)$$,\1,'; \ + sed_butlast='s,/*[^/]*$$,,'; \ + while test -n "$$dir1"; do \ + first=`echo "$$dir1" | sed -e "$$sed_first"`; \ + if test "$$first" != "."; then \ + if test "$$first" = ".."; then \ + dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \ + dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \ + else \ + first2=`echo "$$dir2" | sed -e "$$sed_first"`; \ + if test "$$first2" = "$$first"; then \ + dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \ + else \ + dir2="../$$dir2"; \ + fi; \ + dir0="$$dir0"/"$$first"; \ + fi; \ + fi; \ + dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \ + done; \ + reldir="$$dir2" +ACLOCAL = @ACLOCAL@ +ALSACTL_DAEMONSWITCH = @ALSACTL_DAEMONSWITCH@ +ALSACTL_PIDFILE_DIR = @ALSACTL_PIDFILE_DIR@ +ALSA_CFLAGS = @ALSA_CFLAGS@ +ALSA_LIBS = @ALSA_LIBS@ +ALSA_TOPOLOGY_LIBS = @ALSA_TOPOLOGY_LIBS@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +ASOUND_LOCK_DIR = @ASOUND_LOCK_DIR@ +ASOUND_STATE_DIR = @ASOUND_STATE_DIR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CURSESINC = @CURSESINC@ +CURSESLIB = @CURSESLIB@ +CURSES_CFLAGS = @CURSES_CFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +FFTW_CFLAGS = @FFTW_CFLAGS@ +FFTW_INC = @FFTW_INC@ +FFTW_LIB = @FFTW_LIB@ +GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ +GMSGFMT = @GMSGFMT@ +GMSGFMT_015 = @GMSGFMT_015@ +GREP = @GREP@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +INTLLIBS = @INTLLIBS@ +INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@ +LDFLAGS = @LDFLAGS@ +LIBICONV = @LIBICONV@ +LIBINTL = @LIBINTL@ +LIBOBJS = @LIBOBJS@ +LIBRT = @LIBRT@ +LIBS = @LIBS@ +LN_S = @LN_S@ +LTLIBICONV = @LTLIBICONV@ +LTLIBINTL = @LTLIBINTL@ +LTLIBOBJS = @LTLIBOBJS@ +MAINT = @MAINT@ +MAKEINFO = @MAKEINFO@ +MKDIR_P = @MKDIR_P@ +MSGFMT = @MSGFMT@ +MSGFMT_015 = @MSGFMT_015@ +MSGMERGE = @MSGMERGE@ +NCURSESW_CFLAGS = @NCURSESW_CFLAGS@ +NCURSESW_LIBS = @NCURSESW_LIBS@ +NCURSES_CFLAGS = @NCURSES_CFLAGS@ +NCURSES_LIBS = @NCURSES_LIBS@ +OBJEXT = @OBJEXT@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ +POSUB = @POSUB@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +SND_UTIL_MAJOR = @SND_UTIL_MAJOR@ +SND_UTIL_MINOR = @SND_UTIL_MINOR@ +SND_UTIL_SUBMINOR = @SND_UTIL_SUBMINOR@ +SND_UTIL_VERSION = @SND_UTIL_VERSION@ +STRIP = @STRIP@ +SYSTEMD_CFLAGS = @SYSTEMD_CFLAGS@ +SYSTEMD_LIBS = @SYSTEMD_LIBS@ +TESTSOUND = @TESTSOUND@ +USE_NLS = @USE_NLS@ +VERSION = @VERSION@ +XGETTEXT = @XGETTEXT@ +XGETTEXT_015 = @XGETTEXT_015@ +XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_CC = @ac_ct_CC@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +mydatadir = @mydatadir@ +ncurses5_config = @ncurses5_config@ +ncursesw5_config = @ncursesw5_config@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +rst2man_available = @rst2man_available@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +systemdsystemunitdir = @systemdsystemunitdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +udevrulesdir = @udevrulesdir@ +xmlto_available = @xmlto_available@ +SUBDIRS = asound_state +alsabat_script_files = analog_audio_playback_and_capture.sh \ + dp_audio_playback.sh \ + dp_audio_subdevice_number.sh \ + hdmi_audio_playback.sh \ + hdmi_audio_subdevice_number.sh \ + map_test_case \ + README + +EXTRA_DIST = \ + $(alsabat_script_files) + +all: all-recursive + +.SUFFIXES: +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign bat/tests/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --foreign bat/tests/Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): + +# This directory's subdirectories are mostly independent; you can cd +# into them and run 'make' without going through this Makefile. +# To change the values of 'make' variables: instead of editing Makefiles, +# (1) if the variable is set in 'config.status', edit 'config.status' +# (which will cause the Makefiles to be regenerated when you run 'make'); +# (2) otherwise, pass the desired values on the 'make' command line. +$(am__recursive_targets): + @fail=; \ + if $(am__make_keepgoing); then \ + failcom='fail=yes'; \ + else \ + failcom='exit 1'; \ + fi; \ + dot_seen=no; \ + target=`echo $@ | sed s/-recursive//`; \ + case "$@" in \ + distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ + *) list='$(SUBDIRS)' ;; \ + esac; \ + for subdir in $$list; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + dot_seen=yes; \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || eval $$failcom; \ + done; \ + if test "$$dot_seen" = "no"; then \ + $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ + fi; test -z "$$fail" + +ID: $(am__tagged_files) + $(am__define_uniq_tagged_files); mkid -fID $$unique +tags: tags-recursive +TAGS: tags + +tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + set x; \ + here=`pwd`; \ + if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ + include_option=--etags-include; \ + empty_fix=.; \ + else \ + include_option=--include; \ + empty_fix=; \ + fi; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test ! -f $$subdir/TAGS || \ + set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \ + fi; \ + done; \ + $(am__define_uniq_tagged_files); \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: ctags-recursive + +CTAGS: ctags +ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + $(am__define_uniq_tagged_files); \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" +cscopelist: cscopelist-recursive + +cscopelist-am: $(am__tagged_files) + list='$(am__tagged_files)'; \ + case "$(srcdir)" in \ + [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ + *) sdir=$(subdir)/$(srcdir) ;; \ + esac; \ + for i in $$list; do \ + if test -f "$$i"; then \ + echo "$(subdir)/$$i"; \ + else \ + echo "$$sdir/$$i"; \ + fi; \ + done >> $(top_builddir)/cscope.files + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) distdir-am + +distdir-am: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done + @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + $(am__make_dryrun) \ + || test -d "$(distdir)/$$subdir" \ + || $(MKDIR_P) "$(distdir)/$$subdir" \ + || exit 1; \ + dir1=$$subdir; dir2="$(distdir)/$$subdir"; \ + $(am__relativize); \ + new_distdir=$$reldir; \ + dir1=$$subdir; dir2="$(top_distdir)"; \ + $(am__relativize); \ + new_top_distdir=$$reldir; \ + echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \ + echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \ + ($(am__cd) $$subdir && \ + $(MAKE) $(AM_MAKEFLAGS) \ + top_distdir="$$new_top_distdir" \ + distdir="$$new_distdir" \ + am__remove_distdir=: \ + am__skip_length_check=: \ + am__skip_mode_fix=: \ + distdir) \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-recursive +all-am: Makefile +installdirs: installdirs-recursive +installdirs-am: +install: install-recursive +install-exec: install-exec-recursive +install-data: install-data-recursive +uninstall: uninstall-recursive + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-recursive +install-strip: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-recursive + +clean-am: clean-generic mostlyclean-am + +distclean: distclean-recursive + -rm -f Makefile +distclean-am: clean-am distclean-generic distclean-tags + +dvi: dvi-recursive + +dvi-am: + +html: html-recursive + +html-am: + +info: info-recursive + +info-am: + +install-data-am: + +install-dvi: install-dvi-recursive + +install-dvi-am: + +install-exec-am: + +install-html: install-html-recursive + +install-html-am: + +install-info: install-info-recursive + +install-info-am: + +install-man: + +install-pdf: install-pdf-recursive + +install-pdf-am: + +install-ps: install-ps-recursive + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-recursive + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-recursive + +mostlyclean-am: mostlyclean-generic + +pdf: pdf-recursive + +pdf-am: + +ps: ps-recursive + +ps-am: + +uninstall-am: + +.MAKE: $(am__recursive_targets) install-am install-strip + +.PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am check \ + check-am clean clean-generic cscopelist-am ctags ctags-am \ + distclean distclean-generic distclean-tags distdir dvi dvi-am \ + html html-am info info-am install install-am install-data \ + install-data-am install-dvi install-dvi-am install-exec \ + install-exec-am install-html install-html-am install-info \ + install-info-am install-man install-pdf install-pdf-am \ + install-ps install-ps-am install-strip installcheck \ + installcheck-am installdirs installdirs-am maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-generic pdf \ + pdf-am ps ps-am tags tags-am uninstall uninstall-am + +.PRECIOUS: Makefile + + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/bat/tests/README b/bat/tests/README new file mode 100644 index 0000000..de69686 --- /dev/null +++ b/bat/tests/README @@ -0,0 +1,32 @@ + + automated test scripts for linux audio driver + based on alsa-lib interface by using alsabat +=============================================================================== + +This package contains the test scripts for linux audio driver based on +alsa-lib interface by using alsabat. +It supports analog and display(HDMI/DP) audio test. +The package needs the alsa-utils, alsa-lib installed environment. + +alsabat_main.sh + - the main entrance test script, + it will call the other scripts to run the tests + (test result will save in the ./log/ folder) +analog_audio_playback_and_capture.sh + - analog audio test script (please to loopback the + analog audio output to analog audio input) +hdmi_audio_playback.sh + - hdmi audio test script (please to loopback the hdmi audio output + to analog audio input) +dp_audio_playback.sh + - dp audio test script (please to loopback the dp audio + output to analog audio input) +map_test_case + - to map the test suite/cases to a test script +asound_state/ + - some asound.state config reference files + based on different platforms + + Focus Luo + Wang,Jinliang + Zhang,Keqiao diff --git a/bat/tests/analog_audio_playback_and_capture.sh b/bat/tests/analog_audio_playback_and_capture.sh new file mode 100755 index 0000000..bac491e --- /dev/null +++ b/bat/tests/analog_audio_playback_and_capture.sh @@ -0,0 +1,84 @@ +#!/bin/bash + +#/* +# * Copyright (C) 2013-2016 Intel Corporation +# * +# * This program is free software; you can redistribute it and/or modify +# * it under the terms of the GNU General Public License as published by +# * the Free Software Foundation; either version 2 of the License, or +# * (at your option) any later version. +# * +# * This program is distributed in the hope that it will be useful, +# * but WITHOUT ANY WARRANTY; without even the implied warranty of +# * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# * GNU General Public License for more details. +# * +# */ + +#set test freq table (HZ) +freq_table="10 31 73 155 380 977 1932 4119 8197 16197" + +#set test number of channels +test_channel=2 + +#get Analog audio card number +card_number=$(aplay -l | grep "Analog" | cut -b 6) +if [ "$card_number" = "" ]; then + echo "Can not get Analog card number." + exit 1 +fi + +#get Analog audio device number +device_number=$(aplay -l | grep "Analog"| cut -d " " -f 8 |cut -b 1) +if [ "$device_number" = "" ]; then + echo "Can not get Analog device number" + exit 1 +fi + + +device="hw:$card_number,$device_number" +echo $device + +#get Analog audio record card number +record_card_number=$(arecord -l | grep "Analog" | cut -b 6) +if [ "$record_card_number" = "" ]; then + echo "Can not get record card number." + exit 1 +fi + +#get Analog audio record device number +record_device_number=$(arecord -l | grep "Analog"| cut -d " " -f 8 |cut -b 1) +echo $record_device_number +if [ "$record_device_number" = "" ]; then + echo "Can not get record device number" + exit 1 +fi + +#Notice: to loopback the analog audio output to the analog audio input +record_device="hw:$record_card_number,$record_device_number" +test_flag=0 + +echo -e "\e[31m Notice: to loopback the analog audio output to \ +the analog audio input" +echo -e "\e[0m" +read -p "Press enter to continue" + +#call alsabat to do the test for each frequency in the freq_table +for freq in $freq_table + do + alsabat -P $device -C plug$record_device -c $test_channel -F $freq + if [ $? = 0 ]; then + echo "Test target frequency:$freq for Analog playback -- Passed \ +" >> $ABAT_TEST_LOG_FILE + echo "Test target frequency:$freq for Analog capture -- Passed \ +" >> $ABAT_TEST_LOG_FILE + else + echo "Test target frequency:$freq for Analog playback -- Failed \ +" >> $ABAT_TEST_LOG_FILE + echo "Test target frequency:$freq for Analog capture -- Failed \ +" >> $ABAT_TEST_LOG_FILE + test_flag=1 + fi + done + +exit $test_flag diff --git a/bat/tests/asound_state/Makefile.am b/bat/tests/asound_state/Makefile.am new file mode 100644 index 0000000..7010310 --- /dev/null +++ b/bat/tests/asound_state/Makefile.am @@ -0,0 +1,6 @@ +alsabat_cfg_files = asound.state.Broadwell \ + asound.state.Haswell \ + asound.state.Skylake + +EXTRA_DIST = \ + $(alsabat_cfg_files) diff --git a/bat/tests/asound_state/Makefile.in b/bat/tests/asound_state/Makefile.in new file mode 100644 index 0000000..e127968 --- /dev/null +++ b/bat/tests/asound_state/Makefile.in @@ -0,0 +1,474 @@ +# Makefile.in generated by automake 1.16.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994-2018 Free Software Foundation, Inc. + +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ +VPATH = @srcdir@ +am__is_gnu_make = { \ + if test -z '$(MAKELEVEL)'; then \ + false; \ + elif test -n '$(MAKE_HOST)'; then \ + true; \ + elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ + true; \ + else \ + false; \ + fi; \ +} +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + esac; \ + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +subdir = bat/tests/asound_state +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/gettext.m4 \ + $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/lib-ld.m4 \ + $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ + $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \ + $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/acinclude.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/include/aconfig.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = +SOURCES = +DIST_SOURCES = +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) +am__DIST_COMMON = $(srcdir)/Makefile.in +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +ALSACTL_DAEMONSWITCH = @ALSACTL_DAEMONSWITCH@ +ALSACTL_PIDFILE_DIR = @ALSACTL_PIDFILE_DIR@ +ALSA_CFLAGS = @ALSA_CFLAGS@ +ALSA_LIBS = @ALSA_LIBS@ +ALSA_TOPOLOGY_LIBS = @ALSA_TOPOLOGY_LIBS@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +ASOUND_LOCK_DIR = @ASOUND_LOCK_DIR@ +ASOUND_STATE_DIR = @ASOUND_STATE_DIR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CURSESINC = @CURSESINC@ +CURSESLIB = @CURSESLIB@ +CURSES_CFLAGS = @CURSES_CFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +FFTW_CFLAGS = @FFTW_CFLAGS@ +FFTW_INC = @FFTW_INC@ +FFTW_LIB = @FFTW_LIB@ +GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ +GMSGFMT = @GMSGFMT@ +GMSGFMT_015 = @GMSGFMT_015@ +GREP = @GREP@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +INTLLIBS = @INTLLIBS@ +INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@ +LDFLAGS = @LDFLAGS@ +LIBICONV = @LIBICONV@ +LIBINTL = @LIBINTL@ +LIBOBJS = @LIBOBJS@ +LIBRT = @LIBRT@ +LIBS = @LIBS@ +LN_S = @LN_S@ +LTLIBICONV = @LTLIBICONV@ +LTLIBINTL = @LTLIBINTL@ +LTLIBOBJS = @LTLIBOBJS@ +MAINT = @MAINT@ +MAKEINFO = @MAKEINFO@ +MKDIR_P = @MKDIR_P@ +MSGFMT = @MSGFMT@ +MSGFMT_015 = @MSGFMT_015@ +MSGMERGE = @MSGMERGE@ +NCURSESW_CFLAGS = @NCURSESW_CFLAGS@ +NCURSESW_LIBS = @NCURSESW_LIBS@ +NCURSES_CFLAGS = @NCURSES_CFLAGS@ +NCURSES_LIBS = @NCURSES_LIBS@ +OBJEXT = @OBJEXT@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ +POSUB = @POSUB@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +SND_UTIL_MAJOR = @SND_UTIL_MAJOR@ +SND_UTIL_MINOR = @SND_UTIL_MINOR@ +SND_UTIL_SUBMINOR = @SND_UTIL_SUBMINOR@ +SND_UTIL_VERSION = @SND_UTIL_VERSION@ +STRIP = @STRIP@ +SYSTEMD_CFLAGS = @SYSTEMD_CFLAGS@ +SYSTEMD_LIBS = @SYSTEMD_LIBS@ +TESTSOUND = @TESTSOUND@ +USE_NLS = @USE_NLS@ +VERSION = @VERSION@ +XGETTEXT = @XGETTEXT@ +XGETTEXT_015 = @XGETTEXT_015@ +XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_CC = @ac_ct_CC@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +mydatadir = @mydatadir@ +ncurses5_config = @ncurses5_config@ +ncursesw5_config = @ncursesw5_config@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +rst2man_available = @rst2man_available@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +systemdsystemunitdir = @systemdsystemunitdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +udevrulesdir = @udevrulesdir@ +xmlto_available = @xmlto_available@ +alsabat_cfg_files = asound.state.Broadwell \ + asound.state.Haswell \ + asound.state.Skylake + +EXTRA_DIST = \ + $(alsabat_cfg_files) + +all: all-am + +.SUFFIXES: +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign bat/tests/asound_state/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --foreign bat/tests/asound_state/Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): +tags TAGS: + +ctags CTAGS: + +cscope cscopelist: + + +distdir: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) distdir-am + +distdir-am: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile +installdirs: +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic mostlyclean-am + +distclean: distclean-am + -rm -f Makefile +distclean-am: clean-am distclean-generic + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-generic + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: + +.MAKE: install-am install-strip + +.PHONY: all all-am check check-am clean clean-generic cscopelist-am \ + ctags-am distclean distclean-generic distdir dvi dvi-am html \ + html-am info info-am install install-am install-data \ + install-data-am install-dvi install-dvi-am install-exec \ + install-exec-am install-html install-html-am install-info \ + install-info-am install-man install-pdf install-pdf-am \ + install-ps install-ps-am install-strip installcheck \ + installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-generic pdf \ + pdf-am ps ps-am tags-am uninstall uninstall-am + +.PRECIOUS: Makefile + + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/bat/tests/asound_state/asound.state.Broadwell b/bat/tests/asound_state/asound.state.Broadwell new file mode 100644 index 0000000..bea75e5 --- /dev/null +++ b/bat/tests/asound_state/asound.state.Broadwell @@ -0,0 +1,439 @@ +state.HDMI { + control.1 { + iface CARD + name 'HDMI/DP,pcm=3 Jack' + value false + comment { + access read + type BOOLEAN + count 1 + } + } + control.2 { + iface MIXER + name 'IEC958 Playback Con Mask' + value '0fff000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000' + comment { + access read + type IEC958 + count 1 + } + } + control.3 { + iface MIXER + name 'IEC958 Playback Pro Mask' + value '0f00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000' + comment { + access read + type IEC958 + count 1 + } + } + control.4 { + iface MIXER + name 'IEC958 Playback Default' + value '0482000200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000' + comment { + access 'read write' + type IEC958 + count 1 + } + } + control.5 { + iface MIXER + name 'IEC958 Playback Switch' + value true + comment { + access 'read write' + type BOOLEAN + count 1 + } + } + control.6 { + iface PCM + device 3 + name ELD + value '' + comment { + access 'read volatile' + type BYTES + count 0 + } + } + control.7 { + iface CARD + name 'HDMI/DP,pcm=7 Jack' + value true + comment { + access read + type BOOLEAN + count 1 + } + } + control.8 { + iface MIXER + name 'IEC958 Playback Con Mask' + index 1 + value '0fff000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000' + comment { + access read + type IEC958 + count 1 + } + } + control.9 { + iface MIXER + name 'IEC958 Playback Pro Mask' + index 1 + value '0f00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000' + comment { + access read + type IEC958 + count 1 + } + } + control.10 { + iface MIXER + name 'IEC958 Playback Default' + index 1 + value '0400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000' + comment { + access 'read write' + type IEC958 + count 1 + } + } + control.11 { + iface MIXER + name 'IEC958 Playback Switch' + index 1 + value true + comment { + access 'read write' + type BOOLEAN + count 1 + } + } + control.12 { + iface PCM + device 7 + name ELD + value '100008006a10000100000000000000000469b12341535553205041323338091707000000' + comment { + access 'read volatile' + type BYTES + count 36 + } + } + control.13 { + iface CARD + name 'HDMI/DP,pcm=8 Jack' + value false + comment { + access read + type BOOLEAN + count 1 + } + } + control.14 { + iface MIXER + name 'IEC958 Playback Con Mask' + index 2 + value '0fff000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000' + comment { + access read + type IEC958 + count 1 + } + } + control.15 { + iface MIXER + name 'IEC958 Playback Pro Mask' + index 2 + value '0f00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000' + comment { + access read + type IEC958 + count 1 + } + } + control.16 { + iface MIXER + name 'IEC958 Playback Default' + index 2 + value '0400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000' + comment { + access 'read write' + type IEC958 + count 1 + } + } + control.17 { + iface MIXER + name 'IEC958 Playback Switch' + index 2 + value true + comment { + access 'read write' + type BOOLEAN + count 1 + } + } + control.18 { + iface PCM + device 8 + name ELD + value '' + comment { + access 'read volatile' + type BYTES + count 0 + } + } + control.19 { + iface PCM + device 3 + name 'Playback Channel Map' + value.0 0 + value.1 0 + value.2 0 + value.3 0 + value.4 0 + value.5 0 + value.6 0 + value.7 0 + comment { + access 'read write' + type INTEGER + count 8 + range '0 - 36' + } + } + control.20 { + iface PCM + device 7 + name 'Playback Channel Map' + value.0 0 + value.1 0 + value.2 0 + value.3 0 + value.4 0 + value.5 0 + value.6 0 + value.7 0 + comment { + access 'read write' + type INTEGER + count 8 + range '0 - 36' + } + } + control.21 { + iface PCM + device 8 + name 'Playback Channel Map' + value.0 0 + value.1 0 + value.2 0 + value.3 0 + value.4 0 + value.5 0 + value.6 0 + value.7 0 + comment { + access 'read write' + type INTEGER + count 8 + range '0 - 36' + } + } +} +state.PCH { + control.1 { + iface MIXER + name 'Master Playback Volume' + value.0 41 + value.1 41 + comment { + access 'read write' + type INTEGER + count 2 + range '0 - 87' + dbmin -6525 + dbmax 0 + dbvalue.0 -3450 + dbvalue.1 -3450 + } + } + control.2 { + iface MIXER + name 'Master Playback Switch' + value.0 true + value.1 true + comment { + access 'read write' + type BOOLEAN + count 2 + } + } + control.3 { + iface MIXER + name 'Loopback Mixing' + value Enabled + comment { + access 'read write' + type ENUMERATED + count 1 + item.0 Disabled + item.1 Enabled + } + } + control.4 { + iface MIXER + name 'Mic Playback Volume' + value.0 0 + value.1 0 + comment { + access 'read write' + type INTEGER + count 2 + range '0 - 31' + dbmin -3450 + dbmax 1200 + dbvalue.0 -3450 + dbvalue.1 -3450 + } + } + control.5 { + iface MIXER + name 'Mic Playback Switch' + value.0 true + value.1 true + comment { + access 'read write' + type BOOLEAN + count 2 + } + } + control.6 { + iface MIXER + name 'Capture Volume' + value.0 21 + value.1 21 + comment { + access 'read write' + type INTEGER + count 2 + range '0 - 63' + dbmin -1725 + dbmax 3000 + dbvalue.0 -150 + dbvalue.1 -150 + } + } + control.7 { + iface MIXER + name 'Capture Switch' + value.0 true + value.1 true + comment { + access 'read write' + type BOOLEAN + count 2 + } + } + control.8 { + iface MIXER + name 'Mic Boost Volume' + value.0 0 + value.1 0 + comment { + access 'read write' + type INTEGER + count 2 + range '0 - 3' + dbmin 0 + dbmax 3600 + dbvalue.0 0 + dbvalue.1 0 + } + } + control.9 { + iface CARD + name 'Mic Jack' + value false + comment { + access read + type BOOLEAN + count 1 + } + } + control.10 { + iface CARD + name 'Headphone Jack' + value true + comment { + access read + type BOOLEAN + count 1 + } + } + control.11 { + iface PCM + name 'Playback Channel Map' + value.0 0 + value.1 0 + comment { + access read + type INTEGER + count 2 + range '0 - 36' + } + } + control.12 { + iface PCM + name 'Capture Channel Map' + value.0 0 + value.1 0 + comment { + access read + type INTEGER + count 2 + range '0 - 36' + } + } + control.13 { + iface MIXER + name 'PCM Playback Volume' + value.0 105 + value.1 105 + comment { + access 'read write user' + type INTEGER + count 2 + range '0 - 255' + tlv '0000000100000008ffffec1400000014' + dbmin -5100 + dbmax 0 + dbvalue.0 -3000 + dbvalue.1 -3000 + } + } + control.14 { + iface MIXER + name 'Digital Capture Volume' + value.0 60 + value.1 60 + comment { + access 'read write user' + type INTEGER + count 2 + range '0 - 120' + tlv '0000000100000008fffff44800000032' + dbmin -3000 + dbmax 3000 + dbvalue.0 0 + dbvalue.1 0 + } + } +} diff --git a/bat/tests/asound_state/asound.state.Haswell b/bat/tests/asound_state/asound.state.Haswell new file mode 100644 index 0000000..04b05c1 --- /dev/null +++ b/bat/tests/asound_state/asound.state.Haswell @@ -0,0 +1,342 @@ +state.HDMI { + control.1 { + iface CARD + name 'HDMI/DP,pcm=3 Jack' + value true + comment { + access read + type BOOLEAN + count 1 + } + } + control.2 { + iface MIXER + name 'IEC958 Playback Con Mask' + value '0fff000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000' + comment { + access read + type IEC958 + count 1 + } + } + control.3 { + iface MIXER + name 'IEC958 Playback Pro Mask' + value '0f00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000' + comment { + access read + type IEC958 + count 1 + } + } + control.4 { + iface MIXER + name 'IEC958 Playback Default' + value '0482000200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000' + comment { + access 'read write' + type IEC958 + count 1 + } + } + control.5 { + iface MIXER + name 'IEC958 Playback Switch' + value true + comment { + access 'read write' + type BOOLEAN + count 1 + } + } + control.6 { + iface PCM + device 3 + name ELD + value '100008006a10000100000000000000000469d22341535553205653323339091707000000' + comment { + access 'read volatile' + type BYTES + count 36 + } + } + control.7 { + iface CARD + name 'HDMI/DP,pcm=7 Jack' + value true + comment { + access read + type BOOLEAN + count 1 + } + } + control.8 { + iface MIXER + name 'IEC958 Playback Con Mask' + index 1 + value '0fff000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000' + comment { + access read + type IEC958 + count 1 + } + } + control.9 { + iface MIXER + name 'IEC958 Playback Pro Mask' + index 1 + value '0f00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000' + comment { + access read + type IEC958 + count 1 + } + } + control.10 { + iface MIXER + name 'IEC958 Playback Default' + index 1 + value '0400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000' + comment { + access 'read write' + type IEC958 + count 1 + } + } + control.11 { + iface MIXER + name 'IEC958 Playback Switch' + index 1 + value true + comment { + access 'read write' + type BOOLEAN + count 1 + } + } + control.12 { + iface PCM + device 7 + name ELD + value '100008006a10000100000000000000000469b12341535553205041323338091707000000' + comment { + access 'read volatile' + type BYTES + count 36 + } + } + control.13 { + iface PCM + device 3 + name 'Playback Channel Map' + value.0 0 + value.1 0 + value.2 0 + value.3 0 + value.4 0 + value.5 0 + value.6 0 + value.7 0 + comment { + access 'read write' + type INTEGER + count 8 + range '0 - 36' + } + } + control.14 { + iface PCM + device 7 + name 'Playback Channel Map' + value.0 0 + value.1 0 + value.2 0 + value.3 0 + value.4 0 + value.5 0 + value.6 0 + value.7 0 + comment { + access 'read write' + type INTEGER + count 8 + range '0 - 36' + } + } +} +state.PCH { + control.1 { + iface MIXER + name 'Master Playback Volume' + value.0 45 + value.1 45 + comment { + access 'read write' + type INTEGER + count 2 + range '0 - 87' + dbmin -6525 + dbmax 0 + dbvalue.0 -3150 + dbvalue.1 -3150 + } + } + control.2 { + iface MIXER + name 'Master Playback Switch' + value.0 true + value.1 true + comment { + access 'read write' + type BOOLEAN + count 2 + } + } + control.3 { + iface MIXER + name 'Capture Volume' + value.0 27 + value.1 27 + comment { + access 'read write' + type INTEGER + count 2 + range '0 - 63' + dbmin -1725 + dbmax 3000 + dbvalue.0 300 + dbvalue.1 300 + } + } + control.4 { + iface MIXER + name 'Capture Switch' + value.0 true + value.1 true + comment { + access 'read write' + type BOOLEAN + count 2 + } + } + control.5 { + iface MIXER + name 'Mic Boost Volume' + value.0 0 + value.1 0 + comment { + access 'read write' + type INTEGER + count 2 + range '0 - 3' + dbmin 0 + dbmax 3600 + dbvalue.0 0 + dbvalue.1 0 + } + } + control.6 { + iface MIXER + name 'Internal Mic Boost Volume' + value.0 0 + value.1 0 + comment { + access 'read write' + type INTEGER + count 2 + range '0 - 3' + dbmin 0 + dbmax 3600 + dbvalue.0 0 + dbvalue.1 0 + } + } + control.7 { + iface CARD + name 'Mic Jack' + value true + comment { + access read + type BOOLEAN + count 1 + } + } + control.8 { + iface CARD + name 'Internal Mic Phantom Jack' + value true + comment { + access read + type BOOLEAN + count 1 + } + } + control.9 { + iface CARD + name 'Headphone Jack' + value true + comment { + access read + type BOOLEAN + count 1 + } + } + control.10 { + iface PCM + name 'Playback Channel Map' + value.0 0 + value.1 0 + comment { + access read + type INTEGER + count 2 + range '0 - 36' + } + } + control.11 { + iface PCM + name 'Capture Channel Map' + value.0 0 + value.1 0 + comment { + access read + type INTEGER + count 2 + range '0 - 36' + } + } + control.12 { + iface MIXER + name 'PCM Playback Volume' + value.0 167 + value.1 167 + comment { + access 'read write user' + type INTEGER + count 2 + range '0 - 255' + tlv '0000000100000008ffffec1400000014' + dbmin -5100 + dbmax 0 + dbvalue.0 -1760 + dbvalue.1 -1760 + } + } + control.13 { + iface MIXER + name 'Digital Capture Volume' + value.0 60 + value.1 60 + comment { + access 'read write user' + type INTEGER + count 2 + range '0 - 120' + tlv '0000000100000008fffff44800000032' + dbmin -3000 + dbmax 3000 + dbvalue.0 0 + dbvalue.1 0 + } + } +} diff --git a/bat/tests/asound_state/asound.state.Skylake b/bat/tests/asound_state/asound.state.Skylake new file mode 100644 index 0000000..50f672a --- /dev/null +++ b/bat/tests/asound_state/asound.state.Skylake @@ -0,0 +1,437 @@ +state.PCH { + control.1 { + iface MIXER + name 'Master Playback Volume' + value.0 57 + value.1 57 + comment { + access 'read write' + type INTEGER + count 2 + range '0 - 87' + dbmin -6525 + dbmax 0 + dbvalue.0 -2250 + dbvalue.1 -2250 + } + } + control.2 { + iface MIXER + name 'Master Playback Switch' + value.0 true + value.1 true + comment { + access 'read write' + type BOOLEAN + count 2 + } + } + control.3 { + iface MIXER + name 'Loopback Mixing' + value Enabled + comment { + access 'read write' + type ENUMERATED + count 1 + item.0 Disabled + item.1 Enabled + } + } + control.4 { + iface MIXER + name 'Mic Playback Volume' + value.0 15 + value.1 15 + comment { + access 'read write' + type INTEGER + count 2 + range '0 - 31' + dbmin -3450 + dbmax 1200 + dbvalue.0 -1200 + dbvalue.1 -1200 + } + } + control.5 { + iface MIXER + name 'Mic Playback Switch' + value.0 true + value.1 true + comment { + access 'read write' + type BOOLEAN + count 2 + } + } + control.6 { + iface MIXER + name 'Capture Volume' + value.0 27 + value.1 27 + comment { + access 'read write' + type INTEGER + count 2 + range '0 - 63' + dbmin -1725 + dbmax 3000 + dbvalue.0 300 + dbvalue.1 300 + } + } + control.7 { + iface MIXER + name 'Capture Switch' + value.0 true + value.1 true + comment { + access 'read write' + type BOOLEAN + count 2 + } + } + control.8 { + iface MIXER + name 'Mic Boost Volume' + value.0 0 + value.1 0 + comment { + access 'read write' + type INTEGER + count 2 + range '0 - 3' + dbmin 0 + dbmax 3600 + dbvalue.0 0 + dbvalue.1 0 + } + } + control.9 { + iface CARD + name 'Mic Jack' + value true + comment { + access read + type BOOLEAN + count 1 + } + } + control.10 { + iface CARD + name 'Headphone Jack' + value true + comment { + access read + type BOOLEAN + count 1 + } + } + control.11 { + iface PCM + name 'Playback Channel Map' + value.0 0 + value.1 0 + comment { + access read + type INTEGER + count 2 + range '0 - 36' + } + } + control.12 { + iface PCM + name 'Capture Channel Map' + value.0 0 + value.1 0 + comment { + access read + type INTEGER + count 2 + range '0 - 36' + } + } + control.13 { + iface CARD + name 'HDMI/DP,pcm=3 Jack' + value true + comment { + access read + type BOOLEAN + count 1 + } + } + control.14 { + iface MIXER + name 'IEC958 Playback Con Mask' + value '0fff000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000' + comment { + access read + type IEC958 + count 1 + } + } + control.15 { + iface MIXER + name 'IEC958 Playback Pro Mask' + value '0f00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000' + comment { + access read + type IEC958 + count 1 + } + } + control.16 { + iface MIXER + name 'IEC958 Playback Default' + value '0400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000' + comment { + access 'read write' + type IEC958 + count 1 + } + } + control.17 { + iface MIXER + name 'IEC958 Playback Switch' + value true + comment { + access 'read write' + type BOOLEAN + count 1 + } + } + control.18 { + iface PCM + device 3 + name ELD + value '100008006a10000100000000000000000469d22341535553205653323339091707000000' + comment { + access 'read volatile' + type BYTES + count 36 + } + } + control.19 { + iface CARD + name 'HDMI/DP,pcm=7 Jack' + value true + comment { + access read + type BOOLEAN + count 1 + } + } + control.20 { + iface MIXER + name 'IEC958 Playback Con Mask' + index 1 + value '0fff000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000' + comment { + access read + type IEC958 + count 1 + } + } + control.21 { + iface MIXER + name 'IEC958 Playback Pro Mask' + index 1 + value '0f00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000' + comment { + access read + type IEC958 + count 1 + } + } + control.22 { + iface MIXER + name 'IEC958 Playback Default' + index 1 + value '0400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000' + comment { + access 'read write' + type IEC958 + count 1 + } + } + control.23 { + iface MIXER + name 'IEC958 Playback Switch' + index 1 + value true + comment { + access 'read write' + type BOOLEAN + count 1 + } + } + control.24 { + iface PCM + device 7 + name ELD + value '100008006a14000100000000000000000469b12341535553205041323338091707000000' + comment { + access 'read volatile' + type BYTES + count 36 + } + } + control.25 { + iface CARD + name 'HDMI/DP,pcm=8 Jack' + value false + comment { + access read + type BOOLEAN + count 1 + } + } + control.26 { + iface MIXER + name 'IEC958 Playback Con Mask' + index 2 + value '0fff000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000' + comment { + access read + type IEC958 + count 1 + } + } + control.27 { + iface MIXER + name 'IEC958 Playback Pro Mask' + index 2 + value '0f00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000' + comment { + access read + type IEC958 + count 1 + } + } + control.28 { + iface MIXER + name 'IEC958 Playback Default' + index 2 + value '0400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000' + comment { + access 'read write' + type IEC958 + count 1 + } + } + control.29 { + iface MIXER + name 'IEC958 Playback Switch' + index 2 + value true + comment { + access 'read write' + type BOOLEAN + count 1 + } + } + control.30 { + iface PCM + device 8 + name ELD + value '' + comment { + access 'read volatile' + type BYTES + count 0 + } + } + control.31 { + iface PCM + device 3 + name 'Playback Channel Map' + value.0 0 + value.1 0 + value.2 0 + value.3 0 + value.4 0 + value.5 0 + value.6 0 + value.7 0 + comment { + access 'read write' + type INTEGER + count 8 + range '0 - 36' + } + } + control.32 { + iface PCM + device 7 + name 'Playback Channel Map' + value.0 0 + value.1 0 + value.2 0 + value.3 0 + value.4 0 + value.5 0 + value.6 0 + value.7 0 + comment { + access 'read write' + type INTEGER + count 8 + range '0 - 36' + } + } + control.33 { + iface PCM + device 8 + name 'Playback Channel Map' + value.0 0 + value.1 0 + value.2 0 + value.3 0 + value.4 0 + value.5 0 + value.6 0 + value.7 0 + comment { + access 'read write' + type INTEGER + count 8 + range '0 - 36' + } + } + control.34 { + iface MIXER + name 'PCM Playback Volume' + value.0 158 + value.1 158 + comment { + access 'read write user' + type INTEGER + count 2 + range '0 - 255' + tlv '0000000100000008ffffec1400000014' + dbmin -5100 + dbmax 0 + dbvalue.0 -1940 + dbvalue.1 -1940 + } + } + control.35 { + iface MIXER + name 'Digital Capture Volume' + value.0 60 + value.1 60 + comment { + access 'read write user' + type INTEGER + count 2 + range '0 - 120' + tlv '0000000100000008fffff44800000032' + dbmin -3000 + dbmax 3000 + dbvalue.0 0 + dbvalue.1 0 + } + } +} diff --git a/bat/tests/dp_audio_playback.sh b/bat/tests/dp_audio_playback.sh new file mode 100755 index 0000000..9c7ee7e --- /dev/null +++ b/bat/tests/dp_audio_playback.sh @@ -0,0 +1,83 @@ +#!/bin/bash + +#/* +# * Copyright (C) 2013-2016 Intel Corporation +# * +# * This program is free software; you can redistribute it and/or modify +# * it under the terms of the GNU General Public License as published by +# * the Free Software Foundation; either version 2 of the License, or +# * (at your option) any later version. +# * +# * This program is distributed in the hope that it will be useful, +# * but WITHOUT ANY WARRANTY; without even the implied warranty of +# * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# * GNU General Public License for more details. +# * +# */ + +#set test freq table (HZ) +freq_table="10 31 73 155 380 977 1932 4119 8197 16197" + +#set test number of channels +test_channel=2 + +#get device number for DP +DP_device_num=0 +$ABAT_TEST_PATH/dp_audio_subdevice_number.sh +DP_device_num=$? +if [ $DP_device_num = 77 ]; then + echo "Prompt: Can not get device with DP audio or \ +show the wrong connection type as HDMI in ELD info" + exit 1 +fi + +#To get DP audio device number +DP_card_number=$(aplay -l | grep "HDMI 0" | cut -b 6) +if [ "$DP_card_number" = "" ]; then + echo "Error: Can not get Display audio card." + exit 1 +fi + +DP_device="hw:$DP_card_number,$DP_device_num" +echo $device +sleep 2 + +#get Analog audio record card number +record_card_number=$(arecord -l | grep "Analog" | cut -b 6) +if [ "$record_card_number" = "" ]; then + echo "Can not get record card number." + exit 1 +fi + +#get Analog audio record device number +record_device_number=$(arecord -l | grep "Analog"| cut -d " " -f 8 |cut -b 1) +echo $record_device_number +if [ "$record_device_number" = "" ]; then + echo "Can not get record device number" + exit 1 +fi + +#Notice: to loopback the DP audio output to the analog audio input +record_device="hw:$record_card_number,$record_device_number" +test_flag=0 + +echo -e "\e[31m Notice: to loopback the DP audio \ +output to the analog audio input" +echo -e "\e[0m" +read -p "Press enter to continue" + +#call alsabat to do the test for each frequency in the freq_table +for freq in $freq_table + do + alsabat -P $DP_device -C plug$record_device -c $test_channel -F $freq + if [ $? = 0 ]; then + echo "Test target frequency:$freq for DP audio playback--Passed" \ +>> $ABAT_TEST_LOG_FILE + else + echo "Test target frequency:$freq for DP audio playback--Failed" \ +>> $ABAT_TEST_LOG_FILE + test_flag=1 + fi + done + +exit $test_flag diff --git a/bat/tests/dp_audio_subdevice_number.sh b/bat/tests/dp_audio_subdevice_number.sh new file mode 100755 index 0000000..db2e79e --- /dev/null +++ b/bat/tests/dp_audio_subdevice_number.sh @@ -0,0 +1,68 @@ +#!/bin/bash + +#/* +# * Copyright (C) 2013-2016 Intel Corporation +# * +# * This program is free software; you can redistribute it and/or modify +# * it under the terms of the GNU General Public License as published by +# * the Free Software Foundation; either version 2 of the License, or +# * (at your option) any later version. +# * +# * This program is distributed in the hope that it will be useful, +# * but WITHOUT ANY WARRANTY; without even the implied warranty of +# * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# * GNU General Public License for more details. +# * +# */ +#set -x + +subdevice_number=0 +get_subdevice=0 + +#make sure the DP monitor is connected and active + +# To get DisplayPort audio device number +card_number=$(aplay -l | grep "HDMI 1" | cut -b 6) +echo $card_number +if [ "$card_number" = "" ]; then + echo "Can not get Display audio card." + exit 254 +fi + +audio_card_dir="/proc/asound/card$card_number/" + +cd $audio_card_dir + +for file in `ls` +do + #To get the ELD info according to the connented monitor with DisplayPort. + if [[ $file == eld* ]]; then + let subdevice_number+=1 + cat $file | grep connection_type | grep DisplayPort > /dev/null + if [ $? = 0 ]; then + echo "Get the ELD information according to the connented \ +monitor with DisplayPort." + get_subdevice=1 + break + fi + fi +done + +#failed to get the subdevice number of DisplayPort audio +if [ $get_subdevice == 0 ]; then + exit 77 +fi + +#the subdevice number of DisplayPort audio is 3 +if [ $subdevice_number == 1 ]; then + exit 3 +#the subdevice number of DisplayPort audio is 7. +elif [ $subdevice_number == 2 ]; then + exit 7 +#the subdevice number of DisplayPort audio is 8 +elif [ $subdevice_number == 3 ]; then + exit 8 +#default: failed to get the subdevice number of DisplayPort audio +else + exit 77 +fi diff --git a/bat/tests/hdmi_audio_playback.sh b/bat/tests/hdmi_audio_playback.sh new file mode 100755 index 0000000..3c45d91 --- /dev/null +++ b/bat/tests/hdmi_audio_playback.sh @@ -0,0 +1,81 @@ +#!/bin/bash + +#/* +# * Copyright (C) 2013-2016 Intel Corporation +# * +# * This program is free software; you can redistribute it and/or modify +# * it under the terms of the GNU General Public License as published by +# * the Free Software Foundation; either version 2 of the License, or +# * (at your option) any later version. +# * +# * This program is distributed in the hope that it will be useful, +# * but WITHOUT ANY WARRANTY; without even the implied warranty of +# * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# * GNU General Public License for more details. +# * +# */ + +#set test freq table (HZ) +freq_table="10 31 73 155 380 977 1932 4119 8197 16197" + +#set test number of channels +test_channel=2 + +#get device number for HDMI +HDMI_device_num=0 +$ABAT_TEST_PATH/hdmi_audio_subdevice_number.sh +HDMI_device_num=$? +if [ $HDMI_device_num = 77 ]; then + echo "Prompt: Can not get device with HDMI audio or \ +show the wrong connection type as DP in ELD info" + exit 1 +fi + +#To get HDMI audio device number +HDMI_card_number=$(aplay -l | grep "HDMI 0" | cut -b 6) +if [ "$HDMI_card_number" = "" ]; then + echo "Error: Can not get Display audio card." + exit 1 +fi + +HDMI_device="hw:$HDMI_card_number,$HDMI_device_num" +echo $device +sleep 2 + +#get Analog audio record card number +record_card_number=$(arecord -l | grep "Analog" | cut -b 6) +if [ "$record_card_number" = "" ]; then + echo "Can not get record card number." + exit 1 +fi + +#get Analog audio record device number +record_device_number=$(arecord -l | grep "Analog"| cut -d " " -f 8 |cut -b 1) +if [ "$record_device_number" = "" ]; then + echo "Can not get record device number" + exit 1 +fi + +#Notice: to loopback the HDMI audio output to the analog audio input +record_device="hw:$record_card_number,$record_device_number" +test_flag=0 + +echo -e "\e[31m Notice: to loopback the HDMI audio output \ +to the analog audio input" +echo -e "\e[0m" +read -p "Press enter to continue" +#call alsabat to do the test for each frequency in the freq_table +for freq in $freq_table + do + alsabat -P $HDMI_device -C plug$record_device -c $test_channel -F $freq + if [ $? = 0 ]; then + echo "Test target frequency:$freq for HDMI audio playback \ +-- Passed " >> $ABAT_TEST_LOG_FILE + else + echo "Test target frequency:$freq for HDMI audio playback \ +-- Failed " >> $ABAT_TEST_LOG_FILE + test_flag=1 + fi + done + +exit $test_flag diff --git a/bat/tests/hdmi_audio_subdevice_number.sh b/bat/tests/hdmi_audio_subdevice_number.sh new file mode 100755 index 0000000..7811577 --- /dev/null +++ b/bat/tests/hdmi_audio_subdevice_number.sh @@ -0,0 +1,65 @@ +#!/bin/bash + +#/* +# * Copyright (C) 2013-2016 Intel Corporation +# * +# * This program is free software; you can redistribute it and/or modify +# * it under the terms of the GNU General Public License as published by +# * the Free Software Foundation; either version 2 of the License, or +# * (at your option) any later version. +# * +# * This program is distributed in the hope that it will be useful, +# * but WITHOUT ANY WARRANTY; without even the implied warranty of +# * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# * GNU General Public License for more details. +# * +# */ +#set -x + +subdevice_number=0 +get_subdevice=0 + +#make sure the HDMI monitor is connected and active ######## + +# To get HDMI audio device number +card_number=$(aplay -l | grep "HDMI 0" | cut -b 6) +if [ "$card_number" = "" ]; then + echo "Can not get Display audio card." + #failed to get Display audio card. + exit 1 +fi + +audio_card_dir="/proc/asound/card$card_number/" + +cd $audio_card_dir +for file in `ls` + do + #To get the ELD information according to the connented monitor with HDMI + if [[ $file == eld* ]]; then + let subdevice_number+=1 + cat $file | grep connection_type | grep HDMI > /dev/null + if [ $? = 0 ]; then + get_subdevice=1 + break + fi + fi + done + +#failed to get the subdevice number of HDMI audio. +if [ $get_subdevice == 0 ]; then + exit 77 +fi + +#the subdevice number of HDMI audio is 3. +if [ $subdevice_number == 1 ]; then + exit 3 +#the subdevice number of HDMI audio is 7. +elif [ $subdevice_number == 2 ]; then + exit 7 +#the subdevice number of HDMI audio is 8. +elif [ $subdevice_number == 3 ]; then + exit 8 +#default: failed to get the subdevice number of HDMI audio. +else + exit 77 +fi diff --git a/bat/tests/map_test_case b/bat/tests/map_test_case new file mode 100644 index 0000000..20eb223 --- /dev/null +++ b/bat/tests/map_test_case @@ -0,0 +1,8 @@ +# Analog audio basic test +verify_Analog_audio_playback_and_capture="$ABAT_TEST_PATH/analog_audio_playback_and_capture.sh" + +# Display audio basic test cases - for HDMI +verify_HDMI_audio_playback="$ABAT_TEST_PATH/hdmi_audio_playback.sh" + +# Display audio basic test cases - for DP +verify_DP_audio_playback="$ABAT_TEST_PATH/dp_audio_playback.sh" diff --git a/bat/tinyalsa.c b/bat/tinyalsa.c new file mode 100644 index 0000000..f1c20fa --- /dev/null +++ b/bat/tinyalsa.c @@ -0,0 +1,554 @@ +/* + * Copyright (C) 2013-2015 Intel Corporation + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + */ + +#include +#include +#include +#include +#include +#include + +#include + +#include "aconfig.h" +#include "gettext.h" + +#include "common.h" +#include "tinyalsa.h" +#include "latencytest.h" + +struct format_map_table { + enum _bat_pcm_format format_bat; + enum pcm_format format_tiny; +}; + +static struct format_map_table map_tables[] = { + { BAT_PCM_FORMAT_S16_LE, PCM_FORMAT_S16_LE }, + { BAT_PCM_FORMAT_S32_LE, PCM_FORMAT_S32_LE }, + { BAT_PCM_FORMAT_MAX, }, +}; + +static int format_convert(struct bat *bat, struct pcm_config *config) +{ + struct format_map_table *t = map_tables; + + for (; t->format_bat != BAT_PCM_FORMAT_MAX; t++) { + if (t->format_bat == bat->format) { + config->format = t->format_tiny; + return 0; + } + } + fprintf(bat->err, _("Invalid format!\n")); + return -EINVAL; +} + +static int init_config(struct bat *bat, struct pcm_config *config) +{ + config->channels = bat->channels; + config->rate = bat->rate; + if (bat->period_size > 0) + config->period_size = bat->period_size; + else + config->period_size = TINYALSA_PERIODSIZE; + config->period_count = 4; + config->start_threshold = 0; + config->stop_threshold = 0; + config->silence_threshold = 0; + + return format_convert(bat, config); +} + +/** + * Called when thread is finished + */ +static void close_handle(void *handle) +{ + struct pcm *pcm = handle; + + if (NULL != pcm) + pcm_close(pcm); +} + +/** + * Check that a parameter is inside bounds + */ +static int check_param(struct bat *bat, struct pcm_params *params, + unsigned int param, unsigned int value, + char *param_name, char *param_unit) +{ + unsigned int min; + unsigned int max; + int ret = 0; + + min = pcm_params_get_min(params, param); + if (value < min) { + fprintf(bat->err, + _("%s is %u%s, device only supports >= %u%s!\n"), + param_name, value, param_unit, min, param_unit); + ret = -EINVAL; + } + + max = pcm_params_get_max(params, param); + if (value > max) { + fprintf(bat->err, + _("%s is %u%s, device only supports <= %u%s!\n"), + param_name, value, param_unit, max, param_unit); + ret = -EINVAL; + } + + return ret; +} + +/** + * Check all parameters + */ +static int check_playback_params(struct bat *bat, + struct pcm_config *config) +{ + struct pcm_params *params; + unsigned int card = bat->playback.card_tiny; + unsigned int device = bat->playback.device_tiny; + int err = 0; + + params = pcm_params_get(card, device, PCM_OUT); + if (params == NULL) { + fprintf(bat->err, _("Unable to open PCM device %u!\n"), + device); + return -EINVAL; + } + + err = check_param(bat, params, PCM_PARAM_RATE, + config->rate, "Sample rate", "Hz"); + if (err < 0) + goto exit; + err = check_param(bat, params, PCM_PARAM_CHANNELS, + config->channels, "Sample", " channels"); + if (err < 0) + goto exit; + err = check_param(bat, params, PCM_PARAM_SAMPLE_BITS, + bat->sample_size * 8, "Bitrate", " bits"); + if (err < 0) + goto exit; + err = check_param(bat, params, PCM_PARAM_PERIOD_SIZE, + config->period_size, "Period size", "Hz"); + if (err < 0) + goto exit; + err = check_param(bat, params, PCM_PARAM_PERIODS, + config->period_count, "Period count", "Hz"); + if (err < 0) + goto exit; + +exit: + pcm_params_free(params); + + return err; +} + +/** + * Process output data for latency test + */ +static int latencytest_process_output(struct bat *bat, struct pcm *pcm, + void *buffer, int bytes) +{ + int err = 0; + int frames = bytes / bat->frame_size; + + fprintf(bat->log, _("Play sample with %d frames buffer\n"), frames); + + bat->latency.is_playing = true; + + while (1) { + /* generate output data */ + err = handleoutput(bat, buffer, bytes, frames); + if (err != 0) + break; + + err = pcm_write(pcm, buffer, bytes); + if (err != 0) + break; + + if (bat->latency.state == LATENCY_STATE_COMPLETE_SUCCESS) + break; + + bat->periods_played++; + } + + bat->latency.is_playing = false; + + return err; +} + +/** + * Play sample + */ +static int play_sample(struct bat *bat, struct pcm *pcm, + void *buffer, int bytes) +{ + int err = 0; + int frames = bytes / bat->frame_size; + FILE *fp = NULL; + int bytes_total = 0; + + if (bat->debugplay) { + fp = fopen(bat->debugplay, "wb"); + err = -errno; + if (fp == NULL) { + fprintf(bat->err, _("Cannot open file: %s %d\n"), + bat->debugplay, err); + return err; + } + /* leave space for file header */ + if (fseek(fp, sizeof(struct wav_container), SEEK_SET) != 0) { + err = -errno; + fclose(fp); + return err; + } + } + + while (1) { + err = generate_input_data(bat, buffer, bytes, frames); + if (err != 0) + break; + + if (bat->debugplay) { + if (fwrite(buffer, 1, bytes, fp) != bytes) { + err = -EIO; + break; + } + bytes_total += bytes; + } + + bat->periods_played++; + if (bat->period_is_limited + && bat->periods_played >= bat->periods_total) + break; + + err = pcm_write(pcm, buffer, bytes); + if (err != 0) + break; + } + + if (bat->debugplay) { + update_wav_header(bat, fp, bytes_total); + fclose(fp); + } + return err; +} + +static int get_tiny_device(struct bat *bat, char *alsa_device, + unsigned int *tiny_card, unsigned int *tiny_device) +{ + char *tmp1, *tmp2, *tmp3; + + if (alsa_device == NULL) + goto fail; + + tmp1 = strchr(alsa_device, ':'); + if (tmp1 == NULL) + goto fail; + + tmp3 = tmp1 + 1; + tmp2 = strchr(tmp3, ','); + if (tmp2 == NULL) + goto fail; + + tmp1 = tmp2 + 1; + *tiny_device = atoi(tmp1); + *tmp2 = '\0'; + *tiny_card = atoi(tmp3); + *tmp2 = ','; + + return 0; +fail: + fprintf(bat->err, _("Invalid tiny device: %s\n"), alsa_device); + return -EINVAL; +} + +/** + * Play + */ +void *playback_tinyalsa(struct bat *bat) +{ + int err = 0; + struct pcm_config config; + struct pcm *pcm = NULL; + void *buffer = NULL; + int bufbytes; + + fprintf(bat->log, _("Entering playback thread (tinyalsa).\n")); + + retval_play = 0; + + /* init device */ + err = get_tiny_device(bat, bat->playback.device, + &bat->playback.card_tiny, + &bat->playback.device_tiny); + if (err < 0) { + retval_play = err; + goto exit1; + } + + /* init config */ + err = init_config(bat, &config); + if (err < 0) { + retval_play = err; + goto exit1; + } + + /* check param before open device */ + err = check_playback_params(bat, &config); + if (err < 0) { + retval_play = err; + goto exit1; + } + + /* open device */ + pcm = pcm_open(bat->playback.card_tiny, bat->playback.device_tiny, + PCM_OUT, &config); + if (!pcm || !pcm_is_ready(pcm)) { + fprintf(bat->err, _("Unable to open PCM device %u (%s)!\n"), + bat->playback.device_tiny, pcm_get_error(pcm)); + retval_play = -EINVAL; + goto exit1; + } + + /* init buffer */ + bufbytes = pcm_frames_to_bytes(pcm, pcm_get_buffer_size(pcm)); + buffer = malloc(bufbytes); + if (!buffer) { + retval_play = -ENOMEM; + goto exit2; + } + + /* init playback source */ + if (bat->playback.file == NULL) { + fprintf(bat->log, _("Playing generated audio sine wave")); + bat->sinus_duration == 0 ? + fprintf(bat->log, _(" endlessly\n")) : + fprintf(bat->log, _("\n")); + } else { + fprintf(bat->log, _("Playing input audio file: %s\n"), + bat->playback.file); + bat->fp = fopen(bat->playback.file, "rb"); + err = -errno; + if (bat->fp == NULL) { + fprintf(bat->err, _("Cannot open file: %s %d\n"), + bat->playback.file, err); + retval_play = err; + goto exit3; + } + /* Skip header */ + err = read_wav_header(bat, bat->playback.file, bat->fp, true); + if (err != 0) { + retval_play = err; + goto exit4; + } + } + + if (bat->roundtriplatency) + err = latencytest_process_output(bat, pcm, buffer, bufbytes); + else + err = play_sample(bat, pcm, buffer, bufbytes); + if (err < 0) { + retval_play = err; + goto exit4; + } + +exit4: + if (bat->playback.file) + fclose(bat->fp); +exit3: + free(buffer); +exit2: + pcm_close(pcm); +exit1: + pthread_exit(&retval_play); +} + +/** + * Capture sample + */ +static int capture_sample(struct bat *bat, struct pcm *pcm, + void *buffer, unsigned int bytes) +{ + int err = 0; + FILE *fp = NULL; + unsigned int bytes_read = 0; + unsigned int bytes_count = bat->frames * bat->frame_size; + + remove(bat->capture.file); + fp = fopen(bat->capture.file, "wb"); + err = -errno; + if (fp == NULL) { + fprintf(bat->err, _("Cannot open file: %s %d\n"), + bat->capture.file, err); + return err; + } + /* leave space for file header */ + if (fseek(fp, sizeof(struct wav_container), SEEK_SET) != 0) { + err = -errno; + fclose(fp); + return err; + } + + while (bytes_read < bytes_count && !pcm_read(pcm, buffer, bytes)) { + if (fwrite(buffer, 1, bytes, fp) != bytes) + break; + + bytes_read += bytes; + + bat->periods_played++; + + if (bat->period_is_limited + && bat->periods_played >= bat->periods_total) + break; + } + + err = update_wav_header(bat, fp, bytes_read); + + fclose(fp); + return err; +} + +/** + * Process input data for latency test + */ +static int latencytest_process_input(struct bat *bat, struct pcm *pcm, + void *buffer, unsigned int bytes) +{ + int err = 0; + FILE *fp = NULL; + unsigned int bytes_read = 0; + unsigned int bytes_count = bat->frames * bat->frame_size; + + remove(bat->capture.file); + fp = fopen(bat->capture.file, "wb"); + err = -errno; + if (fp == NULL) { + fprintf(bat->err, _("Cannot open file: %s %d\n"), + bat->capture.file, err); + return err; + } + /* leave space for file header */ + if (fseek(fp, sizeof(struct wav_container), SEEK_SET) != 0) { + err = -errno; + fclose(fp); + return err; + } + + bat->latency.is_capturing = true; + + while (bytes_read < bytes_count && !pcm_read(pcm, buffer, bytes)) { + if (fwrite(buffer, 1, bytes, fp) != bytes) + break; + + err = handleinput(bat, buffer, bytes / bat->frame_size); + if (err != 0) + break; + + if (bat->latency.is_playing == false) + break; + + bytes_read += bytes; + } + + bat->latency.is_capturing = false; + + err = update_wav_header(bat, fp, bytes_read); + + fclose(fp); + return err; +} + +/** + * Record + */ +void *record_tinyalsa(struct bat *bat) +{ + int err = 0; + struct pcm_config config; + struct pcm *pcm; + void *buffer; + unsigned int bufbytes; + + pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, NULL); + + fprintf(bat->log, _("Entering capture thread (tinyalsa).\n")); + + retval_record = 0; + + /* init device */ + err = get_tiny_device(bat, bat->capture.device, + &bat->capture.card_tiny, + &bat->capture.device_tiny); + if (err < 0) { + retval_record = err; + goto exit1; + } + + /* init config */ + err = init_config(bat, &config); + if (err < 0) { + retval_record = err; + goto exit1; + } + + /* open device */ + pcm = pcm_open(bat->capture.card_tiny, bat->capture.device_tiny, + PCM_IN, &config); + if (!pcm || !pcm_is_ready(pcm)) { + fprintf(bat->err, _("Unable to open PCM device (%s)!\n"), + pcm_get_error(pcm)); + retval_record = -EINVAL; + goto exit1; + } + + /* init buffer */ + bufbytes = pcm_frames_to_bytes(pcm, pcm_get_buffer_size(pcm)); + buffer = malloc(bufbytes); + if (!buffer) { + retval_record = -ENOMEM; + goto exit2; + } + + pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL); + pthread_setcanceltype(PTHREAD_CANCEL_DEFERRED, NULL); + pthread_cleanup_push(close_handle, pcm); + pthread_cleanup_push(free, buffer); + + fprintf(bat->log, _("Recording ...\n")); + if (bat->roundtriplatency) + err = latencytest_process_input(bat, pcm, buffer, bufbytes); + else + err = capture_sample(bat, pcm, buffer, bufbytes); + if (err != 0) { + retval_record = err; + goto exit3; + } + + /* Normally we will never reach this part of code (unless error in + * previous call) (before exit3) as this thread will be cancelled + * by end of play thread. Except in single line mode. */ + pthread_cleanup_pop(0); + pthread_cleanup_pop(0); + pthread_exit(&retval_record); + +exit3: + free(buffer); +exit2: + pcm_close(pcm); +exit1: + pthread_exit(&retval_record); +} diff --git a/bat/tinyalsa.h b/bat/tinyalsa.h new file mode 100644 index 0000000..60f78f7 --- /dev/null +++ b/bat/tinyalsa.h @@ -0,0 +1,20 @@ +/* + * Copyright (C) 2013-2015 Intel Corporation + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + */ + +extern int retval_play; +extern int retval_record; + +void *playback_tinyalsa(struct bat *); +void *record_tinyalsa(struct bat *); diff --git a/compile b/compile new file mode 100755 index 0000000..99e5052 --- /dev/null +++ b/compile @@ -0,0 +1,348 @@ +#! /bin/sh +# Wrapper for compilers which do not understand '-c -o'. + +scriptversion=2018-03-07.03; # UTC + +# Copyright (C) 1999-2018 Free Software Foundation, Inc. +# Written by Tom Tromey . +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +# This file is maintained in Automake, please report +# bugs to or send patches to +# . + +nl=' +' + +# We need space, tab and new line, in precisely that order. Quoting is +# there to prevent tools from complaining about whitespace usage. +IFS=" "" $nl" + +file_conv= + +# func_file_conv build_file lazy +# Convert a $build file to $host form and store it in $file +# Currently only supports Windows hosts. If the determined conversion +# type is listed in (the comma separated) LAZY, no conversion will +# take place. +func_file_conv () +{ + file=$1 + case $file in + / | /[!/]*) # absolute file, and not a UNC file + if test -z "$file_conv"; then + # lazily determine how to convert abs files + case `uname -s` in + MINGW*) + file_conv=mingw + ;; + CYGWIN*) + file_conv=cygwin + ;; + *) + file_conv=wine + ;; + esac + fi + case $file_conv/,$2, in + *,$file_conv,*) + ;; + mingw/*) + file=`cmd //C echo "$file " | sed -e 's/"\(.*\) " *$/\1/'` + ;; + cygwin/*) + file=`cygpath -m "$file" || echo "$file"` + ;; + wine/*) + file=`winepath -w "$file" || echo "$file"` + ;; + esac + ;; + esac +} + +# func_cl_dashL linkdir +# Make cl look for libraries in LINKDIR +func_cl_dashL () +{ + func_file_conv "$1" + if test -z "$lib_path"; then + lib_path=$file + else + lib_path="$lib_path;$file" + fi + linker_opts="$linker_opts -LIBPATH:$file" +} + +# func_cl_dashl library +# Do a library search-path lookup for cl +func_cl_dashl () +{ + lib=$1 + found=no + save_IFS=$IFS + IFS=';' + for dir in $lib_path $LIB + do + IFS=$save_IFS + if $shared && test -f "$dir/$lib.dll.lib"; then + found=yes + lib=$dir/$lib.dll.lib + break + fi + if test -f "$dir/$lib.lib"; then + found=yes + lib=$dir/$lib.lib + break + fi + if test -f "$dir/lib$lib.a"; then + found=yes + lib=$dir/lib$lib.a + break + fi + done + IFS=$save_IFS + + if test "$found" != yes; then + lib=$lib.lib + fi +} + +# func_cl_wrapper cl arg... +# Adjust compile command to suit cl +func_cl_wrapper () +{ + # Assume a capable shell + lib_path= + shared=: + linker_opts= + for arg + do + if test -n "$eat"; then + eat= + else + case $1 in + -o) + # configure might choose to run compile as 'compile cc -o foo foo.c'. + eat=1 + case $2 in + *.o | *.[oO][bB][jJ]) + func_file_conv "$2" + set x "$@" -Fo"$file" + shift + ;; + *) + func_file_conv "$2" + set x "$@" -Fe"$file" + shift + ;; + esac + ;; + -I) + eat=1 + func_file_conv "$2" mingw + set x "$@" -I"$file" + shift + ;; + -I*) + func_file_conv "${1#-I}" mingw + set x "$@" -I"$file" + shift + ;; + -l) + eat=1 + func_cl_dashl "$2" + set x "$@" "$lib" + shift + ;; + -l*) + func_cl_dashl "${1#-l}" + set x "$@" "$lib" + shift + ;; + -L) + eat=1 + func_cl_dashL "$2" + ;; + -L*) + func_cl_dashL "${1#-L}" + ;; + -static) + shared=false + ;; + -Wl,*) + arg=${1#-Wl,} + save_ifs="$IFS"; IFS=',' + for flag in $arg; do + IFS="$save_ifs" + linker_opts="$linker_opts $flag" + done + IFS="$save_ifs" + ;; + -Xlinker) + eat=1 + linker_opts="$linker_opts $2" + ;; + -*) + set x "$@" "$1" + shift + ;; + *.cc | *.CC | *.cxx | *.CXX | *.[cC]++) + func_file_conv "$1" + set x "$@" -Tp"$file" + shift + ;; + *.c | *.cpp | *.CPP | *.lib | *.LIB | *.Lib | *.OBJ | *.obj | *.[oO]) + func_file_conv "$1" mingw + set x "$@" "$file" + shift + ;; + *) + set x "$@" "$1" + shift + ;; + esac + fi + shift + done + if test -n "$linker_opts"; then + linker_opts="-link$linker_opts" + fi + exec "$@" $linker_opts + exit 1 +} + +eat= + +case $1 in + '') + echo "$0: No command. Try '$0 --help' for more information." 1>&2 + exit 1; + ;; + -h | --h*) + cat <<\EOF +Usage: compile [--help] [--version] PROGRAM [ARGS] + +Wrapper for compilers which do not understand '-c -o'. +Remove '-o dest.o' from ARGS, run PROGRAM with the remaining +arguments, and rename the output as expected. + +If you are trying to build a whole package this is not the +right script to run: please start by reading the file 'INSTALL'. + +Report bugs to . +EOF + exit $? + ;; + -v | --v*) + echo "compile $scriptversion" + exit $? + ;; + cl | *[/\\]cl | cl.exe | *[/\\]cl.exe | \ + icl | *[/\\]icl | icl.exe | *[/\\]icl.exe ) + func_cl_wrapper "$@" # Doesn't return... + ;; +esac + +ofile= +cfile= + +for arg +do + if test -n "$eat"; then + eat= + else + case $1 in + -o) + # configure might choose to run compile as 'compile cc -o foo foo.c'. + # So we strip '-o arg' only if arg is an object. + eat=1 + case $2 in + *.o | *.obj) + ofile=$2 + ;; + *) + set x "$@" -o "$2" + shift + ;; + esac + ;; + *.c) + cfile=$1 + set x "$@" "$1" + shift + ;; + *) + set x "$@" "$1" + shift + ;; + esac + fi + shift +done + +if test -z "$ofile" || test -z "$cfile"; then + # If no '-o' option was seen then we might have been invoked from a + # pattern rule where we don't need one. That is ok -- this is a + # normal compilation that the losing compiler can handle. If no + # '.c' file was seen then we are probably linking. That is also + # ok. + exec "$@" +fi + +# Name of file we expect compiler to create. +cofile=`echo "$cfile" | sed 's|^.*[\\/]||; s|^[a-zA-Z]:||; s/\.c$/.o/'` + +# Create the lock directory. +# Note: use '[/\\:.-]' here to ensure that we don't use the same name +# that we are using for the .o file. Also, base the name on the expected +# object file name, since that is what matters with a parallel build. +lockdir=`echo "$cofile" | sed -e 's|[/\\:.-]|_|g'`.d +while true; do + if mkdir "$lockdir" >/dev/null 2>&1; then + break + fi + sleep 1 +done +# FIXME: race condition here if user kills between mkdir and trap. +trap "rmdir '$lockdir'; exit 1" 1 2 15 + +# Run the compile. +"$@" +ret=$? + +if test -f "$cofile"; then + test "$cofile" = "$ofile" || mv "$cofile" "$ofile" +elif test -f "${cofile}bj"; then + test "${cofile}bj" = "$ofile" || mv "${cofile}bj" "$ofile" +fi + +rmdir "$lockdir" +exit $ret + +# Local Variables: +# mode: shell-script +# sh-indentation: 2 +# eval: (add-hook 'before-save-hook 'time-stamp) +# time-stamp-start: "scriptversion=" +# time-stamp-format: "%:y-%02m-%02d.%02H" +# time-stamp-time-zone: "UTC0" +# time-stamp-end: "; # UTC" +# End: diff --git a/config.guess b/config.guess new file mode 100755 index 0000000..256083a --- /dev/null +++ b/config.guess @@ -0,0 +1,1476 @@ +#! /bin/sh +# Attempt to guess a canonical system name. +# Copyright 1992-2018 Free Software Foundation, Inc. + +timestamp='2018-03-08' + +# This file is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, see . +# +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that +# program. This Exception is an additional permission under section 7 +# of the GNU General Public License, version 3 ("GPLv3"). +# +# Originally written by Per Bothner; maintained since 2000 by Ben Elliston. +# +# You can get the latest version of this script from: +# https://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess +# +# Please send patches to . + + +me=`echo "$0" | sed -e 's,.*/,,'` + +usage="\ +Usage: $0 [OPTION] + +Output the configuration name of the system \`$me' is run on. + +Options: + -h, --help print this help, then exit + -t, --time-stamp print date of last modification, then exit + -v, --version print version number, then exit + +Report bugs and patches to ." + +version="\ +GNU config.guess ($timestamp) + +Originally written by Per Bothner. +Copyright 1992-2018 Free Software Foundation, Inc. + +This is free software; see the source for copying conditions. There is NO +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." + +help=" +Try \`$me --help' for more information." + +# Parse command line +while test $# -gt 0 ; do + case $1 in + --time-stamp | --time* | -t ) + echo "$timestamp" ; exit ;; + --version | -v ) + echo "$version" ; exit ;; + --help | --h* | -h ) + echo "$usage"; exit ;; + -- ) # Stop option processing + shift; break ;; + - ) # Use stdin as input. + break ;; + -* ) + echo "$me: invalid option $1$help" >&2 + exit 1 ;; + * ) + break ;; + esac +done + +if test $# != 0; then + echo "$me: too many arguments$help" >&2 + exit 1 +fi + +trap 'exit 1' 1 2 15 + +# CC_FOR_BUILD -- compiler used by this script. Note that the use of a +# compiler to aid in system detection is discouraged as it requires +# temporary files to be created and, as you can see below, it is a +# headache to deal with in a portable fashion. + +# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still +# use `HOST_CC' if defined, but it is deprecated. + +# Portable tmp directory creation inspired by the Autoconf team. + +set_cc_for_build=' +trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ; +trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ; +: ${TMPDIR=/tmp} ; + { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || + { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } || + { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } || + { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ; +dummy=$tmp/dummy ; +tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ; +case $CC_FOR_BUILD,$HOST_CC,$CC in + ,,) echo "int x;" > "$dummy.c" ; + for c in cc gcc c89 c99 ; do + if ($c -c -o "$dummy.o" "$dummy.c") >/dev/null 2>&1 ; then + CC_FOR_BUILD="$c"; break ; + fi ; + done ; + if test x"$CC_FOR_BUILD" = x ; then + CC_FOR_BUILD=no_compiler_found ; + fi + ;; + ,,*) CC_FOR_BUILD=$CC ;; + ,*,*) CC_FOR_BUILD=$HOST_CC ;; +esac ; set_cc_for_build= ;' + +# This is needed to find uname on a Pyramid OSx when run in the BSD universe. +# (ghazi@noc.rutgers.edu 1994-08-24) +if (test -f /.attbin/uname) >/dev/null 2>&1 ; then + PATH=$PATH:/.attbin ; export PATH +fi + +UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown +UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown +UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown +UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown + +case "$UNAME_SYSTEM" in +Linux|GNU|GNU/*) + # If the system lacks a compiler, then just pick glibc. + # We could probably try harder. + LIBC=gnu + + eval "$set_cc_for_build" + cat <<-EOF > "$dummy.c" + #include + #if defined(__UCLIBC__) + LIBC=uclibc + #elif defined(__dietlibc__) + LIBC=dietlibc + #else + LIBC=gnu + #endif + EOF + eval "`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^LIBC' | sed 's, ,,g'`" + + # If ldd exists, use it to detect musl libc. + if command -v ldd >/dev/null && \ + ldd --version 2>&1 | grep -q ^musl + then + LIBC=musl + fi + ;; +esac + +# Note: order is significant - the case branches are not exclusive. + +case "$UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION" in + *:NetBSD:*:*) + # NetBSD (nbsd) targets should (where applicable) match one or + # more of the tuples: *-*-netbsdelf*, *-*-netbsdaout*, + # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently + # switched to ELF, *-*-netbsd* would select the old + # object file format. This provides both forward + # compatibility and a consistent mechanism for selecting the + # object file format. + # + # Note: NetBSD doesn't particularly care about the vendor + # portion of the name. We always set it to "unknown". + sysctl="sysctl -n hw.machine_arch" + UNAME_MACHINE_ARCH=`(uname -p 2>/dev/null || \ + "/sbin/$sysctl" 2>/dev/null || \ + "/usr/sbin/$sysctl" 2>/dev/null || \ + echo unknown)` + case "$UNAME_MACHINE_ARCH" in + armeb) machine=armeb-unknown ;; + arm*) machine=arm-unknown ;; + sh3el) machine=shl-unknown ;; + sh3eb) machine=sh-unknown ;; + sh5el) machine=sh5le-unknown ;; + earmv*) + arch=`echo "$UNAME_MACHINE_ARCH" | sed -e 's,^e\(armv[0-9]\).*$,\1,'` + endian=`echo "$UNAME_MACHINE_ARCH" | sed -ne 's,^.*\(eb\)$,\1,p'` + machine="${arch}${endian}"-unknown + ;; + *) machine="$UNAME_MACHINE_ARCH"-unknown ;; + esac + # The Operating System including object format, if it has switched + # to ELF recently (or will in the future) and ABI. + case "$UNAME_MACHINE_ARCH" in + earm*) + os=netbsdelf + ;; + arm*|i386|m68k|ns32k|sh3*|sparc|vax) + eval "$set_cc_for_build" + if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ + | grep -q __ELF__ + then + # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). + # Return netbsd for either. FIX? + os=netbsd + else + os=netbsdelf + fi + ;; + *) + os=netbsd + ;; + esac + # Determine ABI tags. + case "$UNAME_MACHINE_ARCH" in + earm*) + expr='s/^earmv[0-9]/-eabi/;s/eb$//' + abi=`echo "$UNAME_MACHINE_ARCH" | sed -e "$expr"` + ;; + esac + # The OS release + # Debian GNU/NetBSD machines have a different userland, and + # thus, need a distinct triplet. However, they do not need + # kernel version information, so it can be replaced with a + # suitable tag, in the style of linux-gnu. + case "$UNAME_VERSION" in + Debian*) + release='-gnu' + ;; + *) + release=`echo "$UNAME_RELEASE" | sed -e 's/[-_].*//' | cut -d. -f1,2` + ;; + esac + # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: + # contains redundant information, the shorter form: + # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. + echo "$machine-${os}${release}${abi}" + exit ;; + *:Bitrig:*:*) + UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'` + echo "$UNAME_MACHINE_ARCH"-unknown-bitrig"$UNAME_RELEASE" + exit ;; + *:OpenBSD:*:*) + UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'` + echo "$UNAME_MACHINE_ARCH"-unknown-openbsd"$UNAME_RELEASE" + exit ;; + *:LibertyBSD:*:*) + UNAME_MACHINE_ARCH=`arch | sed 's/^.*BSD\.//'` + echo "$UNAME_MACHINE_ARCH"-unknown-libertybsd"$UNAME_RELEASE" + exit ;; + *:MidnightBSD:*:*) + echo "$UNAME_MACHINE"-unknown-midnightbsd"$UNAME_RELEASE" + exit ;; + *:ekkoBSD:*:*) + echo "$UNAME_MACHINE"-unknown-ekkobsd"$UNAME_RELEASE" + exit ;; + *:SolidBSD:*:*) + echo "$UNAME_MACHINE"-unknown-solidbsd"$UNAME_RELEASE" + exit ;; + macppc:MirBSD:*:*) + echo powerpc-unknown-mirbsd"$UNAME_RELEASE" + exit ;; + *:MirBSD:*:*) + echo "$UNAME_MACHINE"-unknown-mirbsd"$UNAME_RELEASE" + exit ;; + *:Sortix:*:*) + echo "$UNAME_MACHINE"-unknown-sortix + exit ;; + *:Redox:*:*) + echo "$UNAME_MACHINE"-unknown-redox + exit ;; + mips:OSF1:*.*) + echo mips-dec-osf1 + exit ;; + alpha:OSF1:*:*) + case $UNAME_RELEASE in + *4.0) + UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` + ;; + *5.*) + UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'` + ;; + esac + # According to Compaq, /usr/sbin/psrinfo has been available on + # OSF/1 and Tru64 systems produced since 1995. I hope that + # covers most systems running today. This code pipes the CPU + # types through head -n 1, so we only detect the type of CPU 0. + ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1` + case "$ALPHA_CPU_TYPE" in + "EV4 (21064)") + UNAME_MACHINE=alpha ;; + "EV4.5 (21064)") + UNAME_MACHINE=alpha ;; + "LCA4 (21066/21068)") + UNAME_MACHINE=alpha ;; + "EV5 (21164)") + UNAME_MACHINE=alphaev5 ;; + "EV5.6 (21164A)") + UNAME_MACHINE=alphaev56 ;; + "EV5.6 (21164PC)") + UNAME_MACHINE=alphapca56 ;; + "EV5.7 (21164PC)") + UNAME_MACHINE=alphapca57 ;; + "EV6 (21264)") + UNAME_MACHINE=alphaev6 ;; + "EV6.7 (21264A)") + UNAME_MACHINE=alphaev67 ;; + "EV6.8CB (21264C)") + UNAME_MACHINE=alphaev68 ;; + "EV6.8AL (21264B)") + UNAME_MACHINE=alphaev68 ;; + "EV6.8CX (21264D)") + UNAME_MACHINE=alphaev68 ;; + "EV6.9A (21264/EV69A)") + UNAME_MACHINE=alphaev69 ;; + "EV7 (21364)") + UNAME_MACHINE=alphaev7 ;; + "EV7.9 (21364A)") + UNAME_MACHINE=alphaev79 ;; + esac + # A Pn.n version is a patched version. + # A Vn.n version is a released version. + # A Tn.n version is a released field test version. + # A Xn.n version is an unreleased experimental baselevel. + # 1.2 uses "1.2" for uname -r. + echo "$UNAME_MACHINE"-dec-osf"`echo "$UNAME_RELEASE" | sed -e 's/^[PVTX]//' | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz`" + # Reset EXIT trap before exiting to avoid spurious non-zero exit code. + exitcode=$? + trap '' 0 + exit $exitcode ;; + Amiga*:UNIX_System_V:4.0:*) + echo m68k-unknown-sysv4 + exit ;; + *:[Aa]miga[Oo][Ss]:*:*) + echo "$UNAME_MACHINE"-unknown-amigaos + exit ;; + *:[Mm]orph[Oo][Ss]:*:*) + echo "$UNAME_MACHINE"-unknown-morphos + exit ;; + *:OS/390:*:*) + echo i370-ibm-openedition + exit ;; + *:z/VM:*:*) + echo s390-ibm-zvmoe + exit ;; + *:OS400:*:*) + echo powerpc-ibm-os400 + exit ;; + arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) + echo arm-acorn-riscix"$UNAME_RELEASE" + exit ;; + arm*:riscos:*:*|arm*:RISCOS:*:*) + echo arm-unknown-riscos + exit ;; + SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) + echo hppa1.1-hitachi-hiuxmpp + exit ;; + Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) + # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. + if test "`(/bin/universe) 2>/dev/null`" = att ; then + echo pyramid-pyramid-sysv3 + else + echo pyramid-pyramid-bsd + fi + exit ;; + NILE*:*:*:dcosx) + echo pyramid-pyramid-svr4 + exit ;; + DRS?6000:unix:4.0:6*) + echo sparc-icl-nx6 + exit ;; + DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*) + case `/usr/bin/uname -p` in + sparc) echo sparc-icl-nx7; exit ;; + esac ;; + s390x:SunOS:*:*) + echo "$UNAME_MACHINE"-ibm-solaris2"`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`" + exit ;; + sun4H:SunOS:5.*:*) + echo sparc-hal-solaris2"`echo "$UNAME_RELEASE"|sed -e 's/[^.]*//'`" + exit ;; + sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) + echo sparc-sun-solaris2"`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`" + exit ;; + i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*) + echo i386-pc-auroraux"$UNAME_RELEASE" + exit ;; + i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*) + eval "$set_cc_for_build" + SUN_ARCH=i386 + # If there is a compiler, see if it is configured for 64-bit objects. + # Note that the Sun cc does not turn __LP64__ into 1 like gcc does. + # This test works for both compilers. + if [ "$CC_FOR_BUILD" != no_compiler_found ]; then + if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \ + (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \ + grep IS_64BIT_ARCH >/dev/null + then + SUN_ARCH=x86_64 + fi + fi + echo "$SUN_ARCH"-pc-solaris2"`echo "$UNAME_RELEASE"|sed -e 's/[^.]*//'`" + exit ;; + sun4*:SunOS:6*:*) + # According to config.sub, this is the proper way to canonicalize + # SunOS6. Hard to guess exactly what SunOS6 will be like, but + # it's likely to be more like Solaris than SunOS4. + echo sparc-sun-solaris3"`echo "$UNAME_RELEASE"|sed -e 's/[^.]*//'`" + exit ;; + sun4*:SunOS:*:*) + case "`/usr/bin/arch -k`" in + Series*|S4*) + UNAME_RELEASE=`uname -v` + ;; + esac + # Japanese Language versions have a version number like `4.1.3-JL'. + echo sparc-sun-sunos"`echo "$UNAME_RELEASE"|sed -e 's/-/_/'`" + exit ;; + sun3*:SunOS:*:*) + echo m68k-sun-sunos"$UNAME_RELEASE" + exit ;; + sun*:*:4.2BSD:*) + UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` + test "x$UNAME_RELEASE" = x && UNAME_RELEASE=3 + case "`/bin/arch`" in + sun3) + echo m68k-sun-sunos"$UNAME_RELEASE" + ;; + sun4) + echo sparc-sun-sunos"$UNAME_RELEASE" + ;; + esac + exit ;; + aushp:SunOS:*:*) + echo sparc-auspex-sunos"$UNAME_RELEASE" + exit ;; + # The situation for MiNT is a little confusing. The machine name + # can be virtually everything (everything which is not + # "atarist" or "atariste" at least should have a processor + # > m68000). The system name ranges from "MiNT" over "FreeMiNT" + # to the lowercase version "mint" (or "freemint"). Finally + # the system name "TOS" denotes a system which is actually not + # MiNT. But MiNT is downward compatible to TOS, so this should + # be no problem. + atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) + echo m68k-atari-mint"$UNAME_RELEASE" + exit ;; + atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) + echo m68k-atari-mint"$UNAME_RELEASE" + exit ;; + *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) + echo m68k-atari-mint"$UNAME_RELEASE" + exit ;; + milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) + echo m68k-milan-mint"$UNAME_RELEASE" + exit ;; + hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) + echo m68k-hades-mint"$UNAME_RELEASE" + exit ;; + *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) + echo m68k-unknown-mint"$UNAME_RELEASE" + exit ;; + m68k:machten:*:*) + echo m68k-apple-machten"$UNAME_RELEASE" + exit ;; + powerpc:machten:*:*) + echo powerpc-apple-machten"$UNAME_RELEASE" + exit ;; + RISC*:Mach:*:*) + echo mips-dec-mach_bsd4.3 + exit ;; + RISC*:ULTRIX:*:*) + echo mips-dec-ultrix"$UNAME_RELEASE" + exit ;; + VAX*:ULTRIX*:*:*) + echo vax-dec-ultrix"$UNAME_RELEASE" + exit ;; + 2020:CLIX:*:* | 2430:CLIX:*:*) + echo clipper-intergraph-clix"$UNAME_RELEASE" + exit ;; + mips:*:*:UMIPS | mips:*:*:RISCos) + eval "$set_cc_for_build" + sed 's/^ //' << EOF > "$dummy.c" +#ifdef __cplusplus +#include /* for printf() prototype */ + int main (int argc, char *argv[]) { +#else + int main (argc, argv) int argc; char *argv[]; { +#endif + #if defined (host_mips) && defined (MIPSEB) + #if defined (SYSTYPE_SYSV) + printf ("mips-mips-riscos%ssysv\\n", argv[1]); exit (0); + #endif + #if defined (SYSTYPE_SVR4) + printf ("mips-mips-riscos%ssvr4\\n", argv[1]); exit (0); + #endif + #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) + printf ("mips-mips-riscos%sbsd\\n", argv[1]); exit (0); + #endif + #endif + exit (-1); + } +EOF + $CC_FOR_BUILD -o "$dummy" "$dummy.c" && + dummyarg=`echo "$UNAME_RELEASE" | sed -n 's/\([0-9]*\).*/\1/p'` && + SYSTEM_NAME=`"$dummy" "$dummyarg"` && + { echo "$SYSTEM_NAME"; exit; } + echo mips-mips-riscos"$UNAME_RELEASE" + exit ;; + Motorola:PowerMAX_OS:*:*) + echo powerpc-motorola-powermax + exit ;; + Motorola:*:4.3:PL8-*) + echo powerpc-harris-powermax + exit ;; + Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*) + echo powerpc-harris-powermax + exit ;; + Night_Hawk:Power_UNIX:*:*) + echo powerpc-harris-powerunix + exit ;; + m88k:CX/UX:7*:*) + echo m88k-harris-cxux7 + exit ;; + m88k:*:4*:R4*) + echo m88k-motorola-sysv4 + exit ;; + m88k:*:3*:R3*) + echo m88k-motorola-sysv3 + exit ;; + AViiON:dgux:*:*) + # DG/UX returns AViiON for all architectures + UNAME_PROCESSOR=`/usr/bin/uname -p` + if [ "$UNAME_PROCESSOR" = mc88100 ] || [ "$UNAME_PROCESSOR" = mc88110 ] + then + if [ "$TARGET_BINARY_INTERFACE"x = m88kdguxelfx ] || \ + [ "$TARGET_BINARY_INTERFACE"x = x ] + then + echo m88k-dg-dgux"$UNAME_RELEASE" + else + echo m88k-dg-dguxbcs"$UNAME_RELEASE" + fi + else + echo i586-dg-dgux"$UNAME_RELEASE" + fi + exit ;; + M88*:DolphinOS:*:*) # DolphinOS (SVR3) + echo m88k-dolphin-sysv3 + exit ;; + M88*:*:R3*:*) + # Delta 88k system running SVR3 + echo m88k-motorola-sysv3 + exit ;; + XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) + echo m88k-tektronix-sysv3 + exit ;; + Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) + echo m68k-tektronix-bsd + exit ;; + *:IRIX*:*:*) + echo mips-sgi-irix"`echo "$UNAME_RELEASE"|sed -e 's/-/_/g'`" + exit ;; + ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. + echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id + exit ;; # Note that: echo "'`uname -s`'" gives 'AIX ' + i*86:AIX:*:*) + echo i386-ibm-aix + exit ;; + ia64:AIX:*:*) + if [ -x /usr/bin/oslevel ] ; then + IBM_REV=`/usr/bin/oslevel` + else + IBM_REV="$UNAME_VERSION.$UNAME_RELEASE" + fi + echo "$UNAME_MACHINE"-ibm-aix"$IBM_REV" + exit ;; + *:AIX:2:3) + if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then + eval "$set_cc_for_build" + sed 's/^ //' << EOF > "$dummy.c" + #include + + main() + { + if (!__power_pc()) + exit(1); + puts("powerpc-ibm-aix3.2.5"); + exit(0); + } +EOF + if $CC_FOR_BUILD -o "$dummy" "$dummy.c" && SYSTEM_NAME=`"$dummy"` + then + echo "$SYSTEM_NAME" + else + echo rs6000-ibm-aix3.2.5 + fi + elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then + echo rs6000-ibm-aix3.2.4 + else + echo rs6000-ibm-aix3.2 + fi + exit ;; + *:AIX:*:[4567]) + IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` + if /usr/sbin/lsattr -El "$IBM_CPU_ID" | grep ' POWER' >/dev/null 2>&1; then + IBM_ARCH=rs6000 + else + IBM_ARCH=powerpc + fi + if [ -x /usr/bin/lslpp ] ; then + IBM_REV=`/usr/bin/lslpp -Lqc bos.rte.libc | + awk -F: '{ print $3 }' | sed s/[0-9]*$/0/` + else + IBM_REV="$UNAME_VERSION.$UNAME_RELEASE" + fi + echo "$IBM_ARCH"-ibm-aix"$IBM_REV" + exit ;; + *:AIX:*:*) + echo rs6000-ibm-aix + exit ;; + ibmrt:4.4BSD:*|romp-ibm:4.4BSD:*) + echo romp-ibm-bsd4.4 + exit ;; + ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and + echo romp-ibm-bsd"$UNAME_RELEASE" # 4.3 with uname added to + exit ;; # report: romp-ibm BSD 4.3 + *:BOSX:*:*) + echo rs6000-bull-bosx + exit ;; + DPX/2?00:B.O.S.:*:*) + echo m68k-bull-sysv3 + exit ;; + 9000/[34]??:4.3bsd:1.*:*) + echo m68k-hp-bsd + exit ;; + hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) + echo m68k-hp-bsd4.4 + exit ;; + 9000/[34678]??:HP-UX:*:*) + HPUX_REV=`echo "$UNAME_RELEASE"|sed -e 's/[^.]*.[0B]*//'` + case "$UNAME_MACHINE" in + 9000/31?) HP_ARCH=m68000 ;; + 9000/[34]??) HP_ARCH=m68k ;; + 9000/[678][0-9][0-9]) + if [ -x /usr/bin/getconf ]; then + sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` + sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` + case "$sc_cpu_version" in + 523) HP_ARCH=hppa1.0 ;; # CPU_PA_RISC1_0 + 528) HP_ARCH=hppa1.1 ;; # CPU_PA_RISC1_1 + 532) # CPU_PA_RISC2_0 + case "$sc_kernel_bits" in + 32) HP_ARCH=hppa2.0n ;; + 64) HP_ARCH=hppa2.0w ;; + '') HP_ARCH=hppa2.0 ;; # HP-UX 10.20 + esac ;; + esac + fi + if [ "$HP_ARCH" = "" ]; then + eval "$set_cc_for_build" + sed 's/^ //' << EOF > "$dummy.c" + + #define _HPUX_SOURCE + #include + #include + + int main () + { + #if defined(_SC_KERNEL_BITS) + long bits = sysconf(_SC_KERNEL_BITS); + #endif + long cpu = sysconf (_SC_CPU_VERSION); + + switch (cpu) + { + case CPU_PA_RISC1_0: puts ("hppa1.0"); break; + case CPU_PA_RISC1_1: puts ("hppa1.1"); break; + case CPU_PA_RISC2_0: + #if defined(_SC_KERNEL_BITS) + switch (bits) + { + case 64: puts ("hppa2.0w"); break; + case 32: puts ("hppa2.0n"); break; + default: puts ("hppa2.0"); break; + } break; + #else /* !defined(_SC_KERNEL_BITS) */ + puts ("hppa2.0"); break; + #endif + default: puts ("hppa1.0"); break; + } + exit (0); + } +EOF + (CCOPTS="" $CC_FOR_BUILD -o "$dummy" "$dummy.c" 2>/dev/null) && HP_ARCH=`"$dummy"` + test -z "$HP_ARCH" && HP_ARCH=hppa + fi ;; + esac + if [ "$HP_ARCH" = hppa2.0w ] + then + eval "$set_cc_for_build" + + # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating + # 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler + # generating 64-bit code. GNU and HP use different nomenclature: + # + # $ CC_FOR_BUILD=cc ./config.guess + # => hppa2.0w-hp-hpux11.23 + # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess + # => hppa64-hp-hpux11.23 + + if echo __LP64__ | (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | + grep -q __LP64__ + then + HP_ARCH=hppa2.0w + else + HP_ARCH=hppa64 + fi + fi + echo "$HP_ARCH"-hp-hpux"$HPUX_REV" + exit ;; + ia64:HP-UX:*:*) + HPUX_REV=`echo "$UNAME_RELEASE"|sed -e 's/[^.]*.[0B]*//'` + echo ia64-hp-hpux"$HPUX_REV" + exit ;; + 3050*:HI-UX:*:*) + eval "$set_cc_for_build" + sed 's/^ //' << EOF > "$dummy.c" + #include + int + main () + { + long cpu = sysconf (_SC_CPU_VERSION); + /* The order matters, because CPU_IS_HP_MC68K erroneously returns + true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct + results, however. */ + if (CPU_IS_PA_RISC (cpu)) + { + switch (cpu) + { + case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break; + case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break; + case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break; + default: puts ("hppa-hitachi-hiuxwe2"); break; + } + } + else if (CPU_IS_HP_MC68K (cpu)) + puts ("m68k-hitachi-hiuxwe2"); + else puts ("unknown-hitachi-hiuxwe2"); + exit (0); + } +EOF + $CC_FOR_BUILD -o "$dummy" "$dummy.c" && SYSTEM_NAME=`"$dummy"` && + { echo "$SYSTEM_NAME"; exit; } + echo unknown-hitachi-hiuxwe2 + exit ;; + 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:*) + echo hppa1.1-hp-bsd + exit ;; + 9000/8??:4.3bsd:*:*) + echo hppa1.0-hp-bsd + exit ;; + *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) + echo hppa1.0-hp-mpeix + exit ;; + hp7??:OSF1:*:* | hp8?[79]:OSF1:*:*) + echo hppa1.1-hp-osf + exit ;; + hp8??:OSF1:*:*) + echo hppa1.0-hp-osf + exit ;; + i*86:OSF1:*:*) + if [ -x /usr/sbin/sysversion ] ; then + echo "$UNAME_MACHINE"-unknown-osf1mk + else + echo "$UNAME_MACHINE"-unknown-osf1 + fi + exit ;; + parisc*:Lites*:*:*) + echo hppa1.1-hp-lites + exit ;; + C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) + echo c1-convex-bsd + exit ;; + C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) + if getsysinfo -f scalar_acc + then echo c32-convex-bsd + else echo c2-convex-bsd + fi + exit ;; + C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) + echo c34-convex-bsd + exit ;; + C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) + echo c38-convex-bsd + exit ;; + C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) + echo c4-convex-bsd + exit ;; + CRAY*Y-MP:*:*:*) + echo ymp-cray-unicos"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/' + exit ;; + CRAY*[A-Z]90:*:*:*) + echo "$UNAME_MACHINE"-cray-unicos"$UNAME_RELEASE" \ + | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ + -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \ + -e 's/\.[^.]*$/.X/' + exit ;; + CRAY*TS:*:*:*) + echo t90-cray-unicos"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/' + exit ;; + CRAY*T3E:*:*:*) + echo alphaev5-cray-unicosmk"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/' + exit ;; + CRAY*SV1:*:*:*) + echo sv1-cray-unicos"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/' + exit ;; + *:UNICOS/mp:*:*) + echo craynv-cray-unicosmp"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/' + exit ;; + F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) + FUJITSU_PROC=`uname -m | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz` + FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'` + FUJITSU_REL=`echo "$UNAME_RELEASE" | sed -e 's/ /_/'` + echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" + exit ;; + 5000:UNIX_System_V:4.*:*) + FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'` + FUJITSU_REL=`echo "$UNAME_RELEASE" | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/ /_/'` + echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" + exit ;; + i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) + echo "$UNAME_MACHINE"-pc-bsdi"$UNAME_RELEASE" + exit ;; + sparc*:BSD/OS:*:*) + echo sparc-unknown-bsdi"$UNAME_RELEASE" + exit ;; + *:BSD/OS:*:*) + echo "$UNAME_MACHINE"-unknown-bsdi"$UNAME_RELEASE" + exit ;; + *:FreeBSD:*:*) + UNAME_PROCESSOR=`/usr/bin/uname -p` + case "$UNAME_PROCESSOR" in + amd64) + UNAME_PROCESSOR=x86_64 ;; + i386) + UNAME_PROCESSOR=i586 ;; + esac + echo "$UNAME_PROCESSOR"-unknown-freebsd"`echo "$UNAME_RELEASE"|sed -e 's/[-(].*//'`" + exit ;; + i*:CYGWIN*:*) + echo "$UNAME_MACHINE"-pc-cygwin + exit ;; + *:MINGW64*:*) + echo "$UNAME_MACHINE"-pc-mingw64 + exit ;; + *:MINGW*:*) + echo "$UNAME_MACHINE"-pc-mingw32 + exit ;; + *:MSYS*:*) + echo "$UNAME_MACHINE"-pc-msys + exit ;; + i*:PW*:*) + echo "$UNAME_MACHINE"-pc-pw32 + exit ;; + *:Interix*:*) + case "$UNAME_MACHINE" in + x86) + echo i586-pc-interix"$UNAME_RELEASE" + exit ;; + authenticamd | genuineintel | EM64T) + echo x86_64-unknown-interix"$UNAME_RELEASE" + exit ;; + IA64) + echo ia64-unknown-interix"$UNAME_RELEASE" + exit ;; + esac ;; + i*:UWIN*:*) + echo "$UNAME_MACHINE"-pc-uwin + exit ;; + amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*) + echo x86_64-unknown-cygwin + exit ;; + prep*:SunOS:5.*:*) + echo powerpcle-unknown-solaris2"`echo "$UNAME_RELEASE"|sed -e 's/[^.]*//'`" + exit ;; + *:GNU:*:*) + # the GNU system + echo "`echo "$UNAME_MACHINE"|sed -e 's,[-/].*$,,'`-unknown-$LIBC`echo "$UNAME_RELEASE"|sed -e 's,/.*$,,'`" + exit ;; + *:GNU/*:*:*) + # other systems with GNU libc and userland + echo "$UNAME_MACHINE-unknown-`echo "$UNAME_SYSTEM" | sed 's,^[^/]*/,,' | tr "[:upper:]" "[:lower:]"``echo "$UNAME_RELEASE"|sed -e 's/[-(].*//'`-$LIBC" + exit ;; + i*86:Minix:*:*) + echo "$UNAME_MACHINE"-pc-minix + exit ;; + aarch64:Linux:*:*) + echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" + exit ;; + aarch64_be:Linux:*:*) + UNAME_MACHINE=aarch64_be + echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" + exit ;; + alpha:Linux:*:*) + case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in + EV5) UNAME_MACHINE=alphaev5 ;; + EV56) UNAME_MACHINE=alphaev56 ;; + PCA56) UNAME_MACHINE=alphapca56 ;; + PCA57) UNAME_MACHINE=alphapca56 ;; + EV6) UNAME_MACHINE=alphaev6 ;; + EV67) UNAME_MACHINE=alphaev67 ;; + EV68*) UNAME_MACHINE=alphaev68 ;; + esac + objdump --private-headers /bin/sh | grep -q ld.so.1 + if test "$?" = 0 ; then LIBC=gnulibc1 ; fi + echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" + exit ;; + arc:Linux:*:* | arceb:Linux:*:*) + echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" + exit ;; + arm*:Linux:*:*) + eval "$set_cc_for_build" + if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \ + | grep -q __ARM_EABI__ + then + echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" + else + if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \ + | grep -q __ARM_PCS_VFP + then + echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"eabi + else + echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"eabihf + fi + fi + exit ;; + avr32*:Linux:*:*) + echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" + exit ;; + cris:Linux:*:*) + echo "$UNAME_MACHINE"-axis-linux-"$LIBC" + exit ;; + crisv32:Linux:*:*) + echo "$UNAME_MACHINE"-axis-linux-"$LIBC" + exit ;; + e2k:Linux:*:*) + echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" + exit ;; + frv:Linux:*:*) + echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" + exit ;; + hexagon:Linux:*:*) + echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" + exit ;; + i*86:Linux:*:*) + echo "$UNAME_MACHINE"-pc-linux-"$LIBC" + exit ;; + ia64:Linux:*:*) + echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" + exit ;; + k1om:Linux:*:*) + echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" + exit ;; + m32r*:Linux:*:*) + echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" + exit ;; + m68*:Linux:*:*) + echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" + exit ;; + mips:Linux:*:* | mips64:Linux:*:*) + eval "$set_cc_for_build" + sed 's/^ //' << EOF > "$dummy.c" + #undef CPU + #undef ${UNAME_MACHINE} + #undef ${UNAME_MACHINE}el + #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) + CPU=${UNAME_MACHINE}el + #else + #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) + CPU=${UNAME_MACHINE} + #else + CPU= + #endif + #endif +EOF + eval "`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^CPU'`" + test "x$CPU" != x && { echo "$CPU-unknown-linux-$LIBC"; exit; } + ;; + mips64el:Linux:*:*) + echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" + exit ;; + openrisc*:Linux:*:*) + echo or1k-unknown-linux-"$LIBC" + exit ;; + or32:Linux:*:* | or1k*:Linux:*:*) + echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" + exit ;; + padre:Linux:*:*) + echo sparc-unknown-linux-"$LIBC" + exit ;; + parisc64:Linux:*:* | hppa64:Linux:*:*) + echo hppa64-unknown-linux-"$LIBC" + exit ;; + parisc:Linux:*:* | hppa:Linux:*:*) + # Look for CPU level + case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in + PA7*) echo hppa1.1-unknown-linux-"$LIBC" ;; + PA8*) echo hppa2.0-unknown-linux-"$LIBC" ;; + *) echo hppa-unknown-linux-"$LIBC" ;; + esac + exit ;; + ppc64:Linux:*:*) + echo powerpc64-unknown-linux-"$LIBC" + exit ;; + ppc:Linux:*:*) + echo powerpc-unknown-linux-"$LIBC" + exit ;; + ppc64le:Linux:*:*) + echo powerpc64le-unknown-linux-"$LIBC" + exit ;; + ppcle:Linux:*:*) + echo powerpcle-unknown-linux-"$LIBC" + exit ;; + riscv32:Linux:*:* | riscv64:Linux:*:*) + echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" + exit ;; + s390:Linux:*:* | s390x:Linux:*:*) + echo "$UNAME_MACHINE"-ibm-linux-"$LIBC" + exit ;; + sh64*:Linux:*:*) + echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" + exit ;; + sh*:Linux:*:*) + echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" + exit ;; + sparc:Linux:*:* | sparc64:Linux:*:*) + echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" + exit ;; + tile*:Linux:*:*) + echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" + exit ;; + vax:Linux:*:*) + echo "$UNAME_MACHINE"-dec-linux-"$LIBC" + exit ;; + x86_64:Linux:*:*) + echo "$UNAME_MACHINE"-pc-linux-"$LIBC" + exit ;; + xtensa*:Linux:*:*) + echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" + exit ;; + i*86:DYNIX/ptx:4*:*) + # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. + # earlier versions are messed up and put the nodename in both + # sysname and nodename. + echo i386-sequent-sysv4 + exit ;; + i*86:UNIX_SV:4.2MP:2.*) + # Unixware is an offshoot of SVR4, but it has its own version + # number series starting with 2... + # I am not positive that other SVR4 systems won't match this, + # I just have to hope. -- rms. + # Use sysv4.2uw... so that sysv4* matches it. + echo "$UNAME_MACHINE"-pc-sysv4.2uw"$UNAME_VERSION" + exit ;; + i*86:OS/2:*:*) + # If we were able to find `uname', then EMX Unix compatibility + # is probably installed. + echo "$UNAME_MACHINE"-pc-os2-emx + exit ;; + i*86:XTS-300:*:STOP) + echo "$UNAME_MACHINE"-unknown-stop + exit ;; + i*86:atheos:*:*) + echo "$UNAME_MACHINE"-unknown-atheos + exit ;; + i*86:syllable:*:*) + echo "$UNAME_MACHINE"-pc-syllable + exit ;; + i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*) + echo i386-unknown-lynxos"$UNAME_RELEASE" + exit ;; + i*86:*DOS:*:*) + echo "$UNAME_MACHINE"-pc-msdosdjgpp + exit ;; + i*86:*:4.*:*) + UNAME_REL=`echo "$UNAME_RELEASE" | sed 's/\/MP$//'` + if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then + echo "$UNAME_MACHINE"-univel-sysv"$UNAME_REL" + else + echo "$UNAME_MACHINE"-pc-sysv"$UNAME_REL" + fi + exit ;; + i*86:*:5:[678]*) + # UnixWare 7.x, OpenUNIX and OpenServer 6. + case `/bin/uname -X | grep "^Machine"` in + *486*) UNAME_MACHINE=i486 ;; + *Pentium) UNAME_MACHINE=i586 ;; + *Pent*|*Celeron) UNAME_MACHINE=i686 ;; + esac + echo "$UNAME_MACHINE-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}{$UNAME_VERSION}" + exit ;; + i*86:*:3.2:*) + if test -f /usr/options/cb.name; then + UNAME_REL=`sed -n 's/.*Version //p' /dev/null >/dev/null ; then + UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')` + (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486 + (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \ + && UNAME_MACHINE=i586 + (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \ + && UNAME_MACHINE=i686 + (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \ + && UNAME_MACHINE=i686 + echo "$UNAME_MACHINE"-pc-sco"$UNAME_REL" + else + echo "$UNAME_MACHINE"-pc-sysv32 + fi + exit ;; + pc:*:*:*) + # Left here for compatibility: + # uname -m prints for DJGPP always 'pc', but it prints nothing about + # the processor, so we play safe by assuming i586. + # Note: whatever this is, it MUST be the same as what config.sub + # prints for the "djgpp" host, or else GDB configure will decide that + # this is a cross-build. + echo i586-pc-msdosdjgpp + exit ;; + Intel:Mach:3*:*) + echo i386-pc-mach3 + exit ;; + paragon:*:*:*) + echo i860-intel-osf1 + exit ;; + i860:*:4.*:*) # i860-SVR4 + if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then + echo i860-stardent-sysv"$UNAME_RELEASE" # Stardent Vistra i860-SVR4 + else # Add other i860-SVR4 vendors below as they are discovered. + echo i860-unknown-sysv"$UNAME_RELEASE" # Unknown i860-SVR4 + fi + exit ;; + mini*:CTIX:SYS*5:*) + # "miniframe" + echo m68010-convergent-sysv + exit ;; + mc68k:UNIX:SYSTEM5:3.51m) + echo m68k-convergent-sysv + exit ;; + M680?0:D-NIX:5.3:*) + echo m68k-diab-dnix + exit ;; + M68*:*:R3V[5678]*:*) + test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;; + 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0) + OS_REL='' + test -r /etc/.relid \ + && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` + /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ + && { echo i486-ncr-sysv4.3"$OS_REL"; exit; } + /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ + && { echo i586-ncr-sysv4.3"$OS_REL"; exit; } ;; + 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) + /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ + && { echo i486-ncr-sysv4; exit; } ;; + NCR*:*:4.2:* | MPRAS*:*:4.2:*) + OS_REL='.3' + test -r /etc/.relid \ + && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` + /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ + && { echo i486-ncr-sysv4.3"$OS_REL"; exit; } + /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ + && { echo i586-ncr-sysv4.3"$OS_REL"; exit; } + /bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \ + && { echo i586-ncr-sysv4.3"$OS_REL"; exit; } ;; + m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) + echo m68k-unknown-lynxos"$UNAME_RELEASE" + exit ;; + mc68030:UNIX_System_V:4.*:*) + echo m68k-atari-sysv4 + exit ;; + TSUNAMI:LynxOS:2.*:*) + echo sparc-unknown-lynxos"$UNAME_RELEASE" + exit ;; + rs6000:LynxOS:2.*:*) + echo rs6000-unknown-lynxos"$UNAME_RELEASE" + exit ;; + PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*) + echo powerpc-unknown-lynxos"$UNAME_RELEASE" + exit ;; + SM[BE]S:UNIX_SV:*:*) + echo mips-dde-sysv"$UNAME_RELEASE" + exit ;; + RM*:ReliantUNIX-*:*:*) + echo mips-sni-sysv4 + exit ;; + RM*:SINIX-*:*:*) + echo mips-sni-sysv4 + exit ;; + *:SINIX-*:*:*) + if uname -p 2>/dev/null >/dev/null ; then + UNAME_MACHINE=`(uname -p) 2>/dev/null` + echo "$UNAME_MACHINE"-sni-sysv4 + else + echo ns32k-sni-sysv + fi + exit ;; + PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort + # says + echo i586-unisys-sysv4 + exit ;; + *:UNIX_System_V:4*:FTX*) + # From Gerald Hewes . + # How about differentiating between stratus architectures? -djm + echo hppa1.1-stratus-sysv4 + exit ;; + *:*:*:FTX*) + # From seanf@swdc.stratus.com. + echo i860-stratus-sysv4 + exit ;; + i*86:VOS:*:*) + # From Paul.Green@stratus.com. + echo "$UNAME_MACHINE"-stratus-vos + exit ;; + *:VOS:*:*) + # From Paul.Green@stratus.com. + echo hppa1.1-stratus-vos + exit ;; + mc68*:A/UX:*:*) + echo m68k-apple-aux"$UNAME_RELEASE" + exit ;; + news*:NEWS-OS:6*:*) + echo mips-sony-newsos6 + exit ;; + R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) + if [ -d /usr/nec ]; then + echo mips-nec-sysv"$UNAME_RELEASE" + else + echo mips-unknown-sysv"$UNAME_RELEASE" + fi + exit ;; + BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. + echo powerpc-be-beos + exit ;; + BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. + echo powerpc-apple-beos + exit ;; + BePC:BeOS:*:*) # BeOS running on Intel PC compatible. + echo i586-pc-beos + exit ;; + BePC:Haiku:*:*) # Haiku running on Intel PC compatible. + echo i586-pc-haiku + exit ;; + x86_64:Haiku:*:*) + echo x86_64-unknown-haiku + exit ;; + SX-4:SUPER-UX:*:*) + echo sx4-nec-superux"$UNAME_RELEASE" + exit ;; + SX-5:SUPER-UX:*:*) + echo sx5-nec-superux"$UNAME_RELEASE" + exit ;; + SX-6:SUPER-UX:*:*) + echo sx6-nec-superux"$UNAME_RELEASE" + exit ;; + SX-7:SUPER-UX:*:*) + echo sx7-nec-superux"$UNAME_RELEASE" + exit ;; + SX-8:SUPER-UX:*:*) + echo sx8-nec-superux"$UNAME_RELEASE" + exit ;; + SX-8R:SUPER-UX:*:*) + echo sx8r-nec-superux"$UNAME_RELEASE" + exit ;; + SX-ACE:SUPER-UX:*:*) + echo sxace-nec-superux"$UNAME_RELEASE" + exit ;; + Power*:Rhapsody:*:*) + echo powerpc-apple-rhapsody"$UNAME_RELEASE" + exit ;; + *:Rhapsody:*:*) + echo "$UNAME_MACHINE"-apple-rhapsody"$UNAME_RELEASE" + exit ;; + *:Darwin:*:*) + UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown + eval "$set_cc_for_build" + if test "$UNAME_PROCESSOR" = unknown ; then + UNAME_PROCESSOR=powerpc + fi + if test "`echo "$UNAME_RELEASE" | sed -e 's/\..*//'`" -le 10 ; then + if [ "$CC_FOR_BUILD" != no_compiler_found ]; then + if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \ + (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \ + grep IS_64BIT_ARCH >/dev/null + then + case $UNAME_PROCESSOR in + i386) UNAME_PROCESSOR=x86_64 ;; + powerpc) UNAME_PROCESSOR=powerpc64 ;; + esac + fi + # On 10.4-10.6 one might compile for PowerPC via gcc -arch ppc + if (echo '#ifdef __POWERPC__'; echo IS_PPC; echo '#endif') | \ + (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \ + grep IS_PPC >/dev/null + then + UNAME_PROCESSOR=powerpc + fi + fi + elif test "$UNAME_PROCESSOR" = i386 ; then + # Avoid executing cc on OS X 10.9, as it ships with a stub + # that puts up a graphical alert prompting to install + # developer tools. Any system running Mac OS X 10.7 or + # later (Darwin 11 and later) is required to have a 64-bit + # processor. This is not true of the ARM version of Darwin + # that Apple uses in portable devices. + UNAME_PROCESSOR=x86_64 + fi + echo "$UNAME_PROCESSOR"-apple-darwin"$UNAME_RELEASE" + exit ;; + *:procnto*:*:* | *:QNX:[0123456789]*:*) + UNAME_PROCESSOR=`uname -p` + if test "$UNAME_PROCESSOR" = x86; then + UNAME_PROCESSOR=i386 + UNAME_MACHINE=pc + fi + echo "$UNAME_PROCESSOR"-"$UNAME_MACHINE"-nto-qnx"$UNAME_RELEASE" + exit ;; + *:QNX:*:4*) + echo i386-pc-qnx + exit ;; + NEO-*:NONSTOP_KERNEL:*:*) + echo neo-tandem-nsk"$UNAME_RELEASE" + exit ;; + NSE-*:NONSTOP_KERNEL:*:*) + echo nse-tandem-nsk"$UNAME_RELEASE" + exit ;; + NSR-*:NONSTOP_KERNEL:*:*) + echo nsr-tandem-nsk"$UNAME_RELEASE" + exit ;; + NSV-*:NONSTOP_KERNEL:*:*) + echo nsv-tandem-nsk"$UNAME_RELEASE" + exit ;; + NSX-*:NONSTOP_KERNEL:*:*) + echo nsx-tandem-nsk"$UNAME_RELEASE" + exit ;; + *:NonStop-UX:*:*) + echo mips-compaq-nonstopux + exit ;; + BS2000:POSIX*:*:*) + echo bs2000-siemens-sysv + exit ;; + DS/*:UNIX_System_V:*:*) + echo "$UNAME_MACHINE"-"$UNAME_SYSTEM"-"$UNAME_RELEASE" + exit ;; + *:Plan9:*:*) + # "uname -m" is not consistent, so use $cputype instead. 386 + # is converted to i386 for consistency with other x86 + # operating systems. + if test "$cputype" = 386; then + UNAME_MACHINE=i386 + else + UNAME_MACHINE="$cputype" + fi + echo "$UNAME_MACHINE"-unknown-plan9 + exit ;; + *:TOPS-10:*:*) + echo pdp10-unknown-tops10 + exit ;; + *:TENEX:*:*) + echo pdp10-unknown-tenex + exit ;; + KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) + echo pdp10-dec-tops20 + exit ;; + XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) + echo pdp10-xkl-tops20 + exit ;; + *:TOPS-20:*:*) + echo pdp10-unknown-tops20 + exit ;; + *:ITS:*:*) + echo pdp10-unknown-its + exit ;; + SEI:*:*:SEIUX) + echo mips-sei-seiux"$UNAME_RELEASE" + exit ;; + *:DragonFly:*:*) + echo "$UNAME_MACHINE"-unknown-dragonfly"`echo "$UNAME_RELEASE"|sed -e 's/[-(].*//'`" + exit ;; + *:*VMS:*:*) + UNAME_MACHINE=`(uname -p) 2>/dev/null` + case "$UNAME_MACHINE" in + A*) echo alpha-dec-vms ; exit ;; + I*) echo ia64-dec-vms ; exit ;; + V*) echo vax-dec-vms ; exit ;; + esac ;; + *:XENIX:*:SysV) + echo i386-pc-xenix + exit ;; + i*86:skyos:*:*) + echo "$UNAME_MACHINE"-pc-skyos"`echo "$UNAME_RELEASE" | sed -e 's/ .*$//'`" + exit ;; + i*86:rdos:*:*) + echo "$UNAME_MACHINE"-pc-rdos + exit ;; + i*86:AROS:*:*) + echo "$UNAME_MACHINE"-pc-aros + exit ;; + x86_64:VMkernel:*:*) + echo "$UNAME_MACHINE"-unknown-esx + exit ;; + amd64:Isilon\ OneFS:*:*) + echo x86_64-unknown-onefs + exit ;; +esac + +echo "$0: unable to guess system type" >&2 + +case "$UNAME_MACHINE:$UNAME_SYSTEM" in + mips:Linux | mips64:Linux) + # If we got here on MIPS GNU/Linux, output extra information. + cat >&2 <&2 </dev/null || echo unknown` +uname -r = `(uname -r) 2>/dev/null || echo unknown` +uname -s = `(uname -s) 2>/dev/null || echo unknown` +uname -v = `(uname -v) 2>/dev/null || echo unknown` + +/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null` +/bin/uname -X = `(/bin/uname -X) 2>/dev/null` + +hostinfo = `(hostinfo) 2>/dev/null` +/bin/universe = `(/bin/universe) 2>/dev/null` +/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null` +/bin/arch = `(/bin/arch) 2>/dev/null` +/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null` +/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null` + +UNAME_MACHINE = "$UNAME_MACHINE" +UNAME_RELEASE = "$UNAME_RELEASE" +UNAME_SYSTEM = "$UNAME_SYSTEM" +UNAME_VERSION = "$UNAME_VERSION" +EOF + +exit 1 + +# Local variables: +# eval: (add-hook 'before-save-hook 'time-stamp) +# time-stamp-start: "timestamp='" +# time-stamp-format: "%:y-%02m-%02d" +# time-stamp-end: "'" +# End: diff --git a/config.rpath b/config.rpath new file mode 100755 index 0000000..f631b8e --- /dev/null +++ b/config.rpath @@ -0,0 +1,684 @@ +#!/usr/bin/sh +# Output a system dependent set of variables, describing how to set the +# run time search path of shared libraries in an executable. +# +# Copyright 1996-2016 Free Software Foundation, Inc. +# Taken from GNU libtool, 2001 +# Originally by Gordon Matzigkeit , 1996 +# +# This file is free software; the Free Software Foundation gives +# unlimited permission to copy and/or distribute it, with or without +# modifications, as long as this notice is preserved. +# +# The first argument passed to this file is the canonical host specification, +# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM +# or +# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM +# The environment variables CC, GCC, LDFLAGS, LD, with_gnu_ld +# should be set by the caller. +# +# The set of defined variables is at the end of this script. + +# Known limitations: +# - On IRIX 6.5 with CC="cc", the run time search patch must not be longer +# than 256 bytes, otherwise the compiler driver will dump core. The only +# known workaround is to choose shorter directory names for the build +# directory and/or the installation directory. + +# All known linkers require a '.a' archive for static linking (except MSVC, +# which needs '.lib'). +libext=a +shrext=.so + +host="$1" +host_cpu=`echo "$host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` +host_vendor=`echo "$host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` +host_os=`echo "$host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` + +# Code taken from libtool.m4's _LT_CC_BASENAME. + +for cc_temp in $CC""; do + case $cc_temp in + compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; + distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; + \-*) ;; + *) break;; + esac +done +cc_basename=`echo "$cc_temp" | sed -e 's%^.*/%%'` + +# Code taken from libtool.m4's _LT_COMPILER_PIC. + +wl= +if test "$GCC" = yes; then + wl='-Wl,' +else + case "$host_os" in + aix*) + wl='-Wl,' + ;; + mingw* | cygwin* | pw32* | os2* | cegcc*) + ;; + hpux9* | hpux10* | hpux11*) + wl='-Wl,' + ;; + irix5* | irix6* | nonstopux*) + wl='-Wl,' + ;; + linux* | k*bsd*-gnu | kopensolaris*-gnu) + case $cc_basename in + ecc*) + wl='-Wl,' + ;; + icc* | ifort*) + wl='-Wl,' + ;; + lf95*) + wl='-Wl,' + ;; + nagfor*) + wl='-Wl,-Wl,,' + ;; + pgcc* | pgf77* | pgf90* | pgf95* | pgfortran*) + wl='-Wl,' + ;; + ccc*) + wl='-Wl,' + ;; + xl* | bgxl* | bgf* | mpixl*) + wl='-Wl,' + ;; + como) + wl='-lopt=' + ;; + *) + case `$CC -V 2>&1 | sed 5q` in + *Sun\ F* | *Sun*Fortran*) + wl= + ;; + *Sun\ C*) + wl='-Wl,' + ;; + esac + ;; + esac + ;; + newsos6) + ;; + *nto* | *qnx*) + ;; + osf3* | osf4* | osf5*) + wl='-Wl,' + ;; + rdos*) + ;; + solaris*) + case $cc_basename in + f77* | f90* | f95* | sunf77* | sunf90* | sunf95*) + wl='-Qoption ld ' + ;; + *) + wl='-Wl,' + ;; + esac + ;; + sunos4*) + wl='-Qoption ld ' + ;; + sysv4 | sysv4.2uw2* | sysv4.3*) + wl='-Wl,' + ;; + sysv4*MP*) + ;; + sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) + wl='-Wl,' + ;; + unicos*) + wl='-Wl,' + ;; + uts4*) + ;; + esac +fi + +# Code taken from libtool.m4's _LT_LINKER_SHLIBS. + +hardcode_libdir_flag_spec= +hardcode_libdir_separator= +hardcode_direct=no +hardcode_minus_L=no + +case "$host_os" in + cygwin* | mingw* | pw32* | cegcc*) + # FIXME: the MSVC++ port hasn't been tested in a loooong time + # When not using gcc, we currently assume that we are using + # Microsoft Visual C++. + if test "$GCC" != yes; then + with_gnu_ld=no + fi + ;; + interix*) + # we just hope/assume this is gcc and not c89 (= MSVC++) + with_gnu_ld=yes + ;; + openbsd*) + with_gnu_ld=no + ;; +esac + +ld_shlibs=yes +if test "$with_gnu_ld" = yes; then + # Set some defaults for GNU ld with shared library support. These + # are reset later if shared libraries are not supported. Putting them + # here allows them to be overridden if necessary. + # Unlike libtool, we use -rpath here, not --rpath, since the documented + # option of GNU ld is called -rpath, not --rpath. + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + case "$host_os" in + aix[3-9]*) + # On AIX/PPC, the GNU linker is very broken + if test "$host_cpu" != ia64; then + ld_shlibs=no + fi + ;; + amigaos*) + case "$host_cpu" in + powerpc) + ;; + m68k) + hardcode_libdir_flag_spec='-L$libdir' + hardcode_minus_L=yes + ;; + esac + ;; + beos*) + if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + : + else + ld_shlibs=no + fi + ;; + cygwin* | mingw* | pw32* | cegcc*) + # hardcode_libdir_flag_spec is actually meaningless, as there is + # no search path for DLLs. + hardcode_libdir_flag_spec='-L$libdir' + if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then + : + else + ld_shlibs=no + fi + ;; + haiku*) + ;; + interix[3-9]*) + hardcode_direct=no + hardcode_libdir_flag_spec='${wl}-rpath,$libdir' + ;; + gnu* | linux* | tpf* | k*bsd*-gnu | kopensolaris*-gnu) + if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + : + else + ld_shlibs=no + fi + ;; + netbsd*) + ;; + solaris*) + if $LD -v 2>&1 | grep 'BFD 2\.8' > /dev/null; then + ld_shlibs=no + elif $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + : + else + ld_shlibs=no + fi + ;; + sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*) + case `$LD -v 2>&1` in + *\ [01].* | *\ 2.[0-9].* | *\ 2.1[0-5].*) + ld_shlibs=no + ;; + *) + if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + hardcode_libdir_flag_spec='`test -z "$SCOABSPATH" && echo ${wl}-rpath,$libdir`' + else + ld_shlibs=no + fi + ;; + esac + ;; + sunos4*) + hardcode_direct=yes + ;; + *) + if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + : + else + ld_shlibs=no + fi + ;; + esac + if test "$ld_shlibs" = no; then + hardcode_libdir_flag_spec= + fi +else + case "$host_os" in + aix3*) + # Note: this linker hardcodes the directories in LIBPATH if there + # are no directories specified by -L. + hardcode_minus_L=yes + if test "$GCC" = yes; then + # Neither direct hardcoding nor static linking is supported with a + # broken collect2. + hardcode_direct=unsupported + fi + ;; + aix[4-9]*) + if test "$host_cpu" = ia64; then + # On IA64, the linker does run time linking by default, so we don't + # have to do anything special. + aix_use_runtimelinking=no + else + aix_use_runtimelinking=no + # Test if we are trying to use run time linking or normal + # AIX style linking. If -brtl is somewhere in LDFLAGS, we + # need to do runtime linking. + case $host_os in aix4.[23]|aix4.[23].*|aix[5-9]*) + for ld_flag in $LDFLAGS; do + if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then + aix_use_runtimelinking=yes + break + fi + done + ;; + esac + fi + hardcode_direct=yes + hardcode_libdir_separator=':' + if test "$GCC" = yes; then + case $host_os in aix4.[012]|aix4.[012].*) + collect2name=`${CC} -print-prog-name=collect2` + if test -f "$collect2name" && \ + strings "$collect2name" | grep resolve_lib_name >/dev/null + then + # We have reworked collect2 + : + else + # We have old collect2 + hardcode_direct=unsupported + hardcode_minus_L=yes + hardcode_libdir_flag_spec='-L$libdir' + hardcode_libdir_separator= + fi + ;; + esac + fi + # Begin _LT_AC_SYS_LIBPATH_AIX. + echo 'int main () { return 0; }' > conftest.c + ${CC} ${LDFLAGS} conftest.c -o conftest + aix_libpath=`dump -H conftest 2>/dev/null | sed -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } +}'` + if test -z "$aix_libpath"; then + aix_libpath=`dump -HX64 conftest 2>/dev/null | sed -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } +}'` + fi + if test -z "$aix_libpath"; then + aix_libpath="/usr/lib:/lib" + fi + rm -f conftest.c conftest + # End _LT_AC_SYS_LIBPATH_AIX. + if test "$aix_use_runtimelinking" = yes; then + hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath" + else + if test "$host_cpu" = ia64; then + hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib' + else + hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath" + fi + fi + ;; + amigaos*) + case "$host_cpu" in + powerpc) + ;; + m68k) + hardcode_libdir_flag_spec='-L$libdir' + hardcode_minus_L=yes + ;; + esac + ;; + bsdi[45]*) + ;; + cygwin* | mingw* | pw32* | cegcc*) + # When not using gcc, we currently assume that we are using + # Microsoft Visual C++. + # hardcode_libdir_flag_spec is actually meaningless, as there is + # no search path for DLLs. + hardcode_libdir_flag_spec=' ' + libext=lib + ;; + darwin* | rhapsody*) + hardcode_direct=no + if { case $cc_basename in ifort*) true;; *) test "$GCC" = yes;; esac; }; then + : + else + ld_shlibs=no + fi + ;; + dgux*) + hardcode_libdir_flag_spec='-L$libdir' + ;; + freebsd2.[01]*) + hardcode_direct=yes + hardcode_minus_L=yes + ;; + freebsd* | dragonfly*) + hardcode_libdir_flag_spec='-R$libdir' + hardcode_direct=yes + ;; + hpux9*) + hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' + hardcode_libdir_separator=: + hardcode_direct=yes + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + hardcode_minus_L=yes + ;; + hpux10*) + if test "$with_gnu_ld" = no; then + hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' + hardcode_libdir_separator=: + hardcode_direct=yes + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + hardcode_minus_L=yes + fi + ;; + hpux11*) + if test "$with_gnu_ld" = no; then + hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' + hardcode_libdir_separator=: + case $host_cpu in + hppa*64*|ia64*) + hardcode_direct=no + ;; + *) + hardcode_direct=yes + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + hardcode_minus_L=yes + ;; + esac + fi + ;; + irix5* | irix6* | nonstopux*) + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator=: + ;; + netbsd*) + hardcode_libdir_flag_spec='-R$libdir' + hardcode_direct=yes + ;; + newsos6) + hardcode_direct=yes + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator=: + ;; + *nto* | *qnx*) + ;; + openbsd*) + if test -f /usr/libexec/ld.so; then + hardcode_direct=yes + if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + hardcode_libdir_flag_spec='${wl}-rpath,$libdir' + else + case "$host_os" in + openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*) + hardcode_libdir_flag_spec='-R$libdir' + ;; + *) + hardcode_libdir_flag_spec='${wl}-rpath,$libdir' + ;; + esac + fi + else + ld_shlibs=no + fi + ;; + os2*) + hardcode_libdir_flag_spec='-L$libdir' + hardcode_minus_L=yes + ;; + osf3*) + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator=: + ;; + osf4* | osf5*) + if test "$GCC" = yes; then + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + else + # Both cc and cxx compiler support -rpath directly + hardcode_libdir_flag_spec='-rpath $libdir' + fi + hardcode_libdir_separator=: + ;; + solaris*) + hardcode_libdir_flag_spec='-R$libdir' + ;; + sunos4*) + hardcode_libdir_flag_spec='-L$libdir' + hardcode_direct=yes + hardcode_minus_L=yes + ;; + sysv4) + case $host_vendor in + sni) + hardcode_direct=yes # is this really true??? + ;; + siemens) + hardcode_direct=no + ;; + motorola) + hardcode_direct=no #Motorola manual says yes, but my tests say they lie + ;; + esac + ;; + sysv4.3*) + ;; + sysv4*MP*) + if test -d /usr/nec; then + ld_shlibs=yes + fi + ;; + sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7* | sco3.2v5.0.[024]*) + ;; + sysv5* | sco3.2v5* | sco5v6*) + hardcode_libdir_flag_spec='`test -z "$SCOABSPATH" && echo ${wl}-R,$libdir`' + hardcode_libdir_separator=':' + ;; + uts4*) + hardcode_libdir_flag_spec='-L$libdir' + ;; + *) + ld_shlibs=no + ;; + esac +fi + +# Check dynamic linker characteristics +# Code taken from libtool.m4's _LT_SYS_DYNAMIC_LINKER. +# Unlike libtool.m4, here we don't care about _all_ names of the library, but +# only about the one the linker finds when passed -lNAME. This is the last +# element of library_names_spec in libtool.m4, or possibly two of them if the +# linker has special search rules. +library_names_spec= # the last element of library_names_spec in libtool.m4 +libname_spec='lib$name' +case "$host_os" in + aix3*) + library_names_spec='$libname.a' + ;; + aix[4-9]*) + library_names_spec='$libname$shrext' + ;; + amigaos*) + case "$host_cpu" in + powerpc*) + library_names_spec='$libname$shrext' ;; + m68k) + library_names_spec='$libname.a' ;; + esac + ;; + beos*) + library_names_spec='$libname$shrext' + ;; + bsdi[45]*) + library_names_spec='$libname$shrext' + ;; + cygwin* | mingw* | pw32* | cegcc*) + shrext=.dll + library_names_spec='$libname.dll.a $libname.lib' + ;; + darwin* | rhapsody*) + shrext=.dylib + library_names_spec='$libname$shrext' + ;; + dgux*) + library_names_spec='$libname$shrext' + ;; + freebsd[23].*) + library_names_spec='$libname$shrext$versuffix' + ;; + freebsd* | dragonfly*) + library_names_spec='$libname$shrext' + ;; + gnu*) + library_names_spec='$libname$shrext' + ;; + haiku*) + library_names_spec='$libname$shrext' + ;; + hpux9* | hpux10* | hpux11*) + case $host_cpu in + ia64*) + shrext=.so + ;; + hppa*64*) + shrext=.sl + ;; + *) + shrext=.sl + ;; + esac + library_names_spec='$libname$shrext' + ;; + interix[3-9]*) + library_names_spec='$libname$shrext' + ;; + irix5* | irix6* | nonstopux*) + library_names_spec='$libname$shrext' + case "$host_os" in + irix5* | nonstopux*) + libsuff= shlibsuff= + ;; + *) + case $LD in + *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") libsuff= shlibsuff= ;; + *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") libsuff=32 shlibsuff=N32 ;; + *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") libsuff=64 shlibsuff=64 ;; + *) libsuff= shlibsuff= ;; + esac + ;; + esac + ;; + linux*oldld* | linux*aout* | linux*coff*) + ;; + linux* | k*bsd*-gnu | kopensolaris*-gnu) + library_names_spec='$libname$shrext' + ;; + knetbsd*-gnu) + library_names_spec='$libname$shrext' + ;; + netbsd*) + library_names_spec='$libname$shrext' + ;; + newsos6) + library_names_spec='$libname$shrext' + ;; + *nto* | *qnx*) + library_names_spec='$libname$shrext' + ;; + openbsd*) + library_names_spec='$libname$shrext$versuffix' + ;; + os2*) + libname_spec='$name' + shrext=.dll + library_names_spec='$libname.a' + ;; + osf3* | osf4* | osf5*) + library_names_spec='$libname$shrext' + ;; + rdos*) + ;; + solaris*) + library_names_spec='$libname$shrext' + ;; + sunos4*) + library_names_spec='$libname$shrext$versuffix' + ;; + sysv4 | sysv4.3*) + library_names_spec='$libname$shrext' + ;; + sysv4*MP*) + library_names_spec='$libname$shrext' + ;; + sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) + library_names_spec='$libname$shrext' + ;; + tpf*) + library_names_spec='$libname$shrext' + ;; + uts4*) + library_names_spec='$libname$shrext' + ;; +esac + +sed_quote_subst='s/\(["`$\\]\)/\\\1/g' +escaped_wl=`echo "X$wl" | sed -e 's/^X//' -e "$sed_quote_subst"` +shlibext=`echo "$shrext" | sed -e 's,^\.,,'` +escaped_libname_spec=`echo "X$libname_spec" | sed -e 's/^X//' -e "$sed_quote_subst"` +escaped_library_names_spec=`echo "X$library_names_spec" | sed -e 's/^X//' -e "$sed_quote_subst"` +escaped_hardcode_libdir_flag_spec=`echo "X$hardcode_libdir_flag_spec" | sed -e 's/^X//' -e "$sed_quote_subst"` + +LC_ALL=C sed -e 's/^\([a-zA-Z0-9_]*\)=/acl_cv_\1=/' <. +# +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that +# program. This Exception is an additional permission under section 7 +# of the GNU General Public License, version 3 ("GPLv3"). + + +# Please send patches to . +# +# Configuration subroutine to validate and canonicalize a configuration type. +# Supply the specified configuration type as an argument. +# If it is invalid, we print an error message on stderr and exit with code 1. +# Otherwise, we print the canonical config type on stdout and succeed. + +# You can get the latest version of this script from: +# https://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub + +# This file is supposed to be the same for all GNU packages +# and recognize all the CPU types, system types and aliases +# that are meaningful with *any* GNU software. +# Each package is responsible for reporting which valid configurations +# it does not support. The user should be able to distinguish +# a failure to support a valid configuration from a meaningless +# configuration. + +# The goal of this file is to map all the various variations of a given +# machine specification into a single specification in the form: +# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM +# or in some cases, the newer four-part form: +# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM +# It is wrong to echo any other type of specification. + +me=`echo "$0" | sed -e 's,.*/,,'` + +usage="\ +Usage: $0 [OPTION] CPU-MFR-OPSYS or ALIAS + +Canonicalize a configuration name. + +Options: + -h, --help print this help, then exit + -t, --time-stamp print date of last modification, then exit + -v, --version print version number, then exit + +Report bugs and patches to ." + +version="\ +GNU config.sub ($timestamp) + +Copyright 1992-2018 Free Software Foundation, Inc. + +This is free software; see the source for copying conditions. There is NO +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." + +help=" +Try \`$me --help' for more information." + +# Parse command line +while test $# -gt 0 ; do + case $1 in + --time-stamp | --time* | -t ) + echo "$timestamp" ; exit ;; + --version | -v ) + echo "$version" ; exit ;; + --help | --h* | -h ) + echo "$usage"; exit ;; + -- ) # Stop option processing + shift; break ;; + - ) # Use stdin as input. + break ;; + -* ) + echo "$me: invalid option $1$help" + exit 1 ;; + + *local*) + # First pass through any local machine types. + echo "$1" + exit ;; + + * ) + break ;; + esac +done + +case $# in + 0) echo "$me: missing argument$help" >&2 + exit 1;; + 1) ;; + *) echo "$me: too many arguments$help" >&2 + exit 1;; +esac + +# Spilt fields of configuration type +IFS="-" read -r field1 field2 field3 field4 <&2 + exit 1 + ;; + # Recognize the basic CPU types with company name. + 580-* \ + | a29k-* \ + | aarch64-* | aarch64_be-* \ + | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ + | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ + | alphapca5[67]-* | alpha64pca5[67]-* | arc-* | arceb-* \ + | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ + | avr-* | avr32-* \ + | ba-* \ + | be32-* | be64-* \ + | bfin-* | bs2000-* \ + | c[123]* | c30-* | [cjt]90-* | c4x-* \ + | c8051-* | clipper-* | craynv-* | csky-* | cydra-* \ + | d10v-* | d30v-* | dlx-* \ + | e2k-* | elxsi-* \ + | f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \ + | h8300-* | h8500-* \ + | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ + | hexagon-* \ + | i*86-* | i860-* | i960-* | ia16-* | ia64-* \ + | ip2k-* | iq2000-* \ + | k1om-* \ + | le32-* | le64-* \ + | lm32-* \ + | m32c-* | m32r-* | m32rle-* \ + | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ + | m88110-* | m88k-* | maxq-* | mcore-* | metag-* \ + | microblaze-* | microblazeel-* \ + | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ + | mips16-* \ + | mips64-* | mips64el-* \ + | mips64octeon-* | mips64octeonel-* \ + | mips64orion-* | mips64orionel-* \ + | mips64r5900-* | mips64r5900el-* \ + | mips64vr-* | mips64vrel-* \ + | mips64vr4100-* | mips64vr4100el-* \ + | mips64vr4300-* | mips64vr4300el-* \ + | mips64vr5000-* | mips64vr5000el-* \ + | mips64vr5900-* | mips64vr5900el-* \ + | mipsisa32-* | mipsisa32el-* \ + | mipsisa32r2-* | mipsisa32r2el-* \ + | mipsisa32r6-* | mipsisa32r6el-* \ + | mipsisa64-* | mipsisa64el-* \ + | mipsisa64r2-* | mipsisa64r2el-* \ + | mipsisa64r6-* | mipsisa64r6el-* \ + | mipsisa64sb1-* | mipsisa64sb1el-* \ + | mipsisa64sr71k-* | mipsisa64sr71kel-* \ + | mipsr5900-* | mipsr5900el-* \ + | mipstx39-* | mipstx39el-* \ + | mmix-* \ + | mt-* \ + | msp430-* \ + | nds32-* | nds32le-* | nds32be-* \ + | nfp-* \ + | nios-* | nios2-* | nios2eb-* | nios2el-* \ + | none-* | np1-* | ns16k-* | ns32k-* \ + | open8-* \ + | or1k*-* \ + | orion-* \ + | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ + | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* \ + | pru-* \ + | pyramid-* \ + | riscv32-* | riscv64-* \ + | rl78-* | romp-* | rs6000-* | rx-* \ + | sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \ + | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ + | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \ + | sparclite-* \ + | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | sv1-* | sx*-* \ + | tahoe-* \ + | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \ + | tile*-* \ + | tron-* \ + | ubicom32-* \ + | v850-* | v850e-* | v850e1-* | v850es-* | v850e2-* | v850e2v3-* \ + | vax-* \ + | visium-* \ + | wasm32-* \ + | we32k-* \ + | x86-* | x86_64-* | xc16x-* | xps100-* \ + | xstormy16-* | xtensa*-* \ + | ymp-* \ + | z8k-* | z80-*) + ;; + # Recognize the basic CPU types without company name, with glob match. + xtensa*) + basic_machine=$basic_machine-unknown + ;; + # Recognize the various machine names and aliases which stand + # for a CPU type and a company and sometimes even an OS. + 386bsd) + basic_machine=i386-pc + os=-bsd + ;; + 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) + basic_machine=m68000-att + ;; + 3b*) + basic_machine=we32k-att + ;; + a29khif) + basic_machine=a29k-amd + os=-udi + ;; + abacus) + basic_machine=abacus-unknown + ;; + adobe68k) + basic_machine=m68010-adobe + os=-scout + ;; + alliant | fx80) + basic_machine=fx80-alliant + ;; + altos | altos3068) + basic_machine=m68k-altos + ;; + am29k) + basic_machine=a29k-none + os=-bsd + ;; + amd64) + basic_machine=x86_64-pc + ;; + amd64-*) + basic_machine=x86_64-`echo "$basic_machine" | sed 's/^[^-]*-//'` + ;; + amdahl) + basic_machine=580-amdahl + os=-sysv + ;; + amiga | amiga-*) + basic_machine=m68k-unknown + ;; + amigaos | amigados) + basic_machine=m68k-unknown + os=-amigaos + ;; + amigaunix | amix) + basic_machine=m68k-unknown + os=-sysv4 + ;; + apollo68) + basic_machine=m68k-apollo + os=-sysv + ;; + apollo68bsd) + basic_machine=m68k-apollo + os=-bsd + ;; + aros) + basic_machine=i386-pc + os=-aros + ;; + asmjs) + basic_machine=asmjs-unknown + ;; + aux) + basic_machine=m68k-apple + os=-aux + ;; + balance) + basic_machine=ns32k-sequent + os=-dynix + ;; + blackfin) + basic_machine=bfin-unknown + os=-linux + ;; + blackfin-*) + basic_machine=bfin-`echo "$basic_machine" | sed 's/^[^-]*-//'` + os=-linux + ;; + bluegene*) + basic_machine=powerpc-ibm + os=-cnk + ;; + c54x-*) + basic_machine=tic54x-`echo "$basic_machine" | sed 's/^[^-]*-//'` + ;; + c55x-*) + basic_machine=tic55x-`echo "$basic_machine" | sed 's/^[^-]*-//'` + ;; + c6x-*) + basic_machine=tic6x-`echo "$basic_machine" | sed 's/^[^-]*-//'` + ;; + c90) + basic_machine=c90-cray + os=-unicos + ;; + cegcc) + basic_machine=arm-unknown + os=-cegcc + ;; + convex-c1) + basic_machine=c1-convex + os=-bsd + ;; + convex-c2) + basic_machine=c2-convex + os=-bsd + ;; + convex-c32) + basic_machine=c32-convex + os=-bsd + ;; + convex-c34) + basic_machine=c34-convex + os=-bsd + ;; + convex-c38) + basic_machine=c38-convex + os=-bsd + ;; + cray | j90) + basic_machine=j90-cray + os=-unicos + ;; + craynv) + basic_machine=craynv-cray + os=-unicosmp + ;; + cr16 | cr16-*) + basic_machine=cr16-unknown + os=-elf + ;; + crds | unos) + basic_machine=m68k-crds + ;; + crisv32 | crisv32-* | etraxfs*) + basic_machine=crisv32-axis + ;; + cris | cris-* | etrax*) + basic_machine=cris-axis + ;; + crx) + basic_machine=crx-unknown + os=-elf + ;; + da30 | da30-*) + basic_machine=m68k-da30 + ;; + decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn) + basic_machine=mips-dec + ;; + decsystem10* | dec10*) + basic_machine=pdp10-dec + os=-tops10 + ;; + decsystem20* | dec20*) + basic_machine=pdp10-dec + os=-tops20 + ;; + delta | 3300 | motorola-3300 | motorola-delta \ + | 3300-motorola | delta-motorola) + basic_machine=m68k-motorola + ;; + delta88) + basic_machine=m88k-motorola + os=-sysv3 + ;; + dicos) + basic_machine=i686-pc + os=-dicos + ;; + djgpp) + basic_machine=i586-pc + os=-msdosdjgpp + ;; + dpx20 | dpx20-*) + basic_machine=rs6000-bull + os=-bosx + ;; + dpx2*) + basic_machine=m68k-bull + os=-sysv3 + ;; + e500v[12]) + basic_machine=powerpc-unknown + os=$os"spe" + ;; + e500v[12]-*) + basic_machine=powerpc-`echo "$basic_machine" | sed 's/^[^-]*-//'` + os=$os"spe" + ;; + ebmon29k) + basic_machine=a29k-amd + os=-ebmon + ;; + elxsi) + basic_machine=elxsi-elxsi + os=-bsd + ;; + encore | umax | mmax) + basic_machine=ns32k-encore + ;; + es1800 | OSE68k | ose68k | ose | OSE) + basic_machine=m68k-ericsson + os=-ose + ;; + fx2800) + basic_machine=i860-alliant + ;; + genix) + basic_machine=ns32k-ns + ;; + gmicro) + basic_machine=tron-gmicro + os=-sysv + ;; + go32) + basic_machine=i386-pc + os=-go32 + ;; + h3050r* | hiux*) + basic_machine=hppa1.1-hitachi + os=-hiuxwe2 + ;; + h8300hms) + basic_machine=h8300-hitachi + os=-hms + ;; + h8300xray) + basic_machine=h8300-hitachi + os=-xray + ;; + h8500hms) + basic_machine=h8500-hitachi + os=-hms + ;; + harris) + basic_machine=m88k-harris + os=-sysv3 + ;; + hp300-*) + basic_machine=m68k-hp + ;; + hp300bsd) + basic_machine=m68k-hp + os=-bsd + ;; + hp300hpux) + basic_machine=m68k-hp + os=-hpux + ;; + hp3k9[0-9][0-9] | hp9[0-9][0-9]) + basic_machine=hppa1.0-hp + ;; + hp9k2[0-9][0-9] | hp9k31[0-9]) + basic_machine=m68000-hp + ;; + hp9k3[2-9][0-9]) + basic_machine=m68k-hp + ;; + hp9k6[0-9][0-9] | hp6[0-9][0-9]) + basic_machine=hppa1.0-hp + ;; + hp9k7[0-79][0-9] | hp7[0-79][0-9]) + basic_machine=hppa1.1-hp + ;; + hp9k78[0-9] | hp78[0-9]) + # FIXME: really hppa2.0-hp + basic_machine=hppa1.1-hp + ;; + hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) + # FIXME: really hppa2.0-hp + basic_machine=hppa1.1-hp + ;; + hp9k8[0-9][13679] | hp8[0-9][13679]) + basic_machine=hppa1.1-hp + ;; + hp9k8[0-9][0-9] | hp8[0-9][0-9]) + basic_machine=hppa1.0-hp + ;; + hppaosf) + basic_machine=hppa1.1-hp + os=-osf + ;; + hppro) + basic_machine=hppa1.1-hp + os=-proelf + ;; + i370-ibm* | ibm*) + basic_machine=i370-ibm + ;; + i*86v32) + basic_machine=`echo "$1" | sed -e 's/86.*/86-pc/'` + os=-sysv32 + ;; + i*86v4*) + basic_machine=`echo "$1" | sed -e 's/86.*/86-pc/'` + os=-sysv4 + ;; + i*86v) + basic_machine=`echo "$1" | sed -e 's/86.*/86-pc/'` + os=-sysv + ;; + i*86sol2) + basic_machine=`echo "$1" | sed -e 's/86.*/86-pc/'` + os=-solaris2 + ;; + i386mach) + basic_machine=i386-mach + os=-mach + ;; + vsta) + basic_machine=i386-unknown + os=-vsta + ;; + iris | iris4d) + basic_machine=mips-sgi + case $os in + -irix*) + ;; + *) + os=-irix4 + ;; + esac + ;; + isi68 | isi) + basic_machine=m68k-isi + os=-sysv + ;; + leon-*|leon[3-9]-*) + basic_machine=sparc-`echo "$basic_machine" | sed 's/-.*//'` + ;; + m68knommu) + basic_machine=m68k-unknown + os=-linux + ;; + m68knommu-*) + basic_machine=m68k-`echo "$basic_machine" | sed 's/^[^-]*-//'` + os=-linux + ;; + magnum | m3230) + basic_machine=mips-mips + os=-sysv + ;; + merlin) + basic_machine=ns32k-utek + os=-sysv + ;; + microblaze*) + basic_machine=microblaze-xilinx + ;; + mingw64) + basic_machine=x86_64-pc + os=-mingw64 + ;; + mingw32) + basic_machine=i686-pc + os=-mingw32 + ;; + mingw32ce) + basic_machine=arm-unknown + os=-mingw32ce + ;; + miniframe) + basic_machine=m68000-convergent + ;; + *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*) + basic_machine=m68k-atari + os=-mint + ;; + mips3*-*) + basic_machine=`echo "$basic_machine" | sed -e 's/mips3/mips64/'` + ;; + mips3*) + basic_machine=`echo "$basic_machine" | sed -e 's/mips3/mips64/'`-unknown + ;; + monitor) + basic_machine=m68k-rom68k + os=-coff + ;; + morphos) + basic_machine=powerpc-unknown + os=-morphos + ;; + moxiebox) + basic_machine=moxie-unknown + os=-moxiebox + ;; + msdos) + basic_machine=i386-pc + os=-msdos + ;; + ms1-*) + basic_machine=`echo "$basic_machine" | sed -e 's/ms1-/mt-/'` + ;; + msys) + basic_machine=i686-pc + os=-msys + ;; + mvs) + basic_machine=i370-ibm + os=-mvs + ;; + nacl) + basic_machine=le32-unknown + os=-nacl + ;; + ncr3000) + basic_machine=i486-ncr + os=-sysv4 + ;; + netbsd386) + basic_machine=i386-unknown + os=-netbsd + ;; + netwinder) + basic_machine=armv4l-rebel + os=-linux + ;; + news | news700 | news800 | news900) + basic_machine=m68k-sony + os=-newsos + ;; + news1000) + basic_machine=m68030-sony + os=-newsos + ;; + news-3600 | risc-news) + basic_machine=mips-sony + os=-newsos + ;; + necv70) + basic_machine=v70-nec + os=-sysv + ;; + next | m*-next) + basic_machine=m68k-next + case $os in + -nextstep* ) + ;; + -ns2*) + os=-nextstep2 + ;; + *) + os=-nextstep3 + ;; + esac + ;; + nh3000) + basic_machine=m68k-harris + os=-cxux + ;; + nh[45]000) + basic_machine=m88k-harris + os=-cxux + ;; + nindy960) + basic_machine=i960-intel + os=-nindy + ;; + mon960) + basic_machine=i960-intel + os=-mon960 + ;; + nonstopux) + basic_machine=mips-compaq + os=-nonstopux + ;; + np1) + basic_machine=np1-gould + ;; + neo-tandem) + basic_machine=neo-tandem + ;; + nse-tandem) + basic_machine=nse-tandem + ;; + nsr-tandem) + basic_machine=nsr-tandem + ;; + nsv-tandem) + basic_machine=nsv-tandem + ;; + nsx-tandem) + basic_machine=nsx-tandem + ;; + op50n-* | op60c-*) + basic_machine=hppa1.1-oki + os=-proelf + ;; + openrisc | openrisc-*) + basic_machine=or32-unknown + ;; + os400) + basic_machine=powerpc-ibm + os=-os400 + ;; + OSE68000 | ose68000) + basic_machine=m68000-ericsson + os=-ose + ;; + os68k) + basic_machine=m68k-none + os=-os68k + ;; + pa-hitachi) + basic_machine=hppa1.1-hitachi + os=-hiuxwe2 + ;; + paragon) + basic_machine=i860-intel + os=-osf + ;; + parisc) + basic_machine=hppa-unknown + os=-linux + ;; + parisc-*) + basic_machine=hppa-`echo "$basic_machine" | sed 's/^[^-]*-//'` + os=-linux + ;; + pbd) + basic_machine=sparc-tti + ;; + pbb) + basic_machine=m68k-tti + ;; + pc532 | pc532-*) + basic_machine=ns32k-pc532 + ;; + pc98) + basic_machine=i386-pc + ;; + pc98-*) + basic_machine=i386-`echo "$basic_machine" | sed 's/^[^-]*-//'` + ;; + pentium | p5 | k5 | k6 | nexgen | viac3) + basic_machine=i586-pc + ;; + pentiumpro | p6 | 6x86 | athlon | athlon_*) + basic_machine=i686-pc + ;; + pentiumii | pentium2 | pentiumiii | pentium3) + basic_machine=i686-pc + ;; + pentium4) + basic_machine=i786-pc + ;; + pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*) + basic_machine=i586-`echo "$basic_machine" | sed 's/^[^-]*-//'` + ;; + pentiumpro-* | p6-* | 6x86-* | athlon-*) + basic_machine=i686-`echo "$basic_machine" | sed 's/^[^-]*-//'` + ;; + pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*) + basic_machine=i686-`echo "$basic_machine" | sed 's/^[^-]*-//'` + ;; + pentium4-*) + basic_machine=i786-`echo "$basic_machine" | sed 's/^[^-]*-//'` + ;; + pn) + basic_machine=pn-gould + ;; + power) basic_machine=power-ibm + ;; + ppc | ppcbe) basic_machine=powerpc-unknown + ;; + ppc-* | ppcbe-*) + basic_machine=powerpc-`echo "$basic_machine" | sed 's/^[^-]*-//'` + ;; + ppcle | powerpclittle) + basic_machine=powerpcle-unknown + ;; + ppcle-* | powerpclittle-*) + basic_machine=powerpcle-`echo "$basic_machine" | sed 's/^[^-]*-//'` + ;; + ppc64) basic_machine=powerpc64-unknown + ;; + ppc64-*) basic_machine=powerpc64-`echo "$basic_machine" | sed 's/^[^-]*-//'` + ;; + ppc64le | powerpc64little) + basic_machine=powerpc64le-unknown + ;; + ppc64le-* | powerpc64little-*) + basic_machine=powerpc64le-`echo "$basic_machine" | sed 's/^[^-]*-//'` + ;; + ps2) + basic_machine=i386-ibm + ;; + pw32) + basic_machine=i586-unknown + os=-pw32 + ;; + rdos | rdos64) + basic_machine=x86_64-pc + os=-rdos + ;; + rdos32) + basic_machine=i386-pc + os=-rdos + ;; + rom68k) + basic_machine=m68k-rom68k + os=-coff + ;; + rm[46]00) + basic_machine=mips-siemens + ;; + rtpc | rtpc-*) + basic_machine=romp-ibm + ;; + s390 | s390-*) + basic_machine=s390-ibm + ;; + s390x | s390x-*) + basic_machine=s390x-ibm + ;; + sa29200) + basic_machine=a29k-amd + os=-udi + ;; + sb1) + basic_machine=mipsisa64sb1-unknown + ;; + sb1el) + basic_machine=mipsisa64sb1el-unknown + ;; + sde) + basic_machine=mipsisa32-sde + os=-elf + ;; + sei) + basic_machine=mips-sei + os=-seiux + ;; + sequent) + basic_machine=i386-sequent + ;; + sh5el) + basic_machine=sh5le-unknown + ;; + simso-wrs) + basic_machine=sparclite-wrs + os=-vxworks + ;; + sps7) + basic_machine=m68k-bull + os=-sysv2 + ;; + spur) + basic_machine=spur-unknown + ;; + st2000) + basic_machine=m68k-tandem + ;; + stratus) + basic_machine=i860-stratus + os=-sysv4 + ;; + strongarm-* | thumb-*) + basic_machine=arm-`echo "$basic_machine" | sed 's/^[^-]*-//'` + ;; + sun2) + basic_machine=m68000-sun + ;; + sun2os3) + basic_machine=m68000-sun + os=-sunos3 + ;; + sun2os4) + basic_machine=m68000-sun + os=-sunos4 + ;; + sun3os3) + basic_machine=m68k-sun + os=-sunos3 + ;; + sun3os4) + basic_machine=m68k-sun + os=-sunos4 + ;; + sun4os3) + basic_machine=sparc-sun + os=-sunos3 + ;; + sun4os4) + basic_machine=sparc-sun + os=-sunos4 + ;; + sun4sol2) + basic_machine=sparc-sun + os=-solaris2 + ;; + sun3 | sun3-*) + basic_machine=m68k-sun + ;; + sun4) + basic_machine=sparc-sun + ;; + sun386 | sun386i | roadrunner) + basic_machine=i386-sun + ;; + sv1) + basic_machine=sv1-cray + os=-unicos + ;; + symmetry) + basic_machine=i386-sequent + os=-dynix + ;; + t3e) + basic_machine=alphaev5-cray + os=-unicos + ;; + t90) + basic_machine=t90-cray + os=-unicos + ;; + tile*) + basic_machine=$basic_machine-unknown + os=-linux-gnu + ;; + tx39) + basic_machine=mipstx39-unknown + ;; + tx39el) + basic_machine=mipstx39el-unknown + ;; + toad1) + basic_machine=pdp10-xkl + os=-tops20 + ;; + tower | tower-32) + basic_machine=m68k-ncr + ;; + tpf) + basic_machine=s390x-ibm + os=-tpf + ;; + udi29k) + basic_machine=a29k-amd + os=-udi + ;; + ultra3) + basic_machine=a29k-nyu + os=-sym1 + ;; + v810 | necv810) + basic_machine=v810-nec + os=-none + ;; + vaxv) + basic_machine=vax-dec + os=-sysv + ;; + vms) + basic_machine=vax-dec + os=-vms + ;; + vpp*|vx|vx-*) + basic_machine=f301-fujitsu + ;; + vxworks960) + basic_machine=i960-wrs + os=-vxworks + ;; + vxworks68) + basic_machine=m68k-wrs + os=-vxworks + ;; + vxworks29k) + basic_machine=a29k-wrs + os=-vxworks + ;; + w65*) + basic_machine=w65-wdc + os=-none + ;; + w89k-*) + basic_machine=hppa1.1-winbond + os=-proelf + ;; + x64) + basic_machine=x86_64-pc + ;; + xbox) + basic_machine=i686-pc + os=-mingw32 + ;; + xps | xps100) + basic_machine=xps100-honeywell + ;; + xscale-* | xscalee[bl]-*) + basic_machine=`echo "$basic_machine" | sed 's/^xscale/arm/'` + ;; + ymp) + basic_machine=ymp-cray + os=-unicos + ;; + none) + basic_machine=none-none + os=-none + ;; + +# Here we handle the default manufacturer of certain CPU types. It is in +# some cases the only manufacturer, in others, it is the most popular. + w89k) + basic_machine=hppa1.1-winbond + ;; + op50n) + basic_machine=hppa1.1-oki + ;; + op60c) + basic_machine=hppa1.1-oki + ;; + romp) + basic_machine=romp-ibm + ;; + mmix) + basic_machine=mmix-knuth + ;; + rs6000) + basic_machine=rs6000-ibm + ;; + vax) + basic_machine=vax-dec + ;; + pdp11) + basic_machine=pdp11-dec + ;; + we32k) + basic_machine=we32k-att + ;; + sh[1234] | sh[24]a | sh[24]aeb | sh[34]eb | sh[1234]le | sh[23]ele) + basic_machine=sh-unknown + ;; + cydra) + basic_machine=cydra-cydrome + ;; + orion) + basic_machine=orion-highlevel + ;; + orion105) + basic_machine=clipper-highlevel + ;; + mac | mpw | mac-mpw) + basic_machine=m68k-apple + ;; + pmac | pmac-mpw) + basic_machine=powerpc-apple + ;; + *-unknown) + # Make sure to match an already-canonicalized machine name. + ;; + *) + echo Invalid configuration \`"$1"\': machine \`"$basic_machine"\' not recognized 1>&2 + exit 1 + ;; +esac + +# Here we canonicalize certain aliases for manufacturers. +case $basic_machine in + *-digital*) + basic_machine=`echo "$basic_machine" | sed 's/digital.*/dec/'` + ;; + *-commodore*) + basic_machine=`echo "$basic_machine" | sed 's/commodore.*/cbm/'` + ;; + *) + ;; +esac + +# Decode manufacturer-specific aliases for certain operating systems. + +if [ x$os != x ] +then +case $os in + # First match some system type aliases that might get confused + # with valid system types. + # -solaris* is a basic system type, with this one exception. + -auroraux) + os=-auroraux + ;; + -solaris1 | -solaris1.*) + os=`echo $os | sed -e 's|solaris1|sunos4|'` + ;; + -solaris) + os=-solaris2 + ;; + -unixware*) + os=-sysv4.2uw + ;; + -gnu/linux*) + os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'` + ;; + # es1800 is here to avoid being matched by es* (a different OS) + -es1800*) + os=-ose + ;; + # Now accept the basic system types. + # The portable systems comes first. + # Each alternative MUST end in a * to match a version number. + # -sysv* is not here because it comes later, after sysvr4. + -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ + | -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\ + | -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \ + | -sym* | -kopensolaris* | -plan9* \ + | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ + | -aos* | -aros* | -cloudabi* | -sortix* \ + | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ + | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ + | -hiux* | -knetbsd* | -mirbsd* | -netbsd* \ + | -bitrig* | -openbsd* | -solidbsd* | -libertybsd* \ + | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \ + | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ + | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ + | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* | -hcos* \ + | -chorusos* | -chorusrdb* | -cegcc* | -glidix* \ + | -cygwin* | -msys* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ + | -midipix* | -mingw32* | -mingw64* | -linux-gnu* | -linux-android* \ + | -linux-newlib* | -linux-musl* | -linux-uclibc* \ + | -uxpv* | -beos* | -mpeix* | -udk* | -moxiebox* \ + | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* \ + | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ + | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ + | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ + | -morphos* | -superux* | -rtmk* | -windiss* \ + | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \ + | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es* \ + | -onefs* | -tirtos* | -phoenix* | -fuchsia* | -redox* | -bme* \ + | -midnightbsd*) + # Remember, each alternative MUST END IN *, to match a version number. + ;; + -qnx*) + case $basic_machine in + x86-* | i*86-*) + ;; + *) + os=-nto$os + ;; + esac + ;; + -nto-qnx*) + ;; + -nto*) + os=`echo $os | sed -e 's|nto|nto-qnx|'` + ;; + -sim | -xray | -os68k* | -v88r* \ + | -windows* | -osx | -abug | -netware* | -os9* \ + | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*) + ;; + -mac*) + os=`echo "$os" | sed -e 's|mac|macos|'` + ;; + -linux-dietlibc) + os=-linux-dietlibc + ;; + -linux*) + os=`echo $os | sed -e 's|linux|linux-gnu|'` + ;; + -sunos5*) + os=`echo "$os" | sed -e 's|sunos5|solaris2|'` + ;; + -sunos6*) + os=`echo "$os" | sed -e 's|sunos6|solaris3|'` + ;; + -opened*) + os=-openedition + ;; + -os400*) + os=-os400 + ;; + -wince*) + os=-wince + ;; + -utek*) + os=-bsd + ;; + -dynix*) + os=-bsd + ;; + -acis*) + os=-aos + ;; + -atheos*) + os=-atheos + ;; + -syllable*) + os=-syllable + ;; + -386bsd) + os=-bsd + ;; + -ctix* | -uts*) + os=-sysv + ;; + -nova*) + os=-rtmk-nova + ;; + -ns2) + os=-nextstep2 + ;; + -nsk*) + os=-nsk + ;; + # Preserve the version number of sinix5. + -sinix5.*) + os=`echo $os | sed -e 's|sinix|sysv|'` + ;; + -sinix*) + os=-sysv4 + ;; + -tpf*) + os=-tpf + ;; + -triton*) + os=-sysv3 + ;; + -oss*) + os=-sysv3 + ;; + -svr4*) + os=-sysv4 + ;; + -svr3) + os=-sysv3 + ;; + -sysvr4) + os=-sysv4 + ;; + # This must come after -sysvr4. + -sysv*) + ;; + -ose*) + os=-ose + ;; + -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) + os=-mint + ;; + -zvmoe) + os=-zvmoe + ;; + -dicos*) + os=-dicos + ;; + -pikeos*) + # Until real need of OS specific support for + # particular features comes up, bare metal + # configurations are quite functional. + case $basic_machine in + arm*) + os=-eabi + ;; + *) + os=-elf + ;; + esac + ;; + -nacl*) + ;; + -ios) + ;; + -none) + ;; + -*-eabi) + case $basic_machine in + arm*) + ;; + esac + ;; + *) + # Get rid of the `-' at the beginning of $os. + os=`echo $os | sed 's/[^-]*-//'` + echo Invalid configuration \`"$1"\': system \`"$os"\' not recognized 1>&2 + exit 1 + ;; +esac +else + +# Here we handle the default operating systems that come with various machines. +# The value should be what the vendor currently ships out the door with their +# machine or put another way, the most popular os provided with the machine. + +# Note that if you're going to try to match "-MANUFACTURER" here (say, +# "-sun"), then you have to tell the case statement up towards the top +# that MANUFACTURER isn't an operating system. Otherwise, code above +# will signal an error saying that MANUFACTURER isn't an operating +# system, and we'll never get to this point. + +case $basic_machine in + score-*) + os=-elf + ;; + spu-*) + os=-elf + ;; + *-acorn) + os=-riscix1.2 + ;; + arm*-rebel) + os=-linux + ;; + arm*-semi) + os=-aout + ;; + c4x-* | tic4x-*) + os=-coff + ;; + c8051-*) + os=-elf + ;; + hexagon-*) + os=-elf + ;; + tic54x-*) + os=-coff + ;; + tic55x-*) + os=-coff + ;; + tic6x-*) + os=-coff + ;; + # This must come before the *-dec entry. + pdp10-*) + os=-tops20 + ;; + pdp11-*) + os=-none + ;; + *-dec | vax-*) + os=-ultrix4.2 + ;; + m68*-apollo) + os=-domain + ;; + i386-sun) + os=-sunos4.0.2 + ;; + m68000-sun) + os=-sunos3 + ;; + m68*-cisco) + os=-aout + ;; + mep-*) + os=-elf + ;; + mips*-cisco) + os=-elf + ;; + mips*-*) + os=-elf + ;; + or32-*) + os=-coff + ;; + *-tti) # must be before sparc entry or we get the wrong os. + os=-sysv3 + ;; + sparc-* | *-sun) + os=-sunos4.1.1 + ;; + pru-*) + os=-elf + ;; + *-be) + os=-beos + ;; + *-ibm) + os=-aix + ;; + *-knuth) + os=-mmixware + ;; + *-wec) + os=-proelf + ;; + *-winbond) + os=-proelf + ;; + *-oki) + os=-proelf + ;; + *-hp) + os=-hpux + ;; + *-hitachi) + os=-hiux + ;; + i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) + os=-sysv + ;; + *-cbm) + os=-amigaos + ;; + *-dg) + os=-dgux + ;; + *-dolphin) + os=-sysv3 + ;; + m68k-ccur) + os=-rtu + ;; + m88k-omron*) + os=-luna + ;; + *-next) + os=-nextstep + ;; + *-sequent) + os=-ptx + ;; + *-crds) + os=-unos + ;; + *-ns) + os=-genix + ;; + i370-*) + os=-mvs + ;; + *-gould) + os=-sysv + ;; + *-highlevel) + os=-bsd + ;; + *-encore) + os=-bsd + ;; + *-sgi) + os=-irix + ;; + *-siemens) + os=-sysv4 + ;; + *-masscomp) + os=-rtu + ;; + f30[01]-fujitsu | f700-fujitsu) + os=-uxpv + ;; + *-rom68k) + os=-coff + ;; + *-*bug) + os=-coff + ;; + *-apple) + os=-macos + ;; + *-atari*) + os=-mint + ;; + *) + os=-none + ;; +esac +fi + +# Here we handle the case where we know the os, and the CPU type, but not the +# manufacturer. We pick the logical manufacturer. +vendor=unknown +case $basic_machine in + *-unknown) + case $os in + -riscix*) + vendor=acorn + ;; + -sunos*) + vendor=sun + ;; + -cnk*|-aix*) + vendor=ibm + ;; + -beos*) + vendor=be + ;; + -hpux*) + vendor=hp + ;; + -mpeix*) + vendor=hp + ;; + -hiux*) + vendor=hitachi + ;; + -unos*) + vendor=crds + ;; + -dgux*) + vendor=dg + ;; + -luna*) + vendor=omron + ;; + -genix*) + vendor=ns + ;; + -mvs* | -opened*) + vendor=ibm + ;; + -os400*) + vendor=ibm + ;; + -ptx*) + vendor=sequent + ;; + -tpf*) + vendor=ibm + ;; + -vxsim* | -vxworks* | -windiss*) + vendor=wrs + ;; + -aux*) + vendor=apple + ;; + -hms*) + vendor=hitachi + ;; + -mpw* | -macos*) + vendor=apple + ;; + -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) + vendor=atari + ;; + -vos*) + vendor=stratus + ;; + esac + basic_machine=`echo "$basic_machine" | sed "s/unknown/$vendor/"` + ;; +esac + +echo "$basic_machine$os" +exit + +# Local variables: +# eval: (add-hook 'before-save-hook 'time-stamp) +# time-stamp-start: "timestamp='" +# time-stamp-format: "%:y-%02m-%02d" +# time-stamp-end: "'" +# End: diff --git a/configure b/configure new file mode 100755 index 0000000..a4c0c4f --- /dev/null +++ b/configure @@ -0,0 +1,11976 @@ +#! /bin/sh +# Guess values for system-dependent variables and create Makefiles. +# Generated by GNU Autoconf 2.69 for alsa-utils 1.2.4. +# +# +# Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc. +# +# +# This configure script is free software; the Free Software Foundation +# gives unlimited permission to copy, distribute and modify it. +## -------------------- ## +## M4sh Initialization. ## +## -------------------- ## + +# Be more Bourne compatible +DUALCASE=1; export DUALCASE # for MKS sh +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : + emulate sh + NULLCMD=: + # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which + # is contrary to our usage. Disable this feature. + alias -g '${1+"$@"}'='"$@"' + setopt NO_GLOB_SUBST +else + case `(set -o) 2>/dev/null` in #( + *posix*) : + set -o posix ;; #( + *) : + ;; +esac +fi + + +as_nl=' +' +export as_nl +# Printing a long string crashes Solaris 7 /usr/bin/printf. +as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' +as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo +as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo +# Prefer a ksh shell builtin over an external printf program on Solaris, +# but without wasting forks for bash or zsh. +if test -z "$BASH_VERSION$ZSH_VERSION" \ + && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then + as_echo='print -r --' + as_echo_n='print -rn --' +elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then + as_echo='printf %s\n' + as_echo_n='printf %s' +else + if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then + as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' + as_echo_n='/usr/ucb/echo -n' + else + as_echo_body='eval expr "X$1" : "X\\(.*\\)"' + as_echo_n_body='eval + arg=$1; + case $arg in #( + *"$as_nl"*) + expr "X$arg" : "X\\(.*\\)$as_nl"; + arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; + esac; + expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" + ' + export as_echo_n_body + as_echo_n='sh -c $as_echo_n_body as_echo' + fi + export as_echo_body + as_echo='sh -c $as_echo_body as_echo' +fi + +# The user is always right. +if test "${PATH_SEPARATOR+set}" != set; then + PATH_SEPARATOR=: + (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { + (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || + PATH_SEPARATOR=';' + } +fi + + +# IFS +# We need space, tab and new line, in precisely that order. Quoting is +# there to prevent editors from complaining about space-tab. +# (If _AS_PATH_WALK were called with IFS unset, it would disable word +# splitting by setting IFS to empty value.) +IFS=" "" $as_nl" + +# Find who we are. Look in the path if we contain no directory separator. +as_myself= +case $0 in #(( + *[\\/]* ) as_myself=$0 ;; + *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break + done +IFS=$as_save_IFS + + ;; +esac +# We did not find ourselves, most probably we were run as `sh COMMAND' +# in which case we are not to be found in the path. +if test "x$as_myself" = x; then + as_myself=$0 +fi +if test ! -f "$as_myself"; then + $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 + exit 1 +fi + +# Unset variables that we do not need and which cause bugs (e.g. in +# pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" +# suppresses any "Segmentation fault" message there. '((' could +# trigger a bug in pdksh 5.2.14. +for as_var in BASH_ENV ENV MAIL MAILPATH +do eval test x\${$as_var+set} = xset \ + && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : +done +PS1='$ ' +PS2='> ' +PS4='+ ' + +# NLS nuisances. +LC_ALL=C +export LC_ALL +LANGUAGE=C +export LANGUAGE + +# CDPATH. +(unset CDPATH) >/dev/null 2>&1 && unset CDPATH + +# Use a proper internal environment variable to ensure we don't fall + # into an infinite loop, continuously re-executing ourselves. + if test x"${_as_can_reexec}" != xno && test "x$CONFIG_SHELL" != x; then + _as_can_reexec=no; export _as_can_reexec; + # We cannot yet assume a decent shell, so we have to provide a +# neutralization value for shells without unset; and this also +# works around shells that cannot unset nonexistent variables. +# Preserve -v and -x to the replacement shell. +BASH_ENV=/dev/null +ENV=/dev/null +(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV +case $- in # (((( + *v*x* | *x*v* ) as_opts=-vx ;; + *v* ) as_opts=-v ;; + *x* ) as_opts=-x ;; + * ) as_opts= ;; +esac +exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} +# Admittedly, this is quite paranoid, since all the known shells bail +# out after a failed `exec'. +$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2 +as_fn_exit 255 + fi + # We don't want this to propagate to other subprocesses. + { _as_can_reexec=; unset _as_can_reexec;} +if test "x$CONFIG_SHELL" = x; then + as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then : + emulate sh + NULLCMD=: + # Pre-4.2 versions of Zsh do word splitting on \${1+\"\$@\"}, which + # is contrary to our usage. Disable this feature. + alias -g '\${1+\"\$@\"}'='\"\$@\"' + setopt NO_GLOB_SUBST +else + case \`(set -o) 2>/dev/null\` in #( + *posix*) : + set -o posix ;; #( + *) : + ;; +esac +fi +" + as_required="as_fn_return () { (exit \$1); } +as_fn_success () { as_fn_return 0; } +as_fn_failure () { as_fn_return 1; } +as_fn_ret_success () { return 0; } +as_fn_ret_failure () { return 1; } + +exitcode=0 +as_fn_success || { exitcode=1; echo as_fn_success failed.; } +as_fn_failure && { exitcode=1; echo as_fn_failure succeeded.; } +as_fn_ret_success || { exitcode=1; echo as_fn_ret_success failed.; } +as_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; } +if ( set x; as_fn_ret_success y && test x = \"\$1\" ); then : + +else + exitcode=1; echo positional parameters were not saved. +fi +test x\$exitcode = x0 || exit 1 +test -x / || exit 1" + as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO + as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO + eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" && + test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1 +test \$(( 1 + 1 )) = 2 || exit 1" + if (eval "$as_required") 2>/dev/null; then : + as_have_required=yes +else + as_have_required=no +fi + if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null; then : + +else + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +as_found=false +for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + as_found=: + case $as_dir in #( + /*) + for as_base in sh bash ksh sh5; do + # Try only shells that exist, to save several forks. + as_shell=$as_dir/$as_base + if { test -f "$as_shell" || test -f "$as_shell.exe"; } && + { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$as_shell"; } 2>/dev/null; then : + CONFIG_SHELL=$as_shell as_have_required=yes + if { $as_echo "$as_bourne_compatible""$as_suggested" | as_run=a "$as_shell"; } 2>/dev/null; then : + break 2 +fi +fi + done;; + esac + as_found=false +done +$as_found || { if { test -f "$SHELL" || test -f "$SHELL.exe"; } && + { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$SHELL"; } 2>/dev/null; then : + CONFIG_SHELL=$SHELL as_have_required=yes +fi; } +IFS=$as_save_IFS + + + if test "x$CONFIG_SHELL" != x; then : + export CONFIG_SHELL + # We cannot yet assume a decent shell, so we have to provide a +# neutralization value for shells without unset; and this also +# works around shells that cannot unset nonexistent variables. +# Preserve -v and -x to the replacement shell. +BASH_ENV=/dev/null +ENV=/dev/null +(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV +case $- in # (((( + *v*x* | *x*v* ) as_opts=-vx ;; + *v* ) as_opts=-v ;; + *x* ) as_opts=-x ;; + * ) as_opts= ;; +esac +exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} +# Admittedly, this is quite paranoid, since all the known shells bail +# out after a failed `exec'. +$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2 +exit 255 +fi + + if test x$as_have_required = xno; then : + $as_echo "$0: This script requires a shell more modern than all" + $as_echo "$0: the shells that I found on your system." + if test x${ZSH_VERSION+set} = xset ; then + $as_echo "$0: In particular, zsh $ZSH_VERSION has bugs and should" + $as_echo "$0: be upgraded to zsh 4.3.4 or later." + else + $as_echo "$0: Please tell bug-autoconf@gnu.org about your system, +$0: including any error possibly output before this +$0: message. Then install a modern shell, or manually run +$0: the script under such a shell if you do have one." + fi + exit 1 +fi +fi +fi +SHELL=${CONFIG_SHELL-/bin/sh} +export SHELL +# Unset more variables known to interfere with behavior of common tools. +CLICOLOR_FORCE= GREP_OPTIONS= +unset CLICOLOR_FORCE GREP_OPTIONS + +## --------------------- ## +## M4sh Shell Functions. ## +## --------------------- ## +# as_fn_unset VAR +# --------------- +# Portably unset VAR. +as_fn_unset () +{ + { eval $1=; unset $1;} +} +as_unset=as_fn_unset + +# as_fn_set_status STATUS +# ----------------------- +# Set $? to STATUS, without forking. +as_fn_set_status () +{ + return $1 +} # as_fn_set_status + +# as_fn_exit STATUS +# ----------------- +# Exit the shell with STATUS, even in a "trap 0" or "set -e" context. +as_fn_exit () +{ + set +e + as_fn_set_status $1 + exit $1 +} # as_fn_exit + +# as_fn_mkdir_p +# ------------- +# Create "$as_dir" as a directory, including parents if necessary. +as_fn_mkdir_p () +{ + + case $as_dir in #( + -*) as_dir=./$as_dir;; + esac + test -d "$as_dir" || eval $as_mkdir_p || { + as_dirs= + while :; do + case $as_dir in #( + *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( + *) as_qdir=$as_dir;; + esac + as_dirs="'$as_qdir' $as_dirs" + as_dir=`$as_dirname -- "$as_dir" || +$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_dir" : 'X\(//\)[^/]' \| \ + X"$as_dir" : 'X\(//\)$' \| \ + X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$as_dir" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + test -d "$as_dir" && break + done + test -z "$as_dirs" || eval "mkdir $as_dirs" + } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" + + +} # as_fn_mkdir_p + +# as_fn_executable_p FILE +# ----------------------- +# Test if FILE is an executable regular file. +as_fn_executable_p () +{ + test -f "$1" && test -x "$1" +} # as_fn_executable_p +# as_fn_append VAR VALUE +# ---------------------- +# Append the text in VALUE to the end of the definition contained in VAR. Take +# advantage of any shell optimizations that allow amortized linear growth over +# repeated appends, instead of the typical quadratic growth present in naive +# implementations. +if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : + eval 'as_fn_append () + { + eval $1+=\$2 + }' +else + as_fn_append () + { + eval $1=\$$1\$2 + } +fi # as_fn_append + +# as_fn_arith ARG... +# ------------------ +# Perform arithmetic evaluation on the ARGs, and store the result in the +# global $as_val. Take advantage of shells that can avoid forks. The arguments +# must be portable across $(()) and expr. +if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : + eval 'as_fn_arith () + { + as_val=$(( $* )) + }' +else + as_fn_arith () + { + as_val=`expr "$@" || test $? -eq 1` + } +fi # as_fn_arith + + +# as_fn_error STATUS ERROR [LINENO LOG_FD] +# ---------------------------------------- +# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are +# provided, also output the error to LOG_FD, referencing LINENO. Then exit the +# script with STATUS, using 1 if that was 0. +as_fn_error () +{ + as_status=$1; test $as_status -eq 0 && as_status=1 + if test "$4"; then + as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 + fi + $as_echo "$as_me: error: $2" >&2 + as_fn_exit $as_status +} # as_fn_error + +if expr a : '\(a\)' >/dev/null 2>&1 && + test "X`expr 00001 : '.*\(...\)'`" = X001; then + as_expr=expr +else + as_expr=false +fi + +if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then + as_basename=basename +else + as_basename=false +fi + +if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then + as_dirname=dirname +else + as_dirname=false +fi + +as_me=`$as_basename -- "$0" || +$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X/"$0" | + sed '/^.*\/\([^/][^/]*\)\/*$/{ + s//\1/ + q + } + /^X\/\(\/\/\)$/{ + s//\1/ + q + } + /^X\/\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + +# Avoid depending upon Character Ranges. +as_cr_letters='abcdefghijklmnopqrstuvwxyz' +as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' +as_cr_Letters=$as_cr_letters$as_cr_LETTERS +as_cr_digits='0123456789' +as_cr_alnum=$as_cr_Letters$as_cr_digits + + + as_lineno_1=$LINENO as_lineno_1a=$LINENO + as_lineno_2=$LINENO as_lineno_2a=$LINENO + eval 'test "x$as_lineno_1'$as_run'" != "x$as_lineno_2'$as_run'" && + test "x`expr $as_lineno_1'$as_run' + 1`" = "x$as_lineno_2'$as_run'"' || { + # Blame Lee E. McMahon (1931-1989) for sed's syntax. :-) + sed -n ' + p + /[$]LINENO/= + ' <$as_myself | + sed ' + s/[$]LINENO.*/&-/ + t lineno + b + :lineno + N + :loop + s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ + t loop + s/-\n.*// + ' >$as_me.lineno && + chmod +x "$as_me.lineno" || + { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; } + + # If we had to re-execute with $CONFIG_SHELL, we're ensured to have + # already done that, so ensure we don't try to do so again and fall + # in an infinite loop. This has already happened in practice. + _as_can_reexec=no; export _as_can_reexec + # Don't try to exec as it changes $[0], causing all sort of problems + # (the dirname of $[0] is not the place where we might find the + # original and so on. Autoconf is especially sensitive to this). + . "./$as_me.lineno" + # Exit status is that of the last command. + exit +} + +ECHO_C= ECHO_N= ECHO_T= +case `echo -n x` in #((((( +-n*) + case `echo 'xy\c'` in + *c*) ECHO_T=' ';; # ECHO_T is single tab character. + xy) ECHO_C='\c';; + *) echo `echo ksh88 bug on AIX 6.1` > /dev/null + ECHO_T=' ';; + esac;; +*) + ECHO_N='-n';; +esac + +rm -f conf$$ conf$$.exe conf$$.file +if test -d conf$$.dir; then + rm -f conf$$.dir/conf$$.file +else + rm -f conf$$.dir + mkdir conf$$.dir 2>/dev/null +fi +if (echo >conf$$.file) 2>/dev/null; then + if ln -s conf$$.file conf$$ 2>/dev/null; then + as_ln_s='ln -s' + # ... but there are two gotchas: + # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. + # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. + # In both cases, we have to default to `cp -pR'. + ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || + as_ln_s='cp -pR' + elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln + else + as_ln_s='cp -pR' + fi +else + as_ln_s='cp -pR' +fi +rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file +rmdir conf$$.dir 2>/dev/null + +if mkdir -p . 2>/dev/null; then + as_mkdir_p='mkdir -p "$as_dir"' +else + test -d ./-p && rmdir ./-p + as_mkdir_p=false +fi + +as_test_x='test -x' +as_executable_p=as_fn_executable_p + +# Sed expression to map a string onto a valid CPP name. +as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" + +# Sed expression to map a string onto a valid variable name. +as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" + + +test -n "$DJDIR" || exec 7<&0 &1 + +# Name of the host. +# hostname on some systems (SVR3.2, old GNU/Linux) returns a bogus exit status, +# so uname gets run too. +ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` + +# +# Initializations. +# +ac_default_prefix=/usr/local +ac_clean_files= +ac_config_libobj_dir=. +LIBOBJS= +cross_compiling=no +subdirs= +MFLAGS= +MAKEFLAGS= + +# Identity of this package. +PACKAGE_NAME='alsa-utils' +PACKAGE_TARNAME='alsa-utils' +PACKAGE_VERSION='1.2.4' +PACKAGE_STRING='alsa-utils 1.2.4' +PACKAGE_BUGREPORT='' +PACKAGE_URL='' + +ac_unique_file="aplay/aplay.c" +ac_default_prefix=/usr +gt_needs= +# Factoring default headers for most tests. +ac_includes_default="\ +#include +#ifdef HAVE_SYS_TYPES_H +# include +#endif +#ifdef HAVE_SYS_STAT_H +# include +#endif +#ifdef STDC_HEADERS +# include +# include +#else +# ifdef HAVE_STDLIB_H +# include +# endif +#endif +#ifdef HAVE_STRING_H +# if !defined STDC_HEADERS && defined HAVE_MEMORY_H +# include +# endif +# include +#endif +#ifdef HAVE_STRINGS_H +# include +#endif +#ifdef HAVE_INTTYPES_H +# include +#endif +#ifdef HAVE_STDINT_H +# include +#endif +#ifdef HAVE_UNISTD_H +# include +#endif" + +ac_subst_vars='am__EXEEXT_FALSE +am__EXEEXT_TRUE +LTLIBOBJS +LIBOBJS +ALSACTL_DAEMONSWITCH +ALSACTL_PIDFILE_DIR +ASOUND_LOCK_DIR +ASOUND_STATE_DIR +HAVE_SYSTEMD_FALSE +HAVE_SYSTEMD_TRUE +systemdsystemunitdir +SYSTEMD_LIBS +SYSTEMD_CFLAGS +LIBRT +SND_UTIL_SUBMINOR +SND_UTIL_MINOR +SND_UTIL_MAJOR +SND_UTIL_VERSION +TESTSOUND +mydatadir +CURSES_CFLAGS +CURSESLIB +CURSESINC +ncurses5_config +NCURSES_LIBS +NCURSES_CFLAGS +ncursesw5_config +NCURSESW_LIBS +NCURSESW_CFLAGS +udevrulesdir +USE_RST2MAN_FALSE +USE_RST2MAN_TRUE +rst2man_available +USE_XMLTO_FALSE +USE_XMLTO_TRUE +xmlto_available +ALSALOOP_FALSE +ALSALOOP_TRUE +ALSACONF_FALSE +ALSACONF_TRUE +ALSAMIXER_FALSE +ALSAMIXER_TRUE +HAVE_LIBTINYALSA_FALSE +HAVE_LIBTINYALSA_TRUE +HAVE_LIBFFTW3_FALSE +HAVE_LIBFFTW3_TRUE +FFTW_CFLAGS +FFTW_LIB +FFTW_INC +BAT_FALSE +BAT_TRUE +HAVE_FFADO_FALSE +HAVE_FFADO_TRUE +HAVE_SAMPLERATE_FALSE +HAVE_SAMPLERATE_TRUE +HAVE_TOPOLOGY_FALSE +HAVE_TOPOLOGY_TRUE +HAVE_UCM_FALSE +HAVE_UCM_TRUE +HAVE_SEQ_FALSE +HAVE_SEQ_TRUE +HAVE_RAWMIDI_FALSE +HAVE_RAWMIDI_TRUE +HAVE_MIXER_FALSE +HAVE_MIXER_TRUE +HAVE_PCM_FALSE +HAVE_PCM_TRUE +ALSA_TOPOLOGY_LIBS +ALSA_LIBS +ALSA_CFLAGS +PKG_CONFIG_LIBDIR +PKG_CONFIG_PATH +PKG_CONFIG +LN_S +POSUB +LTLIBINTL +LIBINTL +INTLLIBS +LTLIBICONV +LIBICONV +INTL_MACOSX_LIBS +EGREP +GREP +CPP +host_os +host_vendor +host_cpu +host +build_os +build_vendor +build_cpu +build +am__fastdepCC_FALSE +am__fastdepCC_TRUE +CCDEPMODE +am__nodep +AMDEPBACKSLASH +AMDEP_FALSE +AMDEP_TRUE +am__include +DEPDIR +OBJEXT +EXEEXT +ac_ct_CC +CPPFLAGS +LDFLAGS +CFLAGS +CC +XGETTEXT_EXTRA_OPTIONS +MSGMERGE +XGETTEXT_015 +XGETTEXT +GMSGFMT_015 +MSGFMT_015 +GMSGFMT +MSGFMT +GETTEXT_MACRO_VERSION +USE_NLS +SED +MAINT +MAINTAINER_MODE_FALSE +MAINTAINER_MODE_TRUE +AM_BACKSLASH +AM_DEFAULT_VERBOSITY +AM_DEFAULT_V +AM_V +am__untar +am__tar +AMTAR +am__leading_dot +SET_MAKE +AWK +mkdir_p +MKDIR_P +INSTALL_STRIP_PROGRAM +STRIP +install_sh +MAKEINFO +AUTOHEADER +AUTOMAKE +AUTOCONF +ACLOCAL +VERSION +PACKAGE +CYGPATH_W +am__isrc +INSTALL_DATA +INSTALL_SCRIPT +INSTALL_PROGRAM +target_alias +host_alias +build_alias +LIBS +ECHO_T +ECHO_N +ECHO_C +DEFS +mandir +localedir +libdir +psdir +pdfdir +dvidir +htmldir +infodir +docdir +oldincludedir +includedir +localstatedir +sharedstatedir +sysconfdir +datadir +datarootdir +libexecdir +sbindir +bindir +program_transform_name +prefix +exec_prefix +PACKAGE_URL +PACKAGE_BUGREPORT +PACKAGE_STRING +PACKAGE_VERSION +PACKAGE_TARNAME +PACKAGE_NAME +PATH_SEPARATOR +SHELL +am__quote' +ac_subst_files='' +ac_user_opts=' +enable_option_checking +enable_silent_rules +enable_maintainer_mode +enable_nls +enable_dependency_tracking +with_gnu_ld +enable_rpath +with_libiconv_prefix +with_libintl_prefix +with_alsa_prefix +with_alsa_inc_prefix +enable_alsa_topology +enable_alsatest +enable_alsabat_backend_tiny +enable_bat +with_librt +enable_alsamixer +enable_alsaconf +enable_alsaloop +enable_xmlto +enable_rst2man +with_udev_rules_dir +with_curses +with_testsound +enable_largefile +with_systemdsystemunitdir +with_asound_state_dir +with_alsactl_lock_dir +with_alsactl_pidfile_dir +with_alsactl_daemonswitch +' + ac_precious_vars='build_alias +host_alias +target_alias +CC +CFLAGS +LDFLAGS +LIBS +CPPFLAGS +CPP +PKG_CONFIG +PKG_CONFIG_PATH +PKG_CONFIG_LIBDIR +NCURSESW_CFLAGS +NCURSESW_LIBS +NCURSES_CFLAGS +NCURSES_LIBS +SYSTEMD_CFLAGS +SYSTEMD_LIBS' + + +# Initialize some variables set by options. +ac_init_help= +ac_init_version=false +ac_unrecognized_opts= +ac_unrecognized_sep= +# The variables have the same names as the options, with +# dashes changed to underlines. +cache_file=/dev/null +exec_prefix=NONE +no_create= +no_recursion= +prefix=NONE +program_prefix=NONE +program_suffix=NONE +program_transform_name=s,x,x, +silent= +site= +srcdir= +verbose= +x_includes=NONE +x_libraries=NONE + +# Installation directory options. +# These are left unexpanded so users can "make install exec_prefix=/foo" +# and all the variables that are supposed to be based on exec_prefix +# by default will actually change. +# Use braces instead of parens because sh, perl, etc. also accept them. +# (The list follows the same order as the GNU Coding Standards.) +bindir='${exec_prefix}/bin' +sbindir='${exec_prefix}/sbin' +libexecdir='${exec_prefix}/libexec' +datarootdir='${prefix}/share' +datadir='${datarootdir}' +sysconfdir='${prefix}/etc' +sharedstatedir='${prefix}/com' +localstatedir='${prefix}/var' +includedir='${prefix}/include' +oldincludedir='/usr/include' +docdir='${datarootdir}/doc/${PACKAGE_TARNAME}' +infodir='${datarootdir}/info' +htmldir='${docdir}' +dvidir='${docdir}' +pdfdir='${docdir}' +psdir='${docdir}' +libdir='${exec_prefix}/lib' +localedir='${datarootdir}/locale' +mandir='${datarootdir}/man' + +ac_prev= +ac_dashdash= +for ac_option +do + # If the previous option needs an argument, assign it. + if test -n "$ac_prev"; then + eval $ac_prev=\$ac_option + ac_prev= + continue + fi + + case $ac_option in + *=?*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;; + *=) ac_optarg= ;; + *) ac_optarg=yes ;; + esac + + # Accept the important Cygnus configure options, so we can diagnose typos. + + case $ac_dashdash$ac_option in + --) + ac_dashdash=yes ;; + + -bindir | --bindir | --bindi | --bind | --bin | --bi) + ac_prev=bindir ;; + -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) + bindir=$ac_optarg ;; + + -build | --build | --buil | --bui | --bu) + ac_prev=build_alias ;; + -build=* | --build=* | --buil=* | --bui=* | --bu=*) + build_alias=$ac_optarg ;; + + -cache-file | --cache-file | --cache-fil | --cache-fi \ + | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) + ac_prev=cache_file ;; + -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ + | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) + cache_file=$ac_optarg ;; + + --config-cache | -C) + cache_file=config.cache ;; + + -datadir | --datadir | --datadi | --datad) + ac_prev=datadir ;; + -datadir=* | --datadir=* | --datadi=* | --datad=*) + datadir=$ac_optarg ;; + + -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \ + | --dataroo | --dataro | --datar) + ac_prev=datarootdir ;; + -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \ + | --dataroot=* | --dataroo=* | --dataro=* | --datar=*) + datarootdir=$ac_optarg ;; + + -disable-* | --disable-*) + ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && + as_fn_error $? "invalid feature name: $ac_useropt" + ac_useropt_orig=$ac_useropt + ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` + case $ac_user_opts in + *" +"enable_$ac_useropt" +"*) ;; + *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--disable-$ac_useropt_orig" + ac_unrecognized_sep=', ';; + esac + eval enable_$ac_useropt=no ;; + + -docdir | --docdir | --docdi | --doc | --do) + ac_prev=docdir ;; + -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*) + docdir=$ac_optarg ;; + + -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv) + ac_prev=dvidir ;; + -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*) + dvidir=$ac_optarg ;; + + -enable-* | --enable-*) + ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && + as_fn_error $? "invalid feature name: $ac_useropt" + ac_useropt_orig=$ac_useropt + ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` + case $ac_user_opts in + *" +"enable_$ac_useropt" +"*) ;; + *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--enable-$ac_useropt_orig" + ac_unrecognized_sep=', ';; + esac + eval enable_$ac_useropt=\$ac_optarg ;; + + -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ + | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ + | --exec | --exe | --ex) + ac_prev=exec_prefix ;; + -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ + | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ + | --exec=* | --exe=* | --ex=*) + exec_prefix=$ac_optarg ;; + + -gas | --gas | --ga | --g) + # Obsolete; use --with-gas. + with_gas=yes ;; + + -help | --help | --hel | --he | -h) + ac_init_help=long ;; + -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) + ac_init_help=recursive ;; + -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) + ac_init_help=short ;; + + -host | --host | --hos | --ho) + ac_prev=host_alias ;; + -host=* | --host=* | --hos=* | --ho=*) + host_alias=$ac_optarg ;; + + -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht) + ac_prev=htmldir ;; + -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \ + | --ht=*) + htmldir=$ac_optarg ;; + + -includedir | --includedir | --includedi | --included | --include \ + | --includ | --inclu | --incl | --inc) + ac_prev=includedir ;; + -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ + | --includ=* | --inclu=* | --incl=* | --inc=*) + includedir=$ac_optarg ;; + + -infodir | --infodir | --infodi | --infod | --info | --inf) + ac_prev=infodir ;; + -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) + infodir=$ac_optarg ;; + + -libdir | --libdir | --libdi | --libd) + ac_prev=libdir ;; + -libdir=* | --libdir=* | --libdi=* | --libd=*) + libdir=$ac_optarg ;; + + -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ + | --libexe | --libex | --libe) + ac_prev=libexecdir ;; + -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ + | --libexe=* | --libex=* | --libe=*) + libexecdir=$ac_optarg ;; + + -localedir | --localedir | --localedi | --localed | --locale) + ac_prev=localedir ;; + -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*) + localedir=$ac_optarg ;; + + -localstatedir | --localstatedir | --localstatedi | --localstated \ + | --localstate | --localstat | --localsta | --localst | --locals) + ac_prev=localstatedir ;; + -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ + | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*) + localstatedir=$ac_optarg ;; + + -mandir | --mandir | --mandi | --mand | --man | --ma | --m) + ac_prev=mandir ;; + -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) + mandir=$ac_optarg ;; + + -nfp | --nfp | --nf) + # Obsolete; use --without-fp. + with_fp=no ;; + + -no-create | --no-create | --no-creat | --no-crea | --no-cre \ + | --no-cr | --no-c | -n) + no_create=yes ;; + + -no-recursion | --no-recursion | --no-recursio | --no-recursi \ + | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) + no_recursion=yes ;; + + -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ + | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ + | --oldin | --oldi | --old | --ol | --o) + ac_prev=oldincludedir ;; + -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ + | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ + | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) + oldincludedir=$ac_optarg ;; + + -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) + ac_prev=prefix ;; + -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) + prefix=$ac_optarg ;; + + -program-prefix | --program-prefix | --program-prefi | --program-pref \ + | --program-pre | --program-pr | --program-p) + ac_prev=program_prefix ;; + -program-prefix=* | --program-prefix=* | --program-prefi=* \ + | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) + program_prefix=$ac_optarg ;; + + -program-suffix | --program-suffix | --program-suffi | --program-suff \ + | --program-suf | --program-su | --program-s) + ac_prev=program_suffix ;; + -program-suffix=* | --program-suffix=* | --program-suffi=* \ + | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) + program_suffix=$ac_optarg ;; + + -program-transform-name | --program-transform-name \ + | --program-transform-nam | --program-transform-na \ + | --program-transform-n | --program-transform- \ + | --program-transform | --program-transfor \ + | --program-transfo | --program-transf \ + | --program-trans | --program-tran \ + | --progr-tra | --program-tr | --program-t) + ac_prev=program_transform_name ;; + -program-transform-name=* | --program-transform-name=* \ + | --program-transform-nam=* | --program-transform-na=* \ + | --program-transform-n=* | --program-transform-=* \ + | --program-transform=* | --program-transfor=* \ + | --program-transfo=* | --program-transf=* \ + | --program-trans=* | --program-tran=* \ + | --progr-tra=* | --program-tr=* | --program-t=*) + program_transform_name=$ac_optarg ;; + + -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd) + ac_prev=pdfdir ;; + -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*) + pdfdir=$ac_optarg ;; + + -psdir | --psdir | --psdi | --psd | --ps) + ac_prev=psdir ;; + -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*) + psdir=$ac_optarg ;; + + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil) + silent=yes ;; + + -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) + ac_prev=sbindir ;; + -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ + | --sbi=* | --sb=*) + sbindir=$ac_optarg ;; + + -sharedstatedir | --sharedstatedir | --sharedstatedi \ + | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ + | --sharedst | --shareds | --shared | --share | --shar \ + | --sha | --sh) + ac_prev=sharedstatedir ;; + -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ + | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ + | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ + | --sha=* | --sh=*) + sharedstatedir=$ac_optarg ;; + + -site | --site | --sit) + ac_prev=site ;; + -site=* | --site=* | --sit=*) + site=$ac_optarg ;; + + -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) + ac_prev=srcdir ;; + -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) + srcdir=$ac_optarg ;; + + -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ + | --syscon | --sysco | --sysc | --sys | --sy) + ac_prev=sysconfdir ;; + -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ + | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) + sysconfdir=$ac_optarg ;; + + -target | --target | --targe | --targ | --tar | --ta | --t) + ac_prev=target_alias ;; + -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) + target_alias=$ac_optarg ;; + + -v | -verbose | --verbose | --verbos | --verbo | --verb) + verbose=yes ;; + + -version | --version | --versio | --versi | --vers | -V) + ac_init_version=: ;; + + -with-* | --with-*) + ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && + as_fn_error $? "invalid package name: $ac_useropt" + ac_useropt_orig=$ac_useropt + ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` + case $ac_user_opts in + *" +"with_$ac_useropt" +"*) ;; + *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--with-$ac_useropt_orig" + ac_unrecognized_sep=', ';; + esac + eval with_$ac_useropt=\$ac_optarg ;; + + -without-* | --without-*) + ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && + as_fn_error $? "invalid package name: $ac_useropt" + ac_useropt_orig=$ac_useropt + ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` + case $ac_user_opts in + *" +"with_$ac_useropt" +"*) ;; + *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--without-$ac_useropt_orig" + ac_unrecognized_sep=', ';; + esac + eval with_$ac_useropt=no ;; + + --x) + # Obsolete; use --with-x. + with_x=yes ;; + + -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ + | --x-incl | --x-inc | --x-in | --x-i) + ac_prev=x_includes ;; + -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ + | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) + x_includes=$ac_optarg ;; + + -x-libraries | --x-libraries | --x-librarie | --x-librari \ + | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) + ac_prev=x_libraries ;; + -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ + | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) + x_libraries=$ac_optarg ;; + + -*) as_fn_error $? "unrecognized option: \`$ac_option' +Try \`$0 --help' for more information" + ;; + + *=*) + ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` + # Reject names that are not valid shell variable names. + case $ac_envvar in #( + '' | [0-9]* | *[!_$as_cr_alnum]* ) + as_fn_error $? "invalid variable name: \`$ac_envvar'" ;; + esac + eval $ac_envvar=\$ac_optarg + export $ac_envvar ;; + + *) + # FIXME: should be removed in autoconf 3.0. + $as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2 + expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && + $as_echo "$as_me: WARNING: invalid host type: $ac_option" >&2 + : "${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}" + ;; + + esac +done + +if test -n "$ac_prev"; then + ac_option=--`echo $ac_prev | sed 's/_/-/g'` + as_fn_error $? "missing argument to $ac_option" +fi + +if test -n "$ac_unrecognized_opts"; then + case $enable_option_checking in + no) ;; + fatal) as_fn_error $? "unrecognized options: $ac_unrecognized_opts" ;; + *) $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;; + esac +fi + +# Check all directory arguments for consistency. +for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ + datadir sysconfdir sharedstatedir localstatedir includedir \ + oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ + libdir localedir mandir +do + eval ac_val=\$$ac_var + # Remove trailing slashes. + case $ac_val in + */ ) + ac_val=`expr "X$ac_val" : 'X\(.*[^/]\)' \| "X$ac_val" : 'X\(.*\)'` + eval $ac_var=\$ac_val;; + esac + # Be sure to have absolute directory names. + case $ac_val in + [\\/$]* | ?:[\\/]* ) continue;; + NONE | '' ) case $ac_var in *prefix ) continue;; esac;; + esac + as_fn_error $? "expected an absolute directory name for --$ac_var: $ac_val" +done + +# There might be people who depend on the old broken behavior: `$host' +# used to hold the argument of --host etc. +# FIXME: To remove some day. +build=$build_alias +host=$host_alias +target=$target_alias + +# FIXME: To remove some day. +if test "x$host_alias" != x; then + if test "x$build_alias" = x; then + cross_compiling=maybe + elif test "x$build_alias" != "x$host_alias"; then + cross_compiling=yes + fi +fi + +ac_tool_prefix= +test -n "$host_alias" && ac_tool_prefix=$host_alias- + +test "$silent" = yes && exec 6>/dev/null + + +ac_pwd=`pwd` && test -n "$ac_pwd" && +ac_ls_di=`ls -di .` && +ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` || + as_fn_error $? "working directory cannot be determined" +test "X$ac_ls_di" = "X$ac_pwd_ls_di" || + as_fn_error $? "pwd does not report name of working directory" + + +# Find the source files, if location was not specified. +if test -z "$srcdir"; then + ac_srcdir_defaulted=yes + # Try the directory containing this script, then the parent directory. + ac_confdir=`$as_dirname -- "$as_myself" || +$as_expr X"$as_myself" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_myself" : 'X\(//\)[^/]' \| \ + X"$as_myself" : 'X\(//\)$' \| \ + X"$as_myself" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$as_myself" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + srcdir=$ac_confdir + if test ! -r "$srcdir/$ac_unique_file"; then + srcdir=.. + fi +else + ac_srcdir_defaulted=no +fi +if test ! -r "$srcdir/$ac_unique_file"; then + test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .." + as_fn_error $? "cannot find sources ($ac_unique_file) in $srcdir" +fi +ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work" +ac_abs_confdir=`( + cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error $? "$ac_msg" + pwd)` +# When building in place, set srcdir=. +if test "$ac_abs_confdir" = "$ac_pwd"; then + srcdir=. +fi +# Remove unnecessary trailing slashes from srcdir. +# Double slashes in file names in object file debugging info +# mess up M-x gdb in Emacs. +case $srcdir in +*/) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;; +esac +for ac_var in $ac_precious_vars; do + eval ac_env_${ac_var}_set=\${${ac_var}+set} + eval ac_env_${ac_var}_value=\$${ac_var} + eval ac_cv_env_${ac_var}_set=\${${ac_var}+set} + eval ac_cv_env_${ac_var}_value=\$${ac_var} +done + +# +# Report the --help message. +# +if test "$ac_init_help" = "long"; then + # Omit some internal or obsolete options to make the list less imposing. + # This message is too long to be a string in the A/UX 3.1 sh. + cat <<_ACEOF +\`configure' configures alsa-utils 1.2.4 to adapt to many kinds of systems. + +Usage: $0 [OPTION]... [VAR=VALUE]... + +To assign environment variables (e.g., CC, CFLAGS...), specify them as +VAR=VALUE. See below for descriptions of some of the useful variables. + +Defaults for the options are specified in brackets. + +Configuration: + -h, --help display this help and exit + --help=short display options specific to this package + --help=recursive display the short help of all the included packages + -V, --version display version information and exit + -q, --quiet, --silent do not print \`checking ...' messages + --cache-file=FILE cache test results in FILE [disabled] + -C, --config-cache alias for \`--cache-file=config.cache' + -n, --no-create do not create output files + --srcdir=DIR find the sources in DIR [configure dir or \`..'] + +Installation directories: + --prefix=PREFIX install architecture-independent files in PREFIX + [$ac_default_prefix] + --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX + [PREFIX] + +By default, \`make install' will install all the files in +\`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify +an installation prefix other than \`$ac_default_prefix' using \`--prefix', +for instance \`--prefix=\$HOME'. + +For better control, use the options below. + +Fine tuning of the installation directories: + --bindir=DIR user executables [EPREFIX/bin] + --sbindir=DIR system admin executables [EPREFIX/sbin] + --libexecdir=DIR program executables [EPREFIX/libexec] + --sysconfdir=DIR read-only single-machine data [PREFIX/etc] + --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] + --localstatedir=DIR modifiable single-machine data [PREFIX/var] + --libdir=DIR object code libraries [EPREFIX/lib] + --includedir=DIR C header files [PREFIX/include] + --oldincludedir=DIR C header files for non-gcc [/usr/include] + --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] + --datadir=DIR read-only architecture-independent data [DATAROOTDIR] + --infodir=DIR info documentation [DATAROOTDIR/info] + --localedir=DIR locale-dependent data [DATAROOTDIR/locale] + --mandir=DIR man documentation [DATAROOTDIR/man] + --docdir=DIR documentation root [DATAROOTDIR/doc/alsa-utils] + --htmldir=DIR html documentation [DOCDIR] + --dvidir=DIR dvi documentation [DOCDIR] + --pdfdir=DIR pdf documentation [DOCDIR] + --psdir=DIR ps documentation [DOCDIR] +_ACEOF + + cat <<\_ACEOF + +Program names: + --program-prefix=PREFIX prepend PREFIX to installed program names + --program-suffix=SUFFIX append SUFFIX to installed program names + --program-transform-name=PROGRAM run sed PROGRAM on installed program names + +System types: + --build=BUILD configure for building on BUILD [guessed] + --host=HOST cross-compile to build programs to run on HOST [BUILD] +_ACEOF +fi + +if test -n "$ac_init_help"; then + case $ac_init_help in + short | recursive ) echo "Configuration of alsa-utils 1.2.4:";; + esac + cat <<\_ACEOF + +Optional Features: + --disable-option-checking ignore unrecognized --enable/--with options + --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) + --enable-FEATURE[=ARG] include FEATURE [ARG=yes] + --enable-silent-rules less verbose build output (undo: "make V=1") + --disable-silent-rules verbose build output (undo: "make V=0") + --disable-maintainer-mode + disable make rules and dependencies not useful (and + sometimes confusing) to the casual installer + --disable-nls do not use Native Language Support + --enable-dependency-tracking + do not reject slow dependency extractors + --disable-dependency-tracking + speeds up one-time build + --disable-rpath do not hardcode runtime library paths + --enable-alsatopology Force to use the Alsa topology library + --disable-alsatest Do not try to compile and run a test Alsa program + --enable-alsabat-backend-tiny + Use tinyalsa for alsabat backend + --disable-bat Disable bat compilation + --disable-alsamixer Disable alsamixer compilation + --disable-alsaconf Disable alsaconf packaging + --disable-alsaloop Disable alsaloop packaging + --disable-xmlto Disable man page creation via xmlto + --disable-rst2man Disable man page creation via rst2man + --disable-largefile omit support for large files + +Optional Packages: + --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] + --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) + --with-gnu-ld assume the C compiler uses GNU ld [default=no] + --with-libiconv-prefix[=DIR] search for libiconv in DIR/include and DIR/lib + --without-libiconv-prefix don't search for libiconv in includedir and libdir + --with-libintl-prefix[=DIR] search for libintl in DIR/include and DIR/lib + --without-libintl-prefix don't search for libintl in includedir and libdir + --with-alsa-prefix=PFX Prefix where Alsa library is installed(optional) + --with-alsa-inc-prefix=PFX + Prefix where include libraries are (optional) + --with-librt Use librt for monotonic clock (default = yes) + --with-udev-rules-dir=DIR + Directory where to install udev rules to + (default=auto) + --with-curses=libname Specify the curses library to use (default=auto) + --with-testsound=file give the path of test sound file for alsaconf + --with-systemdsystemunitdir=DIR + Directory for systemd service files + --with-asound-state-dir=DIR + Directory to place asound.state file in + --with-alsactl-lock-dir=DIR + Directory to place lock files in + --with-alsactl-pidfile-dir=DIR + Directory to place alsactl.pid file in + --with-alsactl-daemonswitch=FILE + File to test for the daemon mode + +Some influential environment variables: + CC C compiler command + CFLAGS C compiler flags + LDFLAGS linker flags, e.g. -L if you have libraries in a + nonstandard directory + LIBS libraries to pass to the linker, e.g. -l + CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I if + you have headers in a nonstandard directory + CPP C preprocessor + PKG_CONFIG path to pkg-config utility + PKG_CONFIG_PATH + directories to add to pkg-config's search path + PKG_CONFIG_LIBDIR + path overriding pkg-config's built-in search path + NCURSESW_CFLAGS + C compiler flags for NCURSESW, overriding pkg-config + NCURSESW_LIBS + linker flags for NCURSESW, overriding pkg-config + NCURSES_CFLAGS + C compiler flags for NCURSES, overriding pkg-config + NCURSES_LIBS + linker flags for NCURSES, overriding pkg-config + SYSTEMD_CFLAGS + C compiler flags for SYSTEMD, overriding pkg-config + SYSTEMD_LIBS + linker flags for SYSTEMD, overriding pkg-config + +Use these variables to override the choices made by `configure' or to help +it to find libraries and programs with nonstandard names/locations. + +Report bugs to the package provider. +_ACEOF +ac_status=$? +fi + +if test "$ac_init_help" = "recursive"; then + # If there are subdirs, report their specific --help. + for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue + test -d "$ac_dir" || + { cd "$srcdir" && ac_pwd=`pwd` && srcdir=. && test -d "$ac_dir"; } || + continue + ac_builddir=. + +case "$ac_dir" in +.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; +*) + ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` + # A ".." for each directory in $ac_dir_suffix. + ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` + case $ac_top_builddir_sub in + "") ac_top_builddir_sub=. ac_top_build_prefix= ;; + *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; + esac ;; +esac +ac_abs_top_builddir=$ac_pwd +ac_abs_builddir=$ac_pwd$ac_dir_suffix +# for backward compatibility: +ac_top_builddir=$ac_top_build_prefix + +case $srcdir in + .) # We are building in place. + ac_srcdir=. + ac_top_srcdir=$ac_top_builddir_sub + ac_abs_top_srcdir=$ac_pwd ;; + [\\/]* | ?:[\\/]* ) # Absolute name. + ac_srcdir=$srcdir$ac_dir_suffix; + ac_top_srcdir=$srcdir + ac_abs_top_srcdir=$srcdir ;; + *) # Relative name. + ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_top_build_prefix$srcdir + ac_abs_top_srcdir=$ac_pwd/$srcdir ;; +esac +ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix + + cd "$ac_dir" || { ac_status=$?; continue; } + # Check for guested configure. + if test -f "$ac_srcdir/configure.gnu"; then + echo && + $SHELL "$ac_srcdir/configure.gnu" --help=recursive + elif test -f "$ac_srcdir/configure"; then + echo && + $SHELL "$ac_srcdir/configure" --help=recursive + else + $as_echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 + fi || ac_status=$? + cd "$ac_pwd" || { ac_status=$?; break; } + done +fi + +test -n "$ac_init_help" && exit $ac_status +if $ac_init_version; then + cat <<\_ACEOF +alsa-utils configure 1.2.4 +generated by GNU Autoconf 2.69 + +Copyright (C) 2012 Free Software Foundation, Inc. +This configure script is free software; the Free Software Foundation +gives unlimited permission to copy, distribute and modify it. +_ACEOF + exit +fi + +## ------------------------ ## +## Autoconf initialization. ## +## ------------------------ ## + +# ac_fn_c_try_compile LINENO +# -------------------------- +# Try to compile conftest.$ac_ext, and return whether this succeeded. +ac_fn_c_try_compile () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + rm -f conftest.$ac_objext + if { { ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_compile") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + grep -v '^ *+' conftest.err >conftest.er1 + cat conftest.er1 >&5 + mv -f conftest.er1 conftest.err + fi + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then : + ac_retval=0 +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=1 +fi + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + as_fn_set_status $ac_retval + +} # ac_fn_c_try_compile + +# ac_fn_c_try_cpp LINENO +# ---------------------- +# Try to preprocess conftest.$ac_ext, and return whether this succeeded. +ac_fn_c_try_cpp () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + if { { ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + grep -v '^ *+' conftest.err >conftest.er1 + cat conftest.er1 >&5 + mv -f conftest.er1 conftest.err + fi + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } > conftest.i && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then : + ac_retval=0 +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=1 +fi + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + as_fn_set_status $ac_retval + +} # ac_fn_c_try_cpp + +# ac_fn_c_try_link LINENO +# ----------------------- +# Try to link conftest.$ac_ext, and return whether this succeeded. +ac_fn_c_try_link () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + rm -f conftest.$ac_objext conftest$ac_exeext + if { { ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_link") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + grep -v '^ *+' conftest.err >conftest.er1 + cat conftest.er1 >&5 + mv -f conftest.er1 conftest.err + fi + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && { + test "$cross_compiling" = yes || + test -x conftest$ac_exeext + }; then : + ac_retval=0 +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=1 +fi + # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information + # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would + # interfere with the next link command; also delete a directory that is + # left behind by Apple's compiler. We do this before executing the actions. + rm -rf conftest.dSYM conftest_ipa8_conftest.oo + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + as_fn_set_status $ac_retval + +} # ac_fn_c_try_link + +# ac_fn_c_try_run LINENO +# ---------------------- +# Try to link conftest.$ac_ext, and return whether this succeeded. Assumes +# that executables *can* be run. +ac_fn_c_try_run () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + if { { ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && { ac_try='./conftest$ac_exeext' + { { case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; }; then : + ac_retval=0 +else + $as_echo "$as_me: program exited with status $ac_status" >&5 + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=$ac_status +fi + rm -rf conftest.dSYM conftest_ipa8_conftest.oo + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + as_fn_set_status $ac_retval + +} # ac_fn_c_try_run + +# ac_fn_c_check_func LINENO FUNC VAR +# ---------------------------------- +# Tests whether FUNC exists, setting the cache variable VAR accordingly +ac_fn_c_check_func () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 +$as_echo_n "checking for $2... " >&6; } +if eval \${$3+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +/* Define $2 to an innocuous variant, in case declares $2. + For example, HP-UX 11i declares gettimeofday. */ +#define $2 innocuous_$2 + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $2 (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#endif + +#undef $2 + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char $2 (); +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined __stub_$2 || defined __stub___$2 +choke me +#endif + +int +main () +{ +return $2 (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + eval "$3=yes" +else + eval "$3=no" +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +eval ac_res=\$$3 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + +} # ac_fn_c_check_func + +# ac_fn_c_check_header_compile LINENO HEADER VAR INCLUDES +# ------------------------------------------------------- +# Tests whether HEADER exists and can be compiled using the include files in +# INCLUDES, setting the cache variable VAR accordingly. +ac_fn_c_check_header_compile () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 +$as_echo_n "checking for $2... " >&6; } +if eval \${$3+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +#include <$2> +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + eval "$3=yes" +else + eval "$3=no" +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +eval ac_res=\$$3 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + +} # ac_fn_c_check_header_compile + +# ac_fn_c_check_header_mongrel LINENO HEADER VAR INCLUDES +# ------------------------------------------------------- +# Tests whether HEADER exists, giving a warning if it cannot be compiled using +# the include files in INCLUDES and setting the cache variable VAR +# accordingly. +ac_fn_c_check_header_mongrel () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + if eval \${$3+:} false; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 +$as_echo_n "checking for $2... " >&6; } +if eval \${$3+:} false; then : + $as_echo_n "(cached) " >&6 +fi +eval ac_res=\$$3 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } +else + # Is the header compilable? +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 usability" >&5 +$as_echo_n "checking $2 usability... " >&6; } +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +#include <$2> +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_header_compiler=yes +else + ac_header_compiler=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_compiler" >&5 +$as_echo "$ac_header_compiler" >&6; } + +# Is the header present? +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 presence" >&5 +$as_echo_n "checking $2 presence... " >&6; } +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include <$2> +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + ac_header_preproc=yes +else + ac_header_preproc=no +fi +rm -f conftest.err conftest.i conftest.$ac_ext +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_preproc" >&5 +$as_echo "$ac_header_preproc" >&6; } + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in #(( + yes:no: ) + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&5 +$as_echo "$as_me: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 +$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} + ;; + no:yes:* ) + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: present but cannot be compiled" >&5 +$as_echo "$as_me: WARNING: $2: present but cannot be compiled" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: check for missing prerequisite headers?" >&5 +$as_echo "$as_me: WARNING: $2: check for missing prerequisite headers?" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: see the Autoconf documentation" >&5 +$as_echo "$as_me: WARNING: $2: see the Autoconf documentation" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&5 +$as_echo "$as_me: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 +$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} + ;; +esac + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 +$as_echo_n "checking for $2... " >&6; } +if eval \${$3+:} false; then : + $as_echo_n "(cached) " >&6 +else + eval "$3=\$ac_header_compiler" +fi +eval ac_res=\$$3 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } +fi + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + +} # ac_fn_c_check_header_mongrel +cat >config.log <<_ACEOF +This file contains any messages produced by compilers while +running configure, to aid debugging if configure makes a mistake. + +It was created by alsa-utils $as_me 1.2.4, which was +generated by GNU Autoconf 2.69. Invocation command line was + + $ $0 $@ + +_ACEOF +exec 5>>config.log +{ +cat <<_ASUNAME +## --------- ## +## Platform. ## +## --------- ## + +hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` +uname -m = `(uname -m) 2>/dev/null || echo unknown` +uname -r = `(uname -r) 2>/dev/null || echo unknown` +uname -s = `(uname -s) 2>/dev/null || echo unknown` +uname -v = `(uname -v) 2>/dev/null || echo unknown` + +/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` +/bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` + +/bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` +/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` +/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` +/usr/bin/hostinfo = `(/usr/bin/hostinfo) 2>/dev/null || echo unknown` +/bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` +/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` +/bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` + +_ASUNAME + +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + $as_echo "PATH: $as_dir" + done +IFS=$as_save_IFS + +} >&5 + +cat >&5 <<_ACEOF + + +## ----------- ## +## Core tests. ## +## ----------- ## + +_ACEOF + + +# Keep a trace of the command line. +# Strip out --no-create and --no-recursion so they do not pile up. +# Strip out --silent because we don't want to record it for future runs. +# Also quote any args containing shell meta-characters. +# Make two passes to allow for proper duplicate-argument suppression. +ac_configure_args= +ac_configure_args0= +ac_configure_args1= +ac_must_keep_next=false +for ac_pass in 1 2 +do + for ac_arg + do + case $ac_arg in + -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil) + continue ;; + *\'*) + ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; + esac + case $ac_pass in + 1) as_fn_append ac_configure_args0 " '$ac_arg'" ;; + 2) + as_fn_append ac_configure_args1 " '$ac_arg'" + if test $ac_must_keep_next = true; then + ac_must_keep_next=false # Got value, back to normal. + else + case $ac_arg in + *=* | --config-cache | -C | -disable-* | --disable-* \ + | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ + | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ + | -with-* | --with-* | -without-* | --without-* | --x) + case "$ac_configure_args0 " in + "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; + esac + ;; + -* ) ac_must_keep_next=true ;; + esac + fi + as_fn_append ac_configure_args " '$ac_arg'" + ;; + esac + done +done +{ ac_configure_args0=; unset ac_configure_args0;} +{ ac_configure_args1=; unset ac_configure_args1;} + +# When interrupted or exit'd, cleanup temporary files, and complete +# config.log. We remove comments because anyway the quotes in there +# would cause problems or look ugly. +# WARNING: Use '\'' to represent an apostrophe within the trap. +# WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug. +trap 'exit_status=$? + # Save into config.log some information that might help in debugging. + { + echo + + $as_echo "## ---------------- ## +## Cache variables. ## +## ---------------- ##" + echo + # The following way of writing the cache mishandles newlines in values, +( + for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do + eval ac_val=\$$ac_var + case $ac_val in #( + *${as_nl}*) + case $ac_var in #( + *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 +$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; + esac + case $ac_var in #( + _ | IFS | as_nl) ;; #( + BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( + *) { eval $ac_var=; unset $ac_var;} ;; + esac ;; + esac + done + (set) 2>&1 | + case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #( + *${as_nl}ac_space=\ *) + sed -n \ + "s/'\''/'\''\\\\'\'''\''/g; + s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p" + ;; #( + *) + sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" + ;; + esac | + sort +) + echo + + $as_echo "## ----------------- ## +## Output variables. ## +## ----------------- ##" + echo + for ac_var in $ac_subst_vars + do + eval ac_val=\$$ac_var + case $ac_val in + *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; + esac + $as_echo "$ac_var='\''$ac_val'\''" + done | sort + echo + + if test -n "$ac_subst_files"; then + $as_echo "## ------------------- ## +## File substitutions. ## +## ------------------- ##" + echo + for ac_var in $ac_subst_files + do + eval ac_val=\$$ac_var + case $ac_val in + *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; + esac + $as_echo "$ac_var='\''$ac_val'\''" + done | sort + echo + fi + + if test -s confdefs.h; then + $as_echo "## ----------- ## +## confdefs.h. ## +## ----------- ##" + echo + cat confdefs.h + echo + fi + test "$ac_signal" != 0 && + $as_echo "$as_me: caught signal $ac_signal" + $as_echo "$as_me: exit $exit_status" + } >&5 + rm -f core *.core core.conftest.* && + rm -f -r conftest* confdefs* conf$$* $ac_clean_files && + exit $exit_status +' 0 +for ac_signal in 1 2 13 15; do + trap 'ac_signal='$ac_signal'; as_fn_exit 1' $ac_signal +done +ac_signal=0 + +# confdefs.h avoids OS command line length limits that DEFS can exceed. +rm -f -r conftest* confdefs.h + +$as_echo "/* confdefs.h */" > confdefs.h + +# Predefined preprocessor variables. + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_NAME "$PACKAGE_NAME" +_ACEOF + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_TARNAME "$PACKAGE_TARNAME" +_ACEOF + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_VERSION "$PACKAGE_VERSION" +_ACEOF + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_STRING "$PACKAGE_STRING" +_ACEOF + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" +_ACEOF + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_URL "$PACKAGE_URL" +_ACEOF + + +# Let the site file select an alternate cache file if it wants to. +# Prefer an explicitly selected file to automatically selected ones. +ac_site_file1=NONE +ac_site_file2=NONE +if test -n "$CONFIG_SITE"; then + # We do not want a PATH search for config.site. + case $CONFIG_SITE in #(( + -*) ac_site_file1=./$CONFIG_SITE;; + */*) ac_site_file1=$CONFIG_SITE;; + *) ac_site_file1=./$CONFIG_SITE;; + esac +elif test "x$prefix" != xNONE; then + ac_site_file1=$prefix/share/config.site + ac_site_file2=$prefix/etc/config.site +else + ac_site_file1=$ac_default_prefix/share/config.site + ac_site_file2=$ac_default_prefix/etc/config.site +fi +for ac_site_file in "$ac_site_file1" "$ac_site_file2" +do + test "x$ac_site_file" = xNONE && continue + if test /dev/null != "$ac_site_file" && test -r "$ac_site_file"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5 +$as_echo "$as_me: loading site script $ac_site_file" >&6;} + sed 's/^/| /' "$ac_site_file" >&5 + . "$ac_site_file" \ + || { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "failed to load site script $ac_site_file +See \`config.log' for more details" "$LINENO" 5; } + fi +done + +if test -r "$cache_file"; then + # Some versions of bash will fail to source /dev/null (special files + # actually), so we avoid doing that. DJGPP emulates it as a regular file. + if test /dev/null != "$cache_file" && test -f "$cache_file"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5 +$as_echo "$as_me: loading cache $cache_file" >&6;} + case $cache_file in + [\\/]* | ?:[\\/]* ) . "$cache_file";; + *) . "./$cache_file";; + esac + fi +else + { $as_echo "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5 +$as_echo "$as_me: creating cache $cache_file" >&6;} + >$cache_file +fi + +gt_needs="$gt_needs " +# Check that the precious variables saved in the cache have kept the same +# value. +ac_cache_corrupted=false +for ac_var in $ac_precious_vars; do + eval ac_old_set=\$ac_cv_env_${ac_var}_set + eval ac_new_set=\$ac_env_${ac_var}_set + eval ac_old_val=\$ac_cv_env_${ac_var}_value + eval ac_new_val=\$ac_env_${ac_var}_value + case $ac_old_set,$ac_new_set in + set,) + { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 +$as_echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} + ac_cache_corrupted=: ;; + ,set) + { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was not set in the previous run" >&5 +$as_echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} + ac_cache_corrupted=: ;; + ,);; + *) + if test "x$ac_old_val" != "x$ac_new_val"; then + # differences in whitespace do not lead to failure. + ac_old_val_w=`echo x $ac_old_val` + ac_new_val_w=`echo x $ac_new_val` + if test "$ac_old_val_w" != "$ac_new_val_w"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' has changed since the previous run:" >&5 +$as_echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} + ac_cache_corrupted=: + else + { $as_echo "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5 +$as_echo "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;} + eval $ac_var=\$ac_old_val + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: former value: \`$ac_old_val'" >&5 +$as_echo "$as_me: former value: \`$ac_old_val'" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: current value: \`$ac_new_val'" >&5 +$as_echo "$as_me: current value: \`$ac_new_val'" >&2;} + fi;; + esac + # Pass precious variables to config.status. + if test "$ac_new_set" = set; then + case $ac_new_val in + *\'*) ac_arg=$ac_var=`$as_echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; + *) ac_arg=$ac_var=$ac_new_val ;; + esac + case " $ac_configure_args " in + *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. + *) as_fn_append ac_configure_args " '$ac_arg'" ;; + esac + fi +done +if $ac_cache_corrupted; then + { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5 +$as_echo "$as_me: error: changes in the environment can compromise the build" >&2;} + as_fn_error $? "run \`make distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5 +fi +## -------------------- ## +## Main body of script. ## +## -------------------- ## + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + + + +am__api_version='1.16' + +ac_aux_dir= +for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do + if test -f "$ac_dir/install-sh"; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install-sh -c" + break + elif test -f "$ac_dir/install.sh"; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install.sh -c" + break + elif test -f "$ac_dir/shtool"; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/shtool install -c" + break + fi +done +if test -z "$ac_aux_dir"; then + as_fn_error $? "cannot find install-sh, install.sh, or shtool in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" "$LINENO" 5 +fi + +# These three variables are undocumented and unsupported, +# and are intended to be withdrawn in a future Autoconf release. +# They can cause serious problems if a builder's source tree is in a directory +# whose full name contains unusual characters. +ac_config_guess="$SHELL $ac_aux_dir/config.guess" # Please don't use this var. +ac_config_sub="$SHELL $ac_aux_dir/config.sub" # Please don't use this var. +ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var. + + +# Find a good install program. We prefer a C program (faster), +# so one script is as good as another. But avoid the broken or +# incompatible versions: +# SysV /etc/install, /usr/sbin/install +# SunOS /usr/etc/install +# IRIX /sbin/install +# AIX /bin/install +# AmigaOS /C/install, which installs bootblocks on floppy discs +# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag +# AFS /usr/afsws/bin/install, which mishandles nonexistent args +# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" +# OS/2's system install, which has a completely different semantic +# ./install, which can be erroneously created by make from ./install.sh. +# Reject install programs that cannot install multiple files. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a BSD-compatible install" >&5 +$as_echo_n "checking for a BSD-compatible install... " >&6; } +if test -z "$INSTALL"; then +if ${ac_cv_path_install+:} false; then : + $as_echo_n "(cached) " >&6 +else + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + # Account for people who put trailing slashes in PATH elements. +case $as_dir/ in #(( + ./ | .// | /[cC]/* | \ + /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ + ?:[\\/]os2[\\/]install[\\/]* | ?:[\\/]OS2[\\/]INSTALL[\\/]* | \ + /usr/ucb/* ) ;; + *) + # OSF1 and SCO ODT 3.0 have their own names for install. + # Don't use installbsd from OSF since it installs stuff as root + # by default. + for ac_prog in ginstall scoinst install; do + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then + if test $ac_prog = install && + grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then + # AIX install. It has an incompatible calling convention. + : + elif test $ac_prog = install && + grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then + # program-specific install script used by HP pwplus--don't use. + : + else + rm -rf conftest.one conftest.two conftest.dir + echo one > conftest.one + echo two > conftest.two + mkdir conftest.dir + if "$as_dir/$ac_prog$ac_exec_ext" -c conftest.one conftest.two "`pwd`/conftest.dir" && + test -s conftest.one && test -s conftest.two && + test -s conftest.dir/conftest.one && + test -s conftest.dir/conftest.two + then + ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" + break 3 + fi + fi + fi + done + done + ;; +esac + + done +IFS=$as_save_IFS + +rm -rf conftest.one conftest.two conftest.dir + +fi + if test "${ac_cv_path_install+set}" = set; then + INSTALL=$ac_cv_path_install + else + # As a last resort, use the slow shell script. Don't cache a + # value for INSTALL within a source directory, because that will + # break other packages using the cache if that directory is + # removed, or if the value is a relative name. + INSTALL=$ac_install_sh + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $INSTALL" >&5 +$as_echo "$INSTALL" >&6; } + +# Use test -z because SunOS4 sh mishandles braces in ${var-val}. +# It thinks the first close brace ends the variable substitution. +test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' + +test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' + +test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether build environment is sane" >&5 +$as_echo_n "checking whether build environment is sane... " >&6; } +# Reject unsafe characters in $srcdir or the absolute working directory +# name. Accept space and tab only in the latter. +am_lf=' +' +case `pwd` in + *[\\\"\#\$\&\'\`$am_lf]*) + as_fn_error $? "unsafe absolute working directory name" "$LINENO" 5;; +esac +case $srcdir in + *[\\\"\#\$\&\'\`$am_lf\ \ ]*) + as_fn_error $? "unsafe srcdir value: '$srcdir'" "$LINENO" 5;; +esac + +# Do 'set' in a subshell so we don't clobber the current shell's +# arguments. Must try -L first in case configure is actually a +# symlink; some systems play weird games with the mod time of symlinks +# (eg FreeBSD returns the mod time of the symlink's containing +# directory). +if ( + am_has_slept=no + for am_try in 1 2; do + echo "timestamp, slept: $am_has_slept" > conftest.file + set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null` + if test "$*" = "X"; then + # -L didn't work. + set X `ls -t "$srcdir/configure" conftest.file` + fi + if test "$*" != "X $srcdir/configure conftest.file" \ + && test "$*" != "X conftest.file $srcdir/configure"; then + + # If neither matched, then we have a broken ls. This can happen + # if, for instance, CONFIG_SHELL is bash and it inherits a + # broken ls alias from the environment. This has actually + # happened. Such a system could not be considered "sane". + as_fn_error $? "ls -t appears to fail. Make sure there is not a broken + alias in your environment" "$LINENO" 5 + fi + if test "$2" = conftest.file || test $am_try -eq 2; then + break + fi + # Just in case. + sleep 1 + am_has_slept=yes + done + test "$2" = conftest.file + ) +then + # Ok. + : +else + as_fn_error $? "newly created file is older than distributed files! +Check your system clock" "$LINENO" 5 +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } +# If we didn't sleep, we still need to ensure time stamps of config.status and +# generated files are strictly newer. +am_sleep_pid= +if grep 'slept: no' conftest.file >/dev/null 2>&1; then + ( sleep 1 ) & + am_sleep_pid=$! +fi + +rm -f conftest.file + +test "$program_prefix" != NONE && + program_transform_name="s&^&$program_prefix&;$program_transform_name" +# Use a double $ so make ignores it. +test "$program_suffix" != NONE && + program_transform_name="s&\$&$program_suffix&;$program_transform_name" +# Double any \ or $. +# By default was `s,x,x', remove it if useless. +ac_script='s/[\\$]/&&/g;s/;s,x,x,$//' +program_transform_name=`$as_echo "$program_transform_name" | sed "$ac_script"` + +# Expand $ac_aux_dir to an absolute path. +am_aux_dir=`cd "$ac_aux_dir" && pwd` + +if test x"${MISSING+set}" != xset; then + case $am_aux_dir in + *\ * | *\ *) + MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;; + *) + MISSING="\${SHELL} $am_aux_dir/missing" ;; + esac +fi +# Use eval to expand $SHELL +if eval "$MISSING --is-lightweight"; then + am_missing_run="$MISSING " +else + am_missing_run= + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: 'missing' script is too old or missing" >&5 +$as_echo "$as_me: WARNING: 'missing' script is too old or missing" >&2;} +fi + +if test x"${install_sh+set}" != xset; then + case $am_aux_dir in + *\ * | *\ *) + install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;; + *) + install_sh="\${SHELL} $am_aux_dir/install-sh" + esac +fi + +# Installed binaries are usually stripped using 'strip' when the user +# run "make install-strip". However 'strip' might not be the right +# tool to use in cross-compilation environments, therefore Automake +# will honor the 'STRIP' environment variable to overrule this program. +if test "$cross_compiling" != no; then + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. +set dummy ${ac_tool_prefix}strip; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_STRIP+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$STRIP"; then + ac_cv_prog_STRIP="$STRIP" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_STRIP="${ac_tool_prefix}strip" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +STRIP=$ac_cv_prog_STRIP +if test -n "$STRIP"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5 +$as_echo "$STRIP" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_STRIP"; then + ac_ct_STRIP=$STRIP + # Extract the first word of "strip", so it can be a program name with args. +set dummy strip; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_STRIP+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_STRIP"; then + ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_STRIP="strip" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP +if test -n "$ac_ct_STRIP"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5 +$as_echo "$ac_ct_STRIP" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_STRIP" = x; then + STRIP=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + STRIP=$ac_ct_STRIP + fi +else + STRIP="$ac_cv_prog_STRIP" +fi + +fi +INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a thread-safe mkdir -p" >&5 +$as_echo_n "checking for a thread-safe mkdir -p... " >&6; } +if test -z "$MKDIR_P"; then + if ${ac_cv_path_mkdir+:} false; then : + $as_echo_n "(cached) " >&6 +else + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH$PATH_SEPARATOR/opt/sfw/bin +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_prog in mkdir gmkdir; do + for ac_exec_ext in '' $ac_executable_extensions; do + as_fn_executable_p "$as_dir/$ac_prog$ac_exec_ext" || continue + case `"$as_dir/$ac_prog$ac_exec_ext" --version 2>&1` in #( + 'mkdir (GNU coreutils) '* | \ + 'mkdir (coreutils) '* | \ + 'mkdir (fileutils) '4.1*) + ac_cv_path_mkdir=$as_dir/$ac_prog$ac_exec_ext + break 3;; + esac + done + done + done +IFS=$as_save_IFS + +fi + + test -d ./--version && rmdir ./--version + if test "${ac_cv_path_mkdir+set}" = set; then + MKDIR_P="$ac_cv_path_mkdir -p" + else + # As a last resort, use the slow shell script. Don't cache a + # value for MKDIR_P within a source directory, because that will + # break other packages using the cache if that directory is + # removed, or if the value is a relative name. + MKDIR_P="$ac_install_sh -d" + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $MKDIR_P" >&5 +$as_echo "$MKDIR_P" >&6; } + +for ac_prog in gawk mawk nawk awk +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_AWK+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$AWK"; then + ac_cv_prog_AWK="$AWK" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_AWK="$ac_prog" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +AWK=$ac_cv_prog_AWK +if test -n "$AWK"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AWK" >&5 +$as_echo "$AWK" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$AWK" && break +done + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} sets \$(MAKE)" >&5 +$as_echo_n "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; } +set x ${MAKE-make} +ac_make=`$as_echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'` +if eval \${ac_cv_prog_make_${ac_make}_set+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat >conftest.make <<\_ACEOF +SHELL = /bin/sh +all: + @echo '@@@%%%=$(MAKE)=@@@%%%' +_ACEOF +# GNU make sometimes prints "make[1]: Entering ...", which would confuse us. +case `${MAKE-make} -f conftest.make 2>/dev/null` in + *@@@%%%=?*=@@@%%%*) + eval ac_cv_prog_make_${ac_make}_set=yes;; + *) + eval ac_cv_prog_make_${ac_make}_set=no;; +esac +rm -f conftest.make +fi +if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + SET_MAKE= +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + SET_MAKE="MAKE=${MAKE-make}" +fi + +rm -rf .tst 2>/dev/null +mkdir .tst 2>/dev/null +if test -d .tst; then + am__leading_dot=. +else + am__leading_dot=_ +fi +rmdir .tst 2>/dev/null + +# Check whether --enable-silent-rules was given. +if test "${enable_silent_rules+set}" = set; then : + enableval=$enable_silent_rules; +fi + +case $enable_silent_rules in # ((( + yes) AM_DEFAULT_VERBOSITY=0;; + no) AM_DEFAULT_VERBOSITY=1;; + *) AM_DEFAULT_VERBOSITY=1;; +esac +am_make=${MAKE-make} +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $am_make supports nested variables" >&5 +$as_echo_n "checking whether $am_make supports nested variables... " >&6; } +if ${am_cv_make_support_nested_variables+:} false; then : + $as_echo_n "(cached) " >&6 +else + if $as_echo 'TRUE=$(BAR$(V)) +BAR0=false +BAR1=true +V=1 +am__doit: + @$(TRUE) +.PHONY: am__doit' | $am_make -f - >/dev/null 2>&1; then + am_cv_make_support_nested_variables=yes +else + am_cv_make_support_nested_variables=no +fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_make_support_nested_variables" >&5 +$as_echo "$am_cv_make_support_nested_variables" >&6; } +if test $am_cv_make_support_nested_variables = yes; then + AM_V='$(V)' + AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)' +else + AM_V=$AM_DEFAULT_VERBOSITY + AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY +fi +AM_BACKSLASH='\' + +if test "`cd $srcdir && pwd`" != "`pwd`"; then + # Use -I$(srcdir) only when $(srcdir) != ., so that make's output + # is not polluted with repeated "-I." + am__isrc=' -I$(srcdir)' + # test to see if srcdir already configured + if test -f $srcdir/config.status; then + as_fn_error $? "source directory already configured; run \"make distclean\" there first" "$LINENO" 5 + fi +fi + +# test whether we have cygpath +if test -z "$CYGPATH_W"; then + if (cygpath --version) >/dev/null 2>/dev/null; then + CYGPATH_W='cygpath -w' + else + CYGPATH_W=echo + fi +fi + + +# Define the identity of the package. + PACKAGE='alsa-utils' + VERSION='1.2.4' + + +cat >>confdefs.h <<_ACEOF +#define PACKAGE "$PACKAGE" +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define VERSION "$VERSION" +_ACEOF + +# Some tools Automake needs. + +ACLOCAL=${ACLOCAL-"${am_missing_run}aclocal-${am__api_version}"} + + +AUTOCONF=${AUTOCONF-"${am_missing_run}autoconf"} + + +AUTOMAKE=${AUTOMAKE-"${am_missing_run}automake-${am__api_version}"} + + +AUTOHEADER=${AUTOHEADER-"${am_missing_run}autoheader"} + + +MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"} + +# For better backward compatibility. To be removed once Automake 1.9.x +# dies out for good. For more background, see: +# +# +mkdir_p='$(MKDIR_P)' + +# We need awk for the "check" target (and possibly the TAP driver). The +# system "awk" is bad on some platforms. +# Always define AMTAR for backward compatibility. Yes, it's still used +# in the wild :-( We should find a proper way to deprecate it ... +AMTAR='$${TAR-tar}' + + +# We'll loop over all known methods to create a tar archive until one works. +_am_tools='gnutar pax cpio none' + +am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -' + + + + + + +# POSIX will say in a future version that running "rm -f" with no argument +# is OK; and we want to be able to make that assumption in our Makefile +# recipes. So use an aggressive probe to check that the usage we want is +# actually supported "in the wild" to an acceptable degree. +# See automake bug#10828. +# To make any issue more visible, cause the running configure to be aborted +# by default if the 'rm' program in use doesn't match our expectations; the +# user can still override this though. +if rm -f && rm -fr && rm -rf; then : OK; else + cat >&2 <<'END' +Oops! + +Your 'rm' program seems unable to run without file operands specified +on the command line, even when the '-f' option is present. This is contrary +to the behaviour of most rm programs out there, and not conforming with +the upcoming POSIX standard: + +Please tell bug-automake@gnu.org about your system, including the value +of your $PATH and any error possibly output before this message. This +can help us improve future automake versions. + +END + if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then + echo 'Configuration will proceed anyway, since you have set the' >&2 + echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2 + echo >&2 + else + cat >&2 <<'END' +Aborting the configuration process, to ensure you take notice of the issue. + +You can download and install GNU coreutils to get an 'rm' implementation +that behaves properly: . + +If you want to complete the configuration process using your problematic +'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM +to "yes", and re-run configure. + +END + as_fn_error $? "Your 'rm' program is bad, sorry." "$LINENO" 5 + fi +fi + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to enable maintainer-specific portions of Makefiles" >&5 +$as_echo_n "checking whether to enable maintainer-specific portions of Makefiles... " >&6; } + # Check whether --enable-maintainer-mode was given. +if test "${enable_maintainer_mode+set}" = set; then : + enableval=$enable_maintainer_mode; USE_MAINTAINER_MODE=$enableval +else + USE_MAINTAINER_MODE=yes +fi + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $USE_MAINTAINER_MODE" >&5 +$as_echo "$USE_MAINTAINER_MODE" >&6; } + if test $USE_MAINTAINER_MODE = yes; then + MAINTAINER_MODE_TRUE= + MAINTAINER_MODE_FALSE='#' +else + MAINTAINER_MODE_TRUE='#' + MAINTAINER_MODE_FALSE= +fi + + MAINT=$MAINTAINER_MODE_TRUE + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a sed that does not truncate output" >&5 +$as_echo_n "checking for a sed that does not truncate output... " >&6; } +if ${ac_cv_path_SED+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_script=s/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb/ + for ac_i in 1 2 3 4 5 6 7; do + ac_script="$ac_script$as_nl$ac_script" + done + echo "$ac_script" 2>/dev/null | sed 99q >conftest.sed + { ac_script=; unset ac_script;} + if test -z "$SED"; then + ac_path_SED_found=false + # Loop through the user's path and test for each of PROGNAME-LIST + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_prog in sed gsed; do + for ac_exec_ext in '' $ac_executable_extensions; do + ac_path_SED="$as_dir/$ac_prog$ac_exec_ext" + as_fn_executable_p "$ac_path_SED" || continue +# Check for GNU ac_path_SED and select it if it is found. + # Check for GNU $ac_path_SED +case `"$ac_path_SED" --version 2>&1` in +*GNU*) + ac_cv_path_SED="$ac_path_SED" ac_path_SED_found=:;; +*) + ac_count=0 + $as_echo_n 0123456789 >"conftest.in" + while : + do + cat "conftest.in" "conftest.in" >"conftest.tmp" + mv "conftest.tmp" "conftest.in" + cp "conftest.in" "conftest.nl" + $as_echo '' >> "conftest.nl" + "$ac_path_SED" -f conftest.sed < "conftest.nl" >"conftest.out" 2>/dev/null || break + diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break + as_fn_arith $ac_count + 1 && ac_count=$as_val + if test $ac_count -gt ${ac_path_SED_max-0}; then + # Best one so far, save it but keep looking for a better one + ac_cv_path_SED="$ac_path_SED" + ac_path_SED_max=$ac_count + fi + # 10*(2^10) chars as input seems more than enough + test $ac_count -gt 10 && break + done + rm -f conftest.in conftest.tmp conftest.nl conftest.out;; +esac + + $ac_path_SED_found && break 3 + done + done + done +IFS=$as_save_IFS + if test -z "$ac_cv_path_SED"; then + as_fn_error $? "no acceptable sed could be found in \$PATH" "$LINENO" 5 + fi +else + ac_cv_path_SED=$SED +fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_SED" >&5 +$as_echo "$ac_cv_path_SED" >&6; } + SED="$ac_cv_path_SED" + rm -f conftest.sed + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether NLS is requested" >&5 +$as_echo_n "checking whether NLS is requested... " >&6; } + # Check whether --enable-nls was given. +if test "${enable_nls+set}" = set; then : + enableval=$enable_nls; USE_NLS=$enableval +else + USE_NLS=yes +fi + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $USE_NLS" >&5 +$as_echo "$USE_NLS" >&6; } + + + + + GETTEXT_MACRO_VERSION=0.19 + + + + +# Prepare PATH_SEPARATOR. +# The user is always right. +if test "${PATH_SEPARATOR+set}" != set; then + # Determine PATH_SEPARATOR by trying to find /bin/sh in a PATH which + # contains only /bin. Note that ksh looks also at the FPATH variable, + # so we have to set that as well for the test. + PATH_SEPARATOR=: + (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 \ + && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 \ + || PATH_SEPARATOR=';' + } +fi + +# Find out how to test for executable files. Don't use a zero-byte file, +# as systems may use methods other than mode bits to determine executability. +cat >conf$$.file <<_ASEOF +#! /bin/sh +exit 0 +_ASEOF +chmod +x conf$$.file +if test -x conf$$.file >/dev/null 2>&1; then + ac_executable_p="test -x" +else + ac_executable_p="test -f" +fi +rm -f conf$$.file + +# Extract the first word of "msgfmt", so it can be a program name with args. +set dummy msgfmt; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_path_MSGFMT+:} false; then : + $as_echo_n "(cached) " >&6 +else + case "$MSGFMT" in + [\\/]* | ?:[\\/]*) + ac_cv_path_MSGFMT="$MSGFMT" # Let the user override the test with a path. + ;; + *) + ac_save_IFS="$IFS"; IFS=$PATH_SEPARATOR + for ac_dir in $PATH; do + IFS="$ac_save_IFS" + test -z "$ac_dir" && ac_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $ac_executable_p "$ac_dir/$ac_word$ac_exec_ext"; then + echo "$as_me: trying $ac_dir/$ac_word..." >&5 + if $ac_dir/$ac_word --statistics /dev/null >&5 2>&1 && + (if $ac_dir/$ac_word --statistics /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi); then + ac_cv_path_MSGFMT="$ac_dir/$ac_word$ac_exec_ext" + break 2 + fi + fi + done + done + IFS="$ac_save_IFS" + test -z "$ac_cv_path_MSGFMT" && ac_cv_path_MSGFMT=":" + ;; +esac +fi +MSGFMT="$ac_cv_path_MSGFMT" +if test "$MSGFMT" != ":"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MSGFMT" >&5 +$as_echo "$MSGFMT" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + # Extract the first word of "gmsgfmt", so it can be a program name with args. +set dummy gmsgfmt; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_path_GMSGFMT+:} false; then : + $as_echo_n "(cached) " >&6 +else + case $GMSGFMT in + [\\/]* | ?:[\\/]*) + ac_cv_path_GMSGFMT="$GMSGFMT" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_path_GMSGFMT="$as_dir/$ac_word$ac_exec_ext" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + + test -z "$ac_cv_path_GMSGFMT" && ac_cv_path_GMSGFMT="$MSGFMT" + ;; +esac +fi +GMSGFMT=$ac_cv_path_GMSGFMT +if test -n "$GMSGFMT"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $GMSGFMT" >&5 +$as_echo "$GMSGFMT" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + + case `$MSGFMT --version | sed 1q | sed -e 's,^[^0-9]*,,'` in + '' | 0.[0-9] | 0.[0-9].* | 0.1[0-4] | 0.1[0-4].*) MSGFMT_015=: ;; + *) MSGFMT_015=$MSGFMT ;; + esac + + case `$GMSGFMT --version | sed 1q | sed -e 's,^[^0-9]*,,'` in + '' | 0.[0-9] | 0.[0-9].* | 0.1[0-4] | 0.1[0-4].*) GMSGFMT_015=: ;; + *) GMSGFMT_015=$GMSGFMT ;; + esac + + + +# Prepare PATH_SEPARATOR. +# The user is always right. +if test "${PATH_SEPARATOR+set}" != set; then + # Determine PATH_SEPARATOR by trying to find /bin/sh in a PATH which + # contains only /bin. Note that ksh looks also at the FPATH variable, + # so we have to set that as well for the test. + PATH_SEPARATOR=: + (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 \ + && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 \ + || PATH_SEPARATOR=';' + } +fi + +# Find out how to test for executable files. Don't use a zero-byte file, +# as systems may use methods other than mode bits to determine executability. +cat >conf$$.file <<_ASEOF +#! /bin/sh +exit 0 +_ASEOF +chmod +x conf$$.file +if test -x conf$$.file >/dev/null 2>&1; then + ac_executable_p="test -x" +else + ac_executable_p="test -f" +fi +rm -f conf$$.file + +# Extract the first word of "xgettext", so it can be a program name with args. +set dummy xgettext; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_path_XGETTEXT+:} false; then : + $as_echo_n "(cached) " >&6 +else + case "$XGETTEXT" in + [\\/]* | ?:[\\/]*) + ac_cv_path_XGETTEXT="$XGETTEXT" # Let the user override the test with a path. + ;; + *) + ac_save_IFS="$IFS"; IFS=$PATH_SEPARATOR + for ac_dir in $PATH; do + IFS="$ac_save_IFS" + test -z "$ac_dir" && ac_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $ac_executable_p "$ac_dir/$ac_word$ac_exec_ext"; then + echo "$as_me: trying $ac_dir/$ac_word..." >&5 + if $ac_dir/$ac_word --omit-header --copyright-holder= --msgid-bugs-address= /dev/null >&5 2>&1 && + (if $ac_dir/$ac_word --omit-header --copyright-holder= --msgid-bugs-address= /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi); then + ac_cv_path_XGETTEXT="$ac_dir/$ac_word$ac_exec_ext" + break 2 + fi + fi + done + done + IFS="$ac_save_IFS" + test -z "$ac_cv_path_XGETTEXT" && ac_cv_path_XGETTEXT=":" + ;; +esac +fi +XGETTEXT="$ac_cv_path_XGETTEXT" +if test "$XGETTEXT" != ":"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $XGETTEXT" >&5 +$as_echo "$XGETTEXT" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + rm -f messages.po + + case `$XGETTEXT --version | sed 1q | sed -e 's,^[^0-9]*,,'` in + '' | 0.[0-9] | 0.[0-9].* | 0.1[0-4] | 0.1[0-4].*) XGETTEXT_015=: ;; + *) XGETTEXT_015=$XGETTEXT ;; + esac + + + +# Prepare PATH_SEPARATOR. +# The user is always right. +if test "${PATH_SEPARATOR+set}" != set; then + # Determine PATH_SEPARATOR by trying to find /bin/sh in a PATH which + # contains only /bin. Note that ksh looks also at the FPATH variable, + # so we have to set that as well for the test. + PATH_SEPARATOR=: + (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 \ + && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 \ + || PATH_SEPARATOR=';' + } +fi + +# Find out how to test for executable files. Don't use a zero-byte file, +# as systems may use methods other than mode bits to determine executability. +cat >conf$$.file <<_ASEOF +#! /bin/sh +exit 0 +_ASEOF +chmod +x conf$$.file +if test -x conf$$.file >/dev/null 2>&1; then + ac_executable_p="test -x" +else + ac_executable_p="test -f" +fi +rm -f conf$$.file + +# Extract the first word of "msgmerge", so it can be a program name with args. +set dummy msgmerge; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_path_MSGMERGE+:} false; then : + $as_echo_n "(cached) " >&6 +else + case "$MSGMERGE" in + [\\/]* | ?:[\\/]*) + ac_cv_path_MSGMERGE="$MSGMERGE" # Let the user override the test with a path. + ;; + *) + ac_save_IFS="$IFS"; IFS=$PATH_SEPARATOR + for ac_dir in $PATH; do + IFS="$ac_save_IFS" + test -z "$ac_dir" && ac_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $ac_executable_p "$ac_dir/$ac_word$ac_exec_ext"; then + echo "$as_me: trying $ac_dir/$ac_word..." >&5 + if $ac_dir/$ac_word --update -q /dev/null /dev/null >&5 2>&1; then + ac_cv_path_MSGMERGE="$ac_dir/$ac_word$ac_exec_ext" + break 2 + fi + fi + done + done + IFS="$ac_save_IFS" + test -z "$ac_cv_path_MSGMERGE" && ac_cv_path_MSGMERGE=":" + ;; +esac +fi +MSGMERGE="$ac_cv_path_MSGMERGE" +if test "$MSGMERGE" != ":"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MSGMERGE" >&5 +$as_echo "$MSGMERGE" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$localedir" || localedir='${datadir}/locale' + + + test -n "${XGETTEXT_EXTRA_OPTIONS+set}" || XGETTEXT_EXTRA_OPTIONS= + + + ac_config_commands="$ac_config_commands po-directories" + + + + if test "X$prefix" = "XNONE"; then + acl_final_prefix="$ac_default_prefix" + else + acl_final_prefix="$prefix" + fi + if test "X$exec_prefix" = "XNONE"; then + acl_final_exec_prefix='${prefix}' + else + acl_final_exec_prefix="$exec_prefix" + fi + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + eval acl_final_exec_prefix=\"$acl_final_exec_prefix\" + prefix="$acl_save_prefix" + +DEPDIR="${am__leading_dot}deps" + +ac_config_commands="$ac_config_commands depfiles" + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} supports the include directive" >&5 +$as_echo_n "checking whether ${MAKE-make} supports the include directive... " >&6; } +cat > confinc.mk << 'END' +am__doit: + @echo this is the am__doit target >confinc.out +.PHONY: am__doit +END +am__include="#" +am__quote= +# BSD make does it like this. +echo '.include "confinc.mk" # ignored' > confmf.BSD +# Other make implementations (GNU, Solaris 10, AIX) do it like this. +echo 'include confinc.mk # ignored' > confmf.GNU +_am_result=no +for s in GNU BSD; do + { echo "$as_me:$LINENO: ${MAKE-make} -f confmf.$s && cat confinc.out" >&5 + (${MAKE-make} -f confmf.$s && cat confinc.out) >&5 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } + case $?:`cat confinc.out 2>/dev/null` in #( + '0:this is the am__doit target') : + case $s in #( + BSD) : + am__include='.include' am__quote='"' ;; #( + *) : + am__include='include' am__quote='' ;; +esac ;; #( + *) : + ;; +esac + if test "$am__include" != "#"; then + _am_result="yes ($s style)" + break + fi +done +rm -f confinc.* confmf.* +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: ${_am_result}" >&5 +$as_echo "${_am_result}" >&6; } + +# Check whether --enable-dependency-tracking was given. +if test "${enable_dependency_tracking+set}" = set; then : + enableval=$enable_dependency_tracking; +fi + +if test "x$enable_dependency_tracking" != xno; then + am_depcomp="$ac_aux_dir/depcomp" + AMDEPBACKSLASH='\' + am__nodep='_no' +fi + if test "x$enable_dependency_tracking" != xno; then + AMDEP_TRUE= + AMDEP_FALSE='#' +else + AMDEP_TRUE='#' + AMDEP_FALSE= +fi + + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. +set dummy ${ac_tool_prefix}gcc; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_CC+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_CC="${ac_tool_prefix}gcc" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +$as_echo "$CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_CC"; then + ac_ct_CC=$CC + # Extract the first word of "gcc", so it can be a program name with args. +set dummy gcc; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_CC+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_CC="gcc" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 +$as_echo "$ac_ct_CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_CC" = x; then + CC="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + CC=$ac_ct_CC + fi +else + CC="$ac_cv_prog_CC" +fi + +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. +set dummy ${ac_tool_prefix}cc; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_CC+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_CC="${ac_tool_prefix}cc" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +$as_echo "$CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + fi +fi +if test -z "$CC"; then + # Extract the first word of "cc", so it can be a program name with args. +set dummy cc; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_CC+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + ac_prog_rejected=no +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then + ac_prog_rejected=yes + continue + fi + ac_cv_prog_CC="cc" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +if test $ac_prog_rejected = yes; then + # We found a bogon in the path, so make sure we never use it. + set dummy $ac_cv_prog_CC + shift + if test $# != 0; then + # We chose a different compiler from the bogus one. + # However, it has the same basename, so the bogon will be chosen + # first if we set CC to just the basename; use the full file name. + shift + ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" + fi +fi +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +$as_echo "$CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + for ac_prog in cl.exe + do + # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. +set dummy $ac_tool_prefix$ac_prog; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_CC+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_CC="$ac_tool_prefix$ac_prog" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +$as_echo "$CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$CC" && break + done +fi +if test -z "$CC"; then + ac_ct_CC=$CC + for ac_prog in cl.exe +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_CC+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_CC="$ac_prog" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 +$as_echo "$ac_ct_CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$ac_ct_CC" && break +done + + if test "x$ac_ct_CC" = x; then + CC="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + CC=$ac_ct_CC + fi +fi + +fi + + +test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "no acceptable C compiler found in \$PATH +See \`config.log' for more details" "$LINENO" 5; } + +# Provide some information about the compiler. +$as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 +set X $ac_compile +ac_compiler=$2 +for ac_option in --version -v -V -qversion; do + { { ac_try="$ac_compiler $ac_option >&5" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_compiler $ac_option >&5") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + sed '10a\ +... rest of stderr output deleted ... + 10q' conftest.err >conftest.er1 + cat conftest.er1 >&5 + fi + rm -f conftest.er1 conftest.err + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } +done + +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +ac_clean_files_save=$ac_clean_files +ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out" +# Try to create an executable without -o first, disregard a.out. +# It will help us diagnose broken compilers, and finding out an intuition +# of exeext. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5 +$as_echo_n "checking whether the C compiler works... " >&6; } +ac_link_default=`$as_echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` + +# The possible output files: +ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*" + +ac_rmfiles= +for ac_file in $ac_files +do + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; + * ) ac_rmfiles="$ac_rmfiles $ac_file";; + esac +done +rm -f $ac_rmfiles + +if { { ac_try="$ac_link_default" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_link_default") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then : + # Autoconf-2.13 could set the ac_cv_exeext variable to `no'. +# So ignore a value of `no', otherwise this would lead to `EXEEXT = no' +# in a Makefile. We should not override ac_cv_exeext if it was cached, +# so that the user can short-circuit this test for compilers unknown to +# Autoconf. +for ac_file in $ac_files '' +do + test -f "$ac_file" || continue + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) + ;; + [ab].out ) + # We found the default executable, but exeext='' is most + # certainly right. + break;; + *.* ) + if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no; + then :; else + ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` + fi + # We set ac_cv_exeext here because the later test for it is not + # safe: cross compilers may not add the suffix if given an `-o' + # argument, so we may need to know it at that point already. + # Even if this section looks crufty: it has the advantage of + # actually working. + break;; + * ) + break;; + esac +done +test "$ac_cv_exeext" = no && ac_cv_exeext= + +else + ac_file='' +fi +if test -z "$ac_file"; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +$as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error 77 "C compiler cannot create executables +See \`config.log' for more details" "$LINENO" 5; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5 +$as_echo_n "checking for C compiler default output file name... " >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5 +$as_echo "$ac_file" >&6; } +ac_exeext=$ac_cv_exeext + +rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out +ac_clean_files=$ac_clean_files_save +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5 +$as_echo_n "checking for suffix of executables... " >&6; } +if { { ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then : + # If both `conftest.exe' and `conftest' are `present' (well, observable) +# catch `conftest.exe'. For instance with Cygwin, `ls conftest' will +# work properly (i.e., refer to `conftest.exe'), while it won't with +# `rm'. +for ac_file in conftest.exe conftest conftest.*; do + test -f "$ac_file" || continue + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; + *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` + break;; + * ) break;; + esac +done +else + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "cannot compute suffix of executables: cannot compile and link +See \`config.log' for more details" "$LINENO" 5; } +fi +rm -f conftest conftest$ac_cv_exeext +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5 +$as_echo "$ac_cv_exeext" >&6; } + +rm -f conftest.$ac_ext +EXEEXT=$ac_cv_exeext +ac_exeext=$EXEEXT +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +int +main () +{ +FILE *f = fopen ("conftest.out", "w"); + return ferror (f) || fclose (f) != 0; + + ; + return 0; +} +_ACEOF +ac_clean_files="$ac_clean_files conftest.out" +# Check that the compiler produces executables we can run. If not, either +# the compiler is broken, or we cross compile. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5 +$as_echo_n "checking whether we are cross compiling... " >&6; } +if test "$cross_compiling" != yes; then + { { ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } + if { ac_try='./conftest$ac_cv_exeext' + { { case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; }; then + cross_compiling=no + else + if test "$cross_compiling" = maybe; then + cross_compiling=yes + else + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "cannot run C compiled programs. +If you meant to cross compile, use \`--host'. +See \`config.log' for more details" "$LINENO" 5; } + fi + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5 +$as_echo "$cross_compiling" >&6; } + +rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out +ac_clean_files=$ac_clean_files_save +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5 +$as_echo_n "checking for suffix of object files... " >&6; } +if ${ac_cv_objext+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.o conftest.obj +if { { ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_compile") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then : + for ac_file in conftest.o conftest.obj conftest.*; do + test -f "$ac_file" || continue; + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM ) ;; + *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` + break;; + esac +done +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "cannot compute suffix of object files: cannot compile +See \`config.log' for more details" "$LINENO" 5; } +fi +rm -f conftest.$ac_cv_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5 +$as_echo "$ac_cv_objext" >&6; } +OBJEXT=$ac_cv_objext +ac_objext=$OBJEXT +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5 +$as_echo_n "checking whether we are using the GNU C compiler... " >&6; } +if ${ac_cv_c_compiler_gnu+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ +#ifndef __GNUC__ + choke me +#endif + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_compiler_gnu=yes +else + ac_compiler_gnu=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +ac_cv_c_compiler_gnu=$ac_compiler_gnu + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 +$as_echo "$ac_cv_c_compiler_gnu" >&6; } +if test $ac_compiler_gnu = yes; then + GCC=yes +else + GCC= +fi +ac_test_CFLAGS=${CFLAGS+set} +ac_save_CFLAGS=$CFLAGS +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 +$as_echo_n "checking whether $CC accepts -g... " >&6; } +if ${ac_cv_prog_cc_g+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_save_c_werror_flag=$ac_c_werror_flag + ac_c_werror_flag=yes + ac_cv_prog_cc_g=no + CFLAGS="-g" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_prog_cc_g=yes +else + CFLAGS="" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + +else + ac_c_werror_flag=$ac_save_c_werror_flag + CFLAGS="-g" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_prog_cc_g=yes +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + ac_c_werror_flag=$ac_save_c_werror_flag +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5 +$as_echo "$ac_cv_prog_cc_g" >&6; } +if test "$ac_test_CFLAGS" = set; then + CFLAGS=$ac_save_CFLAGS +elif test $ac_cv_prog_cc_g = yes; then + if test "$GCC" = yes; then + CFLAGS="-g -O2" + else + CFLAGS="-g" + fi +else + if test "$GCC" = yes; then + CFLAGS="-O2" + else + CFLAGS= + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5 +$as_echo_n "checking for $CC option to accept ISO C89... " >&6; } +if ${ac_cv_prog_cc_c89+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_cv_prog_cc_c89=no +ac_save_CC=$CC +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +#include +struct stat; +/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ +struct buf { int x; }; +FILE * (*rcsopen) (struct buf *, struct stat *, int); +static char *e (p, i) + char **p; + int i; +{ + return p[i]; +} +static char *f (char * (*g) (char **, int), char **p, ...) +{ + char *s; + va_list v; + va_start (v,p); + s = g (p, va_arg (v,int)); + va_end (v); + return s; +} + +/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has + function prototypes and stuff, but not '\xHH' hex character constants. + These don't provoke an error unfortunately, instead are silently treated + as 'x'. The following induces an error, until -std is added to get + proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an + array size at least. It's necessary to write '\x00'==0 to get something + that's true only with -std. */ +int osf4_cc_array ['\x00' == 0 ? 1 : -1]; + +/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters + inside strings and character constants. */ +#define FOO(x) 'x' +int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; + +int test (int i, double x); +struct s1 {int (*f) (int a);}; +struct s2 {int (*f) (double a);}; +int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); +int argc; +char **argv; +int +main () +{ +return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; + ; + return 0; +} +_ACEOF +for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ + -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" +do + CC="$ac_save_CC $ac_arg" + if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_prog_cc_c89=$ac_arg +fi +rm -f core conftest.err conftest.$ac_objext + test "x$ac_cv_prog_cc_c89" != "xno" && break +done +rm -f conftest.$ac_ext +CC=$ac_save_CC + +fi +# AC_CACHE_VAL +case "x$ac_cv_prog_cc_c89" in + x) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 +$as_echo "none needed" >&6; } ;; + xno) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 +$as_echo "unsupported" >&6; } ;; + *) + CC="$CC $ac_cv_prog_cc_c89" + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 +$as_echo "$ac_cv_prog_cc_c89" >&6; } ;; +esac +if test "x$ac_cv_prog_cc_c89" != xno; then : + +fi + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC understands -c and -o together" >&5 +$as_echo_n "checking whether $CC understands -c and -o together... " >&6; } +if ${am_cv_prog_cc_c_o+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF + # Make sure it works both with $CC and with simple cc. + # Following AC_PROG_CC_C_O, we do the test twice because some + # compilers refuse to overwrite an existing .o file with -o, + # though they will create one. + am_cv_prog_cc_c_o=yes + for am_i in 1 2; do + if { echo "$as_me:$LINENO: $CC -c conftest.$ac_ext -o conftest2.$ac_objext" >&5 + ($CC -c conftest.$ac_ext -o conftest2.$ac_objext) >&5 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } \ + && test -f conftest2.$ac_objext; then + : OK + else + am_cv_prog_cc_c_o=no + break + fi + done + rm -f core conftest* + unset am_i +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_prog_cc_c_o" >&5 +$as_echo "$am_cv_prog_cc_c_o" >&6; } +if test "$am_cv_prog_cc_c_o" != yes; then + # Losing compiler, so override with the script. + # FIXME: It is wrong to rewrite CC. + # But if we don't then we get into trouble of one sort or another. + # A longer-term fix would be to have automake use am__CC in this case, + # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)" + CC="$am_aux_dir/compile $CC" +fi +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + +depcc="$CC" am_compiler_list= + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5 +$as_echo_n "checking dependency style of $depcc... " >&6; } +if ${am_cv_CC_dependencies_compiler_type+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then + # We make a subdir and do the tests there. Otherwise we can end up + # making bogus files that we don't know about and never remove. For + # instance it was reported that on HP-UX the gcc test will end up + # making a dummy file named 'D' -- because '-MD' means "put the output + # in D". + rm -rf conftest.dir + mkdir conftest.dir + # Copy depcomp to subdir because otherwise we won't find it if we're + # using a relative directory. + cp "$am_depcomp" conftest.dir + cd conftest.dir + # We will build objects and dependencies in a subdirectory because + # it helps to detect inapplicable dependency modes. For instance + # both Tru64's cc and ICC support -MD to output dependencies as a + # side effect of compilation, but ICC will put the dependencies in + # the current directory while Tru64 will put them in the object + # directory. + mkdir sub + + am_cv_CC_dependencies_compiler_type=none + if test "$am_compiler_list" = ""; then + am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` + fi + am__universal=false + case " $depcc " in #( + *\ -arch\ *\ -arch\ *) am__universal=true ;; + esac + + for depmode in $am_compiler_list; do + # Setup a source with many dependencies, because some compilers + # like to wrap large dependency lists on column 80 (with \), and + # we should not choose a depcomp mode which is confused by this. + # + # We need to recreate these files for each test, as the compiler may + # overwrite some of them when testing with obscure command lines. + # This happens at least with the AIX C compiler. + : > sub/conftest.c + for i in 1 2 3 4 5 6; do + echo '#include "conftst'$i'.h"' >> sub/conftest.c + # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with + # Solaris 10 /bin/sh. + echo '/* dummy */' > sub/conftst$i.h + done + echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf + + # We check with '-c' and '-o' for the sake of the "dashmstdout" + # mode. It turns out that the SunPro C++ compiler does not properly + # handle '-M -o', and we need to detect this. Also, some Intel + # versions had trouble with output in subdirs. + am__obj=sub/conftest.${OBJEXT-o} + am__minus_obj="-o $am__obj" + case $depmode in + gcc) + # This depmode causes a compiler race in universal mode. + test "$am__universal" = false || continue + ;; + nosideeffect) + # After this tag, mechanisms are not by side-effect, so they'll + # only be used when explicitly requested. + if test "x$enable_dependency_tracking" = xyes; then + continue + else + break + fi + ;; + msvc7 | msvc7msys | msvisualcpp | msvcmsys) + # This compiler won't grok '-c -o', but also, the minuso test has + # not run yet. These depmodes are late enough in the game, and + # so weak that their functioning should not be impacted. + am__obj=conftest.${OBJEXT-o} + am__minus_obj= + ;; + none) break ;; + esac + if depmode=$depmode \ + source=sub/conftest.c object=$am__obj \ + depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ + $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \ + >/dev/null 2>conftest.err && + grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && + grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && + grep $am__obj sub/conftest.Po > /dev/null 2>&1 && + ${MAKE-make} -s -f confmf > /dev/null 2>&1; then + # icc doesn't choke on unknown options, it will just issue warnings + # or remarks (even with -Werror). So we grep stderr for any message + # that says an option was ignored or not supported. + # When given -MP, icc 7.0 and 7.1 complain thusly: + # icc: Command line warning: ignoring option '-M'; no argument required + # The diagnosis changed in icc 8.0: + # icc: Command line remark: option '-MP' not supported + if (grep 'ignoring option' conftest.err || + grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else + am_cv_CC_dependencies_compiler_type=$depmode + break + fi + fi + done + + cd .. + rm -rf conftest.dir +else + am_cv_CC_dependencies_compiler_type=none +fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_CC_dependencies_compiler_type" >&5 +$as_echo "$am_cv_CC_dependencies_compiler_type" >&6; } +CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type + + if + test "x$enable_dependency_tracking" != xno \ + && test "$am_cv_CC_dependencies_compiler_type" = gcc3; then + am__fastdepCC_TRUE= + am__fastdepCC_FALSE='#' +else + am__fastdepCC_TRUE='#' + am__fastdepCC_FALSE= +fi + + +# Make sure we can run config.sub. +$SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 || + as_fn_error $? "cannot run $SHELL $ac_aux_dir/config.sub" "$LINENO" 5 + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking build system type" >&5 +$as_echo_n "checking build system type... " >&6; } +if ${ac_cv_build+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_build_alias=$build_alias +test "x$ac_build_alias" = x && + ac_build_alias=`$SHELL "$ac_aux_dir/config.guess"` +test "x$ac_build_alias" = x && + as_fn_error $? "cannot guess build type; you must specify one" "$LINENO" 5 +ac_cv_build=`$SHELL "$ac_aux_dir/config.sub" $ac_build_alias` || + as_fn_error $? "$SHELL $ac_aux_dir/config.sub $ac_build_alias failed" "$LINENO" 5 + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_build" >&5 +$as_echo "$ac_cv_build" >&6; } +case $ac_cv_build in +*-*-*) ;; +*) as_fn_error $? "invalid value of canonical build" "$LINENO" 5;; +esac +build=$ac_cv_build +ac_save_IFS=$IFS; IFS='-' +set x $ac_cv_build +shift +build_cpu=$1 +build_vendor=$2 +shift; shift +# Remember, the first character of IFS is used to create $*, +# except with old shells: +build_os=$* +IFS=$ac_save_IFS +case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking host system type" >&5 +$as_echo_n "checking host system type... " >&6; } +if ${ac_cv_host+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test "x$host_alias" = x; then + ac_cv_host=$ac_cv_build +else + ac_cv_host=`$SHELL "$ac_aux_dir/config.sub" $host_alias` || + as_fn_error $? "$SHELL $ac_aux_dir/config.sub $host_alias failed" "$LINENO" 5 +fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_host" >&5 +$as_echo "$ac_cv_host" >&6; } +case $ac_cv_host in +*-*-*) ;; +*) as_fn_error $? "invalid value of canonical host" "$LINENO" 5;; +esac +host=$ac_cv_host +ac_save_IFS=$IFS; IFS='-' +set x $ac_cv_host +shift +host_cpu=$1 +host_vendor=$2 +shift; shift +# Remember, the first character of IFS is used to create $*, +# except with old shells: +host_os=$* +IFS=$ac_save_IFS +case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac + + + + +# Check whether --with-gnu-ld was given. +if test "${with_gnu_ld+set}" = set; then : + withval=$with_gnu_ld; test "$withval" = no || with_gnu_ld=yes +else + with_gnu_ld=no +fi + +# Prepare PATH_SEPARATOR. +# The user is always right. +if test "${PATH_SEPARATOR+set}" != set; then + # Determine PATH_SEPARATOR by trying to find /bin/sh in a PATH which + # contains only /bin. Note that ksh looks also at the FPATH variable, + # so we have to set that as well for the test. + PATH_SEPARATOR=: + (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 \ + && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 \ + || PATH_SEPARATOR=';' + } +fi + +ac_prog=ld +if test "$GCC" = yes; then + # Check if gcc -print-prog-name=ld gives a path. + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ld used by $CC" >&5 +$as_echo_n "checking for ld used by $CC... " >&6; } + case $host in + *-*-mingw*) + # gcc leaves a trailing carriage return which upsets mingw + ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; + *) + ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; + esac + case $ac_prog in + # Accept absolute paths. + [\\/]* | ?:[\\/]*) + re_direlt='/[^/][^/]*/\.\./' + # Canonicalize the pathname of ld + ac_prog=`echo "$ac_prog"| sed 's%\\\\%/%g'` + while echo "$ac_prog" | grep "$re_direlt" > /dev/null 2>&1; do + ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"` + done + test -z "$LD" && LD="$ac_prog" + ;; + "") + # If it fails, then pretend we aren't using GCC. + ac_prog=ld + ;; + *) + # If it is relative, then search for the first ld in PATH. + with_gnu_ld=unknown + ;; + esac +elif test "$with_gnu_ld" = yes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU ld" >&5 +$as_echo_n "checking for GNU ld... " >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for non-GNU ld" >&5 +$as_echo_n "checking for non-GNU ld... " >&6; } +fi +if ${acl_cv_path_LD+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -z "$LD"; then + acl_save_ifs="$IFS"; IFS=$PATH_SEPARATOR + for ac_dir in $PATH; do + IFS="$acl_save_ifs" + test -z "$ac_dir" && ac_dir=. + if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then + acl_cv_path_LD="$ac_dir/$ac_prog" + # Check to see if the program is GNU ld. I'd rather use --version, + # but apparently some variants of GNU ld only accept -v. + # Break only if it was the GNU/non-GNU ld that we prefer. + case `"$acl_cv_path_LD" -v 2>&1 &5 +$as_echo "$LD" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi +test -z "$LD" && as_fn_error $? "no acceptable ld found in \$PATH" "$LINENO" 5 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if the linker ($LD) is GNU ld" >&5 +$as_echo_n "checking if the linker ($LD) is GNU ld... " >&6; } +if ${acl_cv_prog_gnu_ld+:} false; then : + $as_echo_n "(cached) " >&6 +else + # I'd rather use --version here, but apparently some GNU lds only accept -v. +case `$LD -v 2>&1 &5 +$as_echo "$acl_cv_prog_gnu_ld" >&6; } +with_gnu_ld=$acl_cv_prog_gnu_ld + + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for shared library run path origin" >&5 +$as_echo_n "checking for shared library run path origin... " >&6; } +if ${acl_cv_rpath+:} false; then : + $as_echo_n "(cached) " >&6 +else + + CC="$CC" GCC="$GCC" LDFLAGS="$LDFLAGS" LD="$LD" with_gnu_ld="$with_gnu_ld" \ + ${CONFIG_SHELL-/bin/sh} "$ac_aux_dir/config.rpath" "$host" > conftest.sh + . ./conftest.sh + rm -f ./conftest.sh + acl_cv_rpath=done + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $acl_cv_rpath" >&5 +$as_echo "$acl_cv_rpath" >&6; } + wl="$acl_cv_wl" + acl_libext="$acl_cv_libext" + acl_shlibext="$acl_cv_shlibext" + acl_libname_spec="$acl_cv_libname_spec" + acl_library_names_spec="$acl_cv_library_names_spec" + acl_hardcode_libdir_flag_spec="$acl_cv_hardcode_libdir_flag_spec" + acl_hardcode_libdir_separator="$acl_cv_hardcode_libdir_separator" + acl_hardcode_direct="$acl_cv_hardcode_direct" + acl_hardcode_minus_L="$acl_cv_hardcode_minus_L" + # Check whether --enable-rpath was given. +if test "${enable_rpath+set}" = set; then : + enableval=$enable_rpath; : +else + enable_rpath=yes +fi + + + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5 +$as_echo_n "checking how to run the C preprocessor... " >&6; } +# On Suns, sometimes $CPP names a directory. +if test -n "$CPP" && test -d "$CPP"; then + CPP= +fi +if test -z "$CPP"; then + if ${ac_cv_prog_CPP+:} false; then : + $as_echo_n "(cached) " >&6 +else + # Double quotes because CPP needs to be expanded + for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" + do + ac_preproc_ok=false +for ac_c_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # Prefer to if __STDC__ is defined, since + # exists even on freestanding compilers. + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. "Syntax error" is here to catch this case. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#ifdef __STDC__ +# include +#else +# include +#endif + Syntax error +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + +else + # Broken: fails on valid input. +continue +fi +rm -f conftest.err conftest.i conftest.$ac_ext + + # OK, works on sane cases. Now check whether nonexistent headers + # can be detected and how. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + # Broken: success on invalid input. +continue +else + # Passes both tests. +ac_preproc_ok=: +break +fi +rm -f conftest.err conftest.i conftest.$ac_ext + +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.i conftest.err conftest.$ac_ext +if $ac_preproc_ok; then : + break +fi + + done + ac_cv_prog_CPP=$CPP + +fi + CPP=$ac_cv_prog_CPP +else + ac_cv_prog_CPP=$CPP +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5 +$as_echo "$CPP" >&6; } +ac_preproc_ok=false +for ac_c_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # Prefer to if __STDC__ is defined, since + # exists even on freestanding compilers. + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. "Syntax error" is here to catch this case. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#ifdef __STDC__ +# include +#else +# include +#endif + Syntax error +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + +else + # Broken: fails on valid input. +continue +fi +rm -f conftest.err conftest.i conftest.$ac_ext + + # OK, works on sane cases. Now check whether nonexistent headers + # can be detected and how. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + # Broken: success on invalid input. +continue +else + # Passes both tests. +ac_preproc_ok=: +break +fi +rm -f conftest.err conftest.i conftest.$ac_ext + +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.i conftest.err conftest.$ac_ext +if $ac_preproc_ok; then : + +else + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "C preprocessor \"$CPP\" fails sanity check +See \`config.log' for more details" "$LINENO" 5; } +fi + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5 +$as_echo_n "checking for grep that handles long lines and -e... " >&6; } +if ${ac_cv_path_GREP+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -z "$GREP"; then + ac_path_GREP_found=false + # Loop through the user's path and test for each of PROGNAME-LIST + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_prog in grep ggrep; do + for ac_exec_ext in '' $ac_executable_extensions; do + ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext" + as_fn_executable_p "$ac_path_GREP" || continue +# Check for GNU ac_path_GREP and select it if it is found. + # Check for GNU $ac_path_GREP +case `"$ac_path_GREP" --version 2>&1` in +*GNU*) + ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;; +*) + ac_count=0 + $as_echo_n 0123456789 >"conftest.in" + while : + do + cat "conftest.in" "conftest.in" >"conftest.tmp" + mv "conftest.tmp" "conftest.in" + cp "conftest.in" "conftest.nl" + $as_echo 'GREP' >> "conftest.nl" + "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break + diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break + as_fn_arith $ac_count + 1 && ac_count=$as_val + if test $ac_count -gt ${ac_path_GREP_max-0}; then + # Best one so far, save it but keep looking for a better one + ac_cv_path_GREP="$ac_path_GREP" + ac_path_GREP_max=$ac_count + fi + # 10*(2^10) chars as input seems more than enough + test $ac_count -gt 10 && break + done + rm -f conftest.in conftest.tmp conftest.nl conftest.out;; +esac + + $ac_path_GREP_found && break 3 + done + done + done +IFS=$as_save_IFS + if test -z "$ac_cv_path_GREP"; then + as_fn_error $? "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 + fi +else + ac_cv_path_GREP=$GREP +fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5 +$as_echo "$ac_cv_path_GREP" >&6; } + GREP="$ac_cv_path_GREP" + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5 +$as_echo_n "checking for egrep... " >&6; } +if ${ac_cv_path_EGREP+:} false; then : + $as_echo_n "(cached) " >&6 +else + if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 + then ac_cv_path_EGREP="$GREP -E" + else + if test -z "$EGREP"; then + ac_path_EGREP_found=false + # Loop through the user's path and test for each of PROGNAME-LIST + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_prog in egrep; do + for ac_exec_ext in '' $ac_executable_extensions; do + ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext" + as_fn_executable_p "$ac_path_EGREP" || continue +# Check for GNU ac_path_EGREP and select it if it is found. + # Check for GNU $ac_path_EGREP +case `"$ac_path_EGREP" --version 2>&1` in +*GNU*) + ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;; +*) + ac_count=0 + $as_echo_n 0123456789 >"conftest.in" + while : + do + cat "conftest.in" "conftest.in" >"conftest.tmp" + mv "conftest.tmp" "conftest.in" + cp "conftest.in" "conftest.nl" + $as_echo 'EGREP' >> "conftest.nl" + "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break + diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break + as_fn_arith $ac_count + 1 && ac_count=$as_val + if test $ac_count -gt ${ac_path_EGREP_max-0}; then + # Best one so far, save it but keep looking for a better one + ac_cv_path_EGREP="$ac_path_EGREP" + ac_path_EGREP_max=$ac_count + fi + # 10*(2^10) chars as input seems more than enough + test $ac_count -gt 10 && break + done + rm -f conftest.in conftest.tmp conftest.nl conftest.out;; +esac + + $ac_path_EGREP_found && break 3 + done + done + done +IFS=$as_save_IFS + if test -z "$ac_cv_path_EGREP"; then + as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 + fi +else + ac_cv_path_EGREP=$EGREP +fi + + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5 +$as_echo "$ac_cv_path_EGREP" >&6; } + EGREP="$ac_cv_path_EGREP" + + + + + acl_libdirstem=lib + acl_libdirstem2= + case "$host_os" in + solaris*) + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for 64-bit host" >&5 +$as_echo_n "checking for 64-bit host... " >&6; } +if ${gl_cv_solaris_64bit+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#ifdef _LP64 +sixtyfour bits +#endif + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "sixtyfour bits" >/dev/null 2>&1; then : + gl_cv_solaris_64bit=yes +else + gl_cv_solaris_64bit=no +fi +rm -f conftest* + + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_solaris_64bit" >&5 +$as_echo "$gl_cv_solaris_64bit" >&6; } + if test $gl_cv_solaris_64bit = yes; then + acl_libdirstem=lib/64 + case "$host_cpu" in + sparc*) acl_libdirstem2=lib/sparcv9 ;; + i*86 | x86_64) acl_libdirstem2=lib/amd64 ;; + esac + fi + ;; + *) + searchpath=`(LC_ALL=C $CC -print-search-dirs) 2>/dev/null | sed -n -e 's,^libraries: ,,p' | sed -e 's,^=,,'` + if test -n "$searchpath"; then + acl_save_IFS="${IFS= }"; IFS=":" + for searchdir in $searchpath; do + if test -d "$searchdir"; then + case "$searchdir" in + */lib64/ | */lib64 ) acl_libdirstem=lib64 ;; + */../ | */.. ) + # Better ignore directories of this form. They are misleading. + ;; + *) searchdir=`cd "$searchdir" && pwd` + case "$searchdir" in + */lib64 ) acl_libdirstem=lib64 ;; + esac ;; + esac + fi + done + IFS="$acl_save_IFS" + fi + ;; + esac + test -n "$acl_libdirstem2" || acl_libdirstem2="$acl_libdirstem" + + + + + + + + + + + + + use_additional=yes + + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + acl_save_exec_prefix="$exec_prefix" + exec_prefix="$acl_final_exec_prefix" + + eval additional_includedir=\"$includedir\" + eval additional_libdir=\"$libdir\" + + exec_prefix="$acl_save_exec_prefix" + prefix="$acl_save_prefix" + + +# Check whether --with-libiconv-prefix was given. +if test "${with_libiconv_prefix+set}" = set; then : + withval=$with_libiconv_prefix; + if test "X$withval" = "Xno"; then + use_additional=no + else + if test "X$withval" = "X"; then + + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + acl_save_exec_prefix="$exec_prefix" + exec_prefix="$acl_final_exec_prefix" + + eval additional_includedir=\"$includedir\" + eval additional_libdir=\"$libdir\" + + exec_prefix="$acl_save_exec_prefix" + prefix="$acl_save_prefix" + + else + additional_includedir="$withval/include" + additional_libdir="$withval/$acl_libdirstem" + if test "$acl_libdirstem2" != "$acl_libdirstem" \ + && ! test -d "$withval/$acl_libdirstem"; then + additional_libdir="$withval/$acl_libdirstem2" + fi + fi + fi + +fi + + LIBICONV= + LTLIBICONV= + INCICONV= + LIBICONV_PREFIX= + HAVE_LIBICONV= + rpathdirs= + ltrpathdirs= + names_already_handled= + names_next_round='iconv ' + while test -n "$names_next_round"; do + names_this_round="$names_next_round" + names_next_round= + for name in $names_this_round; do + already_handled= + for n in $names_already_handled; do + if test "$n" = "$name"; then + already_handled=yes + break + fi + done + if test -z "$already_handled"; then + names_already_handled="$names_already_handled $name" + uppername=`echo "$name" | sed -e 'y|abcdefghijklmnopqrstuvwxyz./+-|ABCDEFGHIJKLMNOPQRSTUVWXYZ____|'` + eval value=\"\$HAVE_LIB$uppername\" + if test -n "$value"; then + if test "$value" = yes; then + eval value=\"\$LIB$uppername\" + test -z "$value" || LIBICONV="${LIBICONV}${LIBICONV:+ }$value" + eval value=\"\$LTLIB$uppername\" + test -z "$value" || LTLIBICONV="${LTLIBICONV}${LTLIBICONV:+ }$value" + else + : + fi + else + found_dir= + found_la= + found_so= + found_a= + eval libname=\"$acl_libname_spec\" # typically: libname=lib$name + if test -n "$acl_shlibext"; then + shrext=".$acl_shlibext" # typically: shrext=.so + else + shrext= + fi + if test $use_additional = yes; then + dir="$additional_libdir" + if test -n "$acl_shlibext"; then + if test -f "$dir/$libname$shrext"; then + found_dir="$dir" + found_so="$dir/$libname$shrext" + else + if test "$acl_library_names_spec" = '$libname$shrext$versuffix'; then + ver=`(cd "$dir" && \ + for f in "$libname$shrext".*; do echo "$f"; done \ + | sed -e "s,^$libname$shrext\\\\.,," \ + | sort -t '.' -n -r -k1,1 -k2,2 -k3,3 -k4,4 -k5,5 \ + | sed 1q ) 2>/dev/null` + if test -n "$ver" && test -f "$dir/$libname$shrext.$ver"; then + found_dir="$dir" + found_so="$dir/$libname$shrext.$ver" + fi + else + eval library_names=\"$acl_library_names_spec\" + for f in $library_names; do + if test -f "$dir/$f"; then + found_dir="$dir" + found_so="$dir/$f" + break + fi + done + fi + fi + fi + if test "X$found_dir" = "X"; then + if test -f "$dir/$libname.$acl_libext"; then + found_dir="$dir" + found_a="$dir/$libname.$acl_libext" + fi + fi + if test "X$found_dir" != "X"; then + if test -f "$dir/$libname.la"; then + found_la="$dir/$libname.la" + fi + fi + fi + if test "X$found_dir" = "X"; then + for x in $LDFLAGS $LTLIBICONV; do + + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + acl_save_exec_prefix="$exec_prefix" + exec_prefix="$acl_final_exec_prefix" + eval x=\"$x\" + exec_prefix="$acl_save_exec_prefix" + prefix="$acl_save_prefix" + + case "$x" in + -L*) + dir=`echo "X$x" | sed -e 's/^X-L//'` + if test -n "$acl_shlibext"; then + if test -f "$dir/$libname$shrext"; then + found_dir="$dir" + found_so="$dir/$libname$shrext" + else + if test "$acl_library_names_spec" = '$libname$shrext$versuffix'; then + ver=`(cd "$dir" && \ + for f in "$libname$shrext".*; do echo "$f"; done \ + | sed -e "s,^$libname$shrext\\\\.,," \ + | sort -t '.' -n -r -k1,1 -k2,2 -k3,3 -k4,4 -k5,5 \ + | sed 1q ) 2>/dev/null` + if test -n "$ver" && test -f "$dir/$libname$shrext.$ver"; then + found_dir="$dir" + found_so="$dir/$libname$shrext.$ver" + fi + else + eval library_names=\"$acl_library_names_spec\" + for f in $library_names; do + if test -f "$dir/$f"; then + found_dir="$dir" + found_so="$dir/$f" + break + fi + done + fi + fi + fi + if test "X$found_dir" = "X"; then + if test -f "$dir/$libname.$acl_libext"; then + found_dir="$dir" + found_a="$dir/$libname.$acl_libext" + fi + fi + if test "X$found_dir" != "X"; then + if test -f "$dir/$libname.la"; then + found_la="$dir/$libname.la" + fi + fi + ;; + esac + if test "X$found_dir" != "X"; then + break + fi + done + fi + if test "X$found_dir" != "X"; then + LTLIBICONV="${LTLIBICONV}${LTLIBICONV:+ }-L$found_dir -l$name" + if test "X$found_so" != "X"; then + if test "$enable_rpath" = no \ + || test "X$found_dir" = "X/usr/$acl_libdirstem" \ + || test "X$found_dir" = "X/usr/$acl_libdirstem2"; then + LIBICONV="${LIBICONV}${LIBICONV:+ }$found_so" + else + haveit= + for x in $ltrpathdirs; do + if test "X$x" = "X$found_dir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + ltrpathdirs="$ltrpathdirs $found_dir" + fi + if test "$acl_hardcode_direct" = yes; then + LIBICONV="${LIBICONV}${LIBICONV:+ }$found_so" + else + if test -n "$acl_hardcode_libdir_flag_spec" && test "$acl_hardcode_minus_L" = no; then + LIBICONV="${LIBICONV}${LIBICONV:+ }$found_so" + haveit= + for x in $rpathdirs; do + if test "X$x" = "X$found_dir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + rpathdirs="$rpathdirs $found_dir" + fi + else + haveit= + for x in $LDFLAGS $LIBICONV; do + + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + acl_save_exec_prefix="$exec_prefix" + exec_prefix="$acl_final_exec_prefix" + eval x=\"$x\" + exec_prefix="$acl_save_exec_prefix" + prefix="$acl_save_prefix" + + if test "X$x" = "X-L$found_dir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + LIBICONV="${LIBICONV}${LIBICONV:+ }-L$found_dir" + fi + if test "$acl_hardcode_minus_L" != no; then + LIBICONV="${LIBICONV}${LIBICONV:+ }$found_so" + else + LIBICONV="${LIBICONV}${LIBICONV:+ }-l$name" + fi + fi + fi + fi + else + if test "X$found_a" != "X"; then + LIBICONV="${LIBICONV}${LIBICONV:+ }$found_a" + else + LIBICONV="${LIBICONV}${LIBICONV:+ }-L$found_dir -l$name" + fi + fi + additional_includedir= + case "$found_dir" in + */$acl_libdirstem | */$acl_libdirstem/) + basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e "s,/$acl_libdirstem/"'*$,,'` + if test "$name" = 'iconv'; then + LIBICONV_PREFIX="$basedir" + fi + additional_includedir="$basedir/include" + ;; + */$acl_libdirstem2 | */$acl_libdirstem2/) + basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e "s,/$acl_libdirstem2/"'*$,,'` + if test "$name" = 'iconv'; then + LIBICONV_PREFIX="$basedir" + fi + additional_includedir="$basedir/include" + ;; + esac + if test "X$additional_includedir" != "X"; then + if test "X$additional_includedir" != "X/usr/include"; then + haveit= + if test "X$additional_includedir" = "X/usr/local/include"; then + if test -n "$GCC"; then + case $host_os in + linux* | gnu* | k*bsd*-gnu) haveit=yes;; + esac + fi + fi + if test -z "$haveit"; then + for x in $CPPFLAGS $INCICONV; do + + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + acl_save_exec_prefix="$exec_prefix" + exec_prefix="$acl_final_exec_prefix" + eval x=\"$x\" + exec_prefix="$acl_save_exec_prefix" + prefix="$acl_save_prefix" + + if test "X$x" = "X-I$additional_includedir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + if test -d "$additional_includedir"; then + INCICONV="${INCICONV}${INCICONV:+ }-I$additional_includedir" + fi + fi + fi + fi + fi + if test -n "$found_la"; then + save_libdir="$libdir" + case "$found_la" in + */* | *\\*) . "$found_la" ;; + *) . "./$found_la" ;; + esac + libdir="$save_libdir" + for dep in $dependency_libs; do + case "$dep" in + -L*) + additional_libdir=`echo "X$dep" | sed -e 's/^X-L//'` + if test "X$additional_libdir" != "X/usr/$acl_libdirstem" \ + && test "X$additional_libdir" != "X/usr/$acl_libdirstem2"; then + haveit= + if test "X$additional_libdir" = "X/usr/local/$acl_libdirstem" \ + || test "X$additional_libdir" = "X/usr/local/$acl_libdirstem2"; then + if test -n "$GCC"; then + case $host_os in + linux* | gnu* | k*bsd*-gnu) haveit=yes;; + esac + fi + fi + if test -z "$haveit"; then + haveit= + for x in $LDFLAGS $LIBICONV; do + + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + acl_save_exec_prefix="$exec_prefix" + exec_prefix="$acl_final_exec_prefix" + eval x=\"$x\" + exec_prefix="$acl_save_exec_prefix" + prefix="$acl_save_prefix" + + if test "X$x" = "X-L$additional_libdir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + if test -d "$additional_libdir"; then + LIBICONV="${LIBICONV}${LIBICONV:+ }-L$additional_libdir" + fi + fi + haveit= + for x in $LDFLAGS $LTLIBICONV; do + + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + acl_save_exec_prefix="$exec_prefix" + exec_prefix="$acl_final_exec_prefix" + eval x=\"$x\" + exec_prefix="$acl_save_exec_prefix" + prefix="$acl_save_prefix" + + if test "X$x" = "X-L$additional_libdir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + if test -d "$additional_libdir"; then + LTLIBICONV="${LTLIBICONV}${LTLIBICONV:+ }-L$additional_libdir" + fi + fi + fi + fi + ;; + -R*) + dir=`echo "X$dep" | sed -e 's/^X-R//'` + if test "$enable_rpath" != no; then + haveit= + for x in $rpathdirs; do + if test "X$x" = "X$dir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + rpathdirs="$rpathdirs $dir" + fi + haveit= + for x in $ltrpathdirs; do + if test "X$x" = "X$dir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + ltrpathdirs="$ltrpathdirs $dir" + fi + fi + ;; + -l*) + names_next_round="$names_next_round "`echo "X$dep" | sed -e 's/^X-l//'` + ;; + *.la) + names_next_round="$names_next_round "`echo "X$dep" | sed -e 's,^X.*/,,' -e 's,^lib,,' -e 's,\.la$,,'` + ;; + *) + LIBICONV="${LIBICONV}${LIBICONV:+ }$dep" + LTLIBICONV="${LTLIBICONV}${LTLIBICONV:+ }$dep" + ;; + esac + done + fi + else + LIBICONV="${LIBICONV}${LIBICONV:+ }-l$name" + LTLIBICONV="${LTLIBICONV}${LTLIBICONV:+ }-l$name" + fi + fi + fi + done + done + if test "X$rpathdirs" != "X"; then + if test -n "$acl_hardcode_libdir_separator"; then + alldirs= + for found_dir in $rpathdirs; do + alldirs="${alldirs}${alldirs:+$acl_hardcode_libdir_separator}$found_dir" + done + acl_save_libdir="$libdir" + libdir="$alldirs" + eval flag=\"$acl_hardcode_libdir_flag_spec\" + libdir="$acl_save_libdir" + LIBICONV="${LIBICONV}${LIBICONV:+ }$flag" + else + for found_dir in $rpathdirs; do + acl_save_libdir="$libdir" + libdir="$found_dir" + eval flag=\"$acl_hardcode_libdir_flag_spec\" + libdir="$acl_save_libdir" + LIBICONV="${LIBICONV}${LIBICONV:+ }$flag" + done + fi + fi + if test "X$ltrpathdirs" != "X"; then + for found_dir in $ltrpathdirs; do + LTLIBICONV="${LTLIBICONV}${LTLIBICONV:+ }-R$found_dir" + done + fi + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for CFPreferencesCopyAppValue" >&5 +$as_echo_n "checking for CFPreferencesCopyAppValue... " >&6; } +if ${gt_cv_func_CFPreferencesCopyAppValue+:} false; then : + $as_echo_n "(cached) " >&6 +else + gt_save_LIBS="$LIBS" + LIBS="$LIBS -Wl,-framework -Wl,CoreFoundation" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +int +main () +{ +CFPreferencesCopyAppValue(NULL, NULL) + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + gt_cv_func_CFPreferencesCopyAppValue=yes +else + gt_cv_func_CFPreferencesCopyAppValue=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + LIBS="$gt_save_LIBS" +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gt_cv_func_CFPreferencesCopyAppValue" >&5 +$as_echo "$gt_cv_func_CFPreferencesCopyAppValue" >&6; } + if test $gt_cv_func_CFPreferencesCopyAppValue = yes; then + +$as_echo "#define HAVE_CFPREFERENCESCOPYAPPVALUE 1" >>confdefs.h + + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for CFLocaleCopyCurrent" >&5 +$as_echo_n "checking for CFLocaleCopyCurrent... " >&6; } +if ${gt_cv_func_CFLocaleCopyCurrent+:} false; then : + $as_echo_n "(cached) " >&6 +else + gt_save_LIBS="$LIBS" + LIBS="$LIBS -Wl,-framework -Wl,CoreFoundation" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +int +main () +{ +CFLocaleCopyCurrent(); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + gt_cv_func_CFLocaleCopyCurrent=yes +else + gt_cv_func_CFLocaleCopyCurrent=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + LIBS="$gt_save_LIBS" +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gt_cv_func_CFLocaleCopyCurrent" >&5 +$as_echo "$gt_cv_func_CFLocaleCopyCurrent" >&6; } + if test $gt_cv_func_CFLocaleCopyCurrent = yes; then + +$as_echo "#define HAVE_CFLOCALECOPYCURRENT 1" >>confdefs.h + + fi + INTL_MACOSX_LIBS= + if test $gt_cv_func_CFPreferencesCopyAppValue = yes || test $gt_cv_func_CFLocaleCopyCurrent = yes; then + INTL_MACOSX_LIBS="-Wl,-framework -Wl,CoreFoundation" + fi + + + + + + + LIBINTL= + LTLIBINTL= + POSUB= + + case " $gt_needs " in + *" need-formatstring-macros "*) gt_api_version=3 ;; + *" need-ngettext "*) gt_api_version=2 ;; + *) gt_api_version=1 ;; + esac + gt_func_gnugettext_libc="gt_cv_func_gnugettext${gt_api_version}_libc" + gt_func_gnugettext_libintl="gt_cv_func_gnugettext${gt_api_version}_libintl" + + if test "$USE_NLS" = "yes"; then + gt_use_preinstalled_gnugettext=no + + + if test $gt_api_version -ge 3; then + gt_revision_test_code=' +#ifndef __GNU_GETTEXT_SUPPORTED_REVISION +#define __GNU_GETTEXT_SUPPORTED_REVISION(major) ((major) == 0 ? 0 : -1) +#endif +typedef int array [2 * (__GNU_GETTEXT_SUPPORTED_REVISION(0) >= 1) - 1]; +' + else + gt_revision_test_code= + fi + if test $gt_api_version -ge 2; then + gt_expression_test_code=' + * ngettext ("", "", 0)' + else + gt_expression_test_code= + fi + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU gettext in libc" >&5 +$as_echo_n "checking for GNU gettext in libc... " >&6; } +if eval \${$gt_func_gnugettext_libc+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include +#ifndef __GNU_GETTEXT_SUPPORTED_REVISION +extern int _nl_msg_cat_cntr; +extern int *_nl_domain_bindings; +#define __GNU_GETTEXT_SYMBOL_EXPRESSION (_nl_msg_cat_cntr + *_nl_domain_bindings) +#else +#define __GNU_GETTEXT_SYMBOL_EXPRESSION 0 +#endif +$gt_revision_test_code + +int +main () +{ + +bindtextdomain ("", ""); +return * gettext ("")$gt_expression_test_code + __GNU_GETTEXT_SYMBOL_EXPRESSION + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + eval "$gt_func_gnugettext_libc=yes" +else + eval "$gt_func_gnugettext_libc=no" +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +eval ac_res=\$$gt_func_gnugettext_libc + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } + + if { eval "gt_val=\$$gt_func_gnugettext_libc"; test "$gt_val" != "yes"; }; then + + + + + + am_save_CPPFLAGS="$CPPFLAGS" + + for element in $INCICONV; do + haveit= + for x in $CPPFLAGS; do + + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + acl_save_exec_prefix="$exec_prefix" + exec_prefix="$acl_final_exec_prefix" + eval x=\"$x\" + exec_prefix="$acl_save_exec_prefix" + prefix="$acl_save_prefix" + + if test "X$x" = "X$element"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + CPPFLAGS="${CPPFLAGS}${CPPFLAGS:+ }$element" + fi + done + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for iconv" >&5 +$as_echo_n "checking for iconv... " >&6; } +if ${am_cv_func_iconv+:} false; then : + $as_echo_n "(cached) " >&6 +else + + am_cv_func_iconv="no, consider installing GNU libiconv" + am_cv_lib_iconv=no + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include +#include + +int +main () +{ +iconv_t cd = iconv_open("",""); + iconv(cd,NULL,NULL,NULL,NULL); + iconv_close(cd); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + am_cv_func_iconv=yes +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + if test "$am_cv_func_iconv" != yes; then + am_save_LIBS="$LIBS" + LIBS="$LIBS $LIBICONV" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include +#include + +int +main () +{ +iconv_t cd = iconv_open("",""); + iconv(cd,NULL,NULL,NULL,NULL); + iconv_close(cd); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + am_cv_lib_iconv=yes + am_cv_func_iconv=yes +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + LIBS="$am_save_LIBS" + fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_func_iconv" >&5 +$as_echo "$am_cv_func_iconv" >&6; } + if test "$am_cv_func_iconv" = yes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for working iconv" >&5 +$as_echo_n "checking for working iconv... " >&6; } +if ${am_cv_func_iconv_works+:} false; then : + $as_echo_n "(cached) " >&6 +else + + am_save_LIBS="$LIBS" + if test $am_cv_lib_iconv = yes; then + LIBS="$LIBS $LIBICONV" + fi + am_cv_func_iconv_works=no + for ac_iconv_const in '' 'const'; do + if test "$cross_compiling" = yes; then : + case "$host_os" in + aix* | hpux*) am_cv_func_iconv_works="guessing no" ;; + *) am_cv_func_iconv_works="guessing yes" ;; + esac +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include +#include + +#ifndef ICONV_CONST +# define ICONV_CONST $ac_iconv_const +#endif + +int +main () +{ +int result = 0; + /* Test against AIX 5.1 bug: Failures are not distinguishable from successful + returns. */ + { + iconv_t cd_utf8_to_88591 = iconv_open ("ISO8859-1", "UTF-8"); + if (cd_utf8_to_88591 != (iconv_t)(-1)) + { + static ICONV_CONST char input[] = "\342\202\254"; /* EURO SIGN */ + char buf[10]; + ICONV_CONST char *inptr = input; + size_t inbytesleft = strlen (input); + char *outptr = buf; + size_t outbytesleft = sizeof (buf); + size_t res = iconv (cd_utf8_to_88591, + &inptr, &inbytesleft, + &outptr, &outbytesleft); + if (res == 0) + result |= 1; + iconv_close (cd_utf8_to_88591); + } + } + /* Test against Solaris 10 bug: Failures are not distinguishable from + successful returns. */ + { + iconv_t cd_ascii_to_88591 = iconv_open ("ISO8859-1", "646"); + if (cd_ascii_to_88591 != (iconv_t)(-1)) + { + static ICONV_CONST char input[] = "\263"; + char buf[10]; + ICONV_CONST char *inptr = input; + size_t inbytesleft = strlen (input); + char *outptr = buf; + size_t outbytesleft = sizeof (buf); + size_t res = iconv (cd_ascii_to_88591, + &inptr, &inbytesleft, + &outptr, &outbytesleft); + if (res == 0) + result |= 2; + iconv_close (cd_ascii_to_88591); + } + } + /* Test against AIX 6.1..7.1 bug: Buffer overrun. */ + { + iconv_t cd_88591_to_utf8 = iconv_open ("UTF-8", "ISO-8859-1"); + if (cd_88591_to_utf8 != (iconv_t)(-1)) + { + static ICONV_CONST char input[] = "\304"; + static char buf[2] = { (char)0xDE, (char)0xAD }; + ICONV_CONST char *inptr = input; + size_t inbytesleft = 1; + char *outptr = buf; + size_t outbytesleft = 1; + size_t res = iconv (cd_88591_to_utf8, + &inptr, &inbytesleft, + &outptr, &outbytesleft); + if (res != (size_t)(-1) || outptr - buf > 1 || buf[1] != (char)0xAD) + result |= 4; + iconv_close (cd_88591_to_utf8); + } + } +#if 0 /* This bug could be worked around by the caller. */ + /* Test against HP-UX 11.11 bug: Positive return value instead of 0. */ + { + iconv_t cd_88591_to_utf8 = iconv_open ("utf8", "iso88591"); + if (cd_88591_to_utf8 != (iconv_t)(-1)) + { + static ICONV_CONST char input[] = "\304rger mit b\366sen B\374bchen ohne Augenma\337"; + char buf[50]; + ICONV_CONST char *inptr = input; + size_t inbytesleft = strlen (input); + char *outptr = buf; + size_t outbytesleft = sizeof (buf); + size_t res = iconv (cd_88591_to_utf8, + &inptr, &inbytesleft, + &outptr, &outbytesleft); + if ((int)res > 0) + result |= 8; + iconv_close (cd_88591_to_utf8); + } + } +#endif + /* Test against HP-UX 11.11 bug: No converter from EUC-JP to UTF-8 is + provided. */ + if (/* Try standardized names. */ + iconv_open ("UTF-8", "EUC-JP") == (iconv_t)(-1) + /* Try IRIX, OSF/1 names. */ + && iconv_open ("UTF-8", "eucJP") == (iconv_t)(-1) + /* Try AIX names. */ + && iconv_open ("UTF-8", "IBM-eucJP") == (iconv_t)(-1) + /* Try HP-UX names. */ + && iconv_open ("utf8", "eucJP") == (iconv_t)(-1)) + result |= 16; + return result; + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_run "$LINENO"; then : + am_cv_func_iconv_works=yes +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + + test "$am_cv_func_iconv_works" = no || break + done + LIBS="$am_save_LIBS" + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_func_iconv_works" >&5 +$as_echo "$am_cv_func_iconv_works" >&6; } + case "$am_cv_func_iconv_works" in + *no) am_func_iconv=no am_cv_lib_iconv=no ;; + *) am_func_iconv=yes ;; + esac + else + am_func_iconv=no am_cv_lib_iconv=no + fi + if test "$am_func_iconv" = yes; then + +$as_echo "#define HAVE_ICONV 1" >>confdefs.h + + fi + if test "$am_cv_lib_iconv" = yes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to link with libiconv" >&5 +$as_echo_n "checking how to link with libiconv... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LIBICONV" >&5 +$as_echo "$LIBICONV" >&6; } + else + CPPFLAGS="$am_save_CPPFLAGS" + LIBICONV= + LTLIBICONV= + fi + + + + + + + + + + + + use_additional=yes + + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + acl_save_exec_prefix="$exec_prefix" + exec_prefix="$acl_final_exec_prefix" + + eval additional_includedir=\"$includedir\" + eval additional_libdir=\"$libdir\" + + exec_prefix="$acl_save_exec_prefix" + prefix="$acl_save_prefix" + + +# Check whether --with-libintl-prefix was given. +if test "${with_libintl_prefix+set}" = set; then : + withval=$with_libintl_prefix; + if test "X$withval" = "Xno"; then + use_additional=no + else + if test "X$withval" = "X"; then + + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + acl_save_exec_prefix="$exec_prefix" + exec_prefix="$acl_final_exec_prefix" + + eval additional_includedir=\"$includedir\" + eval additional_libdir=\"$libdir\" + + exec_prefix="$acl_save_exec_prefix" + prefix="$acl_save_prefix" + + else + additional_includedir="$withval/include" + additional_libdir="$withval/$acl_libdirstem" + if test "$acl_libdirstem2" != "$acl_libdirstem" \ + && ! test -d "$withval/$acl_libdirstem"; then + additional_libdir="$withval/$acl_libdirstem2" + fi + fi + fi + +fi + + LIBINTL= + LTLIBINTL= + INCINTL= + LIBINTL_PREFIX= + HAVE_LIBINTL= + rpathdirs= + ltrpathdirs= + names_already_handled= + names_next_round='intl ' + while test -n "$names_next_round"; do + names_this_round="$names_next_round" + names_next_round= + for name in $names_this_round; do + already_handled= + for n in $names_already_handled; do + if test "$n" = "$name"; then + already_handled=yes + break + fi + done + if test -z "$already_handled"; then + names_already_handled="$names_already_handled $name" + uppername=`echo "$name" | sed -e 'y|abcdefghijklmnopqrstuvwxyz./+-|ABCDEFGHIJKLMNOPQRSTUVWXYZ____|'` + eval value=\"\$HAVE_LIB$uppername\" + if test -n "$value"; then + if test "$value" = yes; then + eval value=\"\$LIB$uppername\" + test -z "$value" || LIBINTL="${LIBINTL}${LIBINTL:+ }$value" + eval value=\"\$LTLIB$uppername\" + test -z "$value" || LTLIBINTL="${LTLIBINTL}${LTLIBINTL:+ }$value" + else + : + fi + else + found_dir= + found_la= + found_so= + found_a= + eval libname=\"$acl_libname_spec\" # typically: libname=lib$name + if test -n "$acl_shlibext"; then + shrext=".$acl_shlibext" # typically: shrext=.so + else + shrext= + fi + if test $use_additional = yes; then + dir="$additional_libdir" + if test -n "$acl_shlibext"; then + if test -f "$dir/$libname$shrext"; then + found_dir="$dir" + found_so="$dir/$libname$shrext" + else + if test "$acl_library_names_spec" = '$libname$shrext$versuffix'; then + ver=`(cd "$dir" && \ + for f in "$libname$shrext".*; do echo "$f"; done \ + | sed -e "s,^$libname$shrext\\\\.,," \ + | sort -t '.' -n -r -k1,1 -k2,2 -k3,3 -k4,4 -k5,5 \ + | sed 1q ) 2>/dev/null` + if test -n "$ver" && test -f "$dir/$libname$shrext.$ver"; then + found_dir="$dir" + found_so="$dir/$libname$shrext.$ver" + fi + else + eval library_names=\"$acl_library_names_spec\" + for f in $library_names; do + if test -f "$dir/$f"; then + found_dir="$dir" + found_so="$dir/$f" + break + fi + done + fi + fi + fi + if test "X$found_dir" = "X"; then + if test -f "$dir/$libname.$acl_libext"; then + found_dir="$dir" + found_a="$dir/$libname.$acl_libext" + fi + fi + if test "X$found_dir" != "X"; then + if test -f "$dir/$libname.la"; then + found_la="$dir/$libname.la" + fi + fi + fi + if test "X$found_dir" = "X"; then + for x in $LDFLAGS $LTLIBINTL; do + + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + acl_save_exec_prefix="$exec_prefix" + exec_prefix="$acl_final_exec_prefix" + eval x=\"$x\" + exec_prefix="$acl_save_exec_prefix" + prefix="$acl_save_prefix" + + case "$x" in + -L*) + dir=`echo "X$x" | sed -e 's/^X-L//'` + if test -n "$acl_shlibext"; then + if test -f "$dir/$libname$shrext"; then + found_dir="$dir" + found_so="$dir/$libname$shrext" + else + if test "$acl_library_names_spec" = '$libname$shrext$versuffix'; then + ver=`(cd "$dir" && \ + for f in "$libname$shrext".*; do echo "$f"; done \ + | sed -e "s,^$libname$shrext\\\\.,," \ + | sort -t '.' -n -r -k1,1 -k2,2 -k3,3 -k4,4 -k5,5 \ + | sed 1q ) 2>/dev/null` + if test -n "$ver" && test -f "$dir/$libname$shrext.$ver"; then + found_dir="$dir" + found_so="$dir/$libname$shrext.$ver" + fi + else + eval library_names=\"$acl_library_names_spec\" + for f in $library_names; do + if test -f "$dir/$f"; then + found_dir="$dir" + found_so="$dir/$f" + break + fi + done + fi + fi + fi + if test "X$found_dir" = "X"; then + if test -f "$dir/$libname.$acl_libext"; then + found_dir="$dir" + found_a="$dir/$libname.$acl_libext" + fi + fi + if test "X$found_dir" != "X"; then + if test -f "$dir/$libname.la"; then + found_la="$dir/$libname.la" + fi + fi + ;; + esac + if test "X$found_dir" != "X"; then + break + fi + done + fi + if test "X$found_dir" != "X"; then + LTLIBINTL="${LTLIBINTL}${LTLIBINTL:+ }-L$found_dir -l$name" + if test "X$found_so" != "X"; then + if test "$enable_rpath" = no \ + || test "X$found_dir" = "X/usr/$acl_libdirstem" \ + || test "X$found_dir" = "X/usr/$acl_libdirstem2"; then + LIBINTL="${LIBINTL}${LIBINTL:+ }$found_so" + else + haveit= + for x in $ltrpathdirs; do + if test "X$x" = "X$found_dir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + ltrpathdirs="$ltrpathdirs $found_dir" + fi + if test "$acl_hardcode_direct" = yes; then + LIBINTL="${LIBINTL}${LIBINTL:+ }$found_so" + else + if test -n "$acl_hardcode_libdir_flag_spec" && test "$acl_hardcode_minus_L" = no; then + LIBINTL="${LIBINTL}${LIBINTL:+ }$found_so" + haveit= + for x in $rpathdirs; do + if test "X$x" = "X$found_dir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + rpathdirs="$rpathdirs $found_dir" + fi + else + haveit= + for x in $LDFLAGS $LIBINTL; do + + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + acl_save_exec_prefix="$exec_prefix" + exec_prefix="$acl_final_exec_prefix" + eval x=\"$x\" + exec_prefix="$acl_save_exec_prefix" + prefix="$acl_save_prefix" + + if test "X$x" = "X-L$found_dir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + LIBINTL="${LIBINTL}${LIBINTL:+ }-L$found_dir" + fi + if test "$acl_hardcode_minus_L" != no; then + LIBINTL="${LIBINTL}${LIBINTL:+ }$found_so" + else + LIBINTL="${LIBINTL}${LIBINTL:+ }-l$name" + fi + fi + fi + fi + else + if test "X$found_a" != "X"; then + LIBINTL="${LIBINTL}${LIBINTL:+ }$found_a" + else + LIBINTL="${LIBINTL}${LIBINTL:+ }-L$found_dir -l$name" + fi + fi + additional_includedir= + case "$found_dir" in + */$acl_libdirstem | */$acl_libdirstem/) + basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e "s,/$acl_libdirstem/"'*$,,'` + if test "$name" = 'intl'; then + LIBINTL_PREFIX="$basedir" + fi + additional_includedir="$basedir/include" + ;; + */$acl_libdirstem2 | */$acl_libdirstem2/) + basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e "s,/$acl_libdirstem2/"'*$,,'` + if test "$name" = 'intl'; then + LIBINTL_PREFIX="$basedir" + fi + additional_includedir="$basedir/include" + ;; + esac + if test "X$additional_includedir" != "X"; then + if test "X$additional_includedir" != "X/usr/include"; then + haveit= + if test "X$additional_includedir" = "X/usr/local/include"; then + if test -n "$GCC"; then + case $host_os in + linux* | gnu* | k*bsd*-gnu) haveit=yes;; + esac + fi + fi + if test -z "$haveit"; then + for x in $CPPFLAGS $INCINTL; do + + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + acl_save_exec_prefix="$exec_prefix" + exec_prefix="$acl_final_exec_prefix" + eval x=\"$x\" + exec_prefix="$acl_save_exec_prefix" + prefix="$acl_save_prefix" + + if test "X$x" = "X-I$additional_includedir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + if test -d "$additional_includedir"; then + INCINTL="${INCINTL}${INCINTL:+ }-I$additional_includedir" + fi + fi + fi + fi + fi + if test -n "$found_la"; then + save_libdir="$libdir" + case "$found_la" in + */* | *\\*) . "$found_la" ;; + *) . "./$found_la" ;; + esac + libdir="$save_libdir" + for dep in $dependency_libs; do + case "$dep" in + -L*) + additional_libdir=`echo "X$dep" | sed -e 's/^X-L//'` + if test "X$additional_libdir" != "X/usr/$acl_libdirstem" \ + && test "X$additional_libdir" != "X/usr/$acl_libdirstem2"; then + haveit= + if test "X$additional_libdir" = "X/usr/local/$acl_libdirstem" \ + || test "X$additional_libdir" = "X/usr/local/$acl_libdirstem2"; then + if test -n "$GCC"; then + case $host_os in + linux* | gnu* | k*bsd*-gnu) haveit=yes;; + esac + fi + fi + if test -z "$haveit"; then + haveit= + for x in $LDFLAGS $LIBINTL; do + + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + acl_save_exec_prefix="$exec_prefix" + exec_prefix="$acl_final_exec_prefix" + eval x=\"$x\" + exec_prefix="$acl_save_exec_prefix" + prefix="$acl_save_prefix" + + if test "X$x" = "X-L$additional_libdir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + if test -d "$additional_libdir"; then + LIBINTL="${LIBINTL}${LIBINTL:+ }-L$additional_libdir" + fi + fi + haveit= + for x in $LDFLAGS $LTLIBINTL; do + + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + acl_save_exec_prefix="$exec_prefix" + exec_prefix="$acl_final_exec_prefix" + eval x=\"$x\" + exec_prefix="$acl_save_exec_prefix" + prefix="$acl_save_prefix" + + if test "X$x" = "X-L$additional_libdir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + if test -d "$additional_libdir"; then + LTLIBINTL="${LTLIBINTL}${LTLIBINTL:+ }-L$additional_libdir" + fi + fi + fi + fi + ;; + -R*) + dir=`echo "X$dep" | sed -e 's/^X-R//'` + if test "$enable_rpath" != no; then + haveit= + for x in $rpathdirs; do + if test "X$x" = "X$dir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + rpathdirs="$rpathdirs $dir" + fi + haveit= + for x in $ltrpathdirs; do + if test "X$x" = "X$dir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + ltrpathdirs="$ltrpathdirs $dir" + fi + fi + ;; + -l*) + names_next_round="$names_next_round "`echo "X$dep" | sed -e 's/^X-l//'` + ;; + *.la) + names_next_round="$names_next_round "`echo "X$dep" | sed -e 's,^X.*/,,' -e 's,^lib,,' -e 's,\.la$,,'` + ;; + *) + LIBINTL="${LIBINTL}${LIBINTL:+ }$dep" + LTLIBINTL="${LTLIBINTL}${LTLIBINTL:+ }$dep" + ;; + esac + done + fi + else + LIBINTL="${LIBINTL}${LIBINTL:+ }-l$name" + LTLIBINTL="${LTLIBINTL}${LTLIBINTL:+ }-l$name" + fi + fi + fi + done + done + if test "X$rpathdirs" != "X"; then + if test -n "$acl_hardcode_libdir_separator"; then + alldirs= + for found_dir in $rpathdirs; do + alldirs="${alldirs}${alldirs:+$acl_hardcode_libdir_separator}$found_dir" + done + acl_save_libdir="$libdir" + libdir="$alldirs" + eval flag=\"$acl_hardcode_libdir_flag_spec\" + libdir="$acl_save_libdir" + LIBINTL="${LIBINTL}${LIBINTL:+ }$flag" + else + for found_dir in $rpathdirs; do + acl_save_libdir="$libdir" + libdir="$found_dir" + eval flag=\"$acl_hardcode_libdir_flag_spec\" + libdir="$acl_save_libdir" + LIBINTL="${LIBINTL}${LIBINTL:+ }$flag" + done + fi + fi + if test "X$ltrpathdirs" != "X"; then + for found_dir in $ltrpathdirs; do + LTLIBINTL="${LTLIBINTL}${LTLIBINTL:+ }-R$found_dir" + done + fi + + + + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU gettext in libintl" >&5 +$as_echo_n "checking for GNU gettext in libintl... " >&6; } +if eval \${$gt_func_gnugettext_libintl+:} false; then : + $as_echo_n "(cached) " >&6 +else + gt_save_CPPFLAGS="$CPPFLAGS" + CPPFLAGS="$CPPFLAGS $INCINTL" + gt_save_LIBS="$LIBS" + LIBS="$LIBS $LIBINTL" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include +#ifndef __GNU_GETTEXT_SUPPORTED_REVISION +extern int _nl_msg_cat_cntr; +extern +#ifdef __cplusplus +"C" +#endif +const char *_nl_expand_alias (const char *); +#define __GNU_GETTEXT_SYMBOL_EXPRESSION (_nl_msg_cat_cntr + *_nl_expand_alias ("")) +#else +#define __GNU_GETTEXT_SYMBOL_EXPRESSION 0 +#endif +$gt_revision_test_code + +int +main () +{ + +bindtextdomain ("", ""); +return * gettext ("")$gt_expression_test_code + __GNU_GETTEXT_SYMBOL_EXPRESSION + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + eval "$gt_func_gnugettext_libintl=yes" +else + eval "$gt_func_gnugettext_libintl=no" +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + if { eval "gt_val=\$$gt_func_gnugettext_libintl"; test "$gt_val" != yes; } && test -n "$LIBICONV"; then + LIBS="$LIBS $LIBICONV" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include +#ifndef __GNU_GETTEXT_SUPPORTED_REVISION +extern int _nl_msg_cat_cntr; +extern +#ifdef __cplusplus +"C" +#endif +const char *_nl_expand_alias (const char *); +#define __GNU_GETTEXT_SYMBOL_EXPRESSION (_nl_msg_cat_cntr + *_nl_expand_alias ("")) +#else +#define __GNU_GETTEXT_SYMBOL_EXPRESSION 0 +#endif +$gt_revision_test_code + +int +main () +{ + +bindtextdomain ("", ""); +return * gettext ("")$gt_expression_test_code + __GNU_GETTEXT_SYMBOL_EXPRESSION + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + LIBINTL="$LIBINTL $LIBICONV" + LTLIBINTL="$LTLIBINTL $LTLIBICONV" + eval "$gt_func_gnugettext_libintl=yes" + +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + fi + CPPFLAGS="$gt_save_CPPFLAGS" + LIBS="$gt_save_LIBS" +fi +eval ac_res=\$$gt_func_gnugettext_libintl + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } + fi + + if { eval "gt_val=\$$gt_func_gnugettext_libc"; test "$gt_val" = "yes"; } \ + || { { eval "gt_val=\$$gt_func_gnugettext_libintl"; test "$gt_val" = "yes"; } \ + && test "$PACKAGE" != gettext-runtime \ + && test "$PACKAGE" != gettext-tools; }; then + gt_use_preinstalled_gnugettext=yes + else + LIBINTL= + LTLIBINTL= + INCINTL= + fi + + + + if test -n "$INTL_MACOSX_LIBS"; then + if test "$gt_use_preinstalled_gnugettext" = "yes" \ + || test "$nls_cv_use_gnu_gettext" = "yes"; then + LIBINTL="$LIBINTL $INTL_MACOSX_LIBS" + LTLIBINTL="$LTLIBINTL $INTL_MACOSX_LIBS" + fi + fi + + if test "$gt_use_preinstalled_gnugettext" = "yes" \ + || test "$nls_cv_use_gnu_gettext" = "yes"; then + +$as_echo "#define ENABLE_NLS 1" >>confdefs.h + + else + USE_NLS=no + fi + fi + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to use NLS" >&5 +$as_echo_n "checking whether to use NLS... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $USE_NLS" >&5 +$as_echo "$USE_NLS" >&6; } + if test "$USE_NLS" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking where the gettext function comes from" >&5 +$as_echo_n "checking where the gettext function comes from... " >&6; } + if test "$gt_use_preinstalled_gnugettext" = "yes"; then + if { eval "gt_val=\$$gt_func_gnugettext_libintl"; test "$gt_val" = "yes"; }; then + gt_source="external libintl" + else + gt_source="libc" + fi + else + gt_source="included intl directory" + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $gt_source" >&5 +$as_echo "$gt_source" >&6; } + fi + + if test "$USE_NLS" = "yes"; then + + if test "$gt_use_preinstalled_gnugettext" = "yes"; then + if { eval "gt_val=\$$gt_func_gnugettext_libintl"; test "$gt_val" = "yes"; }; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to link with libintl" >&5 +$as_echo_n "checking how to link with libintl... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LIBINTL" >&5 +$as_echo "$LIBINTL" >&6; } + + for element in $INCINTL; do + haveit= + for x in $CPPFLAGS; do + + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + acl_save_exec_prefix="$exec_prefix" + exec_prefix="$acl_final_exec_prefix" + eval x=\"$x\" + exec_prefix="$acl_save_exec_prefix" + prefix="$acl_save_prefix" + + if test "X$x" = "X$element"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + CPPFLAGS="${CPPFLAGS}${CPPFLAGS:+ }$element" + fi + done + + fi + + +$as_echo "#define HAVE_GETTEXT 1" >>confdefs.h + + +$as_echo "#define HAVE_DCGETTEXT 1" >>confdefs.h + + fi + + POSUB=po + fi + + + + INTLLIBS="$LIBINTL" + + + + + + + + + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. +set dummy ${ac_tool_prefix}gcc; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_CC+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_CC="${ac_tool_prefix}gcc" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +$as_echo "$CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_CC"; then + ac_ct_CC=$CC + # Extract the first word of "gcc", so it can be a program name with args. +set dummy gcc; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_CC+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_CC="gcc" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 +$as_echo "$ac_ct_CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_CC" = x; then + CC="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + CC=$ac_ct_CC + fi +else + CC="$ac_cv_prog_CC" +fi + +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. +set dummy ${ac_tool_prefix}cc; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_CC+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_CC="${ac_tool_prefix}cc" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +$as_echo "$CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + fi +fi +if test -z "$CC"; then + # Extract the first word of "cc", so it can be a program name with args. +set dummy cc; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_CC+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + ac_prog_rejected=no +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then + ac_prog_rejected=yes + continue + fi + ac_cv_prog_CC="cc" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +if test $ac_prog_rejected = yes; then + # We found a bogon in the path, so make sure we never use it. + set dummy $ac_cv_prog_CC + shift + if test $# != 0; then + # We chose a different compiler from the bogus one. + # However, it has the same basename, so the bogon will be chosen + # first if we set CC to just the basename; use the full file name. + shift + ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" + fi +fi +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +$as_echo "$CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + for ac_prog in cl.exe + do + # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. +set dummy $ac_tool_prefix$ac_prog; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_CC+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_CC="$ac_tool_prefix$ac_prog" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +$as_echo "$CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$CC" && break + done +fi +if test -z "$CC"; then + ac_ct_CC=$CC + for ac_prog in cl.exe +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_CC+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_CC="$ac_prog" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 +$as_echo "$ac_ct_CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$ac_ct_CC" && break +done + + if test "x$ac_ct_CC" = x; then + CC="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + CC=$ac_ct_CC + fi +fi + +fi + + +test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "no acceptable C compiler found in \$PATH +See \`config.log' for more details" "$LINENO" 5; } + +# Provide some information about the compiler. +$as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 +set X $ac_compile +ac_compiler=$2 +for ac_option in --version -v -V -qversion; do + { { ac_try="$ac_compiler $ac_option >&5" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_compiler $ac_option >&5") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + sed '10a\ +... rest of stderr output deleted ... + 10q' conftest.err >conftest.er1 + cat conftest.er1 >&5 + fi + rm -f conftest.er1 conftest.err + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } +done + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5 +$as_echo_n "checking whether we are using the GNU C compiler... " >&6; } +if ${ac_cv_c_compiler_gnu+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ +#ifndef __GNUC__ + choke me +#endif + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_compiler_gnu=yes +else + ac_compiler_gnu=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +ac_cv_c_compiler_gnu=$ac_compiler_gnu + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 +$as_echo "$ac_cv_c_compiler_gnu" >&6; } +if test $ac_compiler_gnu = yes; then + GCC=yes +else + GCC= +fi +ac_test_CFLAGS=${CFLAGS+set} +ac_save_CFLAGS=$CFLAGS +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 +$as_echo_n "checking whether $CC accepts -g... " >&6; } +if ${ac_cv_prog_cc_g+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_save_c_werror_flag=$ac_c_werror_flag + ac_c_werror_flag=yes + ac_cv_prog_cc_g=no + CFLAGS="-g" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_prog_cc_g=yes +else + CFLAGS="" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + +else + ac_c_werror_flag=$ac_save_c_werror_flag + CFLAGS="-g" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_prog_cc_g=yes +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + ac_c_werror_flag=$ac_save_c_werror_flag +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5 +$as_echo "$ac_cv_prog_cc_g" >&6; } +if test "$ac_test_CFLAGS" = set; then + CFLAGS=$ac_save_CFLAGS +elif test $ac_cv_prog_cc_g = yes; then + if test "$GCC" = yes; then + CFLAGS="-g -O2" + else + CFLAGS="-g" + fi +else + if test "$GCC" = yes; then + CFLAGS="-O2" + else + CFLAGS= + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5 +$as_echo_n "checking for $CC option to accept ISO C89... " >&6; } +if ${ac_cv_prog_cc_c89+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_cv_prog_cc_c89=no +ac_save_CC=$CC +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +#include +struct stat; +/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ +struct buf { int x; }; +FILE * (*rcsopen) (struct buf *, struct stat *, int); +static char *e (p, i) + char **p; + int i; +{ + return p[i]; +} +static char *f (char * (*g) (char **, int), char **p, ...) +{ + char *s; + va_list v; + va_start (v,p); + s = g (p, va_arg (v,int)); + va_end (v); + return s; +} + +/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has + function prototypes and stuff, but not '\xHH' hex character constants. + These don't provoke an error unfortunately, instead are silently treated + as 'x'. The following induces an error, until -std is added to get + proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an + array size at least. It's necessary to write '\x00'==0 to get something + that's true only with -std. */ +int osf4_cc_array ['\x00' == 0 ? 1 : -1]; + +/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters + inside strings and character constants. */ +#define FOO(x) 'x' +int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; + +int test (int i, double x); +struct s1 {int (*f) (int a);}; +struct s2 {int (*f) (double a);}; +int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); +int argc; +char **argv; +int +main () +{ +return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; + ; + return 0; +} +_ACEOF +for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ + -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" +do + CC="$ac_save_CC $ac_arg" + if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_prog_cc_c89=$ac_arg +fi +rm -f core conftest.err conftest.$ac_objext + test "x$ac_cv_prog_cc_c89" != "xno" && break +done +rm -f conftest.$ac_ext +CC=$ac_save_CC + +fi +# AC_CACHE_VAL +case "x$ac_cv_prog_cc_c89" in + x) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 +$as_echo "none needed" >&6; } ;; + xno) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 +$as_echo "unsupported" >&6; } ;; + *) + CC="$CC $ac_cv_prog_cc_c89" + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 +$as_echo "$ac_cv_prog_cc_c89" >&6; } ;; +esac +if test "x$ac_cv_prog_cc_c89" != xno; then : + +fi + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC understands -c and -o together" >&5 +$as_echo_n "checking whether $CC understands -c and -o together... " >&6; } +if ${am_cv_prog_cc_c_o+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF + # Make sure it works both with $CC and with simple cc. + # Following AC_PROG_CC_C_O, we do the test twice because some + # compilers refuse to overwrite an existing .o file with -o, + # though they will create one. + am_cv_prog_cc_c_o=yes + for am_i in 1 2; do + if { echo "$as_me:$LINENO: $CC -c conftest.$ac_ext -o conftest2.$ac_objext" >&5 + ($CC -c conftest.$ac_ext -o conftest2.$ac_objext) >&5 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } \ + && test -f conftest2.$ac_objext; then + : OK + else + am_cv_prog_cc_c_o=no + break + fi + done + rm -f core conftest* + unset am_i +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_prog_cc_c_o" >&5 +$as_echo "$am_cv_prog_cc_c_o" >&6; } +if test "$am_cv_prog_cc_c_o" != yes; then + # Losing compiler, so override with the script. + # FIXME: It is wrong to rewrite CC. + # But if we don't then we get into trouble of one sort or another. + # A longer-term fix would be to have automake use am__CC in this case, + # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)" + CC="$am_aux_dir/compile $CC" +fi +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + +depcc="$CC" am_compiler_list= + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5 +$as_echo_n "checking dependency style of $depcc... " >&6; } +if ${am_cv_CC_dependencies_compiler_type+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then + # We make a subdir and do the tests there. Otherwise we can end up + # making bogus files that we don't know about and never remove. For + # instance it was reported that on HP-UX the gcc test will end up + # making a dummy file named 'D' -- because '-MD' means "put the output + # in D". + rm -rf conftest.dir + mkdir conftest.dir + # Copy depcomp to subdir because otherwise we won't find it if we're + # using a relative directory. + cp "$am_depcomp" conftest.dir + cd conftest.dir + # We will build objects and dependencies in a subdirectory because + # it helps to detect inapplicable dependency modes. For instance + # both Tru64's cc and ICC support -MD to output dependencies as a + # side effect of compilation, but ICC will put the dependencies in + # the current directory while Tru64 will put them in the object + # directory. + mkdir sub + + am_cv_CC_dependencies_compiler_type=none + if test "$am_compiler_list" = ""; then + am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` + fi + am__universal=false + case " $depcc " in #( + *\ -arch\ *\ -arch\ *) am__universal=true ;; + esac + + for depmode in $am_compiler_list; do + # Setup a source with many dependencies, because some compilers + # like to wrap large dependency lists on column 80 (with \), and + # we should not choose a depcomp mode which is confused by this. + # + # We need to recreate these files for each test, as the compiler may + # overwrite some of them when testing with obscure command lines. + # This happens at least with the AIX C compiler. + : > sub/conftest.c + for i in 1 2 3 4 5 6; do + echo '#include "conftst'$i'.h"' >> sub/conftest.c + # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with + # Solaris 10 /bin/sh. + echo '/* dummy */' > sub/conftst$i.h + done + echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf + + # We check with '-c' and '-o' for the sake of the "dashmstdout" + # mode. It turns out that the SunPro C++ compiler does not properly + # handle '-M -o', and we need to detect this. Also, some Intel + # versions had trouble with output in subdirs. + am__obj=sub/conftest.${OBJEXT-o} + am__minus_obj="-o $am__obj" + case $depmode in + gcc) + # This depmode causes a compiler race in universal mode. + test "$am__universal" = false || continue + ;; + nosideeffect) + # After this tag, mechanisms are not by side-effect, so they'll + # only be used when explicitly requested. + if test "x$enable_dependency_tracking" = xyes; then + continue + else + break + fi + ;; + msvc7 | msvc7msys | msvisualcpp | msvcmsys) + # This compiler won't grok '-c -o', but also, the minuso test has + # not run yet. These depmodes are late enough in the game, and + # so weak that their functioning should not be impacted. + am__obj=conftest.${OBJEXT-o} + am__minus_obj= + ;; + none) break ;; + esac + if depmode=$depmode \ + source=sub/conftest.c object=$am__obj \ + depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ + $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \ + >/dev/null 2>conftest.err && + grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && + grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && + grep $am__obj sub/conftest.Po > /dev/null 2>&1 && + ${MAKE-make} -s -f confmf > /dev/null 2>&1; then + # icc doesn't choke on unknown options, it will just issue warnings + # or remarks (even with -Werror). So we grep stderr for any message + # that says an option was ignored or not supported. + # When given -MP, icc 7.0 and 7.1 complain thusly: + # icc: Command line warning: ignoring option '-M'; no argument required + # The diagnosis changed in icc 8.0: + # icc: Command line remark: option '-MP' not supported + if (grep 'ignoring option' conftest.err || + grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else + am_cv_CC_dependencies_compiler_type=$depmode + break + fi + fi + done + + cd .. + rm -rf conftest.dir +else + am_cv_CC_dependencies_compiler_type=none +fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_CC_dependencies_compiler_type" >&5 +$as_echo "$am_cv_CC_dependencies_compiler_type" >&6; } +CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type + + if + test "x$enable_dependency_tracking" != xno \ + && test "$am_cv_CC_dependencies_compiler_type" = gcc3; then + am__fastdepCC_TRUE= + am__fastdepCC_FALSE='#' +else + am__fastdepCC_TRUE='#' + am__fastdepCC_FALSE= +fi + + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ln -s works" >&5 +$as_echo_n "checking whether ln -s works... " >&6; } +LN_S=$as_ln_s +if test "$LN_S" = "ln -s"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no, using $LN_S" >&5 +$as_echo "no, using $LN_S" >&6; } +fi + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a sed that does not truncate output" >&5 +$as_echo_n "checking for a sed that does not truncate output... " >&6; } +if ${ac_cv_path_SED+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_script=s/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb/ + for ac_i in 1 2 3 4 5 6 7; do + ac_script="$ac_script$as_nl$ac_script" + done + echo "$ac_script" 2>/dev/null | sed 99q >conftest.sed + { ac_script=; unset ac_script;} + if test -z "$SED"; then + ac_path_SED_found=false + # Loop through the user's path and test for each of PROGNAME-LIST + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_prog in sed gsed; do + for ac_exec_ext in '' $ac_executable_extensions; do + ac_path_SED="$as_dir/$ac_prog$ac_exec_ext" + as_fn_executable_p "$ac_path_SED" || continue +# Check for GNU ac_path_SED and select it if it is found. + # Check for GNU $ac_path_SED +case `"$ac_path_SED" --version 2>&1` in +*GNU*) + ac_cv_path_SED="$ac_path_SED" ac_path_SED_found=:;; +*) + ac_count=0 + $as_echo_n 0123456789 >"conftest.in" + while : + do + cat "conftest.in" "conftest.in" >"conftest.tmp" + mv "conftest.tmp" "conftest.in" + cp "conftest.in" "conftest.nl" + $as_echo '' >> "conftest.nl" + "$ac_path_SED" -f conftest.sed < "conftest.nl" >"conftest.out" 2>/dev/null || break + diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break + as_fn_arith $ac_count + 1 && ac_count=$as_val + if test $ac_count -gt ${ac_path_SED_max-0}; then + # Best one so far, save it but keep looking for a better one + ac_cv_path_SED="$ac_path_SED" + ac_path_SED_max=$ac_count + fi + # 10*(2^10) chars as input seems more than enough + test $ac_count -gt 10 && break + done + rm -f conftest.in conftest.tmp conftest.nl conftest.out;; +esac + + $ac_path_SED_found && break 3 + done + done + done +IFS=$as_save_IFS + if test -z "$ac_cv_path_SED"; then + as_fn_error $? "no acceptable sed could be found in \$PATH" "$LINENO" 5 + fi +else + ac_cv_path_SED=$SED +fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_SED" >&5 +$as_echo "$ac_cv_path_SED" >&6; } + SED="$ac_cv_path_SED" + rm -f conftest.sed + + + + + + + + +if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}pkg-config", so it can be a program name with args. +set dummy ${ac_tool_prefix}pkg-config; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_path_PKG_CONFIG+:} false; then : + $as_echo_n "(cached) " >&6 +else + case $PKG_CONFIG in + [\\/]* | ?:[\\/]*) + ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + + ;; +esac +fi +PKG_CONFIG=$ac_cv_path_PKG_CONFIG +if test -n "$PKG_CONFIG"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PKG_CONFIG" >&5 +$as_echo "$PKG_CONFIG" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_path_PKG_CONFIG"; then + ac_pt_PKG_CONFIG=$PKG_CONFIG + # Extract the first word of "pkg-config", so it can be a program name with args. +set dummy pkg-config; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_path_ac_pt_PKG_CONFIG+:} false; then : + $as_echo_n "(cached) " >&6 +else + case $ac_pt_PKG_CONFIG in + [\\/]* | ?:[\\/]*) + ac_cv_path_ac_pt_PKG_CONFIG="$ac_pt_PKG_CONFIG" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_path_ac_pt_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + + ;; +esac +fi +ac_pt_PKG_CONFIG=$ac_cv_path_ac_pt_PKG_CONFIG +if test -n "$ac_pt_PKG_CONFIG"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_pt_PKG_CONFIG" >&5 +$as_echo "$ac_pt_PKG_CONFIG" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_pt_PKG_CONFIG" = x; then + PKG_CONFIG="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + PKG_CONFIG=$ac_pt_PKG_CONFIG + fi +else + PKG_CONFIG="$ac_cv_path_PKG_CONFIG" +fi + +fi +if test -n "$PKG_CONFIG"; then + _pkg_min_version=0.9.0 + { $as_echo "$as_me:${as_lineno-$LINENO}: checking pkg-config is at least version $_pkg_min_version" >&5 +$as_echo_n "checking pkg-config is at least version $_pkg_min_version... " >&6; } + if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + PKG_CONFIG="" + fi +fi +alsa_save_CFLAGS="$CFLAGS" +alsa_save_LDFLAGS="$LDFLAGS" +alsa_save_LIBS="$LIBS" +alsa_found=yes +alsa_topology_found=no + + +# Check whether --with-alsa-prefix was given. +if test "${with_alsa_prefix+set}" = set; then : + withval=$with_alsa_prefix; alsa_prefix="$withval" +else + alsa_prefix="" +fi + + + +# Check whether --with-alsa-inc-prefix was given. +if test "${with_alsa_inc_prefix+set}" = set; then : + withval=$with_alsa_inc_prefix; alsa_inc_prefix="$withval" +else + alsa_inc_prefix="" +fi + + +# Check whether --enable-alsa-topology was given. +if test "${enable_alsa_topology+set}" = set; then : + enableval=$enable_alsa_topology; enable_atopology="$enableval" +else + enable_atopology=no +fi + + +# Check whether --enable-alsatest was given. +if test "${enable_alsatest+set}" = set; then : + enableval=$enable_alsatest; enable_alsatest="$enableval" +else + enable_alsatest=yes +fi + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ALSA CFLAGS" >&5 +$as_echo_n "checking for ALSA CFLAGS... " >&6; } +if test "$alsa_inc_prefix" != "" ; then + ALSA_CFLAGS="$ALSA_CFLAGS -I$alsa_inc_prefix" + CFLAGS="$CFLAGS -I$alsa_inc_prefix" +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ALSA_CFLAGS" >&5 +$as_echo "$ALSA_CFLAGS" >&6; } + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -lc" >&5 +$as_echo_n "checking for dlopen in -lc... " >&6; } +if ${ac_cv_lib_c_dlopen+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lc $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char dlopen (); +int +main () +{ +return dlopen (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_c_dlopen=yes +else + ac_cv_lib_c_dlopen=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_c_dlopen" >&5 +$as_echo "$ac_cv_lib_c_dlopen" >&6; } +if test "x$ac_cv_lib_c_dlopen" = xyes; then : + LIBDL="" +else + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5 +$as_echo_n "checking for dlopen in -ldl... " >&6; } +if ${ac_cv_lib_dl_dlopen+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-ldl $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char dlopen (); +int +main () +{ +return dlopen (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_dl_dlopen=yes +else + ac_cv_lib_dl_dlopen=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5 +$as_echo "$ac_cv_lib_dl_dlopen" >&6; } +if test "x$ac_cv_lib_dl_dlopen" = xyes; then : + LIBDL="-ldl" +fi + +fi + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ALSA LDFLAGS" >&5 +$as_echo_n "checking for ALSA LDFLAGS... " >&6; } +if test "$alsa_prefix" != "" ; then + ALSA_LIBS="$ALSA_LIBS -L$alsa_prefix" + LDFLAGS="$LDFLAGS $ALSA_LIBS" +fi + +ALSA_LIBS="$ALSA_LIBS -lasound -lm $LIBDL -lpthread" +LIBS="$ALSA_LIBS $LIBS" +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ALSA_LIBS" >&5 +$as_echo "$ALSA_LIBS" >&6; } + +if test "x$enable_alsatest" = "xyes"; then + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking required libasound headers version" >&5 +$as_echo_n "checking required libasound headers version... " >&6; } +min_alsa_version=1.0.27 +no_alsa="" + alsa_min_major_version=`echo $min_alsa_version | \ + sed 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)/\1/'` + alsa_min_minor_version=`echo $min_alsa_version | \ + sed 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)/\2/'` + alsa_min_micro_version=`echo $min_alsa_version | \ + sed 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)/\3/'` +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $alsa_min_major_version.$alsa_min_minor_version.$alsa_min_micro_version" >&5 +$as_echo "$alsa_min_major_version.$alsa_min_minor_version.$alsa_min_micro_version" >&6; } + + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for libasound headers version >= $alsa_min_major_version.$alsa_min_minor_version.$alsa_min_micro_version ($min_alsa_version)" >&5 +$as_echo_n "checking for libasound headers version >= $alsa_min_major_version.$alsa_min_minor_version.$alsa_min_micro_version ($min_alsa_version)... " >&6; } +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include + +int +main () +{ + +/* ensure backward compatibility */ +#if !defined(SND_LIB_MAJOR) && defined(SOUNDLIB_VERSION_MAJOR) +#define SND_LIB_MAJOR SOUNDLIB_VERSION_MAJOR +#endif +#if !defined(SND_LIB_MINOR) && defined(SOUNDLIB_VERSION_MINOR) +#define SND_LIB_MINOR SOUNDLIB_VERSION_MINOR +#endif +#if !defined(SND_LIB_SUBMINOR) && defined(SOUNDLIB_VERSION_SUBMINOR) +#define SND_LIB_SUBMINOR SOUNDLIB_VERSION_SUBMINOR +#endif + +# if(SND_LIB_MAJOR > $alsa_min_major_version) + exit(0); +# else +# if(SND_LIB_MAJOR < $alsa_min_major_version) +# error not present +# endif + +# if(SND_LIB_MINOR > $alsa_min_minor_version) + exit(0); +# else +# if(SND_LIB_MINOR < $alsa_min_minor_version) +# error not present +# endif + +# if(SND_LIB_SUBMINOR < $alsa_min_micro_version) +# error not present +# endif +# endif +# endif +exit(0); + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: result: found." >&5 +$as_echo "found." >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: not present." >&5 +$as_echo "not present." >&6; } + as_fn_error $? "Sufficiently new version of libasound not found." "$LINENO" 5 + alsa_found=no + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for libatopology (sound headers version > 1.1.9)" >&5 +$as_echo_n "checking for libatopology (sound headers version > 1.1.9)... " >&6; } +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include +#include + +int +main () +{ + +/* ensure backward compatibility */ +#if !defined(SND_LIB_VERSION) +#define SND_LIB_VERSION 0 +#endif +#if SND_LIB_VERSION > 0x00010109 + exit(0); +#else +# error not present +#endif +exit(0); + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + enable_atopology="yes" +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + +fi + +if test "x$enable_alsatest" = "xyes"; then +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for snd_ctl_open in -lasound" >&5 +$as_echo_n "checking for snd_ctl_open in -lasound... " >&6; } +if ${ac_cv_lib_asound_snd_ctl_open+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lasound $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char snd_ctl_open (); +int +main () +{ +return snd_ctl_open (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_asound_snd_ctl_open=yes +else + ac_cv_lib_asound_snd_ctl_open=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_asound_snd_ctl_open" >&5 +$as_echo "$ac_cv_lib_asound_snd_ctl_open" >&6; } +if test "x$ac_cv_lib_asound_snd_ctl_open" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_LIBASOUND 1 +_ACEOF + + LIBS="-lasound $LIBS" + +else + as_fn_error $? "No linkable libasound was found." "$LINENO" 5 + alsa_found=no + +fi + +if test "x$enable_atopology" = "xyes"; then +alsa_topology_found=yes +alsa_save_LIBS2="$LIBS" +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for snd_tplg_new in -latopology" >&5 +$as_echo_n "checking for snd_tplg_new in -latopology... " >&6; } +if ${ac_cv_lib_atopology_snd_tplg_new+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-latopology $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char snd_tplg_new (); +int +main () +{ +return snd_tplg_new (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_atopology_snd_tplg_new=yes +else + ac_cv_lib_atopology_snd_tplg_new=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_atopology_snd_tplg_new" >&5 +$as_echo "$ac_cv_lib_atopology_snd_tplg_new" >&6; } +if test "x$ac_cv_lib_atopology_snd_tplg_new" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_LIBATOPOLOGY 1 +_ACEOF + + LIBS="-latopology $LIBS" + +else + as_fn_error $? "No linkable libatopology was found." "$LINENO" 5 + alsa_topology_found=no, + + +fi + +LIBS="$alsa_save_LIBS2" +fi +else +if test "x$enable_atopology" = "xyes"; then + alsa_topology_found=yes +fi +fi + +if test "x$alsa_found" = "xyes" ; then + : + LIBS=`echo $LIBS | sed 's/-lasound//g'` + LIBS=`echo $LIBS | sed 's/ //'` + LIBS="-lasound $LIBS" +fi +if test "x$alsa_found" = "xno" ; then + : + CFLAGS="$alsa_save_CFLAGS" + LDFLAGS="$alsa_save_LDFLAGS" + LIBS="$alsa_save_LIBS" + ALSA_CFLAGS="" + ALSA_LIBS="" + ALSA_TOPOLOGY_LIBS="" +fi + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ALSA topology LDFLAGS" >&5 +$as_echo_n "checking for ALSA topology LDFLAGS... " >&6; } +if test "x$alsa_topology_found" = "xyes"; then + ALSA_TOPOLOGY_LIBS="$ALSA_TOPOLOGY_LIBS -latopology" +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ALSA_TOPOLOGY_LIBS" >&5 +$as_echo "$ALSA_TOPOLOGY_LIBS" >&6; } + + + + + +if test "x$enable_alsatest" = "xyes"; then +ac_fn_c_check_func "$LINENO" "snd_ctl_elem_add_enumerated" "ac_cv_func_snd_ctl_elem_add_enumerated" +if test "x$ac_cv_func_snd_ctl_elem_add_enumerated" = xyes; then : + +else + as_fn_error $? "No user enum control support in alsa-lib" "$LINENO" 5 +fi + +fi + +for ac_header in alsa/pcm.h +do : + ac_fn_c_check_header_compile "$LINENO" "alsa/pcm.h" "ac_cv_header_alsa_pcm_h" "#include +" +if test "x$ac_cv_header_alsa_pcm_h" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_ALSA_PCM_H 1 +_ACEOF + have_pcm="yes" +else + have_pcm="no" +fi + +done + +for ac_header in alsa/mixer.h +do : + ac_fn_c_check_header_compile "$LINENO" "alsa/mixer.h" "ac_cv_header_alsa_mixer_h" "#include +" +if test "x$ac_cv_header_alsa_mixer_h" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_ALSA_MIXER_H 1 +_ACEOF + have_mixer="yes" +else + have_mixer="no" +fi + +done + +for ac_header in alsa/rawmidi.h +do : + ac_fn_c_check_header_compile "$LINENO" "alsa/rawmidi.h" "ac_cv_header_alsa_rawmidi_h" "#include +" +if test "x$ac_cv_header_alsa_rawmidi_h" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_ALSA_RAWMIDI_H 1 +_ACEOF + have_rawmidi="yes" +else + have_rawmidi="no" +fi + +done + +for ac_header in alsa/seq.h +do : + ac_fn_c_check_header_compile "$LINENO" "alsa/seq.h" "ac_cv_header_alsa_seq_h" "#include +" +if test "x$ac_cv_header_alsa_seq_h" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_ALSA_SEQ_H 1 +_ACEOF + have_seq="yes" +else + have_seq="no" +fi + +done + +for ac_header in alsa/use-case.h +do : + ac_fn_c_check_header_compile "$LINENO" "alsa/use-case.h" "ac_cv_header_alsa_use_case_h" "#include +" +if test "x$ac_cv_header_alsa_use_case_h" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_ALSA_USE_CASE_H 1 +_ACEOF + have_ucm="yes" +else + have_ucm="no" +fi + +done + +for ac_header in alsa/topology.h +do : + ac_fn_c_check_header_compile "$LINENO" "alsa/topology.h" "ac_cv_header_alsa_topology_h" "#include +" +if test "x$ac_cv_header_alsa_topology_h" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_ALSA_TOPOLOGY_H 1 +_ACEOF + have_topology="yes" +else + have_topology="no" +fi + +done + +for ac_header in samplerate.h +do : + ac_fn_c_check_header_compile "$LINENO" "samplerate.h" "ac_cv_header_samplerate_h" "#include +" +if test "x$ac_cv_header_samplerate_h" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_SAMPLERATE_H 1 +_ACEOF + have_samplerate="yes" +else + have_samplerate="no" +fi + +done + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for snd_seq_client_info_get_card in -lasound" >&5 +$as_echo_n "checking for snd_seq_client_info_get_card in -lasound... " >&6; } +if ${ac_cv_lib_asound_snd_seq_client_info_get_card+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lasound $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char snd_seq_client_info_get_card (); +int +main () +{ +return snd_seq_client_info_get_card (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_asound_snd_seq_client_info_get_card=yes +else + ac_cv_lib_asound_snd_seq_client_info_get_card=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_asound_snd_seq_client_info_get_card" >&5 +$as_echo "$ac_cv_lib_asound_snd_seq_client_info_get_card" >&6; } +if test "x$ac_cv_lib_asound_snd_seq_client_info_get_card" = xyes; then : + HAVE_SEQ_CLIENT_INFO_GET_CARD="yes" +fi + +if test "$HAVE_SEQ_CLIENT_INFO_GET_CARD" = "yes" ; then + +$as_echo "#define HAVE_SEQ_CLIENT_INFO_GET_CARD 1" >>confdefs.h + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for snd_seq_client_info_get_pid in -lasound" >&5 +$as_echo_n "checking for snd_seq_client_info_get_pid in -lasound... " >&6; } +if ${ac_cv_lib_asound_snd_seq_client_info_get_pid+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lasound $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char snd_seq_client_info_get_pid (); +int +main () +{ +return snd_seq_client_info_get_pid (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_asound_snd_seq_client_info_get_pid=yes +else + ac_cv_lib_asound_snd_seq_client_info_get_pid=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_asound_snd_seq_client_info_get_pid" >&5 +$as_echo "$ac_cv_lib_asound_snd_seq_client_info_get_pid" >&6; } +if test "x$ac_cv_lib_asound_snd_seq_client_info_get_pid" = xyes; then : + HAVE_SEQ_CLIENT_INFO_GET_PID="yes" +fi + +if test "$HAVE_SEQ_CLIENT_INFO_GET_PID" = "yes" ; then + +$as_echo "#define HAVE_SEQ_CLIENT_INFO_GET_PID 1" >>confdefs.h + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for snd_tplg_save in -latopology" >&5 +$as_echo_n "checking for snd_tplg_save in -latopology... " >&6; } +if ${ac_cv_lib_atopology_snd_tplg_save+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-latopology $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char snd_tplg_save (); +int +main () +{ +return snd_tplg_save (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_atopology_snd_tplg_save=yes +else + ac_cv_lib_atopology_snd_tplg_save=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_atopology_snd_tplg_save" >&5 +$as_echo "$ac_cv_lib_atopology_snd_tplg_save" >&6; } +if test "x$ac_cv_lib_atopology_snd_tplg_save" = xyes; then : + have_topology="yes" +else + have_topology="no" +fi + + +# +# NOTE: The library 'libffado' (at least v2.4.1) executes ctor/dtor of instances +# for some objects in startup/finish routines of C runtime. As a result, it +# outputs some superfluos messages. Furthermore, it brings much memory leak +# internally. Totally, libffado support is not recommended at all in usual +# purposes except for technical preview. +# +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ffado_streaming_init in -lffado" >&5 +$as_echo_n "checking for ffado_streaming_init in -lffado... " >&6; } +if ${ac_cv_lib_ffado_ffado_streaming_init+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lffado $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char ffado_streaming_init (); +int +main () +{ +return ffado_streaming_init (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_ffado_ffado_streaming_init=yes +else + ac_cv_lib_ffado_ffado_streaming_init=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_ffado_ffado_streaming_init" >&5 +$as_echo "$ac_cv_lib_ffado_ffado_streaming_init" >&6; } +if test "x$ac_cv_lib_ffado_ffado_streaming_init" = xyes; then : + have_ffado="yes" +else + have_ffado="no" +fi + +if test x"$have_ffado" = xyes; then : + +$as_echo "#define WITH_FFADO 1" >>confdefs.h + +fi + + if test "$have_pcm" = "yes"; then + HAVE_PCM_TRUE= + HAVE_PCM_FALSE='#' +else + HAVE_PCM_TRUE='#' + HAVE_PCM_FALSE= +fi + + if test "$have_mixer" = "yes"; then + HAVE_MIXER_TRUE= + HAVE_MIXER_FALSE='#' +else + HAVE_MIXER_TRUE='#' + HAVE_MIXER_FALSE= +fi + + if test "$have_rawmidi" = "yes"; then + HAVE_RAWMIDI_TRUE= + HAVE_RAWMIDI_FALSE='#' +else + HAVE_RAWMIDI_TRUE='#' + HAVE_RAWMIDI_FALSE= +fi + + if test "$have_seq" = "yes"; then + HAVE_SEQ_TRUE= + HAVE_SEQ_FALSE='#' +else + HAVE_SEQ_TRUE='#' + HAVE_SEQ_FALSE= +fi + + if test "$have_ucm" = "yes"; then + HAVE_UCM_TRUE= + HAVE_UCM_FALSE='#' +else + HAVE_UCM_TRUE='#' + HAVE_UCM_FALSE= +fi + + if test "$have_topology" = "yes"; then + HAVE_TOPOLOGY_TRUE= + HAVE_TOPOLOGY_FALSE='#' +else + HAVE_TOPOLOGY_TRUE='#' + HAVE_TOPOLOGY_FALSE= +fi + + if test "$have_samplerate" = "yes"; then + HAVE_SAMPLERATE_TRUE= + HAVE_SAMPLERATE_FALSE='#' +else + HAVE_SAMPLERATE_TRUE='#' + HAVE_SAMPLERATE_FALSE= +fi + + if test "$have_ffado" = "yes"; then + HAVE_FFADO_TRUE= + HAVE_FFADO_FALSE='#' +else + HAVE_FFADO_TRUE='#' + HAVE_FFADO_FALSE= +fi + + +alsabat_backend_tiny= +# Check whether --enable-alsabat_backend_tiny was given. +if test "${enable_alsabat_backend_tiny+set}" = set; then : + enableval=$enable_alsabat_backend_tiny; case "${enableval}" in + yes) alsabat_backend_tiny=true ;; + no) alsabat_backend_tiny=false ;; + *) as_fn_error $? "bad value ${enableval} for --enable-alsabat-backend-tiny" "$LINENO" 5 ;; + esac +else + alsabat_backend_tiny=false +fi + + +bat= +if test "$have_pcm" = "yes"; then +# Check whether --enable-bat was given. +if test "${enable_bat+set}" = set; then : + enableval=$enable_bat; case "${enableval}" in + yes) bat=true ;; + no) bat=false ;; + *) as_fn_error $? "bad value ${enableval} for --enable-bat" "$LINENO" 5 ;; + esac +else + bat=true +fi + +fi + if test x$bat = xtrue; then + BAT_TRUE= + BAT_FALSE='#' +else + BAT_TRUE='#' + BAT_FALSE= +fi + + +if test x$bat = xtrue; then + + saved_CFLAGS="$CFLAGS" + saved_LDFLAGS="$LDFLAGS" + saved_LIBS="$LIBS" + FFTW_INC="" + FFTW_LIB="" + FFTW_CFLAGS="" + have_libfftw3="yes" + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for fftwf_malloc in -lfftw3f" >&5 +$as_echo_n "checking for fftwf_malloc in -lfftw3f... " >&6; } +if ${ac_cv_lib_fftw3f_fftwf_malloc+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lfftw3f $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char fftwf_malloc (); +int +main () +{ +return fftwf_malloc (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_fftw3f_fftwf_malloc=yes +else + ac_cv_lib_fftw3f_fftwf_malloc=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_fftw3f_fftwf_malloc" >&5 +$as_echo "$ac_cv_lib_fftw3f_fftwf_malloc" >&6; } +if test "x$ac_cv_lib_fftw3f_fftwf_malloc" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_LIBFFTW3F 1 +_ACEOF + + LIBS="-lfftw3f $LIBS" + +else + have_libfftw3="no" +fi + + have_libtinyalsa= + if test x$alsabat_backend_tiny = xtrue; then + have_libtinyalsa="yes" + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pcm_open in -ltinyalsa" >&5 +$as_echo_n "checking for pcm_open in -ltinyalsa... " >&6; } +if ${ac_cv_lib_tinyalsa_pcm_open+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-ltinyalsa $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char pcm_open (); +int +main () +{ +return pcm_open (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_tinyalsa_pcm_open=yes +else + ac_cv_lib_tinyalsa_pcm_open=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_tinyalsa_pcm_open" >&5 +$as_echo "$ac_cv_lib_tinyalsa_pcm_open" >&6; } +if test "x$ac_cv_lib_tinyalsa_pcm_open" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_LIBTINYALSA 1 +_ACEOF + + LIBS="-ltinyalsa $LIBS" + +else + have_libtinyalsa="no" +fi + + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for sqrtf in -lm" >&5 +$as_echo_n "checking for sqrtf in -lm... " >&6; } +if ${ac_cv_lib_m_sqrtf+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lm $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char sqrtf (); +int +main () +{ +return sqrtf (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_m_sqrtf=yes +else + ac_cv_lib_m_sqrtf=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_m_sqrtf" >&5 +$as_echo "$ac_cv_lib_m_sqrtf" >&6; } +if test "x$ac_cv_lib_m_sqrtf" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_LIBM 1 +_ACEOF + + LIBS="-lm $LIBS" + +else + as_fn_error $? "Error: Need sqrtf" "$LINENO" 5 +fi + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread_create in -lpthread" >&5 +$as_echo_n "checking for pthread_create in -lpthread... " >&6; } +if ${ac_cv_lib_pthread_pthread_create+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lpthread $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char pthread_create (); +int +main () +{ +return pthread_create (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_pthread_pthread_create=yes +else + ac_cv_lib_pthread_pthread_create=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_pthread_pthread_create" >&5 +$as_echo "$ac_cv_lib_pthread_pthread_create" >&6; } +if test "x$ac_cv_lib_pthread_pthread_create" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_LIBPTHREAD 1 +_ACEOF + + LIBS="-lpthread $LIBS" + +else + as_fn_error $? "Error: need PTHREAD library" "$LINENO" 5 +fi + + FFTW_CFLAGS="$CFLAGS" + FFTW_LIB="$LIBS" + CFLAGS="$saved_CFLAGS" + LDFLAGS="$saved_LDFLAGS" + LIBS="$saved_LIBS" + + + + +fi + if test "$have_libfftw3" = "yes"; then + HAVE_LIBFFTW3_TRUE= + HAVE_LIBFFTW3_FALSE='#' +else + HAVE_LIBFFTW3_TRUE='#' + HAVE_LIBFFTW3_FALSE= +fi + + if test "$have_libtinyalsa" = "yes"; then + HAVE_LIBTINYALSA_TRUE= + HAVE_LIBTINYALSA_FALSE='#' +else + HAVE_LIBTINYALSA_TRUE='#' + HAVE_LIBTINYALSA_FALSE= +fi + + +LIBRT="" +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for librt" >&5 +$as_echo_n "checking for librt... " >&6; } + +# Check whether --with-librt was given. +if test "${with_librt+set}" = set; then : + withval=$with_librt; have_librt="$withval" +else + have_librt="yes" +fi + +if test "$have_librt" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for clock_gettime in -lrt" >&5 +$as_echo_n "checking for clock_gettime in -lrt... " >&6; } +if ${ac_cv_lib_rt_clock_gettime+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lrt $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char clock_gettime (); +int +main () +{ +return clock_gettime (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_rt_clock_gettime=yes +else + ac_cv_lib_rt_clock_gettime=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_rt_clock_gettime" >&5 +$as_echo "$ac_cv_lib_rt_clock_gettime" >&6; } +if test "x$ac_cv_lib_rt_clock_gettime" = xyes; then : + HAVE_LIBRT="yes" +fi + + if test "$HAVE_LIBRT" = "yes" ; then + LIBRT="-lrt" + +$as_echo "#define HAVE_LIBRT 1" >>confdefs.h + + +$as_echo "#define HAVE_CLOCK_GETTIME 1" >>confdefs.h + + fi +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + +CURSESINC="" +CURSESLIB="" +CURSES_CFLAGS="" +alsamixer= +if test "$have_mixer" = "yes"; then +# Check whether --enable-alsamixer was given. +if test "${enable_alsamixer+set}" = set; then : + enableval=$enable_alsamixer; case "${enableval}" in + yes) alsamixer=true ;; + no) alsamixer=false ;; + *) as_fn_error $? "bad value ${enableval} for --enable-alsamixer" "$LINENO" 5 ;; + esac +else + alsamixer=true +fi + +fi + if test x$alsamixer = xtrue; then + ALSAMIXER_TRUE= + ALSAMIXER_FALSE='#' +else + ALSAMIXER_TRUE='#' + ALSAMIXER_FALSE= +fi + + +# Check whether --enable-alsaconf was given. +if test "${enable_alsaconf+set}" = set; then : + enableval=$enable_alsaconf; case "${enableval}" in + yes) alsaconf=true ;; + no) alsaconf=false ;; + *) as_fn_error $? "bad value ${enableval} for --enable-alsaconf" "$LINENO" 5 ;; + esac +else + alsaconf=true +fi + + if test x$alsaconf = xtrue; then + ALSACONF_TRUE= + ALSACONF_FALSE='#' +else + ALSACONF_TRUE='#' + ALSACONF_FALSE= +fi + + +# Check whether --enable-alsaloop was given. +if test "${enable_alsaloop+set}" = set; then : + enableval=$enable_alsaloop; case "${enableval}" in + yes) alsaloop=true ;; + no) alsaloop=false ;; + *) as_fn_error $? "bad value ${enableval} for --enable-alsaloop" "$LINENO" 5 ;; + esac +else + alsaloop=true +fi + + if test x$alsaloop = xtrue; then + ALSALOOP_TRUE= + ALSALOOP_FALSE='#' +else + ALSALOOP_TRUE='#' + ALSALOOP_FALSE= +fi + + +xmlto_available="" +# Check whether --enable-xmlto was given. +if test "${enable_xmlto+set}" = set; then : + enableval=$enable_xmlto; xmlto="$enableval" +else + xmlto="yes" +fi + +if test "$xmlto" = "yes"; then + # Extract the first word of "xmlto", so it can be a program name with args. +set dummy xmlto; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_xmlto_available+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$xmlto_available"; then + ac_cv_prog_xmlto_available="$xmlto_available" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_xmlto_available="yes" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +xmlto_available=$ac_cv_prog_xmlto_available +if test -n "$xmlto_available"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $xmlto_available" >&5 +$as_echo "$xmlto_available" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi + if test x"$xmlto_available" = xyes; then + USE_XMLTO_TRUE= + USE_XMLTO_FALSE='#' +else + USE_XMLTO_TRUE='#' + USE_XMLTO_FALSE= +fi + + +rst2man_available="" +# Check whether --enable-rst2man was given. +if test "${enable_rst2man+set}" = set; then : + enableval=$enable_rst2man; rst2man="$enableval" +else + rst2man="yes" +fi + +if test "$rst2man" = "yes"; then + # Extract the first word of "rst2man", so it can be a program name with args. +set dummy rst2man; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_rst2man_available+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$rst2man_available"; then + ac_cv_prog_rst2man_available="$rst2man_available" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_rst2man_available="yes" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +rst2man_available=$ac_cv_prog_rst2man_available +if test -n "$rst2man_available"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $rst2man_available" >&5 +$as_echo "$rst2man_available" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi + if test x"$rst2man_available" = xyes; then + USE_RST2MAN_TRUE= + USE_RST2MAN_FALSE='#' +else + USE_RST2MAN_TRUE='#' + USE_RST2MAN_FALSE= +fi + + + +# Check whether --with-udev-rules-dir was given. +if test "${with_udev_rules_dir+set}" = set; then : + withval=$with_udev_rules_dir; udevrulesdir="$withval" +else + udevdir=$($PKG_CONFIG udev --variable=udevdir) + if test "x$udevdir" = "x"; then + udevrulesdir="/lib/udev/rules.d" + else + udevrulesdir="$udevdir/rules.d" + fi +fi + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5 +$as_echo_n "checking for ANSI C header files... " >&6; } +if ${ac_cv_header_stdc+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +#include +#include +#include + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_header_stdc=yes +else + ac_cv_header_stdc=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + +if test $ac_cv_header_stdc = yes; then + # SunOS 4.x string.h does not declare mem*, contrary to ANSI. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "memchr" >/dev/null 2>&1; then : + +else + ac_cv_header_stdc=no +fi +rm -f conftest* + +fi + +if test $ac_cv_header_stdc = yes; then + # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "free" >/dev/null 2>&1; then : + +else + ac_cv_header_stdc=no +fi +rm -f conftest* + +fi + +if test $ac_cv_header_stdc = yes; then + # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. + if test "$cross_compiling" = yes; then : + : +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +#include +#if ((' ' & 0x0FF) == 0x020) +# define ISLOWER(c) ('a' <= (c) && (c) <= 'z') +# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) +#else +# define ISLOWER(c) \ + (('a' <= (c) && (c) <= 'i') \ + || ('j' <= (c) && (c) <= 'r') \ + || ('s' <= (c) && (c) <= 'z')) +# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) +#endif + +#define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) +int +main () +{ + int i; + for (i = 0; i < 256; i++) + if (XOR (islower (i), ISLOWER (i)) + || toupper (i) != TOUPPER (i)) + return 2; + return 0; +} +_ACEOF +if ac_fn_c_try_run "$LINENO"; then : + +else + ac_cv_header_stdc=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + +fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5 +$as_echo "$ac_cv_header_stdc" >&6; } +if test $ac_cv_header_stdc = yes; then + +$as_echo "#define STDC_HEADERS 1" >>confdefs.h + +fi + +if test x$alsamixer = xtrue; then + +# Check whether --with-curses was given. +if test "${with_curses+set}" = set; then : + withval=$with_curses; curseslib="$withval" +else + curseslib="auto" +fi + + CURSESLIBDIR="" + NCURSESLIBSUFFIX="" + CURSES_NLS="no" + if test "$curseslib" = "ncursesw" -o \( "$curseslib" = "auto" -a "$USE_NLS" = "yes" \); then + +pkg_failed=no +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for NCURSESW" >&5 +$as_echo_n "checking for NCURSESW... " >&6; } + +if test -n "$NCURSESW_CFLAGS"; then + pkg_cv_NCURSESW_CFLAGS="$NCURSESW_CFLAGS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"ncursesw\""; } >&5 + ($PKG_CONFIG --exists --print-errors "ncursesw") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_NCURSESW_CFLAGS=`$PKG_CONFIG --cflags "ncursesw" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi +if test -n "$NCURSESW_LIBS"; then + pkg_cv_NCURSESW_LIBS="$NCURSESW_LIBS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"ncursesw\""; } >&5 + ($PKG_CONFIG --exists --print-errors "ncursesw") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_NCURSESW_LIBS=`$PKG_CONFIG --libs "ncursesw" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi + + + +if test $pkg_failed = yes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then + _pkg_short_errors_supported=yes +else + _pkg_short_errors_supported=no +fi + if test $_pkg_short_errors_supported = yes; then + NCURSESW_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "ncursesw" 2>&1` + else + NCURSESW_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "ncursesw" 2>&1` + fi + # Put the nasty error message in config.log where it belongs + echo "$NCURSESW_PKG_ERRORS" >&5 + + + # Extract the first word of "ncursesw5-config", so it can be a program name with args. +set dummy ncursesw5-config; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ncursesw5_config+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ncursesw5_config"; then + ac_cv_prog_ncursesw5_config="$ncursesw5_config" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ncursesw5_config="yes" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ncursesw5_config=$ac_cv_prog_ncursesw5_config +if test -n "$ncursesw5_config"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ncursesw5_config" >&5 +$as_echo "$ncursesw5_config" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + if test "$ncursesw5_config" = "yes"; then + CURSESINC="" + CURSESLIB=`ncursesw5-config --libs` + CURSESLIBDIR=`ncursesw5-config --libdir` + CURSES_CFLAGS=`ncursesw5-config --cflags` + curseslib="ncursesw" + else + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for initscr in -lncursesw" >&5 +$as_echo_n "checking for initscr in -lncursesw... " >&6; } +if ${ac_cv_lib_ncursesw_initscr+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lncursesw $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char initscr (); +int +main () +{ +return initscr (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_ncursesw_initscr=yes +else + ac_cv_lib_ncursesw_initscr=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_ncursesw_initscr" >&5 +$as_echo "$ac_cv_lib_ncursesw_initscr" >&6; } +if test "x$ac_cv_lib_ncursesw_initscr" = xyes; then : + CURSESINC=''; CURSESLIB='-lncursesw'; curseslib="ncursesw" +fi + + fi + +elif test $pkg_failed = untried; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + + # Extract the first word of "ncursesw5-config", so it can be a program name with args. +set dummy ncursesw5-config; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ncursesw5_config+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ncursesw5_config"; then + ac_cv_prog_ncursesw5_config="$ncursesw5_config" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ncursesw5_config="yes" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ncursesw5_config=$ac_cv_prog_ncursesw5_config +if test -n "$ncursesw5_config"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ncursesw5_config" >&5 +$as_echo "$ncursesw5_config" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + if test "$ncursesw5_config" = "yes"; then + CURSESINC="" + CURSESLIB=`ncursesw5-config --libs` + CURSESLIBDIR=`ncursesw5-config --libdir` + CURSES_CFLAGS=`ncursesw5-config --cflags` + curseslib="ncursesw" + else + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for initscr in -lncursesw" >&5 +$as_echo_n "checking for initscr in -lncursesw... " >&6; } +if ${ac_cv_lib_ncursesw_initscr+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lncursesw $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char initscr (); +int +main () +{ +return initscr (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_ncursesw_initscr=yes +else + ac_cv_lib_ncursesw_initscr=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_ncursesw_initscr" >&5 +$as_echo "$ac_cv_lib_ncursesw_initscr" >&6; } +if test "x$ac_cv_lib_ncursesw_initscr" = xyes; then : + CURSESINC=''; CURSESLIB='-lncursesw'; curseslib="ncursesw" +fi + + fi + +else + NCURSESW_CFLAGS=$pkg_cv_NCURSESW_CFLAGS + NCURSESW_LIBS=$pkg_cv_NCURSESW_LIBS + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + + CURSESINC="" + CURSESLIB="${NCURSESW_LIBS}" + CURSESLIBDIR= + CURSES_CFLAGS="${NCURSESW_CFLAGS}" + curseslib="ncursesw" + +fi + if test -n "$CURSESINC"; then + NCURSESLIBSUFFIX="w" + CURSES_NLS="yes" + fi + fi + if test "$curseslib" = "ncurses" -o "$curseslib" = "auto"; then + +pkg_failed=no +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for NCURSES" >&5 +$as_echo_n "checking for NCURSES... " >&6; } + +if test -n "$NCURSES_CFLAGS"; then + pkg_cv_NCURSES_CFLAGS="$NCURSES_CFLAGS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"ncurses\""; } >&5 + ($PKG_CONFIG --exists --print-errors "ncurses") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_NCURSES_CFLAGS=`$PKG_CONFIG --cflags "ncurses" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi +if test -n "$NCURSES_LIBS"; then + pkg_cv_NCURSES_LIBS="$NCURSES_LIBS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"ncurses\""; } >&5 + ($PKG_CONFIG --exists --print-errors "ncurses") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_NCURSES_LIBS=`$PKG_CONFIG --libs "ncurses" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi + + + +if test $pkg_failed = yes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then + _pkg_short_errors_supported=yes +else + _pkg_short_errors_supported=no +fi + if test $_pkg_short_errors_supported = yes; then + NCURSES_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "ncurses" 2>&1` + else + NCURSES_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "ncurses" 2>&1` + fi + # Put the nasty error message in config.log where it belongs + echo "$NCURSES_PKG_ERRORS" >&5 + + + # Extract the first word of "ncurses5-config", so it can be a program name with args. +set dummy ncurses5-config; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ncurses5_config+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ncurses5_config"; then + ac_cv_prog_ncurses5_config="$ncurses5_config" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ncurses5_config="yes" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ncurses5_config=$ac_cv_prog_ncurses5_config +if test -n "$ncurses5_config"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ncurses5_config" >&5 +$as_echo "$ncurses5_config" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + if test "$ncurses5_config" = "yes"; then + CURSESINC="" + CURSESLIB=`ncurses5-config --libs` + CURSESLIBDIR=`ncurses5-config --libdir` + CURSES_CFLAGS=`ncurses5-config --cflags` + curseslib="ncurses" + else + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for initscr in -lncurses" >&5 +$as_echo_n "checking for initscr in -lncurses... " >&6; } +if ${ac_cv_lib_ncurses_initscr+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lncurses $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char initscr (); +int +main () +{ +return initscr (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_ncurses_initscr=yes +else + ac_cv_lib_ncurses_initscr=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_ncurses_initscr" >&5 +$as_echo "$ac_cv_lib_ncurses_initscr" >&6; } +if test "x$ac_cv_lib_ncurses_initscr" = xyes; then : + CURSESINC=''; CURSESLIB='-lncurses'; curseslib="ncurses" +fi + + fi + +elif test $pkg_failed = untried; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + + # Extract the first word of "ncurses5-config", so it can be a program name with args. +set dummy ncurses5-config; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ncurses5_config+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ncurses5_config"; then + ac_cv_prog_ncurses5_config="$ncurses5_config" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ncurses5_config="yes" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ncurses5_config=$ac_cv_prog_ncurses5_config +if test -n "$ncurses5_config"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ncurses5_config" >&5 +$as_echo "$ncurses5_config" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + if test "$ncurses5_config" = "yes"; then + CURSESINC="" + CURSESLIB=`ncurses5-config --libs` + CURSESLIBDIR=`ncurses5-config --libdir` + CURSES_CFLAGS=`ncurses5-config --cflags` + curseslib="ncurses" + else + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for initscr in -lncurses" >&5 +$as_echo_n "checking for initscr in -lncurses... " >&6; } +if ${ac_cv_lib_ncurses_initscr+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lncurses $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char initscr (); +int +main () +{ +return initscr (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_ncurses_initscr=yes +else + ac_cv_lib_ncurses_initscr=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_ncurses_initscr" >&5 +$as_echo "$ac_cv_lib_ncurses_initscr" >&6; } +if test "x$ac_cv_lib_ncurses_initscr" = xyes; then : + CURSESINC=''; CURSESLIB='-lncurses'; curseslib="ncurses" +fi + + fi + +else + NCURSES_CFLAGS=$pkg_cv_NCURSES_CFLAGS + NCURSES_LIBS=$pkg_cv_NCURSES_LIBS + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + + CURSESINC="" + CURSESLIB="${NCURSES_LIBS}" + CURSESLIBDIR= + CURSES_CFLAGS="${NCURSES_CFLAGS}" + curseslib="ncurses" + +fi + fi + if test "$curseslib" = "curses" -o "$curseslib" = "auto"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for initscr in -lcurses" >&5 +$as_echo_n "checking for initscr in -lcurses... " >&6; } +if ${ac_cv_lib_curses_initscr+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lcurses $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char initscr (); +int +main () +{ +return initscr (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_curses_initscr=yes +else + ac_cv_lib_curses_initscr=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_curses_initscr" >&5 +$as_echo "$ac_cv_lib_curses_initscr" >&6; } +if test "x$ac_cv_lib_curses_initscr" = xyes; then : + CURSESINC=''; CURSESLIB='-lcurses'; curseslib="curses" +fi + + fi + if test -z "$CURSESINC"; then + as_fn_error $? "this packages requires a curses library" "$LINENO" 5 + fi + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for curses library" >&5 +$as_echo_n "checking for curses library... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $curseslib" >&5 +$as_echo "$curseslib" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for curses header name" >&5 +$as_echo_n "checking for curses header name... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CURSESINC" >&5 +$as_echo "$CURSESINC" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for curses compiler flags" >&5 +$as_echo_n "checking for curses compiler flags... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CURSES_CFLAGS" >&5 +$as_echo "$CURSES_CFLAGS" >&6; } + + if test -n "$CURSESLIBDIR"; then + if test "-L$CURSESLIBDIR " = "$(echo $CURSESLIB | cut -c-$((${#CURSESLIBDIR}+3)) )"; then + CURSESLIB="$(echo $CURSESLIB | cut -c$((${#CURSESLIBDIR}+4))-)" + fi + fi + + saved_CFLAGS="$CFLAGS" + saved_LDFLAGS="$LDFLAGS" + saved_LIBS="$LIBS" + CFLAGS="$CFLAGS $CURSES_CFLAGS" + if test -n "$CURSESLIBDIR"; then + LDFLAGS="$LDFLAGS -L$CURSESLIBDIR" + fi + LIBS="$CURSESLIB $LIBS" + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +int +main () +{ +set_escdelay(100); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + HAVE_CURSES_ESCDELAY="yes" +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + if test "$HAVE_CURSES_ESCDELAY" = "yes"; then + +$as_echo "#define HAVE_CURSES_ESCDELAY 1" >>confdefs.h + + fi + + if test "$USE_NLS" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for curses NLS support" >&5 +$as_echo_n "checking for curses NLS support... " >&6; } + if test "$curseslib" = "curses"; then + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + #define _XOPEN_SOURCE 1 + #define _XOPEN_SOURCE_EXTENDED 1 + #include + +int +main () +{ + + cchar_t wc; + setcchar(&wc, L"x", A_NORMAL, 0, 0); + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + CURSES_NLS="yes" +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CURSES_NLS" >&5 +$as_echo "$CURSES_NLS" >&6; } + if test "$CURSES_NLS" = "yes"; then + +$as_echo "#define ENABLE_NLS_IN_CURSES 1" >>confdefs.h + + fi + fi + + # On IRIX 5.3, sys/types and inttypes.h are conflicting. +for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ + inttypes.h stdint.h unistd.h +do : + as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` +ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default +" +if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + +for ac_header in panel.h menu.h form.h +do : + as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` +ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" +if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +else + as_fn_error $? "required curses helper header not found" "$LINENO" 5 +fi + +done + + as_ac_Lib=`$as_echo "ac_cv_lib_panel$NCURSESLIBSUFFIX''_new_panel" | $as_tr_sh` +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for new_panel in -lpanel$NCURSESLIBSUFFIX" >&5 +$as_echo_n "checking for new_panel in -lpanel$NCURSESLIBSUFFIX... " >&6; } +if eval \${$as_ac_Lib+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lpanel$NCURSESLIBSUFFIX $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char new_panel (); +int +main () +{ +return new_panel (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + eval "$as_ac_Lib=yes" +else + eval "$as_ac_Lib=no" +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +eval ac_res=\$$as_ac_Lib + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } +if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then : + CURSESLIB="-lpanel$NCURSESLIBSUFFIX $CURSESLIB" +else + as_fn_error $? "panel$NCURSESLIBSUFFIX library not found" "$LINENO" 5 +fi + + as_ac_Lib=`$as_echo "ac_cv_lib_menu$NCURSESLIBSUFFIX''_new_menu" | $as_tr_sh` +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for new_menu in -lmenu$NCURSESLIBSUFFIX" >&5 +$as_echo_n "checking for new_menu in -lmenu$NCURSESLIBSUFFIX... " >&6; } +if eval \${$as_ac_Lib+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lmenu$NCURSESLIBSUFFIX $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char new_menu (); +int +main () +{ +return new_menu (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + eval "$as_ac_Lib=yes" +else + eval "$as_ac_Lib=no" +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +eval ac_res=\$$as_ac_Lib + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } +if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then : + CURSESLIB="-lmenu$NCURSESLIBSUFFIX $CURSESLIB" +else + as_fn_error $? "menu$NCURSESLIBSUFFIX library not found" "$LINENO" 5 +fi + + as_ac_Lib=`$as_echo "ac_cv_lib_form$NCURSESLIBSUFFIX''_new_form" | $as_tr_sh` +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for new_form in -lform$NCURSESLIBSUFFIX" >&5 +$as_echo_n "checking for new_form in -lform$NCURSESLIBSUFFIX... " >&6; } +if eval \${$as_ac_Lib+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lform$NCURSESLIBSUFFIX $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char new_form (); +int +main () +{ +return new_form (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + eval "$as_ac_Lib=yes" +else + eval "$as_ac_Lib=no" +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +eval ac_res=\$$as_ac_Lib + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } +if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then : + CURSESLIB="-lform$NCURSESLIBSUFFIX $CURSESLIB" +else + as_fn_error $? "form$NCURSESLIBSUFFIX library not found" "$LINENO" 5 +fi + + + CFLAGS="$saved_CFLAGS" + LDFLAGS="$saved_LDFLAGS" + LIBS="$saved_LIBS" + + if test -n "$CURSESLIBDIR"; then + CURSESLIB="-L$CURSESLIBDIR $CURSESLIB" + fi + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for curses linker flags" >&5 +$as_echo_n "checking for curses linker flags... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CURSESLIB" >&5 +$as_echo "$CURSESLIB" >&6; } +fi + + + + + +test "x$prefix" = xNONE && prefix=$ac_default_prefix + +eval dir="$datadir" +case "$dir" in +/*) ;; +*) dir="$prefix/share" +esac + +soundsdir="$dir/sounds/alsa" + +cat >>confdefs.h <<_ACEOF +#define SOUNDSDIR "$soundsdir" +_ACEOF + + +mydatadir="$dir/alsa" + +cat >>confdefs.h <<_ACEOF +#define DATADIR "$mydatadir" +_ACEOF + + + + +# Check whether --with-testsound was given. +if test "${with_testsound+set}" = set; then : + withval=$with_testsound; TESTSOUND="$withval" +else + TESTSOUND="$dir/test.wav" +fi + + + +ac_config_headers="$ac_config_headers include/aconfig.h" + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for an ANSI C-conforming const" >&5 +$as_echo_n "checking for an ANSI C-conforming const... " >&6; } +if ${ac_cv_c_const+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + +#ifndef __cplusplus + /* Ultrix mips cc rejects this sort of thing. */ + typedef int charset[2]; + const charset cs = { 0, 0 }; + /* SunOS 4.1.1 cc rejects this. */ + char const *const *pcpcc; + char **ppc; + /* NEC SVR4.0.2 mips cc rejects this. */ + struct point {int x, y;}; + static struct point const zero = {0,0}; + /* AIX XL C 1.02.0.0 rejects this. + It does not let you subtract one const X* pointer from another in + an arm of an if-expression whose if-part is not a constant + expression */ + const char *g = "string"; + pcpcc = &g + (g ? g-g : 0); + /* HPUX 7.0 cc rejects these. */ + ++pcpcc; + ppc = (char**) pcpcc; + pcpcc = (char const *const *) ppc; + { /* SCO 3.2v4 cc rejects this sort of thing. */ + char tx; + char *t = &tx; + char const *s = 0 ? (char *) 0 : (char const *) 0; + + *t++ = 0; + if (s) return 0; + } + { /* Someone thinks the Sun supposedly-ANSI compiler will reject this. */ + int x[] = {25, 17}; + const int *foo = &x[0]; + ++foo; + } + { /* Sun SC1.0 ANSI compiler rejects this -- but not the above. */ + typedef const int *iptr; + iptr p = 0; + ++p; + } + { /* AIX XL C 1.02.0.0 rejects this sort of thing, saying + "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */ + struct s { int j; const int *ap[3]; } bx; + struct s *b = &bx; b->j = 5; + } + { /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */ + const int foo = 10; + if (!foo) return 0; + } + return !cs[0] && !zero.x; +#endif + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_c_const=yes +else + ac_cv_c_const=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_const" >&5 +$as_echo "$ac_cv_c_const" >&6; } +if test $ac_cv_c_const = no; then + +$as_echo "#define const /**/" >>confdefs.h + +fi + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for inline" >&5 +$as_echo_n "checking for inline... " >&6; } +if ${ac_cv_c_inline+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_cv_c_inline=no +for ac_kw in inline __inline__ __inline; do + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#ifndef __cplusplus +typedef int foo_t; +static $ac_kw foo_t static_foo () {return 0; } +$ac_kw foo_t foo () {return 0; } +#endif + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_c_inline=$ac_kw +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + test "$ac_cv_c_inline" != no && break +done + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_inline" >&5 +$as_echo "$ac_cv_c_inline" >&6; } + +case $ac_cv_c_inline in + inline | yes) ;; + *) + case $ac_cv_c_inline in + no) ac_val=;; + *) ac_val=$ac_cv_c_inline;; + esac + cat >>confdefs.h <<_ACEOF +#ifndef __cplusplus +#define inline $ac_val +#endif +_ACEOF + ;; +esac + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether time.h and sys/time.h may both be included" >&5 +$as_echo_n "checking whether time.h and sys/time.h may both be included... " >&6; } +if ${ac_cv_header_time+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +#include +#include + +int +main () +{ +if ((struct tm *) 0) +return 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_header_time=yes +else + ac_cv_header_time=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_time" >&5 +$as_echo "$ac_cv_header_time" >&6; } +if test $ac_cv_header_time = yes; then + +$as_echo "#define TIME_WITH_SYS_TIME 1" >>confdefs.h + +fi + + +if test $ac_cv_c_compiler_gnu = yes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC needs -traditional" >&5 +$as_echo_n "checking whether $CC needs -traditional... " >&6; } +if ${ac_cv_prog_gcc_traditional+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_pattern="Autoconf.*'x'" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +Autoconf TIOCGETP +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "$ac_pattern" >/dev/null 2>&1; then : + ac_cv_prog_gcc_traditional=yes +else + ac_cv_prog_gcc_traditional=no +fi +rm -f conftest* + + + if test $ac_cv_prog_gcc_traditional = no; then + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +Autoconf TCGETA +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "$ac_pattern" >/dev/null 2>&1; then : + ac_cv_prog_gcc_traditional=yes +fi +rm -f conftest* + + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_gcc_traditional" >&5 +$as_echo "$ac_cv_prog_gcc_traditional" >&6; } + if test $ac_cv_prog_gcc_traditional = yes; then + CC="$CC -traditional" + fi +fi + + +# Check whether --enable-largefile was given. +if test "${enable_largefile+set}" = set; then : + enableval=$enable_largefile; +fi + +if test "$enable_largefile" != no; then + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for special C compiler options needed for large files" >&5 +$as_echo_n "checking for special C compiler options needed for large files... " >&6; } +if ${ac_cv_sys_largefile_CC+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_cv_sys_largefile_CC=no + if test "$GCC" != yes; then + ac_save_CC=$CC + while :; do + # IRIX 6.2 and later do not support large files by default, + # so use the C compiler's -n32 option if that helps. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + /* Check that off_t can represent 2**63 - 1 correctly. + We can't simply define LARGE_OFF_T to be 9223372036854775807, + since some C++ compilers masquerading as C compilers + incorrectly reject 9223372036854775807. */ +#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) + int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 + && LARGE_OFF_T % 2147483647 == 1) + ? 1 : -1]; +int +main () +{ + + ; + return 0; +} +_ACEOF + if ac_fn_c_try_compile "$LINENO"; then : + break +fi +rm -f core conftest.err conftest.$ac_objext + CC="$CC -n32" + if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_sys_largefile_CC=' -n32'; break +fi +rm -f core conftest.err conftest.$ac_objext + break + done + CC=$ac_save_CC + rm -f conftest.$ac_ext + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_largefile_CC" >&5 +$as_echo "$ac_cv_sys_largefile_CC" >&6; } + if test "$ac_cv_sys_largefile_CC" != no; then + CC=$CC$ac_cv_sys_largefile_CC + fi + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for _FILE_OFFSET_BITS value needed for large files" >&5 +$as_echo_n "checking for _FILE_OFFSET_BITS value needed for large files... " >&6; } +if ${ac_cv_sys_file_offset_bits+:} false; then : + $as_echo_n "(cached) " >&6 +else + while :; do + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + /* Check that off_t can represent 2**63 - 1 correctly. + We can't simply define LARGE_OFF_T to be 9223372036854775807, + since some C++ compilers masquerading as C compilers + incorrectly reject 9223372036854775807. */ +#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) + int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 + && LARGE_OFF_T % 2147483647 == 1) + ? 1 : -1]; +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_sys_file_offset_bits=no; break +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#define _FILE_OFFSET_BITS 64 +#include + /* Check that off_t can represent 2**63 - 1 correctly. + We can't simply define LARGE_OFF_T to be 9223372036854775807, + since some C++ compilers masquerading as C compilers + incorrectly reject 9223372036854775807. */ +#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) + int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 + && LARGE_OFF_T % 2147483647 == 1) + ? 1 : -1]; +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_sys_file_offset_bits=64; break +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + ac_cv_sys_file_offset_bits=unknown + break +done +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_file_offset_bits" >&5 +$as_echo "$ac_cv_sys_file_offset_bits" >&6; } +case $ac_cv_sys_file_offset_bits in #( + no | unknown) ;; + *) +cat >>confdefs.h <<_ACEOF +#define _FILE_OFFSET_BITS $ac_cv_sys_file_offset_bits +_ACEOF +;; +esac +rm -rf conftest* + if test $ac_cv_sys_file_offset_bits = unknown; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for _LARGE_FILES value needed for large files" >&5 +$as_echo_n "checking for _LARGE_FILES value needed for large files... " >&6; } +if ${ac_cv_sys_large_files+:} false; then : + $as_echo_n "(cached) " >&6 +else + while :; do + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + /* Check that off_t can represent 2**63 - 1 correctly. + We can't simply define LARGE_OFF_T to be 9223372036854775807, + since some C++ compilers masquerading as C compilers + incorrectly reject 9223372036854775807. */ +#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) + int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 + && LARGE_OFF_T % 2147483647 == 1) + ? 1 : -1]; +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_sys_large_files=no; break +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#define _LARGE_FILES 1 +#include + /* Check that off_t can represent 2**63 - 1 correctly. + We can't simply define LARGE_OFF_T to be 9223372036854775807, + since some C++ compilers masquerading as C compilers + incorrectly reject 9223372036854775807. */ +#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) + int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 + && LARGE_OFF_T % 2147483647 == 1) + ? 1 : -1]; +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_sys_large_files=1; break +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + ac_cv_sys_large_files=unknown + break +done +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_large_files" >&5 +$as_echo "$ac_cv_sys_large_files" >&6; } +case $ac_cv_sys_large_files in #( + no | unknown) ;; + *) +cat >>confdefs.h <<_ACEOF +#define _LARGE_FILES $ac_cv_sys_large_files +_ACEOF +;; +esac +rm -rf conftest* + fi + + +fi + + + +SND_UTIL_VERSION=$VERSION +echo $VERSION > $srcdir/version + +cat >>confdefs.h <<_ACEOF +#define VERSION "$SND_UTIL_VERSION" +_ACEOF + + +SND_UTIL_MAJOR=`echo $VERSION | cut -d . -f 1` + +SND_UTIL_MINOR=`echo $VERSION | cut -d . -f 2` + +SND_UTIL_SUBMINOR=`echo $VERSION | cut -d . -f 3 | sed -e 's/pre[0-9]*//g'` + + + + + + +pkg_failed=no +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for SYSTEMD" >&5 +$as_echo_n "checking for SYSTEMD... " >&6; } + +if test -n "$SYSTEMD_CFLAGS"; then + pkg_cv_SYSTEMD_CFLAGS="$SYSTEMD_CFLAGS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"systemd >= 18\""; } >&5 + ($PKG_CONFIG --exists --print-errors "systemd >= 18") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_SYSTEMD_CFLAGS=`$PKG_CONFIG --cflags "systemd >= 18" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi +if test -n "$SYSTEMD_LIBS"; then + pkg_cv_SYSTEMD_LIBS="$SYSTEMD_LIBS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"systemd >= 18\""; } >&5 + ($PKG_CONFIG --exists --print-errors "systemd >= 18") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_SYSTEMD_LIBS=`$PKG_CONFIG --libs "systemd >= 18" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi + + + +if test $pkg_failed = yes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then + _pkg_short_errors_supported=yes +else + _pkg_short_errors_supported=no +fi + if test $_pkg_short_errors_supported = yes; then + SYSTEMD_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "systemd >= 18" 2>&1` + else + SYSTEMD_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "systemd >= 18" 2>&1` + fi + # Put the nasty error message in config.log where it belongs + echo "$SYSTEMD_PKG_ERRORS" >&5 + + have_min_systemd="no" +elif test $pkg_failed = untried; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + have_min_systemd="no" +else + SYSTEMD_CFLAGS=$pkg_cv_SYSTEMD_CFLAGS + SYSTEMD_LIBS=$pkg_cv_SYSTEMD_LIBS + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + have_min_systemd="yes" +fi + +# Check whether --with-systemdsystemunitdir was given. +if test "${with_systemdsystemunitdir+set}" = set; then : + withval=$with_systemdsystemunitdir; +else + with_systemdsystemunitdir=$($PKG_CONFIG --variable=systemdsystemunitdir systemd) +fi + +if test "x$with_systemdsystemunitdir" != xno; then + systemdsystemunitdir=$with_systemdsystemunitdir + +fi + if test "$have_min_systemd" = "yes" \ + -a -n "$with_systemdsystemunitdir" -a "x$with_systemdsystemunitdir" != xno ; then + HAVE_SYSTEMD_TRUE= + HAVE_SYSTEMD_FALSE='#' +else + HAVE_SYSTEMD_TRUE='#' + HAVE_SYSTEMD_FALSE= +fi + + + +# Check whether --with-asound-state-dir was given. +if test "${with_asound_state_dir+set}" = set; then : + withval=$with_asound_state_dir; ASOUND_STATE_DIR="$withval" +else + ASOUND_STATE_DIR="/var/lib/alsa" +fi + + + + +# Check whether --with-alsactl-lock-dir was given. +if test "${with_alsactl_lock_dir+set}" = set; then : + withval=$with_alsactl_lock_dir; ASOUND_LOCK_DIR="$withval" +else + ASOUND_LOCK_DIR="/var/lock" +fi + + + + +# Check whether --with-alsactl-pidfile-dir was given. +if test "${with_alsactl_pidfile_dir+set}" = set; then : + withval=$with_alsactl_pidfile_dir; ALSACTL_PIDFILE_DIR="$withval" +else + ALSACTL_PIDFILE_DIR="/var/run" +fi + + + + +# Check whether --with-alsactl-daemonswitch was given. +if test "${with_alsactl_daemonswitch+set}" = set; then : + withval=$with_alsactl_daemonswitch; ALSACTL_DAEMONSWITCH="$withval" +else + ALSACTL_DAEMONSWITCH="/etc/alsa/state-daemon.conf" +fi + + + +ac_config_files="$ac_config_files Makefile alsactl/Makefile alsactl/init/Makefile alsamixer/Makefile amidi/Makefile amixer/Makefile m4/Makefile po/Makefile.in alsaconf/alsaconf alsaconf/Makefile alsaconf/po/Makefile alsaucm/Makefile topology/Makefile bat/Makefile bat/tests/Makefile bat/tests/asound_state/Makefile aplay/Makefile include/Makefile iecset/Makefile utils/Makefile utils/alsa-utils.spec seq/Makefile seq/aconnect/Makefile seq/aplaymidi/Makefile seq/aseqdump/Makefile seq/aseqnet/Makefile speaker-test/Makefile speaker-test/samples/Makefile alsaloop/Makefile alsa-info/Makefile axfer/Makefile axfer/test/Makefile" + +cat >confcache <<\_ACEOF +# This file is a shell script that caches the results of configure +# tests run on this system so they can be shared between configure +# scripts and configure runs, see configure's option --config-cache. +# It is not useful on other systems. If it contains results you don't +# want to keep, you may remove or edit it. +# +# config.status only pays attention to the cache file if you give it +# the --recheck option to rerun configure. +# +# `ac_cv_env_foo' variables (set or unset) will be overridden when +# loading this file, other *unset* `ac_cv_foo' will be assigned the +# following values. + +_ACEOF + +# The following way of writing the cache mishandles newlines in values, +# but we know of no workaround that is simple, portable, and efficient. +# So, we kill variables containing newlines. +# Ultrix sh set writes to stderr and can't be redirected directly, +# and sets the high bit in the cache file unless we assign to the vars. +( + for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do + eval ac_val=\$$ac_var + case $ac_val in #( + *${as_nl}*) + case $ac_var in #( + *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 +$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; + esac + case $ac_var in #( + _ | IFS | as_nl) ;; #( + BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( + *) { eval $ac_var=; unset $ac_var;} ;; + esac ;; + esac + done + + (set) 2>&1 | + case $as_nl`(ac_space=' '; set) 2>&1` in #( + *${as_nl}ac_space=\ *) + # `set' does not quote correctly, so add quotes: double-quote + # substitution turns \\\\ into \\, and sed turns \\ into \. + sed -n \ + "s/'/'\\\\''/g; + s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" + ;; #( + *) + # `set' quotes correctly as required by POSIX, so do not add quotes. + sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" + ;; + esac | + sort +) | + sed ' + /^ac_cv_env_/b end + t clear + :clear + s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ + t end + s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ + :end' >>confcache +if diff "$cache_file" confcache >/dev/null 2>&1; then :; else + if test -w "$cache_file"; then + if test "x$cache_file" != "x/dev/null"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5 +$as_echo "$as_me: updating cache $cache_file" >&6;} + if test ! -f "$cache_file" || test -h "$cache_file"; then + cat confcache >"$cache_file" + else + case $cache_file in #( + */* | ?:*) + mv -f confcache "$cache_file"$$ && + mv -f "$cache_file"$$ "$cache_file" ;; #( + *) + mv -f confcache "$cache_file" ;; + esac + fi + fi + else + { $as_echo "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5 +$as_echo "$as_me: not updating unwritable cache $cache_file" >&6;} + fi +fi +rm -f confcache + +test "x$prefix" = xNONE && prefix=$ac_default_prefix +# Let make expand exec_prefix. +test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' + +DEFS=-DHAVE_CONFIG_H + +ac_libobjs= +ac_ltlibobjs= +U= +for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue + # 1. Remove the extension, and $U if already installed. + ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' + ac_i=`$as_echo "$ac_i" | sed "$ac_script"` + # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR + # will be set to the directory where LIBOBJS objects are built. + as_fn_append ac_libobjs " \${LIBOBJDIR}$ac_i\$U.$ac_objext" + as_fn_append ac_ltlibobjs " \${LIBOBJDIR}$ac_i"'$U.lo' +done +LIBOBJS=$ac_libobjs + +LTLIBOBJS=$ac_ltlibobjs + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking that generated files are newer than configure" >&5 +$as_echo_n "checking that generated files are newer than configure... " >&6; } + if test -n "$am_sleep_pid"; then + # Hide warnings about reused PIDs. + wait $am_sleep_pid 2>/dev/null + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: result: done" >&5 +$as_echo "done" >&6; } + if test -n "$EXEEXT"; then + am__EXEEXT_TRUE= + am__EXEEXT_FALSE='#' +else + am__EXEEXT_TRUE='#' + am__EXEEXT_FALSE= +fi + +if test -z "${MAINTAINER_MODE_TRUE}" && test -z "${MAINTAINER_MODE_FALSE}"; then + as_fn_error $? "conditional \"MAINTAINER_MODE\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then + as_fn_error $? "conditional \"AMDEP\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then + as_fn_error $? "conditional \"am__fastdepCC\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then + as_fn_error $? "conditional \"am__fastdepCC\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${HAVE_PCM_TRUE}" && test -z "${HAVE_PCM_FALSE}"; then + as_fn_error $? "conditional \"HAVE_PCM\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${HAVE_MIXER_TRUE}" && test -z "${HAVE_MIXER_FALSE}"; then + as_fn_error $? "conditional \"HAVE_MIXER\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${HAVE_RAWMIDI_TRUE}" && test -z "${HAVE_RAWMIDI_FALSE}"; then + as_fn_error $? "conditional \"HAVE_RAWMIDI\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${HAVE_SEQ_TRUE}" && test -z "${HAVE_SEQ_FALSE}"; then + as_fn_error $? "conditional \"HAVE_SEQ\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${HAVE_UCM_TRUE}" && test -z "${HAVE_UCM_FALSE}"; then + as_fn_error $? "conditional \"HAVE_UCM\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${HAVE_TOPOLOGY_TRUE}" && test -z "${HAVE_TOPOLOGY_FALSE}"; then + as_fn_error $? "conditional \"HAVE_TOPOLOGY\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${HAVE_SAMPLERATE_TRUE}" && test -z "${HAVE_SAMPLERATE_FALSE}"; then + as_fn_error $? "conditional \"HAVE_SAMPLERATE\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${HAVE_FFADO_TRUE}" && test -z "${HAVE_FFADO_FALSE}"; then + as_fn_error $? "conditional \"HAVE_FFADO\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${BAT_TRUE}" && test -z "${BAT_FALSE}"; then + as_fn_error $? "conditional \"BAT\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${HAVE_LIBFFTW3_TRUE}" && test -z "${HAVE_LIBFFTW3_FALSE}"; then + as_fn_error $? "conditional \"HAVE_LIBFFTW3\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${HAVE_LIBTINYALSA_TRUE}" && test -z "${HAVE_LIBTINYALSA_FALSE}"; then + as_fn_error $? "conditional \"HAVE_LIBTINYALSA\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${ALSAMIXER_TRUE}" && test -z "${ALSAMIXER_FALSE}"; then + as_fn_error $? "conditional \"ALSAMIXER\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${ALSACONF_TRUE}" && test -z "${ALSACONF_FALSE}"; then + as_fn_error $? "conditional \"ALSACONF\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${ALSALOOP_TRUE}" && test -z "${ALSALOOP_FALSE}"; then + as_fn_error $? "conditional \"ALSALOOP\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${USE_XMLTO_TRUE}" && test -z "${USE_XMLTO_FALSE}"; then + as_fn_error $? "conditional \"USE_XMLTO\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${USE_RST2MAN_TRUE}" && test -z "${USE_RST2MAN_FALSE}"; then + as_fn_error $? "conditional \"USE_RST2MAN\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${HAVE_SYSTEMD_TRUE}" && test -z "${HAVE_SYSTEMD_FALSE}"; then + as_fn_error $? "conditional \"HAVE_SYSTEMD\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi + +: "${CONFIG_STATUS=./config.status}" +ac_write_fail=0 +ac_clean_files_save=$ac_clean_files +ac_clean_files="$ac_clean_files $CONFIG_STATUS" +{ $as_echo "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5 +$as_echo "$as_me: creating $CONFIG_STATUS" >&6;} +as_write_fail=0 +cat >$CONFIG_STATUS <<_ASEOF || as_write_fail=1 +#! $SHELL +# Generated by $as_me. +# Run this file to recreate the current configuration. +# Compiler output produced by configure, useful for debugging +# configure, is in config.log if it exists. + +debug=false +ac_cs_recheck=false +ac_cs_silent=false + +SHELL=\${CONFIG_SHELL-$SHELL} +export SHELL +_ASEOF +cat >>$CONFIG_STATUS <<\_ASEOF || as_write_fail=1 +## -------------------- ## +## M4sh Initialization. ## +## -------------------- ## + +# Be more Bourne compatible +DUALCASE=1; export DUALCASE # for MKS sh +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : + emulate sh + NULLCMD=: + # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which + # is contrary to our usage. Disable this feature. + alias -g '${1+"$@"}'='"$@"' + setopt NO_GLOB_SUBST +else + case `(set -o) 2>/dev/null` in #( + *posix*) : + set -o posix ;; #( + *) : + ;; +esac +fi + + +as_nl=' +' +export as_nl +# Printing a long string crashes Solaris 7 /usr/bin/printf. +as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' +as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo +as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo +# Prefer a ksh shell builtin over an external printf program on Solaris, +# but without wasting forks for bash or zsh. +if test -z "$BASH_VERSION$ZSH_VERSION" \ + && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then + as_echo='print -r --' + as_echo_n='print -rn --' +elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then + as_echo='printf %s\n' + as_echo_n='printf %s' +else + if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then + as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' + as_echo_n='/usr/ucb/echo -n' + else + as_echo_body='eval expr "X$1" : "X\\(.*\\)"' + as_echo_n_body='eval + arg=$1; + case $arg in #( + *"$as_nl"*) + expr "X$arg" : "X\\(.*\\)$as_nl"; + arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; + esac; + expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" + ' + export as_echo_n_body + as_echo_n='sh -c $as_echo_n_body as_echo' + fi + export as_echo_body + as_echo='sh -c $as_echo_body as_echo' +fi + +# The user is always right. +if test "${PATH_SEPARATOR+set}" != set; then + PATH_SEPARATOR=: + (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { + (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || + PATH_SEPARATOR=';' + } +fi + + +# IFS +# We need space, tab and new line, in precisely that order. Quoting is +# there to prevent editors from complaining about space-tab. +# (If _AS_PATH_WALK were called with IFS unset, it would disable word +# splitting by setting IFS to empty value.) +IFS=" "" $as_nl" + +# Find who we are. Look in the path if we contain no directory separator. +as_myself= +case $0 in #(( + *[\\/]* ) as_myself=$0 ;; + *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break + done +IFS=$as_save_IFS + + ;; +esac +# We did not find ourselves, most probably we were run as `sh COMMAND' +# in which case we are not to be found in the path. +if test "x$as_myself" = x; then + as_myself=$0 +fi +if test ! -f "$as_myself"; then + $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 + exit 1 +fi + +# Unset variables that we do not need and which cause bugs (e.g. in +# pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" +# suppresses any "Segmentation fault" message there. '((' could +# trigger a bug in pdksh 5.2.14. +for as_var in BASH_ENV ENV MAIL MAILPATH +do eval test x\${$as_var+set} = xset \ + && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : +done +PS1='$ ' +PS2='> ' +PS4='+ ' + +# NLS nuisances. +LC_ALL=C +export LC_ALL +LANGUAGE=C +export LANGUAGE + +# CDPATH. +(unset CDPATH) >/dev/null 2>&1 && unset CDPATH + + +# as_fn_error STATUS ERROR [LINENO LOG_FD] +# ---------------------------------------- +# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are +# provided, also output the error to LOG_FD, referencing LINENO. Then exit the +# script with STATUS, using 1 if that was 0. +as_fn_error () +{ + as_status=$1; test $as_status -eq 0 && as_status=1 + if test "$4"; then + as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 + fi + $as_echo "$as_me: error: $2" >&2 + as_fn_exit $as_status +} # as_fn_error + + +# as_fn_set_status STATUS +# ----------------------- +# Set $? to STATUS, without forking. +as_fn_set_status () +{ + return $1 +} # as_fn_set_status + +# as_fn_exit STATUS +# ----------------- +# Exit the shell with STATUS, even in a "trap 0" or "set -e" context. +as_fn_exit () +{ + set +e + as_fn_set_status $1 + exit $1 +} # as_fn_exit + +# as_fn_unset VAR +# --------------- +# Portably unset VAR. +as_fn_unset () +{ + { eval $1=; unset $1;} +} +as_unset=as_fn_unset +# as_fn_append VAR VALUE +# ---------------------- +# Append the text in VALUE to the end of the definition contained in VAR. Take +# advantage of any shell optimizations that allow amortized linear growth over +# repeated appends, instead of the typical quadratic growth present in naive +# implementations. +if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : + eval 'as_fn_append () + { + eval $1+=\$2 + }' +else + as_fn_append () + { + eval $1=\$$1\$2 + } +fi # as_fn_append + +# as_fn_arith ARG... +# ------------------ +# Perform arithmetic evaluation on the ARGs, and store the result in the +# global $as_val. Take advantage of shells that can avoid forks. The arguments +# must be portable across $(()) and expr. +if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : + eval 'as_fn_arith () + { + as_val=$(( $* )) + }' +else + as_fn_arith () + { + as_val=`expr "$@" || test $? -eq 1` + } +fi # as_fn_arith + + +if expr a : '\(a\)' >/dev/null 2>&1 && + test "X`expr 00001 : '.*\(...\)'`" = X001; then + as_expr=expr +else + as_expr=false +fi + +if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then + as_basename=basename +else + as_basename=false +fi + +if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then + as_dirname=dirname +else + as_dirname=false +fi + +as_me=`$as_basename -- "$0" || +$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X/"$0" | + sed '/^.*\/\([^/][^/]*\)\/*$/{ + s//\1/ + q + } + /^X\/\(\/\/\)$/{ + s//\1/ + q + } + /^X\/\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + +# Avoid depending upon Character Ranges. +as_cr_letters='abcdefghijklmnopqrstuvwxyz' +as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' +as_cr_Letters=$as_cr_letters$as_cr_LETTERS +as_cr_digits='0123456789' +as_cr_alnum=$as_cr_Letters$as_cr_digits + +ECHO_C= ECHO_N= ECHO_T= +case `echo -n x` in #((((( +-n*) + case `echo 'xy\c'` in + *c*) ECHO_T=' ';; # ECHO_T is single tab character. + xy) ECHO_C='\c';; + *) echo `echo ksh88 bug on AIX 6.1` > /dev/null + ECHO_T=' ';; + esac;; +*) + ECHO_N='-n';; +esac + +rm -f conf$$ conf$$.exe conf$$.file +if test -d conf$$.dir; then + rm -f conf$$.dir/conf$$.file +else + rm -f conf$$.dir + mkdir conf$$.dir 2>/dev/null +fi +if (echo >conf$$.file) 2>/dev/null; then + if ln -s conf$$.file conf$$ 2>/dev/null; then + as_ln_s='ln -s' + # ... but there are two gotchas: + # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. + # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. + # In both cases, we have to default to `cp -pR'. + ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || + as_ln_s='cp -pR' + elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln + else + as_ln_s='cp -pR' + fi +else + as_ln_s='cp -pR' +fi +rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file +rmdir conf$$.dir 2>/dev/null + + +# as_fn_mkdir_p +# ------------- +# Create "$as_dir" as a directory, including parents if necessary. +as_fn_mkdir_p () +{ + + case $as_dir in #( + -*) as_dir=./$as_dir;; + esac + test -d "$as_dir" || eval $as_mkdir_p || { + as_dirs= + while :; do + case $as_dir in #( + *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( + *) as_qdir=$as_dir;; + esac + as_dirs="'$as_qdir' $as_dirs" + as_dir=`$as_dirname -- "$as_dir" || +$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_dir" : 'X\(//\)[^/]' \| \ + X"$as_dir" : 'X\(//\)$' \| \ + X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$as_dir" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + test -d "$as_dir" && break + done + test -z "$as_dirs" || eval "mkdir $as_dirs" + } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" + + +} # as_fn_mkdir_p +if mkdir -p . 2>/dev/null; then + as_mkdir_p='mkdir -p "$as_dir"' +else + test -d ./-p && rmdir ./-p + as_mkdir_p=false +fi + + +# as_fn_executable_p FILE +# ----------------------- +# Test if FILE is an executable regular file. +as_fn_executable_p () +{ + test -f "$1" && test -x "$1" +} # as_fn_executable_p +as_test_x='test -x' +as_executable_p=as_fn_executable_p + +# Sed expression to map a string onto a valid CPP name. +as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" + +# Sed expression to map a string onto a valid variable name. +as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" + + +exec 6>&1 +## ----------------------------------- ## +## Main body of $CONFIG_STATUS script. ## +## ----------------------------------- ## +_ASEOF +test $as_write_fail = 0 && chmod +x $CONFIG_STATUS || ac_write_fail=1 + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +# Save the log message, to keep $0 and so on meaningful, and to +# report actual input values of CONFIG_FILES etc. instead of their +# values after options handling. +ac_log=" +This file was extended by alsa-utils $as_me 1.2.4, which was +generated by GNU Autoconf 2.69. Invocation command line was + + CONFIG_FILES = $CONFIG_FILES + CONFIG_HEADERS = $CONFIG_HEADERS + CONFIG_LINKS = $CONFIG_LINKS + CONFIG_COMMANDS = $CONFIG_COMMANDS + $ $0 $@ + +on `(hostname || uname -n) 2>/dev/null | sed 1q` +" + +_ACEOF + +case $ac_config_files in *" +"*) set x $ac_config_files; shift; ac_config_files=$*;; +esac + +case $ac_config_headers in *" +"*) set x $ac_config_headers; shift; ac_config_headers=$*;; +esac + + +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +# Files that config.status was made for. +config_files="$ac_config_files" +config_headers="$ac_config_headers" +config_commands="$ac_config_commands" + +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +ac_cs_usage="\ +\`$as_me' instantiates files and other configuration actions +from templates according to the current configuration. Unless the files +and actions are specified as TAGs, all are instantiated by default. + +Usage: $0 [OPTION]... [TAG]... + + -h, --help print this help, then exit + -V, --version print version number and configuration settings, then exit + --config print configuration, then exit + -q, --quiet, --silent + do not print progress messages + -d, --debug don't remove temporary files + --recheck update $as_me by reconfiguring in the same conditions + --file=FILE[:TEMPLATE] + instantiate the configuration file FILE + --header=FILE[:TEMPLATE] + instantiate the configuration header FILE + +Configuration files: +$config_files + +Configuration headers: +$config_headers + +Configuration commands: +$config_commands + +Report bugs to the package provider." + +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" +ac_cs_version="\\ +alsa-utils config.status 1.2.4 +configured by $0, generated by GNU Autoconf 2.69, + with options \\"\$ac_cs_config\\" + +Copyright (C) 2012 Free Software Foundation, Inc. +This config.status script is free software; the Free Software Foundation +gives unlimited permission to copy, distribute and modify it." + +ac_pwd='$ac_pwd' +srcdir='$srcdir' +INSTALL='$INSTALL' +MKDIR_P='$MKDIR_P' +AWK='$AWK' +test -n "\$AWK" || AWK=awk +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +# The default lists apply if the user does not specify any file. +ac_need_defaults=: +while test $# != 0 +do + case $1 in + --*=?*) + ac_option=`expr "X$1" : 'X\([^=]*\)='` + ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'` + ac_shift=: + ;; + --*=) + ac_option=`expr "X$1" : 'X\([^=]*\)='` + ac_optarg= + ac_shift=: + ;; + *) + ac_option=$1 + ac_optarg=$2 + ac_shift=shift + ;; + esac + + case $ac_option in + # Handling of the options. + -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) + ac_cs_recheck=: ;; + --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) + $as_echo "$ac_cs_version"; exit ;; + --config | --confi | --conf | --con | --co | --c ) + $as_echo "$ac_cs_config"; exit ;; + --debug | --debu | --deb | --de | --d | -d ) + debug=: ;; + --file | --fil | --fi | --f ) + $ac_shift + case $ac_optarg in + *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; + '') as_fn_error $? "missing file argument" ;; + esac + as_fn_append CONFIG_FILES " '$ac_optarg'" + ac_need_defaults=false;; + --header | --heade | --head | --hea ) + $ac_shift + case $ac_optarg in + *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; + esac + as_fn_append CONFIG_HEADERS " '$ac_optarg'" + ac_need_defaults=false;; + --he | --h) + # Conflict between --help and --header + as_fn_error $? "ambiguous option: \`$1' +Try \`$0 --help' for more information.";; + --help | --hel | -h ) + $as_echo "$ac_cs_usage"; exit ;; + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil | --si | --s) + ac_cs_silent=: ;; + + # This is an error. + -*) as_fn_error $? "unrecognized option: \`$1' +Try \`$0 --help' for more information." ;; + + *) as_fn_append ac_config_targets " $1" + ac_need_defaults=false ;; + + esac + shift +done + +ac_configure_extra_args= + +if $ac_cs_silent; then + exec 6>/dev/null + ac_configure_extra_args="$ac_configure_extra_args --silent" +fi + +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +if \$ac_cs_recheck; then + set X $SHELL '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion + shift + \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6 + CONFIG_SHELL='$SHELL' + export CONFIG_SHELL + exec "\$@" +fi + +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +exec 5>>config.log +{ + echo + sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX +## Running $as_me. ## +_ASBOX + $as_echo "$ac_log" +} >&5 + +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +# +# INIT-COMMANDS +# +# Capture the value of obsolete ALL_LINGUAS because we need it to compute + # POFILES, UPDATEPOFILES, DUMMYPOFILES, GMOFILES, CATALOGS. But hide it + # from automake < 1.5. + eval 'OBSOLETE_ALL_LINGUAS''="$ALL_LINGUAS"' + # Capture the value of LINGUAS because we need it to compute CATALOGS. + LINGUAS="${LINGUAS-%UNSET%}" + +AMDEP_TRUE="$AMDEP_TRUE" MAKE="${MAKE-make}" + +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 + +# Handling of arguments. +for ac_config_target in $ac_config_targets +do + case $ac_config_target in + "po-directories") CONFIG_COMMANDS="$CONFIG_COMMANDS po-directories" ;; + "depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;; + "include/aconfig.h") CONFIG_HEADERS="$CONFIG_HEADERS include/aconfig.h" ;; + "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; + "alsactl/Makefile") CONFIG_FILES="$CONFIG_FILES alsactl/Makefile" ;; + "alsactl/init/Makefile") CONFIG_FILES="$CONFIG_FILES alsactl/init/Makefile" ;; + "alsamixer/Makefile") CONFIG_FILES="$CONFIG_FILES alsamixer/Makefile" ;; + "amidi/Makefile") CONFIG_FILES="$CONFIG_FILES amidi/Makefile" ;; + "amixer/Makefile") CONFIG_FILES="$CONFIG_FILES amixer/Makefile" ;; + "m4/Makefile") CONFIG_FILES="$CONFIG_FILES m4/Makefile" ;; + "po/Makefile.in") CONFIG_FILES="$CONFIG_FILES po/Makefile.in" ;; + "alsaconf/alsaconf") CONFIG_FILES="$CONFIG_FILES alsaconf/alsaconf" ;; + "alsaconf/Makefile") CONFIG_FILES="$CONFIG_FILES alsaconf/Makefile" ;; + "alsaconf/po/Makefile") CONFIG_FILES="$CONFIG_FILES alsaconf/po/Makefile" ;; + "alsaucm/Makefile") CONFIG_FILES="$CONFIG_FILES alsaucm/Makefile" ;; + "topology/Makefile") CONFIG_FILES="$CONFIG_FILES topology/Makefile" ;; + "bat/Makefile") CONFIG_FILES="$CONFIG_FILES bat/Makefile" ;; + "bat/tests/Makefile") CONFIG_FILES="$CONFIG_FILES bat/tests/Makefile" ;; + "bat/tests/asound_state/Makefile") CONFIG_FILES="$CONFIG_FILES bat/tests/asound_state/Makefile" ;; + "aplay/Makefile") CONFIG_FILES="$CONFIG_FILES aplay/Makefile" ;; + "include/Makefile") CONFIG_FILES="$CONFIG_FILES include/Makefile" ;; + "iecset/Makefile") CONFIG_FILES="$CONFIG_FILES iecset/Makefile" ;; + "utils/Makefile") CONFIG_FILES="$CONFIG_FILES utils/Makefile" ;; + "utils/alsa-utils.spec") CONFIG_FILES="$CONFIG_FILES utils/alsa-utils.spec" ;; + "seq/Makefile") CONFIG_FILES="$CONFIG_FILES seq/Makefile" ;; + "seq/aconnect/Makefile") CONFIG_FILES="$CONFIG_FILES seq/aconnect/Makefile" ;; + "seq/aplaymidi/Makefile") CONFIG_FILES="$CONFIG_FILES seq/aplaymidi/Makefile" ;; + "seq/aseqdump/Makefile") CONFIG_FILES="$CONFIG_FILES seq/aseqdump/Makefile" ;; + "seq/aseqnet/Makefile") CONFIG_FILES="$CONFIG_FILES seq/aseqnet/Makefile" ;; + "speaker-test/Makefile") CONFIG_FILES="$CONFIG_FILES speaker-test/Makefile" ;; + "speaker-test/samples/Makefile") CONFIG_FILES="$CONFIG_FILES speaker-test/samples/Makefile" ;; + "alsaloop/Makefile") CONFIG_FILES="$CONFIG_FILES alsaloop/Makefile" ;; + "alsa-info/Makefile") CONFIG_FILES="$CONFIG_FILES alsa-info/Makefile" ;; + "axfer/Makefile") CONFIG_FILES="$CONFIG_FILES axfer/Makefile" ;; + "axfer/test/Makefile") CONFIG_FILES="$CONFIG_FILES axfer/test/Makefile" ;; + + *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;; + esac +done + + +# If the user did not use the arguments to specify the items to instantiate, +# then the envvar interface is used. Set only those that are not. +# We use the long form for the default assignment because of an extremely +# bizarre bug on SunOS 4.1.3. +if $ac_need_defaults; then + test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files + test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers + test "${CONFIG_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands +fi + +# Have a temporary directory for convenience. Make it in the build tree +# simply because there is no reason against having it here, and in addition, +# creating and moving files from /tmp can sometimes cause problems. +# Hook for its removal unless debugging. +# Note that there is a small window in which the directory will not be cleaned: +# after its creation but before its name has been assigned to `$tmp'. +$debug || +{ + tmp= ac_tmp= + trap 'exit_status=$? + : "${ac_tmp:=$tmp}" + { test ! -d "$ac_tmp" || rm -fr "$ac_tmp"; } && exit $exit_status +' 0 + trap 'as_fn_exit 1' 1 2 13 15 +} +# Create a (secure) tmp directory for tmp files. + +{ + tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && + test -d "$tmp" +} || +{ + tmp=./conf$$-$RANDOM + (umask 077 && mkdir "$tmp") +} || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5 +ac_tmp=$tmp + +# Set up the scripts for CONFIG_FILES section. +# No need to generate them if there are no CONFIG_FILES. +# This happens for instance with `./config.status config.h'. +if test -n "$CONFIG_FILES"; then + + +ac_cr=`echo X | tr X '\015'` +# On cygwin, bash can eat \r inside `` if the user requested igncr. +# But we know of no other shell where ac_cr would be empty at this +# point, so we can use a bashism as a fallback. +if test "x$ac_cr" = x; then + eval ac_cr=\$\'\\r\' +fi +ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' /dev/null` +if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then + ac_cs_awk_cr='\\r' +else + ac_cs_awk_cr=$ac_cr +fi + +echo 'BEGIN {' >"$ac_tmp/subs1.awk" && +_ACEOF + + +{ + echo "cat >conf$$subs.awk <<_ACEOF" && + echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' && + echo "_ACEOF" +} >conf$$subs.sh || + as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 +ac_delim_num=`echo "$ac_subst_vars" | grep -c '^'` +ac_delim='%!_!# ' +for ac_last_try in false false false false false :; do + . ./conf$$subs.sh || + as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 + + ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X` + if test $ac_delim_n = $ac_delim_num; then + break + elif $ac_last_try; then + as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 + else + ac_delim="$ac_delim!$ac_delim _$ac_delim!! " + fi +done +rm -f conf$$subs.sh + +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +cat >>"\$ac_tmp/subs1.awk" <<\\_ACAWK && +_ACEOF +sed -n ' +h +s/^/S["/; s/!.*/"]=/ +p +g +s/^[^!]*!// +:repl +t repl +s/'"$ac_delim"'$// +t delim +:nl +h +s/\(.\{148\}\)..*/\1/ +t more1 +s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/ +p +n +b repl +:more1 +s/["\\]/\\&/g; s/^/"/; s/$/"\\/ +p +g +s/.\{148\}// +t nl +:delim +h +s/\(.\{148\}\)..*/\1/ +t more2 +s/["\\]/\\&/g; s/^/"/; s/$/"/ +p +b +:more2 +s/["\\]/\\&/g; s/^/"/; s/$/"\\/ +p +g +s/.\{148\}// +t delim +' >$CONFIG_STATUS || ac_write_fail=1 +rm -f conf$$subs.awk +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +_ACAWK +cat >>"\$ac_tmp/subs1.awk" <<_ACAWK && + for (key in S) S_is_set[key] = 1 + FS = "" + +} +{ + line = $ 0 + nfields = split(line, field, "@") + substed = 0 + len = length(field[1]) + for (i = 2; i < nfields; i++) { + key = field[i] + keylen = length(key) + if (S_is_set[key]) { + value = S[key] + line = substr(line, 1, len) "" value "" substr(line, len + keylen + 3) + len += length(value) + length(field[++i]) + substed = 1 + } else + len += 1 + keylen + } + + print line +} + +_ACAWK +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then + sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g" +else + cat +fi < "$ac_tmp/subs1.awk" > "$ac_tmp/subs.awk" \ + || as_fn_error $? "could not setup config files machinery" "$LINENO" 5 +_ACEOF + +# VPATH may cause trouble with some makes, so we remove sole $(srcdir), +# ${srcdir} and @srcdir@ entries from VPATH if srcdir is ".", strip leading and +# trailing colons and then remove the whole line if VPATH becomes empty +# (actually we leave an empty line to preserve line numbers). +if test "x$srcdir" = x.; then + ac_vpsub='/^[ ]*VPATH[ ]*=[ ]*/{ +h +s/// +s/^/:/ +s/[ ]*$/:/ +s/:\$(srcdir):/:/g +s/:\${srcdir}:/:/g +s/:@srcdir@:/:/g +s/^:*// +s/:*$// +x +s/\(=[ ]*\).*/\1/ +G +s/\n// +s/^[^=]*=[ ]*$// +}' +fi + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +fi # test -n "$CONFIG_FILES" + +# Set up the scripts for CONFIG_HEADERS section. +# No need to generate them if there are no CONFIG_HEADERS. +# This happens for instance with `./config.status Makefile'. +if test -n "$CONFIG_HEADERS"; then +cat >"$ac_tmp/defines.awk" <<\_ACAWK || +BEGIN { +_ACEOF + +# Transform confdefs.h into an awk script `defines.awk', embedded as +# here-document in config.status, that substitutes the proper values into +# config.h.in to produce config.h. + +# Create a delimiter string that does not exist in confdefs.h, to ease +# handling of long lines. +ac_delim='%!_!# ' +for ac_last_try in false false :; do + ac_tt=`sed -n "/$ac_delim/p" confdefs.h` + if test -z "$ac_tt"; then + break + elif $ac_last_try; then + as_fn_error $? "could not make $CONFIG_HEADERS" "$LINENO" 5 + else + ac_delim="$ac_delim!$ac_delim _$ac_delim!! " + fi +done + +# For the awk script, D is an array of macro values keyed by name, +# likewise P contains macro parameters if any. Preserve backslash +# newline sequences. + +ac_word_re=[_$as_cr_Letters][_$as_cr_alnum]* +sed -n ' +s/.\{148\}/&'"$ac_delim"'/g +t rset +:rset +s/^[ ]*#[ ]*define[ ][ ]*/ / +t def +d +:def +s/\\$// +t bsnl +s/["\\]/\\&/g +s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ +D["\1"]=" \3"/p +s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2"/p +d +:bsnl +s/["\\]/\\&/g +s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ +D["\1"]=" \3\\\\\\n"\\/p +t cont +s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2\\\\\\n"\\/p +t cont +d +:cont +n +s/.\{148\}/&'"$ac_delim"'/g +t clear +:clear +s/\\$// +t bsnlc +s/["\\]/\\&/g; s/^/"/; s/$/"/p +d +:bsnlc +s/["\\]/\\&/g; s/^/"/; s/$/\\\\\\n"\\/p +b cont +' >$CONFIG_STATUS || ac_write_fail=1 + +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 + for (key in D) D_is_set[key] = 1 + FS = "" +} +/^[\t ]*#[\t ]*(define|undef)[\t ]+$ac_word_re([\t (]|\$)/ { + line = \$ 0 + split(line, arg, " ") + if (arg[1] == "#") { + defundef = arg[2] + mac1 = arg[3] + } else { + defundef = substr(arg[1], 2) + mac1 = arg[2] + } + split(mac1, mac2, "(") #) + macro = mac2[1] + prefix = substr(line, 1, index(line, defundef) - 1) + if (D_is_set[macro]) { + # Preserve the white space surrounding the "#". + print prefix "define", macro P[macro] D[macro] + next + } else { + # Replace #undef with comments. This is necessary, for example, + # in the case of _POSIX_SOURCE, which is predefined and required + # on some systems where configure will not decide to define it. + if (defundef == "undef") { + print "/*", prefix defundef, macro, "*/" + next + } + } +} +{ print } +_ACAWK +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 + as_fn_error $? "could not setup config headers machinery" "$LINENO" 5 +fi # test -n "$CONFIG_HEADERS" + + +eval set X " :F $CONFIG_FILES :H $CONFIG_HEADERS :C $CONFIG_COMMANDS" +shift +for ac_tag +do + case $ac_tag in + :[FHLC]) ac_mode=$ac_tag; continue;; + esac + case $ac_mode$ac_tag in + :[FHL]*:*);; + :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5;; + :[FH]-) ac_tag=-:-;; + :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; + esac + ac_save_IFS=$IFS + IFS=: + set x $ac_tag + IFS=$ac_save_IFS + shift + ac_file=$1 + shift + + case $ac_mode in + :L) ac_source=$1;; + :[FH]) + ac_file_inputs= + for ac_f + do + case $ac_f in + -) ac_f="$ac_tmp/stdin";; + *) # Look for the file first in the build tree, then in the source tree + # (if the path is not absolute). The absolute path cannot be DOS-style, + # because $ac_f cannot contain `:'. + test -f "$ac_f" || + case $ac_f in + [\\/$]*) false;; + *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; + esac || + as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5;; + esac + case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac + as_fn_append ac_file_inputs " '$ac_f'" + done + + # Let's still pretend it is `configure' which instantiates (i.e., don't + # use $as_me), people would be surprised to read: + # /* config.h. Generated by config.status. */ + configure_input='Generated from '` + $as_echo "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g' + `' by configure.' + if test x"$ac_file" != x-; then + configure_input="$ac_file. $configure_input" + { $as_echo "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5 +$as_echo "$as_me: creating $ac_file" >&6;} + fi + # Neutralize special characters interpreted by sed in replacement strings. + case $configure_input in #( + *\&* | *\|* | *\\* ) + ac_sed_conf_input=`$as_echo "$configure_input" | + sed 's/[\\\\&|]/\\\\&/g'`;; #( + *) ac_sed_conf_input=$configure_input;; + esac + + case $ac_tag in + *:-:* | *:-) cat >"$ac_tmp/stdin" \ + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; + esac + ;; + esac + + ac_dir=`$as_dirname -- "$ac_file" || +$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$ac_file" : 'X\(//\)[^/]' \| \ + X"$ac_file" : 'X\(//\)$' \| \ + X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$ac_file" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + as_dir="$ac_dir"; as_fn_mkdir_p + ac_builddir=. + +case "$ac_dir" in +.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; +*) + ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` + # A ".." for each directory in $ac_dir_suffix. + ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` + case $ac_top_builddir_sub in + "") ac_top_builddir_sub=. ac_top_build_prefix= ;; + *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; + esac ;; +esac +ac_abs_top_builddir=$ac_pwd +ac_abs_builddir=$ac_pwd$ac_dir_suffix +# for backward compatibility: +ac_top_builddir=$ac_top_build_prefix + +case $srcdir in + .) # We are building in place. + ac_srcdir=. + ac_top_srcdir=$ac_top_builddir_sub + ac_abs_top_srcdir=$ac_pwd ;; + [\\/]* | ?:[\\/]* ) # Absolute name. + ac_srcdir=$srcdir$ac_dir_suffix; + ac_top_srcdir=$srcdir + ac_abs_top_srcdir=$srcdir ;; + *) # Relative name. + ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_top_build_prefix$srcdir + ac_abs_top_srcdir=$ac_pwd/$srcdir ;; +esac +ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix + + + case $ac_mode in + :F) + # + # CONFIG_FILE + # + + case $INSTALL in + [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; + *) ac_INSTALL=$ac_top_build_prefix$INSTALL ;; + esac + ac_MKDIR_P=$MKDIR_P + case $MKDIR_P in + [\\/$]* | ?:[\\/]* ) ;; + */*) ac_MKDIR_P=$ac_top_build_prefix$MKDIR_P ;; + esac +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +# If the template does not know about datarootdir, expand it. +# FIXME: This hack should be removed a few years after 2.60. +ac_datarootdir_hack=; ac_datarootdir_seen= +ac_sed_dataroot=' +/datarootdir/ { + p + q +} +/@datadir@/p +/@docdir@/p +/@infodir@/p +/@localedir@/p +/@mandir@/p' +case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in +*datarootdir*) ac_datarootdir_seen=yes;; +*@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 +$as_echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 + ac_datarootdir_hack=' + s&@datadir@&$datadir&g + s&@docdir@&$docdir&g + s&@infodir@&$infodir&g + s&@localedir@&$localedir&g + s&@mandir@&$mandir&g + s&\\\${datarootdir}&$datarootdir&g' ;; +esac +_ACEOF + +# Neutralize VPATH when `$srcdir' = `.'. +# Shell code in configure.ac might set extrasub. +# FIXME: do we really want to maintain this feature? +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +ac_sed_extra="$ac_vpsub +$extrasub +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +:t +/@[a-zA-Z_][a-zA-Z_0-9]*@/!b +s|@configure_input@|$ac_sed_conf_input|;t t +s&@top_builddir@&$ac_top_builddir_sub&;t t +s&@top_build_prefix@&$ac_top_build_prefix&;t t +s&@srcdir@&$ac_srcdir&;t t +s&@abs_srcdir@&$ac_abs_srcdir&;t t +s&@top_srcdir@&$ac_top_srcdir&;t t +s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t +s&@builddir@&$ac_builddir&;t t +s&@abs_builddir@&$ac_abs_builddir&;t t +s&@abs_top_builddir@&$ac_abs_top_builddir&;t t +s&@INSTALL@&$ac_INSTALL&;t t +s&@MKDIR_P@&$ac_MKDIR_P&;t t +$ac_datarootdir_hack +" +eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$ac_tmp/subs.awk" \ + >$ac_tmp/out || as_fn_error $? "could not create $ac_file" "$LINENO" 5 + +test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && + { ac_out=`sed -n '/\${datarootdir}/p' "$ac_tmp/out"`; test -n "$ac_out"; } && + { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' \ + "$ac_tmp/out"`; test -z "$ac_out"; } && + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir' +which seems to be undefined. Please make sure it is defined" >&5 +$as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' +which seems to be undefined. Please make sure it is defined" >&2;} + + rm -f "$ac_tmp/stdin" + case $ac_file in + -) cat "$ac_tmp/out" && rm -f "$ac_tmp/out";; + *) rm -f "$ac_file" && mv "$ac_tmp/out" "$ac_file";; + esac \ + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 + ;; + :H) + # + # CONFIG_HEADER + # + if test x"$ac_file" != x-; then + { + $as_echo "/* $configure_input */" \ + && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" + } >"$ac_tmp/config.h" \ + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 + if diff "$ac_file" "$ac_tmp/config.h" >/dev/null 2>&1; then + { $as_echo "$as_me:${as_lineno-$LINENO}: $ac_file is unchanged" >&5 +$as_echo "$as_me: $ac_file is unchanged" >&6;} + else + rm -f "$ac_file" + mv "$ac_tmp/config.h" "$ac_file" \ + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 + fi + else + $as_echo "/* $configure_input */" \ + && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" \ + || as_fn_error $? "could not create -" "$LINENO" 5 + fi +# Compute "$ac_file"'s index in $config_headers. +_am_arg="$ac_file" +_am_stamp_count=1 +for _am_header in $config_headers :; do + case $_am_header in + $_am_arg | $_am_arg:* ) + break ;; + * ) + _am_stamp_count=`expr $_am_stamp_count + 1` ;; + esac +done +echo "timestamp for $_am_arg" >`$as_dirname -- "$_am_arg" || +$as_expr X"$_am_arg" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$_am_arg" : 'X\(//\)[^/]' \| \ + X"$_am_arg" : 'X\(//\)$' \| \ + X"$_am_arg" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$_am_arg" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'`/stamp-h$_am_stamp_count + ;; + + :C) { $as_echo "$as_me:${as_lineno-$LINENO}: executing $ac_file commands" >&5 +$as_echo "$as_me: executing $ac_file commands" >&6;} + ;; + esac + + + case $ac_file$ac_mode in + "po-directories":C) + for ac_file in $CONFIG_FILES; do + # Support "outfile[:infile[:infile...]]" + case "$ac_file" in + *:*) ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; + esac + # PO directories have a Makefile.in generated from Makefile.in.in. + case "$ac_file" in */Makefile.in) + # Adjust a relative srcdir. + ac_dir=`echo "$ac_file"|sed 's%/[^/][^/]*$%%'` + ac_dir_suffix=/`echo "$ac_dir"|sed 's%^\./%%'` + ac_dots=`echo "$ac_dir_suffix"|sed 's%/[^/]*%../%g'` + # In autoconf-2.13 it is called $ac_given_srcdir. + # In autoconf-2.50 it is called $srcdir. + test -n "$ac_given_srcdir" || ac_given_srcdir="$srcdir" + case "$ac_given_srcdir" in + .) top_srcdir=`echo $ac_dots|sed 's%/$%%'` ;; + /*) top_srcdir="$ac_given_srcdir" ;; + *) top_srcdir="$ac_dots$ac_given_srcdir" ;; + esac + # Treat a directory as a PO directory if and only if it has a + # POTFILES.in file. This allows packages to have multiple PO + # directories under different names or in different locations. + if test -f "$ac_given_srcdir/$ac_dir/POTFILES.in"; then + rm -f "$ac_dir/POTFILES" + test -n "$as_me" && echo "$as_me: creating $ac_dir/POTFILES" || echo "creating $ac_dir/POTFILES" + gt_tab=`printf '\t'` + cat "$ac_given_srcdir/$ac_dir/POTFILES.in" | sed -e "/^#/d" -e "/^[ ${gt_tab}]*\$/d" -e "s,.*, $top_srcdir/& \\\\," | sed -e "\$s/\(.*\) \\\\/\1/" > "$ac_dir/POTFILES" + POMAKEFILEDEPS="POTFILES.in" + # ALL_LINGUAS, POFILES, UPDATEPOFILES, DUMMYPOFILES, GMOFILES depend + # on $ac_dir but don't depend on user-specified configuration + # parameters. + if test -f "$ac_given_srcdir/$ac_dir/LINGUAS"; then + # The LINGUAS file contains the set of available languages. + if test -n "$OBSOLETE_ALL_LINGUAS"; then + test -n "$as_me" && echo "$as_me: setting ALL_LINGUAS in configure.in is obsolete" || echo "setting ALL_LINGUAS in configure.in is obsolete" + fi + ALL_LINGUAS_=`sed -e "/^#/d" -e "s/#.*//" "$ac_given_srcdir/$ac_dir/LINGUAS"` + # Hide the ALL_LINGUAS assignment from automake < 1.5. + eval 'ALL_LINGUAS''=$ALL_LINGUAS_' + POMAKEFILEDEPS="$POMAKEFILEDEPS LINGUAS" + else + # The set of available languages was given in configure.in. + # Hide the ALL_LINGUAS assignment from automake < 1.5. + eval 'ALL_LINGUAS''=$OBSOLETE_ALL_LINGUAS' + fi + # Compute POFILES + # as $(foreach lang, $(ALL_LINGUAS), $(srcdir)/$(lang).po) + # Compute UPDATEPOFILES + # as $(foreach lang, $(ALL_LINGUAS), $(lang).po-update) + # Compute DUMMYPOFILES + # as $(foreach lang, $(ALL_LINGUAS), $(lang).nop) + # Compute GMOFILES + # as $(foreach lang, $(ALL_LINGUAS), $(srcdir)/$(lang).gmo) + case "$ac_given_srcdir" in + .) srcdirpre= ;; + *) srcdirpre='$(srcdir)/' ;; + esac + POFILES= + UPDATEPOFILES= + DUMMYPOFILES= + GMOFILES= + for lang in $ALL_LINGUAS; do + POFILES="$POFILES $srcdirpre$lang.po" + UPDATEPOFILES="$UPDATEPOFILES $lang.po-update" + DUMMYPOFILES="$DUMMYPOFILES $lang.nop" + GMOFILES="$GMOFILES $srcdirpre$lang.gmo" + done + # CATALOGS depends on both $ac_dir and the user's LINGUAS + # environment variable. + INST_LINGUAS= + if test -n "$ALL_LINGUAS"; then + for presentlang in $ALL_LINGUAS; do + useit=no + if test "%UNSET%" != "$LINGUAS"; then + desiredlanguages="$LINGUAS" + else + desiredlanguages="$ALL_LINGUAS" + fi + for desiredlang in $desiredlanguages; do + # Use the presentlang catalog if desiredlang is + # a. equal to presentlang, or + # b. a variant of presentlang (because in this case, + # presentlang can be used as a fallback for messages + # which are not translated in the desiredlang catalog). + case "$desiredlang" in + "$presentlang"*) useit=yes;; + esac + done + if test $useit = yes; then + INST_LINGUAS="$INST_LINGUAS $presentlang" + fi + done + fi + CATALOGS= + if test -n "$INST_LINGUAS"; then + for lang in $INST_LINGUAS; do + CATALOGS="$CATALOGS $lang.gmo" + done + fi + test -n "$as_me" && echo "$as_me: creating $ac_dir/Makefile" || echo "creating $ac_dir/Makefile" + sed -e "/^POTFILES =/r $ac_dir/POTFILES" -e "/^# Makevars/r $ac_given_srcdir/$ac_dir/Makevars" -e "s|@POFILES@|$POFILES|g" -e "s|@UPDATEPOFILES@|$UPDATEPOFILES|g" -e "s|@DUMMYPOFILES@|$DUMMYPOFILES|g" -e "s|@GMOFILES@|$GMOFILES|g" -e "s|@CATALOGS@|$CATALOGS|g" -e "s|@POMAKEFILEDEPS@|$POMAKEFILEDEPS|g" "$ac_dir/Makefile.in" > "$ac_dir/Makefile" + for f in "$ac_given_srcdir/$ac_dir"/Rules-*; do + if test -f "$f"; then + case "$f" in + *.orig | *.bak | *~) ;; + *) cat "$f" >> "$ac_dir/Makefile" ;; + esac + fi + done + fi + ;; + esac + done ;; + "depfiles":C) test x"$AMDEP_TRUE" != x"" || { + # Older Autoconf quotes --file arguments for eval, but not when files + # are listed without --file. Let's play safe and only enable the eval + # if we detect the quoting. + # TODO: see whether this extra hack can be removed once we start + # requiring Autoconf 2.70 or later. + case $CONFIG_FILES in #( + *\'*) : + eval set x "$CONFIG_FILES" ;; #( + *) : + set x $CONFIG_FILES ;; #( + *) : + ;; +esac + shift + # Used to flag and report bootstrapping failures. + am_rc=0 + for am_mf + do + # Strip MF so we end up with the name of the file. + am_mf=`$as_echo "$am_mf" | sed -e 's/:.*$//'` + # Check whether this is an Automake generated Makefile which includes + # dependency-tracking related rules and includes. + # Grep'ing the whole file directly is not great: AIX grep has a line + # limit of 2048, but all sed's we know have understand at least 4000. + sed -n 's,^am--depfiles:.*,X,p' "$am_mf" | grep X >/dev/null 2>&1 \ + || continue + am_dirpart=`$as_dirname -- "$am_mf" || +$as_expr X"$am_mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$am_mf" : 'X\(//\)[^/]' \| \ + X"$am_mf" : 'X\(//\)$' \| \ + X"$am_mf" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$am_mf" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + am_filepart=`$as_basename -- "$am_mf" || +$as_expr X/"$am_mf" : '.*/\([^/][^/]*\)/*$' \| \ + X"$am_mf" : 'X\(//\)$' \| \ + X"$am_mf" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X/"$am_mf" | + sed '/^.*\/\([^/][^/]*\)\/*$/{ + s//\1/ + q + } + /^X\/\(\/\/\)$/{ + s//\1/ + q + } + /^X\/\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + { echo "$as_me:$LINENO: cd "$am_dirpart" \ + && sed -e '/# am--include-marker/d' "$am_filepart" \ + | $MAKE -f - am--depfiles" >&5 + (cd "$am_dirpart" \ + && sed -e '/# am--include-marker/d' "$am_filepart" \ + | $MAKE -f - am--depfiles) >&5 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } || am_rc=$? + done + if test $am_rc -ne 0; then + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "Something went wrong bootstrapping makefile fragments + for automatic dependency tracking. Try re-running configure with the + '--disable-dependency-tracking' option to at least be able to build + the package (albeit without support for automatic dependency tracking). +See \`config.log' for more details" "$LINENO" 5; } + fi + { am_dirpart=; unset am_dirpart;} + { am_filepart=; unset am_filepart;} + { am_mf=; unset am_mf;} + { am_rc=; unset am_rc;} + rm -f conftest-deps.mk +} + ;; + + esac +done # for ac_tag + + +as_fn_exit 0 +_ACEOF +ac_clean_files=$ac_clean_files_save + +test $ac_write_fail = 0 || + as_fn_error $? "write failure creating $CONFIG_STATUS" "$LINENO" 5 + + +# configure is writing to config.log, and then calls config.status. +# config.status does its own redirection, appending to config.log. +# Unfortunately, on DOS this fails, as config.log is still kept open +# by configure, so config.status won't be able to write to it; its +# output is simply discarded. So we exec the FD to /dev/null, +# effectively closing config.log, so it can be properly (re)opened and +# appended to by config.status. When coming back to configure, we +# need to make the FD available again. +if test "$no_create" != yes; then + ac_cs_success=: + ac_config_status_args= + test "$silent" = yes && + ac_config_status_args="$ac_config_status_args --quiet" + exec 5>/dev/null + $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false + exec 5>>config.log + # Use ||, not &&, to avoid exiting from the if with $? = 1, which + # would make configure fail if this is the last instruction. + $ac_cs_success || as_fn_exit 1 +fi +if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5 +$as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} +fi + diff --git a/configure.ac b/configure.ac new file mode 100644 index 0000000..1f119c5 --- /dev/null +++ b/configure.ac @@ -0,0 +1,447 @@ +dnl Process this file with autoconf to produce a configure script. +AC_PREREQ(2.59) +AC_INIT(alsa-utils, 1.2.4) +AC_CONFIG_SRCDIR([aplay/aplay.c]) +AC_PREFIX_DEFAULT(/usr) +AM_INIT_AUTOMAKE + +AM_MAINTAINER_MODE([enable]) + +AM_GNU_GETTEXT([external]) +AM_GNU_GETTEXT_VERSION([0.19.8]) + +dnl Checks for programs. + +AC_PROG_CC +dnl AC_PROG_CXX +AC_PROG_INSTALL +AC_PROG_MKDIR_P +AC_PROG_LN_S +AC_PROG_SED +PKG_PROG_PKG_CONFIG +AM_PATH_ALSA(1.0.27) +if test "x$enable_alsatest" = "xyes"; then +AC_CHECK_FUNC([snd_ctl_elem_add_enumerated], + , [AC_ERROR([No user enum control support in alsa-lib])]) +fi + +dnl Check components +AC_CHECK_HEADERS([alsa/pcm.h], [have_pcm="yes"], [have_pcm="no"], + [#include ]) +AC_CHECK_HEADERS([alsa/mixer.h], [have_mixer="yes"], [have_mixer="no"], + [#include ]) +AC_CHECK_HEADERS([alsa/rawmidi.h], [have_rawmidi="yes"], [have_rawmidi="no"], + [#include ]) +AC_CHECK_HEADERS([alsa/seq.h], [have_seq="yes"], [have_seq="no"], + [#include ]) +AC_CHECK_HEADERS([alsa/use-case.h], [have_ucm="yes"], [have_ucm="no"], + [#include ]) +AC_CHECK_HEADERS([alsa/topology.h], [have_topology="yes"], [have_topology="no"], + [#include ]) +AC_CHECK_HEADERS([samplerate.h], [have_samplerate="yes"], [have_samplerate="no"], + [#include ]) + +AC_CHECK_LIB([asound], [snd_seq_client_info_get_card], [HAVE_SEQ_CLIENT_INFO_GET_CARD="yes"]) +if test "$HAVE_SEQ_CLIENT_INFO_GET_CARD" = "yes" ; then + AC_DEFINE([HAVE_SEQ_CLIENT_INFO_GET_CARD], 1, [alsa-lib supports snd_seq_client_info_get_card]) +fi +AC_CHECK_LIB([asound], [snd_seq_client_info_get_pid], [HAVE_SEQ_CLIENT_INFO_GET_PID="yes"]) +if test "$HAVE_SEQ_CLIENT_INFO_GET_PID" = "yes" ; then + AC_DEFINE([HAVE_SEQ_CLIENT_INFO_GET_PID], 1, [alsa-lib supports snd_seq_client_info_get_pid]) +fi +AC_CHECK_LIB([atopology], [snd_tplg_save], [have_topology="yes"], [have_topology="no"]) + +# +# NOTE: The library 'libffado' (at least v2.4.1) executes ctor/dtor of instances +# for some objects in startup/finish routines of C runtime. As a result, it +# outputs some superfluos messages. Furthermore, it brings much memory leak +# internally. Totally, libffado support is not recommended at all in usual +# purposes except for technical preview. +# +AC_CHECK_LIB([ffado], [ffado_streaming_init], [have_ffado="yes"], [have_ffado="no"]) +AS_IF([test x"$have_ffado" = xyes], + [AC_DEFINE([WITH_FFADO], [1], [Define if FFADO library is available])]) + +AM_CONDITIONAL(HAVE_PCM, test "$have_pcm" = "yes") +AM_CONDITIONAL(HAVE_MIXER, test "$have_mixer" = "yes") +AM_CONDITIONAL(HAVE_RAWMIDI, test "$have_rawmidi" = "yes") +AM_CONDITIONAL(HAVE_SEQ, test "$have_seq" = "yes") +AM_CONDITIONAL(HAVE_UCM, test "$have_ucm" = "yes") +AM_CONDITIONAL(HAVE_TOPOLOGY, test "$have_topology" = "yes") +AM_CONDITIONAL(HAVE_SAMPLERATE, test "$have_samplerate" = "yes") +AM_CONDITIONAL(HAVE_FFADO, test "$have_ffado" = "yes") + +dnl Use tinyalsa +alsabat_backend_tiny= +AC_ARG_ENABLE(alsabat_backend_tiny, + AS_HELP_STRING([--enable-alsabat-backend-tiny], [Use tinyalsa for alsabat backend]), + [case "${enableval}" in + yes) alsabat_backend_tiny=true ;; + no) alsabat_backend_tiny=false ;; + *) AC_MSG_ERROR(bad value ${enableval} for --enable-alsabat-backend-tiny) ;; + esac],[alsabat_backend_tiny=false]) + +dnl Disable bat +bat= +if test "$have_pcm" = "yes"; then +AC_ARG_ENABLE(bat, + AS_HELP_STRING([--disable-bat], [Disable bat compilation]), + [case "${enableval}" in + yes) bat=true ;; + no) bat=false ;; + *) AC_MSG_ERROR(bad value ${enableval} for --enable-bat) ;; + esac],[bat=true]) +fi +AM_CONDITIONAL(BAT, test x$bat = xtrue) + +if test x$bat = xtrue; then + + saved_CFLAGS="$CFLAGS" + saved_LDFLAGS="$LDFLAGS" + saved_LIBS="$LIBS" + FFTW_INC="" + FFTW_LIB="" + FFTW_CFLAGS="" + dnl Check for libfftw3 + have_libfftw3="yes" + AC_CHECK_LIB([fftw3f], [fftwf_malloc], , [have_libfftw3="no"]) + dnl Check for libtinyalsa + have_libtinyalsa= + if test x$alsabat_backend_tiny = xtrue; then + have_libtinyalsa="yes" + AC_CHECK_LIB([tinyalsa], [pcm_open], , [have_libtinyalsa="no"]) + fi + AC_CHECK_LIB([m], [sqrtf], , [AC_MSG_ERROR([Error: Need sqrtf])]) + AC_CHECK_LIB([pthread], [pthread_create], , [AC_MSG_ERROR([Error: need PTHREAD library])]) + FFTW_CFLAGS="$CFLAGS" + FFTW_LIB="$LIBS" + CFLAGS="$saved_CFLAGS" + LDFLAGS="$saved_LDFLAGS" + LIBS="$saved_LIBS" + AC_SUBST(FFTW_INC) + AC_SUBST(FFTW_LIB) + AC_SUBST(FFTW_CFLAGS) + +fi +AM_CONDITIONAL(HAVE_LIBFFTW3, test "$have_libfftw3" = "yes") +AM_CONDITIONAL(HAVE_LIBTINYALSA, test "$have_libtinyalsa" = "yes") + +dnl Check for librt +LIBRT="" +AC_MSG_CHECKING(for librt) +AC_ARG_WITH(librt, + AS_HELP_STRING([--with-librt], [Use librt for monotonic clock (default = yes)]), + [ have_librt="$withval" ], [ have_librt="yes" ]) +if test "$have_librt" = "yes"; then + AC_CHECK_LIB([rt], [clock_gettime], [HAVE_LIBRT="yes"]) + if test "$HAVE_LIBRT" = "yes" ; then + LIBRT="-lrt" + AC_DEFINE([HAVE_LIBRT], 1, [Have librt]) + AC_DEFINE([HAVE_CLOCK_GETTIME], 1, [Have clock gettime]) + fi +else + AC_MSG_RESULT(no) +fi + +dnl Disable alsamixer +CURSESINC="" +CURSESLIB="" +CURSES_CFLAGS="" +alsamixer= +if test "$have_mixer" = "yes"; then +AC_ARG_ENABLE(alsamixer, + AS_HELP_STRING([--disable-alsamixer], [Disable alsamixer compilation]), + [case "${enableval}" in + yes) alsamixer=true ;; + no) alsamixer=false ;; + *) AC_MSG_ERROR(bad value ${enableval} for --enable-alsamixer) ;; + esac],[alsamixer=true]) +fi +AM_CONDITIONAL(ALSAMIXER, test x$alsamixer = xtrue) + +dnl Disable alsaconf +AC_ARG_ENABLE(alsaconf, + AS_HELP_STRING([--disable-alsaconf], [Disable alsaconf packaging]), + [case "${enableval}" in + yes) alsaconf=true ;; + no) alsaconf=false ;; + *) AC_MSG_ERROR(bad value ${enableval} for --enable-alsaconf) ;; + esac],[alsaconf=true]) +AM_CONDITIONAL(ALSACONF, test x$alsaconf = xtrue) + +dnl Disable alsaloop +AC_ARG_ENABLE(alsaloop, + AS_HELP_STRING([--disable-alsaloop], [Disable alsaloop packaging]), + [case "${enableval}" in + yes) alsaloop=true ;; + no) alsaloop=false ;; + *) AC_MSG_ERROR(bad value ${enableval} for --enable-alsaloop) ;; + esac],[alsaloop=true]) +AM_CONDITIONAL(ALSALOOP, test x$alsaloop = xtrue) + +xmlto_available="" +AC_ARG_ENABLE(xmlto, + AS_HELP_STRING([--disable-xmlto], [Disable man page creation via xmlto]), + xmlto="$enableval", xmlto="yes") +if test "$xmlto" = "yes"; then + AC_CHECK_PROG([xmlto_available], [xmlto], [yes]) +fi +AM_CONDITIONAL(USE_XMLTO, test x"$xmlto_available" = xyes) + +rst2man_available="" +AC_ARG_ENABLE(rst2man, + AS_HELP_STRING([--disable-rst2man], [Disable man page creation via rst2man]), + rst2man="$enableval", rst2man="yes") +if test "$rst2man" = "yes"; then + AC_CHECK_PROG([rst2man_available], [rst2man], [yes]) +fi +AM_CONDITIONAL(USE_RST2MAN, test x"$rst2man_available" = xyes) + +AC_ARG_WITH( + [udev-rules-dir], + AS_HELP_STRING([--with-udev-rules-dir=DIR],[Directory where to install udev rules to (default=auto)]), + [udevrulesdir="$withval"], + [udevdir=$($PKG_CONFIG udev --variable=udevdir) + if test "x$udevdir" = "x"; then + udevrulesdir="/lib/udev/rules.d" + else + udevrulesdir="$udevdir/rules.d" + fi]) +AC_SUBST(udevrulesdir) + +dnl Checks for header files. +AC_HEADER_STDC +if test x$alsamixer = xtrue; then + AC_ARG_WITH(curses, + AS_HELP_STRING([--with-curses=libname], [Specify the curses library to use (default=auto)]), + curseslib="$withval", + curseslib="auto") + CURSESLIBDIR="" + NCURSESLIBSUFFIX="" + CURSES_NLS="no" + if test "$curseslib" = "ncursesw" -o \( "$curseslib" = "auto" -a "$USE_NLS" = "yes" \); then + dnl First try out pkg-config, then fall back to old config scripts. + PKG_CHECK_MODULES([NCURSESW], [ncursesw], [ + CURSESINC="" + CURSESLIB="${NCURSESW_LIBS}" + CURSESLIBDIR= + CURSES_CFLAGS="${NCURSESW_CFLAGS}" + curseslib="ncursesw" + ], [ + AC_CHECK_PROG([ncursesw5_config], [ncursesw5-config], [yes]) + if test "$ncursesw5_config" = "yes"; then + CURSESINC="" + CURSESLIB=`ncursesw5-config --libs` + CURSESLIBDIR=`ncursesw5-config --libdir` + CURSES_CFLAGS=`ncursesw5-config --cflags` + curseslib="ncursesw" + else + AC_CHECK_LIB(ncursesw, initscr, + [ CURSESINC=''; CURSESLIB='-lncursesw'; curseslib="ncursesw"]) + fi + ]) + if test -n "$CURSESINC"; then + NCURSESLIBSUFFIX="w" + CURSES_NLS="yes" + fi + fi + if test "$curseslib" = "ncurses" -o "$curseslib" = "auto"; then + dnl First try out pkg-config, then fall back to old config scripts. + PKG_CHECK_MODULES([NCURSES], [ncurses], [ + CURSESINC="" + CURSESLIB="${NCURSES_LIBS}" + CURSESLIBDIR= + CURSES_CFLAGS="${NCURSES_CFLAGS}" + curseslib="ncurses" + ], [ + AC_CHECK_PROG([ncurses5_config], [ncurses5-config], [yes]) + if test "$ncurses5_config" = "yes"; then + CURSESINC="" + CURSESLIB=`ncurses5-config --libs` + CURSESLIBDIR=`ncurses5-config --libdir` + CURSES_CFLAGS=`ncurses5-config --cflags` + curseslib="ncurses" + else + AC_CHECK_LIB(ncurses, initscr, + [ CURSESINC=''; CURSESLIB='-lncurses'; curseslib="ncurses"]) + fi + ]) + fi + if test "$curseslib" = "curses" -o "$curseslib" = "auto"; then + AC_CHECK_LIB(curses, initscr, + [ CURSESINC=''; CURSESLIB='-lcurses'; curseslib="curses"]) + fi + if test -z "$CURSESINC"; then + AC_MSG_ERROR(this packages requires a curses library) + fi + + AC_MSG_CHECKING([for curses library]) + AC_MSG_RESULT([$curseslib]) + AC_MSG_CHECKING([for curses header name]) + AC_MSG_RESULT([$CURSESINC]) + AC_MSG_CHECKING([for curses compiler flags]) + AC_MSG_RESULT([$CURSES_CFLAGS]) + + dnl CURSESLIBS might have the library path at the beginning. If so, we cut it + dnl off so that we can insert the other curses libraries before the ncurses + dnl library but after the library path (which is later again prepended below). + if test -n "$CURSESLIBDIR"; then + if test "-L$CURSESLIBDIR " = "$(echo $CURSESLIB | cut -c-$((${#CURSESLIBDIR}+3)) )"; then + CURSESLIB="$(echo $CURSESLIB | cut -c$((${#CURSESLIBDIR}+4))-)" + fi + fi + + saved_CFLAGS="$CFLAGS" + saved_LDFLAGS="$LDFLAGS" + saved_LIBS="$LIBS" + CFLAGS="$CFLAGS $CURSES_CFLAGS" + if test -n "$CURSESLIBDIR"; then + LDFLAGS="$LDFLAGS -L$CURSESLIBDIR" + fi + LIBS="$CURSESLIB $LIBS" + + AC_TRY_LINK([#include ], [set_escdelay(100);],[HAVE_CURSES_ESCDELAY="yes"]) + if test "$HAVE_CURSES_ESCDELAY" = "yes"; then + AC_DEFINE([HAVE_CURSES_ESCDELAY], 1, [Have curses set_escdelay]) + fi + + if test "$USE_NLS" = "yes"; then + AC_MSG_CHECKING([for curses NLS support]) + dnl In theory, a single-byte curses works just fine in ISO 8859-* locales. + dnl In practice, however, everybody uses UTF-8 nowadays, so we'd better + dnl check for wide-character support. + dnl For ncurses/ncursesw, CURSES_NLS was already set above. + if test "$curseslib" = "curses"; then + AC_TRY_LINK([ + #define _XOPEN_SOURCE 1 + #define _XOPEN_SOURCE_EXTENDED 1 + #include + ], [ + cchar_t wc; + setcchar(&wc, L"x", A_NORMAL, 0, 0); + ], + [CURSES_NLS="yes"]) + fi + AC_MSG_RESULT([$CURSES_NLS]) + if test "$CURSES_NLS" = "yes"; then + AC_DEFINE([ENABLE_NLS_IN_CURSES], [1], + [Define if curses-based programs can show translated messages.]) + fi + fi + + AC_CHECK_HEADERS([panel.h menu.h form.h], [], + [AC_MSG_ERROR([required curses helper header not found])]) + AC_CHECK_LIB([panel$NCURSESLIBSUFFIX], [new_panel], + [CURSESLIB="-lpanel$NCURSESLIBSUFFIX $CURSESLIB"], + [AC_MSG_ERROR([panel$NCURSESLIBSUFFIX library not found])]) + AC_CHECK_LIB([menu$NCURSESLIBSUFFIX], [new_menu], + [CURSESLIB="-lmenu$NCURSESLIBSUFFIX $CURSESLIB"], + [AC_MSG_ERROR([menu$NCURSESLIBSUFFIX library not found])]) + AC_CHECK_LIB([form$NCURSESLIBSUFFIX], [new_form], + [CURSESLIB="-lform$NCURSESLIBSUFFIX $CURSESLIB"], + [AC_MSG_ERROR([form$NCURSESLIBSUFFIX library not found])]) + + CFLAGS="$saved_CFLAGS" + LDFLAGS="$saved_LDFLAGS" + LIBS="$saved_LIBS" + + if test -n "$CURSESLIBDIR"; then + CURSESLIB="-L$CURSESLIBDIR $CURSESLIB" + fi + + AC_MSG_CHECKING([for curses linker flags]) + AC_MSG_RESULT([$CURSESLIB]) +fi + +AC_SUBST(CURSESINC) +AC_SUBST(CURSESLIB) +AC_SUBST(CURSES_CFLAGS) + +test "x$prefix" = xNONE && prefix=$ac_default_prefix + +eval dir="$datadir" +case "$dir" in +/*) ;; +*) dir="$prefix/share" +esac + +soundsdir="$dir/sounds/alsa" +AC_DEFINE_UNQUOTED(SOUNDSDIR, "$soundsdir", [directory containing sample data]) + +mydatadir="$dir/alsa" +AC_DEFINE_UNQUOTED(DATADIR, "$mydatadir", [directory containing alsa configuration]) +AC_SUBST(mydatadir) + +AC_ARG_WITH(testsound, + AS_HELP_STRING([--with-testsound=file], [give the path of test sound file for alsaconf]), + TESTSOUND="$withval", + TESTSOUND="$dir/test.wav") +AC_SUBST(TESTSOUND) + +AC_CONFIG_HEADERS(include/aconfig.h) + +dnl Checks for typedefs, structures, and compiler characteristics. +AC_C_CONST +AC_C_INLINE +AC_HEADER_TIME + +dnl Checks for library functions. +AC_PROG_GCC_TRADITIONAL + +dnl Enable largefile support +AC_SYS_LARGEFILE + +SAVE_UTIL_VERSION + +AC_SUBST(LIBRT) + +dnl Check for systemd +PKG_CHECK_MODULES(SYSTEMD, [systemd >= 18], + [have_min_systemd="yes"], + [have_min_systemd="no"]) +AC_ARG_WITH([systemdsystemunitdir], + AS_HELP_STRING([--with-systemdsystemunitdir=DIR], [Directory for systemd service files]), + [], [with_systemdsystemunitdir=$($PKG_CONFIG --variable=systemdsystemunitdir systemd)]) +if test "x$with_systemdsystemunitdir" != xno; then + AC_SUBST([systemdsystemunitdir], [$with_systemdsystemunitdir]) +fi +AM_CONDITIONAL(HAVE_SYSTEMD, [test "$have_min_systemd" = "yes" \ + -a -n "$with_systemdsystemunitdir" -a "x$with_systemdsystemunitdir" != xno ]) + +AC_ARG_WITH([asound-state-dir], + AS_HELP_STRING([--with-asound-state-dir=DIR], [Directory to place asound.state file in]), + [ASOUND_STATE_DIR="$withval"], + [ASOUND_STATE_DIR="/var/lib/alsa"]) +AC_SUBST(ASOUND_STATE_DIR) + +AC_ARG_WITH([alsactl-lock-dir], + AS_HELP_STRING([--with-alsactl-lock-dir=DIR], [Directory to place lock files in]), + [ASOUND_LOCK_DIR="$withval"], + [ASOUND_LOCK_DIR="/var/lock"]) +AC_SUBST(ASOUND_LOCK_DIR) + +AC_ARG_WITH([alsactl-pidfile-dir], + AS_HELP_STRING([--with-alsactl-pidfile-dir=DIR], [Directory to place alsactl.pid file in]), + [ALSACTL_PIDFILE_DIR="$withval"], + [ALSACTL_PIDFILE_DIR="/var/run"]) +AC_SUBST(ALSACTL_PIDFILE_DIR) + +AC_ARG_WITH([alsactl-daemonswitch], + AS_HELP_STRING([--with-alsactl-daemonswitch=FILE], [File to test for the daemon mode]), + [ALSACTL_DAEMONSWITCH="$withval"], + [ALSACTL_DAEMONSWITCH="/etc/alsa/state-daemon.conf"]) +AC_SUBST(ALSACTL_DAEMONSWITCH) + +AC_OUTPUT(Makefile alsactl/Makefile alsactl/init/Makefile \ + alsamixer/Makefile amidi/Makefile amixer/Makefile \ + m4/Makefile po/Makefile.in \ + alsaconf/alsaconf alsaconf/Makefile \ + alsaconf/po/Makefile \ + alsaucm/Makefile topology/Makefile \ + bat/Makefile bat/tests/Makefile bat/tests/asound_state/Makefile \ + aplay/Makefile include/Makefile iecset/Makefile utils/Makefile \ + utils/alsa-utils.spec seq/Makefile seq/aconnect/Makefile \ + seq/aplaymidi/Makefile seq/aseqdump/Makefile seq/aseqnet/Makefile \ + speaker-test/Makefile speaker-test/samples/Makefile \ + alsaloop/Makefile alsa-info/Makefile \ + axfer/Makefile axfer/test/Makefile) diff --git a/depcomp b/depcomp new file mode 100755 index 0000000..65cbf70 --- /dev/null +++ b/depcomp @@ -0,0 +1,791 @@ +#! /bin/sh +# depcomp - compile a program generating dependencies as side-effects + +scriptversion=2018-03-07.03; # UTC + +# Copyright (C) 1999-2018 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +# Originally written by Alexandre Oliva . + +case $1 in + '') + echo "$0: No command. Try '$0 --help' for more information." 1>&2 + exit 1; + ;; + -h | --h*) + cat <<\EOF +Usage: depcomp [--help] [--version] PROGRAM [ARGS] + +Run PROGRAMS ARGS to compile a file, generating dependencies +as side-effects. + +Environment variables: + depmode Dependency tracking mode. + source Source file read by 'PROGRAMS ARGS'. + object Object file output by 'PROGRAMS ARGS'. + DEPDIR directory where to store dependencies. + depfile Dependency file to output. + tmpdepfile Temporary file to use when outputting dependencies. + libtool Whether libtool is used (yes/no). + +Report bugs to . +EOF + exit $? + ;; + -v | --v*) + echo "depcomp $scriptversion" + exit $? + ;; +esac + +# Get the directory component of the given path, and save it in the +# global variables '$dir'. Note that this directory component will +# be either empty or ending with a '/' character. This is deliberate. +set_dir_from () +{ + case $1 in + */*) dir=`echo "$1" | sed -e 's|/[^/]*$|/|'`;; + *) dir=;; + esac +} + +# Get the suffix-stripped basename of the given path, and save it the +# global variable '$base'. +set_base_from () +{ + base=`echo "$1" | sed -e 's|^.*/||' -e 's/\.[^.]*$//'` +} + +# If no dependency file was actually created by the compiler invocation, +# we still have to create a dummy depfile, to avoid errors with the +# Makefile "include basename.Plo" scheme. +make_dummy_depfile () +{ + echo "#dummy" > "$depfile" +} + +# Factor out some common post-processing of the generated depfile. +# Requires the auxiliary global variable '$tmpdepfile' to be set. +aix_post_process_depfile () +{ + # If the compiler actually managed to produce a dependency file, + # post-process it. + if test -f "$tmpdepfile"; then + # Each line is of the form 'foo.o: dependency.h'. + # Do two passes, one to just change these to + # $object: dependency.h + # and one to simply output + # dependency.h: + # which is needed to avoid the deleted-header problem. + { sed -e "s,^.*\.[$lower]*:,$object:," < "$tmpdepfile" + sed -e "s,^.*\.[$lower]*:[$tab ]*,," -e 's,$,:,' < "$tmpdepfile" + } > "$depfile" + rm -f "$tmpdepfile" + else + make_dummy_depfile + fi +} + +# A tabulation character. +tab=' ' +# A newline character. +nl=' +' +# Character ranges might be problematic outside the C locale. +# These definitions help. +upper=ABCDEFGHIJKLMNOPQRSTUVWXYZ +lower=abcdefghijklmnopqrstuvwxyz +digits=0123456789 +alpha=${upper}${lower} + +if test -z "$depmode" || test -z "$source" || test -z "$object"; then + echo "depcomp: Variables source, object and depmode must be set" 1>&2 + exit 1 +fi + +# Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po. +depfile=${depfile-`echo "$object" | + sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`} +tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`} + +rm -f "$tmpdepfile" + +# Avoid interferences from the environment. +gccflag= dashmflag= + +# Some modes work just like other modes, but use different flags. We +# parameterize here, but still list the modes in the big case below, +# to make depend.m4 easier to write. Note that we *cannot* use a case +# here, because this file can only contain one case statement. +if test "$depmode" = hp; then + # HP compiler uses -M and no extra arg. + gccflag=-M + depmode=gcc +fi + +if test "$depmode" = dashXmstdout; then + # This is just like dashmstdout with a different argument. + dashmflag=-xM + depmode=dashmstdout +fi + +cygpath_u="cygpath -u -f -" +if test "$depmode" = msvcmsys; then + # This is just like msvisualcpp but w/o cygpath translation. + # Just convert the backslash-escaped backslashes to single forward + # slashes to satisfy depend.m4 + cygpath_u='sed s,\\\\,/,g' + depmode=msvisualcpp +fi + +if test "$depmode" = msvc7msys; then + # This is just like msvc7 but w/o cygpath translation. + # Just convert the backslash-escaped backslashes to single forward + # slashes to satisfy depend.m4 + cygpath_u='sed s,\\\\,/,g' + depmode=msvc7 +fi + +if test "$depmode" = xlc; then + # IBM C/C++ Compilers xlc/xlC can output gcc-like dependency information. + gccflag=-qmakedep=gcc,-MF + depmode=gcc +fi + +case "$depmode" in +gcc3) +## gcc 3 implements dependency tracking that does exactly what +## we want. Yay! Note: for some reason libtool 1.4 doesn't like +## it if -MD -MP comes after the -MF stuff. Hmm. +## Unfortunately, FreeBSD c89 acceptance of flags depends upon +## the command line argument order; so add the flags where they +## appear in depend2.am. Note that the slowdown incurred here +## affects only configure: in makefiles, %FASTDEP% shortcuts this. + for arg + do + case $arg in + -c) set fnord "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" "$arg" ;; + *) set fnord "$@" "$arg" ;; + esac + shift # fnord + shift # $arg + done + "$@" + stat=$? + if test $stat -ne 0; then + rm -f "$tmpdepfile" + exit $stat + fi + mv "$tmpdepfile" "$depfile" + ;; + +gcc) +## Note that this doesn't just cater to obsosete pre-3.x GCC compilers. +## but also to in-use compilers like IMB xlc/xlC and the HP C compiler. +## (see the conditional assignment to $gccflag above). +## There are various ways to get dependency output from gcc. Here's +## why we pick this rather obscure method: +## - Don't want to use -MD because we'd like the dependencies to end +## up in a subdir. Having to rename by hand is ugly. +## (We might end up doing this anyway to support other compilers.) +## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like +## -MM, not -M (despite what the docs say). Also, it might not be +## supported by the other compilers which use the 'gcc' depmode. +## - Using -M directly means running the compiler twice (even worse +## than renaming). + if test -z "$gccflag"; then + gccflag=-MD, + fi + "$@" -Wp,"$gccflag$tmpdepfile" + stat=$? + if test $stat -ne 0; then + rm -f "$tmpdepfile" + exit $stat + fi + rm -f "$depfile" + echo "$object : \\" > "$depfile" + # The second -e expression handles DOS-style file names with drive + # letters. + sed -e 's/^[^:]*: / /' \ + -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile" +## This next piece of magic avoids the "deleted header file" problem. +## The problem is that when a header file which appears in a .P file +## is deleted, the dependency causes make to die (because there is +## typically no way to rebuild the header). We avoid this by adding +## dummy dependencies for each header file. Too bad gcc doesn't do +## this for us directly. +## Some versions of gcc put a space before the ':'. On the theory +## that the space means something, we add a space to the output as +## well. hp depmode also adds that space, but also prefixes the VPATH +## to the object. Take care to not repeat it in the output. +## Some versions of the HPUX 10.20 sed can't process this invocation +## correctly. Breaking it into two sed invocations is a workaround. + tr ' ' "$nl" < "$tmpdepfile" \ + | sed -e 's/^\\$//' -e '/^$/d' -e "s|.*$object$||" -e '/:$/d' \ + | sed -e 's/$/ :/' >> "$depfile" + rm -f "$tmpdepfile" + ;; + +hp) + # This case exists only to let depend.m4 do its work. It works by + # looking at the text of this script. This case will never be run, + # since it is checked for above. + exit 1 + ;; + +sgi) + if test "$libtool" = yes; then + "$@" "-Wp,-MDupdate,$tmpdepfile" + else + "$@" -MDupdate "$tmpdepfile" + fi + stat=$? + if test $stat -ne 0; then + rm -f "$tmpdepfile" + exit $stat + fi + rm -f "$depfile" + + if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files + echo "$object : \\" > "$depfile" + # Clip off the initial element (the dependent). Don't try to be + # clever and replace this with sed code, as IRIX sed won't handle + # lines with more than a fixed number of characters (4096 in + # IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines; + # the IRIX cc adds comments like '#:fec' to the end of the + # dependency line. + tr ' ' "$nl" < "$tmpdepfile" \ + | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' \ + | tr "$nl" ' ' >> "$depfile" + echo >> "$depfile" + # The second pass generates a dummy entry for each header file. + tr ' ' "$nl" < "$tmpdepfile" \ + | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \ + >> "$depfile" + else + make_dummy_depfile + fi + rm -f "$tmpdepfile" + ;; + +xlc) + # This case exists only to let depend.m4 do its work. It works by + # looking at the text of this script. This case will never be run, + # since it is checked for above. + exit 1 + ;; + +aix) + # The C for AIX Compiler uses -M and outputs the dependencies + # in a .u file. In older versions, this file always lives in the + # current directory. Also, the AIX compiler puts '$object:' at the + # start of each line; $object doesn't have directory information. + # Version 6 uses the directory in both cases. + set_dir_from "$object" + set_base_from "$object" + if test "$libtool" = yes; then + tmpdepfile1=$dir$base.u + tmpdepfile2=$base.u + tmpdepfile3=$dir.libs/$base.u + "$@" -Wc,-M + else + tmpdepfile1=$dir$base.u + tmpdepfile2=$dir$base.u + tmpdepfile3=$dir$base.u + "$@" -M + fi + stat=$? + if test $stat -ne 0; then + rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" + exit $stat + fi + + for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" + do + test -f "$tmpdepfile" && break + done + aix_post_process_depfile + ;; + +tcc) + # tcc (Tiny C Compiler) understand '-MD -MF file' since version 0.9.26 + # FIXME: That version still under development at the moment of writing. + # Make that this statement remains true also for stable, released + # versions. + # It will wrap lines (doesn't matter whether long or short) with a + # trailing '\', as in: + # + # foo.o : \ + # foo.c \ + # foo.h \ + # + # It will put a trailing '\' even on the last line, and will use leading + # spaces rather than leading tabs (at least since its commit 0394caf7 + # "Emit spaces for -MD"). + "$@" -MD -MF "$tmpdepfile" + stat=$? + if test $stat -ne 0; then + rm -f "$tmpdepfile" + exit $stat + fi + rm -f "$depfile" + # Each non-empty line is of the form 'foo.o : \' or ' dep.h \'. + # We have to change lines of the first kind to '$object: \'. + sed -e "s|.*:|$object :|" < "$tmpdepfile" > "$depfile" + # And for each line of the second kind, we have to emit a 'dep.h:' + # dummy dependency, to avoid the deleted-header problem. + sed -n -e 's|^ *\(.*\) *\\$|\1:|p' < "$tmpdepfile" >> "$depfile" + rm -f "$tmpdepfile" + ;; + +## The order of this option in the case statement is important, since the +## shell code in configure will try each of these formats in the order +## listed in this file. A plain '-MD' option would be understood by many +## compilers, so we must ensure this comes after the gcc and icc options. +pgcc) + # Portland's C compiler understands '-MD'. + # Will always output deps to 'file.d' where file is the root name of the + # source file under compilation, even if file resides in a subdirectory. + # The object file name does not affect the name of the '.d' file. + # pgcc 10.2 will output + # foo.o: sub/foo.c sub/foo.h + # and will wrap long lines using '\' : + # foo.o: sub/foo.c ... \ + # sub/foo.h ... \ + # ... + set_dir_from "$object" + # Use the source, not the object, to determine the base name, since + # that's sadly what pgcc will do too. + set_base_from "$source" + tmpdepfile=$base.d + + # For projects that build the same source file twice into different object + # files, the pgcc approach of using the *source* file root name can cause + # problems in parallel builds. Use a locking strategy to avoid stomping on + # the same $tmpdepfile. + lockdir=$base.d-lock + trap " + echo '$0: caught signal, cleaning up...' >&2 + rmdir '$lockdir' + exit 1 + " 1 2 13 15 + numtries=100 + i=$numtries + while test $i -gt 0; do + # mkdir is a portable test-and-set. + if mkdir "$lockdir" 2>/dev/null; then + # This process acquired the lock. + "$@" -MD + stat=$? + # Release the lock. + rmdir "$lockdir" + break + else + # If the lock is being held by a different process, wait + # until the winning process is done or we timeout. + while test -d "$lockdir" && test $i -gt 0; do + sleep 1 + i=`expr $i - 1` + done + fi + i=`expr $i - 1` + done + trap - 1 2 13 15 + if test $i -le 0; then + echo "$0: failed to acquire lock after $numtries attempts" >&2 + echo "$0: check lockdir '$lockdir'" >&2 + exit 1 + fi + + if test $stat -ne 0; then + rm -f "$tmpdepfile" + exit $stat + fi + rm -f "$depfile" + # Each line is of the form `foo.o: dependent.h', + # or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'. + # Do two passes, one to just change these to + # `$object: dependent.h' and one to simply `dependent.h:'. + sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile" + # Some versions of the HPUX 10.20 sed can't process this invocation + # correctly. Breaking it into two sed invocations is a workaround. + sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" \ + | sed -e 's/$/ :/' >> "$depfile" + rm -f "$tmpdepfile" + ;; + +hp2) + # The "hp" stanza above does not work with aCC (C++) and HP's ia64 + # compilers, which have integrated preprocessors. The correct option + # to use with these is +Maked; it writes dependencies to a file named + # 'foo.d', which lands next to the object file, wherever that + # happens to be. + # Much of this is similar to the tru64 case; see comments there. + set_dir_from "$object" + set_base_from "$object" + if test "$libtool" = yes; then + tmpdepfile1=$dir$base.d + tmpdepfile2=$dir.libs/$base.d + "$@" -Wc,+Maked + else + tmpdepfile1=$dir$base.d + tmpdepfile2=$dir$base.d + "$@" +Maked + fi + stat=$? + if test $stat -ne 0; then + rm -f "$tmpdepfile1" "$tmpdepfile2" + exit $stat + fi + + for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" + do + test -f "$tmpdepfile" && break + done + if test -f "$tmpdepfile"; then + sed -e "s,^.*\.[$lower]*:,$object:," "$tmpdepfile" > "$depfile" + # Add 'dependent.h:' lines. + sed -ne '2,${ + s/^ *// + s/ \\*$// + s/$/:/ + p + }' "$tmpdepfile" >> "$depfile" + else + make_dummy_depfile + fi + rm -f "$tmpdepfile" "$tmpdepfile2" + ;; + +tru64) + # The Tru64 compiler uses -MD to generate dependencies as a side + # effect. 'cc -MD -o foo.o ...' puts the dependencies into 'foo.o.d'. + # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put + # dependencies in 'foo.d' instead, so we check for that too. + # Subdirectories are respected. + set_dir_from "$object" + set_base_from "$object" + + if test "$libtool" = yes; then + # Libtool generates 2 separate objects for the 2 libraries. These + # two compilations output dependencies in $dir.libs/$base.o.d and + # in $dir$base.o.d. We have to check for both files, because + # one of the two compilations can be disabled. We should prefer + # $dir$base.o.d over $dir.libs/$base.o.d because the latter is + # automatically cleaned when .libs/ is deleted, while ignoring + # the former would cause a distcleancheck panic. + tmpdepfile1=$dir$base.o.d # libtool 1.5 + tmpdepfile2=$dir.libs/$base.o.d # Likewise. + tmpdepfile3=$dir.libs/$base.d # Compaq CCC V6.2-504 + "$@" -Wc,-MD + else + tmpdepfile1=$dir$base.d + tmpdepfile2=$dir$base.d + tmpdepfile3=$dir$base.d + "$@" -MD + fi + + stat=$? + if test $stat -ne 0; then + rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" + exit $stat + fi + + for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" + do + test -f "$tmpdepfile" && break + done + # Same post-processing that is required for AIX mode. + aix_post_process_depfile + ;; + +msvc7) + if test "$libtool" = yes; then + showIncludes=-Wc,-showIncludes + else + showIncludes=-showIncludes + fi + "$@" $showIncludes > "$tmpdepfile" + stat=$? + grep -v '^Note: including file: ' "$tmpdepfile" + if test $stat -ne 0; then + rm -f "$tmpdepfile" + exit $stat + fi + rm -f "$depfile" + echo "$object : \\" > "$depfile" + # The first sed program below extracts the file names and escapes + # backslashes for cygpath. The second sed program outputs the file + # name when reading, but also accumulates all include files in the + # hold buffer in order to output them again at the end. This only + # works with sed implementations that can handle large buffers. + sed < "$tmpdepfile" -n ' +/^Note: including file: *\(.*\)/ { + s//\1/ + s/\\/\\\\/g + p +}' | $cygpath_u | sort -u | sed -n ' +s/ /\\ /g +s/\(.*\)/'"$tab"'\1 \\/p +s/.\(.*\) \\/\1:/ +H +$ { + s/.*/'"$tab"'/ + G + p +}' >> "$depfile" + echo >> "$depfile" # make sure the fragment doesn't end with a backslash + rm -f "$tmpdepfile" + ;; + +msvc7msys) + # This case exists only to let depend.m4 do its work. It works by + # looking at the text of this script. This case will never be run, + # since it is checked for above. + exit 1 + ;; + +#nosideeffect) + # This comment above is used by automake to tell side-effect + # dependency tracking mechanisms from slower ones. + +dashmstdout) + # Important note: in order to support this mode, a compiler *must* + # always write the preprocessed file to stdout, regardless of -o. + "$@" || exit $? + + # Remove the call to Libtool. + if test "$libtool" = yes; then + while test "X$1" != 'X--mode=compile'; do + shift + done + shift + fi + + # Remove '-o $object'. + IFS=" " + for arg + do + case $arg in + -o) + shift + ;; + $object) + shift + ;; + *) + set fnord "$@" "$arg" + shift # fnord + shift # $arg + ;; + esac + done + + test -z "$dashmflag" && dashmflag=-M + # Require at least two characters before searching for ':' + # in the target name. This is to cope with DOS-style filenames: + # a dependency such as 'c:/foo/bar' could be seen as target 'c' otherwise. + "$@" $dashmflag | + sed "s|^[$tab ]*[^:$tab ][^:][^:]*:[$tab ]*|$object: |" > "$tmpdepfile" + rm -f "$depfile" + cat < "$tmpdepfile" > "$depfile" + # Some versions of the HPUX 10.20 sed can't process this sed invocation + # correctly. Breaking it into two sed invocations is a workaround. + tr ' ' "$nl" < "$tmpdepfile" \ + | sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' \ + | sed -e 's/$/ :/' >> "$depfile" + rm -f "$tmpdepfile" + ;; + +dashXmstdout) + # This case only exists to satisfy depend.m4. It is never actually + # run, as this mode is specially recognized in the preamble. + exit 1 + ;; + +makedepend) + "$@" || exit $? + # Remove any Libtool call + if test "$libtool" = yes; then + while test "X$1" != 'X--mode=compile'; do + shift + done + shift + fi + # X makedepend + shift + cleared=no eat=no + for arg + do + case $cleared in + no) + set ""; shift + cleared=yes ;; + esac + if test $eat = yes; then + eat=no + continue + fi + case "$arg" in + -D*|-I*) + set fnord "$@" "$arg"; shift ;; + # Strip any option that makedepend may not understand. Remove + # the object too, otherwise makedepend will parse it as a source file. + -arch) + eat=yes ;; + -*|$object) + ;; + *) + set fnord "$@" "$arg"; shift ;; + esac + done + obj_suffix=`echo "$object" | sed 's/^.*\././'` + touch "$tmpdepfile" + ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@" + rm -f "$depfile" + # makedepend may prepend the VPATH from the source file name to the object. + # No need to regex-escape $object, excess matching of '.' is harmless. + sed "s|^.*\($object *:\)|\1|" "$tmpdepfile" > "$depfile" + # Some versions of the HPUX 10.20 sed can't process the last invocation + # correctly. Breaking it into two sed invocations is a workaround. + sed '1,2d' "$tmpdepfile" \ + | tr ' ' "$nl" \ + | sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' \ + | sed -e 's/$/ :/' >> "$depfile" + rm -f "$tmpdepfile" "$tmpdepfile".bak + ;; + +cpp) + # Important note: in order to support this mode, a compiler *must* + # always write the preprocessed file to stdout. + "$@" || exit $? + + # Remove the call to Libtool. + if test "$libtool" = yes; then + while test "X$1" != 'X--mode=compile'; do + shift + done + shift + fi + + # Remove '-o $object'. + IFS=" " + for arg + do + case $arg in + -o) + shift + ;; + $object) + shift + ;; + *) + set fnord "$@" "$arg" + shift # fnord + shift # $arg + ;; + esac + done + + "$@" -E \ + | sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \ + -e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \ + | sed '$ s: \\$::' > "$tmpdepfile" + rm -f "$depfile" + echo "$object : \\" > "$depfile" + cat < "$tmpdepfile" >> "$depfile" + sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile" + rm -f "$tmpdepfile" + ;; + +msvisualcpp) + # Important note: in order to support this mode, a compiler *must* + # always write the preprocessed file to stdout. + "$@" || exit $? + + # Remove the call to Libtool. + if test "$libtool" = yes; then + while test "X$1" != 'X--mode=compile'; do + shift + done + shift + fi + + IFS=" " + for arg + do + case "$arg" in + -o) + shift + ;; + $object) + shift + ;; + "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI") + set fnord "$@" + shift + shift + ;; + *) + set fnord "$@" "$arg" + shift + shift + ;; + esac + done + "$@" -E 2>/dev/null | + sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::\1:p' | $cygpath_u | sort -u > "$tmpdepfile" + rm -f "$depfile" + echo "$object : \\" > "$depfile" + sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::'"$tab"'\1 \\:p' >> "$depfile" + echo "$tab" >> "$depfile" + sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::\1\::p' >> "$depfile" + rm -f "$tmpdepfile" + ;; + +msvcmsys) + # This case exists only to let depend.m4 do its work. It works by + # looking at the text of this script. This case will never be run, + # since it is checked for above. + exit 1 + ;; + +none) + exec "$@" + ;; + +*) + echo "Unknown depmode $depmode" 1>&2 + exit 1 + ;; +esac + +exit 0 + +# Local Variables: +# mode: shell-script +# sh-indentation: 2 +# eval: (add-hook 'before-save-hook 'time-stamp) +# time-stamp-start: "scriptversion=" +# time-stamp-format: "%:y-%02m-%02d.%02H" +# time-stamp-time-zone: "UTC0" +# time-stamp-end: "; # UTC" +# End: diff --git a/gitcompile b/gitcompile new file mode 100755 index 0000000..ce293cc --- /dev/null +++ b/gitcompile @@ -0,0 +1,25 @@ +#!/bin/bash + +if test -d ../alsa-lib/utils && ! test -r `aclocal --print-ac-dir`/alsa.m4; then + alsa_m4_flags="-I ../alsa-lib/utils" +fi +aclocal $alsa_m4_flags $ACLOCAL_FLAGS +# save original files to avoid stupid modifications by gettextize +cp Makefile.am Makefile.am.ok +cp configure.ac configure.ac.ok +gettextize -c -f --no-changelog +echo "EXTRA_DIST = gettext.m4" > m4/Makefile.am +cp Makefile.am.ok Makefile.am +cp configure.ac.ok configure.ac +autoheader +automake --foreign --copy --add-missing +touch depcomp # for older automake +autoconf +export CFLAGS='-O2 -Wall -pipe -g' +echo "CFLAGS=$CFLAGS" +echo "./configure $@" +./configure $@ || exit 1 +unset CFLAGS +if [ -z "$GITCOMPILE_NO_MAKE" ]; then + make +fi diff --git a/iecset/Makefile.am b/iecset/Makefile.am new file mode 100644 index 0000000..8c80f90 --- /dev/null +++ b/iecset/Makefile.am @@ -0,0 +1,9 @@ +AM_CPPFLAGS = -I$(top_srcdir)/include +LDADD = -lm +# LDFLAGS = -static +# CFLAGS += -g -Wall + +bin_PROGRAMS = iecset +iecset_SOURCES = iecset.c iecbits.c +man_MANS = iecset.1 +EXTRA_DIST = iecset.1 diff --git a/iecset/Makefile.in b/iecset/Makefile.in new file mode 100644 index 0000000..643538b --- /dev/null +++ b/iecset/Makefile.in @@ -0,0 +1,723 @@ +# Makefile.in generated by automake 1.16.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994-2018 Free Software Foundation, Inc. + +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +VPATH = @srcdir@ +am__is_gnu_make = { \ + if test -z '$(MAKELEVEL)'; then \ + false; \ + elif test -n '$(MAKE_HOST)'; then \ + true; \ + elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ + true; \ + else \ + false; \ + fi; \ +} +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + esac; \ + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +bin_PROGRAMS = iecset$(EXEEXT) +subdir = iecset +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/gettext.m4 \ + $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/lib-ld.m4 \ + $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ + $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \ + $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/acinclude.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/include/aconfig.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +am__installdirs = "$(DESTDIR)$(bindir)" "$(DESTDIR)$(man1dir)" +PROGRAMS = $(bin_PROGRAMS) +am_iecset_OBJECTS = iecset.$(OBJEXT) iecbits.$(OBJEXT) +iecset_OBJECTS = $(am_iecset_OBJECTS) +iecset_LDADD = $(LDADD) +iecset_DEPENDENCIES = +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__maybe_remake_depfiles = depfiles +am__depfiles_remade = ./$(DEPDIR)/iecbits.Po ./$(DEPDIR)/iecset.Po +am__mv = mv -f +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +AM_V_CC = $(am__v_CC_@AM_V@) +am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) +am__v_CC_0 = @echo " CC " $@; +am__v_CC_1 = +CCLD = $(CC) +LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_CCLD = $(am__v_CCLD_@AM_V@) +am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) +am__v_CCLD_0 = @echo " CCLD " $@; +am__v_CCLD_1 = +SOURCES = $(iecset_SOURCES) +DIST_SOURCES = $(iecset_SOURCES) +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; +am__vpath_adj = case $$p in \ + $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ + *) f=$$p;; \ + esac; +am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; +am__install_max = 40 +am__nobase_strip_setup = \ + srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` +am__nobase_strip = \ + for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" +am__nobase_list = $(am__nobase_strip_setup); \ + for p in $$list; do echo "$$p $$p"; done | \ + sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ + $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ + if (++n[$$2] == $(am__install_max)) \ + { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ + END { for (dir in files) print dir, files[dir] }' +am__base_list = \ + sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ + sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' +am__uninstall_files_from_dir = { \ + test -z "$$files" \ + || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ + || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ + $(am__cd) "$$dir" && rm -f $$files; }; \ + } +man1dir = $(mandir)/man1 +NROFF = nroff +MANS = $(man_MANS) +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) +# Read a list of newline-separated strings from the standard input, +# and print each of them once, without duplicates. Input order is +# *not* preserved. +am__uniquify_input = $(AWK) '\ + BEGIN { nonempty = 0; } \ + { items[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in items) print i; }; } \ +' +# Make sure the list of sources is unique. This is necessary because, +# e.g., the same source file might be shared among _SOURCES variables +# for different programs/libraries. +am__define_uniq_tagged_files = \ + list='$(am__tagged_files)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | $(am__uniquify_input)` +ETAGS = etags +CTAGS = ctags +am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/depcomp +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +ALSACTL_DAEMONSWITCH = @ALSACTL_DAEMONSWITCH@ +ALSACTL_PIDFILE_DIR = @ALSACTL_PIDFILE_DIR@ +ALSA_CFLAGS = @ALSA_CFLAGS@ +ALSA_LIBS = @ALSA_LIBS@ +ALSA_TOPOLOGY_LIBS = @ALSA_TOPOLOGY_LIBS@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +ASOUND_LOCK_DIR = @ASOUND_LOCK_DIR@ +ASOUND_STATE_DIR = @ASOUND_STATE_DIR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CURSESINC = @CURSESINC@ +CURSESLIB = @CURSESLIB@ +CURSES_CFLAGS = @CURSES_CFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +FFTW_CFLAGS = @FFTW_CFLAGS@ +FFTW_INC = @FFTW_INC@ +FFTW_LIB = @FFTW_LIB@ +GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ +GMSGFMT = @GMSGFMT@ +GMSGFMT_015 = @GMSGFMT_015@ +GREP = @GREP@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +INTLLIBS = @INTLLIBS@ +INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@ +LDFLAGS = @LDFLAGS@ +LIBICONV = @LIBICONV@ +LIBINTL = @LIBINTL@ +LIBOBJS = @LIBOBJS@ +LIBRT = @LIBRT@ +LIBS = @LIBS@ +LN_S = @LN_S@ +LTLIBICONV = @LTLIBICONV@ +LTLIBINTL = @LTLIBINTL@ +LTLIBOBJS = @LTLIBOBJS@ +MAINT = @MAINT@ +MAKEINFO = @MAKEINFO@ +MKDIR_P = @MKDIR_P@ +MSGFMT = @MSGFMT@ +MSGFMT_015 = @MSGFMT_015@ +MSGMERGE = @MSGMERGE@ +NCURSESW_CFLAGS = @NCURSESW_CFLAGS@ +NCURSESW_LIBS = @NCURSESW_LIBS@ +NCURSES_CFLAGS = @NCURSES_CFLAGS@ +NCURSES_LIBS = @NCURSES_LIBS@ +OBJEXT = @OBJEXT@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ +POSUB = @POSUB@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +SND_UTIL_MAJOR = @SND_UTIL_MAJOR@ +SND_UTIL_MINOR = @SND_UTIL_MINOR@ +SND_UTIL_SUBMINOR = @SND_UTIL_SUBMINOR@ +SND_UTIL_VERSION = @SND_UTIL_VERSION@ +STRIP = @STRIP@ +SYSTEMD_CFLAGS = @SYSTEMD_CFLAGS@ +SYSTEMD_LIBS = @SYSTEMD_LIBS@ +TESTSOUND = @TESTSOUND@ +USE_NLS = @USE_NLS@ +VERSION = @VERSION@ +XGETTEXT = @XGETTEXT@ +XGETTEXT_015 = @XGETTEXT_015@ +XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_CC = @ac_ct_CC@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +mydatadir = @mydatadir@ +ncurses5_config = @ncurses5_config@ +ncursesw5_config = @ncursesw5_config@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +rst2man_available = @rst2man_available@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +systemdsystemunitdir = @systemdsystemunitdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +udevrulesdir = @udevrulesdir@ +xmlto_available = @xmlto_available@ +AM_CPPFLAGS = -I$(top_srcdir)/include +LDADD = -lm +iecset_SOURCES = iecset.c iecbits.c +man_MANS = iecset.1 +EXTRA_DIST = iecset.1 +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .o .obj +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign iecset/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --foreign iecset/Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): +install-binPROGRAMS: $(bin_PROGRAMS) + @$(NORMAL_INSTALL) + @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(bindir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(bindir)" || exit 1; \ + fi; \ + for p in $$list; do echo "$$p $$p"; done | \ + sed 's/$(EXEEXT)$$//' | \ + while read p p1; do if test -f $$p \ + ; then echo "$$p"; echo "$$p"; else :; fi; \ + done | \ + sed -e 'p;s,.*/,,;n;h' \ + -e 's|.*|.|' \ + -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \ + sed 'N;N;N;s,\n, ,g' | \ + $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \ + { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \ + if ($$2 == $$4) files[d] = files[d] " " $$1; \ + else { print "f", $$3 "/" $$4, $$1; } } \ + END { for (d in files) print "f", d, files[d] }' | \ + while read type dir files; do \ + if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \ + test -z "$$files" || { \ + echo " $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(bindir)$$dir'"; \ + $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \ + } \ + ; done + +uninstall-binPROGRAMS: + @$(NORMAL_UNINSTALL) + @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ + files=`for p in $$list; do echo "$$p"; done | \ + sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \ + -e 's/$$/$(EXEEXT)/' \ + `; \ + test -n "$$list" || exit 0; \ + echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \ + cd "$(DESTDIR)$(bindir)" && rm -f $$files + +clean-binPROGRAMS: + -test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS) + +iecset$(EXEEXT): $(iecset_OBJECTS) $(iecset_DEPENDENCIES) $(EXTRA_iecset_DEPENDENCIES) + @rm -f iecset$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(iecset_OBJECTS) $(iecset_LDADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/iecbits.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/iecset.Po@am__quote@ # am--include-marker + +$(am__depfiles_remade): + @$(MKDIR_P) $(@D) + @echo '# dummy' >$@-t && $(am__mv) $@-t $@ + +am--depfiles: $(am__depfiles_remade) + +.c.o: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< + +.c.obj: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` +install-man1: $(man_MANS) + @$(NORMAL_INSTALL) + @list1=''; \ + list2='$(man_MANS)'; \ + test -n "$(man1dir)" \ + && test -n "`echo $$list1$$list2`" \ + || exit 0; \ + echo " $(MKDIR_P) '$(DESTDIR)$(man1dir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(man1dir)" || exit 1; \ + { for i in $$list1; do echo "$$i"; done; \ + if test -n "$$list2"; then \ + for i in $$list2; do echo "$$i"; done \ + | sed -n '/\.1[a-z]*$$/p'; \ + fi; \ + } | while read p; do \ + if test -f $$p; then d=; else d="$(srcdir)/"; fi; \ + echo "$$d$$p"; echo "$$p"; \ + done | \ + sed -e 'n;s,.*/,,;p;h;s,.*\.,,;s,^[^1][0-9a-z]*$$,1,;x' \ + -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,' | \ + sed 'N;N;s,\n, ,g' | { \ + list=; while read file base inst; do \ + if test "$$base" = "$$inst"; then list="$$list $$file"; else \ + echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man1dir)/$$inst'"; \ + $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man1dir)/$$inst" || exit $$?; \ + fi; \ + done; \ + for i in $$list; do echo "$$i"; done | $(am__base_list) | \ + while read files; do \ + test -z "$$files" || { \ + echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(man1dir)'"; \ + $(INSTALL_DATA) $$files "$(DESTDIR)$(man1dir)" || exit $$?; }; \ + done; } + +uninstall-man1: + @$(NORMAL_UNINSTALL) + @list=''; test -n "$(man1dir)" || exit 0; \ + files=`{ for i in $$list; do echo "$$i"; done; \ + l2='$(man_MANS)'; for i in $$l2; do echo "$$i"; done | \ + sed -n '/\.1[a-z]*$$/p'; \ + } | sed -e 's,.*/,,;h;s,.*\.,,;s,^[^1][0-9a-z]*$$,1,;x' \ + -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,'`; \ + dir='$(DESTDIR)$(man1dir)'; $(am__uninstall_files_from_dir) + +ID: $(am__tagged_files) + $(am__define_uniq_tagged_files); mkid -fID $$unique +tags: tags-am +TAGS: tags + +tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + set x; \ + here=`pwd`; \ + $(am__define_uniq_tagged_files); \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: ctags-am + +CTAGS: ctags +ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + $(am__define_uniq_tagged_files); \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" +cscopelist: cscopelist-am + +cscopelist-am: $(am__tagged_files) + list='$(am__tagged_files)'; \ + case "$(srcdir)" in \ + [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ + *) sdir=$(subdir)/$(srcdir) ;; \ + esac; \ + for i in $$list; do \ + if test -f "$$i"; then \ + echo "$(subdir)/$$i"; \ + else \ + echo "$$sdir/$$i"; \ + fi; \ + done >> $(top_builddir)/cscope.files + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) distdir-am + +distdir-am: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(PROGRAMS) $(MANS) +installdirs: + for dir in "$(DESTDIR)$(bindir)" "$(DESTDIR)$(man1dir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ + done +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-binPROGRAMS clean-generic mostlyclean-am + +distclean: distclean-am + -rm -f ./$(DEPDIR)/iecbits.Po + -rm -f ./$(DEPDIR)/iecset.Po + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: install-man + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: install-binPROGRAMS + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: install-man1 + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -f ./$(DEPDIR)/iecbits.Po + -rm -f ./$(DEPDIR)/iecset.Po + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-binPROGRAMS uninstall-man + +uninstall-man: uninstall-man1 + +.MAKE: install-am install-strip + +.PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-am clean \ + clean-binPROGRAMS clean-generic cscopelist-am ctags ctags-am \ + distclean distclean-compile distclean-generic distclean-tags \ + distdir dvi dvi-am html html-am info info-am install \ + install-am install-binPROGRAMS install-data install-data-am \ + install-dvi install-dvi-am install-exec install-exec-am \ + install-html install-html-am install-info install-info-am \ + install-man install-man1 install-pdf install-pdf-am install-ps \ + install-ps-am install-strip installcheck installcheck-am \ + installdirs maintainer-clean maintainer-clean-generic \ + mostlyclean mostlyclean-compile mostlyclean-generic pdf pdf-am \ + ps ps-am tags tags-am uninstall uninstall-am \ + uninstall-binPROGRAMS uninstall-man uninstall-man1 + +.PRECIOUS: Makefile + + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/iecset/iecbits.c b/iecset/iecbits.c new file mode 100644 index 0000000..4a768a6 --- /dev/null +++ b/iecset/iecbits.c @@ -0,0 +1,259 @@ +/* + iecdump - dump IEC958 status bits on ALSA + Copyright (C) 2003 by Takashi Iwai + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License + as published by the Free Software Foundation; either version 2 + of the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include +#include + +struct category_str { + int val; + const char *name; +}; + +static const struct category_str con_category[] = { + { IEC958_AES1_CON_GENERAL, "general" }, + + { IEC958_AES1_CON_IEC908_CD, "CD" }, + { IEC958_AES1_CON_NON_IEC908_CD, "non-IEC908 CD" }, + { IEC958_AES1_CON_MINI_DISC, "Mini-Disc" }, + { IEC958_AES1_CON_DVD, "DVD" }, + + { IEC958_AES1_CON_PCM_CODER, "PCM coder" }, + { IEC958_AES1_CON_MIXER, "digital signal mixer" }, + { IEC958_AES1_CON_RATE_CONVERTER, "rate converter" }, + { IEC958_AES1_CON_SAMPLER, "sampler" }, + { IEC958_AES1_CON_DSP, "digital sound processor" }, + + { IEC958_AES1_CON_DAT, "DAT" }, + { IEC958_AES1_CON_VCR, "VCR" }, + { IEC958_AES1_CON_DCC, "DCC" }, + { IEC958_AES1_CON_MAGNETIC_DISC, "magnetic disc" }, + + { IEC958_AES1_CON_DAB_JAPAN, "digital audio broadcast (Japan)" }, + { IEC958_AES1_CON_DAB_EUROPE, "digital audio broadcast (Europe)" }, + { IEC958_AES1_CON_DAB_USA, "digital audio broadcast (USA)" }, + { IEC958_AES1_CON_SOFTWARE, "software delivery" }, + + { IEC958_AES1_CON_SYNTHESIZER, "synthesizer" }, + { IEC958_AES1_CON_MICROPHONE, "microphone" }, + + { IEC958_AES1_CON_ADC, "ADC without copyright information" }, + + { IEC958_AES1_CON_ADC_COPYRIGHT, "ADC with copyright information" }, + + { IEC958_AES1_CON_SOLIDMEM_DIGITAL_RECORDER_PLAYER, "flash memory recorder/player" }, + + { IEC958_AES1_CON_EXPERIMENTAL, "experimental" }, +}; + + +#define ARRAY_SIZE(x) (int)(sizeof(x)/sizeof(x[0])) + +void dump_iec958(snd_aes_iec958_t *iec) +{ + int i; + + if (! (iec->status[0] & IEC958_AES0_PROFESSIONAL)) { + /* consumer */ + printf("Mode: consumer\n"); + printf("Data: "); + if (!(iec->status[0] & IEC958_AES0_NONAUDIO)) { + printf("audio\n"); + } else { + printf("non-audio\n"); + } + printf("Rate: "); + switch (iec->status[3] & IEC958_AES3_CON_FS) { + case IEC958_AES3_CON_FS_22050: + printf("22050 Hz\n"); + break; + case IEC958_AES3_CON_FS_24000: + printf("24000 Hz\n"); + break; + case IEC958_AES3_CON_FS_32000: + printf("32000 Hz\n"); + break; + case IEC958_AES3_CON_FS_44100: + printf("44100 Hz\n"); + break; + case IEC958_AES3_CON_FS_48000: + printf("48000 Hz\n"); + break; + case IEC958_AES3_CON_FS_88200: + printf("88200 Hz\n"); + break; + case IEC958_AES3_CON_FS_96000: + printf("96000 Hz\n"); + break; + case IEC958_AES3_CON_FS_176400: + printf("176400 Hz\n"); + break; + case IEC958_AES3_CON_FS_192000: + printf("192000 Hz\n"); + break; + case IEC958_AES3_CON_FS_768000: + printf("768000 Hz\n"); + break; + case IEC958_AES3_CON_FS_NOTID: + printf("not indicated\n"); + break; + default: + printf("unknown\n"); + break; + } + printf("Copyright: "); + if (iec->status[0] & IEC958_AES0_CON_NOT_COPYRIGHT) { + printf("permitted\n"); + } else { + printf("protected\n"); + } + printf("Emphasis: "); + if ((iec->status[0] & IEC958_AES0_CON_EMPHASIS) != IEC958_AES0_CON_EMPHASIS_5015) { + printf("none\n"); + } else { + printf("50/15us\n"); + } + printf("Category: "); + for (i = 0; i < ARRAY_SIZE(con_category); i++) { + if ((iec->status[1] & IEC958_AES1_CON_CATEGORY) == con_category[i].val) { + printf("%s\n", con_category[i].name); + break; + } + } + if (i >= ARRAY_SIZE(con_category)) { + printf("unknown 0x%x\n", iec->status[1] & IEC958_AES1_CON_CATEGORY); + } + printf("Original: "); + if (iec->status[1] & IEC958_AES1_CON_ORIGINAL) { + printf("original\n"); + } else { + printf("1st generation\n"); + } + printf("Clock: "); + switch (iec->status[3] & IEC958_AES3_CON_CLOCK) { + case IEC958_AES3_CON_CLOCK_1000PPM: + printf("1000 ppm\n"); + break; + case IEC958_AES3_CON_CLOCK_50PPM: + printf("50 ppm\n"); + break; + case IEC958_AES3_CON_CLOCK_VARIABLE: + printf("variable pitch\n"); + break; + default: + printf("unknown\n"); + break; + } + } else { + printf("Mode: professional\n"); + printf("Data: "); + if (!(iec->status[0] & IEC958_AES0_NONAUDIO)) { + printf("audio\n"); + } else { + printf("non-audio\n"); + } + printf("Rate: "); + switch (iec->status[0] & IEC958_AES0_PRO_FS) { + case IEC958_AES0_PRO_FS_44100: + printf("44100 Hz\n"); + break; + case IEC958_AES0_PRO_FS_48000: + printf("48000 Hz\n"); + break; + case IEC958_AES0_PRO_FS_32000: + printf("32000 Hz\n"); + break; + default: + printf("unknown\n"); + break; + } + printf("Rate Locked: "); + if (iec->status[0] & IEC958_AES0_PRO_FREQ_UNLOCKED) + printf("no\n"); + else + printf("yes\n"); + printf("Emphasis: "); + switch (iec->status[0] & IEC958_AES0_PRO_EMPHASIS) { + case IEC958_AES0_PRO_EMPHASIS_CCITT: + printf("CCITT J.17\n"); + break; + case IEC958_AES0_PRO_EMPHASIS_NONE: + printf("none\n"); + break; + case IEC958_AES0_PRO_EMPHASIS_5015: + printf("50/15us\n"); + break; + case IEC958_AES0_PRO_EMPHASIS_NOTID: + default: + printf("unknown\n"); + break; + } + printf("Stereophonic: "); + if ((iec->status[1] & IEC958_AES1_PRO_MODE) == IEC958_AES1_PRO_MODE_STEREOPHONIC) { + printf("stereo\n"); + } else { + printf("not indicated\n"); + } + printf("Userbits: "); + switch (iec->status[1] & IEC958_AES1_PRO_USERBITS) { + case IEC958_AES1_PRO_USERBITS_192: + printf("192bit\n"); + break; + case IEC958_AES1_PRO_USERBITS_UDEF: + printf("user-defined\n"); + break; + default: + printf("unknown\n"); + break; + } + printf("Sample Bits: "); + switch (iec->status[2] & IEC958_AES2_PRO_SBITS) { + case IEC958_AES2_PRO_SBITS_20: + printf("20 bit\n"); + break; + case IEC958_AES2_PRO_SBITS_24: + printf("24 bit\n"); + break; + case IEC958_AES2_PRO_SBITS_UDEF: + printf("user defined\n"); + break; + default: + printf("unknown\n"); + break; + } + printf("Word Length: "); + switch (iec->status[2] & IEC958_AES2_PRO_WORDLEN) { + case IEC958_AES2_PRO_WORDLEN_22_18: + printf("22 bit or 18 bit\n"); + break; + case IEC958_AES2_PRO_WORDLEN_23_19: + printf("23 bit or 19 bit\n"); + break; + case IEC958_AES2_PRO_WORDLEN_24_20: + printf("24 bit or 20 bit\n"); + break; + case IEC958_AES2_PRO_WORDLEN_20_16: + printf("20 bit or 16 bit\n"); + break; + default: + printf("unknown\n"); + break; + } + } +} + diff --git a/iecset/iecset.1 b/iecset/iecset.1 new file mode 100644 index 0000000..dec4ac0 --- /dev/null +++ b/iecset/iecset.1 @@ -0,0 +1,104 @@ +.TH iecset 1 "23 Oct 2003" +.SH NAME +iecset \- Set or dump IEC958 status bits + +.SH SYNOPSIS +\fBiecset\fP [\fIoptions\fP] [\fIcmd\fP \fIarg\fP...] + +.SH DESCRIPTION +\fBiecset\fP is a small utility to set or dump the IEC958 (or so-called +"S/PDIF") status bits of the specified sound card via ALSA control API. + +When \fBiecset\fP is started without arguments except for options, +it will show the current IEC958 status in a human-readable form. +When the commands are given in the arguments, they are parsed +and the IEC958 status bits are updated. The resultant status is +shown as well. + +The commands consist of the command directive and the argument. +As the boolean argument, \fIyes\fP, \fIno\fP, \fItrue\fP, \fIfalse\fP, +or a digit number is allowed. + +.SH EXAMPLES +.TP +.BI iecset\ \-Dhw:1 +Displays the current IEC958 status bits on the second card. +This is equivalent with \fI\-c 1\fP. +.TP +.BI iecset\ \-x +Displays the current IEC958 status bits in a style of the arguments +for the PCM stream. The output string can be passed to the \fIiec958\fP +(or \fIspdif\fP) PCM type as the optional argument. +.TP +.BI iecset\ pro\ off\ audio\ off +Sets the current status to the consumer-mode and turns on the +non-audio bit. The modified status will be shown, too. + +.SH OPTIONS +.TP +\fI\-D\fP device +Specifies the device name of the control to open +.TP +\fI\-c\fP card +Specifies the card index to open. Equivalent with \fI\-Dhw:x\fP. +.TP +\fI\-n\fP index +Specifies the IEC958 control element index, in case you have multiple +IEC958 devices and need to choose one of them. +.TP +\fI\-x\fP +Dumps the status in the form of AESx bytes. +.TP +\fI\-i\fP +Reads the command sequences from stdin. +Each line has single command. + +.SH COMMANDS +.TP +\fIprofessional\fP +The professional mode (true) or consumer mode (false). + +.TP +\fIaudio\fP +The audio mode (true) or non-audio mode (false). + +.TP +\fIrate\fP +The sample rate in Hz. + +.TP +\fIemphasis\fP +The emphasis: 0 = none, 1 = 50/15us, 2 = CCITT. + +.TP +\fIlock\fP +Rate lock: locked (true), unlocked (false). +This command is for the professional mode only. + +.TP +\fIsbits\fP +Sample bits: 2 = 20bit, 4 = 24bit, 6 = undefined. +This command is for the professional mode only. + +.TP +\fIwordlength\fP +Wordlength: 0 = No, 2 = 22-18 bit, 4 = 23-19 bit, 5 = 24-20 bit, 6 = 20-16 bit. +This command is for the professional mode only. + +.TP +\fIcategory\fP +Category: the value is from 0 to 0x7f. +This command is for the consumer mode only. + +.TP +\fIcopyright\fP +Copyright: copyrighted (true), non-copyrighted (false). +This command is for the consumer mode only. + +.TP +\fIoriginal\fP +Original flag: original (true), 1st generation (false). +This command is for the consumer mode only. + +.SH AUTHOR +Takashi Iwai diff --git a/iecset/iecset.c b/iecset/iecset.c new file mode 100644 index 0000000..35039e1 --- /dev/null +++ b/iecset/iecset.c @@ -0,0 +1,432 @@ +/* + iecset - change IEC958 status bits on ALSA + Copyright (C) 2003 by Takashi Iwai + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License + as published by the Free Software Foundation; either version 2 + of the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include +#include +#include + +void dump_iec958(snd_aes_iec958_t *iec); + +static int get_bool(const char *str) +{ + if (strncmp(str, "yes", 3) == 0 || + strncmp(str, "YES", 3) == 0 || + strncmp(str, "on", 2) == 0 || + strncmp(str, "ON", 2) == 0 || + strncmp(str, "true", 4) == 0 || + strncmp(str, "TRUE", 4) == 0 || + *str == '1') + return 1; + return 0; +} + +enum { + CMD_BOOL, CMD_BOOL_INV, CMD_INT +}; + +enum { + IDX_PRO, IDX_NOAUDIO, IDX_RATE, IDX_UNLOCK, IDX_SBITS, IDX_WORD, IDX_EMP, IDX_CAT, IDX_NOCOPY, IDX_ORIG, + IDX_LAST +}; + +struct cmdtbl { + const char *name; + int idx; + int type; + const char *desc; +}; + +static const struct cmdtbl cmds[] = { + { "pro", IDX_PRO, CMD_BOOL, + "professional (common)\n\toff = consumer mode, on = professional mode" }, + { "aud", IDX_NOAUDIO, CMD_BOOL_INV, + "audio (common)\n\ton = audio mode, off = non-audio mode" }, + { "rat", IDX_RATE, CMD_INT, + "rate (common)\n\tsample rate in Hz (0 = not indicated)" }, + { "emp", IDX_EMP, CMD_INT, + "emphasis (common)\n\t0 = none, 1 = 50/15us, 2 = CCITT" }, + { "loc", IDX_UNLOCK, CMD_BOOL_INV, + "lock (prof.)\n\toff = rate unlocked, on = rate locked" }, + { "sbi", IDX_SBITS, CMD_INT, + "sbits (prof.)\n\tsample bits 2 = 20bit, 4 = 24bit, 6 = undef" }, + { "wor", IDX_WORD, CMD_INT, + "wordlength (prof.)\n\t0=no, 2=22-18bit, 4=23-19bit, 5=24-20bit, 6=20-16bit" }, + { "cat", IDX_CAT, CMD_INT, + "category (consumer)\n\t0-0x7f" }, + { "cop", IDX_NOCOPY, CMD_BOOL_INV, + "copyright (consumer)\n\toff = non-copyright, on = copyright" }, + { "ori", IDX_ORIG, CMD_BOOL, + "original (consumer)\n\toff = 1st-gen, on = original" }, +}; + + +static void error(const char *s, int err) +{ + fprintf(stderr, "%s: %s\n", s, snd_strerror(err)); +} + + +static void usage(void) +{ + int i; + + printf("Usage: iecset [options] [cmd arg...]\n"); + printf("Options:\n"); + printf(" -D device specifies the control device to use\n"); + printf(" -c card specifies the card number to use (equiv. with -Dhw:#)\n"); + printf(" -n number specifies the control index number (default = 0)\n"); + printf(" -x dump the dump the AESx hex code for IEC958 PCM parameters\n"); + printf(" -i read commands from stdin\n"); + printf("Commands:\n"); + for (i = 0; i < (int)(sizeof(cmds)/sizeof(cmds[0])); i++) { + printf(" %s\n", cmds[i].desc); + } +} + + +/* + * parse iecset commands + */ +static void parse_command(int *parms, const char *c, const char *arg) +{ + int i; + + for (i = 0; i < (int)(sizeof(cmds)/sizeof(cmds[0])); i++) { + if (strncmp(c, cmds[i].name, strlen(cmds[i].name)) == 0) { + int val; + switch (cmds[i].type) { + case CMD_BOOL: + val = get_bool(arg); + break; + case CMD_BOOL_INV: + val = !get_bool(arg); + break; + case CMD_INT: + default: + val = (int)strtol(arg, NULL, 0); + break; + } + parms[cmds[i].idx] = val; + return; + } + } +} + +static char *skipspace(char *line) +{ + char *p; + for (p = line; *p && isspace(*p); p++) + ; + return p; +} + +/* + * parse iecset commands from the file + */ +static void parse_file(int *parms, FILE *fp) +{ + char line[1024], *cmd, *arg; + while (fgets(line, sizeof(line), fp) != NULL) { + cmd = skipspace(line); + if (*cmd == '#' || ! *cmd) + continue; + for (arg = cmd; *arg && !isspace(*arg); arg++) + ; + if (! *arg) + continue; + *arg++ = 0; + arg = skipspace(arg); + if (! *arg) + continue; + parse_command(parms, cmd, arg); + } +} + +/* update iec958 status values + * return non-zero if the values are modified + */ +static int update_iec958_status(snd_aes_iec958_t *iec958, int *parms) +{ + int changed = 0; + if (parms[IDX_PRO] >= 0) { + if (parms[IDX_PRO]) + iec958->status[0] |= IEC958_AES0_PROFESSIONAL; + else + iec958->status[0] &= ~IEC958_AES0_PROFESSIONAL; + changed = 1; + } + if (parms[IDX_NOAUDIO] >= 0) { + if (parms[IDX_NOAUDIO]) + iec958->status[0] |= IEC958_AES0_NONAUDIO; + else + iec958->status[0] &= ~IEC958_AES0_NONAUDIO; + changed = 1; + } + if (parms[IDX_RATE] >= 0) { + if (iec958->status[0] & IEC958_AES0_PROFESSIONAL) { + iec958->status[0] &= ~IEC958_AES0_PRO_FS; + switch (parms[IDX_RATE]) { + case 44100: + iec958->status[0] |= IEC958_AES0_PRO_FS_44100; + break; + case 48000: + iec958->status[0] |= IEC958_AES0_PRO_FS_48000; + break; + case 32000: + iec958->status[0] |= IEC958_AES0_PRO_FS_32000; + break; + } + } else { + iec958->status[3] &= ~IEC958_AES3_CON_FS; + switch (parms[IDX_RATE]) { + case 22050: + iec958->status[3] |= IEC958_AES3_CON_FS_22050; + break; + case 24000: + iec958->status[3] |= IEC958_AES3_CON_FS_24000; + break; + case 32000: + iec958->status[3] |= IEC958_AES3_CON_FS_32000; + break; + case 44100: + iec958->status[3] |= IEC958_AES3_CON_FS_44100; + break; + case 48000: + iec958->status[3] |= IEC958_AES3_CON_FS_48000; + break; + case 88200: + iec958->status[3] |= IEC958_AES3_CON_FS_88200;; + break; + case 96000: + iec958->status[3] |= IEC958_AES3_CON_FS_96000; + break; + case 176400: + iec958->status[3] |= IEC958_AES3_CON_FS_176400; + break; + case 192000: + iec958->status[3] |= IEC958_AES3_CON_FS_192000; + break; + case 768000: + iec958->status[3] |= IEC958_AES3_CON_FS_768000; + break; + default: + iec958->status[3] |= IEC958_AES3_CON_FS_NOTID; + break; + } + } + changed = 1; + } + if (parms[IDX_NOCOPY] >= 0) { + if (! (iec958->status[0] & IEC958_AES0_PROFESSIONAL)) { + if (parms[IDX_NOCOPY]) + iec958->status[0] |= IEC958_AES0_CON_NOT_COPYRIGHT; + else + iec958->status[0] &= ~IEC958_AES0_CON_NOT_COPYRIGHT; + } + changed = 1; + } + if (parms[IDX_ORIG] >= 0) { + if (! (iec958->status[0] & IEC958_AES0_PROFESSIONAL)) { + if (parms[IDX_ORIG]) + iec958->status[1] |= IEC958_AES1_CON_ORIGINAL; + else + iec958->status[1] &= ~IEC958_AES1_CON_ORIGINAL; + } + changed = 1; + } + if (parms[IDX_EMP] >= 0) { + if (iec958->status[0] & IEC958_AES0_PROFESSIONAL) { + iec958->status[0] &= ~IEC958_AES0_PRO_EMPHASIS; + switch (parms[IDX_EMP]) { + case 0: + iec958->status[0] |= IEC958_AES0_PRO_EMPHASIS_NONE; + break; + case 1: + iec958->status[0] |= IEC958_AES0_PRO_EMPHASIS_5015; + break; + case 2: + iec958->status[0] |= IEC958_AES0_PRO_EMPHASIS_CCITT; + break; + } + } else { + if (parms[IDX_EMP]) + iec958->status[0] |= IEC958_AES0_CON_EMPHASIS_5015; + else + iec958->status[0] &= ~IEC958_AES0_CON_EMPHASIS_5015; + } + changed = 1; + } + if (parms[IDX_UNLOCK] >= 0) { + if (iec958->status[0] & IEC958_AES0_PROFESSIONAL) { + if (parms[IDX_UNLOCK]) + iec958->status[0] |= IEC958_AES0_PRO_FREQ_UNLOCKED; + else + iec958->status[0] &= ~IEC958_AES0_PRO_FREQ_UNLOCKED; + } + changed = 1; + } + if (parms[IDX_SBITS] >= 0) { + if (iec958->status[0] & IEC958_AES0_PROFESSIONAL) { + iec958->status[2] &= ~IEC958_AES2_PRO_SBITS; + iec958->status[2] |= parms[IDX_SBITS] & 7; + } + changed = 1; + } + if (parms[IDX_WORD] >= 0) { + if (iec958->status[0] & IEC958_AES0_PROFESSIONAL) { + iec958->status[2] &= ~IEC958_AES2_PRO_WORDLEN; + iec958->status[2] |= (parms[IDX_WORD] & 7) << 3; + } + changed = 1; + } + if (parms[IDX_CAT] >= 0) { + if (! (iec958->status[0] & IEC958_AES0_PROFESSIONAL)) { + iec958->status[1] &= ~IEC958_AES1_CON_CATEGORY; + iec958->status[1] |= parms[IDX_CAT] & 0x7f; + } + changed = 1; + } + + return changed; +} + + +int main(int argc, char **argv) +{ + const char *dev = "default"; + const char *spdif_str = SND_CTL_NAME_IEC958("", PLAYBACK, DEFAULT); + int spdif_index = -1; + snd_ctl_t *ctl; + snd_ctl_elem_list_t *clist; + snd_ctl_elem_id_t *cid; + snd_ctl_elem_value_t *cval; + snd_aes_iec958_t iec958; + int from_stdin = 0; + int dumphex = 0; + int i, c, err; + unsigned int controls, cidx; + char tmpname[32]; + int parms[IDX_LAST]; + + for (i = 0; i < IDX_LAST; i++) + parms[i] = -1; /* not set */ + + while ((c = getopt(argc, argv, "D:c:n:xhi")) != -1) { + switch (c) { + case 'D': + dev = optarg; + break; + case 'c': + i = atoi(optarg); + if (i < 0 || i >= 32) { + fprintf(stderr, "invalid card index %d\n", i); + return 1; + } + sprintf(tmpname, "hw:%d", i); + dev = tmpname; + break; + case 'n': + spdif_index = atoi(optarg); + break; + case 'x': + dumphex = 1; + break; + case 'i': + from_stdin = 1; + break; + default: + usage(); + return 1; + } + } + + if ((err = snd_ctl_open(&ctl, dev, 0)) < 0) { + error("snd_ctl_open", err); + return 1; + } + + snd_ctl_elem_list_alloca(&clist); + if ((err = snd_ctl_elem_list(ctl, clist)) < 0) { + error("snd_ctl_elem_list", err); + return 1; + } + if ((err = snd_ctl_elem_list_alloc_space(clist, snd_ctl_elem_list_get_count(clist))) < 0) { + error("snd_ctl_elem_list_alloc_space", err); + return 1; + } + if ((err = snd_ctl_elem_list(ctl, clist)) < 0) { + error("snd_ctl_elem_list", err); + return 1; + } + + controls = snd_ctl_elem_list_get_used(clist); + for (cidx = 0; cidx < controls; cidx++) { + if (!strcmp(snd_ctl_elem_list_get_name(clist, cidx), spdif_str)) + if (spdif_index < 0 || + snd_ctl_elem_list_get_index(clist, cidx) == spdif_index) + break; + } + if (cidx >= controls) { + fprintf(stderr, "control \"%s\" (index %d) not found\n", + spdif_str, spdif_index); + return 1; + } + + snd_ctl_elem_id_alloca(&cid); + snd_ctl_elem_list_get_id(clist, cidx, cid); + snd_ctl_elem_value_alloca(&cval); + snd_ctl_elem_value_set_id(cval, cid); + if ((err = snd_ctl_elem_read(ctl, cval)) < 0) { + error("snd_ctl_elem_read", err); + return 1; + } + + snd_ctl_elem_value_get_iec958(cval, &iec958); + + /* parse from stdin */ + if (from_stdin) + parse_file(parms, stdin); + + /* parse commands */ + for (c = optind; c < argc - 1; c += 2) + parse_command(parms, argv[c], argv[c + 1]); + + if (update_iec958_status(&iec958, parms)) { + /* store the values */ + snd_ctl_elem_value_set_iec958(cval, &iec958); + if ((err = snd_ctl_elem_write(ctl, cval)) < 0) { + error("snd_ctl_elem_write", err); + return 1; + } + if ((err = snd_ctl_elem_read(ctl, cval)) < 0) { + error("snd_ctl_elem_write", err); + return 1; + } + snd_ctl_elem_value_get_iec958(cval, &iec958); + } + + if (dumphex) + printf("AES0=0x%02x,AES1=0x%02x,AES2=0x%02x,AES3=0x%02x\n", + iec958.status[0], iec958.status[1], iec958.status[2], iec958.status[3]); + else + dump_iec958(&iec958); + + snd_ctl_close(ctl); + return 0; +} diff --git a/include/Makefile.am b/include/Makefile.am new file mode 100644 index 0000000..b447abf --- /dev/null +++ b/include/Makefile.am @@ -0,0 +1,25 @@ +noinst_HEADERS=version.h gettext.h gettext_curses.h + +version.h: stamp-vh + @: + +stamp-vh: $(top_builddir)/configure.ac + @echo "/*" > ver.tmp + @echo " * version.h" >> ver.tmp + @echo " */" >> ver.tmp + @echo "" >> ver.tmp + @echo "#define SND_UTIL_MAJOR $(SND_UTIL_MAJOR)" >> ver.tmp + @echo "#define SND_UTIL_MINOR $(SND_UTIL_MINOR)" >> ver.tmp + @echo "#define SND_UTIL_SUBMINOR $(SND_UTIL_SUBMINOR)" >> ver.tmp + @echo "#define SND_UTIL_VERSION ((SND_UTIL_MAJOR<<16)|\\" >> ver.tmp + @echo " (SND_UTIL_MINOR<<8)|\\" >> ver.tmp + @echo " SND_UTIL_SUBMINOR)" >> ver.tmp + @echo "#define SND_UTIL_VERSION_STR \"$(SND_UTIL_VERSION)\"" >> ver.tmp + @echo >> ver.tmp + @cmp -s version.h ver.tmp \ + || (echo "Updating version.h"; \ + cp ver.tmp version.h; \ + echo timestamp > stamp-vh) + -@rm -f ver.tmp + +AM_CPPFLAGS=-I$(top_srcdir)/include diff --git a/include/Makefile.in b/include/Makefile.in new file mode 100644 index 0000000..54447ba --- /dev/null +++ b/include/Makefile.in @@ -0,0 +1,576 @@ +# Makefile.in generated by automake 1.16.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994-2018 Free Software Foundation, Inc. + +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +VPATH = @srcdir@ +am__is_gnu_make = { \ + if test -z '$(MAKELEVEL)'; then \ + false; \ + elif test -n '$(MAKE_HOST)'; then \ + true; \ + elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ + true; \ + else \ + false; \ + fi; \ +} +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + esac; \ + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +subdir = include +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/gettext.m4 \ + $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/lib-ld.m4 \ + $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ + $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \ + $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/acinclude.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +DIST_COMMON = $(srcdir)/Makefile.am $(noinst_HEADERS) \ + $(am__DIST_COMMON) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = aconfig.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = +SOURCES = +DIST_SOURCES = +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +HEADERS = $(noinst_HEADERS) +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) \ + $(LISP)aconfig.h.in +# Read a list of newline-separated strings from the standard input, +# and print each of them once, without duplicates. Input order is +# *not* preserved. +am__uniquify_input = $(AWK) '\ + BEGIN { nonempty = 0; } \ + { items[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in items) print i; }; } \ +' +# Make sure the list of sources is unique. This is necessary because, +# e.g., the same source file might be shared among _SOURCES variables +# for different programs/libraries. +am__define_uniq_tagged_files = \ + list='$(am__tagged_files)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | $(am__uniquify_input)` +ETAGS = etags +CTAGS = ctags +am__DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/aconfig.h.in +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +ALSACTL_DAEMONSWITCH = @ALSACTL_DAEMONSWITCH@ +ALSACTL_PIDFILE_DIR = @ALSACTL_PIDFILE_DIR@ +ALSA_CFLAGS = @ALSA_CFLAGS@ +ALSA_LIBS = @ALSA_LIBS@ +ALSA_TOPOLOGY_LIBS = @ALSA_TOPOLOGY_LIBS@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +ASOUND_LOCK_DIR = @ASOUND_LOCK_DIR@ +ASOUND_STATE_DIR = @ASOUND_STATE_DIR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CURSESINC = @CURSESINC@ +CURSESLIB = @CURSESLIB@ +CURSES_CFLAGS = @CURSES_CFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +FFTW_CFLAGS = @FFTW_CFLAGS@ +FFTW_INC = @FFTW_INC@ +FFTW_LIB = @FFTW_LIB@ +GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ +GMSGFMT = @GMSGFMT@ +GMSGFMT_015 = @GMSGFMT_015@ +GREP = @GREP@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +INTLLIBS = @INTLLIBS@ +INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@ +LDFLAGS = @LDFLAGS@ +LIBICONV = @LIBICONV@ +LIBINTL = @LIBINTL@ +LIBOBJS = @LIBOBJS@ +LIBRT = @LIBRT@ +LIBS = @LIBS@ +LN_S = @LN_S@ +LTLIBICONV = @LTLIBICONV@ +LTLIBINTL = @LTLIBINTL@ +LTLIBOBJS = @LTLIBOBJS@ +MAINT = @MAINT@ +MAKEINFO = @MAKEINFO@ +MKDIR_P = @MKDIR_P@ +MSGFMT = @MSGFMT@ +MSGFMT_015 = @MSGFMT_015@ +MSGMERGE = @MSGMERGE@ +NCURSESW_CFLAGS = @NCURSESW_CFLAGS@ +NCURSESW_LIBS = @NCURSESW_LIBS@ +NCURSES_CFLAGS = @NCURSES_CFLAGS@ +NCURSES_LIBS = @NCURSES_LIBS@ +OBJEXT = @OBJEXT@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ +POSUB = @POSUB@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +SND_UTIL_MAJOR = @SND_UTIL_MAJOR@ +SND_UTIL_MINOR = @SND_UTIL_MINOR@ +SND_UTIL_SUBMINOR = @SND_UTIL_SUBMINOR@ +SND_UTIL_VERSION = @SND_UTIL_VERSION@ +STRIP = @STRIP@ +SYSTEMD_CFLAGS = @SYSTEMD_CFLAGS@ +SYSTEMD_LIBS = @SYSTEMD_LIBS@ +TESTSOUND = @TESTSOUND@ +USE_NLS = @USE_NLS@ +VERSION = @VERSION@ +XGETTEXT = @XGETTEXT@ +XGETTEXT_015 = @XGETTEXT_015@ +XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_CC = @ac_ct_CC@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +mydatadir = @mydatadir@ +ncurses5_config = @ncurses5_config@ +ncursesw5_config = @ncursesw5_config@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +rst2man_available = @rst2man_available@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +systemdsystemunitdir = @systemdsystemunitdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +udevrulesdir = @udevrulesdir@ +xmlto_available = @xmlto_available@ +noinst_HEADERS = version.h gettext.h gettext_curses.h +AM_CPPFLAGS = -I$(top_srcdir)/include +all: aconfig.h + $(MAKE) $(AM_MAKEFLAGS) all-am + +.SUFFIXES: +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign include/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --foreign include/Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): + +aconfig.h: stamp-h1 + @test -f $@ || rm -f stamp-h1 + @test -f $@ || $(MAKE) $(AM_MAKEFLAGS) stamp-h1 + +stamp-h1: $(srcdir)/aconfig.h.in $(top_builddir)/config.status + @rm -f stamp-h1 + cd $(top_builddir) && $(SHELL) ./config.status include/aconfig.h +$(srcdir)/aconfig.h.in: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + ($(am__cd) $(top_srcdir) && $(AUTOHEADER)) + rm -f stamp-h1 + touch $@ + +distclean-hdr: + -rm -f aconfig.h stamp-h1 + +ID: $(am__tagged_files) + $(am__define_uniq_tagged_files); mkid -fID $$unique +tags: tags-am +TAGS: tags + +tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + set x; \ + here=`pwd`; \ + $(am__define_uniq_tagged_files); \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: ctags-am + +CTAGS: ctags +ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + $(am__define_uniq_tagged_files); \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" +cscopelist: cscopelist-am + +cscopelist-am: $(am__tagged_files) + list='$(am__tagged_files)'; \ + case "$(srcdir)" in \ + [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ + *) sdir=$(subdir)/$(srcdir) ;; \ + esac; \ + for i in $$list; do \ + if test -f "$$i"; then \ + echo "$(subdir)/$$i"; \ + else \ + echo "$$sdir/$$i"; \ + fi; \ + done >> $(top_builddir)/cscope.files + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) distdir-am + +distdir-am: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(HEADERS) aconfig.h +installdirs: +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic mostlyclean-am + +distclean: distclean-am + -rm -f Makefile +distclean-am: clean-am distclean-generic distclean-hdr distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-generic + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: + +.MAKE: all install-am install-strip + +.PHONY: CTAGS GTAGS TAGS all all-am check check-am clean clean-generic \ + cscopelist-am ctags ctags-am distclean distclean-generic \ + distclean-hdr distclean-tags distdir dvi dvi-am html html-am \ + info info-am install install-am install-data install-data-am \ + install-dvi install-dvi-am install-exec install-exec-am \ + install-html install-html-am install-info install-info-am \ + install-man install-pdf install-pdf-am install-ps \ + install-ps-am install-strip installcheck installcheck-am \ + installdirs maintainer-clean maintainer-clean-generic \ + mostlyclean mostlyclean-generic pdf pdf-am ps ps-am tags \ + tags-am uninstall uninstall-am + +.PRECIOUS: Makefile + + +version.h: stamp-vh + @: + +stamp-vh: $(top_builddir)/configure.ac + @echo "/*" > ver.tmp + @echo " * version.h" >> ver.tmp + @echo " */" >> ver.tmp + @echo "" >> ver.tmp + @echo "#define SND_UTIL_MAJOR $(SND_UTIL_MAJOR)" >> ver.tmp + @echo "#define SND_UTIL_MINOR $(SND_UTIL_MINOR)" >> ver.tmp + @echo "#define SND_UTIL_SUBMINOR $(SND_UTIL_SUBMINOR)" >> ver.tmp + @echo "#define SND_UTIL_VERSION ((SND_UTIL_MAJOR<<16)|\\" >> ver.tmp + @echo " (SND_UTIL_MINOR<<8)|\\" >> ver.tmp + @echo " SND_UTIL_SUBMINOR)" >> ver.tmp + @echo "#define SND_UTIL_VERSION_STR \"$(SND_UTIL_VERSION)\"" >> ver.tmp + @echo >> ver.tmp + @cmp -s version.h ver.tmp \ + || (echo "Updating version.h"; \ + cp ver.tmp version.h; \ + echo timestamp > stamp-vh) + -@rm -f ver.tmp + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/include/aconfig.h.in b/include/aconfig.h.in new file mode 100644 index 0000000..09b942b --- /dev/null +++ b/include/aconfig.h.in @@ -0,0 +1,175 @@ +/* include/aconfig.h.in. Generated from configure.ac by autoheader. */ + +/* directory containing alsa configuration */ +#undef DATADIR + +/* Define to 1 if translation of program messages to the user's native + language is requested. */ +#undef ENABLE_NLS + +/* Define if curses-based programs can show translated messages. */ +#undef ENABLE_NLS_IN_CURSES + +/* Define to 1 if you have the header file. */ +#undef HAVE_ALSA_MIXER_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_ALSA_PCM_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_ALSA_RAWMIDI_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_ALSA_SEQ_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_ALSA_TOPOLOGY_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_ALSA_USE_CASE_H + +/* Define to 1 if you have the Mac OS X function CFLocaleCopyCurrent in the + CoreFoundation framework. */ +#undef HAVE_CFLOCALECOPYCURRENT + +/* Define to 1 if you have the Mac OS X function CFPreferencesCopyAppValue in + the CoreFoundation framework. */ +#undef HAVE_CFPREFERENCESCOPYAPPVALUE + +/* Have clock gettime */ +#undef HAVE_CLOCK_GETTIME + +/* Have curses set_escdelay */ +#undef HAVE_CURSES_ESCDELAY + +/* Define if the GNU dcgettext() function is already present or preinstalled. + */ +#undef HAVE_DCGETTEXT + +/* Define to 1 if you have the header file. */ +#undef HAVE_FORM_H + +/* Define if the GNU gettext() function is already present or preinstalled. */ +#undef HAVE_GETTEXT + +/* Define if you have the iconv() function and it works. */ +#undef HAVE_ICONV + +/* Define to 1 if you have the header file. */ +#undef HAVE_INTTYPES_H + +/* Define to 1 if you have the `asound' library (-lasound). */ +#undef HAVE_LIBASOUND + +/* Define to 1 if you have the `atopology' library (-latopology). */ +#undef HAVE_LIBATOPOLOGY + +/* Define to 1 if you have the `fftw3f' library (-lfftw3f). */ +#undef HAVE_LIBFFTW3F + +/* Define to 1 if you have the `m' library (-lm). */ +#undef HAVE_LIBM + +/* Define to 1 if you have the `pthread' library (-lpthread). */ +#undef HAVE_LIBPTHREAD + +/* Have librt */ +#undef HAVE_LIBRT + +/* Define to 1 if you have the `tinyalsa' library (-ltinyalsa). */ +#undef HAVE_LIBTINYALSA + +/* Define to 1 if you have the header file. */ +#undef HAVE_MEMORY_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_MENU_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_PANEL_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SAMPLERATE_H + +/* alsa-lib supports snd_seq_client_info_get_card */ +#undef HAVE_SEQ_CLIENT_INFO_GET_CARD + +/* alsa-lib supports snd_seq_client_info_get_pid */ +#undef HAVE_SEQ_CLIENT_INFO_GET_PID + +/* Define to 1 if you have the header file. */ +#undef HAVE_STDINT_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STDLIB_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STRINGS_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STRING_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_STAT_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_TYPES_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_UNISTD_H + +/* Name of package */ +#undef PACKAGE + +/* Define to the address where bug reports for this package should be sent. */ +#undef PACKAGE_BUGREPORT + +/* Define to the full name of this package. */ +#undef PACKAGE_NAME + +/* Define to the full name and version of this package. */ +#undef PACKAGE_STRING + +/* Define to the one symbol short name of this package. */ +#undef PACKAGE_TARNAME + +/* Define to the home page for this package. */ +#undef PACKAGE_URL + +/* Define to the version of this package. */ +#undef PACKAGE_VERSION + +/* directory containing sample data */ +#undef SOUNDSDIR + +/* Define to 1 if you have the ANSI C header files. */ +#undef STDC_HEADERS + +/* Define to 1 if you can safely include both and . */ +#undef TIME_WITH_SYS_TIME + +/* ALSA util version */ +#undef VERSION + +/* Define if FFADO library is available */ +#undef WITH_FFADO + +/* Enable large inode numbers on Mac OS X 10.5. */ +#ifndef _DARWIN_USE_64_BIT_INODE +# define _DARWIN_USE_64_BIT_INODE 1 +#endif + +/* Number of bits in a file offset, on hosts where this is settable. */ +#undef _FILE_OFFSET_BITS + +/* Define for large files, on AIX-style hosts. */ +#undef _LARGE_FILES + +/* Define to empty if `const' does not conform to ANSI C. */ +#undef const + +/* Define to `__inline__' or `__inline' if that's what the C compiler + calls it, or to nothing if 'inline' is not supported under any name. */ +#ifndef __cplusplus +#undef inline +#endif diff --git a/include/gettext.h b/include/gettext.h new file mode 100644 index 0000000..d8a1467 --- /dev/null +++ b/include/gettext.h @@ -0,0 +1,22 @@ +#ifndef __MY_GETTEXT_H +#define __MY_GETTEXT_H + +#ifdef USES_CURSES +#define ENABLE_NLS_TEST ENABLE_NLS_IN_CURSES +#else +#define ENABLE_NLS_TEST ENABLE_NLS +#endif + +#if ENABLE_NLS_TEST +# include +#else +# define gettext(msgid) (msgid) +# define textdomain(domain) +# define bindtextdomain(domain, dir) +#endif + +#define _(msgid) gettext (msgid) +#define gettext_noop(msgid) msgid +#define N_(msgid) gettext_noop (msgid) + +#endif /* __MY_GETTEXT_H */ diff --git a/include/gettext_curses.h b/include/gettext_curses.h new file mode 100644 index 0000000..f1c4041 --- /dev/null +++ b/include/gettext_curses.h @@ -0,0 +1,2 @@ +#define USES_CURSES +#include "gettext.h" diff --git a/include/version.h b/include/version.h new file mode 100644 index 0000000..9531c5e --- /dev/null +++ b/include/version.h @@ -0,0 +1,12 @@ +/* + * version.h + */ + +#define SND_UTIL_MAJOR 1 +#define SND_UTIL_MINOR 2 +#define SND_UTIL_SUBMINOR 4 +#define SND_UTIL_VERSION ((SND_UTIL_MAJOR<<16)|\ + (SND_UTIL_MINOR<<8)|\ + SND_UTIL_SUBMINOR) +#define SND_UTIL_VERSION_STR "1.2.4" + diff --git a/install-sh b/install-sh new file mode 100755 index 0000000..8175c64 --- /dev/null +++ b/install-sh @@ -0,0 +1,518 @@ +#!/bin/sh +# install - install a program, script, or datafile + +scriptversion=2018-03-11.20; # UTC + +# This originates from X11R5 (mit/util/scripts/install.sh), which was +# later released in X11R6 (xc/config/util/install.sh) with the +# following copyright and license. +# +# Copyright (C) 1994 X Consortium +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC- +# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +# +# Except as contained in this notice, the name of the X Consortium shall not +# be used in advertising or otherwise to promote the sale, use or other deal- +# ings in this Software without prior written authorization from the X Consor- +# tium. +# +# +# FSF changes to this file are in the public domain. +# +# Calling this script install-sh is preferred over install.sh, to prevent +# 'make' implicit rules from creating a file called install from it +# when there is no Makefile. +# +# This script is compatible with the BSD install script, but was written +# from scratch. + +tab=' ' +nl=' +' +IFS=" $tab$nl" + +# Set DOITPROG to "echo" to test this script. + +doit=${DOITPROG-} +doit_exec=${doit:-exec} + +# Put in absolute file names if you don't have them in your path; +# or use environment vars. + +chgrpprog=${CHGRPPROG-chgrp} +chmodprog=${CHMODPROG-chmod} +chownprog=${CHOWNPROG-chown} +cmpprog=${CMPPROG-cmp} +cpprog=${CPPROG-cp} +mkdirprog=${MKDIRPROG-mkdir} +mvprog=${MVPROG-mv} +rmprog=${RMPROG-rm} +stripprog=${STRIPPROG-strip} + +posix_mkdir= + +# Desired mode of installed file. +mode=0755 + +chgrpcmd= +chmodcmd=$chmodprog +chowncmd= +mvcmd=$mvprog +rmcmd="$rmprog -f" +stripcmd= + +src= +dst= +dir_arg= +dst_arg= + +copy_on_change=false +is_target_a_directory=possibly + +usage="\ +Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE + or: $0 [OPTION]... SRCFILES... DIRECTORY + or: $0 [OPTION]... -t DIRECTORY SRCFILES... + or: $0 [OPTION]... -d DIRECTORIES... + +In the 1st form, copy SRCFILE to DSTFILE. +In the 2nd and 3rd, copy all SRCFILES to DIRECTORY. +In the 4th, create DIRECTORIES. + +Options: + --help display this help and exit. + --version display version info and exit. + + -c (ignored) + -C install only if different (preserve the last data modification time) + -d create directories instead of installing files. + -g GROUP $chgrpprog installed files to GROUP. + -m MODE $chmodprog installed files to MODE. + -o USER $chownprog installed files to USER. + -s $stripprog installed files. + -t DIRECTORY install into DIRECTORY. + -T report an error if DSTFILE is a directory. + +Environment variables override the default commands: + CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG + RMPROG STRIPPROG +" + +while test $# -ne 0; do + case $1 in + -c) ;; + + -C) copy_on_change=true;; + + -d) dir_arg=true;; + + -g) chgrpcmd="$chgrpprog $2" + shift;; + + --help) echo "$usage"; exit $?;; + + -m) mode=$2 + case $mode in + *' '* | *"$tab"* | *"$nl"* | *'*'* | *'?'* | *'['*) + echo "$0: invalid mode: $mode" >&2 + exit 1;; + esac + shift;; + + -o) chowncmd="$chownprog $2" + shift;; + + -s) stripcmd=$stripprog;; + + -t) + is_target_a_directory=always + dst_arg=$2 + # Protect names problematic for 'test' and other utilities. + case $dst_arg in + -* | [=\(\)!]) dst_arg=./$dst_arg;; + esac + shift;; + + -T) is_target_a_directory=never;; + + --version) echo "$0 $scriptversion"; exit $?;; + + --) shift + break;; + + -*) echo "$0: invalid option: $1" >&2 + exit 1;; + + *) break;; + esac + shift +done + +# We allow the use of options -d and -T together, by making -d +# take the precedence; this is for compatibility with GNU install. + +if test -n "$dir_arg"; then + if test -n "$dst_arg"; then + echo "$0: target directory not allowed when installing a directory." >&2 + exit 1 + fi +fi + +if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then + # When -d is used, all remaining arguments are directories to create. + # When -t is used, the destination is already specified. + # Otherwise, the last argument is the destination. Remove it from $@. + for arg + do + if test -n "$dst_arg"; then + # $@ is not empty: it contains at least $arg. + set fnord "$@" "$dst_arg" + shift # fnord + fi + shift # arg + dst_arg=$arg + # Protect names problematic for 'test' and other utilities. + case $dst_arg in + -* | [=\(\)!]) dst_arg=./$dst_arg;; + esac + done +fi + +if test $# -eq 0; then + if test -z "$dir_arg"; then + echo "$0: no input file specified." >&2 + exit 1 + fi + # It's OK to call 'install-sh -d' without argument. + # This can happen when creating conditional directories. + exit 0 +fi + +if test -z "$dir_arg"; then + if test $# -gt 1 || test "$is_target_a_directory" = always; then + if test ! -d "$dst_arg"; then + echo "$0: $dst_arg: Is not a directory." >&2 + exit 1 + fi + fi +fi + +if test -z "$dir_arg"; then + do_exit='(exit $ret); exit $ret' + trap "ret=129; $do_exit" 1 + trap "ret=130; $do_exit" 2 + trap "ret=141; $do_exit" 13 + trap "ret=143; $do_exit" 15 + + # Set umask so as not to create temps with too-generous modes. + # However, 'strip' requires both read and write access to temps. + case $mode in + # Optimize common cases. + *644) cp_umask=133;; + *755) cp_umask=22;; + + *[0-7]) + if test -z "$stripcmd"; then + u_plus_rw= + else + u_plus_rw='% 200' + fi + cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;; + *) + if test -z "$stripcmd"; then + u_plus_rw= + else + u_plus_rw=,u+rw + fi + cp_umask=$mode$u_plus_rw;; + esac +fi + +for src +do + # Protect names problematic for 'test' and other utilities. + case $src in + -* | [=\(\)!]) src=./$src;; + esac + + if test -n "$dir_arg"; then + dst=$src + dstdir=$dst + test -d "$dstdir" + dstdir_status=$? + else + + # Waiting for this to be detected by the "$cpprog $src $dsttmp" command + # might cause directories to be created, which would be especially bad + # if $src (and thus $dsttmp) contains '*'. + if test ! -f "$src" && test ! -d "$src"; then + echo "$0: $src does not exist." >&2 + exit 1 + fi + + if test -z "$dst_arg"; then + echo "$0: no destination specified." >&2 + exit 1 + fi + dst=$dst_arg + + # If destination is a directory, append the input filename. + if test -d "$dst"; then + if test "$is_target_a_directory" = never; then + echo "$0: $dst_arg: Is a directory" >&2 + exit 1 + fi + dstdir=$dst + dstbase=`basename "$src"` + case $dst in + */) dst=$dst$dstbase;; + *) dst=$dst/$dstbase;; + esac + dstdir_status=0 + else + dstdir=`dirname "$dst"` + test -d "$dstdir" + dstdir_status=$? + fi + fi + + case $dstdir in + */) dstdirslash=$dstdir;; + *) dstdirslash=$dstdir/;; + esac + + obsolete_mkdir_used=false + + if test $dstdir_status != 0; then + case $posix_mkdir in + '') + # Create intermediate dirs using mode 755 as modified by the umask. + # This is like FreeBSD 'install' as of 1997-10-28. + umask=`umask` + case $stripcmd.$umask in + # Optimize common cases. + *[2367][2367]) mkdir_umask=$umask;; + .*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;; + + *[0-7]) + mkdir_umask=`expr $umask + 22 \ + - $umask % 100 % 40 + $umask % 20 \ + - $umask % 10 % 4 + $umask % 2 + `;; + *) mkdir_umask=$umask,go-w;; + esac + + # With -d, create the new directory with the user-specified mode. + # Otherwise, rely on $mkdir_umask. + if test -n "$dir_arg"; then + mkdir_mode=-m$mode + else + mkdir_mode= + fi + + posix_mkdir=false + case $umask in + *[123567][0-7][0-7]) + # POSIX mkdir -p sets u+wx bits regardless of umask, which + # is incompatible with FreeBSD 'install' when (umask & 300) != 0. + ;; + *) + # Note that $RANDOM variable is not portable (e.g. dash); Use it + # here however when possible just to lower collision chance. + tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$ + + trap 'ret=$?; rmdir "$tmpdir/a/b" "$tmpdir/a" "$tmpdir" 2>/dev/null; exit $ret' 0 + + # Because "mkdir -p" follows existing symlinks and we likely work + # directly in world-writeable /tmp, make sure that the '$tmpdir' + # directory is successfully created first before we actually test + # 'mkdir -p' feature. + if (umask $mkdir_umask && + $mkdirprog $mkdir_mode "$tmpdir" && + exec $mkdirprog $mkdir_mode -p -- "$tmpdir/a/b") >/dev/null 2>&1 + then + if test -z "$dir_arg" || { + # Check for POSIX incompatibilities with -m. + # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or + # other-writable bit of parent directory when it shouldn't. + # FreeBSD 6.1 mkdir -m -p sets mode of existing directory. + test_tmpdir="$tmpdir/a" + ls_ld_tmpdir=`ls -ld "$test_tmpdir"` + case $ls_ld_tmpdir in + d????-?r-*) different_mode=700;; + d????-?--*) different_mode=755;; + *) false;; + esac && + $mkdirprog -m$different_mode -p -- "$test_tmpdir" && { + ls_ld_tmpdir_1=`ls -ld "$test_tmpdir"` + test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1" + } + } + then posix_mkdir=: + fi + rmdir "$tmpdir/a/b" "$tmpdir/a" "$tmpdir" + else + # Remove any dirs left behind by ancient mkdir implementations. + rmdir ./$mkdir_mode ./-p ./-- "$tmpdir" 2>/dev/null + fi + trap '' 0;; + esac;; + esac + + if + $posix_mkdir && ( + umask $mkdir_umask && + $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir" + ) + then : + else + + # The umask is ridiculous, or mkdir does not conform to POSIX, + # or it failed possibly due to a race condition. Create the + # directory the slow way, step by step, checking for races as we go. + + case $dstdir in + /*) prefix='/';; + [-=\(\)!]*) prefix='./';; + *) prefix='';; + esac + + oIFS=$IFS + IFS=/ + set -f + set fnord $dstdir + shift + set +f + IFS=$oIFS + + prefixes= + + for d + do + test X"$d" = X && continue + + prefix=$prefix$d + if test -d "$prefix"; then + prefixes= + else + if $posix_mkdir; then + (umask=$mkdir_umask && + $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break + # Don't fail if two instances are running concurrently. + test -d "$prefix" || exit 1 + else + case $prefix in + *\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;; + *) qprefix=$prefix;; + esac + prefixes="$prefixes '$qprefix'" + fi + fi + prefix=$prefix/ + done + + if test -n "$prefixes"; then + # Don't fail if two instances are running concurrently. + (umask $mkdir_umask && + eval "\$doit_exec \$mkdirprog $prefixes") || + test -d "$dstdir" || exit 1 + obsolete_mkdir_used=true + fi + fi + fi + + if test -n "$dir_arg"; then + { test -z "$chowncmd" || $doit $chowncmd "$dst"; } && + { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } && + { test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false || + test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1 + else + + # Make a couple of temp file names in the proper directory. + dsttmp=${dstdirslash}_inst.$$_ + rmtmp=${dstdirslash}_rm.$$_ + + # Trap to clean up those temp files at exit. + trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0 + + # Copy the file name to the temp name. + (umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") && + + # and set any options; do chmod last to preserve setuid bits. + # + # If any of these fail, we abort the whole thing. If we want to + # ignore errors from any of these, just make sure not to ignore + # errors from the above "$doit $cpprog $src $dsttmp" command. + # + { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } && + { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } && + { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } && + { test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } && + + # If -C, don't bother to copy if it wouldn't change the file. + if $copy_on_change && + old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` && + new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` && + set -f && + set X $old && old=:$2:$4:$5:$6 && + set X $new && new=:$2:$4:$5:$6 && + set +f && + test "$old" = "$new" && + $cmpprog "$dst" "$dsttmp" >/dev/null 2>&1 + then + rm -f "$dsttmp" + else + # Rename the file to the real destination. + $doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null || + + # The rename failed, perhaps because mv can't rename something else + # to itself, or perhaps because mv is so ancient that it does not + # support -f. + { + # Now remove or move aside any old file at destination location. + # We try this two ways since rm can't unlink itself on some + # systems and the destination file might be busy for other + # reasons. In this case, the final cleanup might fail but the new + # file should still install successfully. + { + test ! -f "$dst" || + $doit $rmcmd -f "$dst" 2>/dev/null || + { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null && + { $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; } + } || + { echo "$0: cannot unlink or rename $dst" >&2 + (exit 1); exit 1 + } + } && + + # Now rename the file to the real destination. + $doit $mvcmd "$dsttmp" "$dst" + } + fi || exit 1 + + trap '' 0 + fi +done + +# Local variables: +# eval: (add-hook 'before-save-hook 'time-stamp) +# time-stamp-start: "scriptversion=" +# time-stamp-format: "%:y-%02m-%02d.%02H" +# time-stamp-time-zone: "UTC0" +# time-stamp-end: "; # UTC" +# End: diff --git a/m4/Makefile.am b/m4/Makefile.am new file mode 100644 index 0000000..f759917 --- /dev/null +++ b/m4/Makefile.am @@ -0,0 +1 @@ +EXTRA_DIST = gettext.m4 iconv.m4 lib-ld.m4 lib-link.m4 lib-prefix.m4 nls.m4 po.m4 progtest.m4 gettext.m4 diff --git a/m4/Makefile.in b/m4/Makefile.in new file mode 100644 index 0000000..4ff0919 --- /dev/null +++ b/m4/Makefile.in @@ -0,0 +1,468 @@ +# Makefile.in generated by automake 1.16.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994-2018 Free Software Foundation, Inc. + +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ +VPATH = @srcdir@ +am__is_gnu_make = { \ + if test -z '$(MAKELEVEL)'; then \ + false; \ + elif test -n '$(MAKE_HOST)'; then \ + true; \ + elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ + true; \ + else \ + false; \ + fi; \ +} +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + esac; \ + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +subdir = m4 +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/gettext.m4 \ + $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/lib-ld.m4 \ + $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ + $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \ + $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/acinclude.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/include/aconfig.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = +SOURCES = +DIST_SOURCES = +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) +am__DIST_COMMON = $(srcdir)/Makefile.in +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +ALSACTL_DAEMONSWITCH = @ALSACTL_DAEMONSWITCH@ +ALSACTL_PIDFILE_DIR = @ALSACTL_PIDFILE_DIR@ +ALSA_CFLAGS = @ALSA_CFLAGS@ +ALSA_LIBS = @ALSA_LIBS@ +ALSA_TOPOLOGY_LIBS = @ALSA_TOPOLOGY_LIBS@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +ASOUND_LOCK_DIR = @ASOUND_LOCK_DIR@ +ASOUND_STATE_DIR = @ASOUND_STATE_DIR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CURSESINC = @CURSESINC@ +CURSESLIB = @CURSESLIB@ +CURSES_CFLAGS = @CURSES_CFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +FFTW_CFLAGS = @FFTW_CFLAGS@ +FFTW_INC = @FFTW_INC@ +FFTW_LIB = @FFTW_LIB@ +GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ +GMSGFMT = @GMSGFMT@ +GMSGFMT_015 = @GMSGFMT_015@ +GREP = @GREP@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +INTLLIBS = @INTLLIBS@ +INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@ +LDFLAGS = @LDFLAGS@ +LIBICONV = @LIBICONV@ +LIBINTL = @LIBINTL@ +LIBOBJS = @LIBOBJS@ +LIBRT = @LIBRT@ +LIBS = @LIBS@ +LN_S = @LN_S@ +LTLIBICONV = @LTLIBICONV@ +LTLIBINTL = @LTLIBINTL@ +LTLIBOBJS = @LTLIBOBJS@ +MAINT = @MAINT@ +MAKEINFO = @MAKEINFO@ +MKDIR_P = @MKDIR_P@ +MSGFMT = @MSGFMT@ +MSGFMT_015 = @MSGFMT_015@ +MSGMERGE = @MSGMERGE@ +NCURSESW_CFLAGS = @NCURSESW_CFLAGS@ +NCURSESW_LIBS = @NCURSESW_LIBS@ +NCURSES_CFLAGS = @NCURSES_CFLAGS@ +NCURSES_LIBS = @NCURSES_LIBS@ +OBJEXT = @OBJEXT@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ +POSUB = @POSUB@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +SND_UTIL_MAJOR = @SND_UTIL_MAJOR@ +SND_UTIL_MINOR = @SND_UTIL_MINOR@ +SND_UTIL_SUBMINOR = @SND_UTIL_SUBMINOR@ +SND_UTIL_VERSION = @SND_UTIL_VERSION@ +STRIP = @STRIP@ +SYSTEMD_CFLAGS = @SYSTEMD_CFLAGS@ +SYSTEMD_LIBS = @SYSTEMD_LIBS@ +TESTSOUND = @TESTSOUND@ +USE_NLS = @USE_NLS@ +VERSION = @VERSION@ +XGETTEXT = @XGETTEXT@ +XGETTEXT_015 = @XGETTEXT_015@ +XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_CC = @ac_ct_CC@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +mydatadir = @mydatadir@ +ncurses5_config = @ncurses5_config@ +ncursesw5_config = @ncursesw5_config@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +rst2man_available = @rst2man_available@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +systemdsystemunitdir = @systemdsystemunitdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +udevrulesdir = @udevrulesdir@ +xmlto_available = @xmlto_available@ +EXTRA_DIST = gettext.m4 iconv.m4 lib-ld.m4 lib-link.m4 lib-prefix.m4 nls.m4 po.m4 progtest.m4 gettext.m4 +all: all-am + +.SUFFIXES: +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign m4/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --foreign m4/Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): +tags TAGS: + +ctags CTAGS: + +cscope cscopelist: + + +distdir: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) distdir-am + +distdir-am: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile +installdirs: +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic mostlyclean-am + +distclean: distclean-am + -rm -f Makefile +distclean-am: clean-am distclean-generic + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-generic + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: + +.MAKE: install-am install-strip + +.PHONY: all all-am check check-am clean clean-generic cscopelist-am \ + ctags-am distclean distclean-generic distdir dvi dvi-am html \ + html-am info info-am install install-am install-data \ + install-data-am install-dvi install-dvi-am install-exec \ + install-exec-am install-html install-html-am install-info \ + install-info-am install-man install-pdf install-pdf-am \ + install-ps install-ps-am install-strip installcheck \ + installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-generic pdf \ + pdf-am ps ps-am tags-am uninstall uninstall-am + +.PRECIOUS: Makefile + + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/m4/gettext.m4 b/m4/gettext.m4 new file mode 100644 index 0000000..eef5073 --- /dev/null +++ b/m4/gettext.m4 @@ -0,0 +1,420 @@ +# gettext.m4 serial 68 (gettext-0.19.8) +dnl Copyright (C) 1995-2014, 2016 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. +dnl +dnl This file can be used in projects which are not available under +dnl the GNU General Public License or the GNU Library General Public +dnl License but which still want to provide support for the GNU gettext +dnl functionality. +dnl Please note that the actual code of the GNU gettext library is covered +dnl by the GNU Library General Public License, and the rest of the GNU +dnl gettext package is covered by the GNU General Public License. +dnl They are *not* in the public domain. + +dnl Authors: +dnl Ulrich Drepper , 1995-2000. +dnl Bruno Haible , 2000-2006, 2008-2010. + +dnl Macro to add for using GNU gettext. + +dnl Usage: AM_GNU_GETTEXT([INTLSYMBOL], [NEEDSYMBOL], [INTLDIR]). +dnl INTLSYMBOL can be one of 'external', 'no-libtool', 'use-libtool'. The +dnl default (if it is not specified or empty) is 'no-libtool'. +dnl INTLSYMBOL should be 'external' for packages with no intl directory, +dnl and 'no-libtool' or 'use-libtool' for packages with an intl directory. +dnl If INTLSYMBOL is 'use-libtool', then a libtool library +dnl $(top_builddir)/intl/libintl.la will be created (shared and/or static, +dnl depending on --{enable,disable}-{shared,static} and on the presence of +dnl AM-DISABLE-SHARED). If INTLSYMBOL is 'no-libtool', a static library +dnl $(top_builddir)/intl/libintl.a will be created. +dnl If NEEDSYMBOL is specified and is 'need-ngettext', then GNU gettext +dnl implementations (in libc or libintl) without the ngettext() function +dnl will be ignored. If NEEDSYMBOL is specified and is +dnl 'need-formatstring-macros', then GNU gettext implementations that don't +dnl support the ISO C 99 formatstring macros will be ignored. +dnl INTLDIR is used to find the intl libraries. If empty, +dnl the value '$(top_builddir)/intl/' is used. +dnl +dnl The result of the configuration is one of three cases: +dnl 1) GNU gettext, as included in the intl subdirectory, will be compiled +dnl and used. +dnl Catalog format: GNU --> install in $(datadir) +dnl Catalog extension: .mo after installation, .gmo in source tree +dnl 2) GNU gettext has been found in the system's C library. +dnl Catalog format: GNU --> install in $(datadir) +dnl Catalog extension: .mo after installation, .gmo in source tree +dnl 3) No internationalization, always use English msgid. +dnl Catalog format: none +dnl Catalog extension: none +dnl If INTLSYMBOL is 'external', only cases 2 and 3 can occur. +dnl The use of .gmo is historical (it was needed to avoid overwriting the +dnl GNU format catalogs when building on a platform with an X/Open gettext), +dnl but we keep it in order not to force irrelevant filename changes on the +dnl maintainers. +dnl +AC_DEFUN([AM_GNU_GETTEXT], +[ + dnl Argument checking. + ifelse([$1], [], , [ifelse([$1], [external], , [ifelse([$1], [no-libtool], , [ifelse([$1], [use-libtool], , + [errprint([ERROR: invalid first argument to AM_GNU_GETTEXT +])])])])]) + ifelse(ifelse([$1], [], [old])[]ifelse([$1], [no-libtool], [old]), [old], + [AC_DIAGNOSE([obsolete], [Use of AM_GNU_GETTEXT without [external] argument is deprecated.])]) + ifelse([$2], [], , [ifelse([$2], [need-ngettext], , [ifelse([$2], [need-formatstring-macros], , + [errprint([ERROR: invalid second argument to AM_GNU_GETTEXT +])])])]) + define([gt_included_intl], + ifelse([$1], [external], + ifdef([AM_GNU_GETTEXT_][INTL_SUBDIR], [yes], [no]), + [yes])) + define([gt_libtool_suffix_prefix], ifelse([$1], [use-libtool], [l], [])) + gt_NEEDS_INIT + AM_GNU_GETTEXT_NEED([$2]) + + AC_REQUIRE([AM_PO_SUBDIRS])dnl + ifelse(gt_included_intl, yes, [ + AC_REQUIRE([AM_INTL_SUBDIR])dnl + ]) + + dnl Prerequisites of AC_LIB_LINKFLAGS_BODY. + AC_REQUIRE([AC_LIB_PREPARE_PREFIX]) + AC_REQUIRE([AC_LIB_RPATH]) + + dnl Sometimes libintl requires libiconv, so first search for libiconv. + dnl Ideally we would do this search only after the + dnl if test "$USE_NLS" = "yes"; then + dnl if { eval "gt_val=\$$gt_func_gnugettext_libc"; test "$gt_val" != "yes"; }; then + dnl tests. But if configure.in invokes AM_ICONV after AM_GNU_GETTEXT + dnl the configure script would need to contain the same shell code + dnl again, outside any 'if'. There are two solutions: + dnl - Invoke AM_ICONV_LINKFLAGS_BODY here, outside any 'if'. + dnl - Control the expansions in more detail using AC_PROVIDE_IFELSE. + dnl Since AC_PROVIDE_IFELSE is only in autoconf >= 2.52 and not + dnl documented, we avoid it. + ifelse(gt_included_intl, yes, , [ + AC_REQUIRE([AM_ICONV_LINKFLAGS_BODY]) + ]) + + dnl Sometimes, on Mac OS X, libintl requires linking with CoreFoundation. + gt_INTL_MACOSX + + dnl Set USE_NLS. + AC_REQUIRE([AM_NLS]) + + ifelse(gt_included_intl, yes, [ + BUILD_INCLUDED_LIBINTL=no + USE_INCLUDED_LIBINTL=no + ]) + LIBINTL= + LTLIBINTL= + POSUB= + + dnl Add a version number to the cache macros. + case " $gt_needs " in + *" need-formatstring-macros "*) gt_api_version=3 ;; + *" need-ngettext "*) gt_api_version=2 ;; + *) gt_api_version=1 ;; + esac + gt_func_gnugettext_libc="gt_cv_func_gnugettext${gt_api_version}_libc" + gt_func_gnugettext_libintl="gt_cv_func_gnugettext${gt_api_version}_libintl" + + dnl If we use NLS figure out what method + if test "$USE_NLS" = "yes"; then + gt_use_preinstalled_gnugettext=no + ifelse(gt_included_intl, yes, [ + AC_MSG_CHECKING([whether included gettext is requested]) + AC_ARG_WITH([included-gettext], + [ --with-included-gettext use the GNU gettext library included here], + nls_cv_force_use_gnu_gettext=$withval, + nls_cv_force_use_gnu_gettext=no) + AC_MSG_RESULT([$nls_cv_force_use_gnu_gettext]) + + nls_cv_use_gnu_gettext="$nls_cv_force_use_gnu_gettext" + if test "$nls_cv_force_use_gnu_gettext" != "yes"; then + ]) + dnl User does not insist on using GNU NLS library. Figure out what + dnl to use. If GNU gettext is available we use this. Else we have + dnl to fall back to GNU NLS library. + + if test $gt_api_version -ge 3; then + gt_revision_test_code=' +#ifndef __GNU_GETTEXT_SUPPORTED_REVISION +#define __GNU_GETTEXT_SUPPORTED_REVISION(major) ((major) == 0 ? 0 : -1) +#endif +changequote(,)dnl +typedef int array [2 * (__GNU_GETTEXT_SUPPORTED_REVISION(0) >= 1) - 1]; +changequote([,])dnl +' + else + gt_revision_test_code= + fi + if test $gt_api_version -ge 2; then + gt_expression_test_code=' + * ngettext ("", "", 0)' + else + gt_expression_test_code= + fi + + AC_CACHE_CHECK([for GNU gettext in libc], [$gt_func_gnugettext_libc], + [AC_LINK_IFELSE( + [AC_LANG_PROGRAM( + [[ +#include +#ifndef __GNU_GETTEXT_SUPPORTED_REVISION +extern int _nl_msg_cat_cntr; +extern int *_nl_domain_bindings; +#define __GNU_GETTEXT_SYMBOL_EXPRESSION (_nl_msg_cat_cntr + *_nl_domain_bindings) +#else +#define __GNU_GETTEXT_SYMBOL_EXPRESSION 0 +#endif +$gt_revision_test_code + ]], + [[ +bindtextdomain ("", ""); +return * gettext ("")$gt_expression_test_code + __GNU_GETTEXT_SYMBOL_EXPRESSION + ]])], + [eval "$gt_func_gnugettext_libc=yes"], + [eval "$gt_func_gnugettext_libc=no"])]) + + if { eval "gt_val=\$$gt_func_gnugettext_libc"; test "$gt_val" != "yes"; }; then + dnl Sometimes libintl requires libiconv, so first search for libiconv. + ifelse(gt_included_intl, yes, , [ + AM_ICONV_LINK + ]) + dnl Search for libintl and define LIBINTL, LTLIBINTL and INCINTL + dnl accordingly. Don't use AC_LIB_LINKFLAGS_BODY([intl],[iconv]) + dnl because that would add "-liconv" to LIBINTL and LTLIBINTL + dnl even if libiconv doesn't exist. + AC_LIB_LINKFLAGS_BODY([intl]) + AC_CACHE_CHECK([for GNU gettext in libintl], + [$gt_func_gnugettext_libintl], + [gt_save_CPPFLAGS="$CPPFLAGS" + CPPFLAGS="$CPPFLAGS $INCINTL" + gt_save_LIBS="$LIBS" + LIBS="$LIBS $LIBINTL" + dnl Now see whether libintl exists and does not depend on libiconv. + AC_LINK_IFELSE( + [AC_LANG_PROGRAM( + [[ +#include +#ifndef __GNU_GETTEXT_SUPPORTED_REVISION +extern int _nl_msg_cat_cntr; +extern +#ifdef __cplusplus +"C" +#endif +const char *_nl_expand_alias (const char *); +#define __GNU_GETTEXT_SYMBOL_EXPRESSION (_nl_msg_cat_cntr + *_nl_expand_alias ("")) +#else +#define __GNU_GETTEXT_SYMBOL_EXPRESSION 0 +#endif +$gt_revision_test_code + ]], + [[ +bindtextdomain ("", ""); +return * gettext ("")$gt_expression_test_code + __GNU_GETTEXT_SYMBOL_EXPRESSION + ]])], + [eval "$gt_func_gnugettext_libintl=yes"], + [eval "$gt_func_gnugettext_libintl=no"]) + dnl Now see whether libintl exists and depends on libiconv. + if { eval "gt_val=\$$gt_func_gnugettext_libintl"; test "$gt_val" != yes; } && test -n "$LIBICONV"; then + LIBS="$LIBS $LIBICONV" + AC_LINK_IFELSE( + [AC_LANG_PROGRAM( + [[ +#include +#ifndef __GNU_GETTEXT_SUPPORTED_REVISION +extern int _nl_msg_cat_cntr; +extern +#ifdef __cplusplus +"C" +#endif +const char *_nl_expand_alias (const char *); +#define __GNU_GETTEXT_SYMBOL_EXPRESSION (_nl_msg_cat_cntr + *_nl_expand_alias ("")) +#else +#define __GNU_GETTEXT_SYMBOL_EXPRESSION 0 +#endif +$gt_revision_test_code + ]], + [[ +bindtextdomain ("", ""); +return * gettext ("")$gt_expression_test_code + __GNU_GETTEXT_SYMBOL_EXPRESSION + ]])], + [LIBINTL="$LIBINTL $LIBICONV" + LTLIBINTL="$LTLIBINTL $LTLIBICONV" + eval "$gt_func_gnugettext_libintl=yes" + ]) + fi + CPPFLAGS="$gt_save_CPPFLAGS" + LIBS="$gt_save_LIBS"]) + fi + + dnl If an already present or preinstalled GNU gettext() is found, + dnl use it. But if this macro is used in GNU gettext, and GNU + dnl gettext is already preinstalled in libintl, we update this + dnl libintl. (Cf. the install rule in intl/Makefile.in.) + if { eval "gt_val=\$$gt_func_gnugettext_libc"; test "$gt_val" = "yes"; } \ + || { { eval "gt_val=\$$gt_func_gnugettext_libintl"; test "$gt_val" = "yes"; } \ + && test "$PACKAGE" != gettext-runtime \ + && test "$PACKAGE" != gettext-tools; }; then + gt_use_preinstalled_gnugettext=yes + else + dnl Reset the values set by searching for libintl. + LIBINTL= + LTLIBINTL= + INCINTL= + fi + + ifelse(gt_included_intl, yes, [ + if test "$gt_use_preinstalled_gnugettext" != "yes"; then + dnl GNU gettext is not found in the C library. + dnl Fall back on included GNU gettext library. + nls_cv_use_gnu_gettext=yes + fi + fi + + if test "$nls_cv_use_gnu_gettext" = "yes"; then + dnl Mark actions used to generate GNU NLS library. + BUILD_INCLUDED_LIBINTL=yes + USE_INCLUDED_LIBINTL=yes + LIBINTL="ifelse([$3],[],\${top_builddir}/intl,[$3])/libintl.[]gt_libtool_suffix_prefix[]a $LIBICONV $LIBTHREAD" + LTLIBINTL="ifelse([$3],[],\${top_builddir}/intl,[$3])/libintl.[]gt_libtool_suffix_prefix[]a $LTLIBICONV $LTLIBTHREAD" + LIBS=`echo " $LIBS " | sed -e 's/ -lintl / /' -e 's/^ //' -e 's/ $//'` + fi + + CATOBJEXT= + if test "$gt_use_preinstalled_gnugettext" = "yes" \ + || test "$nls_cv_use_gnu_gettext" = "yes"; then + dnl Mark actions to use GNU gettext tools. + CATOBJEXT=.gmo + fi + ]) + + if test -n "$INTL_MACOSX_LIBS"; then + if test "$gt_use_preinstalled_gnugettext" = "yes" \ + || test "$nls_cv_use_gnu_gettext" = "yes"; then + dnl Some extra flags are needed during linking. + LIBINTL="$LIBINTL $INTL_MACOSX_LIBS" + LTLIBINTL="$LTLIBINTL $INTL_MACOSX_LIBS" + fi + fi + + if test "$gt_use_preinstalled_gnugettext" = "yes" \ + || test "$nls_cv_use_gnu_gettext" = "yes"; then + AC_DEFINE([ENABLE_NLS], [1], + [Define to 1 if translation of program messages to the user's native language + is requested.]) + else + USE_NLS=no + fi + fi + + AC_MSG_CHECKING([whether to use NLS]) + AC_MSG_RESULT([$USE_NLS]) + if test "$USE_NLS" = "yes"; then + AC_MSG_CHECKING([where the gettext function comes from]) + if test "$gt_use_preinstalled_gnugettext" = "yes"; then + if { eval "gt_val=\$$gt_func_gnugettext_libintl"; test "$gt_val" = "yes"; }; then + gt_source="external libintl" + else + gt_source="libc" + fi + else + gt_source="included intl directory" + fi + AC_MSG_RESULT([$gt_source]) + fi + + if test "$USE_NLS" = "yes"; then + + if test "$gt_use_preinstalled_gnugettext" = "yes"; then + if { eval "gt_val=\$$gt_func_gnugettext_libintl"; test "$gt_val" = "yes"; }; then + AC_MSG_CHECKING([how to link with libintl]) + AC_MSG_RESULT([$LIBINTL]) + AC_LIB_APPENDTOVAR([CPPFLAGS], [$INCINTL]) + fi + + dnl For backward compatibility. Some packages may be using this. + AC_DEFINE([HAVE_GETTEXT], [1], + [Define if the GNU gettext() function is already present or preinstalled.]) + AC_DEFINE([HAVE_DCGETTEXT], [1], + [Define if the GNU dcgettext() function is already present or preinstalled.]) + fi + + dnl We need to process the po/ directory. + POSUB=po + fi + + ifelse(gt_included_intl, yes, [ + dnl If this is used in GNU gettext we have to set BUILD_INCLUDED_LIBINTL + dnl to 'yes' because some of the testsuite requires it. + if test "$PACKAGE" = gettext-runtime || test "$PACKAGE" = gettext-tools; then + BUILD_INCLUDED_LIBINTL=yes + fi + + dnl Make all variables we use known to autoconf. + AC_SUBST([BUILD_INCLUDED_LIBINTL]) + AC_SUBST([USE_INCLUDED_LIBINTL]) + AC_SUBST([CATOBJEXT]) + + dnl For backward compatibility. Some configure.ins may be using this. + nls_cv_header_intl= + nls_cv_header_libgt= + + dnl For backward compatibility. Some Makefiles may be using this. + DATADIRNAME=share + AC_SUBST([DATADIRNAME]) + + dnl For backward compatibility. Some Makefiles may be using this. + INSTOBJEXT=.mo + AC_SUBST([INSTOBJEXT]) + + dnl For backward compatibility. Some Makefiles may be using this. + GENCAT=gencat + AC_SUBST([GENCAT]) + + dnl For backward compatibility. Some Makefiles may be using this. + INTLOBJS= + if test "$USE_INCLUDED_LIBINTL" = yes; then + INTLOBJS="\$(GETTOBJS)" + fi + AC_SUBST([INTLOBJS]) + + dnl Enable libtool support if the surrounding package wishes it. + INTL_LIBTOOL_SUFFIX_PREFIX=gt_libtool_suffix_prefix + AC_SUBST([INTL_LIBTOOL_SUFFIX_PREFIX]) + ]) + + dnl For backward compatibility. Some Makefiles may be using this. + INTLLIBS="$LIBINTL" + AC_SUBST([INTLLIBS]) + + dnl Make all documented variables known to autoconf. + AC_SUBST([LIBINTL]) + AC_SUBST([LTLIBINTL]) + AC_SUBST([POSUB]) +]) + + +dnl gt_NEEDS_INIT ensures that the gt_needs variable is initialized. +m4_define([gt_NEEDS_INIT], +[ + m4_divert_text([DEFAULTS], [gt_needs=]) + m4_define([gt_NEEDS_INIT], []) +]) + + +dnl Usage: AM_GNU_GETTEXT_NEED([NEEDSYMBOL]) +AC_DEFUN([AM_GNU_GETTEXT_NEED], +[ + m4_divert_text([INIT_PREPARE], [gt_needs="$gt_needs $1"]) +]) + + +dnl Usage: AM_GNU_GETTEXT_VERSION([gettext-version]) +AC_DEFUN([AM_GNU_GETTEXT_VERSION], []) + + +dnl Usage: AM_GNU_GETTEXT_REQUIRE_VERSION([gettext-version]) +AC_DEFUN([AM_GNU_GETTEXT_REQUIRE_VERSION], []) diff --git a/m4/iconv.m4 b/m4/iconv.m4 new file mode 100644 index 0000000..aa159c5 --- /dev/null +++ b/m4/iconv.m4 @@ -0,0 +1,271 @@ +# iconv.m4 serial 19 (gettext-0.18.2) +dnl Copyright (C) 2000-2002, 2007-2014, 2016 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +dnl From Bruno Haible. + +AC_DEFUN([AM_ICONV_LINKFLAGS_BODY], +[ + dnl Prerequisites of AC_LIB_LINKFLAGS_BODY. + AC_REQUIRE([AC_LIB_PREPARE_PREFIX]) + AC_REQUIRE([AC_LIB_RPATH]) + + dnl Search for libiconv and define LIBICONV, LTLIBICONV and INCICONV + dnl accordingly. + AC_LIB_LINKFLAGS_BODY([iconv]) +]) + +AC_DEFUN([AM_ICONV_LINK], +[ + dnl Some systems have iconv in libc, some have it in libiconv (OSF/1 and + dnl those with the standalone portable GNU libiconv installed). + AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles + + dnl Search for libiconv and define LIBICONV, LTLIBICONV and INCICONV + dnl accordingly. + AC_REQUIRE([AM_ICONV_LINKFLAGS_BODY]) + + dnl Add $INCICONV to CPPFLAGS before performing the following checks, + dnl because if the user has installed libiconv and not disabled its use + dnl via --without-libiconv-prefix, he wants to use it. The first + dnl AC_LINK_IFELSE will then fail, the second AC_LINK_IFELSE will succeed. + am_save_CPPFLAGS="$CPPFLAGS" + AC_LIB_APPENDTOVAR([CPPFLAGS], [$INCICONV]) + + AC_CACHE_CHECK([for iconv], [am_cv_func_iconv], [ + am_cv_func_iconv="no, consider installing GNU libiconv" + am_cv_lib_iconv=no + AC_LINK_IFELSE( + [AC_LANG_PROGRAM( + [[ +#include +#include + ]], + [[iconv_t cd = iconv_open("",""); + iconv(cd,NULL,NULL,NULL,NULL); + iconv_close(cd);]])], + [am_cv_func_iconv=yes]) + if test "$am_cv_func_iconv" != yes; then + am_save_LIBS="$LIBS" + LIBS="$LIBS $LIBICONV" + AC_LINK_IFELSE( + [AC_LANG_PROGRAM( + [[ +#include +#include + ]], + [[iconv_t cd = iconv_open("",""); + iconv(cd,NULL,NULL,NULL,NULL); + iconv_close(cd);]])], + [am_cv_lib_iconv=yes] + [am_cv_func_iconv=yes]) + LIBS="$am_save_LIBS" + fi + ]) + if test "$am_cv_func_iconv" = yes; then + AC_CACHE_CHECK([for working iconv], [am_cv_func_iconv_works], [ + dnl This tests against bugs in AIX 5.1, AIX 6.1..7.1, HP-UX 11.11, + dnl Solaris 10. + am_save_LIBS="$LIBS" + if test $am_cv_lib_iconv = yes; then + LIBS="$LIBS $LIBICONV" + fi + am_cv_func_iconv_works=no + for ac_iconv_const in '' 'const'; do + AC_RUN_IFELSE( + [AC_LANG_PROGRAM( + [[ +#include +#include + +#ifndef ICONV_CONST +# define ICONV_CONST $ac_iconv_const +#endif + ]], + [[int result = 0; + /* Test against AIX 5.1 bug: Failures are not distinguishable from successful + returns. */ + { + iconv_t cd_utf8_to_88591 = iconv_open ("ISO8859-1", "UTF-8"); + if (cd_utf8_to_88591 != (iconv_t)(-1)) + { + static ICONV_CONST char input[] = "\342\202\254"; /* EURO SIGN */ + char buf[10]; + ICONV_CONST char *inptr = input; + size_t inbytesleft = strlen (input); + char *outptr = buf; + size_t outbytesleft = sizeof (buf); + size_t res = iconv (cd_utf8_to_88591, + &inptr, &inbytesleft, + &outptr, &outbytesleft); + if (res == 0) + result |= 1; + iconv_close (cd_utf8_to_88591); + } + } + /* Test against Solaris 10 bug: Failures are not distinguishable from + successful returns. */ + { + iconv_t cd_ascii_to_88591 = iconv_open ("ISO8859-1", "646"); + if (cd_ascii_to_88591 != (iconv_t)(-1)) + { + static ICONV_CONST char input[] = "\263"; + char buf[10]; + ICONV_CONST char *inptr = input; + size_t inbytesleft = strlen (input); + char *outptr = buf; + size_t outbytesleft = sizeof (buf); + size_t res = iconv (cd_ascii_to_88591, + &inptr, &inbytesleft, + &outptr, &outbytesleft); + if (res == 0) + result |= 2; + iconv_close (cd_ascii_to_88591); + } + } + /* Test against AIX 6.1..7.1 bug: Buffer overrun. */ + { + iconv_t cd_88591_to_utf8 = iconv_open ("UTF-8", "ISO-8859-1"); + if (cd_88591_to_utf8 != (iconv_t)(-1)) + { + static ICONV_CONST char input[] = "\304"; + static char buf[2] = { (char)0xDE, (char)0xAD }; + ICONV_CONST char *inptr = input; + size_t inbytesleft = 1; + char *outptr = buf; + size_t outbytesleft = 1; + size_t res = iconv (cd_88591_to_utf8, + &inptr, &inbytesleft, + &outptr, &outbytesleft); + if (res != (size_t)(-1) || outptr - buf > 1 || buf[1] != (char)0xAD) + result |= 4; + iconv_close (cd_88591_to_utf8); + } + } +#if 0 /* This bug could be worked around by the caller. */ + /* Test against HP-UX 11.11 bug: Positive return value instead of 0. */ + { + iconv_t cd_88591_to_utf8 = iconv_open ("utf8", "iso88591"); + if (cd_88591_to_utf8 != (iconv_t)(-1)) + { + static ICONV_CONST char input[] = "\304rger mit b\366sen B\374bchen ohne Augenma\337"; + char buf[50]; + ICONV_CONST char *inptr = input; + size_t inbytesleft = strlen (input); + char *outptr = buf; + size_t outbytesleft = sizeof (buf); + size_t res = iconv (cd_88591_to_utf8, + &inptr, &inbytesleft, + &outptr, &outbytesleft); + if ((int)res > 0) + result |= 8; + iconv_close (cd_88591_to_utf8); + } + } +#endif + /* Test against HP-UX 11.11 bug: No converter from EUC-JP to UTF-8 is + provided. */ + if (/* Try standardized names. */ + iconv_open ("UTF-8", "EUC-JP") == (iconv_t)(-1) + /* Try IRIX, OSF/1 names. */ + && iconv_open ("UTF-8", "eucJP") == (iconv_t)(-1) + /* Try AIX names. */ + && iconv_open ("UTF-8", "IBM-eucJP") == (iconv_t)(-1) + /* Try HP-UX names. */ + && iconv_open ("utf8", "eucJP") == (iconv_t)(-1)) + result |= 16; + return result; +]])], + [am_cv_func_iconv_works=yes], , + [case "$host_os" in + aix* | hpux*) am_cv_func_iconv_works="guessing no" ;; + *) am_cv_func_iconv_works="guessing yes" ;; + esac]) + test "$am_cv_func_iconv_works" = no || break + done + LIBS="$am_save_LIBS" + ]) + case "$am_cv_func_iconv_works" in + *no) am_func_iconv=no am_cv_lib_iconv=no ;; + *) am_func_iconv=yes ;; + esac + else + am_func_iconv=no am_cv_lib_iconv=no + fi + if test "$am_func_iconv" = yes; then + AC_DEFINE([HAVE_ICONV], [1], + [Define if you have the iconv() function and it works.]) + fi + if test "$am_cv_lib_iconv" = yes; then + AC_MSG_CHECKING([how to link with libiconv]) + AC_MSG_RESULT([$LIBICONV]) + else + dnl If $LIBICONV didn't lead to a usable library, we don't need $INCICONV + dnl either. + CPPFLAGS="$am_save_CPPFLAGS" + LIBICONV= + LTLIBICONV= + fi + AC_SUBST([LIBICONV]) + AC_SUBST([LTLIBICONV]) +]) + +dnl Define AM_ICONV using AC_DEFUN_ONCE for Autoconf >= 2.64, in order to +dnl avoid warnings like +dnl "warning: AC_REQUIRE: `AM_ICONV' was expanded before it was required". +dnl This is tricky because of the way 'aclocal' is implemented: +dnl - It requires defining an auxiliary macro whose name ends in AC_DEFUN. +dnl Otherwise aclocal's initial scan pass would miss the macro definition. +dnl - It requires a line break inside the AC_DEFUN_ONCE and AC_DEFUN expansions. +dnl Otherwise aclocal would emit many "Use of uninitialized value $1" +dnl warnings. +m4_define([gl_iconv_AC_DEFUN], + m4_version_prereq([2.64], + [[AC_DEFUN_ONCE( + [$1], [$2])]], + [m4_ifdef([gl_00GNULIB], + [[AC_DEFUN_ONCE( + [$1], [$2])]], + [[AC_DEFUN( + [$1], [$2])]])])) +gl_iconv_AC_DEFUN([AM_ICONV], +[ + AM_ICONV_LINK + if test "$am_cv_func_iconv" = yes; then + AC_MSG_CHECKING([for iconv declaration]) + AC_CACHE_VAL([am_cv_proto_iconv], [ + AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM( + [[ +#include +#include +extern +#ifdef __cplusplus +"C" +#endif +#if defined(__STDC__) || defined(_MSC_VER) || defined(__cplusplus) +size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft); +#else +size_t iconv(); +#endif + ]], + [[]])], + [am_cv_proto_iconv_arg1=""], + [am_cv_proto_iconv_arg1="const"]) + am_cv_proto_iconv="extern size_t iconv (iconv_t cd, $am_cv_proto_iconv_arg1 char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);"]) + am_cv_proto_iconv=`echo "[$]am_cv_proto_iconv" | tr -s ' ' | sed -e 's/( /(/'` + AC_MSG_RESULT([ + $am_cv_proto_iconv]) + AC_DEFINE_UNQUOTED([ICONV_CONST], [$am_cv_proto_iconv_arg1], + [Define as const if the declaration of iconv() needs const.]) + dnl Also substitute ICONV_CONST in the gnulib generated . + m4_ifdef([gl_ICONV_H_DEFAULTS], + [AC_REQUIRE([gl_ICONV_H_DEFAULTS]) + if test -n "$am_cv_proto_iconv_arg1"; then + ICONV_CONST="const" + fi + ]) + fi +]) diff --git a/m4/lib-ld.m4 b/m4/lib-ld.m4 new file mode 100644 index 0000000..6209de6 --- /dev/null +++ b/m4/lib-ld.m4 @@ -0,0 +1,119 @@ +# lib-ld.m4 serial 6 +dnl Copyright (C) 1996-2003, 2009-2016 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +dnl Subroutines of libtool.m4, +dnl with replacements s/_*LT_PATH/AC_LIB_PROG/ and s/lt_/acl_/ to avoid +dnl collision with libtool.m4. + +dnl From libtool-2.4. Sets the variable with_gnu_ld to yes or no. +AC_DEFUN([AC_LIB_PROG_LD_GNU], +[AC_CACHE_CHECK([if the linker ($LD) is GNU ld], [acl_cv_prog_gnu_ld], +[# I'd rather use --version here, but apparently some GNU lds only accept -v. +case `$LD -v 2>&1 /dev/null 2>&1 \ + && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 \ + || PATH_SEPARATOR=';' + } +fi + +ac_prog=ld +if test "$GCC" = yes; then + # Check if gcc -print-prog-name=ld gives a path. + AC_MSG_CHECKING([for ld used by $CC]) + case $host in + *-*-mingw*) + # gcc leaves a trailing carriage return which upsets mingw + ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; + *) + ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; + esac + case $ac_prog in + # Accept absolute paths. + [[\\/]]* | ?:[[\\/]]*) + re_direlt='/[[^/]][[^/]]*/\.\./' + # Canonicalize the pathname of ld + ac_prog=`echo "$ac_prog"| sed 's%\\\\%/%g'` + while echo "$ac_prog" | grep "$re_direlt" > /dev/null 2>&1; do + ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"` + done + test -z "$LD" && LD="$ac_prog" + ;; + "") + # If it fails, then pretend we aren't using GCC. + ac_prog=ld + ;; + *) + # If it is relative, then search for the first ld in PATH. + with_gnu_ld=unknown + ;; + esac +elif test "$with_gnu_ld" = yes; then + AC_MSG_CHECKING([for GNU ld]) +else + AC_MSG_CHECKING([for non-GNU ld]) +fi +AC_CACHE_VAL([acl_cv_path_LD], +[if test -z "$LD"; then + acl_save_ifs="$IFS"; IFS=$PATH_SEPARATOR + for ac_dir in $PATH; do + IFS="$acl_save_ifs" + test -z "$ac_dir" && ac_dir=. + if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then + acl_cv_path_LD="$ac_dir/$ac_prog" + # Check to see if the program is GNU ld. I'd rather use --version, + # but apparently some variants of GNU ld only accept -v. + # Break only if it was the GNU/non-GNU ld that we prefer. + case `"$acl_cv_path_LD" -v 2>&1 = 1.10 to complain if config.rpath is missing. + m4_ifdef([AC_REQUIRE_AUX_FILE], [AC_REQUIRE_AUX_FILE([config.rpath])]) + AC_REQUIRE([AC_PROG_CC]) dnl we use $CC, $GCC, $LDFLAGS + AC_REQUIRE([AC_LIB_PROG_LD]) dnl we use $LD, $with_gnu_ld + AC_REQUIRE([AC_CANONICAL_HOST]) dnl we use $host + AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT]) dnl we use $ac_aux_dir + AC_CACHE_CHECK([for shared library run path origin], [acl_cv_rpath], [ + CC="$CC" GCC="$GCC" LDFLAGS="$LDFLAGS" LD="$LD" with_gnu_ld="$with_gnu_ld" \ + ${CONFIG_SHELL-/bin/sh} "$ac_aux_dir/config.rpath" "$host" > conftest.sh + . ./conftest.sh + rm -f ./conftest.sh + acl_cv_rpath=done + ]) + wl="$acl_cv_wl" + acl_libext="$acl_cv_libext" + acl_shlibext="$acl_cv_shlibext" + acl_libname_spec="$acl_cv_libname_spec" + acl_library_names_spec="$acl_cv_library_names_spec" + acl_hardcode_libdir_flag_spec="$acl_cv_hardcode_libdir_flag_spec" + acl_hardcode_libdir_separator="$acl_cv_hardcode_libdir_separator" + acl_hardcode_direct="$acl_cv_hardcode_direct" + acl_hardcode_minus_L="$acl_cv_hardcode_minus_L" + dnl Determine whether the user wants rpath handling at all. + AC_ARG_ENABLE([rpath], + [ --disable-rpath do not hardcode runtime library paths], + :, enable_rpath=yes) +]) + +dnl AC_LIB_FROMPACKAGE(name, package) +dnl declares that libname comes from the given package. The configure file +dnl will then not have a --with-libname-prefix option but a +dnl --with-package-prefix option. Several libraries can come from the same +dnl package. This declaration must occur before an AC_LIB_LINKFLAGS or similar +dnl macro call that searches for libname. +AC_DEFUN([AC_LIB_FROMPACKAGE], +[ + pushdef([NAME],[m4_translit([$1],[abcdefghijklmnopqrstuvwxyz./+-], + [ABCDEFGHIJKLMNOPQRSTUVWXYZ____])]) + define([acl_frompackage_]NAME, [$2]) + popdef([NAME]) + pushdef([PACK],[$2]) + pushdef([PACKUP],[m4_translit(PACK,[abcdefghijklmnopqrstuvwxyz./+-], + [ABCDEFGHIJKLMNOPQRSTUVWXYZ____])]) + define([acl_libsinpackage_]PACKUP, + m4_ifdef([acl_libsinpackage_]PACKUP, [m4_defn([acl_libsinpackage_]PACKUP)[, ]],)[lib$1]) + popdef([PACKUP]) + popdef([PACK]) +]) + +dnl AC_LIB_LINKFLAGS_BODY(name [, dependencies]) searches for libname and +dnl the libraries corresponding to explicit and implicit dependencies. +dnl Sets the LIB${NAME}, LTLIB${NAME} and INC${NAME} variables. +dnl Also, sets the LIB${NAME}_PREFIX variable to nonempty if libname was found +dnl in ${LIB${NAME}_PREFIX}/$acl_libdirstem. +AC_DEFUN([AC_LIB_LINKFLAGS_BODY], +[ + AC_REQUIRE([AC_LIB_PREPARE_MULTILIB]) + pushdef([NAME],[m4_translit([$1],[abcdefghijklmnopqrstuvwxyz./+-], + [ABCDEFGHIJKLMNOPQRSTUVWXYZ____])]) + pushdef([PACK],[m4_ifdef([acl_frompackage_]NAME, [acl_frompackage_]NAME, lib[$1])]) + pushdef([PACKUP],[m4_translit(PACK,[abcdefghijklmnopqrstuvwxyz./+-], + [ABCDEFGHIJKLMNOPQRSTUVWXYZ____])]) + pushdef([PACKLIBS],[m4_ifdef([acl_frompackage_]NAME, [acl_libsinpackage_]PACKUP, lib[$1])]) + dnl Autoconf >= 2.61 supports dots in --with options. + pushdef([P_A_C_K],[m4_if(m4_version_compare(m4_defn([m4_PACKAGE_VERSION]),[2.61]),[-1],[m4_translit(PACK,[.],[_])],PACK)]) + dnl By default, look in $includedir and $libdir. + use_additional=yes + AC_LIB_WITH_FINAL_PREFIX([ + eval additional_includedir=\"$includedir\" + eval additional_libdir=\"$libdir\" + ]) + AC_ARG_WITH(P_A_C_K[-prefix], +[[ --with-]]P_A_C_K[[-prefix[=DIR] search for ]PACKLIBS[ in DIR/include and DIR/lib + --without-]]P_A_C_K[[-prefix don't search for ]PACKLIBS[ in includedir and libdir]], +[ + if test "X$withval" = "Xno"; then + use_additional=no + else + if test "X$withval" = "X"; then + AC_LIB_WITH_FINAL_PREFIX([ + eval additional_includedir=\"$includedir\" + eval additional_libdir=\"$libdir\" + ]) + else + additional_includedir="$withval/include" + additional_libdir="$withval/$acl_libdirstem" + if test "$acl_libdirstem2" != "$acl_libdirstem" \ + && ! test -d "$withval/$acl_libdirstem"; then + additional_libdir="$withval/$acl_libdirstem2" + fi + fi + fi +]) + dnl Search the library and its dependencies in $additional_libdir and + dnl $LDFLAGS. Using breadth-first-seach. + LIB[]NAME= + LTLIB[]NAME= + INC[]NAME= + LIB[]NAME[]_PREFIX= + dnl HAVE_LIB${NAME} is an indicator that LIB${NAME}, LTLIB${NAME} have been + dnl computed. So it has to be reset here. + HAVE_LIB[]NAME= + rpathdirs= + ltrpathdirs= + names_already_handled= + names_next_round='$1 $2' + while test -n "$names_next_round"; do + names_this_round="$names_next_round" + names_next_round= + for name in $names_this_round; do + already_handled= + for n in $names_already_handled; do + if test "$n" = "$name"; then + already_handled=yes + break + fi + done + if test -z "$already_handled"; then + names_already_handled="$names_already_handled $name" + dnl See if it was already located by an earlier AC_LIB_LINKFLAGS + dnl or AC_LIB_HAVE_LINKFLAGS call. + uppername=`echo "$name" | sed -e 'y|abcdefghijklmnopqrstuvwxyz./+-|ABCDEFGHIJKLMNOPQRSTUVWXYZ____|'` + eval value=\"\$HAVE_LIB$uppername\" + if test -n "$value"; then + if test "$value" = yes; then + eval value=\"\$LIB$uppername\" + test -z "$value" || LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$value" + eval value=\"\$LTLIB$uppername\" + test -z "$value" || LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }$value" + else + dnl An earlier call to AC_LIB_HAVE_LINKFLAGS has determined + dnl that this library doesn't exist. So just drop it. + : + fi + else + dnl Search the library lib$name in $additional_libdir and $LDFLAGS + dnl and the already constructed $LIBNAME/$LTLIBNAME. + found_dir= + found_la= + found_so= + found_a= + eval libname=\"$acl_libname_spec\" # typically: libname=lib$name + if test -n "$acl_shlibext"; then + shrext=".$acl_shlibext" # typically: shrext=.so + else + shrext= + fi + if test $use_additional = yes; then + dir="$additional_libdir" + dnl The same code as in the loop below: + dnl First look for a shared library. + if test -n "$acl_shlibext"; then + if test -f "$dir/$libname$shrext"; then + found_dir="$dir" + found_so="$dir/$libname$shrext" + else + if test "$acl_library_names_spec" = '$libname$shrext$versuffix'; then + ver=`(cd "$dir" && \ + for f in "$libname$shrext".*; do echo "$f"; done \ + | sed -e "s,^$libname$shrext\\\\.,," \ + | sort -t '.' -n -r -k1,1 -k2,2 -k3,3 -k4,4 -k5,5 \ + | sed 1q ) 2>/dev/null` + if test -n "$ver" && test -f "$dir/$libname$shrext.$ver"; then + found_dir="$dir" + found_so="$dir/$libname$shrext.$ver" + fi + else + eval library_names=\"$acl_library_names_spec\" + for f in $library_names; do + if test -f "$dir/$f"; then + found_dir="$dir" + found_so="$dir/$f" + break + fi + done + fi + fi + fi + dnl Then look for a static library. + if test "X$found_dir" = "X"; then + if test -f "$dir/$libname.$acl_libext"; then + found_dir="$dir" + found_a="$dir/$libname.$acl_libext" + fi + fi + if test "X$found_dir" != "X"; then + if test -f "$dir/$libname.la"; then + found_la="$dir/$libname.la" + fi + fi + fi + if test "X$found_dir" = "X"; then + for x in $LDFLAGS $LTLIB[]NAME; do + AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) + case "$x" in + -L*) + dir=`echo "X$x" | sed -e 's/^X-L//'` + dnl First look for a shared library. + if test -n "$acl_shlibext"; then + if test -f "$dir/$libname$shrext"; then + found_dir="$dir" + found_so="$dir/$libname$shrext" + else + if test "$acl_library_names_spec" = '$libname$shrext$versuffix'; then + ver=`(cd "$dir" && \ + for f in "$libname$shrext".*; do echo "$f"; done \ + | sed -e "s,^$libname$shrext\\\\.,," \ + | sort -t '.' -n -r -k1,1 -k2,2 -k3,3 -k4,4 -k5,5 \ + | sed 1q ) 2>/dev/null` + if test -n "$ver" && test -f "$dir/$libname$shrext.$ver"; then + found_dir="$dir" + found_so="$dir/$libname$shrext.$ver" + fi + else + eval library_names=\"$acl_library_names_spec\" + for f in $library_names; do + if test -f "$dir/$f"; then + found_dir="$dir" + found_so="$dir/$f" + break + fi + done + fi + fi + fi + dnl Then look for a static library. + if test "X$found_dir" = "X"; then + if test -f "$dir/$libname.$acl_libext"; then + found_dir="$dir" + found_a="$dir/$libname.$acl_libext" + fi + fi + if test "X$found_dir" != "X"; then + if test -f "$dir/$libname.la"; then + found_la="$dir/$libname.la" + fi + fi + ;; + esac + if test "X$found_dir" != "X"; then + break + fi + done + fi + if test "X$found_dir" != "X"; then + dnl Found the library. + LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-L$found_dir -l$name" + if test "X$found_so" != "X"; then + dnl Linking with a shared library. We attempt to hardcode its + dnl directory into the executable's runpath, unless it's the + dnl standard /usr/lib. + if test "$enable_rpath" = no \ + || test "X$found_dir" = "X/usr/$acl_libdirstem" \ + || test "X$found_dir" = "X/usr/$acl_libdirstem2"; then + dnl No hardcoding is needed. + LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so" + else + dnl Use an explicit option to hardcode DIR into the resulting + dnl binary. + dnl Potentially add DIR to ltrpathdirs. + dnl The ltrpathdirs will be appended to $LTLIBNAME at the end. + haveit= + for x in $ltrpathdirs; do + if test "X$x" = "X$found_dir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + ltrpathdirs="$ltrpathdirs $found_dir" + fi + dnl The hardcoding into $LIBNAME is system dependent. + if test "$acl_hardcode_direct" = yes; then + dnl Using DIR/libNAME.so during linking hardcodes DIR into the + dnl resulting binary. + LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so" + else + if test -n "$acl_hardcode_libdir_flag_spec" && test "$acl_hardcode_minus_L" = no; then + dnl Use an explicit option to hardcode DIR into the resulting + dnl binary. + LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so" + dnl Potentially add DIR to rpathdirs. + dnl The rpathdirs will be appended to $LIBNAME at the end. + haveit= + for x in $rpathdirs; do + if test "X$x" = "X$found_dir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + rpathdirs="$rpathdirs $found_dir" + fi + else + dnl Rely on "-L$found_dir". + dnl But don't add it if it's already contained in the LDFLAGS + dnl or the already constructed $LIBNAME + haveit= + for x in $LDFLAGS $LIB[]NAME; do + AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) + if test "X$x" = "X-L$found_dir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$found_dir" + fi + if test "$acl_hardcode_minus_L" != no; then + dnl FIXME: Not sure whether we should use + dnl "-L$found_dir -l$name" or "-L$found_dir $found_so" + dnl here. + LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so" + else + dnl We cannot use $acl_hardcode_runpath_var and LD_RUN_PATH + dnl here, because this doesn't fit in flags passed to the + dnl compiler. So give up. No hardcoding. This affects only + dnl very old systems. + dnl FIXME: Not sure whether we should use + dnl "-L$found_dir -l$name" or "-L$found_dir $found_so" + dnl here. + LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-l$name" + fi + fi + fi + fi + else + if test "X$found_a" != "X"; then + dnl Linking with a static library. + LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_a" + else + dnl We shouldn't come here, but anyway it's good to have a + dnl fallback. + LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$found_dir -l$name" + fi + fi + dnl Assume the include files are nearby. + additional_includedir= + case "$found_dir" in + */$acl_libdirstem | */$acl_libdirstem/) + basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e "s,/$acl_libdirstem/"'*$,,'` + if test "$name" = '$1'; then + LIB[]NAME[]_PREFIX="$basedir" + fi + additional_includedir="$basedir/include" + ;; + */$acl_libdirstem2 | */$acl_libdirstem2/) + basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e "s,/$acl_libdirstem2/"'*$,,'` + if test "$name" = '$1'; then + LIB[]NAME[]_PREFIX="$basedir" + fi + additional_includedir="$basedir/include" + ;; + esac + if test "X$additional_includedir" != "X"; then + dnl Potentially add $additional_includedir to $INCNAME. + dnl But don't add it + dnl 1. if it's the standard /usr/include, + dnl 2. if it's /usr/local/include and we are using GCC on Linux, + dnl 3. if it's already present in $CPPFLAGS or the already + dnl constructed $INCNAME, + dnl 4. if it doesn't exist as a directory. + if test "X$additional_includedir" != "X/usr/include"; then + haveit= + if test "X$additional_includedir" = "X/usr/local/include"; then + if test -n "$GCC"; then + case $host_os in + linux* | gnu* | k*bsd*-gnu) haveit=yes;; + esac + fi + fi + if test -z "$haveit"; then + for x in $CPPFLAGS $INC[]NAME; do + AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) + if test "X$x" = "X-I$additional_includedir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + if test -d "$additional_includedir"; then + dnl Really add $additional_includedir to $INCNAME. + INC[]NAME="${INC[]NAME}${INC[]NAME:+ }-I$additional_includedir" + fi + fi + fi + fi + fi + dnl Look for dependencies. + if test -n "$found_la"; then + dnl Read the .la file. It defines the variables + dnl dlname, library_names, old_library, dependency_libs, current, + dnl age, revision, installed, dlopen, dlpreopen, libdir. + save_libdir="$libdir" + case "$found_la" in + */* | *\\*) . "$found_la" ;; + *) . "./$found_la" ;; + esac + libdir="$save_libdir" + dnl We use only dependency_libs. + for dep in $dependency_libs; do + case "$dep" in + -L*) + additional_libdir=`echo "X$dep" | sed -e 's/^X-L//'` + dnl Potentially add $additional_libdir to $LIBNAME and $LTLIBNAME. + dnl But don't add it + dnl 1. if it's the standard /usr/lib, + dnl 2. if it's /usr/local/lib and we are using GCC on Linux, + dnl 3. if it's already present in $LDFLAGS or the already + dnl constructed $LIBNAME, + dnl 4. if it doesn't exist as a directory. + if test "X$additional_libdir" != "X/usr/$acl_libdirstem" \ + && test "X$additional_libdir" != "X/usr/$acl_libdirstem2"; then + haveit= + if test "X$additional_libdir" = "X/usr/local/$acl_libdirstem" \ + || test "X$additional_libdir" = "X/usr/local/$acl_libdirstem2"; then + if test -n "$GCC"; then + case $host_os in + linux* | gnu* | k*bsd*-gnu) haveit=yes;; + esac + fi + fi + if test -z "$haveit"; then + haveit= + for x in $LDFLAGS $LIB[]NAME; do + AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) + if test "X$x" = "X-L$additional_libdir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + if test -d "$additional_libdir"; then + dnl Really add $additional_libdir to $LIBNAME. + LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$additional_libdir" + fi + fi + haveit= + for x in $LDFLAGS $LTLIB[]NAME; do + AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) + if test "X$x" = "X-L$additional_libdir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + if test -d "$additional_libdir"; then + dnl Really add $additional_libdir to $LTLIBNAME. + LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-L$additional_libdir" + fi + fi + fi + fi + ;; + -R*) + dir=`echo "X$dep" | sed -e 's/^X-R//'` + if test "$enable_rpath" != no; then + dnl Potentially add DIR to rpathdirs. + dnl The rpathdirs will be appended to $LIBNAME at the end. + haveit= + for x in $rpathdirs; do + if test "X$x" = "X$dir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + rpathdirs="$rpathdirs $dir" + fi + dnl Potentially add DIR to ltrpathdirs. + dnl The ltrpathdirs will be appended to $LTLIBNAME at the end. + haveit= + for x in $ltrpathdirs; do + if test "X$x" = "X$dir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + ltrpathdirs="$ltrpathdirs $dir" + fi + fi + ;; + -l*) + dnl Handle this in the next round. + names_next_round="$names_next_round "`echo "X$dep" | sed -e 's/^X-l//'` + ;; + *.la) + dnl Handle this in the next round. Throw away the .la's + dnl directory; it is already contained in a preceding -L + dnl option. + names_next_round="$names_next_round "`echo "X$dep" | sed -e 's,^X.*/,,' -e 's,^lib,,' -e 's,\.la$,,'` + ;; + *) + dnl Most likely an immediate library name. + LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$dep" + LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }$dep" + ;; + esac + done + fi + else + dnl Didn't find the library; assume it is in the system directories + dnl known to the linker and runtime loader. (All the system + dnl directories known to the linker should also be known to the + dnl runtime loader, otherwise the system is severely misconfigured.) + LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-l$name" + LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-l$name" + fi + fi + fi + done + done + if test "X$rpathdirs" != "X"; then + if test -n "$acl_hardcode_libdir_separator"; then + dnl Weird platform: only the last -rpath option counts, the user must + dnl pass all path elements in one option. We can arrange that for a + dnl single library, but not when more than one $LIBNAMEs are used. + alldirs= + for found_dir in $rpathdirs; do + alldirs="${alldirs}${alldirs:+$acl_hardcode_libdir_separator}$found_dir" + done + dnl Note: acl_hardcode_libdir_flag_spec uses $libdir and $wl. + acl_save_libdir="$libdir" + libdir="$alldirs" + eval flag=\"$acl_hardcode_libdir_flag_spec\" + libdir="$acl_save_libdir" + LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$flag" + else + dnl The -rpath options are cumulative. + for found_dir in $rpathdirs; do + acl_save_libdir="$libdir" + libdir="$found_dir" + eval flag=\"$acl_hardcode_libdir_flag_spec\" + libdir="$acl_save_libdir" + LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$flag" + done + fi + fi + if test "X$ltrpathdirs" != "X"; then + dnl When using libtool, the option that works for both libraries and + dnl executables is -R. The -R options are cumulative. + for found_dir in $ltrpathdirs; do + LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-R$found_dir" + done + fi + popdef([P_A_C_K]) + popdef([PACKLIBS]) + popdef([PACKUP]) + popdef([PACK]) + popdef([NAME]) +]) + +dnl AC_LIB_APPENDTOVAR(VAR, CONTENTS) appends the elements of CONTENTS to VAR, +dnl unless already present in VAR. +dnl Works only for CPPFLAGS, not for LIB* variables because that sometimes +dnl contains two or three consecutive elements that belong together. +AC_DEFUN([AC_LIB_APPENDTOVAR], +[ + for element in [$2]; do + haveit= + for x in $[$1]; do + AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) + if test "X$x" = "X$element"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + [$1]="${[$1]}${[$1]:+ }$element" + fi + done +]) + +dnl For those cases where a variable contains several -L and -l options +dnl referring to unknown libraries and directories, this macro determines the +dnl necessary additional linker options for the runtime path. +dnl AC_LIB_LINKFLAGS_FROM_LIBS([LDADDVAR], [LIBSVALUE], [USE-LIBTOOL]) +dnl sets LDADDVAR to linker options needed together with LIBSVALUE. +dnl If USE-LIBTOOL evaluates to non-empty, linking with libtool is assumed, +dnl otherwise linking without libtool is assumed. +AC_DEFUN([AC_LIB_LINKFLAGS_FROM_LIBS], +[ + AC_REQUIRE([AC_LIB_RPATH]) + AC_REQUIRE([AC_LIB_PREPARE_MULTILIB]) + $1= + if test "$enable_rpath" != no; then + if test -n "$acl_hardcode_libdir_flag_spec" && test "$acl_hardcode_minus_L" = no; then + dnl Use an explicit option to hardcode directories into the resulting + dnl binary. + rpathdirs= + next= + for opt in $2; do + if test -n "$next"; then + dir="$next" + dnl No need to hardcode the standard /usr/lib. + if test "X$dir" != "X/usr/$acl_libdirstem" \ + && test "X$dir" != "X/usr/$acl_libdirstem2"; then + rpathdirs="$rpathdirs $dir" + fi + next= + else + case $opt in + -L) next=yes ;; + -L*) dir=`echo "X$opt" | sed -e 's,^X-L,,'` + dnl No need to hardcode the standard /usr/lib. + if test "X$dir" != "X/usr/$acl_libdirstem" \ + && test "X$dir" != "X/usr/$acl_libdirstem2"; then + rpathdirs="$rpathdirs $dir" + fi + next= ;; + *) next= ;; + esac + fi + done + if test "X$rpathdirs" != "X"; then + if test -n ""$3""; then + dnl libtool is used for linking. Use -R options. + for dir in $rpathdirs; do + $1="${$1}${$1:+ }-R$dir" + done + else + dnl The linker is used for linking directly. + if test -n "$acl_hardcode_libdir_separator"; then + dnl Weird platform: only the last -rpath option counts, the user + dnl must pass all path elements in one option. + alldirs= + for dir in $rpathdirs; do + alldirs="${alldirs}${alldirs:+$acl_hardcode_libdir_separator}$dir" + done + acl_save_libdir="$libdir" + libdir="$alldirs" + eval flag=\"$acl_hardcode_libdir_flag_spec\" + libdir="$acl_save_libdir" + $1="$flag" + else + dnl The -rpath options are cumulative. + for dir in $rpathdirs; do + acl_save_libdir="$libdir" + libdir="$dir" + eval flag=\"$acl_hardcode_libdir_flag_spec\" + libdir="$acl_save_libdir" + $1="${$1}${$1:+ }$flag" + done + fi + fi + fi + fi + fi + AC_SUBST([$1]) +]) diff --git a/m4/lib-prefix.m4 b/m4/lib-prefix.m4 new file mode 100644 index 0000000..6851031 --- /dev/null +++ b/m4/lib-prefix.m4 @@ -0,0 +1,224 @@ +# lib-prefix.m4 serial 7 (gettext-0.18) +dnl Copyright (C) 2001-2005, 2008-2016 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +dnl From Bruno Haible. + +dnl AC_LIB_ARG_WITH is synonymous to AC_ARG_WITH in autoconf-2.13, and +dnl similar to AC_ARG_WITH in autoconf 2.52...2.57 except that is doesn't +dnl require excessive bracketing. +ifdef([AC_HELP_STRING], +[AC_DEFUN([AC_LIB_ARG_WITH], [AC_ARG_WITH([$1],[[$2]],[$3],[$4])])], +[AC_DEFUN([AC_][LIB_ARG_WITH], [AC_ARG_WITH([$1],[$2],[$3],[$4])])]) + +dnl AC_LIB_PREFIX adds to the CPPFLAGS and LDFLAGS the flags that are needed +dnl to access previously installed libraries. The basic assumption is that +dnl a user will want packages to use other packages he previously installed +dnl with the same --prefix option. +dnl This macro is not needed if only AC_LIB_LINKFLAGS is used to locate +dnl libraries, but is otherwise very convenient. +AC_DEFUN([AC_LIB_PREFIX], +[ + AC_BEFORE([$0], [AC_LIB_LINKFLAGS]) + AC_REQUIRE([AC_PROG_CC]) + AC_REQUIRE([AC_CANONICAL_HOST]) + AC_REQUIRE([AC_LIB_PREPARE_MULTILIB]) + AC_REQUIRE([AC_LIB_PREPARE_PREFIX]) + dnl By default, look in $includedir and $libdir. + use_additional=yes + AC_LIB_WITH_FINAL_PREFIX([ + eval additional_includedir=\"$includedir\" + eval additional_libdir=\"$libdir\" + ]) + AC_LIB_ARG_WITH([lib-prefix], +[ --with-lib-prefix[=DIR] search for libraries in DIR/include and DIR/lib + --without-lib-prefix don't search for libraries in includedir and libdir], +[ + if test "X$withval" = "Xno"; then + use_additional=no + else + if test "X$withval" = "X"; then + AC_LIB_WITH_FINAL_PREFIX([ + eval additional_includedir=\"$includedir\" + eval additional_libdir=\"$libdir\" + ]) + else + additional_includedir="$withval/include" + additional_libdir="$withval/$acl_libdirstem" + fi + fi +]) + if test $use_additional = yes; then + dnl Potentially add $additional_includedir to $CPPFLAGS. + dnl But don't add it + dnl 1. if it's the standard /usr/include, + dnl 2. if it's already present in $CPPFLAGS, + dnl 3. if it's /usr/local/include and we are using GCC on Linux, + dnl 4. if it doesn't exist as a directory. + if test "X$additional_includedir" != "X/usr/include"; then + haveit= + for x in $CPPFLAGS; do + AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) + if test "X$x" = "X-I$additional_includedir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + if test "X$additional_includedir" = "X/usr/local/include"; then + if test -n "$GCC"; then + case $host_os in + linux* | gnu* | k*bsd*-gnu) haveit=yes;; + esac + fi + fi + if test -z "$haveit"; then + if test -d "$additional_includedir"; then + dnl Really add $additional_includedir to $CPPFLAGS. + CPPFLAGS="${CPPFLAGS}${CPPFLAGS:+ }-I$additional_includedir" + fi + fi + fi + fi + dnl Potentially add $additional_libdir to $LDFLAGS. + dnl But don't add it + dnl 1. if it's the standard /usr/lib, + dnl 2. if it's already present in $LDFLAGS, + dnl 3. if it's /usr/local/lib and we are using GCC on Linux, + dnl 4. if it doesn't exist as a directory. + if test "X$additional_libdir" != "X/usr/$acl_libdirstem"; then + haveit= + for x in $LDFLAGS; do + AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) + if test "X$x" = "X-L$additional_libdir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + if test "X$additional_libdir" = "X/usr/local/$acl_libdirstem"; then + if test -n "$GCC"; then + case $host_os in + linux*) haveit=yes;; + esac + fi + fi + if test -z "$haveit"; then + if test -d "$additional_libdir"; then + dnl Really add $additional_libdir to $LDFLAGS. + LDFLAGS="${LDFLAGS}${LDFLAGS:+ }-L$additional_libdir" + fi + fi + fi + fi + fi +]) + +dnl AC_LIB_PREPARE_PREFIX creates variables acl_final_prefix, +dnl acl_final_exec_prefix, containing the values to which $prefix and +dnl $exec_prefix will expand at the end of the configure script. +AC_DEFUN([AC_LIB_PREPARE_PREFIX], +[ + dnl Unfortunately, prefix and exec_prefix get only finally determined + dnl at the end of configure. + if test "X$prefix" = "XNONE"; then + acl_final_prefix="$ac_default_prefix" + else + acl_final_prefix="$prefix" + fi + if test "X$exec_prefix" = "XNONE"; then + acl_final_exec_prefix='${prefix}' + else + acl_final_exec_prefix="$exec_prefix" + fi + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + eval acl_final_exec_prefix=\"$acl_final_exec_prefix\" + prefix="$acl_save_prefix" +]) + +dnl AC_LIB_WITH_FINAL_PREFIX([statement]) evaluates statement, with the +dnl variables prefix and exec_prefix bound to the values they will have +dnl at the end of the configure script. +AC_DEFUN([AC_LIB_WITH_FINAL_PREFIX], +[ + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + acl_save_exec_prefix="$exec_prefix" + exec_prefix="$acl_final_exec_prefix" + $1 + exec_prefix="$acl_save_exec_prefix" + prefix="$acl_save_prefix" +]) + +dnl AC_LIB_PREPARE_MULTILIB creates +dnl - a variable acl_libdirstem, containing the basename of the libdir, either +dnl "lib" or "lib64" or "lib/64", +dnl - a variable acl_libdirstem2, as a secondary possible value for +dnl acl_libdirstem, either the same as acl_libdirstem or "lib/sparcv9" or +dnl "lib/amd64". +AC_DEFUN([AC_LIB_PREPARE_MULTILIB], +[ + dnl There is no formal standard regarding lib and lib64. + dnl On glibc systems, the current practice is that on a system supporting + dnl 32-bit and 64-bit instruction sets or ABIs, 64-bit libraries go under + dnl $prefix/lib64 and 32-bit libraries go under $prefix/lib. We determine + dnl the compiler's default mode by looking at the compiler's library search + dnl path. If at least one of its elements ends in /lib64 or points to a + dnl directory whose absolute pathname ends in /lib64, we assume a 64-bit ABI. + dnl Otherwise we use the default, namely "lib". + dnl On Solaris systems, the current practice is that on a system supporting + dnl 32-bit and 64-bit instruction sets or ABIs, 64-bit libraries go under + dnl $prefix/lib/64 (which is a symlink to either $prefix/lib/sparcv9 or + dnl $prefix/lib/amd64) and 32-bit libraries go under $prefix/lib. + AC_REQUIRE([AC_CANONICAL_HOST]) + acl_libdirstem=lib + acl_libdirstem2= + case "$host_os" in + solaris*) + dnl See Solaris 10 Software Developer Collection > Solaris 64-bit Developer's Guide > The Development Environment + dnl . + dnl "Portable Makefiles should refer to any library directories using the 64 symbolic link." + dnl But we want to recognize the sparcv9 or amd64 subdirectory also if the + dnl symlink is missing, so we set acl_libdirstem2 too. + AC_CACHE_CHECK([for 64-bit host], [gl_cv_solaris_64bit], + [AC_EGREP_CPP([sixtyfour bits], [ +#ifdef _LP64 +sixtyfour bits +#endif + ], [gl_cv_solaris_64bit=yes], [gl_cv_solaris_64bit=no]) + ]) + if test $gl_cv_solaris_64bit = yes; then + acl_libdirstem=lib/64 + case "$host_cpu" in + sparc*) acl_libdirstem2=lib/sparcv9 ;; + i*86 | x86_64) acl_libdirstem2=lib/amd64 ;; + esac + fi + ;; + *) + searchpath=`(LC_ALL=C $CC -print-search-dirs) 2>/dev/null | sed -n -e 's,^libraries: ,,p' | sed -e 's,^=,,'` + if test -n "$searchpath"; then + acl_save_IFS="${IFS= }"; IFS=":" + for searchdir in $searchpath; do + if test -d "$searchdir"; then + case "$searchdir" in + */lib64/ | */lib64 ) acl_libdirstem=lib64 ;; + */../ | */.. ) + # Better ignore directories of this form. They are misleading. + ;; + *) searchdir=`cd "$searchdir" && pwd` + case "$searchdir" in + */lib64 ) acl_libdirstem=lib64 ;; + esac ;; + esac + fi + done + IFS="$acl_save_IFS" + fi + ;; + esac + test -n "$acl_libdirstem2" || acl_libdirstem2="$acl_libdirstem" +]) diff --git a/m4/nls.m4 b/m4/nls.m4 new file mode 100644 index 0000000..afdb9ca --- /dev/null +++ b/m4/nls.m4 @@ -0,0 +1,32 @@ +# nls.m4 serial 5 (gettext-0.18) +dnl Copyright (C) 1995-2003, 2005-2006, 2008-2014, 2016 Free Software +dnl Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. +dnl +dnl This file can be used in projects which are not available under +dnl the GNU General Public License or the GNU Library General Public +dnl License but which still want to provide support for the GNU gettext +dnl functionality. +dnl Please note that the actual code of the GNU gettext library is covered +dnl by the GNU Library General Public License, and the rest of the GNU +dnl gettext package is covered by the GNU General Public License. +dnl They are *not* in the public domain. + +dnl Authors: +dnl Ulrich Drepper , 1995-2000. +dnl Bruno Haible , 2000-2003. + +AC_PREREQ([2.50]) + +AC_DEFUN([AM_NLS], +[ + AC_MSG_CHECKING([whether NLS is requested]) + dnl Default is enabled NLS + AC_ARG_ENABLE([nls], + [ --disable-nls do not use Native Language Support], + USE_NLS=$enableval, USE_NLS=yes) + AC_MSG_RESULT([$USE_NLS]) + AC_SUBST([USE_NLS]) +]) diff --git a/m4/po.m4 b/m4/po.m4 new file mode 100644 index 0000000..c5a2f6b --- /dev/null +++ b/m4/po.m4 @@ -0,0 +1,453 @@ +# po.m4 serial 24 (gettext-0.19) +dnl Copyright (C) 1995-2014, 2016 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. +dnl +dnl This file can be used in projects which are not available under +dnl the GNU General Public License or the GNU Library General Public +dnl License but which still want to provide support for the GNU gettext +dnl functionality. +dnl Please note that the actual code of the GNU gettext library is covered +dnl by the GNU Library General Public License, and the rest of the GNU +dnl gettext package is covered by the GNU General Public License. +dnl They are *not* in the public domain. + +dnl Authors: +dnl Ulrich Drepper , 1995-2000. +dnl Bruno Haible , 2000-2003. + +AC_PREREQ([2.60]) + +dnl Checks for all prerequisites of the po subdirectory. +AC_DEFUN([AM_PO_SUBDIRS], +[ + AC_REQUIRE([AC_PROG_MAKE_SET])dnl + AC_REQUIRE([AC_PROG_INSTALL])dnl + AC_REQUIRE([AC_PROG_MKDIR_P])dnl + AC_REQUIRE([AC_PROG_SED])dnl + AC_REQUIRE([AM_NLS])dnl + + dnl Release version of the gettext macros. This is used to ensure that + dnl the gettext macros and po/Makefile.in.in are in sync. + AC_SUBST([GETTEXT_MACRO_VERSION], [0.19]) + + dnl Perform the following tests also if --disable-nls has been given, + dnl because they are needed for "make dist" to work. + + dnl Search for GNU msgfmt in the PATH. + dnl The first test excludes Solaris msgfmt and early GNU msgfmt versions. + dnl The second test excludes FreeBSD msgfmt. + AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt, + [$ac_dir/$ac_word --statistics /dev/null >&]AS_MESSAGE_LOG_FD[ 2>&1 && + (if $ac_dir/$ac_word --statistics /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi)], + :) + AC_PATH_PROG([GMSGFMT], [gmsgfmt], [$MSGFMT]) + + dnl Test whether it is GNU msgfmt >= 0.15. +changequote(,)dnl + case `$MSGFMT --version | sed 1q | sed -e 's,^[^0-9]*,,'` in + '' | 0.[0-9] | 0.[0-9].* | 0.1[0-4] | 0.1[0-4].*) MSGFMT_015=: ;; + *) MSGFMT_015=$MSGFMT ;; + esac +changequote([,])dnl + AC_SUBST([MSGFMT_015]) +changequote(,)dnl + case `$GMSGFMT --version | sed 1q | sed -e 's,^[^0-9]*,,'` in + '' | 0.[0-9] | 0.[0-9].* | 0.1[0-4] | 0.1[0-4].*) GMSGFMT_015=: ;; + *) GMSGFMT_015=$GMSGFMT ;; + esac +changequote([,])dnl + AC_SUBST([GMSGFMT_015]) + + dnl Search for GNU xgettext 0.12 or newer in the PATH. + dnl The first test excludes Solaris xgettext and early GNU xgettext versions. + dnl The second test excludes FreeBSD xgettext. + AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext, + [$ac_dir/$ac_word --omit-header --copyright-holder= --msgid-bugs-address= /dev/null >&]AS_MESSAGE_LOG_FD[ 2>&1 && + (if $ac_dir/$ac_word --omit-header --copyright-holder= --msgid-bugs-address= /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi)], + :) + dnl Remove leftover from FreeBSD xgettext call. + rm -f messages.po + + dnl Test whether it is GNU xgettext >= 0.15. +changequote(,)dnl + case `$XGETTEXT --version | sed 1q | sed -e 's,^[^0-9]*,,'` in + '' | 0.[0-9] | 0.[0-9].* | 0.1[0-4] | 0.1[0-4].*) XGETTEXT_015=: ;; + *) XGETTEXT_015=$XGETTEXT ;; + esac +changequote([,])dnl + AC_SUBST([XGETTEXT_015]) + + dnl Search for GNU msgmerge 0.11 or newer in the PATH. + AM_PATH_PROG_WITH_TEST(MSGMERGE, msgmerge, + [$ac_dir/$ac_word --update -q /dev/null /dev/null >&]AS_MESSAGE_LOG_FD[ 2>&1], :) + + dnl Installation directories. + dnl Autoconf >= 2.60 defines localedir. For older versions of autoconf, we + dnl have to define it here, so that it can be used in po/Makefile. + test -n "$localedir" || localedir='${datadir}/locale' + AC_SUBST([localedir]) + + dnl Support for AM_XGETTEXT_OPTION. + test -n "${XGETTEXT_EXTRA_OPTIONS+set}" || XGETTEXT_EXTRA_OPTIONS= + AC_SUBST([XGETTEXT_EXTRA_OPTIONS]) + + AC_CONFIG_COMMANDS([po-directories], [[ + for ac_file in $CONFIG_FILES; do + # Support "outfile[:infile[:infile...]]" + case "$ac_file" in + *:*) ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; + esac + # PO directories have a Makefile.in generated from Makefile.in.in. + case "$ac_file" in */Makefile.in) + # Adjust a relative srcdir. + ac_dir=`echo "$ac_file"|sed 's%/[^/][^/]*$%%'` + ac_dir_suffix=/`echo "$ac_dir"|sed 's%^\./%%'` + ac_dots=`echo "$ac_dir_suffix"|sed 's%/[^/]*%../%g'` + # In autoconf-2.13 it is called $ac_given_srcdir. + # In autoconf-2.50 it is called $srcdir. + test -n "$ac_given_srcdir" || ac_given_srcdir="$srcdir" + case "$ac_given_srcdir" in + .) top_srcdir=`echo $ac_dots|sed 's%/$%%'` ;; + /*) top_srcdir="$ac_given_srcdir" ;; + *) top_srcdir="$ac_dots$ac_given_srcdir" ;; + esac + # Treat a directory as a PO directory if and only if it has a + # POTFILES.in file. This allows packages to have multiple PO + # directories under different names or in different locations. + if test -f "$ac_given_srcdir/$ac_dir/POTFILES.in"; then + rm -f "$ac_dir/POTFILES" + test -n "$as_me" && echo "$as_me: creating $ac_dir/POTFILES" || echo "creating $ac_dir/POTFILES" + gt_tab=`printf '\t'` + cat "$ac_given_srcdir/$ac_dir/POTFILES.in" | sed -e "/^#/d" -e "/^[ ${gt_tab}]*\$/d" -e "s,.*, $top_srcdir/& \\\\," | sed -e "\$s/\(.*\) \\\\/\1/" > "$ac_dir/POTFILES" + POMAKEFILEDEPS="POTFILES.in" + # ALL_LINGUAS, POFILES, UPDATEPOFILES, DUMMYPOFILES, GMOFILES depend + # on $ac_dir but don't depend on user-specified configuration + # parameters. + if test -f "$ac_given_srcdir/$ac_dir/LINGUAS"; then + # The LINGUAS file contains the set of available languages. + if test -n "$OBSOLETE_ALL_LINGUAS"; then + test -n "$as_me" && echo "$as_me: setting ALL_LINGUAS in configure.in is obsolete" || echo "setting ALL_LINGUAS in configure.in is obsolete" + fi + ALL_LINGUAS_=`sed -e "/^#/d" -e "s/#.*//" "$ac_given_srcdir/$ac_dir/LINGUAS"` + # Hide the ALL_LINGUAS assignment from automake < 1.5. + eval 'ALL_LINGUAS''=$ALL_LINGUAS_' + POMAKEFILEDEPS="$POMAKEFILEDEPS LINGUAS" + else + # The set of available languages was given in configure.in. + # Hide the ALL_LINGUAS assignment from automake < 1.5. + eval 'ALL_LINGUAS''=$OBSOLETE_ALL_LINGUAS' + fi + # Compute POFILES + # as $(foreach lang, $(ALL_LINGUAS), $(srcdir)/$(lang).po) + # Compute UPDATEPOFILES + # as $(foreach lang, $(ALL_LINGUAS), $(lang).po-update) + # Compute DUMMYPOFILES + # as $(foreach lang, $(ALL_LINGUAS), $(lang).nop) + # Compute GMOFILES + # as $(foreach lang, $(ALL_LINGUAS), $(srcdir)/$(lang).gmo) + case "$ac_given_srcdir" in + .) srcdirpre= ;; + *) srcdirpre='$(srcdir)/' ;; + esac + POFILES= + UPDATEPOFILES= + DUMMYPOFILES= + GMOFILES= + for lang in $ALL_LINGUAS; do + POFILES="$POFILES $srcdirpre$lang.po" + UPDATEPOFILES="$UPDATEPOFILES $lang.po-update" + DUMMYPOFILES="$DUMMYPOFILES $lang.nop" + GMOFILES="$GMOFILES $srcdirpre$lang.gmo" + done + # CATALOGS depends on both $ac_dir and the user's LINGUAS + # environment variable. + INST_LINGUAS= + if test -n "$ALL_LINGUAS"; then + for presentlang in $ALL_LINGUAS; do + useit=no + if test "%UNSET%" != "$LINGUAS"; then + desiredlanguages="$LINGUAS" + else + desiredlanguages="$ALL_LINGUAS" + fi + for desiredlang in $desiredlanguages; do + # Use the presentlang catalog if desiredlang is + # a. equal to presentlang, or + # b. a variant of presentlang (because in this case, + # presentlang can be used as a fallback for messages + # which are not translated in the desiredlang catalog). + case "$desiredlang" in + "$presentlang"*) useit=yes;; + esac + done + if test $useit = yes; then + INST_LINGUAS="$INST_LINGUAS $presentlang" + fi + done + fi + CATALOGS= + if test -n "$INST_LINGUAS"; then + for lang in $INST_LINGUAS; do + CATALOGS="$CATALOGS $lang.gmo" + done + fi + test -n "$as_me" && echo "$as_me: creating $ac_dir/Makefile" || echo "creating $ac_dir/Makefile" + sed -e "/^POTFILES =/r $ac_dir/POTFILES" -e "/^# Makevars/r $ac_given_srcdir/$ac_dir/Makevars" -e "s|@POFILES@|$POFILES|g" -e "s|@UPDATEPOFILES@|$UPDATEPOFILES|g" -e "s|@DUMMYPOFILES@|$DUMMYPOFILES|g" -e "s|@GMOFILES@|$GMOFILES|g" -e "s|@CATALOGS@|$CATALOGS|g" -e "s|@POMAKEFILEDEPS@|$POMAKEFILEDEPS|g" "$ac_dir/Makefile.in" > "$ac_dir/Makefile" + for f in "$ac_given_srcdir/$ac_dir"/Rules-*; do + if test -f "$f"; then + case "$f" in + *.orig | *.bak | *~) ;; + *) cat "$f" >> "$ac_dir/Makefile" ;; + esac + fi + done + fi + ;; + esac + done]], + [# Capture the value of obsolete ALL_LINGUAS because we need it to compute + # POFILES, UPDATEPOFILES, DUMMYPOFILES, GMOFILES, CATALOGS. But hide it + # from automake < 1.5. + eval 'OBSOLETE_ALL_LINGUAS''="$ALL_LINGUAS"' + # Capture the value of LINGUAS because we need it to compute CATALOGS. + LINGUAS="${LINGUAS-%UNSET%}" + ]) +]) + +dnl Postprocesses a Makefile in a directory containing PO files. +AC_DEFUN([AM_POSTPROCESS_PO_MAKEFILE], +[ + # When this code is run, in config.status, two variables have already been + # set: + # - OBSOLETE_ALL_LINGUAS is the value of LINGUAS set in configure.in, + # - LINGUAS is the value of the environment variable LINGUAS at configure + # time. + +changequote(,)dnl + # Adjust a relative srcdir. + ac_dir=`echo "$ac_file"|sed 's%/[^/][^/]*$%%'` + ac_dir_suffix=/`echo "$ac_dir"|sed 's%^\./%%'` + ac_dots=`echo "$ac_dir_suffix"|sed 's%/[^/]*%../%g'` + # In autoconf-2.13 it is called $ac_given_srcdir. + # In autoconf-2.50 it is called $srcdir. + test -n "$ac_given_srcdir" || ac_given_srcdir="$srcdir" + case "$ac_given_srcdir" in + .) top_srcdir=`echo $ac_dots|sed 's%/$%%'` ;; + /*) top_srcdir="$ac_given_srcdir" ;; + *) top_srcdir="$ac_dots$ac_given_srcdir" ;; + esac + + # Find a way to echo strings without interpreting backslash. + if test "X`(echo '\t') 2>/dev/null`" = 'X\t'; then + gt_echo='echo' + else + if test "X`(printf '%s\n' '\t') 2>/dev/null`" = 'X\t'; then + gt_echo='printf %s\n' + else + echo_func () { + cat < "$ac_file.tmp" + tab=`printf '\t'` + if grep -l '@TCLCATALOGS@' "$ac_file" > /dev/null; then + # Add dependencies that cannot be formulated as a simple suffix rule. + for lang in $ALL_LINGUAS; do + frobbedlang=`echo $lang | sed -e 's/\..*$//' -e 'y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/'` + cat >> "$ac_file.tmp" < /dev/null; then + # Add dependencies that cannot be formulated as a simple suffix rule. + for lang in $ALL_LINGUAS; do + frobbedlang=`echo $lang | sed -e 's/_/-/g' -e 's/^sr-CS/sr-SP/' -e 's/@latin$/-Latn/' -e 's/@cyrillic$/-Cyrl/' -e 's/^sr-SP$/sr-SP-Latn/' -e 's/^uz-UZ$/uz-UZ-Latn/'` + cat >> "$ac_file.tmp" <> "$ac_file.tmp" <, 1996. + +AC_PREREQ([2.50]) + +# Search path for a program which passes the given test. + +dnl AM_PATH_PROG_WITH_TEST(VARIABLE, PROG-TO-CHECK-FOR, +dnl TEST-PERFORMED-ON-FOUND_PROGRAM [, VALUE-IF-NOT-FOUND [, PATH]]) +AC_DEFUN([AM_PATH_PROG_WITH_TEST], +[ +# Prepare PATH_SEPARATOR. +# The user is always right. +if test "${PATH_SEPARATOR+set}" != set; then + # Determine PATH_SEPARATOR by trying to find /bin/sh in a PATH which + # contains only /bin. Note that ksh looks also at the FPATH variable, + # so we have to set that as well for the test. + PATH_SEPARATOR=: + (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 \ + && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 \ + || PATH_SEPARATOR=';' + } +fi + +# Find out how to test for executable files. Don't use a zero-byte file, +# as systems may use methods other than mode bits to determine executability. +cat >conf$$.file <<_ASEOF +#! /bin/sh +exit 0 +_ASEOF +chmod +x conf$$.file +if test -x conf$$.file >/dev/null 2>&1; then + ac_executable_p="test -x" +else + ac_executable_p="test -f" +fi +rm -f conf$$.file + +# Extract the first word of "$2", so it can be a program name with args. +set dummy $2; ac_word=[$]2 +AC_MSG_CHECKING([for $ac_word]) +AC_CACHE_VAL([ac_cv_path_$1], +[case "[$]$1" in + [[\\/]]* | ?:[[\\/]]*) + ac_cv_path_$1="[$]$1" # Let the user override the test with a path. + ;; + *) + ac_save_IFS="$IFS"; IFS=$PATH_SEPARATOR + for ac_dir in ifelse([$5], , $PATH, [$5]); do + IFS="$ac_save_IFS" + test -z "$ac_dir" && ac_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $ac_executable_p "$ac_dir/$ac_word$ac_exec_ext"; then + echo "$as_me: trying $ac_dir/$ac_word..." >&AS_MESSAGE_LOG_FD + if [$3]; then + ac_cv_path_$1="$ac_dir/$ac_word$ac_exec_ext" + break 2 + fi + fi + done + done + IFS="$ac_save_IFS" +dnl If no 4th arg is given, leave the cache variable unset, +dnl so AC_PATH_PROGS will keep looking. +ifelse([$4], , , [ test -z "[$]ac_cv_path_$1" && ac_cv_path_$1="$4" +])dnl + ;; +esac])dnl +$1="$ac_cv_path_$1" +if test ifelse([$4], , [-n "[$]$1"], ["[$]$1" != "$4"]); then + AC_MSG_RESULT([$][$1]) +else + AC_MSG_RESULT([no]) +fi +AC_SUBST([$1])dnl +]) diff --git a/missing b/missing new file mode 100755 index 0000000..625aeb1 --- /dev/null +++ b/missing @@ -0,0 +1,215 @@ +#! /bin/sh +# Common wrapper for a few potentially missing GNU programs. + +scriptversion=2018-03-07.03; # UTC + +# Copyright (C) 1996-2018 Free Software Foundation, Inc. +# Originally written by Fran,cois Pinard , 1996. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +if test $# -eq 0; then + echo 1>&2 "Try '$0 --help' for more information" + exit 1 +fi + +case $1 in + + --is-lightweight) + # Used by our autoconf macros to check whether the available missing + # script is modern enough. + exit 0 + ;; + + --run) + # Back-compat with the calling convention used by older automake. + shift + ;; + + -h|--h|--he|--hel|--help) + echo "\ +$0 [OPTION]... PROGRAM [ARGUMENT]... + +Run 'PROGRAM [ARGUMENT]...', returning a proper advice when this fails due +to PROGRAM being missing or too old. + +Options: + -h, --help display this help and exit + -v, --version output version information and exit + +Supported PROGRAM values: + aclocal autoconf autoheader autom4te automake makeinfo + bison yacc flex lex help2man + +Version suffixes to PROGRAM as well as the prefixes 'gnu-', 'gnu', and +'g' are ignored when checking the name. + +Send bug reports to ." + exit $? + ;; + + -v|--v|--ve|--ver|--vers|--versi|--versio|--version) + echo "missing $scriptversion (GNU Automake)" + exit $? + ;; + + -*) + echo 1>&2 "$0: unknown '$1' option" + echo 1>&2 "Try '$0 --help' for more information" + exit 1 + ;; + +esac + +# Run the given program, remember its exit status. +"$@"; st=$? + +# If it succeeded, we are done. +test $st -eq 0 && exit 0 + +# Also exit now if we it failed (or wasn't found), and '--version' was +# passed; such an option is passed most likely to detect whether the +# program is present and works. +case $2 in --version|--help) exit $st;; esac + +# Exit code 63 means version mismatch. This often happens when the user +# tries to use an ancient version of a tool on a file that requires a +# minimum version. +if test $st -eq 63; then + msg="probably too old" +elif test $st -eq 127; then + # Program was missing. + msg="missing on your system" +else + # Program was found and executed, but failed. Give up. + exit $st +fi + +perl_URL=https://www.perl.org/ +flex_URL=https://github.com/westes/flex +gnu_software_URL=https://www.gnu.org/software + +program_details () +{ + case $1 in + aclocal|automake) + echo "The '$1' program is part of the GNU Automake package:" + echo "<$gnu_software_URL/automake>" + echo "It also requires GNU Autoconf, GNU m4 and Perl in order to run:" + echo "<$gnu_software_URL/autoconf>" + echo "<$gnu_software_URL/m4/>" + echo "<$perl_URL>" + ;; + autoconf|autom4te|autoheader) + echo "The '$1' program is part of the GNU Autoconf package:" + echo "<$gnu_software_URL/autoconf/>" + echo "It also requires GNU m4 and Perl in order to run:" + echo "<$gnu_software_URL/m4/>" + echo "<$perl_URL>" + ;; + esac +} + +give_advice () +{ + # Normalize program name to check for. + normalized_program=`echo "$1" | sed ' + s/^gnu-//; t + s/^gnu//; t + s/^g//; t'` + + printf '%s\n' "'$1' is $msg." + + configure_deps="'configure.ac' or m4 files included by 'configure.ac'" + case $normalized_program in + autoconf*) + echo "You should only need it if you modified 'configure.ac'," + echo "or m4 files included by it." + program_details 'autoconf' + ;; + autoheader*) + echo "You should only need it if you modified 'acconfig.h' or" + echo "$configure_deps." + program_details 'autoheader' + ;; + automake*) + echo "You should only need it if you modified 'Makefile.am' or" + echo "$configure_deps." + program_details 'automake' + ;; + aclocal*) + echo "You should only need it if you modified 'acinclude.m4' or" + echo "$configure_deps." + program_details 'aclocal' + ;; + autom4te*) + echo "You might have modified some maintainer files that require" + echo "the 'autom4te' program to be rebuilt." + program_details 'autom4te' + ;; + bison*|yacc*) + echo "You should only need it if you modified a '.y' file." + echo "You may want to install the GNU Bison package:" + echo "<$gnu_software_URL/bison/>" + ;; + lex*|flex*) + echo "You should only need it if you modified a '.l' file." + echo "You may want to install the Fast Lexical Analyzer package:" + echo "<$flex_URL>" + ;; + help2man*) + echo "You should only need it if you modified a dependency" \ + "of a man page." + echo "You may want to install the GNU Help2man package:" + echo "<$gnu_software_URL/help2man/>" + ;; + makeinfo*) + echo "You should only need it if you modified a '.texi' file, or" + echo "any other file indirectly affecting the aspect of the manual." + echo "You might want to install the Texinfo package:" + echo "<$gnu_software_URL/texinfo/>" + echo "The spurious makeinfo call might also be the consequence of" + echo "using a buggy 'make' (AIX, DU, IRIX), in which case you might" + echo "want to install GNU make:" + echo "<$gnu_software_URL/make/>" + ;; + *) + echo "You might have modified some files without having the proper" + echo "tools for further handling them. Check the 'README' file, it" + echo "often tells you about the needed prerequisites for installing" + echo "this package. You may also peek at any GNU archive site, in" + echo "case some other package contains this missing '$1' program." + ;; + esac +} + +give_advice "$1" | sed -e '1s/^/WARNING: /' \ + -e '2,$s/^/ /' >&2 + +# Propagate the correct exit status (expected to be 127 for a program +# not found, 63 for a program that failed due to version mismatch). +exit $st + +# Local variables: +# eval: (add-hook 'before-save-hook 'time-stamp) +# time-stamp-start: "scriptversion=" +# time-stamp-format: "%:y-%02m-%02d.%02H" +# time-stamp-time-zone: "UTC0" +# time-stamp-end: "; # UTC" +# End: diff --git a/po/LINGUAS b/po/LINGUAS new file mode 100644 index 0000000..2027386 --- /dev/null +++ b/po/LINGUAS @@ -0,0 +1 @@ +de fr ja diff --git a/po/Makefile.in.in b/po/Makefile.in.in new file mode 100644 index 0000000..38c293d --- /dev/null +++ b/po/Makefile.in.in @@ -0,0 +1,483 @@ +# Makefile for PO directory in any package using GNU gettext. +# Copyright (C) 1995-1997, 2000-2007, 2009-2010 by Ulrich Drepper +# +# Copying and distribution of this file, with or without modification, +# are permitted in any medium without royalty provided the copyright +# notice and this notice are preserved. This file is offered as-is, +# without any warranty. +# +# Origin: gettext-0.19.8 +GETTEXT_MACRO_VERSION = 0.19 + +PACKAGE = @PACKAGE@ +VERSION = @VERSION@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ + +SED = @SED@ +SHELL = /bin/sh +@SET_MAKE@ + +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ + +prefix = @prefix@ +exec_prefix = @exec_prefix@ +datarootdir = @datarootdir@ +datadir = @datadir@ +localedir = @localedir@ +gettextsrcdir = $(datadir)/gettext/po + +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ + +# We use $(mkdir_p). +# In automake <= 1.9.x, $(mkdir_p) is defined either as "mkdir -p --" or as +# "$(mkinstalldirs)" or as "$(install_sh) -d". For these automake versions, +# @install_sh@ does not start with $(SHELL), so we add it. +# In automake >= 1.10, @mkdir_p@ is derived from ${MKDIR_P}, which is defined +# either as "/path/to/mkdir -p" or ".../install-sh -c -d". For these automake +# versions, $(mkinstalldirs) and $(install_sh) are unused. +mkinstalldirs = $(SHELL) @install_sh@ -d +install_sh = $(SHELL) @install_sh@ +MKDIR_P = @MKDIR_P@ +mkdir_p = @mkdir_p@ + +# When building gettext-tools, we prefer to use the built programs +# rather than installed programs. However, we can't do that when we +# are cross compiling. +CROSS_COMPILING = @CROSS_COMPILING@ + +GMSGFMT_ = @GMSGFMT@ +GMSGFMT_no = @GMSGFMT@ +GMSGFMT_yes = @GMSGFMT_015@ +GMSGFMT = $(GMSGFMT_$(USE_MSGCTXT)) +MSGFMT_ = @MSGFMT@ +MSGFMT_no = @MSGFMT@ +MSGFMT_yes = @MSGFMT_015@ +MSGFMT = $(MSGFMT_$(USE_MSGCTXT)) +XGETTEXT_ = @XGETTEXT@ +XGETTEXT_no = @XGETTEXT@ +XGETTEXT_yes = @XGETTEXT_015@ +XGETTEXT = $(XGETTEXT_$(USE_MSGCTXT)) +MSGMERGE = msgmerge +MSGMERGE_UPDATE = @MSGMERGE@ --update +MSGINIT = msginit +MSGCONV = msgconv +MSGFILTER = msgfilter + +POFILES = @POFILES@ +GMOFILES = @GMOFILES@ +UPDATEPOFILES = @UPDATEPOFILES@ +DUMMYPOFILES = @DUMMYPOFILES@ +DISTFILES.common = Makefile.in.in remove-potcdate.sin \ +$(DISTFILES.common.extra1) $(DISTFILES.common.extra2) $(DISTFILES.common.extra3) +DISTFILES = $(DISTFILES.common) Makevars POTFILES.in \ +$(POFILES) $(GMOFILES) \ +$(DISTFILES.extra1) $(DISTFILES.extra2) $(DISTFILES.extra3) + +POTFILES = \ + +CATALOGS = @CATALOGS@ + +POFILESDEPS_ = $(srcdir)/$(DOMAIN).pot +POFILESDEPS_yes = $(POFILESDEPS_) +POFILESDEPS_no = +POFILESDEPS = $(POFILESDEPS_$(PO_DEPENDS_ON_POT)) + +DISTFILESDEPS_ = update-po +DISTFILESDEPS_yes = $(DISTFILESDEPS_) +DISTFILESDEPS_no = +DISTFILESDEPS = $(DISTFILESDEPS_$(DIST_DEPENDS_ON_UPDATE_PO)) + +# Makevars gets inserted here. (Don't remove this line!) + +.SUFFIXES: +.SUFFIXES: .po .gmo .mo .sed .sin .nop .po-create .po-update + +.po.mo: + @echo "$(MSGFMT) -c -o $@ $<"; \ + $(MSGFMT) -c -o t-$@ $< && mv t-$@ $@ + +.po.gmo: + @lang=`echo $* | sed -e 's,.*/,,'`; \ + test "$(srcdir)" = . && cdcmd="" || cdcmd="cd $(srcdir) && "; \ + echo "$${cdcmd}rm -f $${lang}.gmo && $(GMSGFMT) -c --statistics --verbose -o $${lang}.gmo $${lang}.po"; \ + cd $(srcdir) && rm -f $${lang}.gmo && $(GMSGFMT) -c --statistics --verbose -o t-$${lang}.gmo $${lang}.po && mv t-$${lang}.gmo $${lang}.gmo + +.sin.sed: + sed -e '/^#/d' $< > t-$@ + mv t-$@ $@ + + +all: all-@USE_NLS@ + +all-yes: stamp-po +all-no: + +# Ensure that the gettext macros and this Makefile.in.in are in sync. +CHECK_MACRO_VERSION = \ + test "$(GETTEXT_MACRO_VERSION)" = "@GETTEXT_MACRO_VERSION@" \ + || { echo "*** error: gettext infrastructure mismatch: using a Makefile.in.in from gettext version $(GETTEXT_MACRO_VERSION) but the autoconf macros are from gettext version @GETTEXT_MACRO_VERSION@" 1>&2; \ + exit 1; \ + } + +# $(srcdir)/$(DOMAIN).pot is only created when needed. When xgettext finds no +# internationalized messages, no $(srcdir)/$(DOMAIN).pot is created (because +# we don't want to bother translators with empty POT files). We assume that +# LINGUAS is empty in this case, i.e. $(POFILES) and $(GMOFILES) are empty. +# In this case, stamp-po is a nop (i.e. a phony target). + +# stamp-po is a timestamp denoting the last time at which the CATALOGS have +# been loosely updated. Its purpose is that when a developer or translator +# checks out the package via CVS, and the $(DOMAIN).pot file is not in CVS, +# "make" will update the $(DOMAIN).pot and the $(CATALOGS), but subsequent +# invocations of "make" will do nothing. This timestamp would not be necessary +# if updating the $(CATALOGS) would always touch them; however, the rule for +# $(POFILES) has been designed to not touch files that don't need to be +# changed. +stamp-po: $(srcdir)/$(DOMAIN).pot + @$(CHECK_MACRO_VERSION) + test ! -f $(srcdir)/$(DOMAIN).pot || \ + test -z "$(GMOFILES)" || $(MAKE) $(GMOFILES) + @test ! -f $(srcdir)/$(DOMAIN).pot || { \ + echo "touch stamp-po" && \ + echo timestamp > stamp-poT && \ + mv stamp-poT stamp-po; \ + } + +# Note: Target 'all' must not depend on target '$(DOMAIN).pot-update', +# otherwise packages like GCC can not be built if only parts of the source +# have been downloaded. + +# This target rebuilds $(DOMAIN).pot; it is an expensive operation. +# Note that $(DOMAIN).pot is not touched if it doesn't need to be changed. +# The determination of whether the package xyz is a GNU one is based on the +# heuristic whether some file in the top level directory mentions "GNU xyz". +# If GNU 'find' is available, we avoid grepping through monster files. +$(DOMAIN).pot-update: $(POTFILES) $(srcdir)/POTFILES.in remove-potcdate.sed + package_gnu="$(PACKAGE_GNU)"; \ + test -n "$$package_gnu" || { \ + if { if (LC_ALL=C find --version) 2>/dev/null | grep GNU >/dev/null; then \ + LC_ALL=C find -L $(top_srcdir) -maxdepth 1 -type f \ + -size -10000000c -exec grep 'GNU @PACKAGE@' \ + /dev/null '{}' ';' 2>/dev/null; \ + else \ + LC_ALL=C grep 'GNU @PACKAGE@' $(top_srcdir)/* 2>/dev/null; \ + fi; \ + } | grep -v 'libtool:' >/dev/null; then \ + package_gnu=yes; \ + else \ + package_gnu=no; \ + fi; \ + }; \ + if test "$$package_gnu" = "yes"; then \ + package_prefix='GNU '; \ + else \ + package_prefix=''; \ + fi; \ + if test -n '$(MSGID_BUGS_ADDRESS)' || test '$(PACKAGE_BUGREPORT)' = '@'PACKAGE_BUGREPORT'@'; then \ + msgid_bugs_address='$(MSGID_BUGS_ADDRESS)'; \ + else \ + msgid_bugs_address='$(PACKAGE_BUGREPORT)'; \ + fi; \ + case `$(XGETTEXT) --version | sed 1q | sed -e 's,^[^0-9]*,,'` in \ + '' | 0.[0-9] | 0.[0-9].* | 0.1[0-5] | 0.1[0-5].* | 0.16 | 0.16.[0-1]*) \ + $(XGETTEXT) --default-domain=$(DOMAIN) --directory=$(top_srcdir) \ + --add-comments=TRANSLATORS: $(XGETTEXT_OPTIONS) @XGETTEXT_EXTRA_OPTIONS@ \ + --files-from=$(srcdir)/POTFILES.in \ + --copyright-holder='$(COPYRIGHT_HOLDER)' \ + --msgid-bugs-address="$$msgid_bugs_address" \ + ;; \ + *) \ + $(XGETTEXT) --default-domain=$(DOMAIN) --directory=$(top_srcdir) \ + --add-comments=TRANSLATORS: $(XGETTEXT_OPTIONS) @XGETTEXT_EXTRA_OPTIONS@ \ + --files-from=$(srcdir)/POTFILES.in \ + --copyright-holder='$(COPYRIGHT_HOLDER)' \ + --package-name="$${package_prefix}@PACKAGE@" \ + --package-version='@VERSION@' \ + --msgid-bugs-address="$$msgid_bugs_address" \ + ;; \ + esac + test ! -f $(DOMAIN).po || { \ + if test -f $(srcdir)/$(DOMAIN).pot-header; then \ + sed -e '1,/^#$$/d' < $(DOMAIN).po > $(DOMAIN).1po && \ + cat $(srcdir)/$(DOMAIN).pot-header $(DOMAIN).1po > $(DOMAIN).po; \ + rm -f $(DOMAIN).1po; \ + fi; \ + if test -f $(srcdir)/$(DOMAIN).pot; then \ + sed -f remove-potcdate.sed < $(srcdir)/$(DOMAIN).pot > $(DOMAIN).1po && \ + sed -f remove-potcdate.sed < $(DOMAIN).po > $(DOMAIN).2po && \ + if cmp $(DOMAIN).1po $(DOMAIN).2po >/dev/null 2>&1; then \ + rm -f $(DOMAIN).1po $(DOMAIN).2po $(DOMAIN).po; \ + else \ + rm -f $(DOMAIN).1po $(DOMAIN).2po $(srcdir)/$(DOMAIN).pot && \ + mv $(DOMAIN).po $(srcdir)/$(DOMAIN).pot; \ + fi; \ + else \ + mv $(DOMAIN).po $(srcdir)/$(DOMAIN).pot; \ + fi; \ + } + +# This rule has no dependencies: we don't need to update $(DOMAIN).pot at +# every "make" invocation, only create it when it is missing. +# Only "make $(DOMAIN).pot-update" or "make dist" will force an update. +$(srcdir)/$(DOMAIN).pot: + $(MAKE) $(DOMAIN).pot-update + +# This target rebuilds a PO file if $(DOMAIN).pot has changed. +# Note that a PO file is not touched if it doesn't need to be changed. +$(POFILES): $(POFILESDEPS) + @lang=`echo $@ | sed -e 's,.*/,,' -e 's/\.po$$//'`; \ + if test -f "$(srcdir)/$${lang}.po"; then \ + test -f $(srcdir)/$(DOMAIN).pot || $(MAKE) $(srcdir)/$(DOMAIN).pot; \ + test "$(srcdir)" = . && cdcmd="" || cdcmd="cd $(srcdir) && "; \ + echo "$${cdcmd}$(MSGMERGE_UPDATE) $(MSGMERGE_OPTIONS) --lang=$${lang} $${lang}.po $(DOMAIN).pot"; \ + cd $(srcdir) \ + && { case `$(MSGMERGE) --version | sed 1q | sed -e 's,^[^0-9]*,,'` in \ + '' | 0.[0-9] | 0.[0-9].* | 0.1[0-7] | 0.1[0-7].*) \ + $(MSGMERGE_UPDATE) $(MSGMERGE_OPTIONS) $${lang}.po $(DOMAIN).pot;; \ + *) \ + $(MSGMERGE_UPDATE) $(MSGMERGE_OPTIONS) --lang=$${lang} $${lang}.po $(DOMAIN).pot;; \ + esac; \ + }; \ + else \ + $(MAKE) $${lang}.po-create; \ + fi + + +install: install-exec install-data +install-exec: +install-data: install-data-@USE_NLS@ + if test "$(PACKAGE)" = "gettext-tools"; then \ + $(mkdir_p) $(DESTDIR)$(gettextsrcdir); \ + for file in $(DISTFILES.common) Makevars.template; do \ + $(INSTALL_DATA) $(srcdir)/$$file \ + $(DESTDIR)$(gettextsrcdir)/$$file; \ + done; \ + for file in Makevars; do \ + rm -f $(DESTDIR)$(gettextsrcdir)/$$file; \ + done; \ + else \ + : ; \ + fi +install-data-no: all +install-data-yes: all + @catalogs='$(CATALOGS)'; \ + for cat in $$catalogs; do \ + cat=`basename $$cat`; \ + lang=`echo $$cat | sed -e 's/\.gmo$$//'`; \ + dir=$(localedir)/$$lang/LC_MESSAGES; \ + $(mkdir_p) $(DESTDIR)$$dir; \ + if test -r $$cat; then realcat=$$cat; else realcat=$(srcdir)/$$cat; fi; \ + $(INSTALL_DATA) $$realcat $(DESTDIR)$$dir/$(DOMAIN).mo; \ + echo "installing $$realcat as $(DESTDIR)$$dir/$(DOMAIN).mo"; \ + for lc in '' $(EXTRA_LOCALE_CATEGORIES); do \ + if test -n "$$lc"; then \ + if (cd $(DESTDIR)$(localedir)/$$lang && LC_ALL=C ls -l -d $$lc 2>/dev/null) | grep ' -> ' >/dev/null; then \ + link=`cd $(DESTDIR)$(localedir)/$$lang && LC_ALL=C ls -l -d $$lc | sed -e 's/^.* -> //'`; \ + mv $(DESTDIR)$(localedir)/$$lang/$$lc $(DESTDIR)$(localedir)/$$lang/$$lc.old; \ + mkdir $(DESTDIR)$(localedir)/$$lang/$$lc; \ + (cd $(DESTDIR)$(localedir)/$$lang/$$lc.old && \ + for file in *; do \ + if test -f $$file; then \ + ln -s ../$$link/$$file $(DESTDIR)$(localedir)/$$lang/$$lc/$$file; \ + fi; \ + done); \ + rm -f $(DESTDIR)$(localedir)/$$lang/$$lc.old; \ + else \ + if test -d $(DESTDIR)$(localedir)/$$lang/$$lc; then \ + :; \ + else \ + rm -f $(DESTDIR)$(localedir)/$$lang/$$lc; \ + mkdir $(DESTDIR)$(localedir)/$$lang/$$lc; \ + fi; \ + fi; \ + rm -f $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo; \ + ln -s ../LC_MESSAGES/$(DOMAIN).mo $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo 2>/dev/null || \ + ln $(DESTDIR)$(localedir)/$$lang/LC_MESSAGES/$(DOMAIN).mo $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo 2>/dev/null || \ + cp -p $(DESTDIR)$(localedir)/$$lang/LC_MESSAGES/$(DOMAIN).mo $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo; \ + echo "installing $$realcat link as $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo"; \ + fi; \ + done; \ + done + +install-strip: install + +installdirs: installdirs-exec installdirs-data +installdirs-exec: +installdirs-data: installdirs-data-@USE_NLS@ + if test "$(PACKAGE)" = "gettext-tools"; then \ + $(mkdir_p) $(DESTDIR)$(gettextsrcdir); \ + else \ + : ; \ + fi +installdirs-data-no: +installdirs-data-yes: + @catalogs='$(CATALOGS)'; \ + for cat in $$catalogs; do \ + cat=`basename $$cat`; \ + lang=`echo $$cat | sed -e 's/\.gmo$$//'`; \ + dir=$(localedir)/$$lang/LC_MESSAGES; \ + $(mkdir_p) $(DESTDIR)$$dir; \ + for lc in '' $(EXTRA_LOCALE_CATEGORIES); do \ + if test -n "$$lc"; then \ + if (cd $(DESTDIR)$(localedir)/$$lang && LC_ALL=C ls -l -d $$lc 2>/dev/null) | grep ' -> ' >/dev/null; then \ + link=`cd $(DESTDIR)$(localedir)/$$lang && LC_ALL=C ls -l -d $$lc | sed -e 's/^.* -> //'`; \ + mv $(DESTDIR)$(localedir)/$$lang/$$lc $(DESTDIR)$(localedir)/$$lang/$$lc.old; \ + mkdir $(DESTDIR)$(localedir)/$$lang/$$lc; \ + (cd $(DESTDIR)$(localedir)/$$lang/$$lc.old && \ + for file in *; do \ + if test -f $$file; then \ + ln -s ../$$link/$$file $(DESTDIR)$(localedir)/$$lang/$$lc/$$file; \ + fi; \ + done); \ + rm -f $(DESTDIR)$(localedir)/$$lang/$$lc.old; \ + else \ + if test -d $(DESTDIR)$(localedir)/$$lang/$$lc; then \ + :; \ + else \ + rm -f $(DESTDIR)$(localedir)/$$lang/$$lc; \ + mkdir $(DESTDIR)$(localedir)/$$lang/$$lc; \ + fi; \ + fi; \ + fi; \ + done; \ + done + +# Define this as empty until I found a useful application. +installcheck: + +uninstall: uninstall-exec uninstall-data +uninstall-exec: +uninstall-data: uninstall-data-@USE_NLS@ + if test "$(PACKAGE)" = "gettext-tools"; then \ + for file in $(DISTFILES.common) Makevars.template; do \ + rm -f $(DESTDIR)$(gettextsrcdir)/$$file; \ + done; \ + else \ + : ; \ + fi +uninstall-data-no: +uninstall-data-yes: + catalogs='$(CATALOGS)'; \ + for cat in $$catalogs; do \ + cat=`basename $$cat`; \ + lang=`echo $$cat | sed -e 's/\.gmo$$//'`; \ + for lc in LC_MESSAGES $(EXTRA_LOCALE_CATEGORIES); do \ + rm -f $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo; \ + done; \ + done + +check: all + +info dvi ps pdf html tags TAGS ctags CTAGS ID: + +mostlyclean: + rm -f remove-potcdate.sed + rm -f stamp-poT + rm -f core core.* $(DOMAIN).po $(DOMAIN).1po $(DOMAIN).2po *.new.po + rm -fr *.o + +clean: mostlyclean + +distclean: clean + rm -f Makefile Makefile.in POTFILES *.mo + +maintainer-clean: distclean + @echo "This command is intended for maintainers to use;" + @echo "it deletes files that may require special tools to rebuild." + rm -f stamp-po $(GMOFILES) + +distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir) +dist distdir: + test -z "$(DISTFILESDEPS)" || $(MAKE) $(DISTFILESDEPS) + @$(MAKE) dist2 +# This is a separate target because 'update-po' must be executed before. +dist2: stamp-po $(DISTFILES) + dists="$(DISTFILES)"; \ + if test "$(PACKAGE)" = "gettext-tools"; then \ + dists="$$dists Makevars.template"; \ + fi; \ + if test -f $(srcdir)/$(DOMAIN).pot; then \ + dists="$$dists $(DOMAIN).pot stamp-po"; \ + fi; \ + if test -f $(srcdir)/ChangeLog; then \ + dists="$$dists ChangeLog"; \ + fi; \ + for i in 0 1 2 3 4 5 6 7 8 9; do \ + if test -f $(srcdir)/ChangeLog.$$i; then \ + dists="$$dists ChangeLog.$$i"; \ + fi; \ + done; \ + if test -f $(srcdir)/LINGUAS; then dists="$$dists LINGUAS"; fi; \ + for file in $$dists; do \ + if test -f $$file; then \ + cp -p $$file $(distdir) || exit 1; \ + else \ + cp -p $(srcdir)/$$file $(distdir) || exit 1; \ + fi; \ + done + +update-po: Makefile + $(MAKE) $(DOMAIN).pot-update + test -z "$(UPDATEPOFILES)" || $(MAKE) $(UPDATEPOFILES) + $(MAKE) update-gmo + +# General rule for creating PO files. + +.nop.po-create: + @lang=`echo $@ | sed -e 's/\.po-create$$//'`; \ + echo "File $$lang.po does not exist. If you are a translator, you can create it through 'msginit'." 1>&2; \ + exit 1 + +# General rule for updating PO files. + +.nop.po-update: + @lang=`echo $@ | sed -e 's/\.po-update$$//'`; \ + if test "$(PACKAGE)" = "gettext-tools" && test "$(CROSS_COMPILING)" != "yes"; then PATH=`pwd`/../src:$$PATH; fi; \ + tmpdir=`pwd`; \ + echo "$$lang:"; \ + test "$(srcdir)" = . && cdcmd="" || cdcmd="cd $(srcdir) && "; \ + echo "$${cdcmd}$(MSGMERGE) $(MSGMERGE_OPTIONS) --lang=$$lang $$lang.po $(DOMAIN).pot -o $$lang.new.po"; \ + cd $(srcdir); \ + if { case `$(MSGMERGE) --version | sed 1q | sed -e 's,^[^0-9]*,,'` in \ + '' | 0.[0-9] | 0.[0-9].* | 0.1[0-7] | 0.1[0-7].*) \ + $(MSGMERGE) $(MSGMERGE_OPTIONS) -o $$tmpdir/$$lang.new.po $$lang.po $(DOMAIN).pot;; \ + *) \ + $(MSGMERGE) $(MSGMERGE_OPTIONS) --lang=$$lang -o $$tmpdir/$$lang.new.po $$lang.po $(DOMAIN).pot;; \ + esac; \ + }; then \ + if cmp $$lang.po $$tmpdir/$$lang.new.po >/dev/null 2>&1; then \ + rm -f $$tmpdir/$$lang.new.po; \ + else \ + if mv -f $$tmpdir/$$lang.new.po $$lang.po; then \ + :; \ + else \ + echo "msgmerge for $$lang.po failed: cannot move $$tmpdir/$$lang.new.po to $$lang.po" 1>&2; \ + exit 1; \ + fi; \ + fi; \ + else \ + echo "msgmerge for $$lang.po failed!" 1>&2; \ + rm -f $$tmpdir/$$lang.new.po; \ + fi + +$(DUMMYPOFILES): + +update-gmo: Makefile $(GMOFILES) + @: + +# Recreate Makefile by invoking config.status. Explicitly invoke the shell, +# because execution permission bits may not work on the current file system. +# Use @SHELL@, which is the shell determined by autoconf for the use by its +# scripts, not $(SHELL) which is hardwired to /bin/sh and may be deficient. +Makefile: Makefile.in.in Makevars $(top_builddir)/config.status @POMAKEFILEDEPS@ + cd $(top_builddir) \ + && @SHELL@ ./config.status $(subdir)/$@.in po-directories + +force: + +# Tell versions [3.59,3.63) of GNU make not to export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/po/Makevars b/po/Makevars new file mode 100644 index 0000000..672fef2 --- /dev/null +++ b/po/Makevars @@ -0,0 +1,78 @@ +# Makefile variables for PO directory in any package using GNU gettext. + +# Usually the message domain is the same as the package name. +DOMAIN = $(PACKAGE) + +# These two variables depend on the location of this directory. +subdir = po +top_builddir = .. + +# These options get passed to xgettext. +XGETTEXT_OPTIONS = --keyword=_ --keyword=N_ + +# This tells whether or not to prepend "GNU " prefix to the package +# name that gets inserted into the header of the $(DOMAIN).pot file. +# Possible values are "yes", "no", or empty. If it is empty, try to +# detect it automatically by scanning the files in $(top_srcdir) for +# "GNU packagename" string. +PACKAGE_GNU = + +# This is the copyright holder that gets inserted into the header of the +# $(DOMAIN).pot file. Set this to the copyright holder of the surrounding +# package. (Note that the msgstr strings, extracted from the package's +# sources, belong to the copyright holder of the package.) Translators are +# expected to transfer the copyright for their translations to this person +# or entity, or to disclaim their copyright. The empty string stands for +# the public domain; in this case the translators are expected to disclaim +# their copyright. +COPYRIGHT_HOLDER = The ALSA Team + +# This is the email address or URL to which the translators shall report +# bugs in the untranslated strings: +# - Strings which are not entire sentences, see the maintainer guidelines +# in the GNU gettext documentation, section 'Preparing Strings'. +# - Strings which use unclear terms or require additional context to be +# understood. +# - Strings which make invalid assumptions about notation of date, time or +# money. +# - Pluralisation problems. +# - Incorrect English spelling. +# - Incorrect formatting. +# It can be your email address, or a mailing list address where translators +# can write to without being subscribed, or the URL of a web page through +# which the translators can contact you. +MSGID_BUGS_ADDRESS = + +# This is the list of locale categories, beyond LC_MESSAGES, for which the +# message catalogs shall be used. It is usually empty. +EXTRA_LOCALE_CATEGORIES = + +# This tells whether the $(DOMAIN).pot file contains messages with an 'msgctxt' +# context. Possible values are "yes" and "no". Set this to yes if the +# package uses functions taking also a message context, like pgettext(), or +# if in $(XGETTEXT_OPTIONS) you define keywords with a context argument. +USE_MSGCTXT = no + +# These options get passed to msgmerge. +# Useful options are in particular: +# --previous to keep previous msgids of translated messages, +# --quiet to reduce the verbosity. +MSGMERGE_OPTIONS = + +# These options get passed to msginit. +# If you want to disable line wrapping when writing PO files, add +# --no-wrap to MSGMERGE_OPTIONS, XGETTEXT_OPTIONS, and +# MSGINIT_OPTIONS. +MSGINIT_OPTIONS = + +# This tells whether or not to regenerate a PO file when $(DOMAIN).pot +# has changed. Possible values are "yes" and "no". Set this to no if +# the POT file is checked in the repository and the version control +# program ignores timestamps. +PO_DEPENDS_ON_POT = yes + +# This tells whether or not to forcibly update $(DOMAIN).pot and +# regenerate PO files on "make dist". Possible values are "yes" and +# "no". Set this to no if the POT file and PO files are maintained +# externally. +DIST_DEPENDS_ON_UPDATE_PO = yes diff --git a/po/POTFILES.in b/po/POTFILES.in new file mode 100644 index 0000000..3d1b8ea --- /dev/null +++ b/po/POTFILES.in @@ -0,0 +1,12 @@ +alsamixer/card_select.c +alsamixer/cli.c +alsamixer/device_name.c +alsamixer/die.c +alsamixer/mixer_display.c +alsamixer/mixer_widget.c +alsamixer/proc_files.c +alsamixer/textbox.c +aplay/aplay.c +seq/aconnect/aconnect.c +seq/aseqnet/aseqnet.c +speaker-test/speaker-test.c diff --git a/po/Rules-quot b/po/Rules-quot new file mode 100644 index 0000000..baf6528 --- /dev/null +++ b/po/Rules-quot @@ -0,0 +1,58 @@ +# This file, Rules-quot, can be copied and used freely without restrictions. +# Special Makefile rules for English message catalogs with quotation marks. + +DISTFILES.common.extra1 = quot.sed boldquot.sed en@quot.header en@boldquot.header insert-header.sin Rules-quot + +.SUFFIXES: .insert-header .po-update-en + +en@quot.po-create: + $(MAKE) en@quot.po-update +en@boldquot.po-create: + $(MAKE) en@boldquot.po-update + +en@quot.po-update: en@quot.po-update-en +en@boldquot.po-update: en@boldquot.po-update-en + +.insert-header.po-update-en: + @lang=`echo $@ | sed -e 's/\.po-update-en$$//'`; \ + if test "$(PACKAGE)" = "gettext-tools" && test "$(CROSS_COMPILING)" != "yes"; then PATH=`pwd`/../src:$$PATH; GETTEXTLIBDIR=`cd $(top_srcdir)/src && pwd`; export GETTEXTLIBDIR; fi; \ + tmpdir=`pwd`; \ + echo "$$lang:"; \ + ll=`echo $$lang | sed -e 's/@.*//'`; \ + LC_ALL=C; export LC_ALL; \ + cd $(srcdir); \ + if $(MSGINIT) $(MSGINIT_OPTIONS) -i $(DOMAIN).pot --no-translator -l $$lang -o - 2>/dev/null \ + | $(SED) -f $$tmpdir/$$lang.insert-header | $(MSGCONV) -t UTF-8 | \ + { case `$(MSGFILTER) --version | sed 1q | sed -e 's,^[^0-9]*,,'` in \ + '' | 0.[0-9] | 0.[0-9].* | 0.1[0-8] | 0.1[0-8].*) \ + $(MSGFILTER) $(SED) -f `echo $$lang | sed -e 's/.*@//'`.sed \ + ;; \ + *) \ + $(MSGFILTER) `echo $$lang | sed -e 's/.*@//'` \ + ;; \ + esac } 2>/dev/null > $$tmpdir/$$lang.new.po \ + ; then \ + if cmp $$lang.po $$tmpdir/$$lang.new.po >/dev/null 2>&1; then \ + rm -f $$tmpdir/$$lang.new.po; \ + else \ + if mv -f $$tmpdir/$$lang.new.po $$lang.po; then \ + :; \ + else \ + echo "creation of $$lang.po failed: cannot move $$tmpdir/$$lang.new.po to $$lang.po" 1>&2; \ + exit 1; \ + fi; \ + fi; \ + else \ + echo "creation of $$lang.po failed!" 1>&2; \ + rm -f $$tmpdir/$$lang.new.po; \ + fi + +en@quot.insert-header: insert-header.sin + sed -e '/^#/d' -e 's/HEADER/en@quot.header/g' $(srcdir)/insert-header.sin > en@quot.insert-header + +en@boldquot.insert-header: insert-header.sin + sed -e '/^#/d' -e 's/HEADER/en@boldquot.header/g' $(srcdir)/insert-header.sin > en@boldquot.insert-header + +mostlyclean: mostlyclean-quot +mostlyclean-quot: + rm -f *.insert-header diff --git a/po/alsa-utils.pot b/po/alsa-utils.pot new file mode 100644 index 0000000..a6e6dec --- /dev/null +++ b/po/alsa-utils.pot @@ -0,0 +1,1616 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR The ALSA Team +# This file is distributed under the same license as the alsa-utils package. +# FIRST AUTHOR , YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: alsa-utils 1.2.4\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2020-10-15 11:46+0000\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"Language: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=CHARSET\n" +"Content-Transfer-Encoding: 8bit\n" + +#: alsamixer/card_select.c:77 alsamixer/device_name.c:127 +msgid "Sound Card" +msgstr "" + +#: alsamixer/card_select.c:115 +msgid "(default)" +msgstr "" + +#: alsamixer/card_select.c:125 +msgid "cannot enumerate sound cards" +msgstr "" + +#: alsamixer/card_select.c:147 +msgid "enter device name..." +msgstr "" + +#: alsamixer/cli.c:43 +msgid "Usage: alsamixer [options]" +msgstr "" + +#: alsamixer/cli.c:44 +msgid "" +"Useful options:\n" +" -h, --help this help\n" +" -c, --card=NUMBER sound card number or id\n" +" -D, --device=NAME mixer device name\n" +" -m, --mouse enable mouse\n" +" -M, --no-mouse disable mouse\n" +" -f, --config=FILE configuration file\n" +" -F, --no-config do not load configuration file\n" +" -V, --view=MODE starting view mode: playback/capture/all" +msgstr "" + +#: alsamixer/cli.c:53 +msgid "" +"Debugging options:\n" +" -g, --no-color toggle using of colors\n" +" -a, --abstraction=NAME mixer abstraction level: none/basic" +msgstr "" + +#: alsamixer/cli.c:88 +#, c-format +msgid "invalid card index: %s\n" +msgstr "" + +#: alsamixer/cli.c:126 +#, c-format +msgid "unknown abstraction level: %s\n" +msgstr "" + +#: alsamixer/cli.c:131 +#, c-format +msgid "unknown option: %c\n" +msgstr "" + +#: alsamixer/cli.c:133 +msgid "try `alsamixer --help' for more information\n" +msgstr "" + +#: alsamixer/device_name.c:177 +msgid "Device name:" +msgstr "" + +#: alsamixer/die.c:37 +#, c-format +msgid "%s: %s\n" +msgstr "" + +#: alsamixer/mixer_display.c:99 +msgid "Card:" +msgstr "" + +#: alsamixer/mixer_display.c:100 +msgid "Chip:" +msgstr "" + +#: alsamixer/mixer_display.c:101 +msgid "View:" +msgstr "" + +#: alsamixer/mixer_display.c:102 +msgid "Item:" +msgstr "" + +#: alsamixer/mixer_display.c:105 +msgid "F1: Help" +msgstr "" + +#: alsamixer/mixer_display.c:106 +msgid "F2: System information" +msgstr "" + +#: alsamixer/mixer_display.c:107 +msgid "F6: Select sound card" +msgstr "" + +#: alsamixer/mixer_display.c:108 +msgid "Esc: Exit" +msgstr "" + +#: alsamixer/mixer_display.c:179 +msgid "(unplugged)" +msgstr "" + +#: alsamixer/mixer_display.c:197 +msgid "Playback" +msgstr "" + +#: alsamixer/mixer_display.c:198 +msgid "Capture" +msgstr "" + +#: alsamixer/mixer_display.c:199 +msgid "All" +msgstr "" + +#: alsamixer/mixer_display.c:240 +msgid "mute" +msgstr "" + +#: alsamixer/mixer_display.c:281 alsamixer/mixer_display.c:291 +msgid "dB gain:" +msgstr "" + +#: alsamixer/mixer_display.c:291 +#, c-format +msgid " [%s %s, %s]" +msgstr "" + +#: alsamixer/mixer_display.c:300 alsamixer/mixer_display.c:306 +#: alsamixer/mixer_display.c:312 alsamixer/mixer_display.c:318 +msgid "Off" +msgstr "" + +#: alsamixer/mixer_display.c:306 alsamixer/mixer_display.c:318 +msgid "On" +msgstr "" + +#: alsamixer/mixer_display.c:370 +msgid "The sound device was unplugged." +msgstr "" + +#: alsamixer/mixer_display.c:371 +msgid "Press F6 to select another sound card." +msgstr "" + +#: alsamixer/mixer_display.c:386 +msgid "This sound device does not have any playback controls." +msgstr "" + +#: alsamixer/mixer_display.c:388 +msgid "This sound device does not have any capture controls." +msgstr "" + +#: alsamixer/mixer_display.c:390 +msgid "This sound device does not have any controls." +msgstr "" + +#. TRANSLATORS: playback on; one character +#: alsamixer/mixer_display.c:523 alsamixer/mixer_display.c:528 +msgid "O" +msgstr "" + +#. TRANSLATORS: playback muted; one character +#: alsamixer/mixer_display.c:525 alsamixer/mixer_display.c:529 +msgid "M" +msgstr "" + +#. TRANSLATORS: "left"; no more than two characters +#: alsamixer/mixer_display.c:545 +msgid "L" +msgstr "" + +#. TRANSLATORS: "right"; no more than two characters +#: alsamixer/mixer_display.c:551 +msgid "R" +msgstr "" + +#. TRANSLATORS: no more than eight characters +#: alsamixer/mixer_display.c:555 +msgid "CAPTURE" +msgstr "" + +#: alsamixer/mixer_display.c:611 +msgid "Front" +msgstr "" + +#: alsamixer/mixer_display.c:614 +msgid "Rear" +msgstr "" + +#: alsamixer/mixer_display.c:617 speaker-test/speaker-test.c:124 +msgid "Center" +msgstr "" + +#: alsamixer/mixer_display.c:620 +msgid "Woofer" +msgstr "" + +#: alsamixer/mixer_display.c:623 +msgid "Side" +msgstr "" + +#: alsamixer/mixer_widget.c:91 alsamixer/mixer_widget.c:96 +msgid "cannot open mixer" +msgstr "" + +#: alsamixer/mixer_widget.c:102 alsamixer/mixer_widget.c:179 +msgid "cannot load mixer controls" +msgstr "" + +#: alsamixer/mixer_widget.c:169 +#, c-format +msgid "Cannot open mixer device '%s'." +msgstr "" + +#: alsamixer/mixer_widget.c:190 +msgid "Esc Exit" +msgstr "" + +#: alsamixer/mixer_widget.c:191 +msgid "F1 ? H Help" +msgstr "" + +#: alsamixer/mixer_widget.c:192 +msgid "F2 / System information" +msgstr "" + +#: alsamixer/mixer_widget.c:193 +msgid "F3 Show playback controls" +msgstr "" + +#: alsamixer/mixer_widget.c:194 +msgid "F4 Show capture controls" +msgstr "" + +#: alsamixer/mixer_widget.c:195 +msgid "F5 Show all controls" +msgstr "" + +#: alsamixer/mixer_widget.c:196 +msgid "Tab Toggle view mode (F3/F4/F5)" +msgstr "" + +#: alsamixer/mixer_widget.c:197 +msgid "F6 S Select sound card" +msgstr "" + +#: alsamixer/mixer_widget.c:198 +msgid "L Redraw screen" +msgstr "" + +#: alsamixer/mixer_widget.c:200 +msgid "Left Move to the previous control" +msgstr "" + +#: alsamixer/mixer_widget.c:201 +msgid "Right Move to the next control" +msgstr "" + +#: alsamixer/mixer_widget.c:203 +msgid "Up/Down Change volume" +msgstr "" + +#: alsamixer/mixer_widget.c:204 +msgid "+ - Change volume" +msgstr "" + +#: alsamixer/mixer_widget.c:205 +msgid "Page Up/Dn Change volume in big steps" +msgstr "" + +#: alsamixer/mixer_widget.c:206 +msgid "End Set volume to 0%" +msgstr "" + +#: alsamixer/mixer_widget.c:207 +msgid "0-9 Set volume to 0%-90%" +msgstr "" + +#: alsamixer/mixer_widget.c:208 +msgid "Q W E Increase left/both/right volumes" +msgstr "" + +#. TRANSLATORS: or Y instead of Z +#: alsamixer/mixer_widget.c:210 +msgid "Z X C Decrease left/both/right volumes" +msgstr "" + +#: alsamixer/mixer_widget.c:211 +msgid "B Balance left and right volumes" +msgstr "" + +#: alsamixer/mixer_widget.c:213 +msgid "M Toggle mute" +msgstr "" + +#. TRANSLATORS: or , . +#: alsamixer/mixer_widget.c:215 +msgid "< > Toggle left/right mute" +msgstr "" + +#: alsamixer/mixer_widget.c:217 +msgid "Space Toggle capture" +msgstr "" + +#. TRANSLATORS: or Insert Delete +#: alsamixer/mixer_widget.c:219 +msgid "; ' Toggle left/right capture" +msgstr "" + +#: alsamixer/mixer_widget.c:221 +msgid "Authors:" +msgstr "" + +#: alsamixer/mixer_widget.c:222 +msgid " Tim Janik" +msgstr "" + +#: alsamixer/mixer_widget.c:223 +msgid " Jaroslav Kysela " +msgstr "" + +#: alsamixer/mixer_widget.c:224 +msgid " Clemens Ladisch " +msgstr "" + +#: alsamixer/mixer_widget.c:226 +msgid "Help" +msgstr "" + +#: alsamixer/proc_files.c:56 +msgid "Select File" +msgstr "" + +#: alsamixer/textbox.c:51 alsamixer/textbox.c:65 +msgid "Error" +msgstr "" + +#: alsamixer/textbox.c:80 +#, c-format +msgid "Cannot open file \"%s\"." +msgstr "" + +#: aplay/aplay.c:180 +msgid "raw data" +msgstr "" + +#: aplay/aplay.c:181 +msgid "VOC" +msgstr "" + +#: aplay/aplay.c:183 +msgid "WAVE" +msgstr "" + +#: aplay/aplay.c:184 +msgid "Sparc Audio" +msgstr "" + +#: aplay/aplay.c:205 +#, c-format +msgid "" +"Usage: %s [OPTION]... [FILE]...\n" +"\n" +"-h, --help help\n" +" --version print current version\n" +"-l, --list-devices list all soundcards and digital audio devices\n" +"-L, --list-pcms list device names\n" +"-D, --device=NAME select PCM by name\n" +"-q, --quiet quiet mode\n" +"-t, --file-type TYPE file type (voc, wav, raw or au)\n" +"-c, --channels=# channels\n" +"-f, --format=FORMAT sample format (case insensitive)\n" +"-r, --rate=# sample rate\n" +"-d, --duration=# interrupt after # seconds\n" +"-s, --samples=# interrupt after # samples per channel\n" +"-M, --mmap mmap stream\n" +"-N, --nonblock nonblocking mode\n" +"-F, --period-time=# distance between interrupts is # microseconds\n" +"-B, --buffer-time=# buffer duration is # microseconds\n" +" --period-size=# distance between interrupts is # frames\n" +" --buffer-size=# buffer duration is # frames\n" +"-A, --avail-min=# min available space for wakeup is # microseconds\n" +"-R, --start-delay=# delay for automatic PCM start is # microseconds \n" +" (relative to buffer size if <= 0)\n" +"-T, --stop-delay=# delay for automatic PCM stop is # microseconds from " +"xrun\n" +"-v, --verbose show PCM structure and setup (accumulative)\n" +"-V, --vumeter=TYPE enable VU meter (TYPE: mono or stereo)\n" +"-I, --separate-channels one file for each channel\n" +"-i, --interactive allow interactive operation from stdin\n" +"-m, --chmap=ch1,ch2,.. Give the channel map to override or follow\n" +" --disable-resample disable automatic rate resample\n" +" --disable-channels disable automatic channel conversions\n" +" --disable-format disable automatic format conversions\n" +" --disable-softvol disable software volume control (softvol)\n" +" --test-position test ring buffer position\n" +" --test-coef=# test coefficient for ring buffer position (default " +"8)\n" +" expression for validation is: coef * (buffer_size / " +"2)\n" +" --test-nowait do not wait for ring buffer - eats whole CPU\n" +" --max-file-time=# start another output file when the old file has " +"recorded\n" +" for this many seconds\n" +" --process-id-file write the process ID here\n" +" --use-strftime apply the strftime facility to the output file name\n" +" --dump-hw-params dump hw_params of the device\n" +" --fatal-errors treat all errors as fatal\n" +msgstr "" + +#: aplay/aplay.c:250 speaker-test/speaker-test.c:945 +#, c-format +msgid "Recognized sample formats are:" +msgstr "" + +#: aplay/aplay.c:256 +#, c-format +msgid "" +"\n" +"Some of these may not be available on selected hardware\n" +msgstr "" + +#: aplay/aplay.c:257 +#, c-format +msgid "The available format shortcuts are:\n" +msgstr "" + +#: aplay/aplay.c:258 +#, c-format +msgid "-f cd (16 bit little endian, 44100, stereo)\n" +msgstr "" + +#: aplay/aplay.c:259 +#, c-format +msgid "-f cdr (16 bit big endian, 44100, stereo)\n" +msgstr "" + +#: aplay/aplay.c:260 +#, c-format +msgid "-f dat (16 bit little endian, 48000, stereo)\n" +msgstr "" + +#: aplay/aplay.c:274 +msgid "no soundcards found..." +msgstr "" + +#: aplay/aplay.c:277 +#, c-format +msgid "**** List of %s Hardware Devices ****\n" +msgstr "" + +#: aplay/aplay.c:306 +#, c-format +msgid "card %i: %s [%s], device %i: %s [%s]\n" +msgstr "" + +#: aplay/aplay.c:312 +#, c-format +msgid " Subdevices: %i/%i\n" +msgstr "" + +#: aplay/aplay.c:319 +#, c-format +msgid " Subdevice #%i: %s\n" +msgstr "" + +#: aplay/aplay.c:400 +#, c-format +msgid "Aborted by signal %s...\n" +msgstr "" + +#: aplay/aplay.c:555 +msgid "command should be named either arecord or aplay" +msgstr "" + +#: aplay/aplay.c:599 +#, c-format +msgid "unrecognized file format %s" +msgstr "" + +#: aplay/aplay.c:606 +#, c-format +msgid "invalid channels argument '%s'" +msgstr "" + +#: aplay/aplay.c:610 +#, c-format +msgid "value %i for channels is invalid" +msgstr "" + +#: aplay/aplay.c:629 +#, c-format +msgid "wrong extended format '%s'" +msgstr "" + +#: aplay/aplay.c:637 +#, c-format +msgid "invalid rate argument '%s'" +msgstr "" + +#: aplay/aplay.c:644 +#, c-format +msgid "bad speed value %i" +msgstr "" + +#: aplay/aplay.c:650 +msgid "duration and samples arguments cannot be used together" +msgstr "" + +#: aplay/aplay.c:655 +#, c-format +msgid "invalid duration argument '%s'" +msgstr "" + +#: aplay/aplay.c:662 +msgid "samples and duration arguments cannot be used together" +msgstr "" + +#: aplay/aplay.c:667 +#, c-format +msgid "invalid samples argument '%s'" +msgstr "" + +#: aplay/aplay.c:679 +#, c-format +msgid "invalid period time argument '%s'" +msgstr "" + +#: aplay/aplay.c:686 +#, c-format +msgid "invalid buffer time argument '%s'" +msgstr "" + +#: aplay/aplay.c:693 +#, c-format +msgid "invalid period size argument '%s'" +msgstr "" + +#: aplay/aplay.c:700 +#, c-format +msgid "invalid buffer size argument '%s'" +msgstr "" + +#: aplay/aplay.c:707 +#, c-format +msgid "invalid min available space argument '%s'" +msgstr "" + +#: aplay/aplay.c:714 +#, c-format +msgid "invalid start delay argument '%s'" +msgstr "" + +#: aplay/aplay.c:721 +#, c-format +msgid "invalid stop delay argument '%s'" +msgstr "" + +#: aplay/aplay.c:776 +#, c-format +msgid "invalid test coef argument '%s'" +msgstr "" + +#: aplay/aplay.c:788 +#, c-format +msgid "invalid max file time argument '%s'" +msgstr "" + +#: aplay/aplay.c:808 speaker-test/speaker-test.c:571 +#, c-format +msgid "Unable to parse channel map string: %s\n" +msgstr "" + +#: aplay/aplay.c:814 +#, c-format +msgid "Try `%s --help' for more information.\n" +msgstr "" + +#: aplay/aplay.c:830 +#, c-format +msgid "audio open error: %s" +msgstr "" + +#: aplay/aplay.c:835 +#, c-format +msgid "info error: %s" +msgstr "" + +#: aplay/aplay.c:842 +#, c-format +msgid "nonblock setting error: %s" +msgstr "" + +#: aplay/aplay.c:852 aplay/aplay.c:976 aplay/aplay.c:1266 aplay/aplay.c:1466 +#: aplay/aplay.c:1986 aplay/aplay.c:2016 +msgid "not enough memory" +msgstr "" + +#: aplay/aplay.c:876 +#, c-format +msgid "Cannot create process ID file %s: %s" +msgstr "" + +#: aplay/aplay.c:966 +#, c-format +msgid "read error (called from line %i)" +msgstr "" + +#: aplay/aplay.c:1033 +#, c-format +msgid "unknown length of 'fmt ' chunk (read %u, should be %u at least)" +msgstr "" + +#: aplay/aplay.c:1044 +#, c-format +msgid "" +"unknown length of extensible 'fmt ' chunk (read %u, should be %u at least)" +msgstr "" + +#: aplay/aplay.c:1049 +msgid "wrong format tag in extensible 'fmt ' chunk" +msgstr "" + +#: aplay/aplay.c:1056 +#, c-format +msgid "can't play WAVE-file format 0x%04x which is not PCM or FLOAT encoded" +msgstr "" + +#: aplay/aplay.c:1061 +#, c-format +msgid "can't play WAVE-files with %d tracks" +msgstr "" + +#: aplay/aplay.c:1069 aplay/aplay.c:1195 +#, c-format +msgid "Warning: format is changed to U8\n" +msgstr "" + +#: aplay/aplay.c:1079 aplay/aplay.c:1092 aplay/aplay.c:1103 +#, c-format +msgid "Warning: format is changed to %s\n" +msgstr "" + +#: aplay/aplay.c:1108 +#, c-format +msgid "" +" can't play WAVE-files with sample %d bits in %d bytes wide (%d channels)" +msgstr "" + +#: aplay/aplay.c:1131 +#, c-format +msgid " can't play WAVE-files with sample %d bits wide" +msgstr "" + +#: aplay/aplay.c:1189 +#, c-format +msgid "Warning: format is changed to MU_LAW\n" +msgstr "" + +#: aplay/aplay.c:1201 +#, c-format +msgid "Warning: format is changed to S16_BE\n" +msgstr "" + +#: aplay/aplay.c:1214 aplay/aplay.c:2307 aplay/aplay.c:2314 aplay/aplay.c:2839 +msgid "read error" +msgstr "" + +#: aplay/aplay.c:1244 +msgid "Channel numbers don't match between hw_params and channel map" +msgstr "" + +#: aplay/aplay.c:1253 +#, c-format +msgid "Warning: unable to get channel map\n" +msgstr "" + +#: aplay/aplay.c:1287 +#, c-format +msgid "Channel %d doesn't match with hw_params" +msgstr "" + +#: aplay/aplay.c:1314 +msgid "Broken configuration for this PCM: no configurations available" +msgstr "" + +#: aplay/aplay.c:1318 +#, c-format +msgid "HW Params of device \"%s\":\n" +msgstr "" + +#: aplay/aplay.c:1338 +msgid "Access type not available" +msgstr "" + +#: aplay/aplay.c:1343 +msgid "Sample format non available" +msgstr "" + +#: aplay/aplay.c:1349 +msgid "Channels count non available" +msgstr "" + +#: aplay/aplay.c:1364 +#, c-format +msgid "Warning: rate is not accurate (requested = %iHz, got = %iHz)\n" +msgstr "" + +#: aplay/aplay.c:1370 +#, c-format +msgid " please, try the plug plugin %s\n" +msgstr "" + +#: aplay/aplay.c:1407 +msgid "Unable to install hw params:" +msgstr "" + +#: aplay/aplay.c:1414 +#, c-format +msgid "Can't use period equal to buffer size (%lu == %lu)" +msgstr "" + +#: aplay/aplay.c:1420 +msgid "Unable to get current sw params." +msgstr "" + +#: aplay/aplay.c:1449 +msgid "unable to install sw params:" +msgstr "" + +#: aplay/aplay.c:1484 +#, c-format +msgid "snd_pcm_mmap_begin problem: %s" +msgstr "" + +#: aplay/aplay.c:1513 +#, c-format +msgid "stdin O_NONBLOCK flag setup failed\n" +msgstr "" + +#: aplay/aplay.c:1537 +#, c-format +msgid "\rPAUSE command ignored (no hw support)\n" +msgstr "" + +#: aplay/aplay.c:1545 +#, c-format +msgid "pause push error: %s" +msgstr "" + +#: aplay/aplay.c:1556 +#, c-format +msgid "pause release error: %s" +msgstr "" + +#: aplay/aplay.c:1572 +#, c-format +msgid "" +"\r=== PAUSE === " +msgstr "" + +#: aplay/aplay.c:1614 +#, c-format +msgid "status error: %s" +msgstr "" + +#: aplay/aplay.c:1619 +#, c-format +msgid "fatal %s: %s" +msgstr "" + +#: aplay/aplay.c:1620 aplay/aplay.c:1631 aplay/aplay.c:1634 aplay/aplay.c:1642 +msgid "underrun" +msgstr "" + +#: aplay/aplay.c:1620 aplay/aplay.c:1631 aplay/aplay.c:1642 +msgid "overrun" +msgstr "" + +#: aplay/aplay.c:1630 aplay/aplay.c:1641 +#, c-format +msgid "%s!!! (at least %.3f ms long)\n" +msgstr "" + +#: aplay/aplay.c:1646 +#, c-format +msgid "Status:\n" +msgstr "" + +#: aplay/aplay.c:1650 +#, c-format +msgid "xrun: prepare error: %s" +msgstr "" + +#: aplay/aplay.c:1656 +#, c-format +msgid "Status(DRAINING):\n" +msgstr "" + +#: aplay/aplay.c:1660 +#, c-format +msgid "capture stream format change? attempting recover...\n" +msgstr "" + +#: aplay/aplay.c:1662 +#, c-format +msgid "xrun(DRAINING): prepare error: %s" +msgstr "" + +#: aplay/aplay.c:1669 +#, c-format +msgid "Status(R/W):\n" +msgstr "" + +#: aplay/aplay.c:1672 +#, c-format +msgid "read/write error, state = %s" +msgstr "" + +#: aplay/aplay.c:1682 +#, c-format +msgid "Suspended. Trying resume. " +msgstr "" + +#: aplay/aplay.c:1688 +#, c-format +msgid "Failed. Restarting stream. " +msgstr "" + +#: aplay/aplay.c:1691 +#, c-format +msgid "suspend: prepare error: %s" +msgstr "" + +#: aplay/aplay.c:1696 +#, c-format +msgid "Done.\n" +msgstr "" + +#: aplay/aplay.c:1718 +#, c-format +msgid " !clip " +msgstr "" + +#: aplay/aplay.c:1862 +#, c-format +msgid "Unsupported bit size %d.\n" +msgstr "" + +#: aplay/aplay.c:1896 +#, c-format +msgid "Max peak (%li samples): 0x%08x " +msgstr "" + +#: aplay/aplay.c:1930 +#, c-format +msgid "" +"Suspicious buffer position (%li total): avail = %li, delay = %li, buffer = " +"%li\n" +msgstr "" + +#: aplay/aplay.c:2058 +#, c-format +msgid "write error: %s" +msgstr "" + +#: aplay/aplay.c:2106 +#, c-format +msgid "writev error: %s" +msgstr "" + +#: aplay/aplay.c:2152 +#, c-format +msgid "read error: %s" +msgstr "" + +#: aplay/aplay.c:2199 +#, c-format +msgid "readv error: %s" +msgstr "" + +#: aplay/aplay.c:2248 +msgid "can't allocate buffer for silence" +msgstr "" + +#: aplay/aplay.c:2257 aplay/aplay.c:2485 aplay/aplay.c:2490 aplay/aplay.c:2540 +#: aplay/aplay.c:2549 aplay/aplay.c:2556 aplay/aplay.c:2566 aplay/aplay.c:2572 +#: aplay/aplay.c:2644 aplay/aplay.c:2674 aplay/aplay.c:2688 +msgid "write error" +msgstr "" + +#: aplay/aplay.c:2270 +#, c-format +msgid "voc_pcm_flush - silence error" +msgstr "" + +#: aplay/aplay.c:2273 +msgid "voc_pcm_flush error" +msgstr "" + +#: aplay/aplay.c:2298 +msgid "malloc error" +msgstr "" + +#: aplay/aplay.c:2302 +#, c-format +msgid "Playing Creative Labs Channel file '%s'...\n" +msgstr "" + +#: aplay/aplay.c:2370 aplay/aplay.c:2465 +msgid "can't play packed .voc files" +msgstr "" + +#: aplay/aplay.c:2425 +#, c-format +msgid "can't play loops; %s isn't seekable\n" +msgstr "" + +#: aplay/aplay.c:2474 +#, c-format +msgid "unknown blocktype %d. terminate." +msgstr "" + +#: aplay/aplay.c:2608 +#, c-format +msgid "Wave doesn't support %s format..." +msgstr "" + +#: aplay/aplay.c:2668 +#, c-format +msgid "Sparc Audio doesn't support %s format..." +msgstr "" + +#: aplay/aplay.c:2743 +msgid "Playing" +msgstr "" + +#: aplay/aplay.c:2743 +msgid "Recording" +msgstr "" + +#: aplay/aplay.c:2747 +#, c-format +msgid "Rate %d Hz, " +msgstr "" + +#: aplay/aplay.c:2749 +#, c-format +msgid "Mono" +msgstr "" + +#: aplay/aplay.c:2751 +#, c-format +msgid "Stereo" +msgstr "" + +#: aplay/aplay.c:2753 +#, c-format +msgid "Channels %i" +msgstr "" + +#: aplay/aplay.c:3356 +#, c-format +msgid "You need to specify %u files" +msgstr "" + +#: aplay/aplay.c:3409 +#, c-format +msgid "You need to specify %d files" +msgstr "" + +#: seq/aconnect/aconnect.c:49 +#, c-format +msgid "aconnect - ALSA sequencer connection manager\n" +msgstr "" + +#: seq/aconnect/aconnect.c:50 +#, c-format +msgid "Copyright (C) 1999-2000 Takashi Iwai\n" +msgstr "" + +#: seq/aconnect/aconnect.c:51 +#, c-format +msgid "Usage:\n" +msgstr "" + +#: seq/aconnect/aconnect.c:52 +#, c-format +msgid " * Connection/disconnection between two ports\n" +msgstr "" + +#: seq/aconnect/aconnect.c:53 +#, c-format +msgid " aconnect [-options] sender receiver\n" +msgstr "" + +#: seq/aconnect/aconnect.c:54 +#, c-format +msgid " sender, receiver = client:port pair\n" +msgstr "" + +#: seq/aconnect/aconnect.c:55 +#, c-format +msgid " -d,--disconnect disconnect\n" +msgstr "" + +#: seq/aconnect/aconnect.c:56 +#, c-format +msgid " -e,--exclusive exclusive connection\n" +msgstr "" + +#: seq/aconnect/aconnect.c:57 +#, c-format +msgid " -r,--real # convert real-time-stamp on queue\n" +msgstr "" + +#: seq/aconnect/aconnect.c:58 +#, c-format +msgid " -t,--tick # convert tick-time-stamp on queue\n" +msgstr "" + +#: seq/aconnect/aconnect.c:59 +#, c-format +msgid " * List connected ports (no subscription action)\n" +msgstr "" + +#: seq/aconnect/aconnect.c:60 +#, c-format +msgid " aconnect -i|-o [-options]\n" +msgstr "" + +#: seq/aconnect/aconnect.c:61 +#, c-format +msgid " -i,--input list input (readable) ports\n" +msgstr "" + +#: seq/aconnect/aconnect.c:62 +#, c-format +msgid " -o,--output list output (writable) ports\n" +msgstr "" + +#: seq/aconnect/aconnect.c:63 +#, c-format +msgid " -l,--list list current connections of each port\n" +msgstr "" + +#: seq/aconnect/aconnect.c:64 +#, c-format +msgid " * Remove all exported connections\n" +msgstr "" + +#: seq/aconnect/aconnect.c:65 +#, c-format +msgid " -x, --removeall\n" +msgstr "" + +#: seq/aconnect/aconnect.c:132 +msgid "Connecting To" +msgstr "" + +#: seq/aconnect/aconnect.c:133 +msgid "Connected From" +msgstr "" + +#: seq/aconnect/aconnect.c:171 +#, c-format +msgid "client %d: '%s' [type=%s" +msgstr "" + +#: seq/aconnect/aconnect.c:175 +msgid "user" +msgstr "" + +#: seq/aconnect/aconnect.c:175 +msgid "kernel" +msgstr "" + +#: seq/aconnect/aconnect.c:323 +#, c-format +msgid "can't open sequencer\n" +msgstr "" + +#: seq/aconnect/aconnect.c:351 +#, c-format +msgid "can't get client id\n" +msgstr "" + +#: seq/aconnect/aconnect.c:358 +#, c-format +msgid "can't set client info\n" +msgstr "" + +#: seq/aconnect/aconnect.c:365 +#, c-format +msgid "invalid sender address %s\n" +msgstr "" + +#: seq/aconnect/aconnect.c:370 seq/aseqnet/aseqnet.c:290 +#, c-format +msgid "invalid destination address %s\n" +msgstr "" + +#: seq/aconnect/aconnect.c:384 +#, c-format +msgid "No subscription is found\n" +msgstr "" + +#: seq/aconnect/aconnect.c:389 +#, c-format +msgid "Disconnection failed (%s)\n" +msgstr "" + +#: seq/aconnect/aconnect.c:395 +#, c-format +msgid "Connection is already subscribed\n" +msgstr "" + +#: seq/aconnect/aconnect.c:400 +#, c-format +msgid "Connection failed (%s)\n" +msgstr "" + +#: seq/aseqnet/aseqnet.c:164 +#, c-format +msgid "aseqnet - network client/server on ALSA sequencer\n" +msgstr "" + +#: seq/aseqnet/aseqnet.c:165 +#, c-format +msgid " Copyright (C) 1999 Takashi Iwai\n" +msgstr "" + +#: seq/aseqnet/aseqnet.c:166 +#, c-format +msgid "usage:\n" +msgstr "" + +#: seq/aseqnet/aseqnet.c:167 +#, c-format +msgid " server mode: aseqnet [-options]\n" +msgstr "" + +#: seq/aseqnet/aseqnet.c:168 +#, c-format +msgid " client mode: aseqnet [-options] server_host\n" +msgstr "" + +#: seq/aseqnet/aseqnet.c:169 +#, c-format +msgid "options:\n" +msgstr "" + +#: seq/aseqnet/aseqnet.c:170 +#, c-format +msgid " -p,--port # : specify TCP port (digit or service name)\n" +msgstr "" + +#: seq/aseqnet/aseqnet.c:171 +#, c-format +msgid " -s,--source addr : read from given addr (client:port)\n" +msgstr "" + +#: seq/aseqnet/aseqnet.c:172 +#, c-format +msgid " -d,--dest addr : write to given addr (client:port)\n" +msgstr "" + +#: seq/aseqnet/aseqnet.c:173 +#, c-format +msgid " -v, --verbose : print verbose messages\n" +msgstr "" + +#: seq/aseqnet/aseqnet.c:174 +#, c-format +msgid " -i, --info : print certain received events\n" +msgstr "" + +#: seq/aseqnet/aseqnet.c:188 +#, c-format +msgid "can't malloc\n" +msgstr "" + +#: seq/aseqnet/aseqnet.c:213 +#, c-format +msgid "closing files..\n" +msgstr "" + +#: seq/aseqnet/aseqnet.c:272 +#, c-format +msgid "sequencer opened: %d:%d\n" +msgstr "" + +#: seq/aseqnet/aseqnet.c:279 +#, c-format +msgid "invalid source address %s\n" +msgstr "" + +#: seq/aseqnet/aseqnet.c:309 +#, c-format +msgid "service '%s' is not found in /etc/services\n" +msgstr "" + +#: seq/aseqnet/aseqnet.c:377 +#, c-format +msgid "too many connections!\n" +msgstr "" + +#: seq/aseqnet/aseqnet.c:388 +#, c-format +msgid "accepted[%d]\n" +msgstr "" + +#: seq/aseqnet/aseqnet.c:411 +#, c-format +msgid "can't get address %s\n" +msgstr "" + +#: seq/aseqnet/aseqnet.c:422 +#, c-format +msgid "ok.. connected\n" +msgstr "" + +#: seq/aseqnet/aseqnet.c:518 +#, c-format +msgid "Channel %2d: Control event : %5d\n" +msgstr "" + +#: seq/aseqnet/aseqnet.c:522 +#, c-format +msgid "Channel %2d: Pitchbender : %5d\n" +msgstr "" + +#: seq/aseqnet/aseqnet.c:526 +#, c-format +msgid "Channel %2d: Note On event : %5d\n" +msgstr "" + +#: seq/aseqnet/aseqnet.c:530 +#, c-format +msgid "Channel %2d: Note Off event: %5d\n" +msgstr "" + +#: seq/aseqnet/aseqnet.c:585 +#, c-format +msgid "disconnected\n" +msgstr "" + +#: speaker-test/speaker-test.c:120 +msgid "Front Left" +msgstr "" + +#: speaker-test/speaker-test.c:121 +msgid "Front Right" +msgstr "" + +#: speaker-test/speaker-test.c:122 +msgid "Rear Left" +msgstr "" + +#: speaker-test/speaker-test.c:123 +msgid "Rear Right" +msgstr "" + +#: speaker-test/speaker-test.c:125 +msgid "LFE" +msgstr "" + +#: speaker-test/speaker-test.c:126 +msgid "Side Left" +msgstr "" + +#: speaker-test/speaker-test.c:127 +msgid "Side Right" +msgstr "" + +#: speaker-test/speaker-test.c:128 +msgid "Channel 9" +msgstr "" + +#: speaker-test/speaker-test.c:129 +msgid "Channel 10" +msgstr "" + +#: speaker-test/speaker-test.c:130 +msgid "Channel 11" +msgstr "" + +#: speaker-test/speaker-test.c:131 +msgid "Channel 12" +msgstr "" + +#: speaker-test/speaker-test.c:132 +msgid "Channel 13" +msgstr "" + +#: speaker-test/speaker-test.c:133 +msgid "Channel 14" +msgstr "" + +#: speaker-test/speaker-test.c:134 +msgid "Channel 15" +msgstr "" + +#: speaker-test/speaker-test.c:135 +msgid "Channel 16" +msgstr "" + +#: speaker-test/speaker-test.c:424 +#, c-format +msgid "Broken configuration for playback: no configurations available: %s\n" +msgstr "" + +#: speaker-test/speaker-test.c:431 +#, c-format +msgid "Access type not available for playback: %s\n" +msgstr "" + +#: speaker-test/speaker-test.c:438 +#, c-format +msgid "Sample format not available for playback: %s\n" +msgstr "" + +#: speaker-test/speaker-test.c:445 +#, c-format +msgid "Channels count (%i) not available for playbacks: %s\n" +msgstr "" + +#: speaker-test/speaker-test.c:453 +#, c-format +msgid "Rate %iHz not available for playback: %s\n" +msgstr "" + +#: speaker-test/speaker-test.c:458 +#, c-format +msgid "Rate doesn't match (requested %iHz, get %iHz, err %d)\n" +msgstr "" + +#: speaker-test/speaker-test.c:462 +#, c-format +msgid "Rate set to %iHz (requested %iHz)\n" +msgstr "" + +#: speaker-test/speaker-test.c:468 +#, c-format +msgid "Buffer size range from %lu to %lu\n" +msgstr "" + +#: speaker-test/speaker-test.c:469 +#, c-format +msgid "Period size range from %lu to %lu\n" +msgstr "" + +#: speaker-test/speaker-test.c:471 +#, c-format +msgid "Requested period time %u us\n" +msgstr "" + +#: speaker-test/speaker-test.c:474 +#, c-format +msgid "Unable to set period time %u us for playback: %s\n" +msgstr "" + +#: speaker-test/speaker-test.c:480 +#, c-format +msgid "Requested buffer time %u us\n" +msgstr "" + +#: speaker-test/speaker-test.c:483 +#, c-format +msgid "Unable to set buffer time %u us for playback: %s\n" +msgstr "" + +#: speaker-test/speaker-test.c:492 +#, c-format +msgid "Using max buffer size %lu\n" +msgstr "" + +#: speaker-test/speaker-test.c:495 +#, c-format +msgid "Unable to set buffer size %lu for playback: %s\n" +msgstr "" + +#: speaker-test/speaker-test.c:501 +#, c-format +msgid "Periods = %u\n" +msgstr "" + +#: speaker-test/speaker-test.c:504 +#, c-format +msgid "Unable to set nperiods %u for playback: %s\n" +msgstr "" + +#: speaker-test/speaker-test.c:513 +#, c-format +msgid "Unable to set hw params for playback: %s\n" +msgstr "" + +#: speaker-test/speaker-test.c:519 +#, c-format +msgid "was set period_size = %lu\n" +msgstr "" + +#: speaker-test/speaker-test.c:520 +#, c-format +msgid "was set buffer_size = %lu\n" +msgstr "" + +#: speaker-test/speaker-test.c:522 +#, c-format +msgid "buffer to small, could not use\n" +msgstr "" + +#: speaker-test/speaker-test.c:535 +#, c-format +msgid "Unable to determine current swparams for playback: %s\n" +msgstr "" + +#: speaker-test/speaker-test.c:542 +#, c-format +msgid "Unable to set start threshold mode for playback: %s\n" +msgstr "" + +#: speaker-test/speaker-test.c:549 +#, c-format +msgid "Unable to set avail min for playback: %s\n" +msgstr "" + +#: speaker-test/speaker-test.c:556 +#, c-format +msgid "Unable to set sw params for playback: %s\n" +msgstr "" + +#: speaker-test/speaker-test.c:576 +#, c-format +msgid "Unable to set channel map: %s\n" +msgstr "" + +#: speaker-test/speaker-test.c:601 +#, c-format +msgid "Can't recovery from underrun, prepare failed: %s\n" +msgstr "" + +#: speaker-test/speaker-test.c:612 +#, c-format +msgid "Can't recovery from suspend, prepare failed: %s\n" +msgstr "" + +#: speaker-test/speaker-test.c:676 speaker-test/speaker-test.c:1191 +#, c-format +msgid "No enough memory\n" +msgstr "" + +#: speaker-test/speaker-test.c:681 +#, c-format +msgid "Cannot open WAV file %s\n" +msgstr "" + +#: speaker-test/speaker-test.c:685 speaker-test/speaker-test.c:714 +#, c-format +msgid "Invalid WAV file %s\n" +msgstr "" + +#: speaker-test/speaker-test.c:690 +#, c-format +msgid "Not a WAV file: %s\n" +msgstr "" + +#: speaker-test/speaker-test.c:694 +#, c-format +msgid "Unsupported WAV format %d for %s\n" +msgstr "" + +#: speaker-test/speaker-test.c:699 +#, c-format +msgid "%s is not a mono stream (%d channels)\n" +msgstr "" + +#: speaker-test/speaker-test.c:704 +#, c-format +msgid "Sample rate doesn't match (%d) for %s\n" +msgstr "" + +#: speaker-test/speaker-test.c:709 +#, c-format +msgid "Unsupported sample format bits %d for %s\n" +msgstr "" + +#: speaker-test/speaker-test.c:770 +#, c-format +msgid "Undefined channel %d\n" +msgstr "" + +#: speaker-test/speaker-test.c:821 +#, c-format +msgid "Write error: %d,%s\n" +msgstr "" + +#: speaker-test/speaker-test.c:823 +#, c-format +msgid "xrun_recovery failed: %d,%s\n" +msgstr "" + +#: speaker-test/speaker-test.c:926 +#, c-format +msgid "" +"Usage: speaker-test [OPTION]... \n" +"-h,--help\thelp\n" +"-D,--device\tplayback device\n" +"-r,--rate\tstream rate in Hz\n" +"-c,--channels\tcount of channels in stream\n" +"-f,--frequency\tsine wave frequency in Hz\n" +"-F,--format\tsample format\n" +"-b,--buffer\tring buffer size in us\n" +"-p,--period\tperiod size in us\n" +"-P,--nperiods\tnumber of periods\n" +"-t,--test\tpink=use pink noise, sine=use sine wave, wav=WAV file\n" +"-l,--nloops\tspecify number of loops to test, 0 = infinite\n" +"-s,--speaker\tsingle speaker test. Values 1=Left, 2=right, etc\n" +"-w,--wavfile\tUse the given WAV file as a test sound\n" +"-W,--wavdir\tSpecify the directory containing WAV files\n" +"-m,--chmap\tSpecify the channel map to override\n" +"-X,--force-frequency\tforce frequencies outside the 30-8000hz range\n" +"-S,--scale\tScale of generated test tones in percent (default=80)\n" +"\n" +msgstr "" + +#: speaker-test/speaker-test.c:1058 +#, c-format +msgid "Invalid number of periods %d\n" +msgstr "" + +#: speaker-test/speaker-test.c:1074 speaker-test/speaker-test.c:1078 +#, c-format +msgid "Invalid test type %s\n" +msgstr "" + +#: speaker-test/speaker-test.c:1111 +#, c-format +msgid "Unknown option '%c'\n" +msgstr "" + +#: speaker-test/speaker-test.c:1125 +#, c-format +msgid "Invalid parameter for -s option.\n" +msgstr "" + +#: speaker-test/speaker-test.c:1140 +#, c-format +msgid "Playback device is %s\n" +msgstr "" + +#: speaker-test/speaker-test.c:1141 +#, c-format +msgid "Stream parameters are %iHz, %s, %i channels\n" +msgstr "" + +#: speaker-test/speaker-test.c:1144 +#, c-format +msgid "Using 16 octaves of pink noise\n" +msgstr "" + +#: speaker-test/speaker-test.c:1147 +#, c-format +msgid "Sine wave rate is %.4fHz\n" +msgstr "" + +#: speaker-test/speaker-test.c:1150 +#, c-format +msgid "WAV file(s)\n" +msgstr "" + +#: speaker-test/speaker-test.c:1160 +#, c-format +msgid "Playback open error: %d,%s\n" +msgstr "" + +#: speaker-test/speaker-test.c:1166 +#, c-format +msgid "Setting of hwparams failed: %s\n" +msgstr "" + +#: speaker-test/speaker-test.c:1170 +#, c-format +msgid "Setting of swparams failed: %s\n" +msgstr "" + +#: speaker-test/speaker-test.c:1216 speaker-test/speaker-test.c:1238 +#, c-format +msgid "Transfer failed: %s\n" +msgstr "" + +#: speaker-test/speaker-test.c:1224 +#, c-format +msgid "Time per period = %lf\n" +msgstr "" diff --git a/po/boldquot.sed b/po/boldquot.sed new file mode 100644 index 0000000..4b937aa --- /dev/null +++ b/po/boldquot.sed @@ -0,0 +1,10 @@ +s/"\([^"]*\)"/“\1”/g +s/`\([^`']*\)'/‘\1’/g +s/ '\([^`']*\)' / ‘\1’ /g +s/ '\([^`']*\)'$/ ‘\1’/g +s/^'\([^`']*\)' /‘\1’ /g +s/“”/""/g +s/“/“/g +s/”/”/g +s/‘/‘/g +s/’/’/g diff --git a/po/de.gmo b/po/de.gmo new file mode 100644 index 0000000..2970bfd Binary files /dev/null and b/po/de.gmo differ diff --git a/po/de.po b/po/de.po new file mode 100644 index 0000000..ac3b91a --- /dev/null +++ b/po/de.po @@ -0,0 +1,1710 @@ +# German translations for the alsa-utils package. +# Copyright (C) 2009 The ALSA Team +# This file is distributed under the same license as the alsa-utils package. +# Clemens Ladisch , 2009. +# +msgid "" +msgstr "" +"Project-Id-Version: alsa-utils 1.0.23\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2020-10-15 11:46+0000\n" +"PO-Revision-Date: 2010-11-09 21:12+0100\n" +"Last-Translator: Clemens Ladisch \n" +"Language-Team: German\n" +"Language: de\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: alsamixer/card_select.c:77 alsamixer/device_name.c:127 +msgid "Sound Card" +msgstr "Soundkarte" + +#: alsamixer/card_select.c:115 +msgid "(default)" +msgstr "(Standard)" + +#: alsamixer/card_select.c:125 +msgid "cannot enumerate sound cards" +msgstr "Fehler beim Aufzählen der Soundkarten" + +#: alsamixer/card_select.c:147 +msgid "enter device name..." +msgstr "Gerätenamen eingeben..." + +#: alsamixer/cli.c:43 +msgid "Usage: alsamixer [options]" +msgstr "Verwendung: alsamixer [Optionen]" + +#: alsamixer/cli.c:44 +#, fuzzy +msgid "" +"Useful options:\n" +" -h, --help this help\n" +" -c, --card=NUMBER sound card number or id\n" +" -D, --device=NAME mixer device name\n" +" -m, --mouse enable mouse\n" +" -M, --no-mouse disable mouse\n" +" -f, --config=FILE configuration file\n" +" -F, --no-config do not load configuration file\n" +" -V, --view=MODE starting view mode: playback/capture/all" +msgstr "" +"Optionen:\n" +" -h, --help Hilfe\n" +" -c, --card=NUMMER Soundkarten-Nummer oder -ID\n" +" -D, --device=NAME Mixer-Gerätename\n" +" -V, --view=MODUS Ansicht beim Starten: playback=Wiedergabe, " +"capture=Aufnahme, all=alle" + +#: alsamixer/cli.c:53 +msgid "" +"Debugging options:\n" +" -g, --no-color toggle using of colors\n" +" -a, --abstraction=NAME mixer abstraction level: none/basic" +msgstr "" +"Debugging-Optionen:\n" +" -g, --no-color keine Farben\n" +" -a, --abstraction=NAME Mixer-Abstraktion: none/basic" + +#: alsamixer/cli.c:88 +#, c-format +msgid "invalid card index: %s\n" +msgstr "ungültige Karten-Nummer: %s\n" + +#: alsamixer/cli.c:126 +#, c-format +msgid "unknown abstraction level: %s\n" +msgstr "unbekannte Abstraktion: %s\n" + +#: alsamixer/cli.c:131 +#, c-format +msgid "unknown option: %c\n" +msgstr "unbekannte Option: %c\n" + +#: alsamixer/cli.c:133 +msgid "try `alsamixer --help' for more information\n" +msgstr "siehe `alsamixer --help' für mehr Informationen\n" + +#: alsamixer/device_name.c:177 +msgid "Device name:" +msgstr "Gerätename:" + +#: alsamixer/die.c:37 +#, c-format +msgid "%s: %s\n" +msgstr "%s: %s\n" + +#: alsamixer/mixer_display.c:99 +msgid "Card:" +msgstr "Gerät:" + +#: alsamixer/mixer_display.c:100 +msgid "Chip:" +msgstr "Chip:" + +#: alsamixer/mixer_display.c:101 +msgid "View:" +msgstr "Ansicht:" + +#: alsamixer/mixer_display.c:102 +msgid "Item:" +msgstr "Element:" + +#: alsamixer/mixer_display.c:105 +msgid "F1: Help" +msgstr "F1: Hilfe" + +#: alsamixer/mixer_display.c:106 +msgid "F2: System information" +msgstr "F2: System-Informationen" + +#: alsamixer/mixer_display.c:107 +msgid "F6: Select sound card" +msgstr "F6: Soundkarte auswählen" + +#: alsamixer/mixer_display.c:108 +msgid "Esc: Exit" +msgstr "Esc: Beenden" + +#: alsamixer/mixer_display.c:179 +msgid "(unplugged)" +msgstr "(entfernt)" + +#: alsamixer/mixer_display.c:197 +msgid "Playback" +msgstr "Wiedergabe" + +#: alsamixer/mixer_display.c:198 +msgid "Capture" +msgstr "Aufnahme" + +#: alsamixer/mixer_display.c:199 +msgid "All" +msgstr "Alle" + +#: alsamixer/mixer_display.c:240 +msgid "mute" +msgstr "stumm" + +#: alsamixer/mixer_display.c:281 alsamixer/mixer_display.c:291 +msgid "dB gain:" +msgstr "dB-Änderung:" + +#: alsamixer/mixer_display.c:291 +#, c-format +msgid " [%s %s, %s]" +msgstr " [%s %s; %s]" + +#: alsamixer/mixer_display.c:300 alsamixer/mixer_display.c:306 +#: alsamixer/mixer_display.c:312 alsamixer/mixer_display.c:318 +msgid "Off" +msgstr "Aus" + +#: alsamixer/mixer_display.c:306 alsamixer/mixer_display.c:318 +msgid "On" +msgstr "An" + +#: alsamixer/mixer_display.c:370 +msgid "The sound device was unplugged." +msgstr "Das Gerät wurde entfernt." + +#: alsamixer/mixer_display.c:371 +msgid "Press F6 to select another sound card." +msgstr "Drücken Sie F6, um eine andere Soundkarte auszuwählen." + +#: alsamixer/mixer_display.c:386 +msgid "This sound device does not have any playback controls." +msgstr "Dieses Gerät hat keine Wiedergabe-Regler." + +#: alsamixer/mixer_display.c:388 +msgid "This sound device does not have any capture controls." +msgstr "Dieses Gerät hat keine Aufnahme-Regler." + +#: alsamixer/mixer_display.c:390 +msgid "This sound device does not have any controls." +msgstr "Dieses Gerät hat keine Regler." + +#. TRANSLATORS: playback on; one character +#: alsamixer/mixer_display.c:523 alsamixer/mixer_display.c:528 +msgid "O" +msgstr "O" + +#. TRANSLATORS: playback muted; one character +#: alsamixer/mixer_display.c:525 alsamixer/mixer_display.c:529 +msgid "M" +msgstr "M" + +#. TRANSLATORS: "left"; no more than two characters +#: alsamixer/mixer_display.c:545 +msgid "L" +msgstr "L" + +#. TRANSLATORS: "right"; no more than two characters +#: alsamixer/mixer_display.c:551 +msgid "R" +msgstr "R" + +#. TRANSLATORS: no more than eight characters +#: alsamixer/mixer_display.c:555 +msgid "CAPTURE" +msgstr "AUFNAHME" + +#: alsamixer/mixer_display.c:611 +msgid "Front" +msgstr "Vorne" + +#: alsamixer/mixer_display.c:614 +msgid "Rear" +msgstr "Hinten" + +#: alsamixer/mixer_display.c:617 speaker-test/speaker-test.c:124 +msgid "Center" +msgstr "Mitte" + +#: alsamixer/mixer_display.c:620 +msgid "Woofer" +msgstr "Bass" + +#: alsamixer/mixer_display.c:623 +msgid "Side" +msgstr "Seiten" + +#: alsamixer/mixer_widget.c:91 alsamixer/mixer_widget.c:96 +msgid "cannot open mixer" +msgstr "Fehler beim Öffen des Mixer-Gerätes" + +#: alsamixer/mixer_widget.c:102 alsamixer/mixer_widget.c:179 +msgid "cannot load mixer controls" +msgstr "Fehler beim Laden der Mixer-Regler" + +#: alsamixer/mixer_widget.c:169 +#, c-format +msgid "Cannot open mixer device '%s'." +msgstr "Fehler beim Öffnen des Mixer-Gerätes '%s'." + +#: alsamixer/mixer_widget.c:190 +msgid "Esc Exit" +msgstr "Esc Beenden" + +#: alsamixer/mixer_widget.c:191 +msgid "F1 ? H Help" +msgstr "F1 ? H Hilfe" + +#: alsamixer/mixer_widget.c:192 +msgid "F2 / System information" +msgstr "F2 / System-Informationen" + +#: alsamixer/mixer_widget.c:193 +msgid "F3 Show playback controls" +msgstr "F3 Ansicht Wiedergabe-Regler" + +#: alsamixer/mixer_widget.c:194 +msgid "F4 Show capture controls" +msgstr "F4 Ansicht Aufnahme-Regler" + +#: alsamixer/mixer_widget.c:195 +msgid "F5 Show all controls" +msgstr "F5 Ansicht alle Regler" + +#: alsamixer/mixer_widget.c:196 +msgid "Tab Toggle view mode (F3/F4/F5)" +msgstr "Tab Ansichts-Modus umschalten (F3/F4/F5)" + +#: alsamixer/mixer_widget.c:197 +msgid "F6 S Select sound card" +msgstr "F6 S Soundkarte auswählen" + +#: alsamixer/mixer_widget.c:198 +msgid "L Redraw screen" +msgstr "L Bildschirm neu darstellen" + +#: alsamixer/mixer_widget.c:200 +msgid "Left Move to the previous control" +msgstr "Links gehe zum vorherigen Regler" + +#: alsamixer/mixer_widget.c:201 +msgid "Right Move to the next control" +msgstr "Rechts gehe zum nächsten Regler" + +#: alsamixer/mixer_widget.c:203 +msgid "Up/Down Change volume" +msgstr "Oben/Unten Lautstärke ändern" + +#: alsamixer/mixer_widget.c:204 +msgid "+ - Change volume" +msgstr "+ - Lautstärke ändern" + +#: alsamixer/mixer_widget.c:205 +msgid "Page Up/Dn Change volume in big steps" +msgstr "Bild ^/v Lautstärke in großen Schritten ändern" + +#: alsamixer/mixer_widget.c:206 +msgid "End Set volume to 0%" +msgstr "Ende Lautstärke auf 0% setzen" + +#: alsamixer/mixer_widget.c:207 +msgid "0-9 Set volume to 0%-90%" +msgstr "0-9 Lautstärke auf 0%-90% setzen" + +#: alsamixer/mixer_widget.c:208 +msgid "Q W E Increase left/both/right volumes" +msgstr "Q W E linke/beide/rechte Lautstärke erhöhen" + +#. TRANSLATORS: or Y instead of Z +#: alsamixer/mixer_widget.c:210 +msgid "Z X C Decrease left/both/right volumes" +msgstr "Y X C linke/beide/rechte Lautstärke verringern" + +#: alsamixer/mixer_widget.c:211 +msgid "B Balance left and right volumes" +msgstr "B linke und rechte Lautstärke angleichen" + +#: alsamixer/mixer_widget.c:213 +msgid "M Toggle mute" +msgstr "M stumm umschalten" + +#. TRANSLATORS: or , . +#: alsamixer/mixer_widget.c:215 +msgid "< > Toggle left/right mute" +msgstr ", . stumm links/rechts umschalten" + +#: alsamixer/mixer_widget.c:217 +msgid "Space Toggle capture" +msgstr "Leertaste Aufnahme umschalten" + +#. TRANSLATORS: or Insert Delete +#: alsamixer/mixer_widget.c:219 +msgid "; ' Toggle left/right capture" +msgstr "Einfg Entf Aufnahme links/rechts umschalten" + +#: alsamixer/mixer_widget.c:221 +msgid "Authors:" +msgstr "Autoren:" + +#: alsamixer/mixer_widget.c:222 +msgid " Tim Janik" +msgstr " Tim Janik" + +#: alsamixer/mixer_widget.c:223 +msgid " Jaroslav Kysela " +msgstr " Jaroslav Kysela " + +#: alsamixer/mixer_widget.c:224 +msgid " Clemens Ladisch " +msgstr " Clemens Ladisch " + +#: alsamixer/mixer_widget.c:226 +msgid "Help" +msgstr "Hilfe" + +#: alsamixer/proc_files.c:56 +msgid "Select File" +msgstr "Datei wählen" + +#: alsamixer/textbox.c:51 alsamixer/textbox.c:65 +msgid "Error" +msgstr "Fehler" + +#: alsamixer/textbox.c:80 +#, c-format +msgid "Cannot open file \"%s\"." +msgstr "Fehler beim Öffnen der Datei \"%s\"." + +#: aplay/aplay.c:180 +msgid "raw data" +msgstr "Rohdaten" + +#: aplay/aplay.c:181 +msgid "VOC" +msgstr "VOC" + +#: aplay/aplay.c:183 +msgid "WAVE" +msgstr "WAVE" + +#: aplay/aplay.c:184 +msgid "Sparc Audio" +msgstr "Sparc-Audio" + +#: aplay/aplay.c:205 +#, fuzzy, c-format +msgid "" +"Usage: %s [OPTION]... [FILE]...\n" +"\n" +"-h, --help help\n" +" --version print current version\n" +"-l, --list-devices list all soundcards and digital audio devices\n" +"-L, --list-pcms list device names\n" +"-D, --device=NAME select PCM by name\n" +"-q, --quiet quiet mode\n" +"-t, --file-type TYPE file type (voc, wav, raw or au)\n" +"-c, --channels=# channels\n" +"-f, --format=FORMAT sample format (case insensitive)\n" +"-r, --rate=# sample rate\n" +"-d, --duration=# interrupt after # seconds\n" +"-s, --samples=# interrupt after # samples per channel\n" +"-M, --mmap mmap stream\n" +"-N, --nonblock nonblocking mode\n" +"-F, --period-time=# distance between interrupts is # microseconds\n" +"-B, --buffer-time=# buffer duration is # microseconds\n" +" --period-size=# distance between interrupts is # frames\n" +" --buffer-size=# buffer duration is # frames\n" +"-A, --avail-min=# min available space for wakeup is # microseconds\n" +"-R, --start-delay=# delay for automatic PCM start is # microseconds \n" +" (relative to buffer size if <= 0)\n" +"-T, --stop-delay=# delay for automatic PCM stop is # microseconds from " +"xrun\n" +"-v, --verbose show PCM structure and setup (accumulative)\n" +"-V, --vumeter=TYPE enable VU meter (TYPE: mono or stereo)\n" +"-I, --separate-channels one file for each channel\n" +"-i, --interactive allow interactive operation from stdin\n" +"-m, --chmap=ch1,ch2,.. Give the channel map to override or follow\n" +" --disable-resample disable automatic rate resample\n" +" --disable-channels disable automatic channel conversions\n" +" --disable-format disable automatic format conversions\n" +" --disable-softvol disable software volume control (softvol)\n" +" --test-position test ring buffer position\n" +" --test-coef=# test coefficient for ring buffer position (default " +"8)\n" +" expression for validation is: coef * (buffer_size / " +"2)\n" +" --test-nowait do not wait for ring buffer - eats whole CPU\n" +" --max-file-time=# start another output file when the old file has " +"recorded\n" +" for this many seconds\n" +" --process-id-file write the process ID here\n" +" --use-strftime apply the strftime facility to the output file name\n" +" --dump-hw-params dump hw_params of the device\n" +" --fatal-errors treat all errors as fatal\n" +msgstr "" +"Verwendung: %s [Option]... [Datei]...\n" +"\n" +"-h, --help Hilfe\n" +" --version Version anzeigen\n" +"-l, --list-devices alle Soundkarten und -Geräte auflisten\n" +"-L, --list-pcms ALSA-Gerätenamen auflisten\n" +"-D, --device=NAME PCM-Gerät wählen\n" +"-q, --quiet weniger Programmausgaben\n" +"-t, --file-type TYP Dateityp (voc, wav, raw oder au)\n" +"-c, --channels=# Kanäle\n" +"-f, --format=FORMAT Sample-Format\n" +"-r, --rate=# Sample-Rate\n" +"-d, --duration=# Beenden nach # Sekunden\n" +"-M, --mmap mmap-Modus\n" +"-N, --nonblock nonblocking-Modus\n" +"-F, --period-time=# Abstand zwischen Interrupts ist # µs\n" +"-B, --buffer-time=# Puffer-Länge ist # µs\n" +" --period-size=# Abstand zwischen Interrupts ist # Frames\n" +" --buffer-size=# Puffer-Länge ist # Frames\n" +"-A, --avail-min=# freier Pufferspeicher für Wakeup ist # µs\n" +"-R, --start-delay=# Puffer-Füllgrad zum automatischen PCM-Start, in µs\n" +" (wenn <= 0, freier Puffer-Speicher)\n" +"-T, --stop-delay=# Zeit vor xrun zum automatischen PCM-Stop, in µs\n" +"-v, --verbose zeige PCM-Struktur und -Konfiguration (akkumulativ)\n" +"-V, --vumeter=TYP VU-Anzeige (TYP: mono oder stereo)\n" +"-I, --separate-channels eine Datei pro Kanal\n" +" --disable-resample keine automatische Sample-Rate-Anpassung\n" +" --disable-channels keine automatische Kanal-Anzahl-Anpassung\n" +" --disable-format keine automatische Format-Anpassung\n" +" --disable-softvol kein Software-Lautstärke-Regler (softvol)\n" +" --test-position überprüfe Position im Ring-Puffer\n" +" --test-coef=# Test-Koeffizient für Positionsprüfung (Standard 8)\n" +" Formel für Prüfung ist: Koeffizient * (Puffergröße / " +"2)\n" +" --test-nowait kein Warten auf Ringpuffer; beansprucht volle CPU-" +"Leistung\n" +" --max-file-time=# erzeuge mehrere Dateien; Wechsel nach # Sekunden\n" +" --process-id-file=# schreibe Prozess-ID in diese Datei\n" +" --use-strftime formatiere Dateiname mit strftime; %%v=Dateinummer\n" + +#: aplay/aplay.c:250 speaker-test/speaker-test.c:945 +#, c-format +msgid "Recognized sample formats are:" +msgstr "Unterstützte Sample-Formate:" + +#: aplay/aplay.c:256 +#, c-format +msgid "" +"\n" +"Some of these may not be available on selected hardware\n" +msgstr "" +"\n" +"Nicht alle davon sind auf jeder Hardware verfügbar.\n" + +#: aplay/aplay.c:257 +#, fuzzy, c-format +msgid "The available format shortcuts are:\n" +msgstr "Unterstütze Format-Abkürzungen:\n" + +#: aplay/aplay.c:258 +#, c-format +msgid "-f cd (16 bit little endian, 44100, stereo)\n" +msgstr "-f cd (16 Bits, Little Endian, 44100 Hz, stereo)\n" + +#: aplay/aplay.c:259 +#, c-format +msgid "-f cdr (16 bit big endian, 44100, stereo)\n" +msgstr "-f cdr (16 Bits, Big Endian, 44100 Hz, stereo)\n" + +#: aplay/aplay.c:260 +#, c-format +msgid "-f dat (16 bit little endian, 48000, stereo)\n" +msgstr "-f dat (16 Bits, Little Endian, 48000 Hz, stereo)\n" + +#: aplay/aplay.c:274 +msgid "no soundcards found..." +msgstr "keine Soundkarten gefunden ..." + +#: aplay/aplay.c:277 +#, c-format +msgid "**** List of %s Hardware Devices ****\n" +msgstr "**** Liste der Hardware-Geräte (%s) ****\n" + +#: aplay/aplay.c:306 +#, c-format +msgid "card %i: %s [%s], device %i: %s [%s]\n" +msgstr "Karte %i: %s [%s], Gerät %i: %s [%s]\n" + +#: aplay/aplay.c:312 +#, c-format +msgid " Subdevices: %i/%i\n" +msgstr " Sub-Geräte: %i/%i\n" + +#: aplay/aplay.c:319 +#, c-format +msgid " Subdevice #%i: %s\n" +msgstr " Sub-Gerät #%i: %s\n" + +#: aplay/aplay.c:400 +#, c-format +msgid "Aborted by signal %s...\n" +msgstr "Abbruch durch Signal %s ...\n" + +#: aplay/aplay.c:555 +msgid "command should be named either arecord or aplay" +msgstr "Befehl sollte arecord oder aplay sein" + +#: aplay/aplay.c:599 +#, c-format +msgid "unrecognized file format %s" +msgstr "unbekanntes Dateiformat %s" + +#: aplay/aplay.c:606 +#, fuzzy, c-format +msgid "invalid channels argument '%s'" +msgstr "ungültige Sender-Adresse %s\n" + +#: aplay/aplay.c:610 +#, c-format +msgid "value %i for channels is invalid" +msgstr "Kanalanzahl %i ist ungültig" + +#: aplay/aplay.c:629 +#, c-format +msgid "wrong extended format '%s'" +msgstr "erweitertes Format '%s' ist ungültig" + +#: aplay/aplay.c:637 +#, fuzzy, c-format +msgid "invalid rate argument '%s'" +msgstr "ungültige Quell-Adresse %s\n" + +#: aplay/aplay.c:644 +#, c-format +msgid "bad speed value %i" +msgstr "ungültige Rate %i" + +#: aplay/aplay.c:650 +msgid "duration and samples arguments cannot be used together" +msgstr "" + +#: aplay/aplay.c:655 +#, fuzzy, c-format +msgid "invalid duration argument '%s'" +msgstr "ungültige Ziel-Adresse %s\n" + +#: aplay/aplay.c:662 +msgid "samples and duration arguments cannot be used together" +msgstr "" + +#: aplay/aplay.c:667 +#, fuzzy, c-format +msgid "invalid samples argument '%s'" +msgstr "ungültige Sender-Adresse %s\n" + +#: aplay/aplay.c:679 +#, fuzzy, c-format +msgid "invalid period time argument '%s'" +msgstr "ungültige Sender-Adresse %s\n" + +#: aplay/aplay.c:686 +#, fuzzy, c-format +msgid "invalid buffer time argument '%s'" +msgstr "ungültige Quell-Adresse %s\n" + +#: aplay/aplay.c:693 +#, fuzzy, c-format +msgid "invalid period size argument '%s'" +msgstr "ungültige Sender-Adresse %s\n" + +#: aplay/aplay.c:700 +#, fuzzy, c-format +msgid "invalid buffer size argument '%s'" +msgstr "ungültige Quell-Adresse %s\n" + +#: aplay/aplay.c:707 +#, c-format +msgid "invalid min available space argument '%s'" +msgstr "" + +#: aplay/aplay.c:714 +#, fuzzy, c-format +msgid "invalid start delay argument '%s'" +msgstr "ungültige Sender-Adresse %s\n" + +#: aplay/aplay.c:721 +#, fuzzy, c-format +msgid "invalid stop delay argument '%s'" +msgstr "ungültige Sender-Adresse %s\n" + +#: aplay/aplay.c:776 +#, fuzzy, c-format +msgid "invalid test coef argument '%s'" +msgstr "ungültige Quell-Adresse %s\n" + +#: aplay/aplay.c:788 +#, c-format +msgid "invalid max file time argument '%s'" +msgstr "" + +#: aplay/aplay.c:808 speaker-test/speaker-test.c:571 +#, fuzzy, c-format +msgid "Unable to parse channel map string: %s\n" +msgstr "Fehler beim Setzen des Mindest-verfügbar-Wertes: %s\n" + +#: aplay/aplay.c:814 +#, c-format +msgid "Try `%s --help' for more information.\n" +msgstr "Siehe `%s --help' für mehr Informationen.\n" + +#: aplay/aplay.c:830 +#, c-format +msgid "audio open error: %s" +msgstr "Fehler beim Öffnen des Gerätes: %s" + +#: aplay/aplay.c:835 +#, c-format +msgid "info error: %s" +msgstr "Fehler beim Lesen der Geräteinformationen: %s" + +#: aplay/aplay.c:842 +#, c-format +msgid "nonblock setting error: %s" +msgstr "Fehler beim Setzen des nonblock-Modus: %s" + +#: aplay/aplay.c:852 aplay/aplay.c:976 aplay/aplay.c:1266 aplay/aplay.c:1466 +#: aplay/aplay.c:1986 aplay/aplay.c:2016 +msgid "not enough memory" +msgstr "nicht genug Speicher" + +#: aplay/aplay.c:876 +#, c-format +msgid "Cannot create process ID file %s: %s" +msgstr "Fehler beim Schreiben der Prozess-ID-Datei %s: %s" + +#: aplay/aplay.c:966 +#, c-format +msgid "read error (called from line %i)" +msgstr "Lesefehler (aufgerufen von Zeile %i)" + +#: aplay/aplay.c:1033 +#, c-format +msgid "unknown length of 'fmt ' chunk (read %u, should be %u at least)" +msgstr "" +"unbekannte Länge des 'fmt '-Blocks (gelesen: %u, sollte mindestens %u sein)" + +#: aplay/aplay.c:1044 +#, c-format +msgid "" +"unknown length of extensible 'fmt ' chunk (read %u, should be %u at least)" +msgstr "" +"unbekannte Länge des erweiterten 'fmt '-Blocks (gelesen: %u, sollte " +"mindestens %u sein)" + +#: aplay/aplay.c:1049 +msgid "wrong format tag in extensible 'fmt ' chunk" +msgstr "ungültiger Format-Wert im erweiterten 'fmt '-Block" + +#: aplay/aplay.c:1056 +#, c-format +msgid "can't play WAVE-file format 0x%04x which is not PCM or FLOAT encoded" +msgstr "" +"kann WAVE-Datei-Format 0x%04x nicht abspielen; ist weder PCM noch FLOAT" + +#: aplay/aplay.c:1061 +#, c-format +msgid "can't play WAVE-files with %d tracks" +msgstr "kann WAVE-Datei mit %d Kanälen nicht abspielen" + +#: aplay/aplay.c:1069 aplay/aplay.c:1195 +#, c-format +msgid "Warning: format is changed to U8\n" +msgstr "Warnung: benutztes Format ist U8\n" + +#: aplay/aplay.c:1079 aplay/aplay.c:1092 aplay/aplay.c:1103 +#, fuzzy, c-format +msgid "Warning: format is changed to %s\n" +msgstr "Warnung: benutztes Format ist U8\n" + +#: aplay/aplay.c:1108 +#, c-format +msgid "" +" can't play WAVE-files with sample %d bits in %d bytes wide (%d channels)" +msgstr "" +"kann WAVE-Datei mit %d-Bit-Samples in %d Bytes (%d Kanäle) nicht abspielen" + +#: aplay/aplay.c:1131 +#, c-format +msgid " can't play WAVE-files with sample %d bits wide" +msgstr "kann WAVE-Datei mit %d-Bit-Samples nicht abspielen" + +#: aplay/aplay.c:1189 +#, c-format +msgid "Warning: format is changed to MU_LAW\n" +msgstr "Warnung: benutztes Format ist MU_LAW\n" + +#: aplay/aplay.c:1201 +#, c-format +msgid "Warning: format is changed to S16_BE\n" +msgstr "Warnung: benutztes Format ist S16_BE\n" + +#: aplay/aplay.c:1214 aplay/aplay.c:2307 aplay/aplay.c:2314 aplay/aplay.c:2839 +msgid "read error" +msgstr "Lesefehler" + +#: aplay/aplay.c:1244 +msgid "Channel numbers don't match between hw_params and channel map" +msgstr "" + +#: aplay/aplay.c:1253 +#, c-format +msgid "Warning: unable to get channel map\n" +msgstr "" + +#: aplay/aplay.c:1287 +#, c-format +msgid "Channel %d doesn't match with hw_params" +msgstr "" + +#: aplay/aplay.c:1314 +msgid "Broken configuration for this PCM: no configurations available" +msgstr "" +"ungültige Konfiguration für dieses Gerät: keine unterstützte Konfiguration" + +#: aplay/aplay.c:1318 +#, c-format +msgid "HW Params of device \"%s\":\n" +msgstr "" + +#: aplay/aplay.c:1338 +msgid "Access type not available" +msgstr "Zugriffs-Modus nicht unterstützt" + +#: aplay/aplay.c:1343 +msgid "Sample format non available" +msgstr "Sample-Format nicht unterstützt" + +#: aplay/aplay.c:1349 +msgid "Channels count non available" +msgstr "Kanalanzahl nicht unterstützt" + +#: aplay/aplay.c:1364 +#, c-format +msgid "Warning: rate is not accurate (requested = %iHz, got = %iHz)\n" +msgstr "" +"Warnung: Rate ist nicht exakt (angefordert: %i Hz, unterstützt: %i Hz)\n" + +#: aplay/aplay.c:1370 +#, c-format +msgid " please, try the plug plugin %s\n" +msgstr " probieren Sie bitte das plug-Plugin: %s\n" + +#: aplay/aplay.c:1407 +msgid "Unable to install hw params:" +msgstr "Fehler beim Setzen der Hardware-Parameter:" + +#: aplay/aplay.c:1414 +#, c-format +msgid "Can't use period equal to buffer size (%lu == %lu)" +msgstr "Periode gleich der Puffer-Größe wird nicht unterstützt (%lu == %lu)" + +#: aplay/aplay.c:1420 +#, fuzzy +msgid "Unable to get current sw params." +msgstr "Fehler beim Setzen der Software-Parameter:" + +#: aplay/aplay.c:1449 +msgid "unable to install sw params:" +msgstr "Fehler beim Setzen der Software-Parameter:" + +#: aplay/aplay.c:1484 +#, c-format +msgid "snd_pcm_mmap_begin problem: %s" +msgstr "Fehler bei snd_pcm_mmap_begin: %s" + +#: aplay/aplay.c:1513 +#, c-format +msgid "stdin O_NONBLOCK flag setup failed\n" +msgstr "Fehler beim Setzen von O_NONBLOCK in stdin\n" + +#: aplay/aplay.c:1537 +#, c-format +msgid "\rPAUSE command ignored (no hw support)\n" +msgstr "\rPause-Kommando ignoriert (keine HW-Unterstützung)\n" + +#: aplay/aplay.c:1545 +#, c-format +msgid "pause push error: %s" +msgstr "Fehler beim Pausieren: %s" + +#: aplay/aplay.c:1556 +#, c-format +msgid "pause release error: %s" +msgstr "Fehler beim Beenden der Pause: %s" + +#: aplay/aplay.c:1572 +#, c-format +msgid "" +"\r=== PAUSE === " +msgstr "" +"\r=== PAUSE === " + +#: aplay/aplay.c:1614 +#, c-format +msgid "status error: %s" +msgstr "Status-Fehler: %s" + +#: aplay/aplay.c:1619 +#, fuzzy, c-format +msgid "fatal %s: %s" +msgstr "%s: %s\n" + +#: aplay/aplay.c:1620 aplay/aplay.c:1631 aplay/aplay.c:1634 aplay/aplay.c:1642 +msgid "underrun" +msgstr "Unterlauf" + +#: aplay/aplay.c:1620 aplay/aplay.c:1631 aplay/aplay.c:1642 +msgid "overrun" +msgstr "Überlauf" + +#: aplay/aplay.c:1630 aplay/aplay.c:1641 +#, c-format +msgid "%s!!! (at least %.3f ms long)\n" +msgstr "%s!!! (mindestens %.3f ms)\n" + +#: aplay/aplay.c:1646 +#, c-format +msgid "Status:\n" +msgstr "Status:\n" + +#: aplay/aplay.c:1650 +#, c-format +msgid "xrun: prepare error: %s" +msgstr "Unter-/Überlauf: Fehler beim Re-Initialisieren des Gerätes: %s" + +#: aplay/aplay.c:1656 +#, c-format +msgid "Status(DRAINING):\n" +msgstr "Status (DRAINING):\n" + +#: aplay/aplay.c:1660 +#, c-format +msgid "capture stream format change? attempting recover...\n" +msgstr "Format-Wechsel der Aufnahme-Daten? Versuche Wiederherstellung ...\n" + +#: aplay/aplay.c:1662 +#, c-format +msgid "xrun(DRAINING): prepare error: %s" +msgstr "XRUN (DRAINING): Fehler beim Re-Initialisieren des Gerätes: %s" + +#: aplay/aplay.c:1669 +#, c-format +msgid "Status(R/W):\n" +msgstr "Status (R/W):\n" + +#: aplay/aplay.c:1672 +#, c-format +msgid "read/write error, state = %s" +msgstr "Lese-/Schreibfehler, Status = %s" + +#: aplay/aplay.c:1682 +#, c-format +msgid "Suspended. Trying resume. " +msgstr "Ruhezustand. Versuche, aufzuwecken. " + +#: aplay/aplay.c:1688 +#, c-format +msgid "Failed. Restarting stream. " +msgstr "Fehlgeschlagen. Re-Initialisierung. " + +#: aplay/aplay.c:1691 +#, c-format +msgid "suspend: prepare error: %s" +msgstr "Ruhezustand: Fehler beim Re-Initialisieren: %s" + +#: aplay/aplay.c:1696 +#, c-format +msgid "Done.\n" +msgstr "Fertig.\n" + +#: aplay/aplay.c:1718 +#, c-format +msgid " !clip " +msgstr " !clip " + +#: aplay/aplay.c:1862 +#, c-format +msgid "Unsupported bit size %d.\n" +msgstr "%d-Bit-Samples werden nicht unterstützt.\n" + +#: aplay/aplay.c:1896 +#, c-format +msgid "Max peak (%li samples): 0x%08x " +msgstr "Höchstwert (%li Samples): 0x%08x " + +#: aplay/aplay.c:1930 +#, c-format +msgid "" +"Suspicious buffer position (%li total): avail = %li, delay = %li, buffer = " +"%li\n" +msgstr "" +"verdächtige Puffer-Position (total %li): avail = %li, delay = %li, buffer = " +"%li\n" + +#: aplay/aplay.c:2058 +#, c-format +msgid "write error: %s" +msgstr "Schreibfehler: %s" + +#: aplay/aplay.c:2106 +#, c-format +msgid "writev error: %s" +msgstr "Vektor-Schreib-Fehler: %s" + +#: aplay/aplay.c:2152 +#, c-format +msgid "read error: %s" +msgstr "Lesefehler: %s" + +#: aplay/aplay.c:2199 +#, c-format +msgid "readv error: %s" +msgstr "Vektor-Lese-Fehler: %s" + +#: aplay/aplay.c:2248 +msgid "can't allocate buffer for silence" +msgstr "nicht genug Speicher für Stille-Block" + +#: aplay/aplay.c:2257 aplay/aplay.c:2485 aplay/aplay.c:2490 aplay/aplay.c:2540 +#: aplay/aplay.c:2549 aplay/aplay.c:2556 aplay/aplay.c:2566 aplay/aplay.c:2572 +#: aplay/aplay.c:2644 aplay/aplay.c:2674 aplay/aplay.c:2688 +msgid "write error" +msgstr "Schreibfehler" + +#: aplay/aplay.c:2270 +#, c-format +msgid "voc_pcm_flush - silence error" +msgstr "voc_pcm_flush - Fehler in set_silence" + +#: aplay/aplay.c:2273 +msgid "voc_pcm_flush error" +msgstr "Schreibfehler" + +#: aplay/aplay.c:2298 +msgid "malloc error" +msgstr "nicht genug Speicher" + +#: aplay/aplay.c:2302 +#, c-format +msgid "Playing Creative Labs Channel file '%s'...\n" +msgstr "Spiele Creative Labs Channel-Datei '%s'...\n" + +#: aplay/aplay.c:2370 aplay/aplay.c:2465 +msgid "can't play packed .voc files" +msgstr "kann komprimierte .voc-Dateien nicht abspielen" + +#: aplay/aplay.c:2425 +#, c-format +msgid "can't play loops; %s isn't seekable\n" +msgstr "" +"kann Schleife nicht abspielen; Dateiposition in %s ist nicht änderbar\n" + +#: aplay/aplay.c:2474 +#, c-format +msgid "unknown blocktype %d. terminate." +msgstr "Unbekannter Block-Typ %d. Abbruch." + +#: aplay/aplay.c:2608 +#, c-format +msgid "Wave doesn't support %s format..." +msgstr "Format %s wird in WAVE nicht unterstützt ..." + +#: aplay/aplay.c:2668 +#, c-format +msgid "Sparc Audio doesn't support %s format..." +msgstr "Format %s wird in Sparc-Audio nicht unterstützt ..." + +#: aplay/aplay.c:2743 +msgid "Playing" +msgstr "Wiedergabe:" + +#: aplay/aplay.c:2743 +msgid "Recording" +msgstr "Aufnahme:" + +#: aplay/aplay.c:2747 +#, c-format +msgid "Rate %d Hz, " +msgstr "Rate: %d Hz, " + +#: aplay/aplay.c:2749 +#, c-format +msgid "Mono" +msgstr "mono" + +#: aplay/aplay.c:2751 +#, c-format +msgid "Stereo" +msgstr "stereo" + +#: aplay/aplay.c:2753 +#, c-format +msgid "Channels %i" +msgstr "%i Kanäle" + +#: aplay/aplay.c:3356 +#, fuzzy, c-format +msgid "You need to specify %u files" +msgstr "Es werden %d Dateien benötigt." + +#: aplay/aplay.c:3409 +#, c-format +msgid "You need to specify %d files" +msgstr "Es werden %d Dateien benötigt." + +#: seq/aconnect/aconnect.c:49 +#, c-format +msgid "aconnect - ALSA sequencer connection manager\n" +msgstr "aconnect - ALSA Sequenzer Verbindungs-Manager\n" + +#: seq/aconnect/aconnect.c:50 +#, c-format +msgid "Copyright (C) 1999-2000 Takashi Iwai\n" +msgstr "Copyright © 1999-2000 Takashi Iwai\n" + +#: seq/aconnect/aconnect.c:51 +#, c-format +msgid "Usage:\n" +msgstr "Verwendung:\n" + +#: seq/aconnect/aconnect.c:52 +#, c-format +msgid " * Connection/disconnection between two ports\n" +msgstr " * Verbindung zwischen zwei Ports herstellen/trennen\n" + +#: seq/aconnect/aconnect.c:53 +#, c-format +msgid " aconnect [-options] sender receiver\n" +msgstr " aconnect [Optionen] Sender Empfänger\n" + +#: seq/aconnect/aconnect.c:54 +#, c-format +msgid " sender, receiver = client:port pair\n" +msgstr " Sender, Empfänger = Client:Port\n" + +#: seq/aconnect/aconnect.c:55 +#, c-format +msgid " -d,--disconnect disconnect\n" +msgstr " -d,--disconnect Verbindung trennen\n" + +#: seq/aconnect/aconnect.c:56 +#, c-format +msgid " -e,--exclusive exclusive connection\n" +msgstr " -e,--exclusive exklusive Verbindung\n" + +#: seq/aconnect/aconnect.c:57 +#, c-format +msgid " -r,--real # convert real-time-stamp on queue\n" +msgstr " -r,--real # benutze Zeitstempel der Queue #\n" + +#: seq/aconnect/aconnect.c:58 +#, c-format +msgid " -t,--tick # convert tick-time-stamp on queue\n" +msgstr " -t,--tick # benutze Tick-Zeitstempel der Queue #\n" + +#: seq/aconnect/aconnect.c:59 +#, c-format +msgid " * List connected ports (no subscription action)\n" +msgstr " * Ports und Verbindungen auflisten\n" + +#: seq/aconnect/aconnect.c:60 +#, c-format +msgid " aconnect -i|-o [-options]\n" +msgstr " aconnect -i|-o [Optionen]\n" + +#: seq/aconnect/aconnect.c:61 +#, c-format +msgid " -i,--input list input (readable) ports\n" +msgstr " -i,--input Eingabe-Ports (lesbar) auflisten\n" + +#: seq/aconnect/aconnect.c:62 +#, c-format +msgid " -o,--output list output (writable) ports\n" +msgstr " -o,--output Ausgabe-Ports (schreibbar) auflisten\n" + +#: seq/aconnect/aconnect.c:63 +#, c-format +msgid " -l,--list list current connections of each port\n" +msgstr " -l,--list Verbindungen der Ports auflisten\n" + +#: seq/aconnect/aconnect.c:64 +#, c-format +msgid " * Remove all exported connections\n" +msgstr " * alle Verbindungen trennen\n" + +#: seq/aconnect/aconnect.c:65 +#, c-format +msgid " -x, --removeall\n" +msgstr " -x,--removeall\n" + +#: seq/aconnect/aconnect.c:132 +msgid "Connecting To" +msgstr "verbunden zu" + +#: seq/aconnect/aconnect.c:133 +msgid "Connected From" +msgstr "verbunden von" + +#: seq/aconnect/aconnect.c:171 +#, fuzzy, c-format +msgid "client %d: '%s' [type=%s" +msgstr "Client %d: '%s' [Typ=%s]\n" + +#: seq/aconnect/aconnect.c:175 +msgid "user" +msgstr "User" + +#: seq/aconnect/aconnect.c:175 +msgid "kernel" +msgstr "Kernel" + +#: seq/aconnect/aconnect.c:323 +#, c-format +msgid "can't open sequencer\n" +msgstr "Fehler beim Öffnen des Sequenzers\n" + +#: seq/aconnect/aconnect.c:351 +#, c-format +msgid "can't get client id\n" +msgstr "Fehler beim Lesen der Client-ID\n" + +#: seq/aconnect/aconnect.c:358 +#, c-format +msgid "can't set client info\n" +msgstr "Fehler beim Setzen des Client-Namens\n" + +#: seq/aconnect/aconnect.c:365 +#, c-format +msgid "invalid sender address %s\n" +msgstr "ungültige Sender-Adresse %s\n" + +#: seq/aconnect/aconnect.c:370 seq/aseqnet/aseqnet.c:290 +#, c-format +msgid "invalid destination address %s\n" +msgstr "ungültige Ziel-Adresse %s\n" + +#: seq/aconnect/aconnect.c:384 +#, c-format +msgid "No subscription is found\n" +msgstr "keine Verbindung gefunden\n" + +#: seq/aconnect/aconnect.c:389 +#, c-format +msgid "Disconnection failed (%s)\n" +msgstr "Verbindungs-Trennung fehlgeschlagen (%s)\n" + +#: seq/aconnect/aconnect.c:395 +#, c-format +msgid "Connection is already subscribed\n" +msgstr "Verbindung ist bereits vorhanden\n" + +#: seq/aconnect/aconnect.c:400 +#, c-format +msgid "Connection failed (%s)\n" +msgstr "Verbindung fehlgeschlagen (%s)\n" + +#: seq/aseqnet/aseqnet.c:164 +#, c-format +msgid "aseqnet - network client/server on ALSA sequencer\n" +msgstr "aseqnet - Netzwerk-Client/Server für ALSA Sequenzer\n" + +#: seq/aseqnet/aseqnet.c:165 +#, c-format +msgid " Copyright (C) 1999 Takashi Iwai\n" +msgstr " Copyright © 1999 Takashi Iwai\n" + +#: seq/aseqnet/aseqnet.c:166 +#, c-format +msgid "usage:\n" +msgstr "Verwendung:\n" + +#: seq/aseqnet/aseqnet.c:167 +#, c-format +msgid " server mode: aseqnet [-options]\n" +msgstr " Server-Modus: aseqnet [Optionen]\n" + +#: seq/aseqnet/aseqnet.c:168 +#, c-format +msgid " client mode: aseqnet [-options] server_host\n" +msgstr " Client-Modus: aseqnet [Optionen] ServerHost\n" + +#: seq/aseqnet/aseqnet.c:169 +#, c-format +msgid "options:\n" +msgstr "Optionen:\n" + +#: seq/aseqnet/aseqnet.c:170 +#, fuzzy, c-format +msgid " -p,--port # : specify TCP port (digit or service name)\n" +msgstr " -p,--port # : TCP-Port (Zahl oder Service-Name)\n" + +#: seq/aseqnet/aseqnet.c:171 +#, c-format +msgid " -s,--source addr : read from given addr (client:port)\n" +msgstr " -s,--source # : lese von Sequenzer-Port (Client:Port)\n" + +#: seq/aseqnet/aseqnet.c:172 +#, c-format +msgid " -d,--dest addr : write to given addr (client:port)\n" +msgstr " -d,--dest # : schreibe auf Sequenzer-Port (Client:Port)\n" + +#: seq/aseqnet/aseqnet.c:173 +#, c-format +msgid " -v, --verbose : print verbose messages\n" +msgstr " -v,--verbose : ausführliche Meldungen\n" + +#: seq/aseqnet/aseqnet.c:174 +#, c-format +msgid " -i, --info : print certain received events\n" +msgstr " -i,--info : Ausgabe bestimmter empfangener Ereignisse\n" + +#: seq/aseqnet/aseqnet.c:188 +#, c-format +msgid "can't malloc\n" +msgstr "nicht genug Speicher\n" + +#: seq/aseqnet/aseqnet.c:213 +#, c-format +msgid "closing files..\n" +msgstr "schließe Dateien ...\n" + +#: seq/aseqnet/aseqnet.c:272 +#, c-format +msgid "sequencer opened: %d:%d\n" +msgstr "Sequenzer geöffnet: %d:%d\n" + +#: seq/aseqnet/aseqnet.c:279 +#, c-format +msgid "invalid source address %s\n" +msgstr "ungültige Quell-Adresse %s\n" + +#: seq/aseqnet/aseqnet.c:309 +#, c-format +msgid "service '%s' is not found in /etc/services\n" +msgstr "Service '%s' in /etc/services nicht gefunden\n" + +#: seq/aseqnet/aseqnet.c:377 +#, c-format +msgid "too many connections!\n" +msgstr "zu viele Verbindungen\n" + +#: seq/aseqnet/aseqnet.c:388 +#, c-format +msgid "accepted[%d]\n" +msgstr "angenommen[%d]\n" + +#: seq/aseqnet/aseqnet.c:411 +#, c-format +msgid "can't get address %s\n" +msgstr "kann Adresse für %s nicht bestimmen\n" + +#: seq/aseqnet/aseqnet.c:422 +#, c-format +msgid "ok.. connected\n" +msgstr "OK ... verbunden\n" + +#: seq/aseqnet/aseqnet.c:518 +#, c-format +msgid "Channel %2d: Control event : %5d\n" +msgstr "Channel %2d: Control event : %5d\n" + +#: seq/aseqnet/aseqnet.c:522 +#, c-format +msgid "Channel %2d: Pitchbender : %5d\n" +msgstr "Channel %2d: Pitchbender : %5d\n" + +#: seq/aseqnet/aseqnet.c:526 +#, c-format +msgid "Channel %2d: Note On event : %5d\n" +msgstr "Channel %2d: Note On evenet : %5d\n" + +#: seq/aseqnet/aseqnet.c:530 +#, c-format +msgid "Channel %2d: Note Off event: %5d\n" +msgstr "Channel %2d: Note Off event: %5d\n" + +#: seq/aseqnet/aseqnet.c:585 +#, c-format +msgid "disconnected\n" +msgstr "Verbindung getrennt\n" + +#: speaker-test/speaker-test.c:120 +msgid "Front Left" +msgstr "Vorne links" + +#: speaker-test/speaker-test.c:121 +msgid "Front Right" +msgstr "Vorne rechts" + +#: speaker-test/speaker-test.c:122 +msgid "Rear Left" +msgstr "Hinten links" + +#: speaker-test/speaker-test.c:123 +msgid "Rear Right" +msgstr "Hinten rechts" + +#: speaker-test/speaker-test.c:125 +msgid "LFE" +msgstr "Bass" + +#: speaker-test/speaker-test.c:126 +msgid "Side Left" +msgstr "Seitlich links" + +#: speaker-test/speaker-test.c:127 +msgid "Side Right" +msgstr "Seitlich rechts" + +#: speaker-test/speaker-test.c:128 +msgid "Channel 9" +msgstr "Kanal 9" + +#: speaker-test/speaker-test.c:129 +msgid "Channel 10" +msgstr "Kanal 10" + +#: speaker-test/speaker-test.c:130 +msgid "Channel 11" +msgstr "Kanal 11" + +#: speaker-test/speaker-test.c:131 +msgid "Channel 12" +msgstr "Kanal 12" + +#: speaker-test/speaker-test.c:132 +msgid "Channel 13" +msgstr "Kanal 13" + +#: speaker-test/speaker-test.c:133 +msgid "Channel 14" +msgstr "Kanal 14" + +#: speaker-test/speaker-test.c:134 +msgid "Channel 15" +msgstr "Kanal 15" + +#: speaker-test/speaker-test.c:135 +msgid "Channel 16" +msgstr "Kanal 16" + +#: speaker-test/speaker-test.c:424 +#, c-format +msgid "Broken configuration for playback: no configurations available: %s\n" +msgstr "Ungültige Konfiguration: keine unterstützte Konfiguration: %s\n" + +#: speaker-test/speaker-test.c:431 +#, c-format +msgid "Access type not available for playback: %s\n" +msgstr "Zugriffsmodus nicht unterstützt: %s\n" + +#: speaker-test/speaker-test.c:438 +#, c-format +msgid "Sample format not available for playback: %s\n" +msgstr "Sample-Format nicht unterstützt: %s\n" + +#: speaker-test/speaker-test.c:445 +#, c-format +msgid "Channels count (%i) not available for playbacks: %s\n" +msgstr "Kanal-Anzahl %i nicht unterstützt: %s\n" + +#: speaker-test/speaker-test.c:453 +#, c-format +msgid "Rate %iHz not available for playback: %s\n" +msgstr "Rate %i Hz nicht unterstützt: %s\n" + +#: speaker-test/speaker-test.c:458 +#, c-format +msgid "Rate doesn't match (requested %iHz, get %iHz, err %d)\n" +msgstr "" +"Rate ist nicht exakt (angefordert: %i Hz, unterstützt: %i Hz, Fehlercode " +"%d)\n" + +#: speaker-test/speaker-test.c:462 +#, c-format +msgid "Rate set to %iHz (requested %iHz)\n" +msgstr "Rate ist %i Hz (angefordert: %i Hz)\n" + +#: speaker-test/speaker-test.c:468 +#, c-format +msgid "Buffer size range from %lu to %lu\n" +msgstr "Puffergröße von %lu bis %lu\n" + +#: speaker-test/speaker-test.c:469 +#, c-format +msgid "Period size range from %lu to %lu\n" +msgstr "Periodengröße von %lu bis %lu\n" + +#: speaker-test/speaker-test.c:471 +#, c-format +msgid "Requested period time %u us\n" +msgstr "Angeforderte Periodenzeit %u µs\n" + +#: speaker-test/speaker-test.c:474 +#, c-format +msgid "Unable to set period time %u us for playback: %s\n" +msgstr "Fehler beim Setzen der Periodenzeit %u µs: %s\n" + +#: speaker-test/speaker-test.c:480 +#, c-format +msgid "Requested buffer time %u us\n" +msgstr "Angeforderte Pufferlänge %u µs\n" + +#: speaker-test/speaker-test.c:483 +#, c-format +msgid "Unable to set buffer time %u us for playback: %s\n" +msgstr "Fehler beim Setzen der Pufferlänge %u µs: %s\n" + +#: speaker-test/speaker-test.c:492 +#, c-format +msgid "Using max buffer size %lu\n" +msgstr "Verwende maximale Puffergröße %lu\n" + +#: speaker-test/speaker-test.c:495 +#, c-format +msgid "Unable to set buffer size %lu for playback: %s\n" +msgstr "Fehler beim Setzen der Puffergröße %lu: %s\n" + +#: speaker-test/speaker-test.c:501 +#, c-format +msgid "Periods = %u\n" +msgstr "Perioden = %u\n" + +#: speaker-test/speaker-test.c:504 +#, c-format +msgid "Unable to set nperiods %u for playback: %s\n" +msgstr "Fehler beim Setzen der Periodenanzahl %u: %s\n" + +#: speaker-test/speaker-test.c:513 +#, c-format +msgid "Unable to set hw params for playback: %s\n" +msgstr "Fehler beim Setzen der Hardware-Parameter: %s\n" + +#: speaker-test/speaker-test.c:519 +#, c-format +msgid "was set period_size = %lu\n" +msgstr "gesetzt: period_size = %lu\n" + +#: speaker-test/speaker-test.c:520 +#, c-format +msgid "was set buffer_size = %lu\n" +msgstr "gesetzt: buffer_size = %lu\n" + +#: speaker-test/speaker-test.c:522 +#, c-format +msgid "buffer to small, could not use\n" +msgstr "Puffer zu klein, kann nicht benutzt werden\n" + +#: speaker-test/speaker-test.c:535 +#, c-format +msgid "Unable to determine current swparams for playback: %s\n" +msgstr "Fehler beim Lesen der Software-Parameter: %s\n" + +#: speaker-test/speaker-test.c:542 +#, c-format +msgid "Unable to set start threshold mode for playback: %s\n" +msgstr "Fehler beim Setzen des Start-Schwellenwertes: %s\n" + +#: speaker-test/speaker-test.c:549 +#, c-format +msgid "Unable to set avail min for playback: %s\n" +msgstr "Fehler beim Setzen des Mindest-verfügbar-Wertes: %s\n" + +#: speaker-test/speaker-test.c:556 +#, c-format +msgid "Unable to set sw params for playback: %s\n" +msgstr "Fehler beim Setzen der Software-Parameter: %s\n" + +#: speaker-test/speaker-test.c:576 +#, fuzzy, c-format +msgid "Unable to set channel map: %s\n" +msgstr "Fehler beim Setzen des Mindest-verfügbar-Wertes: %s\n" + +#: speaker-test/speaker-test.c:601 +#, c-format +msgid "Can't recovery from underrun, prepare failed: %s\n" +msgstr "" +"Fehler bei Unterlauf-Behandlung, Re-Initialisierung fehlgeschlagen: %s\n" + +#: speaker-test/speaker-test.c:612 +#, c-format +msgid "Can't recovery from suspend, prepare failed: %s\n" +msgstr "" +"Fehler beim Aufwachen aus dem Ruhezustand, Re-Initialisierung " +"fehlgeschlagen: %s\n" + +#: speaker-test/speaker-test.c:676 speaker-test/speaker-test.c:1191 +#, c-format +msgid "No enough memory\n" +msgstr "Nicht genug Speicher\n" + +#: speaker-test/speaker-test.c:681 +#, c-format +msgid "Cannot open WAV file %s\n" +msgstr "Kann WAV-Datei %s nicht öffnen\n" + +#: speaker-test/speaker-test.c:685 speaker-test/speaker-test.c:714 +#, c-format +msgid "Invalid WAV file %s\n" +msgstr "Ungültige WAV-Datei %s\n" + +#: speaker-test/speaker-test.c:690 +#, c-format +msgid "Not a WAV file: %s\n" +msgstr "Keine WAV-Datei: %s\n" + +#: speaker-test/speaker-test.c:694 +#, c-format +msgid "Unsupported WAV format %d for %s\n" +msgstr "Nicht unterstütztes WAV-Format %d in %s\n" + +#: speaker-test/speaker-test.c:699 +#, c-format +msgid "%s is not a mono stream (%d channels)\n" +msgstr "%s ist keine Mono-Datei (%d Kanäle)\n" + +#: speaker-test/speaker-test.c:704 +#, c-format +msgid "Sample rate doesn't match (%d) for %s\n" +msgstr "Sample-Rate (%d) stimmt nicht überein in %s\n" + +#: speaker-test/speaker-test.c:709 +#, c-format +msgid "Unsupported sample format bits %d for %s\n" +msgstr "Nicht unterstütztes Sample-Format mit %d Bits in %s\n" + +#: speaker-test/speaker-test.c:770 +#, c-format +msgid "Undefined channel %d\n" +msgstr "Kanal %d nicht definiert\n" + +#: speaker-test/speaker-test.c:821 +#, c-format +msgid "Write error: %d,%s\n" +msgstr "Schreibfehler: %d, %s\n" + +#: speaker-test/speaker-test.c:823 +#, c-format +msgid "xrun_recovery failed: %d,%s\n" +msgstr "xrun_recovery fehlgeschlagen: %d, %s\n" + +#: speaker-test/speaker-test.c:926 +#, fuzzy, c-format +msgid "" +"Usage: speaker-test [OPTION]... \n" +"-h,--help\thelp\n" +"-D,--device\tplayback device\n" +"-r,--rate\tstream rate in Hz\n" +"-c,--channels\tcount of channels in stream\n" +"-f,--frequency\tsine wave frequency in Hz\n" +"-F,--format\tsample format\n" +"-b,--buffer\tring buffer size in us\n" +"-p,--period\tperiod size in us\n" +"-P,--nperiods\tnumber of periods\n" +"-t,--test\tpink=use pink noise, sine=use sine wave, wav=WAV file\n" +"-l,--nloops\tspecify number of loops to test, 0 = infinite\n" +"-s,--speaker\tsingle speaker test. Values 1=Left, 2=right, etc\n" +"-w,--wavfile\tUse the given WAV file as a test sound\n" +"-W,--wavdir\tSpecify the directory containing WAV files\n" +"-m,--chmap\tSpecify the channel map to override\n" +"-X,--force-frequency\tforce frequencies outside the 30-8000hz range\n" +"-S,--scale\tScale of generated test tones in percent (default=80)\n" +"\n" +msgstr "" +"Verwendung: speaker-test [Option]...\n" +"-h,--help Hilfe\n" +"-D,--device Wiedergabe-Gerät\n" +"-r,--rate Sample-Rate in Hz\n" +"-c,--channels Anzahl der Kanäle\n" +"-f,--frequency Frequenz der Sinuswelle in Hz\n" +"-F,--format Sample-Format\n" +"-b,--buffer Ringpufferlänge in µs\n" +"-p,--period Periodenlänge in µs\n" +"-P,--nperiods Anzahl der Perioden\n" +"-t,--test pink=rosa Rauschen, sine=Sinuswelle, wav=WAV-Datei\n" +"-l,--nloops Anzahl der Wiederholungen, 0 = unendlich\n" +"-s,--speaker teste einen einzelnen Lautsprecher; 1=links, 2=rechts, usw.\n" +"-w,--wavfile benutze WAV-Datei als Testton\n" +"-W,--wavdir benutze Verzeichnis mit darin enthaltenen WAV-Dateien\n" +"-X,--force-frequency\termöglichen Frequenzen außerhalb der 30-8000Hz " +"Bereich\n" +"\n" + +#: speaker-test/speaker-test.c:1058 +#, c-format +msgid "Invalid number of periods %d\n" +msgstr "Ungültige Periodenanzahl %d\n" + +#: speaker-test/speaker-test.c:1074 speaker-test/speaker-test.c:1078 +#, c-format +msgid "Invalid test type %s\n" +msgstr "Ungültiger Test-Typ %s\n" + +#: speaker-test/speaker-test.c:1111 +#, c-format +msgid "Unknown option '%c'\n" +msgstr "Unbekannte Options '%c'\n" + +#: speaker-test/speaker-test.c:1125 +#, c-format +msgid "Invalid parameter for -s option.\n" +msgstr "Ungültiger Wert für Option -s\n" + +#: speaker-test/speaker-test.c:1140 +#, c-format +msgid "Playback device is %s\n" +msgstr "Wiedergabe-Gerät ist %s\n" + +#: speaker-test/speaker-test.c:1141 +#, c-format +msgid "Stream parameters are %iHz, %s, %i channels\n" +msgstr "Stream-Parameter sind %i Hz, %s, %i Kanäle\n" + +#: speaker-test/speaker-test.c:1144 +#, c-format +msgid "Using 16 octaves of pink noise\n" +msgstr "Verwende 16 Oktaven rosa Rauschen\n" + +#: speaker-test/speaker-test.c:1147 +#, c-format +msgid "Sine wave rate is %.4fHz\n" +msgstr "Sinuswelle mit Frequenz %.4f Hz\n" + +#: speaker-test/speaker-test.c:1150 +#, c-format +msgid "WAV file(s)\n" +msgstr "WAV-Datei(en)\n" + +#: speaker-test/speaker-test.c:1160 +#, c-format +msgid "Playback open error: %d,%s\n" +msgstr "Fehler beim Öffnen des Gerätes: %d, %s\n" + +#: speaker-test/speaker-test.c:1166 +#, c-format +msgid "Setting of hwparams failed: %s\n" +msgstr "Fehler beim Setzen der Hardware-Parameter: %s\n" + +#: speaker-test/speaker-test.c:1170 +#, c-format +msgid "Setting of swparams failed: %s\n" +msgstr "Fehler beim Setzen der Software-Parameter: %s\n" + +#: speaker-test/speaker-test.c:1216 speaker-test/speaker-test.c:1238 +#, c-format +msgid "Transfer failed: %s\n" +msgstr "Schreibfehler: %s\n" + +#: speaker-test/speaker-test.c:1224 +#, c-format +msgid "Time per period = %lf\n" +msgstr "Zeit pro Periode = %lf\n" + +#~ msgid "Warning: format is changed to S16_LE\n" +#~ msgstr "Warnung: benutztes Format ist S16_LE\n" + +#~ msgid "Warning: format is changed to S24_3LE\n" +#~ msgstr "Warnung: benutztes Format ist S24_3LE\n" + +#~ msgid "Warning: format is changed to S24_LE\n" +#~ msgstr "Warnung: benutztes Format ist S24_LE\n" diff --git a/po/en@boldquot.header b/po/en@boldquot.header new file mode 100644 index 0000000..fedb6a0 --- /dev/null +++ b/po/en@boldquot.header @@ -0,0 +1,25 @@ +# All this catalog "translates" are quotation characters. +# The msgids must be ASCII and therefore cannot contain real quotation +# characters, only substitutes like grave accent (0x60), apostrophe (0x27) +# and double quote (0x22). These substitutes look strange; see +# http://www.cl.cam.ac.uk/~mgk25/ucs/quotes.html +# +# This catalog translates grave accent (0x60) and apostrophe (0x27) to +# left single quotation mark (U+2018) and right single quotation mark (U+2019). +# It also translates pairs of apostrophe (0x27) to +# left single quotation mark (U+2018) and right single quotation mark (U+2019) +# and pairs of quotation mark (0x22) to +# left double quotation mark (U+201C) and right double quotation mark (U+201D). +# +# When output to an UTF-8 terminal, the quotation characters appear perfectly. +# When output to an ISO-8859-1 terminal, the single quotation marks are +# transliterated to apostrophes (by iconv in glibc 2.2 or newer) or to +# grave/acute accent (by libiconv), and the double quotation marks are +# transliterated to 0x22. +# When output to an ASCII terminal, the single quotation marks are +# transliterated to apostrophes, and the double quotation marks are +# transliterated to 0x22. +# +# This catalog furthermore displays the text between the quotation marks in +# bold face, assuming the VT100/XTerm escape sequences. +# diff --git a/po/en@quot.header b/po/en@quot.header new file mode 100644 index 0000000..a9647fc --- /dev/null +++ b/po/en@quot.header @@ -0,0 +1,22 @@ +# All this catalog "translates" are quotation characters. +# The msgids must be ASCII and therefore cannot contain real quotation +# characters, only substitutes like grave accent (0x60), apostrophe (0x27) +# and double quote (0x22). These substitutes look strange; see +# http://www.cl.cam.ac.uk/~mgk25/ucs/quotes.html +# +# This catalog translates grave accent (0x60) and apostrophe (0x27) to +# left single quotation mark (U+2018) and right single quotation mark (U+2019). +# It also translates pairs of apostrophe (0x27) to +# left single quotation mark (U+2018) and right single quotation mark (U+2019) +# and pairs of quotation mark (0x22) to +# left double quotation mark (U+201C) and right double quotation mark (U+201D). +# +# When output to an UTF-8 terminal, the quotation characters appear perfectly. +# When output to an ISO-8859-1 terminal, the single quotation marks are +# transliterated to apostrophes (by iconv in glibc 2.2 or newer) or to +# grave/acute accent (by libiconv), and the double quotation marks are +# transliterated to 0x22. +# When output to an ASCII terminal, the single quotation marks are +# transliterated to apostrophes, and the double quotation marks are +# transliterated to 0x22. +# diff --git a/po/fr.gmo b/po/fr.gmo new file mode 100644 index 0000000..5f3e991 Binary files /dev/null and b/po/fr.gmo differ diff --git a/po/fr.po b/po/fr.po new file mode 100644 index 0000000..e661412 --- /dev/null +++ b/po/fr.po @@ -0,0 +1,1722 @@ +# French translation for alsa-utils +# Copyright (C) 2011 The ALSA Team +# This file is distributed under the same license as the alsa-utils package. +# Christoph J. Thompson , 2011. +# +msgid "" +msgstr "" +"Project-Id-Version: alsa-utils 1.0.23\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2020-10-15 11:46+0000\n" +"PO-Revision-Date: 2011-01-07 06:23+0100\n" +"Last-Translator: Christoph J. Thompson \n" +"Language-Team: French \n" +"Language: fr\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: alsamixer/card_select.c:77 alsamixer/device_name.c:127 +msgid "Sound Card" +msgstr "Carte Son" + +#: alsamixer/card_select.c:115 +msgid "(default)" +msgstr "(par défaut)" + +#: alsamixer/card_select.c:125 +msgid "cannot enumerate sound cards" +msgstr "les cartes son n'ont pas pu être énumérées" + +#: alsamixer/card_select.c:147 +msgid "enter device name..." +msgstr "entrez le nom du périphérique..." + +#: alsamixer/cli.c:43 +msgid "Usage: alsamixer [options]" +msgstr "Utilisation: alsamixer [options]" + +#: alsamixer/cli.c:44 +#, fuzzy +msgid "" +"Useful options:\n" +" -h, --help this help\n" +" -c, --card=NUMBER sound card number or id\n" +" -D, --device=NAME mixer device name\n" +" -m, --mouse enable mouse\n" +" -M, --no-mouse disable mouse\n" +" -f, --config=FILE configuration file\n" +" -F, --no-config do not load configuration file\n" +" -V, --view=MODE starting view mode: playback/capture/all" +msgstr "" +"Options utiles:\n" +" -h, --help cette aide\n" +" -c, --card=NUMÉRO numéro ou identifiant de la carte son\n" +" -D, --device=NOM nom du périphérique de mixage\n" +" -V, --view=MODE mode de visualisation par défaut: lecture/capture/tous" + +#: alsamixer/cli.c:53 +msgid "" +"Debugging options:\n" +" -g, --no-color toggle using of colors\n" +" -a, --abstraction=NAME mixer abstraction level: none/basic" +msgstr "" +"Options de débogage:\n" +" -g, --no-color supprimer la couleur\n" +" -a, --abstraction=NOM niveau d'abstraction du mixeur: aucun/basique" + +#: alsamixer/cli.c:88 +#, c-format +msgid "invalid card index: %s\n" +msgstr "index de carte invalide: %s\n" + +#: alsamixer/cli.c:126 +#, c-format +msgid "unknown abstraction level: %s\n" +msgstr "niveau d'abstraction inconnu: %s\n" + +#: alsamixer/cli.c:131 +#, c-format +msgid "unknown option: %c\n" +msgstr "option inconnue: %c\n" + +#: alsamixer/cli.c:133 +msgid "try `alsamixer --help' for more information\n" +msgstr "essayez `alsamixer --help' pour plus d'information\n" + +#: alsamixer/device_name.c:177 +msgid "Device name:" +msgstr "Nom du périphérique:" + +#: alsamixer/die.c:37 +#, c-format +msgid "%s: %s\n" +msgstr "%s: %s\n" + +#: alsamixer/mixer_display.c:99 +msgid "Card:" +msgstr "Carte:" + +#: alsamixer/mixer_display.c:100 +msgid "Chip:" +msgstr "Puce:" + +#: alsamixer/mixer_display.c:101 +msgid "View:" +msgstr "Vue:" + +#: alsamixer/mixer_display.c:102 +msgid "Item:" +msgstr "Contrôle:" + +#: alsamixer/mixer_display.c:105 +msgid "F1: Help" +msgstr "F1: Aide" + +#: alsamixer/mixer_display.c:106 +msgid "F2: System information" +msgstr "F2: Informations Système" + +#: alsamixer/mixer_display.c:107 +msgid "F6: Select sound card" +msgstr "F6: Choisir la carte son" + +#: alsamixer/mixer_display.c:108 +msgid "Esc: Exit" +msgstr "Esc: Quitter" + +#: alsamixer/mixer_display.c:179 +msgid "(unplugged)" +msgstr "(non branché)" + +#: alsamixer/mixer_display.c:197 +msgid "Playback" +msgstr "Lecture" + +#: alsamixer/mixer_display.c:198 +msgid "Capture" +msgstr "Capture" + +#: alsamixer/mixer_display.c:199 +msgid "All" +msgstr "Tout" + +#: alsamixer/mixer_display.c:240 +msgid "mute" +msgstr "muet" + +#: alsamixer/mixer_display.c:281 alsamixer/mixer_display.c:291 +msgid "dB gain:" +msgstr "gain dB:" + +#: alsamixer/mixer_display.c:291 +#, c-format +msgid " [%s %s, %s]" +msgstr " [%s %s, %s]" + +#: alsamixer/mixer_display.c:300 alsamixer/mixer_display.c:306 +#: alsamixer/mixer_display.c:312 alsamixer/mixer_display.c:318 +msgid "Off" +msgstr "Fermé" + +#: alsamixer/mixer_display.c:306 alsamixer/mixer_display.c:318 +msgid "On" +msgstr "Ouvert" + +#: alsamixer/mixer_display.c:370 +msgid "The sound device was unplugged." +msgstr "Le périphérique a été débranché" + +#: alsamixer/mixer_display.c:371 +msgid "Press F6 to select another sound card." +msgstr "Appuyez sur F6 pour choisir une autre carte son." + +#: alsamixer/mixer_display.c:386 +msgid "This sound device does not have any playback controls." +msgstr "Ce périphérique n'a pas de commandes de lecture." + +#: alsamixer/mixer_display.c:388 +msgid "This sound device does not have any capture controls." +msgstr "Ce périphérique n'a pas de commandes de capture." + +#: alsamixer/mixer_display.c:390 +msgid "This sound device does not have any controls." +msgstr "Ce périphérique n'a pas de commandes." + +#. TRANSLATORS: playback on; one character +#: alsamixer/mixer_display.c:523 alsamixer/mixer_display.c:528 +msgid "O" +msgstr "O" + +#. TRANSLATORS: playback muted; one character +#: alsamixer/mixer_display.c:525 alsamixer/mixer_display.c:529 +msgid "M" +msgstr "M" + +#. TRANSLATORS: "left"; no more than two characters +#: alsamixer/mixer_display.c:545 +msgid "L" +msgstr "G" + +#. TRANSLATORS: "right"; no more than two characters +#: alsamixer/mixer_display.c:551 +msgid "R" +msgstr "D" + +#. TRANSLATORS: no more than eight characters +#: alsamixer/mixer_display.c:555 +msgid "CAPTURE" +msgstr "CAPTURE" + +#: alsamixer/mixer_display.c:611 +msgid "Front" +msgstr "Avant" + +#: alsamixer/mixer_display.c:614 +msgid "Rear" +msgstr "Arrière" + +#: alsamixer/mixer_display.c:617 speaker-test/speaker-test.c:124 +msgid "Center" +msgstr "Centre" + +#: alsamixer/mixer_display.c:620 +msgid "Woofer" +msgstr "Basses" + +#: alsamixer/mixer_display.c:623 +msgid "Side" +msgstr "Côté" + +#: alsamixer/mixer_widget.c:91 alsamixer/mixer_widget.c:96 +msgid "cannot open mixer" +msgstr "le mixeur ne peut pas être ouvert" + +#: alsamixer/mixer_widget.c:102 alsamixer/mixer_widget.c:179 +msgid "cannot load mixer controls" +msgstr "les commandes de mixage ne peuvent pas être chargés" + +#: alsamixer/mixer_widget.c:169 +#, c-format +msgid "Cannot open mixer device '%s'." +msgstr "Le périphérique de mixage '%s' ne peut pas être ouvert." + +#: alsamixer/mixer_widget.c:190 +msgid "Esc Exit" +msgstr "Esc Quitter" + +#: alsamixer/mixer_widget.c:191 +msgid "F1 ? H Help" +msgstr "F1 ? H Aide" + +#: alsamixer/mixer_widget.c:192 +msgid "F2 / System information" +msgstr "F2 / Informations système" + +#: alsamixer/mixer_widget.c:193 +msgid "F3 Show playback controls" +msgstr "F3 Afficher les commandes de lecture" + +#: alsamixer/mixer_widget.c:194 +msgid "F4 Show capture controls" +msgstr "F4 Afficher les commandes de capture" + +#: alsamixer/mixer_widget.c:195 +msgid "F5 Show all controls" +msgstr "F5 Afficher toutes les commandes" + +#: alsamixer/mixer_widget.c:196 +msgid "Tab Toggle view mode (F3/F4/F5)" +msgstr "Tab Choisir le mode de visualisation (F3/F4/F5)" + +#: alsamixer/mixer_widget.c:197 +msgid "F6 S Select sound card" +msgstr "F6 S Choisir la carte son" + +#: alsamixer/mixer_widget.c:198 +msgid "L Redraw screen" +msgstr "L Actualiser l'écran" + +#: alsamixer/mixer_widget.c:200 +msgid "Left Move to the previous control" +msgstr "Gauche Aller à la commande précédente" + +#: alsamixer/mixer_widget.c:201 +msgid "Right Move to the next control" +msgstr "Droite Aller à la commande suivante" + +#: alsamixer/mixer_widget.c:203 +msgid "Up/Down Change volume" +msgstr "Haut/Bas Ajuster le volume" + +#: alsamixer/mixer_widget.c:204 +msgid "+ - Change volume" +msgstr "+ - Ajuster le volume" + +#: alsamixer/mixer_widget.c:205 +msgid "Page Up/Dn Change volume in big steps" +msgstr "Page Préc./Suiv. Ajuster le volume en grandes intervalles" + +#: alsamixer/mixer_widget.c:206 +msgid "End Set volume to 0%" +msgstr "Fin Couper le volume" + +#: alsamixer/mixer_widget.c:207 +msgid "0-9 Set volume to 0%-90%" +msgstr "0-9 Ajuster le volume entre 0 et 90%" + +#: alsamixer/mixer_widget.c:208 +msgid "Q W E Increase left/both/right volumes" +msgstr "Q W E Augmenter les volumes de gauche/centre/droite" + +#. TRANSLATORS: or Y instead of Z +#: alsamixer/mixer_widget.c:210 +msgid "Z X C Decrease left/both/right volumes" +msgstr "Z X C Baisser les volumes de gauche/centre/droite" + +#: alsamixer/mixer_widget.c:211 +msgid "B Balance left and right volumes" +msgstr "B Égaliser les volumes de gauche et droite" + +#: alsamixer/mixer_widget.c:213 +msgid "M Toggle mute" +msgstr "M (Dés)activer le mode muet" + +#. TRANSLATORS: or , . +#: alsamixer/mixer_widget.c:215 +msgid "< > Toggle left/right mute" +msgstr "< > (Dés)activer le mode muet à gauche et à droite" + +#: alsamixer/mixer_widget.c:217 +msgid "Space Toggle capture" +msgstr "Espace (Dés)activer la capture" + +#. TRANSLATORS: or Insert Delete +#: alsamixer/mixer_widget.c:219 +msgid "; ' Toggle left/right capture" +msgstr "; (Dés)activer la capture à gauche et à droite" + +#: alsamixer/mixer_widget.c:221 +msgid "Authors:" +msgstr "Auteurs:" + +#: alsamixer/mixer_widget.c:222 +msgid " Tim Janik" +msgstr "" + +#: alsamixer/mixer_widget.c:223 +msgid " Jaroslav Kysela " +msgstr "" + +#: alsamixer/mixer_widget.c:224 +msgid " Clemens Ladisch " +msgstr "" + +#: alsamixer/mixer_widget.c:226 +msgid "Help" +msgstr "Aide" + +#: alsamixer/proc_files.c:56 +msgid "Select File" +msgstr "Choisir un Fichier" + +#: alsamixer/textbox.c:51 alsamixer/textbox.c:65 +msgid "Error" +msgstr "Erreur" + +#: alsamixer/textbox.c:80 +#, c-format +msgid "Cannot open file \"%s\"." +msgstr "Le fichier \"%s\" n'a pas pu être ouvert." + +#: aplay/aplay.c:180 +msgid "raw data" +msgstr "données brutes" + +#: aplay/aplay.c:181 +msgid "VOC" +msgstr "" + +#: aplay/aplay.c:183 +msgid "WAVE" +msgstr "" + +#: aplay/aplay.c:184 +msgid "Sparc Audio" +msgstr "" + +#: aplay/aplay.c:205 +#, fuzzy, c-format +msgid "" +"Usage: %s [OPTION]... [FILE]...\n" +"\n" +"-h, --help help\n" +" --version print current version\n" +"-l, --list-devices list all soundcards and digital audio devices\n" +"-L, --list-pcms list device names\n" +"-D, --device=NAME select PCM by name\n" +"-q, --quiet quiet mode\n" +"-t, --file-type TYPE file type (voc, wav, raw or au)\n" +"-c, --channels=# channels\n" +"-f, --format=FORMAT sample format (case insensitive)\n" +"-r, --rate=# sample rate\n" +"-d, --duration=# interrupt after # seconds\n" +"-s, --samples=# interrupt after # samples per channel\n" +"-M, --mmap mmap stream\n" +"-N, --nonblock nonblocking mode\n" +"-F, --period-time=# distance between interrupts is # microseconds\n" +"-B, --buffer-time=# buffer duration is # microseconds\n" +" --period-size=# distance between interrupts is # frames\n" +" --buffer-size=# buffer duration is # frames\n" +"-A, --avail-min=# min available space for wakeup is # microseconds\n" +"-R, --start-delay=# delay for automatic PCM start is # microseconds \n" +" (relative to buffer size if <= 0)\n" +"-T, --stop-delay=# delay for automatic PCM stop is # microseconds from " +"xrun\n" +"-v, --verbose show PCM structure and setup (accumulative)\n" +"-V, --vumeter=TYPE enable VU meter (TYPE: mono or stereo)\n" +"-I, --separate-channels one file for each channel\n" +"-i, --interactive allow interactive operation from stdin\n" +"-m, --chmap=ch1,ch2,.. Give the channel map to override or follow\n" +" --disable-resample disable automatic rate resample\n" +" --disable-channels disable automatic channel conversions\n" +" --disable-format disable automatic format conversions\n" +" --disable-softvol disable software volume control (softvol)\n" +" --test-position test ring buffer position\n" +" --test-coef=# test coefficient for ring buffer position (default " +"8)\n" +" expression for validation is: coef * (buffer_size / " +"2)\n" +" --test-nowait do not wait for ring buffer - eats whole CPU\n" +" --max-file-time=# start another output file when the old file has " +"recorded\n" +" for this many seconds\n" +" --process-id-file write the process ID here\n" +" --use-strftime apply the strftime facility to the output file name\n" +" --dump-hw-params dump hw_params of the device\n" +" --fatal-errors treat all errors as fatal\n" +msgstr "" +"Utilisation: %s [OPTION]... [FICHIER]...\n" +"\n" +"-h, --help aide\n" +" --version afficher la version du programme\n" +"-l, --list-devices afficher la listes des périphériques\n" +"-L, --list-pcms afficher la liste des noms de périphériques\n" +"-D, --device=NOM choisir le périphérique PCM par son nom\n" +"-Q, --quiet mode silencieux\n" +"-t, --file-type TYPE type de fichier (voc, wav, raw ou au)\n" +"-c, --channels=# canaux\n" +"-f, --format=FORMAT format d'échantillonage (insensible à la casse)\n" +"-r, --rate=# fréquence d'échantillonage\n" +"-d, --duration=# interrompre après # secondes\n" +"-M, --mmap charger le flux en mémoire avec mmap\n" +"-N, --nonblock mode non-bloquant\n" +"-F, --period-time=# # microsecondes entre chaque interruption\n" +"-B, --buffer-time=# la durée du tampon est de # microsecondes\n" +" --period-size=# # trames entre chaque interruption\n" +" --buffer-size=# la durée du tampon est de # trames\n" +"-A, --avail-min=# # microsecondes min. disponibles entre chaque " +"réveil\n" +"-R, --start-delay=# # microsecondes de délai avant le démarrage\n" +" automatique du périphérique PCM (relatif à la " +"taille\n" +" du tampon si <= 0)\n" +"-T, --stop-delay=# # microsecondes de délai depuis xrun avant l'arrêt\n" +" automatique du périphérique PCM \n" +"-v, --verbose afficher la structure et la configuration du\n" +" périphérique PCM (accumulatif)\n" +"-V, --vumeter=TYPE activer le VU-mètre (TYPE: mono ou stereo)\n" +"-I, --separate-channels un fichier par canal\n" +" --disable-resample désactiver le rééchantillonage de fréquence\n" +" automatique\n" +" --disable-channels désactiver les conversions automatiques de canal\n" +" --disable-format désactiver les conversions automatiques de format\n" +" --disable-softvol désactiver la commande du volume logicielle\n" +" --test-position tester la position du tampon circulaire\n" +" --test-coef=# test coefficient pour la position du tampon\n" +" circulaire (par défaut 8). L'expression pour la\n" +" validation est : coef * (taille_tampon / 2)\n" +" --test-nowait ne pas attendre le tampon circulaire - prend toutes\n" +" les resources du processeur\n" +" --max-file-time=# commencer un autre fichier de capture quand " +"l'ancien\n" +" fichier a enregistré pendant # secondes\n" +" --process-id-file écrire l'identifiant du processus ici\n" +" --use-strftime utiliser strftime pour le nom du fichier de capture\n" + +#: aplay/aplay.c:250 speaker-test/speaker-test.c:945 +#, c-format +msgid "Recognized sample formats are:" +msgstr "Les formats d'échantillonage connus sont:" + +#: aplay/aplay.c:256 +#, c-format +msgid "" +"\n" +"Some of these may not be available on selected hardware\n" +msgstr "" +"\n" +"Certains de ceux-ci ne sont peut être pas disponibles avec ce matériel\n" + +#: aplay/aplay.c:257 +#, fuzzy, c-format +msgid "The available format shortcuts are:\n" +msgstr "Les raccourcis format disponibles sont:\n" + +#: aplay/aplay.c:258 +#, c-format +msgid "-f cd (16 bit little endian, 44100, stereo)\n" +msgstr "-f cd (16 bit petit boutiste, 44100, stéréo)\n" + +#: aplay/aplay.c:259 +#, c-format +msgid "-f cdr (16 bit big endian, 44100, stereo)\n" +msgstr "-f cdr (16 bit gros boutiste, 44100, stéréo)\n" + +#: aplay/aplay.c:260 +#, c-format +msgid "-f dat (16 bit little endian, 48000, stereo)\n" +msgstr "-f dat (16 bit petit boutiste, 48000, stéréo)\n" + +#: aplay/aplay.c:274 +msgid "no soundcards found..." +msgstr "aucune carte son n'a été trouvée..." + +#: aplay/aplay.c:277 +#, c-format +msgid "**** List of %s Hardware Devices ****\n" +msgstr "**** Liste des Périphériques Matériels %s ****\n" + +#: aplay/aplay.c:306 +#, c-format +msgid "card %i: %s [%s], device %i: %s [%s]\n" +msgstr "carte %i: %s [%s], périphérique %i: %s [%s]\n" + +#: aplay/aplay.c:312 +#, c-format +msgid " Subdevices: %i/%i\n" +msgstr " Sous-périphériques: %i/%i\n" + +#: aplay/aplay.c:319 +#, c-format +msgid " Subdevice #%i: %s\n" +msgstr " Sous-périphérique #%i: %s\n" + +#: aplay/aplay.c:400 +#, c-format +msgid "Aborted by signal %s...\n" +msgstr "Interrompu par le signal %s...\n" + +#: aplay/aplay.c:555 +msgid "command should be named either arecord or aplay" +msgstr "la commande doit être nommée arecord ou aplay" + +#: aplay/aplay.c:599 +#, c-format +msgid "unrecognized file format %s" +msgstr "format de fichier inconnu %s" + +#: aplay/aplay.c:606 +#, fuzzy, c-format +msgid "invalid channels argument '%s'" +msgstr "l'addresse envoyeur %s est incorrecte\n" + +#: aplay/aplay.c:610 +#, c-format +msgid "value %i for channels is invalid" +msgstr "la valeur %i pour les canaux est incorrecte" + +#: aplay/aplay.c:629 +#, c-format +msgid "wrong extended format '%s'" +msgstr "format étendu '%s' erronné" + +#: aplay/aplay.c:637 +#, fuzzy, c-format +msgid "invalid rate argument '%s'" +msgstr "addresse source %s incorrecte\n" + +#: aplay/aplay.c:644 +#, c-format +msgid "bad speed value %i" +msgstr "mauvaise valeur de vitesse %i" + +#: aplay/aplay.c:650 +msgid "duration and samples arguments cannot be used together" +msgstr "" + +#: aplay/aplay.c:655 +#, fuzzy, c-format +msgid "invalid duration argument '%s'" +msgstr "l'addresse destinataire %s est incorrecte\n" + +#: aplay/aplay.c:662 +msgid "samples and duration arguments cannot be used together" +msgstr "" + +#: aplay/aplay.c:667 +#, fuzzy, c-format +msgid "invalid samples argument '%s'" +msgstr "l'addresse envoyeur %s est incorrecte\n" + +#: aplay/aplay.c:679 +#, fuzzy, c-format +msgid "invalid period time argument '%s'" +msgstr "l'addresse envoyeur %s est incorrecte\n" + +#: aplay/aplay.c:686 +#, fuzzy, c-format +msgid "invalid buffer time argument '%s'" +msgstr "addresse source %s incorrecte\n" + +#: aplay/aplay.c:693 +#, fuzzy, c-format +msgid "invalid period size argument '%s'" +msgstr "l'addresse envoyeur %s est incorrecte\n" + +#: aplay/aplay.c:700 +#, fuzzy, c-format +msgid "invalid buffer size argument '%s'" +msgstr "addresse source %s incorrecte\n" + +#: aplay/aplay.c:707 +#, c-format +msgid "invalid min available space argument '%s'" +msgstr "" + +#: aplay/aplay.c:714 +#, fuzzy, c-format +msgid "invalid start delay argument '%s'" +msgstr "l'addresse envoyeur %s est incorrecte\n" + +#: aplay/aplay.c:721 +#, fuzzy, c-format +msgid "invalid stop delay argument '%s'" +msgstr "l'addresse envoyeur %s est incorrecte\n" + +#: aplay/aplay.c:776 +#, fuzzy, c-format +msgid "invalid test coef argument '%s'" +msgstr "addresse source %s incorrecte\n" + +#: aplay/aplay.c:788 +#, c-format +msgid "invalid max file time argument '%s'" +msgstr "" + +#: aplay/aplay.c:808 speaker-test/speaker-test.c:571 +#, c-format +msgid "Unable to parse channel map string: %s\n" +msgstr "" + +#: aplay/aplay.c:814 +#, c-format +msgid "Try `%s --help' for more information.\n" +msgstr "Essayez `%s --help' pour plus d'informations.\n" + +#: aplay/aplay.c:830 +#, c-format +msgid "audio open error: %s" +msgstr "erreur à l'ouverture audio: %s" + +#: aplay/aplay.c:835 +#, c-format +msgid "info error: %s" +msgstr "erreur info: %s" + +#: aplay/aplay.c:842 +#, c-format +msgid "nonblock setting error: %s" +msgstr "paramètre de non-blocage erronné: %s" + +#: aplay/aplay.c:852 aplay/aplay.c:976 aplay/aplay.c:1266 aplay/aplay.c:1466 +#: aplay/aplay.c:1986 aplay/aplay.c:2016 +msgid "not enough memory" +msgstr "pas assez de mémoire" + +#: aplay/aplay.c:876 +#, c-format +msgid "Cannot create process ID file %s: %s" +msgstr "Le fichier de numéro de processus %s n'a pas pu être créé: %s" + +#: aplay/aplay.c:966 +#, c-format +msgid "read error (called from line %i)" +msgstr "erreur de lecture (appelé à la ligne %i)" + +#: aplay/aplay.c:1033 +#, c-format +msgid "unknown length of 'fmt ' chunk (read %u, should be %u at least)" +msgstr "longueur du morceau 'fmt ' inconnue (lu %u, devrait être au moins %u)" + +#: aplay/aplay.c:1044 +#, c-format +msgid "" +"unknown length of extensible 'fmt ' chunk (read %u, should be %u at least)" +msgstr "" +"longueur du morceau 'fmt ' extensible inconnue (lu %u, devrait être au moins " +"%u)" + +#: aplay/aplay.c:1049 +msgid "wrong format tag in extensible 'fmt ' chunk" +msgstr "libellé de format erronné dans le morceau extensible 'fmt '" + +#: aplay/aplay.c:1056 +#, c-format +msgid "can't play WAVE-file format 0x%04x which is not PCM or FLOAT encoded" +msgstr "" +"Les formats de ficher WAVE 0x%04x qui ne sont pas encodés en PCM ouFLOAT ne " +"sont pas supportés" + +#: aplay/aplay.c:1061 +#, c-format +msgid "can't play WAVE-files with %d tracks" +msgstr "Les fichiers WAVE avec %d pistes ne sont pas supportés" + +#: aplay/aplay.c:1069 aplay/aplay.c:1195 +#, c-format +msgid "Warning: format is changed to U8\n" +msgstr "Avertissement: le format est changé en U8\n" + +#: aplay/aplay.c:1079 aplay/aplay.c:1092 aplay/aplay.c:1103 +#, fuzzy, c-format +msgid "Warning: format is changed to %s\n" +msgstr "Avertissement: le format est changé en U8\n" + +#: aplay/aplay.c:1108 +#, c-format +msgid "" +" can't play WAVE-files with sample %d bits in %d bytes wide (%d channels)" +msgstr "" +" les fichiers WAVE échantillonés %d bits par %d octets en largeur (%d " +"canaux)ne sont pas supportés" + +#: aplay/aplay.c:1131 +#, c-format +msgid " can't play WAVE-files with sample %d bits wide" +msgstr "" +" les fichiers WAVES échantillonés %d bits en largeur ne sont passupportés" + +#: aplay/aplay.c:1189 +#, c-format +msgid "Warning: format is changed to MU_LAW\n" +msgstr "Avertissement: le format est changé en MU_LAW\n" + +#: aplay/aplay.c:1201 +#, c-format +msgid "Warning: format is changed to S16_BE\n" +msgstr "Avertissement: le format est changé en S16_BE\n" + +#: aplay/aplay.c:1214 aplay/aplay.c:2307 aplay/aplay.c:2314 aplay/aplay.c:2839 +msgid "read error" +msgstr "erreur de lecture" + +#: aplay/aplay.c:1244 +msgid "Channel numbers don't match between hw_params and channel map" +msgstr "" + +#: aplay/aplay.c:1253 +#, c-format +msgid "Warning: unable to get channel map\n" +msgstr "" + +#: aplay/aplay.c:1287 +#, c-format +msgid "Channel %d doesn't match with hw_params" +msgstr "" + +#: aplay/aplay.c:1314 +msgid "Broken configuration for this PCM: no configurations available" +msgstr "Configuration erronée pour ce périphérique PCM: pas de configuration" + +#: aplay/aplay.c:1318 +#, c-format +msgid "HW Params of device \"%s\":\n" +msgstr "" + +#: aplay/aplay.c:1338 +msgid "Access type not available" +msgstr "Ce type d'accès n'est pas disponible" + +#: aplay/aplay.c:1343 +msgid "Sample format non available" +msgstr "Ce format d'échantillonage n'est pas disponible" + +#: aplay/aplay.c:1349 +msgid "Channels count non available" +msgstr "Nombre de canaux non disponible" + +#: aplay/aplay.c:1364 +#, c-format +msgid "Warning: rate is not accurate (requested = %iHz, got = %iHz)\n" +msgstr "" +"Avertissement: la fréquence n'est pas précise (demandé = %iHz,\n" +"obtenu = %iHz)\n" + +#: aplay/aplay.c:1370 +#, c-format +msgid " please, try the plug plugin %s\n" +msgstr " veuillez essayez le greffon de branchement %s\n" + +#: aplay/aplay.c:1407 +msgid "Unable to install hw params:" +msgstr "Les paramètres matériel n'ont pas pu être installés:" + +#: aplay/aplay.c:1414 +#, c-format +msgid "Can't use period equal to buffer size (%lu == %lu)" +msgstr "" +"Une période égale à la taille du tampon (%lu == %lu) ne peut êtreutilisée" + +#: aplay/aplay.c:1420 +#, fuzzy +msgid "Unable to get current sw params." +msgstr "Les paramètres logiciel n'ont pas pu être installés:" + +#: aplay/aplay.c:1449 +msgid "unable to install sw params:" +msgstr "Les paramètres logiciel n'ont pas pu être installés:" + +#: aplay/aplay.c:1484 +#, c-format +msgid "snd_pcm_mmap_begin problem: %s" +msgstr "" + +#: aplay/aplay.c:1513 +#, c-format +msgid "stdin O_NONBLOCK flag setup failed\n" +msgstr "" + +#: aplay/aplay.c:1537 +#, c-format +msgid "\rPAUSE command ignored (no hw support)\n" +msgstr "" + +#: aplay/aplay.c:1545 +#, fuzzy, c-format +msgid "pause push error: %s" +msgstr "erreur d'état: %s" + +#: aplay/aplay.c:1556 +#, fuzzy, c-format +msgid "pause release error: %s" +msgstr "suspension: prepare error: %s" + +#: aplay/aplay.c:1572 +#, c-format +msgid "" +"\r=== PAUSE === " +msgstr "" + +#: aplay/aplay.c:1614 +#, c-format +msgid "status error: %s" +msgstr "erreur d'état: %s" + +#: aplay/aplay.c:1619 +#, fuzzy, c-format +msgid "fatal %s: %s" +msgstr "%s: %s\n" + +#: aplay/aplay.c:1620 aplay/aplay.c:1631 aplay/aplay.c:1634 aplay/aplay.c:1642 +msgid "underrun" +msgstr "perte" + +#: aplay/aplay.c:1620 aplay/aplay.c:1631 aplay/aplay.c:1642 +msgid "overrun" +msgstr "dépassement" + +#: aplay/aplay.c:1630 aplay/aplay.c:1641 +#, c-format +msgid "%s!!! (at least %.3f ms long)\n" +msgstr "%s!!! (au moins longue de %.3f ms)\n" + +#: aplay/aplay.c:1646 +#, c-format +msgid "Status:\n" +msgstr "État:\n" + +#: aplay/aplay.c:1650 +#, c-format +msgid "xrun: prepare error: %s" +msgstr "" + +#: aplay/aplay.c:1656 +#, c-format +msgid "Status(DRAINING):\n" +msgstr "" + +#: aplay/aplay.c:1660 +#, c-format +msgid "capture stream format change? attempting recover...\n" +msgstr "" +"changement de format de flux de capture? tentative de récupération...\n" + +#: aplay/aplay.c:1662 +#, c-format +msgid "xrun(DRAINING): prepare error: %s" +msgstr "" + +#: aplay/aplay.c:1669 +#, c-format +msgid "Status(R/W):\n" +msgstr "" + +#: aplay/aplay.c:1672 +#, c-format +msgid "read/write error, state = %s" +msgstr "erreur de lecture/écriture, état = %s" + +#: aplay/aplay.c:1682 +#, c-format +msgid "Suspended. Trying resume. " +msgstr "Suspendu. Tentative de reprise. " + +#: aplay/aplay.c:1688 +#, c-format +msgid "Failed. Restarting stream. " +msgstr "Échec. Redémarrage du flux." + +#: aplay/aplay.c:1691 +#, c-format +msgid "suspend: prepare error: %s" +msgstr "suspension: prepare error: %s" + +#: aplay/aplay.c:1696 +#, c-format +msgid "Done.\n" +msgstr "Terminé.\n" + +#: aplay/aplay.c:1718 +#, c-format +msgid " !clip " +msgstr "" + +#: aplay/aplay.c:1862 +#, c-format +msgid "Unsupported bit size %d.\n" +msgstr "%d bit(s) non supporté(s).\n" + +#: aplay/aplay.c:1896 +#, c-format +msgid "Max peak (%li samples): 0x%08x " +msgstr "Pic max. (%li échantillons): 0x%08x " + +#: aplay/aplay.c:1930 +#, c-format +msgid "" +"Suspicious buffer position (%li total): avail = %li, delay = %li, buffer = " +"%li\n" +msgstr "" +"Position de tampon suspicieuse (total %li): dispo = %li, délai = %li, tampon " +"= %li\n" + +#: aplay/aplay.c:2058 +#, c-format +msgid "write error: %s" +msgstr "erreur en écriture: %s" + +#: aplay/aplay.c:2106 +#, c-format +msgid "writev error: %s" +msgstr "erreur de writev: %s" + +#: aplay/aplay.c:2152 +#, c-format +msgid "read error: %s" +msgstr "erreur en lecture: %s" + +#: aplay/aplay.c:2199 +#, c-format +msgid "readv error: %s" +msgstr "erreur de readv: %s" + +#: aplay/aplay.c:2248 +msgid "can't allocate buffer for silence" +msgstr "Un tampon pour silence n'a pas pu être alloué" + +#: aplay/aplay.c:2257 aplay/aplay.c:2485 aplay/aplay.c:2490 aplay/aplay.c:2540 +#: aplay/aplay.c:2549 aplay/aplay.c:2556 aplay/aplay.c:2566 aplay/aplay.c:2572 +#: aplay/aplay.c:2644 aplay/aplay.c:2674 aplay/aplay.c:2688 +msgid "write error" +msgstr "erreur en écriture" + +#: aplay/aplay.c:2270 +#, c-format +msgid "voc_pcm_flush - silence error" +msgstr "voc_pcm_flush - erreur de silence" + +#: aplay/aplay.c:2273 +msgid "voc_pcm_flush error" +msgstr "erreur voc_pcm_flush" + +#: aplay/aplay.c:2298 +msgid "malloc error" +msgstr "erreur malloc" + +#: aplay/aplay.c:2302 +#, c-format +msgid "Playing Creative Labs Channel file '%s'...\n" +msgstr "Lecture du ficher de canaux Creative Labs '%s'...\n" + +#: aplay/aplay.c:2370 aplay/aplay.c:2465 +msgid "can't play packed .voc files" +msgstr "les fichiers .voc de type 'packed' ne sont pas supportés" + +#: aplay/aplay.c:2425 +#, c-format +msgid "can't play loops; %s isn't seekable\n" +msgstr "%s n'est pas navigable; les motifs n'ont pas pu être lus\n" + +#: aplay/aplay.c:2474 +#, c-format +msgid "unknown blocktype %d. terminate." +msgstr "type de bloc %d inconnu. fin." + +#: aplay/aplay.c:2608 +#, c-format +msgid "Wave doesn't support %s format..." +msgstr "Le format wave %s n'est pas supporté..." + +#: aplay/aplay.c:2668 +#, c-format +msgid "Sparc Audio doesn't support %s format..." +msgstr "Le format %s Sparc Audio n'est pas supporté..." + +#: aplay/aplay.c:2743 +msgid "Playing" +msgstr "Lecture" + +#: aplay/aplay.c:2743 +msgid "Recording" +msgstr "Capture" + +#: aplay/aplay.c:2747 +#, c-format +msgid "Rate %d Hz, " +msgstr "Fréquence %d Hz, " + +#: aplay/aplay.c:2749 +#, c-format +msgid "Mono" +msgstr "" + +#: aplay/aplay.c:2751 +#, c-format +msgid "Stereo" +msgstr "Stéréo" + +#: aplay/aplay.c:2753 +#, c-format +msgid "Channels %i" +msgstr "%i Canaux" + +#: aplay/aplay.c:3356 +#, fuzzy, c-format +msgid "You need to specify %u files" +msgstr "Vous devez spécifier %d fichiers" + +#: aplay/aplay.c:3409 +#, c-format +msgid "You need to specify %d files" +msgstr "Vous devez spécifier %d fichiers" + +#: seq/aconnect/aconnect.c:49 +#, c-format +msgid "aconnect - ALSA sequencer connection manager\n" +msgstr "aconnect - gestionnaire de connection séquenceur ALSA\n" + +#: seq/aconnect/aconnect.c:50 +#, c-format +msgid "Copyright (C) 1999-2000 Takashi Iwai\n" +msgstr "" + +#: seq/aconnect/aconnect.c:51 +#, c-format +msgid "Usage:\n" +msgstr "Utilisation:\n" + +#: seq/aconnect/aconnect.c:52 +#, c-format +msgid " * Connection/disconnection between two ports\n" +msgstr " * Connexion/déconnexion entre deux ports\n" + +#: seq/aconnect/aconnect.c:53 +#, c-format +msgid " aconnect [-options] sender receiver\n" +msgstr " aconnect [-options] envoyeur destinataire\n" + +#: seq/aconnect/aconnect.c:54 +#, c-format +msgid " sender, receiver = client:port pair\n" +msgstr " envoyeur, destinataire = couple client:port\n" + +#: seq/aconnect/aconnect.c:55 +#, c-format +msgid " -d,--disconnect disconnect\n" +msgstr " -d,--disconnect déconnecter\n" + +#: seq/aconnect/aconnect.c:56 +#, c-format +msgid " -e,--exclusive exclusive connection\n" +msgstr " -e,--exclusive connexion exclusive\n" + +#: seq/aconnect/aconnect.c:57 +#, c-format +msgid " -r,--real # convert real-time-stamp on queue\n" +msgstr "" + +#: seq/aconnect/aconnect.c:58 +#, c-format +msgid " -t,--tick # convert tick-time-stamp on queue\n" +msgstr "" + +#: seq/aconnect/aconnect.c:59 +#, c-format +msgid " * List connected ports (no subscription action)\n" +msgstr " * Afficher la liste des ports connectés (pas de souscription)\n" + +#: seq/aconnect/aconnect.c:60 +#, c-format +msgid " aconnect -i|-o [-options]\n" +msgstr " aconnect -i|-o [-options]\n" + +#: seq/aconnect/aconnect.c:61 +#, c-format +msgid " -i,--input list input (readable) ports\n" +msgstr " -i,--input afficher la liste des ports d'entrée\n" + +#: seq/aconnect/aconnect.c:62 +#, c-format +msgid " -o,--output list output (writable) ports\n" +msgstr " -o,--output afficher la liste des ports de sortie\n" + +#: seq/aconnect/aconnect.c:63 +#, c-format +msgid " -l,--list list current connections of each port\n" +msgstr "" +" -l,--list afficher la liste des connexions en cours\n" +" sur chaque port\n" + +#: seq/aconnect/aconnect.c:64 +#, c-format +msgid " * Remove all exported connections\n" +msgstr " * Retirer toutes les connexions exportées\n" + +#: seq/aconnect/aconnect.c:65 +#, c-format +msgid " -x, --removeall\n" +msgstr " -x, --removeall\n" + +#: seq/aconnect/aconnect.c:132 +msgid "Connecting To" +msgstr "Connexion À" + +#: seq/aconnect/aconnect.c:133 +msgid "Connected From" +msgstr "Connecté Depuis" + +#: seq/aconnect/aconnect.c:171 +#, fuzzy, c-format +msgid "client %d: '%s' [type=%s" +msgstr "client %d: '%s' [type=%s]\n" + +#: seq/aconnect/aconnect.c:175 +msgid "user" +msgstr "utilisateur" + +#: seq/aconnect/aconnect.c:175 +msgid "kernel" +msgstr "noyau" + +#: seq/aconnect/aconnect.c:323 +#, c-format +msgid "can't open sequencer\n" +msgstr "le séquenceur n'a pas pu être ouvert\n" + +#: seq/aconnect/aconnect.c:351 +#, c-format +msgid "can't get client id\n" +msgstr "l'identifiant du client n'as pas pu être obtenu\n" + +#: seq/aconnect/aconnect.c:358 +#, c-format +msgid "can't set client info\n" +msgstr "les infos du client n'ont pas pu être définies\n" + +#: seq/aconnect/aconnect.c:365 +#, c-format +msgid "invalid sender address %s\n" +msgstr "l'addresse envoyeur %s est incorrecte\n" + +#: seq/aconnect/aconnect.c:370 seq/aseqnet/aseqnet.c:290 +#, c-format +msgid "invalid destination address %s\n" +msgstr "l'addresse destinataire %s est incorrecte\n" + +#: seq/aconnect/aconnect.c:384 +#, c-format +msgid "No subscription is found\n" +msgstr "Aucune souscription trouvée\n" + +#: seq/aconnect/aconnect.c:389 +#, c-format +msgid "Disconnection failed (%s)\n" +msgstr "La déconnexion a échoué (%s)\n" + +#: seq/aconnect/aconnect.c:395 +#, c-format +msgid "Connection is already subscribed\n" +msgstr "La connexion a déjà été souscrite\n" + +#: seq/aconnect/aconnect.c:400 +#, c-format +msgid "Connection failed (%s)\n" +msgstr "Échec de connexion (%s)\n" + +#: seq/aseqnet/aseqnet.c:164 +#, c-format +msgid "aseqnet - network client/server on ALSA sequencer\n" +msgstr "aseqnet - client/serveur réseau sur le séquenceur ALSA\n" + +#: seq/aseqnet/aseqnet.c:165 +#, c-format +msgid " Copyright (C) 1999 Takashi Iwai\n" +msgstr "" + +#: seq/aseqnet/aseqnet.c:166 +#, c-format +msgid "usage:\n" +msgstr "utilisation:\n" + +#: seq/aseqnet/aseqnet.c:167 +#, c-format +msgid " server mode: aseqnet [-options]\n" +msgstr " mode serveur: aseqnet [-options]\n" + +#: seq/aseqnet/aseqnet.c:168 +#, c-format +msgid " client mode: aseqnet [-options] server_host\n" +msgstr " mode client: aseqnet [-options] hôte_serveur\n" + +#: seq/aseqnet/aseqnet.c:169 +#, c-format +msgid "options:\n" +msgstr "options:\n" + +#: seq/aseqnet/aseqnet.c:170 +#, fuzzy, c-format +msgid " -p,--port # : specify TCP port (digit or service name)\n" +msgstr " -p,--port # : spécifier le port TCP (numéro ou nom de service)\n" + +#: seq/aseqnet/aseqnet.c:171 +#, c-format +msgid " -s,--source addr : read from given addr (client:port)\n" +msgstr " -s,--source addr : lire à partir de l'addr. donnée (client:port)\n" + +#: seq/aseqnet/aseqnet.c:172 +#, c-format +msgid " -d,--dest addr : write to given addr (client:port)\n" +msgstr " -d,--dest addr : écrire à l'addr. donnée (client:port)\n" + +#: seq/aseqnet/aseqnet.c:173 +#, c-format +msgid " -v, --verbose : print verbose messages\n" +msgstr " -v, --verbose : affichage locace de messages\n" + +#: seq/aseqnet/aseqnet.c:174 +#, c-format +msgid " -i, --info : print certain received events\n" +msgstr " -i, --info : afficher certains évènements reçus\n" + +#: seq/aseqnet/aseqnet.c:188 +#, c-format +msgid "can't malloc\n" +msgstr "échec allocation mémoire (malloc)\n" + +#: seq/aseqnet/aseqnet.c:213 +#, c-format +msgid "closing files..\n" +msgstr "fermeture des fichiers...\n" + +#: seq/aseqnet/aseqnet.c:272 +#, c-format +msgid "sequencer opened: %d:%d\n" +msgstr "séquenceur ouvert: %d:%d\n" + +#: seq/aseqnet/aseqnet.c:279 +#, c-format +msgid "invalid source address %s\n" +msgstr "addresse source %s incorrecte\n" + +#: seq/aseqnet/aseqnet.c:309 +#, c-format +msgid "service '%s' is not found in /etc/services\n" +msgstr "le service '%s' n'as pas été trouvé dans /etc/services\n" + +#: seq/aseqnet/aseqnet.c:377 +#, c-format +msgid "too many connections!\n" +msgstr "trop de connexions!\n" + +#: seq/aseqnet/aseqnet.c:388 +#, c-format +msgid "accepted[%d]\n" +msgstr "accepté[%d]\n" + +#: seq/aseqnet/aseqnet.c:411 +#, c-format +msgid "can't get address %s\n" +msgstr "l'addresse %s na pas pu être obtenue\n" + +#: seq/aseqnet/aseqnet.c:422 +#, c-format +msgid "ok.. connected\n" +msgstr "ok.. connecté\n" + +#: seq/aseqnet/aseqnet.c:518 +#, c-format +msgid "Channel %2d: Control event : %5d\n" +msgstr "Canal %2d: Évènement de contrôle: %5d\n" + +#: seq/aseqnet/aseqnet.c:522 +#, c-format +msgid "Channel %2d: Pitchbender : %5d\n" +msgstr "Canal %2d: Pitchbender : %5d\n" + +#: seq/aseqnet/aseqnet.c:526 +#, c-format +msgid "Channel %2d: Note On event : %5d\n" +msgstr "Canal %2d: évènement Note On : %5d\n" + +#: seq/aseqnet/aseqnet.c:530 +#, c-format +msgid "Channel %2d: Note Off event: %5d\n" +msgstr "Canal %2d: évènement Note Off : %5d\n" + +#: seq/aseqnet/aseqnet.c:585 +#, c-format +msgid "disconnected\n" +msgstr "déconnecté\n" + +#: speaker-test/speaker-test.c:120 +msgid "Front Left" +msgstr "Avant Gauche" + +#: speaker-test/speaker-test.c:121 +msgid "Front Right" +msgstr "Avant Droit" + +#: speaker-test/speaker-test.c:122 +msgid "Rear Left" +msgstr "Arrière Gauche" + +#: speaker-test/speaker-test.c:123 +msgid "Rear Right" +msgstr "Arrière Droit" + +#: speaker-test/speaker-test.c:125 +msgid "LFE" +msgstr "" + +#: speaker-test/speaker-test.c:126 +msgid "Side Left" +msgstr "Côté Gauche" + +#: speaker-test/speaker-test.c:127 +msgid "Side Right" +msgstr "Côté Droit" + +#: speaker-test/speaker-test.c:128 +msgid "Channel 9" +msgstr "Canal 9" + +#: speaker-test/speaker-test.c:129 +msgid "Channel 10" +msgstr "Canal 10" + +#: speaker-test/speaker-test.c:130 +msgid "Channel 11" +msgstr "Canal 11" + +#: speaker-test/speaker-test.c:131 +msgid "Channel 12" +msgstr "Canal 12" + +#: speaker-test/speaker-test.c:132 +msgid "Channel 13" +msgstr "Canal 13" + +#: speaker-test/speaker-test.c:133 +msgid "Channel 14" +msgstr "Canal 14" + +#: speaker-test/speaker-test.c:134 +msgid "Channel 15" +msgstr "Canal 15" + +#: speaker-test/speaker-test.c:135 +msgid "Channel 16" +msgstr "Canal 16" + +#: speaker-test/speaker-test.c:424 +#, c-format +msgid "Broken configuration for playback: no configurations available: %s\n" +msgstr "Configuration erronée pour la lecture: pas de configuration: %s\n" + +#: speaker-test/speaker-test.c:431 +#, c-format +msgid "Access type not available for playback: %s\n" +msgstr "Le type d'accès est indisponible à la lecture: %s\n" + +#: speaker-test/speaker-test.c:438 +#, c-format +msgid "Sample format not available for playback: %s\n" +msgstr "Le format d'échantillonage est indisponible à la lecture: %s\n" + +#: speaker-test/speaker-test.c:445 +#, c-format +msgid "Channels count (%i) not available for playbacks: %s\n" +msgstr "Le nombre (%i) de canaux est indisponible à la lecture: %s\n" + +#: speaker-test/speaker-test.c:453 +#, c-format +msgid "Rate %iHz not available for playback: %s\n" +msgstr "La fréquence %iHz est indisponible à la lecture: %s\n" + +#: speaker-test/speaker-test.c:458 +#, c-format +msgid "Rate doesn't match (requested %iHz, get %iHz, err %d)\n" +msgstr "" +"La fréquence ne correspond pas (demandée: %iHz, obtenue %iHz, err %d)\n" + +#: speaker-test/speaker-test.c:462 +#, c-format +msgid "Rate set to %iHz (requested %iHz)\n" +msgstr "La fréquence est %iHz (demandée %iHz)\n" + +#: speaker-test/speaker-test.c:468 +#, c-format +msgid "Buffer size range from %lu to %lu\n" +msgstr "L'intervalle de la taille du tampon est de %lu à %lu\n" + +#: speaker-test/speaker-test.c:469 +#, c-format +msgid "Period size range from %lu to %lu\n" +msgstr "L'intervalle de la taille de la période est de %lu à %lu\n" + +#: speaker-test/speaker-test.c:471 +#, c-format +msgid "Requested period time %u us\n" +msgstr "Temps de période demandé %u µs\n" + +#: speaker-test/speaker-test.c:474 +#, c-format +msgid "Unable to set period time %u us for playback: %s\n" +msgstr "Le temps de période %u µs n'a pas pu être défini pour la lecture: %s\n" + +#: speaker-test/speaker-test.c:480 +#, c-format +msgid "Requested buffer time %u us\n" +msgstr "Temps tampon demandé %u µs\n" + +#: speaker-test/speaker-test.c:483 +#, c-format +msgid "Unable to set buffer time %u us for playback: %s\n" +msgstr "Le temps tampon de %u µs n'a pas pu être définie pour la lecture: %s\n" + +#: speaker-test/speaker-test.c:492 +#, c-format +msgid "Using max buffer size %lu\n" +msgstr "Taille max. de tampon %lu utilisée\n" + +#: speaker-test/speaker-test.c:495 +#, c-format +msgid "Unable to set buffer size %lu for playback: %s\n" +msgstr "La taile de tampon %lu n'a pas pu être définie pour la lecture: %s\n" + +#: speaker-test/speaker-test.c:501 +#, c-format +msgid "Periods = %u\n" +msgstr "Périodes = %u\n" + +#: speaker-test/speaker-test.c:504 +#, c-format +msgid "Unable to set nperiods %u for playback: %s\n" +msgstr "nperiods %u n'a pas pu être défini pour la lecture: %s\n" + +#: speaker-test/speaker-test.c:513 +#, c-format +msgid "Unable to set hw params for playback: %s\n" +msgstr "" +"Les paramètres matériel n'ont pas pu être définis pour la lecture: %s\n" + +#: speaker-test/speaker-test.c:519 +#, c-format +msgid "was set period_size = %lu\n" +msgstr "" + +#: speaker-test/speaker-test.c:520 +#, c-format +msgid "was set buffer_size = %lu\n" +msgstr "" + +#: speaker-test/speaker-test.c:522 +#, c-format +msgid "buffer to small, could not use\n" +msgstr "tampon trop petit, il n'a pas pu être utilisé\n" + +#: speaker-test/speaker-test.c:535 +#, c-format +msgid "Unable to determine current swparams for playback: %s\n" +msgstr "" +"Les paramètres logiciels actuels n'ont pas pu être déterminés pour la " +"lecture: %s\n" + +#: speaker-test/speaker-test.c:542 +#, c-format +msgid "Unable to set start threshold mode for playback: %s\n" +msgstr "" + +#: speaker-test/speaker-test.c:549 +#, c-format +msgid "Unable to set avail min for playback: %s\n" +msgstr "" + +#: speaker-test/speaker-test.c:556 +#, c-format +msgid "Unable to set sw params for playback: %s\n" +msgstr "" +"Les paramètres logiciel n'ont pas pu être définis pour la lecture: %s\n" + +#: speaker-test/speaker-test.c:576 +#, fuzzy, c-format +msgid "Unable to set channel map: %s\n" +msgstr "" +"Les paramètres matériel n'ont pas pu être définis pour la lecture: %s\n" + +#: speaker-test/speaker-test.c:601 +#, c-format +msgid "Can't recovery from underrun, prepare failed: %s\n" +msgstr "" + +#: speaker-test/speaker-test.c:612 +#, c-format +msgid "Can't recovery from suspend, prepare failed: %s\n" +msgstr "" + +#: speaker-test/speaker-test.c:676 speaker-test/speaker-test.c:1191 +#, c-format +msgid "No enough memory\n" +msgstr "Pas assez de mémoire\n" + +#: speaker-test/speaker-test.c:681 +#, c-format +msgid "Cannot open WAV file %s\n" +msgstr "Le fichier WAV %s n'a pas pu être ouvert\n" + +#: speaker-test/speaker-test.c:685 speaker-test/speaker-test.c:714 +#, c-format +msgid "Invalid WAV file %s\n" +msgstr "Fichier WAV incorrect %s\n" + +#: speaker-test/speaker-test.c:690 +#, c-format +msgid "Not a WAV file: %s\n" +msgstr "Le fichier %s n'est pas au format WAV\n" + +#: speaker-test/speaker-test.c:694 +#, c-format +msgid "Unsupported WAV format %d for %s\n" +msgstr "Format WAV %d non supporté pour %s\n" + +#: speaker-test/speaker-test.c:699 +#, c-format +msgid "%s is not a mono stream (%d channels)\n" +msgstr "%s n'est pas un flux en mono (%d canaux)\n" + +#: speaker-test/speaker-test.c:704 +#, c-format +msgid "Sample rate doesn't match (%d) for %s\n" +msgstr "La fréquence d'échantillonage (%d) ne correspond pas à %s\n" + +#: speaker-test/speaker-test.c:709 +#, c-format +msgid "Unsupported sample format bits %d for %s\n" +msgstr "Le format d'échantillonage %d bits n'est pas supporté pour %s\n" + +#: speaker-test/speaker-test.c:770 +#, c-format +msgid "Undefined channel %d\n" +msgstr "Canal non-défini %d\n" + +#: speaker-test/speaker-test.c:821 +#, c-format +msgid "Write error: %d,%s\n" +msgstr "Erreur en écriture: %d,%s\n" + +#: speaker-test/speaker-test.c:823 +#, c-format +msgid "xrun_recovery failed: %d,%s\n" +msgstr "" + +#: speaker-test/speaker-test.c:926 +#, fuzzy, c-format +msgid "" +"Usage: speaker-test [OPTION]... \n" +"-h,--help\thelp\n" +"-D,--device\tplayback device\n" +"-r,--rate\tstream rate in Hz\n" +"-c,--channels\tcount of channels in stream\n" +"-f,--frequency\tsine wave frequency in Hz\n" +"-F,--format\tsample format\n" +"-b,--buffer\tring buffer size in us\n" +"-p,--period\tperiod size in us\n" +"-P,--nperiods\tnumber of periods\n" +"-t,--test\tpink=use pink noise, sine=use sine wave, wav=WAV file\n" +"-l,--nloops\tspecify number of loops to test, 0 = infinite\n" +"-s,--speaker\tsingle speaker test. Values 1=Left, 2=right, etc\n" +"-w,--wavfile\tUse the given WAV file as a test sound\n" +"-W,--wavdir\tSpecify the directory containing WAV files\n" +"-m,--chmap\tSpecify the channel map to override\n" +"-X,--force-frequency\tforce frequencies outside the 30-8000hz range\n" +"-S,--scale\tScale of generated test tones in percent (default=80)\n" +"\n" +msgstr "" +"Utilisation: speaker-test [OPTION]...\n" +"-h,--help\taide\n" +"-D,--device\tpériphérique de lecture\n" +"-r,--rate\tfréquence du flux en Hz\n" +"-c,--channels\tnombre de canaux du flux\n" +"-f,--frequency\tfréquence courbe sinus en Hz\n" +"-F,--format\tformat d'échantillonage\n" +"-b,--buffer\ttaille en µs du tampon circulaire\n" +"-p,--period\ttaille de la période en µs\n" +"-P,--nperiods\tnombre de périodes\n" +"-t,--test\tpink=pink noise, sine=courbe sinus, wav=fichier WAV\n" +"-l,--nloops\tspécifier le nombre de motifs à tester, 0 = infini\n" +"-s,--speaker\ttest sur une seule enceinte.\n" +"\t\tValeurs 1=Gauche, 2=Droite, et c.\n" +"-w,--wavfile\tUtiliser le fichier WAV spécifié pour le test\n" +"-w,--wavdir\tSpécifier le répertoire contenant les fichiers WAV\n" +"-X,--force-frequency\tpermettre fréquences en dehors de la gamme 30-8000Hz\n" +"\n" + +#: speaker-test/speaker-test.c:1058 +#, c-format +msgid "Invalid number of periods %d\n" +msgstr "Nombre de périodes %d incorrect\n" + +#: speaker-test/speaker-test.c:1074 speaker-test/speaker-test.c:1078 +#, c-format +msgid "Invalid test type %s\n" +msgstr "Type de test %s incorrect\n" + +#: speaker-test/speaker-test.c:1111 +#, c-format +msgid "Unknown option '%c'\n" +msgstr "Option '%c' inconnue\n" + +#: speaker-test/speaker-test.c:1125 +#, c-format +msgid "Invalid parameter for -s option.\n" +msgstr "Paramètre incorrect pour l'option -s.\n" + +#: speaker-test/speaker-test.c:1140 +#, c-format +msgid "Playback device is %s\n" +msgstr "Le périphérique de lecture est %s\n" + +#: speaker-test/speaker-test.c:1141 +#, c-format +msgid "Stream parameters are %iHz, %s, %i channels\n" +msgstr "Les paramètres du flux sont %iHz, %s, %i canaux\n" + +#: speaker-test/speaker-test.c:1144 +#, c-format +msgid "Using 16 octaves of pink noise\n" +msgstr "Utilisation de 16 octaves de 'pink noise'\n" + +#: speaker-test/speaker-test.c:1147 +#, c-format +msgid "Sine wave rate is %.4fHz\n" +msgstr "La fréquence de la courbe sinus est %.4fHz\n" + +#: speaker-test/speaker-test.c:1150 +#, c-format +msgid "WAV file(s)\n" +msgstr "fichier(s) WAV\n" + +#: speaker-test/speaker-test.c:1160 +#, c-format +msgid "Playback open error: %d,%s\n" +msgstr "Erreur d'ouverture à la lecture: %d,%s\n" + +#: speaker-test/speaker-test.c:1166 +#, c-format +msgid "Setting of hwparams failed: %s\n" +msgstr "Échec de la configuration des paramètres matériel: %s\n" + +#: speaker-test/speaker-test.c:1170 +#, c-format +msgid "Setting of swparams failed: %s\n" +msgstr "Échec de la configuration des paramètres logiciel: %s\n" + +#: speaker-test/speaker-test.c:1216 speaker-test/speaker-test.c:1238 +#, c-format +msgid "Transfer failed: %s\n" +msgstr "Échec du transfer: %s\n" + +#: speaker-test/speaker-test.c:1224 +#, c-format +msgid "Time per period = %lf\n" +msgstr "Temps par période = %lf\n" + +#~ msgid "Warning: format is changed to S16_LE\n" +#~ msgstr "Avertissement: le format est changé en S16_LE\n" + +#~ msgid "Warning: format is changed to S24_3LE\n" +#~ msgstr "Avertissement: le format est changé en S24_3LE\n" + +#~ msgid "Warning: format is changed to S24_LE\n" +#~ msgstr "Avertissement: le format est changé en S24_LE\n" diff --git a/po/insert-header.sin b/po/insert-header.sin new file mode 100644 index 0000000..b26de01 --- /dev/null +++ b/po/insert-header.sin @@ -0,0 +1,23 @@ +# Sed script that inserts the file called HEADER before the header entry. +# +# At each occurrence of a line starting with "msgid ", we execute the following +# commands. At the first occurrence, insert the file. At the following +# occurrences, do nothing. The distinction between the first and the following +# occurrences is achieved by looking at the hold space. +/^msgid /{ +x +# Test if the hold space is empty. +s/m/m/ +ta +# Yes it was empty. First occurrence. Read the file. +r HEADER +# Output the file's contents by reading the next line. But don't lose the +# current line while doing this. +g +N +bb +:a +# The hold space was nonempty. Following occurrences. Do nothing. +x +:b +} diff --git a/po/ja.gmo b/po/ja.gmo new file mode 100644 index 0000000..b9e6afe Binary files /dev/null and b/po/ja.gmo differ diff --git a/po/ja.po b/po/ja.po new file mode 100644 index 0000000..e1839a7 --- /dev/null +++ b/po/ja.po @@ -0,0 +1,1693 @@ +# Japanese translations for alsa-utils package +# alsa-utils パッケージに対する英訳. +# Copyright (C) 2005 Free Software Foundation, Inc. +# This file is distributed under the same license as the alsa-utils package. +# Takashi Iwai , 2005. +# +msgid "" +msgstr "" +"Project-Id-Version: alsa-utils 1.0.9a\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2020-10-15 11:46+0000\n" +"PO-Revision-Date: 2009-05-27 15:08+0200\n" +"Last-Translator: Takashi Iwai \n" +"Language-Team: Japanese\n" +"Language: ja\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=1; plural=0;\n" + +#: alsamixer/card_select.c:77 alsamixer/device_name.c:127 +msgid "Sound Card" +msgstr "サウンドカード" + +#: alsamixer/card_select.c:115 +msgid "(default)" +msgstr "(デフォルト)" + +#: alsamixer/card_select.c:125 +msgid "cannot enumerate sound cards" +msgstr "サウンドカードを検出できません" + +#: alsamixer/card_select.c:147 +msgid "enter device name..." +msgstr "デバイス名入力..." + +#: alsamixer/cli.c:43 +msgid "Usage: alsamixer [options]" +msgstr "使用法: alsamixer [オプション]" + +#: alsamixer/cli.c:44 +#, fuzzy +msgid "" +"Useful options:\n" +" -h, --help this help\n" +" -c, --card=NUMBER sound card number or id\n" +" -D, --device=NAME mixer device name\n" +" -m, --mouse enable mouse\n" +" -M, --no-mouse disable mouse\n" +" -f, --config=FILE configuration file\n" +" -F, --no-config do not load configuration file\n" +" -V, --view=MODE starting view mode: playback/capture/all" +msgstr "" +"主なオプション:\n" +" -h, --help このヘルプ画面\n" +" -c, --card=番号 サウンドカード番号またはID\n" +" -D, --device=名前 ミキサーデバイス名\n" +" -V, --view=表示モード 開始時の表示モード: playback/capture/all" + +#: alsamixer/cli.c:53 +msgid "" +"Debugging options:\n" +" -g, --no-color toggle using of colors\n" +" -a, --abstraction=NAME mixer abstraction level: none/basic" +msgstr "" +"デバッグオプション:\n" +" -g, --no-color カラー/モノクロ表示\n" +" -a, --abstraction=名前 ミキサー抽象レベル: none/basic" + +#: alsamixer/cli.c:88 +#, c-format +msgid "invalid card index: %s\n" +msgstr "不正なカード番号: %s\n" + +#: alsamixer/cli.c:126 +#, c-format +msgid "unknown abstraction level: %s\n" +msgstr "未知の抽象レベル: %s\n" + +#: alsamixer/cli.c:131 +#, c-format +msgid "unknown option: %c\n" +msgstr "未知のオプション '%c'\n" + +#: alsamixer/cli.c:133 +msgid "try `alsamixer --help' for more information\n" +msgstr "より詳しい情報は「alsamixer --help」を実行してください\n" + +#: alsamixer/device_name.c:177 +msgid "Device name:" +msgstr "デバイス名:" + +#: alsamixer/die.c:37 +#, c-format +msgid "%s: %s\n" +msgstr "" + +#: alsamixer/mixer_display.c:99 +msgid "Card:" +msgstr "カード:" + +#: alsamixer/mixer_display.c:100 +msgid "Chip:" +msgstr "チップ:" + +#: alsamixer/mixer_display.c:101 +msgid "View:" +msgstr "表示:" + +#: alsamixer/mixer_display.c:102 +msgid "Item:" +msgstr "項目:" + +#: alsamixer/mixer_display.c:105 +msgid "F1: Help" +msgstr "F1: ヘルプ" + +#: alsamixer/mixer_display.c:106 +msgid "F2: System information" +msgstr "F2: システム情報" + +#: alsamixer/mixer_display.c:107 +msgid "F6: Select sound card" +msgstr "F6: サウンドカード選択" + +#: alsamixer/mixer_display.c:108 +msgid "Esc: Exit" +msgstr "Esc: 終了" + +#: alsamixer/mixer_display.c:179 +msgid "(unplugged)" +msgstr "" + +#: alsamixer/mixer_display.c:197 +msgid "Playback" +msgstr "再生" + +#: alsamixer/mixer_display.c:198 +msgid "Capture" +msgstr "録音" + +#: alsamixer/mixer_display.c:199 +msgid "All" +msgstr "全て" + +#: alsamixer/mixer_display.c:240 +msgid "mute" +msgstr "ミュート" + +#: alsamixer/mixer_display.c:281 alsamixer/mixer_display.c:291 +msgid "dB gain:" +msgstr "dBゲイン:" + +#: alsamixer/mixer_display.c:291 +#, c-format +msgid " [%s %s, %s]" +msgstr "" + +#: alsamixer/mixer_display.c:300 alsamixer/mixer_display.c:306 +#: alsamixer/mixer_display.c:312 alsamixer/mixer_display.c:318 +msgid "Off" +msgstr "オフ" + +#: alsamixer/mixer_display.c:306 alsamixer/mixer_display.c:318 +msgid "On" +msgstr "オン" + +#: alsamixer/mixer_display.c:370 +msgid "The sound device was unplugged." +msgstr "デバイスが接続されていません" + +#: alsamixer/mixer_display.c:371 +msgid "Press F6 to select another sound card." +msgstr "他のカードを選択するにはF6を押して下さい" + +#: alsamixer/mixer_display.c:386 +msgid "This sound device does not have any playback controls." +msgstr "このカードには再生ミキサーがありません" + +#: alsamixer/mixer_display.c:388 +msgid "This sound device does not have any capture controls." +msgstr "このカードには録音ミキサーがありません" + +#: alsamixer/mixer_display.c:390 +msgid "This sound device does not have any controls." +msgstr "このカードには制御可能なミキサーがありません" + +#. TRANSLATORS: playback on; one character +#: alsamixer/mixer_display.c:523 alsamixer/mixer_display.c:528 +msgid "O" +msgstr "" + +#. TRANSLATORS: playback muted; one character +#: alsamixer/mixer_display.c:525 alsamixer/mixer_display.c:529 +msgid "M" +msgstr "" + +#. TRANSLATORS: "left"; no more than two characters +#: alsamixer/mixer_display.c:545 +msgid "L" +msgstr "" + +#. TRANSLATORS: "right"; no more than two characters +#: alsamixer/mixer_display.c:551 +msgid "R" +msgstr "" + +#. TRANSLATORS: no more than eight characters +#: alsamixer/mixer_display.c:555 +msgid "CAPTURE" +msgstr "録音" + +#: alsamixer/mixer_display.c:611 +msgid "Front" +msgstr "フロント" + +#: alsamixer/mixer_display.c:614 +msgid "Rear" +msgstr "リア" + +#: alsamixer/mixer_display.c:617 speaker-test/speaker-test.c:124 +msgid "Center" +msgstr "センター" + +#: alsamixer/mixer_display.c:620 +msgid "Woofer" +msgstr "低音" + +#: alsamixer/mixer_display.c:623 +msgid "Side" +msgstr "サイド" + +#: alsamixer/mixer_widget.c:91 alsamixer/mixer_widget.c:96 +msgid "cannot open mixer" +msgstr "ミキサーを開けません" + +#: alsamixer/mixer_widget.c:102 alsamixer/mixer_widget.c:179 +msgid "cannot load mixer controls" +msgstr "ミキサーをロードできません" + +#: alsamixer/mixer_widget.c:169 +#, c-format +msgid "Cannot open mixer device '%s'." +msgstr "ミキサーデバイス'%s'を開けません" + +#: alsamixer/mixer_widget.c:190 +msgid "Esc Exit" +msgstr "Esc 終了" + +#: alsamixer/mixer_widget.c:191 +msgid "F1 ? H Help" +msgstr "F1 ? H ヘルプ" + +#: alsamixer/mixer_widget.c:192 +msgid "F2 / System information" +msgstr "F2 / システム情報" + +#: alsamixer/mixer_widget.c:193 +msgid "F3 Show playback controls" +msgstr "F3 再生ミキサー表示" + +#: alsamixer/mixer_widget.c:194 +msgid "F4 Show capture controls" +msgstr "F4 録音ミキサー表示" + +#: alsamixer/mixer_widget.c:195 +msgid "F5 Show all controls" +msgstr "F5 全て表示" + +#: alsamixer/mixer_widget.c:196 +msgid "Tab Toggle view mode (F3/F4/F5)" +msgstr "Tab 表示モード変更 (F3/F4/F5)" + +#: alsamixer/mixer_widget.c:197 +msgid "F6 S Select sound card" +msgstr "F5 S サウンドカード選択" + +#: alsamixer/mixer_widget.c:198 +msgid "L Redraw screen" +msgstr "L 画面再描画" + +#: alsamixer/mixer_widget.c:200 +msgid "Left Move to the previous control" +msgstr "← 前の項目に移る" + +#: alsamixer/mixer_widget.c:201 +msgid "Right Move to the next control" +msgstr "→ 次の項目に移る" + +# ↑ +#: alsamixer/mixer_widget.c:203 +msgid "Up/Down Change volume" +msgstr "↑/↓ 音量変更" + +#: alsamixer/mixer_widget.c:204 +msgid "+ - Change volume" +msgstr "+ - 音量変更" + +#: alsamixer/mixer_widget.c:205 +msgid "Page Up/Dn Change volume in big steps" +msgstr "Page Up/dn 音量変更" + +#: alsamixer/mixer_widget.c:206 +msgid "End Set volume to 0%" +msgstr "End 音量 0%" + +#: alsamixer/mixer_widget.c:207 +msgid "0-9 Set volume to 0%-90%" +msgstr "0-9 音量 0%-90%" + +#: alsamixer/mixer_widget.c:208 +msgid "Q W E Increase left/both/right volumes" +msgstr "Q W E 左/両/右音量アップ" + +#. TRANSLATORS: or Y instead of Z +#: alsamixer/mixer_widget.c:210 +msgid "Z X C Decrease left/both/right volumes" +msgstr "Z X C 左/両/右音量ダウン" + +#: alsamixer/mixer_widget.c:211 +msgid "B Balance left and right volumes" +msgstr "B 左右音量を平均化する" + +#: alsamixer/mixer_widget.c:213 +msgid "M Toggle mute" +msgstr "M ミュートをトグル" + +#. TRANSLATORS: or , . +#: alsamixer/mixer_widget.c:215 +msgid "< > Toggle left/right mute" +msgstr "< > 左/右ミュートをトグル" + +#: alsamixer/mixer_widget.c:217 +msgid "Space Toggle capture" +msgstr "スペース 録音をトグル" + +#. TRANSLATORS: or Insert Delete +#: alsamixer/mixer_widget.c:219 +msgid "; ' Toggle left/right capture" +msgstr "; ' 左/右録音をトグル" + +#: alsamixer/mixer_widget.c:221 +msgid "Authors:" +msgstr "作者:" + +#: alsamixer/mixer_widget.c:222 +msgid " Tim Janik" +msgstr "" + +#: alsamixer/mixer_widget.c:223 +msgid " Jaroslav Kysela " +msgstr "" + +#: alsamixer/mixer_widget.c:224 +msgid " Clemens Ladisch " +msgstr "" + +#: alsamixer/mixer_widget.c:226 +msgid "Help" +msgstr "ヘルプ" + +#: alsamixer/proc_files.c:56 +msgid "Select File" +msgstr "ファイル選択" + +#: alsamixer/textbox.c:51 alsamixer/textbox.c:65 +msgid "Error" +msgstr "エラー" + +#: alsamixer/textbox.c:80 +#, c-format +msgid "Cannot open file \"%s\"." +msgstr "\"%s\"をオープンできません" + +#: aplay/aplay.c:180 +msgid "raw data" +msgstr "raw データ" + +#: aplay/aplay.c:181 +msgid "VOC" +msgstr "VOC" + +#: aplay/aplay.c:183 +msgid "WAVE" +msgstr "WAVE" + +#: aplay/aplay.c:184 +msgid "Sparc Audio" +msgstr "Sparc オーディオ" + +#: aplay/aplay.c:205 +#, fuzzy, c-format +msgid "" +"Usage: %s [OPTION]... [FILE]...\n" +"\n" +"-h, --help help\n" +" --version print current version\n" +"-l, --list-devices list all soundcards and digital audio devices\n" +"-L, --list-pcms list device names\n" +"-D, --device=NAME select PCM by name\n" +"-q, --quiet quiet mode\n" +"-t, --file-type TYPE file type (voc, wav, raw or au)\n" +"-c, --channels=# channels\n" +"-f, --format=FORMAT sample format (case insensitive)\n" +"-r, --rate=# sample rate\n" +"-d, --duration=# interrupt after # seconds\n" +"-s, --samples=# interrupt after # samples per channel\n" +"-M, --mmap mmap stream\n" +"-N, --nonblock nonblocking mode\n" +"-F, --period-time=# distance between interrupts is # microseconds\n" +"-B, --buffer-time=# buffer duration is # microseconds\n" +" --period-size=# distance between interrupts is # frames\n" +" --buffer-size=# buffer duration is # frames\n" +"-A, --avail-min=# min available space for wakeup is # microseconds\n" +"-R, --start-delay=# delay for automatic PCM start is # microseconds \n" +" (relative to buffer size if <= 0)\n" +"-T, --stop-delay=# delay for automatic PCM stop is # microseconds from " +"xrun\n" +"-v, --verbose show PCM structure and setup (accumulative)\n" +"-V, --vumeter=TYPE enable VU meter (TYPE: mono or stereo)\n" +"-I, --separate-channels one file for each channel\n" +"-i, --interactive allow interactive operation from stdin\n" +"-m, --chmap=ch1,ch2,.. Give the channel map to override or follow\n" +" --disable-resample disable automatic rate resample\n" +" --disable-channels disable automatic channel conversions\n" +" --disable-format disable automatic format conversions\n" +" --disable-softvol disable software volume control (softvol)\n" +" --test-position test ring buffer position\n" +" --test-coef=# test coefficient for ring buffer position (default " +"8)\n" +" expression for validation is: coef * (buffer_size / " +"2)\n" +" --test-nowait do not wait for ring buffer - eats whole CPU\n" +" --max-file-time=# start another output file when the old file has " +"recorded\n" +" for this many seconds\n" +" --process-id-file write the process ID here\n" +" --use-strftime apply the strftime facility to the output file name\n" +" --dump-hw-params dump hw_params of the device\n" +" --fatal-errors treat all errors as fatal\n" +msgstr "" +"使用法: %s [オプション]... [ファイル]...\n" +"\n" +"-h, --help ヘルプ\n" +" --version 現在のバージョンを表示\n" +"-l, --list-devices 全てのサウンドカードとオーディオデバイスを表示\n" +"-L, --list-pcms 全ての定義された PCM を表示\n" +"-D, --device=NAME 使用する PCM を指定\n" +"-q, --quiet quiet モード\n" +"-t, --file-type TYPE ファイルタイプ (voc, wav, raw または au)\n" +"-c, --channels=# チャネル数\n" +"-f, --format=FORMAT サンプルフォーマット (大/小文字区別)\n" +"-r, --rate=# サンプルレート\n" +"-d, --duration=# 指定の秒数後に終了\n" +"-M, --mmap mmap ストリーム\n" +"-N, --nonblock 非ブロックモード\n" +"-F, --period-time=# 割り込み間隔をμ秒で指定\n" +"-B, --buffer-time=# バッファの大きさをμ秒で指定\n" +" --period-size=# 割り込み間隔をフレーム数で指定\n" +" --buffer-size=# バッファの大きさをフレーム数で指定\n" +"-A, --avail-min=# wakeup の最少スペースをμ秒で指定\n" +"-R, --start-delay=# 指定のμ秒後に PCM を自動スタート\n" +" (0 以下の場合はバッファサイズより)\n" +"-T, --stop-delay=# XRUN から指定のμ秒後に PCM の自動停止\n" +"-v, --verbose PCM の設定を表示 (複数指定可能)\n" +"-V, --vumeter=TYPE enable VU meter (TYPE: mono or stereo)\n" +"-I, --separate-channels 各チャネルに一つのファイルを用いる\n" +" --disable-resample 自動レート変換を禁止する\n" +" --disable-channels 自動チャネル変換を禁止する\n" +" --disable-format 自動フォーマット変換を禁止する\n" +" --disable-softvol ソフト音量制御(softvol)を禁止する\n" +" --test-position リングバッファ位置をテストする\n" +" --test-coef=# リングバッファ位置テストの係数 (デフォルト 8)\n" +" テスト範囲: coef * (buffer_size / 2)\n" +" --test-nowait リングバッファのウエイトを禁止 - 注意:高CPU負荷\n" + +#: aplay/aplay.c:250 speaker-test/speaker-test.c:945 +#, c-format +msgid "Recognized sample formats are:" +msgstr "認識されるサンプルフォーマット:" + +#: aplay/aplay.c:256 +#, c-format +msgid "" +"\n" +"Some of these may not be available on selected hardware\n" +msgstr "" +"\n" +"これらのいくつかは指定のハードウェアで使用不可能な場合があります\n" + +#: aplay/aplay.c:257 +#, fuzzy, c-format +msgid "The available format shortcuts are:\n" +msgstr "可能なフォーマットの省略形:\n" + +#: aplay/aplay.c:258 +#, c-format +msgid "-f cd (16 bit little endian, 44100, stereo)\n" +msgstr "-f cd (16 ビット、リトルエンディアン、44100、ステレオ)\n" + +#: aplay/aplay.c:259 +#, c-format +msgid "-f cdr (16 bit big endian, 44100, stereo)\n" +msgstr "-f cdr (16 ビット、ビッグエンディアン、44100、ステレオ)\n" + +#: aplay/aplay.c:260 +#, c-format +msgid "-f dat (16 bit little endian, 48000, stereo)\n" +msgstr "-f dat (16 ビット、リトルエンディアン、48000、ステレオ)\n" + +#: aplay/aplay.c:274 +msgid "no soundcards found..." +msgstr "サウンドカードが見つかりません..." + +#: aplay/aplay.c:277 +#, c-format +msgid "**** List of %s Hardware Devices ****\n" +msgstr "**** ハードウェアデバイス %s のリスト ****\n" + +#: aplay/aplay.c:306 +#, c-format +msgid "card %i: %s [%s], device %i: %s [%s]\n" +msgstr "カード %i: %s [%s], デバイス %i: %s [%s]\n" + +#: aplay/aplay.c:312 +#, c-format +msgid " Subdevices: %i/%i\n" +msgstr " サブデバイス: %i/%i\n" + +#: aplay/aplay.c:319 +#, c-format +msgid " Subdevice #%i: %s\n" +msgstr " サブデバイス #%i: %s\n" + +#: aplay/aplay.c:400 +#, c-format +msgid "Aborted by signal %s...\n" +msgstr "シグナル %s で中断...\n" + +#: aplay/aplay.c:555 +msgid "command should be named either arecord or aplay" +msgstr "arecord または aplay コマンドのみ可能" + +#: aplay/aplay.c:599 +#, c-format +msgid "unrecognized file format %s" +msgstr "不正なファイルフォーマット %s" + +#: aplay/aplay.c:606 +#, fuzzy, c-format +msgid "invalid channels argument '%s'" +msgstr "送信アドレスが不正です: %s\n" + +#: aplay/aplay.c:610 +#, c-format +msgid "value %i for channels is invalid" +msgstr "不正なチャネル数 %i" + +#: aplay/aplay.c:629 +#, c-format +msgid "wrong extended format '%s'" +msgstr "不正な拡張フォーマット '%s'" + +#: aplay/aplay.c:637 +#, fuzzy, c-format +msgid "invalid rate argument '%s'" +msgstr "不正な送信アドレス %s\n" + +#: aplay/aplay.c:644 +#, c-format +msgid "bad speed value %i" +msgstr "不正なレート値 %i" + +#: aplay/aplay.c:650 +msgid "duration and samples arguments cannot be used together" +msgstr "" + +#: aplay/aplay.c:655 +#, fuzzy, c-format +msgid "invalid duration argument '%s'" +msgstr "受信アドレスが不正です: %s\n" + +#: aplay/aplay.c:662 +msgid "samples and duration arguments cannot be used together" +msgstr "" + +#: aplay/aplay.c:667 +#, fuzzy, c-format +msgid "invalid samples argument '%s'" +msgstr "送信アドレスが不正です: %s\n" + +#: aplay/aplay.c:679 +#, fuzzy, c-format +msgid "invalid period time argument '%s'" +msgstr "送信アドレスが不正です: %s\n" + +#: aplay/aplay.c:686 +#, fuzzy, c-format +msgid "invalid buffer time argument '%s'" +msgstr "不正な送信アドレス %s\n" + +#: aplay/aplay.c:693 +#, fuzzy, c-format +msgid "invalid period size argument '%s'" +msgstr "送信アドレスが不正です: %s\n" + +#: aplay/aplay.c:700 +#, fuzzy, c-format +msgid "invalid buffer size argument '%s'" +msgstr "不正な送信アドレス %s\n" + +#: aplay/aplay.c:707 +#, c-format +msgid "invalid min available space argument '%s'" +msgstr "" + +#: aplay/aplay.c:714 +#, fuzzy, c-format +msgid "invalid start delay argument '%s'" +msgstr "送信アドレスが不正です: %s\n" + +#: aplay/aplay.c:721 +#, fuzzy, c-format +msgid "invalid stop delay argument '%s'" +msgstr "送信アドレスが不正です: %s\n" + +#: aplay/aplay.c:776 +#, fuzzy, c-format +msgid "invalid test coef argument '%s'" +msgstr "不正な送信アドレス %s\n" + +#: aplay/aplay.c:788 +#, c-format +msgid "invalid max file time argument '%s'" +msgstr "" + +#: aplay/aplay.c:808 speaker-test/speaker-test.c:571 +#, fuzzy, c-format +msgid "Unable to parse channel map string: %s\n" +msgstr "avail_min を設定できません: %s\n" + +#: aplay/aplay.c:814 +#, c-format +msgid "Try `%s --help' for more information.\n" +msgstr "より詳しい情報は「%s --help」を実行してください\n" + +#: aplay/aplay.c:830 +#, c-format +msgid "audio open error: %s" +msgstr "" + +#: aplay/aplay.c:835 +#, c-format +msgid "info error: %s" +msgstr "" + +#: aplay/aplay.c:842 +#, c-format +msgid "nonblock setting error: %s" +msgstr "" + +#: aplay/aplay.c:852 aplay/aplay.c:976 aplay/aplay.c:1266 aplay/aplay.c:1466 +#: aplay/aplay.c:1986 aplay/aplay.c:2016 +msgid "not enough memory" +msgstr "メモリが足りません" + +#: aplay/aplay.c:876 +#, fuzzy, c-format +msgid "Cannot create process ID file %s: %s" +msgstr "WAVファイルがオープンできません: %s\n" + +#: aplay/aplay.c:966 +#, c-format +msgid "read error (called from line %i)" +msgstr "リードエラー (%i 行)" + +#: aplay/aplay.c:1033 +#, c-format +msgid "unknown length of 'fmt ' chunk (read %u, should be %u at least)" +msgstr "" + +#: aplay/aplay.c:1044 +#, c-format +msgid "" +"unknown length of extensible 'fmt ' chunk (read %u, should be %u at least)" +msgstr "" + +#: aplay/aplay.c:1049 +msgid "wrong format tag in extensible 'fmt ' chunk" +msgstr "" + +#: aplay/aplay.c:1056 +#, c-format +msgid "can't play WAVE-file format 0x%04x which is not PCM or FLOAT encoded" +msgstr "" + +#: aplay/aplay.c:1061 +#, c-format +msgid "can't play WAVE-files with %d tracks" +msgstr "%d トラックを含む WAVE ファイルは再生できません" + +#: aplay/aplay.c:1069 aplay/aplay.c:1195 +#, c-format +msgid "Warning: format is changed to U8\n" +msgstr "警告: フォーマットは U8 に変更されます\n" + +#: aplay/aplay.c:1079 aplay/aplay.c:1092 aplay/aplay.c:1103 +#, fuzzy, c-format +msgid "Warning: format is changed to %s\n" +msgstr "警告: フォーマットは U8 に変更されます\n" + +#: aplay/aplay.c:1108 +#, c-format +msgid "" +" can't play WAVE-files with sample %d bits in %d bytes wide (%d channels)" +msgstr "" +"%2$d バイト長 %1$d サンプルビット (%3$d チャネル) の WAVE ファイルは再生でき" +"ません" + +#: aplay/aplay.c:1131 +#, c-format +msgid " can't play WAVE-files with sample %d bits wide" +msgstr "%d ビット長のサンプルの WAVE ファイルは再生できません" + +#: aplay/aplay.c:1189 +#, c-format +msgid "Warning: format is changed to MU_LAW\n" +msgstr "警告: フォーマットは MU_LAW に変更されます\n" + +#: aplay/aplay.c:1201 +#, c-format +msgid "Warning: format is changed to S16_BE\n" +msgstr "警告: フォーマットは S16_BE に変更されます\n" + +#: aplay/aplay.c:1214 aplay/aplay.c:2307 aplay/aplay.c:2314 aplay/aplay.c:2839 +msgid "read error" +msgstr "リードエラー" + +#: aplay/aplay.c:1244 +msgid "Channel numbers don't match between hw_params and channel map" +msgstr "" + +#: aplay/aplay.c:1253 +#, c-format +msgid "Warning: unable to get channel map\n" +msgstr "" + +#: aplay/aplay.c:1287 +#, c-format +msgid "Channel %d doesn't match with hw_params" +msgstr "" + +#: aplay/aplay.c:1314 +msgid "Broken configuration for this PCM: no configurations available" +msgstr "指定の PCM を使用できません: 設定がありません" + +#: aplay/aplay.c:1318 +#, c-format +msgid "HW Params of device \"%s\":\n" +msgstr "" + +#: aplay/aplay.c:1338 +msgid "Access type not available" +msgstr "アクセスタイプが使用不可能" + +#: aplay/aplay.c:1343 +msgid "Sample format non available" +msgstr "サンプルフォーマットが使用不可能" + +#: aplay/aplay.c:1349 +msgid "Channels count non available" +msgstr "チャネル数が使用不可能" + +#: aplay/aplay.c:1364 +#, c-format +msgid "Warning: rate is not accurate (requested = %iHz, got = %iHz)\n" +msgstr "警告: レートが不正確です (要求値 = %iHz, 使用値 = %iHz)\n" + +#: aplay/aplay.c:1370 +#, c-format +msgid " please, try the plug plugin %s\n" +msgstr " plug プラグイン%s を使用してください\n" + +#: aplay/aplay.c:1407 +msgid "Unable to install hw params:" +msgstr "hw params のインストールに失敗しました:" + +#: aplay/aplay.c:1414 +#, c-format +msgid "Can't use period equal to buffer size (%lu == %lu)" +msgstr "period と buffer サイズには同じ値を使用できません (%lu == %lu)" + +#: aplay/aplay.c:1420 +#, fuzzy +msgid "Unable to get current sw params." +msgstr "sw params のインストールに失敗しました:" + +#: aplay/aplay.c:1449 +msgid "unable to install sw params:" +msgstr "sw params のインストールに失敗しました:" + +#: aplay/aplay.c:1484 +#, c-format +msgid "snd_pcm_mmap_begin problem: %s" +msgstr "" + +#: aplay/aplay.c:1513 +#, c-format +msgid "stdin O_NONBLOCK flag setup failed\n" +msgstr "" + +#: aplay/aplay.c:1537 +#, c-format +msgid "\rPAUSE command ignored (no hw support)\n" +msgstr "" + +#: aplay/aplay.c:1545 +#, fuzzy, c-format +msgid "pause push error: %s" +msgstr "ステータスエラー: %s" + +#: aplay/aplay.c:1556 +#, fuzzy, c-format +msgid "pause release error: %s" +msgstr "サスペンド: prepare エラー: %s" + +#: aplay/aplay.c:1572 +#, c-format +msgid "" +"\r=== PAUSE === " +msgstr "" + +#: aplay/aplay.c:1614 +#, c-format +msgid "status error: %s" +msgstr "ステータスエラー: %s" + +#: aplay/aplay.c:1619 +#, c-format +msgid "fatal %s: %s" +msgstr "" + +#: aplay/aplay.c:1620 aplay/aplay.c:1631 aplay/aplay.c:1634 aplay/aplay.c:1642 +msgid "underrun" +msgstr "アンダーラン" + +#: aplay/aplay.c:1620 aplay/aplay.c:1631 aplay/aplay.c:1642 +msgid "overrun" +msgstr "オーバーラン" + +#: aplay/aplay.c:1630 aplay/aplay.c:1641 +#, c-format +msgid "%s!!! (at least %.3f ms long)\n" +msgstr "%s!!! (少なくとも %.3f ms)\n" + +#: aplay/aplay.c:1646 +#, c-format +msgid "Status:\n" +msgstr "ステータス:\n" + +#: aplay/aplay.c:1650 +#, c-format +msgid "xrun: prepare error: %s" +msgstr "" + +#: aplay/aplay.c:1656 +#, c-format +msgid "Status(DRAINING):\n" +msgstr "ステータス(DRAINING):\n" + +#: aplay/aplay.c:1660 +#, c-format +msgid "capture stream format change? attempting recover...\n" +msgstr "録音ストリームのフォーマットが変更? 修復を試みます...\n" + +#: aplay/aplay.c:1662 +#, c-format +msgid "xrun(DRAINING): prepare error: %s" +msgstr "" + +#: aplay/aplay.c:1669 +#, c-format +msgid "Status(R/W):\n" +msgstr "ステータス(R/W):\n" + +#: aplay/aplay.c:1672 +#, c-format +msgid "read/write error, state = %s" +msgstr "読み書きエラー, ステータス = %s" + +#: aplay/aplay.c:1682 +#, c-format +msgid "Suspended. Trying resume. " +msgstr "サスペンド中です。レジュームします。" + +#: aplay/aplay.c:1688 +#, c-format +msgid "Failed. Restarting stream. " +msgstr "失敗しました。ストリームを再スタートします。" + +#: aplay/aplay.c:1691 +#, c-format +msgid "suspend: prepare error: %s" +msgstr "サスペンド: prepare エラー: %s" + +#: aplay/aplay.c:1696 +#, c-format +msgid "Done.\n" +msgstr "終了\n" + +#: aplay/aplay.c:1718 +#, c-format +msgid " !clip " +msgstr "" + +#: aplay/aplay.c:1862 +#, c-format +msgid "Unsupported bit size %d.\n" +msgstr "" + +#: aplay/aplay.c:1896 +#, c-format +msgid "Max peak (%li samples): 0x%08x " +msgstr "最大ピーク (%li サンプル): 0x%08x " + +#: aplay/aplay.c:1930 +#, c-format +msgid "" +"Suspicious buffer position (%li total): avail = %li, delay = %li, buffer = " +"%li\n" +msgstr "" + +#: aplay/aplay.c:2058 +#, c-format +msgid "write error: %s" +msgstr "書込エラー: %s" + +#: aplay/aplay.c:2106 +#, c-format +msgid "writev error: %s" +msgstr "書込(writev)エラー: %s" + +#: aplay/aplay.c:2152 +#, c-format +msgid "read error: %s" +msgstr "読込エラー: %s" + +#: aplay/aplay.c:2199 +#, c-format +msgid "readv error: %s" +msgstr "読込(readv)エラー: %s" + +#: aplay/aplay.c:2248 +msgid "can't allocate buffer for silence" +msgstr "サイレンス用のバッファの取得に失敗しました" + +#: aplay/aplay.c:2257 aplay/aplay.c:2485 aplay/aplay.c:2490 aplay/aplay.c:2540 +#: aplay/aplay.c:2549 aplay/aplay.c:2556 aplay/aplay.c:2566 aplay/aplay.c:2572 +#: aplay/aplay.c:2644 aplay/aplay.c:2674 aplay/aplay.c:2688 +msgid "write error" +msgstr "書込エラー" + +#: aplay/aplay.c:2270 +#, c-format +msgid "voc_pcm_flush - silence error" +msgstr "" + +#: aplay/aplay.c:2273 +msgid "voc_pcm_flush error" +msgstr "" + +#: aplay/aplay.c:2298 +msgid "malloc error" +msgstr "malloc エラー" + +#: aplay/aplay.c:2302 +#, c-format +msgid "Playing Creative Labs Channel file '%s'...\n" +msgstr "Creative Labs Channel ファイル '%s' を演奏中...\n" + +#: aplay/aplay.c:2370 aplay/aplay.c:2465 +msgid "can't play packed .voc files" +msgstr "packed .voc ファイルは演奏できません" + +#: aplay/aplay.c:2425 +#, c-format +msgid "can't play loops; %s isn't seekable\n" +msgstr "ループ演奏できません。%s はシーク不可能です\n" + +#: aplay/aplay.c:2474 +#, c-format +msgid "unknown blocktype %d. terminate." +msgstr "未知のブロックタイプ %d: 終了します。" + +#: aplay/aplay.c:2608 +#, c-format +msgid "Wave doesn't support %s format..." +msgstr "WAVE は %s フォーマットをサポートしません..." + +#: aplay/aplay.c:2668 +#, c-format +msgid "Sparc Audio doesn't support %s format..." +msgstr "Sparc オーディオは %s フォーマットをサポートしません..." + +#: aplay/aplay.c:2743 +msgid "Playing" +msgstr "再生中" + +#: aplay/aplay.c:2743 +msgid "Recording" +msgstr "録音中" + +#: aplay/aplay.c:2747 +#, c-format +msgid "Rate %d Hz, " +msgstr "レート %d Hz, " + +#: aplay/aplay.c:2749 +#, c-format +msgid "Mono" +msgstr "モノラル" + +#: aplay/aplay.c:2751 +#, c-format +msgid "Stereo" +msgstr "ステレオ" + +#: aplay/aplay.c:2753 +#, c-format +msgid "Channels %i" +msgstr "チャネル数 %i" + +#: aplay/aplay.c:3356 +#, fuzzy, c-format +msgid "You need to specify %u files" +msgstr "%d 個のファイルを指定してください" + +#: aplay/aplay.c:3409 +#, c-format +msgid "You need to specify %d files" +msgstr "%d 個のファイルを指定してください" + +#: seq/aconnect/aconnect.c:49 +#, c-format +msgid "aconnect - ALSA sequencer connection manager\n" +msgstr "aconnect - ALSA sequencer 接続マネージャ\n" + +#: seq/aconnect/aconnect.c:50 +#, c-format +msgid "Copyright (C) 1999-2000 Takashi Iwai\n" +msgstr "" + +#: seq/aconnect/aconnect.c:51 +#, c-format +msgid "Usage:\n" +msgstr "使用法:\n" + +#: seq/aconnect/aconnect.c:52 +#, c-format +msgid " * Connection/disconnection between two ports\n" +msgstr " * 二つのポートの接続/切り離し\n" + +#: seq/aconnect/aconnect.c:53 +#, c-format +msgid " aconnect [-options] sender receiver\n" +msgstr " aconnect [-オプション] 送信 受信\n" + +#: seq/aconnect/aconnect.c:54 +#, c-format +msgid " sender, receiver = client:port pair\n" +msgstr " 送信, 受信 = クライアント:ポートの組\n" + +#: seq/aconnect/aconnect.c:55 +#, c-format +msgid " -d,--disconnect disconnect\n" +msgstr " -d,--disconnect 切り離し\n" + +#: seq/aconnect/aconnect.c:56 +#, c-format +msgid " -e,--exclusive exclusive connection\n" +msgstr " -e,--exclusive 排他接続\n" + +#: seq/aconnect/aconnect.c:57 +#, c-format +msgid " -r,--real # convert real-time-stamp on queue\n" +msgstr " -r,--real # キューのリアルタイムスタンプに変換\n" + +#: seq/aconnect/aconnect.c:58 +#, c-format +msgid " -t,--tick # convert tick-time-stamp on queue\n" +msgstr " -t,--tick # キューのティックタイムスタンプに変換\n" + +#: seq/aconnect/aconnect.c:59 +#, c-format +msgid " * List connected ports (no subscription action)\n" +msgstr " * 接続済みのポートの一覧\n" + +#: seq/aconnect/aconnect.c:60 +#, c-format +msgid " aconnect -i|-o [-options]\n" +msgstr " aconnect -i|-o [-オプション]\n" + +#: seq/aconnect/aconnect.c:61 +#, c-format +msgid " -i,--input list input (readable) ports\n" +msgstr " -i,--input 入力 (読込) ポートの一覧\n" + +#: seq/aconnect/aconnect.c:62 +#, c-format +msgid " -o,--output list output (writable) ports\n" +msgstr " -o,--output 主力 (書込) ポートの一覧\n" + +#: seq/aconnect/aconnect.c:63 +#, c-format +msgid " -l,--list list current connections of each port\n" +msgstr " -l,--list 各ポートの現在の接続を表示\n" + +#: seq/aconnect/aconnect.c:64 +#, c-format +msgid " * Remove all exported connections\n" +msgstr " * 全てのエクスポートされた接続を切り離す\n" + +#: seq/aconnect/aconnect.c:65 +#, c-format +msgid " -x, --removeall\n" +msgstr " -x, --removall\n" + +#: seq/aconnect/aconnect.c:132 +msgid "Connecting To" +msgstr "接続先" + +#: seq/aconnect/aconnect.c:133 +msgid "Connected From" +msgstr "接続元" + +#: seq/aconnect/aconnect.c:171 +#, fuzzy, c-format +msgid "client %d: '%s' [type=%s" +msgstr "クライアント %d: '%s' [タイプ=%s]\n" + +#: seq/aconnect/aconnect.c:175 +msgid "user" +msgstr "ユーザ" + +#: seq/aconnect/aconnect.c:175 +msgid "kernel" +msgstr "カーネル" + +#: seq/aconnect/aconnect.c:323 +#, c-format +msgid "can't open sequencer\n" +msgstr "sequencer をオープンできません\n" + +#: seq/aconnect/aconnect.c:351 +#, c-format +msgid "can't get client id\n" +msgstr "クライアント ID を取得できません\n" + +#: seq/aconnect/aconnect.c:358 +#, c-format +msgid "can't set client info\n" +msgstr "クライアント情報を取得できません\n" + +#: seq/aconnect/aconnect.c:365 +#, c-format +msgid "invalid sender address %s\n" +msgstr "送信アドレスが不正です: %s\n" + +#: seq/aconnect/aconnect.c:370 seq/aseqnet/aseqnet.c:290 +#, c-format +msgid "invalid destination address %s\n" +msgstr "受信アドレスが不正です: %s\n" + +#: seq/aconnect/aconnect.c:384 +#, c-format +msgid "No subscription is found\n" +msgstr "接続が見つかりません\n" + +#: seq/aconnect/aconnect.c:389 +#, c-format +msgid "Disconnection failed (%s)\n" +msgstr "切り離しに失敗 (%s)\n" + +#: seq/aconnect/aconnect.c:395 +#, c-format +msgid "Connection is already subscribed\n" +msgstr "既に接続されています\n" + +#: seq/aconnect/aconnect.c:400 +#, c-format +msgid "Connection failed (%s)\n" +msgstr "接続に失敗 (%s)\n" + +#: seq/aseqnet/aseqnet.c:164 +#, c-format +msgid "aseqnet - network client/server on ALSA sequencer\n" +msgstr "aseqnet - ALSA sequencer 上のネットワーククライアント/サーバ\n" + +#: seq/aseqnet/aseqnet.c:165 +#, c-format +msgid " Copyright (C) 1999 Takashi Iwai\n" +msgstr "" + +#: seq/aseqnet/aseqnet.c:166 +#, c-format +msgid "usage:\n" +msgstr "使用法:\n" + +#: seq/aseqnet/aseqnet.c:167 +#, c-format +msgid " server mode: aseqnet [-options]\n" +msgstr " サーバモード: aseqnet [-オプション]\n" + +#: seq/aseqnet/aseqnet.c:168 +#, c-format +msgid " client mode: aseqnet [-options] server_host\n" +msgstr " クライアントモード: aseqnet [-オプション] サーバホスト\n" + +#: seq/aseqnet/aseqnet.c:169 +#, c-format +msgid "options:\n" +msgstr "オプション:\n" + +#: seq/aseqnet/aseqnet.c:170 +#, fuzzy, c-format +msgid " -p,--port # : specify TCP port (digit or service name)\n" +msgstr " -p,--port # : TCP ポートの指定 (数字またはサービス名)\n" + +#: seq/aseqnet/aseqnet.c:171 +#, c-format +msgid " -s,--source addr : read from given addr (client:port)\n" +msgstr " -s,--source addr : 指定のアドレス(クライアント:ポート)から読み込む\n" + +#: seq/aseqnet/aseqnet.c:172 +#, c-format +msgid " -d,--dest addr : write to given addr (client:port)\n" +msgstr " -d,--dest addr : 指定のアドレス(クライアント:ポート)に書き込む\n" + +#: seq/aseqnet/aseqnet.c:173 +#, c-format +msgid " -v, --verbose : print verbose messages\n" +msgstr " -v,--verbose : 冗長メッセージ表示\n" + +#: seq/aseqnet/aseqnet.c:174 +#, c-format +msgid " -i, --info : print certain received events\n" +msgstr " -i,--info : 受信イベントを表示する\n" + +#: seq/aseqnet/aseqnet.c:188 +#, c-format +msgid "can't malloc\n" +msgstr "malloc できません\n" + +#: seq/aseqnet/aseqnet.c:213 +#, c-format +msgid "closing files..\n" +msgstr "ファイルを閉じます..\n" + +#: seq/aseqnet/aseqnet.c:272 +#, c-format +msgid "sequencer opened: %d:%d\n" +msgstr "" + +#: seq/aseqnet/aseqnet.c:279 +#, c-format +msgid "invalid source address %s\n" +msgstr "不正な送信アドレス %s\n" + +#: seq/aseqnet/aseqnet.c:309 +#, c-format +msgid "service '%s' is not found in /etc/services\n" +msgstr "サービス '%s' が /etc/services に見つかりません\n" + +#: seq/aseqnet/aseqnet.c:377 +#, c-format +msgid "too many connections!\n" +msgstr "接続が多すぎます!\n" + +#: seq/aseqnet/aseqnet.c:388 +#, c-format +msgid "accepted[%d]\n" +msgstr "了解[%d]\n" + +#: seq/aseqnet/aseqnet.c:411 +#, c-format +msgid "can't get address %s\n" +msgstr "アドレス %s を取得できません\n" + +#: seq/aseqnet/aseqnet.c:422 +#, c-format +msgid "ok.. connected\n" +msgstr "ok.. 接続\n" + +#: seq/aseqnet/aseqnet.c:518 +#, c-format +msgid "Channel %2d: Control event : %5d\n" +msgstr "チャネル %2d: コントロール : %5d\n" + +#: seq/aseqnet/aseqnet.c:522 +#, c-format +msgid "Channel %2d: Pitchbender : %5d\n" +msgstr "チャネル %2d: ピッチベンド : %5d\n" + +#: seq/aseqnet/aseqnet.c:526 +#, c-format +msgid "Channel %2d: Note On event : %5d\n" +msgstr "チャネル %2d: ノートオン : %5d\n" + +#: seq/aseqnet/aseqnet.c:530 +#, c-format +msgid "Channel %2d: Note Off event: %5d\n" +msgstr "チャネル %2d: ノートオフ : %5d\n" + +#: seq/aseqnet/aseqnet.c:585 +#, c-format +msgid "disconnected\n" +msgstr "切り離し\n" + +#: speaker-test/speaker-test.c:120 +msgid "Front Left" +msgstr "" + +#: speaker-test/speaker-test.c:121 +msgid "Front Right" +msgstr "" + +#: speaker-test/speaker-test.c:122 +msgid "Rear Left" +msgstr "" + +#: speaker-test/speaker-test.c:123 +msgid "Rear Right" +msgstr "" + +#: speaker-test/speaker-test.c:125 +msgid "LFE" +msgstr "" + +#: speaker-test/speaker-test.c:126 +msgid "Side Left" +msgstr "" + +#: speaker-test/speaker-test.c:127 +msgid "Side Right" +msgstr "" + +#: speaker-test/speaker-test.c:128 +msgid "Channel 9" +msgstr "" + +#: speaker-test/speaker-test.c:129 +msgid "Channel 10" +msgstr "" + +#: speaker-test/speaker-test.c:130 +msgid "Channel 11" +msgstr "" + +#: speaker-test/speaker-test.c:131 +msgid "Channel 12" +msgstr "" + +#: speaker-test/speaker-test.c:132 +msgid "Channel 13" +msgstr "" + +#: speaker-test/speaker-test.c:133 +msgid "Channel 14" +msgstr "" + +#: speaker-test/speaker-test.c:134 +msgid "Channel 15" +msgstr "" + +#: speaker-test/speaker-test.c:135 +msgid "Channel 16" +msgstr "" + +#: speaker-test/speaker-test.c:424 +#, c-format +msgid "Broken configuration for playback: no configurations available: %s\n" +msgstr "再生用に設定できません: 設定がみつかりません: %s\n" + +#: speaker-test/speaker-test.c:431 +#, c-format +msgid "Access type not available for playback: %s\n" +msgstr "アクセスタイプが不正です: %s\n" + +#: speaker-test/speaker-test.c:438 +#, c-format +msgid "Sample format not available for playback: %s\n" +msgstr "指定のサンプルフォーマットを使用できません: %s\n" + +#: speaker-test/speaker-test.c:445 +#, c-format +msgid "Channels count (%i) not available for playbacks: %s\n" +msgstr "チャネル数 (%i) を使用できません: %s\n" + +#: speaker-test/speaker-test.c:453 +#, c-format +msgid "Rate %iHz not available for playback: %s\n" +msgstr "レート %iHz を使用できません: %s\n" + +#: speaker-test/speaker-test.c:458 +#, c-format +msgid "Rate doesn't match (requested %iHz, get %iHz, err %d)\n" +msgstr "設定レートが一致しません< (要求値 %iHz, 取得値 %iHz, エラー %d)\n" + +#: speaker-test/speaker-test.c:462 +#, c-format +msgid "Rate set to %iHz (requested %iHz)\n" +msgstr "レート %iHz (要求値 %iHz)\n" + +#: speaker-test/speaker-test.c:468 +#, c-format +msgid "Buffer size range from %lu to %lu\n" +msgstr "バッファサイズ範囲 %lu 〜 %lu\n" + +#: speaker-test/speaker-test.c:469 +#, c-format +msgid "Period size range from %lu to %lu\n" +msgstr "ピリオドサイズ範囲 %lu 〜 %lu\n" + +#: speaker-test/speaker-test.c:471 +#, c-format +msgid "Requested period time %u us\n" +msgstr "要求されたピリオド長 %u us\n" + +#: speaker-test/speaker-test.c:474 +#, c-format +msgid "Unable to set period time %u us for playback: %s\n" +msgstr "ピリオド長 %u us を設定できません: %s\n" + +#: speaker-test/speaker-test.c:480 +#, c-format +msgid "Requested buffer time %u us\n" +msgstr "要求されたバッファ長 %u us\n" + +#: speaker-test/speaker-test.c:483 +#, c-format +msgid "Unable to set buffer time %u us for playback: %s\n" +msgstr "バッファ長 %u us を設定できません: %s\n" + +#: speaker-test/speaker-test.c:492 +#, c-format +msgid "Using max buffer size %lu\n" +msgstr "最大バッファサイズ %lu を使用\n" + +#: speaker-test/speaker-test.c:495 +#, c-format +msgid "Unable to set buffer size %lu for playback: %s\n" +msgstr "バッファサイズ %lu を設定できません: %s\n" + +#: speaker-test/speaker-test.c:501 +#, c-format +msgid "Periods = %u\n" +msgstr "ピリオド数 = %u\n" + +#: speaker-test/speaker-test.c:504 +#, c-format +msgid "Unable to set nperiods %u for playback: %s\n" +msgstr "ピリオド数 %u を設定できません: %s\n" + +#: speaker-test/speaker-test.c:513 +#, c-format +msgid "Unable to set hw params for playback: %s\n" +msgstr "hw params を設定できません: %s\n" + +#: speaker-test/speaker-test.c:519 +#, c-format +msgid "was set period_size = %lu\n" +msgstr "period_size = %lu で設定\n" + +#: speaker-test/speaker-test.c:520 +#, c-format +msgid "was set buffer_size = %lu\n" +msgstr "buffer_size = %lu で設定\n" + +#: speaker-test/speaker-test.c:522 +#, c-format +msgid "buffer to small, could not use\n" +msgstr "バッファが小さすぎます\n" + +#: speaker-test/speaker-test.c:535 +#, c-format +msgid "Unable to determine current swparams for playback: %s\n" +msgstr "現在の swparams を取得できません: %s\n" + +#: speaker-test/speaker-test.c:542 +#, c-format +msgid "Unable to set start threshold mode for playback: %s\n" +msgstr "start_threshold モードを設定できません: %s\n" + +#: speaker-test/speaker-test.c:549 +#, c-format +msgid "Unable to set avail min for playback: %s\n" +msgstr "avail_min を設定できません: %s\n" + +#: speaker-test/speaker-test.c:556 +#, c-format +msgid "Unable to set sw params for playback: %s\n" +msgstr "再生用の sw params を設定できません: %s\n" + +#: speaker-test/speaker-test.c:576 +#, fuzzy, c-format +msgid "Unable to set channel map: %s\n" +msgstr "avail_min を設定できません: %s\n" + +#: speaker-test/speaker-test.c:601 +#, c-format +msgid "Can't recovery from underrun, prepare failed: %s\n" +msgstr "アンダーランから復帰失敗: %s\n" + +#: speaker-test/speaker-test.c:612 +#, c-format +msgid "Can't recovery from suspend, prepare failed: %s\n" +msgstr "サスペンドから復帰失敗: %s\n" + +#: speaker-test/speaker-test.c:676 speaker-test/speaker-test.c:1191 +#, c-format +msgid "No enough memory\n" +msgstr "メモリが足りません\n" + +#: speaker-test/speaker-test.c:681 +#, c-format +msgid "Cannot open WAV file %s\n" +msgstr "WAVファイルがオープンできません: %s\n" + +#: speaker-test/speaker-test.c:685 speaker-test/speaker-test.c:714 +#, c-format +msgid "Invalid WAV file %s\n" +msgstr "不正なWAVファイルです: %s\n" + +#: speaker-test/speaker-test.c:690 +#, c-format +msgid "Not a WAV file: %s\n" +msgstr "WAVファイルではありません: %s\n" + +#: speaker-test/speaker-test.c:694 +#, c-format +msgid "Unsupported WAV format %d for %s\n" +msgstr "未サポートのWAVフォーマット %d: %s\n" + +#: speaker-test/speaker-test.c:699 +#, c-format +msgid "%s is not a mono stream (%d channels)\n" +msgstr "%s はモノストリームではありません (%d チャネル)\n" + +#: speaker-test/speaker-test.c:704 +#, c-format +msgid "Sample rate doesn't match (%d) for %s\n" +msgstr "サンプルレートが不一致です(%d): %s\n" + +#: speaker-test/speaker-test.c:709 +#, c-format +msgid "Unsupported sample format bits %d for %s\n" +msgstr "未サポートのサンプルフォーマットビット %d: %s\n" + +#: speaker-test/speaker-test.c:770 +#, c-format +msgid "Undefined channel %d\n" +msgstr "未定義のチャネル %d\n" + +#: speaker-test/speaker-test.c:821 +#, c-format +msgid "Write error: %d,%s\n" +msgstr "書込エラー: %d,%s\n" + +#: speaker-test/speaker-test.c:823 +#, c-format +msgid "xrun_recovery failed: %d,%s\n" +msgstr "xrun_recovery 失敗: %d,%s\n" + +#: speaker-test/speaker-test.c:926 +#, fuzzy, c-format +msgid "" +"Usage: speaker-test [OPTION]... \n" +"-h,--help\thelp\n" +"-D,--device\tplayback device\n" +"-r,--rate\tstream rate in Hz\n" +"-c,--channels\tcount of channels in stream\n" +"-f,--frequency\tsine wave frequency in Hz\n" +"-F,--format\tsample format\n" +"-b,--buffer\tring buffer size in us\n" +"-p,--period\tperiod size in us\n" +"-P,--nperiods\tnumber of periods\n" +"-t,--test\tpink=use pink noise, sine=use sine wave, wav=WAV file\n" +"-l,--nloops\tspecify number of loops to test, 0 = infinite\n" +"-s,--speaker\tsingle speaker test. Values 1=Left, 2=right, etc\n" +"-w,--wavfile\tUse the given WAV file as a test sound\n" +"-W,--wavdir\tSpecify the directory containing WAV files\n" +"-m,--chmap\tSpecify the channel map to override\n" +"-X,--force-frequency\tforce frequencies outside the 30-8000hz range\n" +"-S,--scale\tScale of generated test tones in percent (default=80)\n" +"\n" +msgstr "" +"使用法: speaker-test [オプション]...\n" +"-h,--help ヘルプ\n" +"-D,--device 再生デバイス\n" +"-r,--rate ストリームレート (Hz)\n" +"-c,--channels チャネル数\n" +"-f,--frequency 正弦波周波数 (hz)\n" +"-F,--format サンプルフォーマット\n" +"-b,--buffer リングバッファサイズ (μs)\n" +"-p,--period ピリオドサイズ (μs)\n" +"-P,--nperiods ピリオド数\n" +"-t,--test pink=ピンクノイズを使用, sine=正弦波を使用, wav=WAVファ" +"イル再生\n" +"-l,--nloops 繰り返しテスト数, 0 = 無制限\n" +"-s,--speaker 単一スピーカーテスト 1=左 または 2=右\n" +"-w,--wavfile 指定のWAVファイルをテスト音源として使用\n" +"-W,--wavdir WAVファイルのあるディレクトリを指定\n" +"-X,--force-frequency\t30-8000Hz範囲外許可\n" +"\n" + +#: speaker-test/speaker-test.c:1058 +#, c-format +msgid "Invalid number of periods %d\n" +msgstr "不正なピリオド数 %d\n" + +#: speaker-test/speaker-test.c:1074 speaker-test/speaker-test.c:1078 +#, c-format +msgid "Invalid test type %s\n" +msgstr "不正なテストタイプ %s\n" + +#: speaker-test/speaker-test.c:1111 +#, c-format +msgid "Unknown option '%c'\n" +msgstr "未知のオプション '%c'\n" + +#: speaker-test/speaker-test.c:1125 +#, c-format +msgid "Invalid parameter for -s option.\n" +msgstr "-s オプションの値が不正です\n" + +#: speaker-test/speaker-test.c:1140 +#, c-format +msgid "Playback device is %s\n" +msgstr "再生デバイス: %s\n" + +#: speaker-test/speaker-test.c:1141 +#, c-format +msgid "Stream parameters are %iHz, %s, %i channels\n" +msgstr "ストリームパラメータ: %iHz, %s, %i チャネル\n" + +#: speaker-test/speaker-test.c:1144 +#, c-format +msgid "Using 16 octaves of pink noise\n" +msgstr "16 オクターブのピンクノイズを使用\n" + +#: speaker-test/speaker-test.c:1147 +#, c-format +msgid "Sine wave rate is %.4fHz\n" +msgstr "正弦波レート: %.4fHz\n" + +#: speaker-test/speaker-test.c:1150 +#, c-format +msgid "WAV file(s)\n" +msgstr "WAV ファイル\n" + +#: speaker-test/speaker-test.c:1160 +#, c-format +msgid "Playback open error: %d,%s\n" +msgstr "再生オープンエラー: %d,%s\n" + +#: speaker-test/speaker-test.c:1166 +#, c-format +msgid "Setting of hwparams failed: %s\n" +msgstr "hwparams の設定に失敗: %s\n" + +#: speaker-test/speaker-test.c:1170 +#, c-format +msgid "Setting of swparams failed: %s\n" +msgstr "swparams の設定に失敗: %s\n" + +#: speaker-test/speaker-test.c:1216 speaker-test/speaker-test.c:1238 +#, c-format +msgid "Transfer failed: %s\n" +msgstr "転送に失敗しました: %s\n" + +#: speaker-test/speaker-test.c:1224 +#, c-format +msgid "Time per period = %lf\n" +msgstr "ピリオド時間 = %lf\n" + +#~ msgid "Warning: format is changed to S16_LE\n" +#~ msgstr "警告: フォーマットは S16_LE に変更されます\n" + +#~ msgid "Warning: format is changed to S24_3LE\n" +#~ msgstr "警告: フォーマットは S24_3LE に変更されます\n" + +#~ msgid "Warning: format is changed to S24_LE\n" +#~ msgstr "警告: フォーマットは S24_LE に変更されます\n" diff --git a/po/quot.sed b/po/quot.sed new file mode 100644 index 0000000..0122c46 --- /dev/null +++ b/po/quot.sed @@ -0,0 +1,6 @@ +s/"\([^"]*\)"/“\1”/g +s/`\([^`']*\)'/‘\1’/g +s/ '\([^`']*\)' / ‘\1’ /g +s/ '\([^`']*\)'$/ ‘\1’/g +s/^'\([^`']*\)' /‘\1’ /g +s/“”/""/g diff --git a/po/remove-potcdate.sin b/po/remove-potcdate.sin new file mode 100644 index 0000000..2436c49 --- /dev/null +++ b/po/remove-potcdate.sin @@ -0,0 +1,19 @@ +# Sed script that remove the POT-Creation-Date line in the header entry +# from a POT file. +# +# The distinction between the first and the following occurrences of the +# pattern is achieved by looking at the hold space. +/^"POT-Creation-Date: .*"$/{ +x +# Test if the hold space is empty. +s/P/P/ +ta +# Yes it was empty. First occurrence. Remove the line. +g +d +bb +:a +# The hold space was nonempty. Following occurrences. Do nothing. +x +:b +} diff --git a/po/stamp-po b/po/stamp-po new file mode 100644 index 0000000..9788f70 --- /dev/null +++ b/po/stamp-po @@ -0,0 +1 @@ +timestamp diff --git a/seq/Makefile.am b/seq/Makefile.am new file mode 100644 index 0000000..2c84cee --- /dev/null +++ b/seq/Makefile.am @@ -0,0 +1 @@ +SUBDIRS=aconnect aplaymidi aseqdump aseqnet diff --git a/seq/Makefile.in b/seq/Makefile.in new file mode 100644 index 0000000..4a79732 --- /dev/null +++ b/seq/Makefile.in @@ -0,0 +1,648 @@ +# Makefile.in generated by automake 1.16.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994-2018 Free Software Foundation, Inc. + +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ +VPATH = @srcdir@ +am__is_gnu_make = { \ + if test -z '$(MAKELEVEL)'; then \ + false; \ + elif test -n '$(MAKE_HOST)'; then \ + true; \ + elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ + true; \ + else \ + false; \ + fi; \ +} +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + esac; \ + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +subdir = seq +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/gettext.m4 \ + $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/lib-ld.m4 \ + $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ + $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \ + $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/acinclude.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/include/aconfig.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = +SOURCES = +DIST_SOURCES = +RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \ + ctags-recursive dvi-recursive html-recursive info-recursive \ + install-data-recursive install-dvi-recursive \ + install-exec-recursive install-html-recursive \ + install-info-recursive install-pdf-recursive \ + install-ps-recursive install-recursive installcheck-recursive \ + installdirs-recursive pdf-recursive ps-recursive \ + tags-recursive uninstall-recursive +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ + distclean-recursive maintainer-clean-recursive +am__recursive_targets = \ + $(RECURSIVE_TARGETS) \ + $(RECURSIVE_CLEAN_TARGETS) \ + $(am__extra_recursive_targets) +AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \ + distdir distdir-am +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) +# Read a list of newline-separated strings from the standard input, +# and print each of them once, without duplicates. Input order is +# *not* preserved. +am__uniquify_input = $(AWK) '\ + BEGIN { nonempty = 0; } \ + { items[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in items) print i; }; } \ +' +# Make sure the list of sources is unique. This is necessary because, +# e.g., the same source file might be shared among _SOURCES variables +# for different programs/libraries. +am__define_uniq_tagged_files = \ + list='$(am__tagged_files)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | $(am__uniquify_input)` +ETAGS = etags +CTAGS = ctags +DIST_SUBDIRS = $(SUBDIRS) +am__DIST_COMMON = $(srcdir)/Makefile.in +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +am__relativize = \ + dir0=`pwd`; \ + sed_first='s,^\([^/]*\)/.*$$,\1,'; \ + sed_rest='s,^[^/]*/*,,'; \ + sed_last='s,^.*/\([^/]*\)$$,\1,'; \ + sed_butlast='s,/*[^/]*$$,,'; \ + while test -n "$$dir1"; do \ + first=`echo "$$dir1" | sed -e "$$sed_first"`; \ + if test "$$first" != "."; then \ + if test "$$first" = ".."; then \ + dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \ + dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \ + else \ + first2=`echo "$$dir2" | sed -e "$$sed_first"`; \ + if test "$$first2" = "$$first"; then \ + dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \ + else \ + dir2="../$$dir2"; \ + fi; \ + dir0="$$dir0"/"$$first"; \ + fi; \ + fi; \ + dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \ + done; \ + reldir="$$dir2" +ACLOCAL = @ACLOCAL@ +ALSACTL_DAEMONSWITCH = @ALSACTL_DAEMONSWITCH@ +ALSACTL_PIDFILE_DIR = @ALSACTL_PIDFILE_DIR@ +ALSA_CFLAGS = @ALSA_CFLAGS@ +ALSA_LIBS = @ALSA_LIBS@ +ALSA_TOPOLOGY_LIBS = @ALSA_TOPOLOGY_LIBS@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +ASOUND_LOCK_DIR = @ASOUND_LOCK_DIR@ +ASOUND_STATE_DIR = @ASOUND_STATE_DIR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CURSESINC = @CURSESINC@ +CURSESLIB = @CURSESLIB@ +CURSES_CFLAGS = @CURSES_CFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +FFTW_CFLAGS = @FFTW_CFLAGS@ +FFTW_INC = @FFTW_INC@ +FFTW_LIB = @FFTW_LIB@ +GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ +GMSGFMT = @GMSGFMT@ +GMSGFMT_015 = @GMSGFMT_015@ +GREP = @GREP@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +INTLLIBS = @INTLLIBS@ +INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@ +LDFLAGS = @LDFLAGS@ +LIBICONV = @LIBICONV@ +LIBINTL = @LIBINTL@ +LIBOBJS = @LIBOBJS@ +LIBRT = @LIBRT@ +LIBS = @LIBS@ +LN_S = @LN_S@ +LTLIBICONV = @LTLIBICONV@ +LTLIBINTL = @LTLIBINTL@ +LTLIBOBJS = @LTLIBOBJS@ +MAINT = @MAINT@ +MAKEINFO = @MAKEINFO@ +MKDIR_P = @MKDIR_P@ +MSGFMT = @MSGFMT@ +MSGFMT_015 = @MSGFMT_015@ +MSGMERGE = @MSGMERGE@ +NCURSESW_CFLAGS = @NCURSESW_CFLAGS@ +NCURSESW_LIBS = @NCURSESW_LIBS@ +NCURSES_CFLAGS = @NCURSES_CFLAGS@ +NCURSES_LIBS = @NCURSES_LIBS@ +OBJEXT = @OBJEXT@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ +POSUB = @POSUB@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +SND_UTIL_MAJOR = @SND_UTIL_MAJOR@ +SND_UTIL_MINOR = @SND_UTIL_MINOR@ +SND_UTIL_SUBMINOR = @SND_UTIL_SUBMINOR@ +SND_UTIL_VERSION = @SND_UTIL_VERSION@ +STRIP = @STRIP@ +SYSTEMD_CFLAGS = @SYSTEMD_CFLAGS@ +SYSTEMD_LIBS = @SYSTEMD_LIBS@ +TESTSOUND = @TESTSOUND@ +USE_NLS = @USE_NLS@ +VERSION = @VERSION@ +XGETTEXT = @XGETTEXT@ +XGETTEXT_015 = @XGETTEXT_015@ +XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_CC = @ac_ct_CC@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +mydatadir = @mydatadir@ +ncurses5_config = @ncurses5_config@ +ncursesw5_config = @ncursesw5_config@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +rst2man_available = @rst2man_available@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +systemdsystemunitdir = @systemdsystemunitdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +udevrulesdir = @udevrulesdir@ +xmlto_available = @xmlto_available@ +SUBDIRS = aconnect aplaymidi aseqdump aseqnet +all: all-recursive + +.SUFFIXES: +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign seq/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --foreign seq/Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): + +# This directory's subdirectories are mostly independent; you can cd +# into them and run 'make' without going through this Makefile. +# To change the values of 'make' variables: instead of editing Makefiles, +# (1) if the variable is set in 'config.status', edit 'config.status' +# (which will cause the Makefiles to be regenerated when you run 'make'); +# (2) otherwise, pass the desired values on the 'make' command line. +$(am__recursive_targets): + @fail=; \ + if $(am__make_keepgoing); then \ + failcom='fail=yes'; \ + else \ + failcom='exit 1'; \ + fi; \ + dot_seen=no; \ + target=`echo $@ | sed s/-recursive//`; \ + case "$@" in \ + distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ + *) list='$(SUBDIRS)' ;; \ + esac; \ + for subdir in $$list; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + dot_seen=yes; \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || eval $$failcom; \ + done; \ + if test "$$dot_seen" = "no"; then \ + $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ + fi; test -z "$$fail" + +ID: $(am__tagged_files) + $(am__define_uniq_tagged_files); mkid -fID $$unique +tags: tags-recursive +TAGS: tags + +tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + set x; \ + here=`pwd`; \ + if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ + include_option=--etags-include; \ + empty_fix=.; \ + else \ + include_option=--include; \ + empty_fix=; \ + fi; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test ! -f $$subdir/TAGS || \ + set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \ + fi; \ + done; \ + $(am__define_uniq_tagged_files); \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: ctags-recursive + +CTAGS: ctags +ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + $(am__define_uniq_tagged_files); \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" +cscopelist: cscopelist-recursive + +cscopelist-am: $(am__tagged_files) + list='$(am__tagged_files)'; \ + case "$(srcdir)" in \ + [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ + *) sdir=$(subdir)/$(srcdir) ;; \ + esac; \ + for i in $$list; do \ + if test -f "$$i"; then \ + echo "$(subdir)/$$i"; \ + else \ + echo "$$sdir/$$i"; \ + fi; \ + done >> $(top_builddir)/cscope.files + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) distdir-am + +distdir-am: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done + @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + $(am__make_dryrun) \ + || test -d "$(distdir)/$$subdir" \ + || $(MKDIR_P) "$(distdir)/$$subdir" \ + || exit 1; \ + dir1=$$subdir; dir2="$(distdir)/$$subdir"; \ + $(am__relativize); \ + new_distdir=$$reldir; \ + dir1=$$subdir; dir2="$(top_distdir)"; \ + $(am__relativize); \ + new_top_distdir=$$reldir; \ + echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \ + echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \ + ($(am__cd) $$subdir && \ + $(MAKE) $(AM_MAKEFLAGS) \ + top_distdir="$$new_top_distdir" \ + distdir="$$new_distdir" \ + am__remove_distdir=: \ + am__skip_length_check=: \ + am__skip_mode_fix=: \ + distdir) \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-recursive +all-am: Makefile +installdirs: installdirs-recursive +installdirs-am: +install: install-recursive +install-exec: install-exec-recursive +install-data: install-data-recursive +uninstall: uninstall-recursive + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-recursive +install-strip: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-recursive + +clean-am: clean-generic mostlyclean-am + +distclean: distclean-recursive + -rm -f Makefile +distclean-am: clean-am distclean-generic distclean-tags + +dvi: dvi-recursive + +dvi-am: + +html: html-recursive + +html-am: + +info: info-recursive + +info-am: + +install-data-am: + +install-dvi: install-dvi-recursive + +install-dvi-am: + +install-exec-am: + +install-html: install-html-recursive + +install-html-am: + +install-info: install-info-recursive + +install-info-am: + +install-man: + +install-pdf: install-pdf-recursive + +install-pdf-am: + +install-ps: install-ps-recursive + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-recursive + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-recursive + +mostlyclean-am: mostlyclean-generic + +pdf: pdf-recursive + +pdf-am: + +ps: ps-recursive + +ps-am: + +uninstall-am: + +.MAKE: $(am__recursive_targets) install-am install-strip + +.PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am check \ + check-am clean clean-generic cscopelist-am ctags ctags-am \ + distclean distclean-generic distclean-tags distdir dvi dvi-am \ + html html-am info info-am install install-am install-data \ + install-data-am install-dvi install-dvi-am install-exec \ + install-exec-am install-html install-html-am install-info \ + install-info-am install-man install-pdf install-pdf-am \ + install-ps install-ps-am install-strip installcheck \ + installcheck-am installdirs installdirs-am maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-generic pdf \ + pdf-am ps ps-am tags tags-am uninstall uninstall-am + +.PRECIOUS: Makefile + + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/seq/aconnect/Makefile.am b/seq/aconnect/Makefile.am new file mode 100644 index 0000000..02be5c5 --- /dev/null +++ b/seq/aconnect/Makefile.am @@ -0,0 +1,7 @@ +AM_CPPFLAGS = -I$(top_srcdir)/include +EXTRA_DIST = README.aconnect aconnect.1 +LDADD = $(LIBINTL) + +bin_PROGRAMS = aconnect +aconnect_SOURCES = aconnect.c +man_MANS = aconnect.1 diff --git a/seq/aconnect/Makefile.in b/seq/aconnect/Makefile.in new file mode 100644 index 0000000..2bee125 --- /dev/null +++ b/seq/aconnect/Makefile.in @@ -0,0 +1,721 @@ +# Makefile.in generated by automake 1.16.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994-2018 Free Software Foundation, Inc. + +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +VPATH = @srcdir@ +am__is_gnu_make = { \ + if test -z '$(MAKELEVEL)'; then \ + false; \ + elif test -n '$(MAKE_HOST)'; then \ + true; \ + elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ + true; \ + else \ + false; \ + fi; \ +} +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + esac; \ + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +bin_PROGRAMS = aconnect$(EXEEXT) +subdir = seq/aconnect +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/gettext.m4 \ + $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/lib-ld.m4 \ + $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ + $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \ + $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/acinclude.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/include/aconfig.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +am__installdirs = "$(DESTDIR)$(bindir)" "$(DESTDIR)$(man1dir)" +PROGRAMS = $(bin_PROGRAMS) +am_aconnect_OBJECTS = aconnect.$(OBJEXT) +aconnect_OBJECTS = $(am_aconnect_OBJECTS) +aconnect_LDADD = $(LDADD) +am__DEPENDENCIES_1 = +aconnect_DEPENDENCIES = $(am__DEPENDENCIES_1) +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__maybe_remake_depfiles = depfiles +am__depfiles_remade = ./$(DEPDIR)/aconnect.Po +am__mv = mv -f +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +AM_V_CC = $(am__v_CC_@AM_V@) +am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) +am__v_CC_0 = @echo " CC " $@; +am__v_CC_1 = +CCLD = $(CC) +LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_CCLD = $(am__v_CCLD_@AM_V@) +am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) +am__v_CCLD_0 = @echo " CCLD " $@; +am__v_CCLD_1 = +SOURCES = $(aconnect_SOURCES) +DIST_SOURCES = $(aconnect_SOURCES) +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; +am__vpath_adj = case $$p in \ + $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ + *) f=$$p;; \ + esac; +am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; +am__install_max = 40 +am__nobase_strip_setup = \ + srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` +am__nobase_strip = \ + for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" +am__nobase_list = $(am__nobase_strip_setup); \ + for p in $$list; do echo "$$p $$p"; done | \ + sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ + $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ + if (++n[$$2] == $(am__install_max)) \ + { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ + END { for (dir in files) print dir, files[dir] }' +am__base_list = \ + sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ + sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' +am__uninstall_files_from_dir = { \ + test -z "$$files" \ + || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ + || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ + $(am__cd) "$$dir" && rm -f $$files; }; \ + } +man1dir = $(mandir)/man1 +NROFF = nroff +MANS = $(man_MANS) +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) +# Read a list of newline-separated strings from the standard input, +# and print each of them once, without duplicates. Input order is +# *not* preserved. +am__uniquify_input = $(AWK) '\ + BEGIN { nonempty = 0; } \ + { items[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in items) print i; }; } \ +' +# Make sure the list of sources is unique. This is necessary because, +# e.g., the same source file might be shared among _SOURCES variables +# for different programs/libraries. +am__define_uniq_tagged_files = \ + list='$(am__tagged_files)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | $(am__uniquify_input)` +ETAGS = etags +CTAGS = ctags +am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/depcomp +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +ALSACTL_DAEMONSWITCH = @ALSACTL_DAEMONSWITCH@ +ALSACTL_PIDFILE_DIR = @ALSACTL_PIDFILE_DIR@ +ALSA_CFLAGS = @ALSA_CFLAGS@ +ALSA_LIBS = @ALSA_LIBS@ +ALSA_TOPOLOGY_LIBS = @ALSA_TOPOLOGY_LIBS@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +ASOUND_LOCK_DIR = @ASOUND_LOCK_DIR@ +ASOUND_STATE_DIR = @ASOUND_STATE_DIR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CURSESINC = @CURSESINC@ +CURSESLIB = @CURSESLIB@ +CURSES_CFLAGS = @CURSES_CFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +FFTW_CFLAGS = @FFTW_CFLAGS@ +FFTW_INC = @FFTW_INC@ +FFTW_LIB = @FFTW_LIB@ +GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ +GMSGFMT = @GMSGFMT@ +GMSGFMT_015 = @GMSGFMT_015@ +GREP = @GREP@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +INTLLIBS = @INTLLIBS@ +INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@ +LDFLAGS = @LDFLAGS@ +LIBICONV = @LIBICONV@ +LIBINTL = @LIBINTL@ +LIBOBJS = @LIBOBJS@ +LIBRT = @LIBRT@ +LIBS = @LIBS@ +LN_S = @LN_S@ +LTLIBICONV = @LTLIBICONV@ +LTLIBINTL = @LTLIBINTL@ +LTLIBOBJS = @LTLIBOBJS@ +MAINT = @MAINT@ +MAKEINFO = @MAKEINFO@ +MKDIR_P = @MKDIR_P@ +MSGFMT = @MSGFMT@ +MSGFMT_015 = @MSGFMT_015@ +MSGMERGE = @MSGMERGE@ +NCURSESW_CFLAGS = @NCURSESW_CFLAGS@ +NCURSESW_LIBS = @NCURSESW_LIBS@ +NCURSES_CFLAGS = @NCURSES_CFLAGS@ +NCURSES_LIBS = @NCURSES_LIBS@ +OBJEXT = @OBJEXT@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ +POSUB = @POSUB@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +SND_UTIL_MAJOR = @SND_UTIL_MAJOR@ +SND_UTIL_MINOR = @SND_UTIL_MINOR@ +SND_UTIL_SUBMINOR = @SND_UTIL_SUBMINOR@ +SND_UTIL_VERSION = @SND_UTIL_VERSION@ +STRIP = @STRIP@ +SYSTEMD_CFLAGS = @SYSTEMD_CFLAGS@ +SYSTEMD_LIBS = @SYSTEMD_LIBS@ +TESTSOUND = @TESTSOUND@ +USE_NLS = @USE_NLS@ +VERSION = @VERSION@ +XGETTEXT = @XGETTEXT@ +XGETTEXT_015 = @XGETTEXT_015@ +XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_CC = @ac_ct_CC@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +mydatadir = @mydatadir@ +ncurses5_config = @ncurses5_config@ +ncursesw5_config = @ncursesw5_config@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +rst2man_available = @rst2man_available@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +systemdsystemunitdir = @systemdsystemunitdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +udevrulesdir = @udevrulesdir@ +xmlto_available = @xmlto_available@ +AM_CPPFLAGS = -I$(top_srcdir)/include +EXTRA_DIST = README.aconnect aconnect.1 +LDADD = $(LIBINTL) +aconnect_SOURCES = aconnect.c +man_MANS = aconnect.1 +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .o .obj +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign seq/aconnect/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --foreign seq/aconnect/Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): +install-binPROGRAMS: $(bin_PROGRAMS) + @$(NORMAL_INSTALL) + @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(bindir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(bindir)" || exit 1; \ + fi; \ + for p in $$list; do echo "$$p $$p"; done | \ + sed 's/$(EXEEXT)$$//' | \ + while read p p1; do if test -f $$p \ + ; then echo "$$p"; echo "$$p"; else :; fi; \ + done | \ + sed -e 'p;s,.*/,,;n;h' \ + -e 's|.*|.|' \ + -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \ + sed 'N;N;N;s,\n, ,g' | \ + $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \ + { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \ + if ($$2 == $$4) files[d] = files[d] " " $$1; \ + else { print "f", $$3 "/" $$4, $$1; } } \ + END { for (d in files) print "f", d, files[d] }' | \ + while read type dir files; do \ + if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \ + test -z "$$files" || { \ + echo " $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(bindir)$$dir'"; \ + $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \ + } \ + ; done + +uninstall-binPROGRAMS: + @$(NORMAL_UNINSTALL) + @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ + files=`for p in $$list; do echo "$$p"; done | \ + sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \ + -e 's/$$/$(EXEEXT)/' \ + `; \ + test -n "$$list" || exit 0; \ + echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \ + cd "$(DESTDIR)$(bindir)" && rm -f $$files + +clean-binPROGRAMS: + -test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS) + +aconnect$(EXEEXT): $(aconnect_OBJECTS) $(aconnect_DEPENDENCIES) $(EXTRA_aconnect_DEPENDENCIES) + @rm -f aconnect$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(aconnect_OBJECTS) $(aconnect_LDADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/aconnect.Po@am__quote@ # am--include-marker + +$(am__depfiles_remade): + @$(MKDIR_P) $(@D) + @echo '# dummy' >$@-t && $(am__mv) $@-t $@ + +am--depfiles: $(am__depfiles_remade) + +.c.o: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< + +.c.obj: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` +install-man1: $(man_MANS) + @$(NORMAL_INSTALL) + @list1=''; \ + list2='$(man_MANS)'; \ + test -n "$(man1dir)" \ + && test -n "`echo $$list1$$list2`" \ + || exit 0; \ + echo " $(MKDIR_P) '$(DESTDIR)$(man1dir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(man1dir)" || exit 1; \ + { for i in $$list1; do echo "$$i"; done; \ + if test -n "$$list2"; then \ + for i in $$list2; do echo "$$i"; done \ + | sed -n '/\.1[a-z]*$$/p'; \ + fi; \ + } | while read p; do \ + if test -f $$p; then d=; else d="$(srcdir)/"; fi; \ + echo "$$d$$p"; echo "$$p"; \ + done | \ + sed -e 'n;s,.*/,,;p;h;s,.*\.,,;s,^[^1][0-9a-z]*$$,1,;x' \ + -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,' | \ + sed 'N;N;s,\n, ,g' | { \ + list=; while read file base inst; do \ + if test "$$base" = "$$inst"; then list="$$list $$file"; else \ + echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man1dir)/$$inst'"; \ + $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man1dir)/$$inst" || exit $$?; \ + fi; \ + done; \ + for i in $$list; do echo "$$i"; done | $(am__base_list) | \ + while read files; do \ + test -z "$$files" || { \ + echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(man1dir)'"; \ + $(INSTALL_DATA) $$files "$(DESTDIR)$(man1dir)" || exit $$?; }; \ + done; } + +uninstall-man1: + @$(NORMAL_UNINSTALL) + @list=''; test -n "$(man1dir)" || exit 0; \ + files=`{ for i in $$list; do echo "$$i"; done; \ + l2='$(man_MANS)'; for i in $$l2; do echo "$$i"; done | \ + sed -n '/\.1[a-z]*$$/p'; \ + } | sed -e 's,.*/,,;h;s,.*\.,,;s,^[^1][0-9a-z]*$$,1,;x' \ + -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,'`; \ + dir='$(DESTDIR)$(man1dir)'; $(am__uninstall_files_from_dir) + +ID: $(am__tagged_files) + $(am__define_uniq_tagged_files); mkid -fID $$unique +tags: tags-am +TAGS: tags + +tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + set x; \ + here=`pwd`; \ + $(am__define_uniq_tagged_files); \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: ctags-am + +CTAGS: ctags +ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + $(am__define_uniq_tagged_files); \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" +cscopelist: cscopelist-am + +cscopelist-am: $(am__tagged_files) + list='$(am__tagged_files)'; \ + case "$(srcdir)" in \ + [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ + *) sdir=$(subdir)/$(srcdir) ;; \ + esac; \ + for i in $$list; do \ + if test -f "$$i"; then \ + echo "$(subdir)/$$i"; \ + else \ + echo "$$sdir/$$i"; \ + fi; \ + done >> $(top_builddir)/cscope.files + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) distdir-am + +distdir-am: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(PROGRAMS) $(MANS) +installdirs: + for dir in "$(DESTDIR)$(bindir)" "$(DESTDIR)$(man1dir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ + done +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-binPROGRAMS clean-generic mostlyclean-am + +distclean: distclean-am + -rm -f ./$(DEPDIR)/aconnect.Po + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: install-man + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: install-binPROGRAMS + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: install-man1 + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -f ./$(DEPDIR)/aconnect.Po + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-binPROGRAMS uninstall-man + +uninstall-man: uninstall-man1 + +.MAKE: install-am install-strip + +.PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-am clean \ + clean-binPROGRAMS clean-generic cscopelist-am ctags ctags-am \ + distclean distclean-compile distclean-generic distclean-tags \ + distdir dvi dvi-am html html-am info info-am install \ + install-am install-binPROGRAMS install-data install-data-am \ + install-dvi install-dvi-am install-exec install-exec-am \ + install-html install-html-am install-info install-info-am \ + install-man install-man1 install-pdf install-pdf-am install-ps \ + install-ps-am install-strip installcheck installcheck-am \ + installdirs maintainer-clean maintainer-clean-generic \ + mostlyclean mostlyclean-compile mostlyclean-generic pdf pdf-am \ + ps ps-am tags tags-am uninstall uninstall-am \ + uninstall-binPROGRAMS uninstall-man uninstall-man1 + +.PRECIOUS: Makefile + + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/seq/aconnect/README.aconnect b/seq/aconnect/README.aconnect new file mode 100644 index 0000000..1f6237a --- /dev/null +++ b/seq/aconnect/README.aconnect @@ -0,0 +1,46 @@ +================================================================ + aconnect - control subscriptions + ver.0.1.3 + Copyright (C) 1999-2000 Takashi Iwai +================================================================ + +aconnect is a utility to control subscriptions of two ports as the +third "manager" client. + +For example, the following connects two ports, from 64:0 to 65:0. + + % aconnect 64:0 65:0 + +To disconnect the existing subscription, use -d option. + + % aconnect -d 64:0 65:0 + +To see which port is available as input port, run the following +command: + + % aconnect -i + client 0: 'System' [type=kernel] + 0 'Timer ' + 1 'Announce ' + client 64: '0: MIDI Synth' [type=kernel] + 0 'card 0: synth-midi: 0' + +Similary, to see the output ports, use -o flag. + + % aconnect -o + client 64: '0: MIDI Synth' [type=kernel] + 0 'card 0: synth-midi: 0' + client 65: 'AWE Wave Table Synth : 0' [type=kernel] + 0 'Emu8000 port 0 ' + 1 'Emu8000 port 1 ' + 2 'Emu8000 port 2 ' + 3 'Emu8000 port 3 ' + +The option -l together with -i or -o shows subscribers for each port. + +Ports are connected exclusively when the option -e is specified. + +For modifying time-stamp with a queue, use -r or -t option followed by +a queue index which updates the time-stamp. Former uses real-time queue, +while the latter uses tick queue. The queue must be used (not necessarily +owned) by the receiver client. diff --git a/seq/aconnect/aconnect.1 b/seq/aconnect/aconnect.1 new file mode 100644 index 0000000..2050187 --- /dev/null +++ b/seq/aconnect/aconnect.1 @@ -0,0 +1,145 @@ +.TH aconnect 1 "August 31, 2000" +.de EX +.nf +.ft CW +.. +.de EE +.ft R +.fi +.. +.SH NAME +aconnect \- ALSA sequencer connection manager + +.SH SYNOPSIS +.B aconnect +[\-d] [\-options] sender receiver +.br +.B aconnect +\-i|\-o [\-options] +.br +.B aconnect +\-x + +.SH DESCRIPTION +.B aconnect +is a utility to connect and disconnect two existing ports on ALSA sequencer +system. +The ports with the arbitrary subscription permission, such as created +by +.B aseqview(1), +can be connected to any (MIDI) device ports using +.B aconnect. +For example, to connect from port 64:0 to 65:0, run as follows: +.IP "" 4 +% aconnect 64:0 65:0 +.PP +The connection is one-way, and the whole data to the sender port (64:0) +is redirected to the receiver port (65:0). When another port (e.g. 65:1) +is attached to the same sender port, the data is sent to both receiver +ports. +For disconnection, use +.B \-d +option. +.sp +.EX +% aconnect \-d 64:0 65:0 +.EE +.PP +The address can be given using the client's name. +.sp +.EX +% aconnect External:0 Emu8000:1 +.EE +.PP +Then the port 0 of the client matching with the string "External" is +connected to the port 1 of the client matching with the "Emu8000". +.PP +Another function of +.B aconnect +is to list the present ports +on the given condition. +The input ports, which may become +.I sender +ports, can be listed with +.B \-i +option. +.sp +.EX +% aconnect \-i +client 0: 'System' [type=kernel] + 0 'Timer ' + 1 'Announce ' +client 64: 'External MIDI\-0' [type=kernel] + 0 'MIDI 0\-0 ' +.EE +.PP +Similarly, to see the output ports, use +.B \-o +flag. +.PP +You can remove all existing exported connections using +.B \-x +option. This function is useful for terminating the ALSA drivers, +because the modules with sequencer connections cannot be unloaded +unless their connections are removed. + +.SH OPTIONS +.SS CONNECTION MANAGEMENT +.TP +.B \-d, \-\-disconnect +Disconnect the given subscription. +.TP +.B \-e, \-\-exclusive +Connect ports with exclusive mode. +Both sender and receiver ports can be no longer connected by any other ports. +.TP +.B \-r, \-\-real queue +Convert time-stamps of event packets to the current value of the given +.I real-time +queue. +This is option is, however, not so useful, since +the receiver port must use (not necessarily own) the specified queue. +.TP +.B \-t, \-\-tick queue +Like +.B \-r +option, but +time-stamps are converted to the current value of the given +.I tick +queue. + +.SS LIST PORTS +.TP +.B \-i, \-\-input +List existing input (readable) ports. +This option is exclusive to +.B \-o. +.TP +.B \-o, \-\-output +List existing output (writable) ports. +This option is exclusive to +.B \-i. +.TP +.B \-l, \-\-list +List the current connection status. The connected and connecting ports +from/to each port are listed together. +The suffix flag +.B [ex] +means the connection is exclusive. +The suffix flag +.B [real:#] +and +.B [tick:#] +mean the connection includes real-time and tick conversion on the listed +queue, respectively. + +.SS REMOVE ALL CONNECTIONS +.TP +.B \-x, \-\-removeall +Remove all exported connections. + +.SH "SEE ALSO" +aseqnet(1), aseqview(1) + +.SH AUTHOR +Takashi Iwai diff --git a/seq/aconnect/aconnect.c b/seq/aconnect/aconnect.c new file mode 100644 index 0000000..85a7770 --- /dev/null +++ b/seq/aconnect/aconnect.c @@ -0,0 +1,408 @@ +/* + * connect / disconnect two subscriber ports + * ver.0.1.3 + * + * Copyright (C) 1999 Takashi Iwai + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "aconfig.h" +#include "gettext.h" + +static void error_handler(const char *file, int line, const char *function, int err, const char *fmt, ...) +{ + va_list arg; + + if (err == ENOENT) /* Ignore those misleading "warnings" */ + return; + va_start(arg, fmt); + fprintf(stderr, "ALSA lib %s:%i:(%s) ", file, line, function); + vfprintf(stderr, fmt, arg); + if (err) + fprintf(stderr, ": %s", snd_strerror(err)); + putc('\n', stderr); + va_end(arg); +} + +static void usage(void) +{ + printf(_("aconnect - ALSA sequencer connection manager\n")); + printf(_("Copyright (C) 1999-2000 Takashi Iwai\n")); + printf(_("Usage:\n")); + printf(_(" * Connection/disconnection between two ports\n")); + printf(_(" aconnect [-options] sender receiver\n")); + printf(_(" sender, receiver = client:port pair\n")); + printf(_(" -d,--disconnect disconnect\n")); + printf(_(" -e,--exclusive exclusive connection\n")); + printf(_(" -r,--real # convert real-time-stamp on queue\n")); + printf(_(" -t,--tick # convert tick-time-stamp on queue\n")); + printf(_(" * List connected ports (no subscription action)\n")); + printf(_(" aconnect -i|-o [-options]\n")); + printf(_(" -i,--input list input (readable) ports\n")); + printf(_(" -o,--output list output (writable) ports\n")); + printf(_(" -l,--list list current connections of each port\n")); + printf(_(" * Remove all exported connections\n")); + printf(_(" -x, --removeall\n")); +} + +/* + * check permission (capability) of specified port + */ + +#define LIST_INPUT 1 +#define LIST_OUTPUT 2 + +#define perm_ok(pinfo,bits) ((snd_seq_port_info_get_capability(pinfo) & (bits)) == (bits)) + +static int check_permission(snd_seq_port_info_t *pinfo, int perm) +{ + if (perm) { + if (perm & LIST_INPUT) { + if (perm_ok(pinfo, SND_SEQ_PORT_CAP_READ|SND_SEQ_PORT_CAP_SUBS_READ)) + goto __ok; + } + if (perm & LIST_OUTPUT) { + if (perm_ok(pinfo, SND_SEQ_PORT_CAP_WRITE|SND_SEQ_PORT_CAP_SUBS_WRITE)) + goto __ok; + } + return 0; + } + __ok: + if (snd_seq_port_info_get_capability(pinfo) & SND_SEQ_PORT_CAP_NO_EXPORT) + return 0; + return 1; +} + +/* + * list subscribers of specified type + */ +static void list_each_subs(snd_seq_t *seq, snd_seq_query_subscribe_t *subs, int type, const char *msg) +{ + int count = 0; + snd_seq_query_subscribe_set_type(subs, type); + snd_seq_query_subscribe_set_index(subs, 0); + while (snd_seq_query_port_subscribers(seq, subs) >= 0) { + const snd_seq_addr_t *addr; + if (count++ == 0) + printf("\t%s: ", msg); + else + printf(", "); + addr = snd_seq_query_subscribe_get_addr(subs); + printf("%d:%d", addr->client, addr->port); + if (snd_seq_query_subscribe_get_exclusive(subs)) + printf("[ex]"); + if (snd_seq_query_subscribe_get_time_update(subs)) + printf("[%s:%d]", + (snd_seq_query_subscribe_get_time_real(subs) ? "real" : "tick"), + snd_seq_query_subscribe_get_queue(subs)); + snd_seq_query_subscribe_set_index(subs, snd_seq_query_subscribe_get_index(subs) + 1); + } + if (count > 0) + printf("\n"); +} + +/* + * list subscribers + */ +static void list_subscribers(snd_seq_t *seq, const snd_seq_addr_t *addr) +{ + snd_seq_query_subscribe_t *subs; + snd_seq_query_subscribe_alloca(&subs); + snd_seq_query_subscribe_set_root(subs, addr); + list_each_subs(seq, subs, SND_SEQ_QUERY_SUBS_READ, _("Connecting To")); + list_each_subs(seq, subs, SND_SEQ_QUERY_SUBS_WRITE, _("Connected From")); +} + +/* + * search all ports + */ +typedef void (*action_func_t)(snd_seq_t *seq, snd_seq_client_info_t *cinfo, snd_seq_port_info_t *pinfo, int count); + +static void do_search_port(snd_seq_t *seq, int perm, action_func_t do_action) +{ + snd_seq_client_info_t *cinfo; + snd_seq_port_info_t *pinfo; + int count; + + snd_seq_client_info_alloca(&cinfo); + snd_seq_port_info_alloca(&pinfo); + snd_seq_client_info_set_client(cinfo, -1); + while (snd_seq_query_next_client(seq, cinfo) >= 0) { + /* reset query info */ + snd_seq_port_info_set_client(pinfo, snd_seq_client_info_get_client(cinfo)); + snd_seq_port_info_set_port(pinfo, -1); + count = 0; + while (snd_seq_query_next_port(seq, pinfo) >= 0) { + if (check_permission(pinfo, perm)) { + do_action(seq, cinfo, pinfo, count); + count++; + } + } + } +} + + +static void print_port(snd_seq_t *seq, snd_seq_client_info_t *cinfo, + snd_seq_port_info_t *pinfo, int count) +{ + if (! count) { + int card = -1, pid = -1; + + printf(_("client %d: '%s' [type=%s"), + snd_seq_client_info_get_client(cinfo), + snd_seq_client_info_get_name(cinfo), + (snd_seq_client_info_get_type(cinfo) == SND_SEQ_USER_CLIENT ? + _("user") : _("kernel"))); + +#ifdef HAVE_SEQ_CLIENT_INFO_GET_CARD + card = snd_seq_client_info_get_card(cinfo); +#endif + if (card != -1) + printf(",card=%d", card); + +#ifdef HAVE_SEQ_CLIENT_INFO_GET_PID + pid = snd_seq_client_info_get_pid(cinfo); +#endif + if (pid != -1) + printf(",pid=%d", pid); + printf("]\n"); + } + printf(" %3d '%-16s'\n", + snd_seq_port_info_get_port(pinfo), + snd_seq_port_info_get_name(pinfo)); +} + +static void print_port_and_subs(snd_seq_t *seq, snd_seq_client_info_t *cinfo, + snd_seq_port_info_t *pinfo, int count) +{ + print_port(seq, cinfo, pinfo, count); + list_subscribers(seq, snd_seq_port_info_get_addr(pinfo)); +} + + +/* + * remove all (exported) connections + */ +static void remove_connection(snd_seq_t *seq, snd_seq_client_info_t *cinfo, + snd_seq_port_info_t *pinfo, int count) +{ + snd_seq_query_subscribe_t *query; + snd_seq_port_info_t *port; + snd_seq_port_subscribe_t *subs; + + snd_seq_query_subscribe_alloca(&query); + snd_seq_query_subscribe_set_root(query, snd_seq_port_info_get_addr(pinfo)); + snd_seq_query_subscribe_set_type(query, SND_SEQ_QUERY_SUBS_READ); + snd_seq_query_subscribe_set_index(query, 0); + + snd_seq_port_info_alloca(&port); + snd_seq_port_subscribe_alloca(&subs); + + while (snd_seq_query_port_subscribers(seq, query) >= 0) { + const snd_seq_addr_t *sender = snd_seq_query_subscribe_get_root(query); + const snd_seq_addr_t *dest = snd_seq_query_subscribe_get_addr(query); + + if (snd_seq_get_any_port_info(seq, dest->client, dest->port, port) < 0 || + !(snd_seq_port_info_get_capability(port) & SND_SEQ_PORT_CAP_SUBS_WRITE) || + (snd_seq_port_info_get_capability(port) & SND_SEQ_PORT_CAP_NO_EXPORT)) { + snd_seq_query_subscribe_set_index(query, snd_seq_query_subscribe_get_index(query) + 1); + continue; + } + snd_seq_port_subscribe_set_queue(subs, snd_seq_query_subscribe_get_queue(query)); + snd_seq_port_subscribe_set_sender(subs, sender); + snd_seq_port_subscribe_set_dest(subs, dest); + if (snd_seq_unsubscribe_port(seq, subs) < 0) { + snd_seq_query_subscribe_set_index(query, snd_seq_query_subscribe_get_index(query) + 1); + } + } +} + +static void remove_all_connections(snd_seq_t *seq) +{ + do_search_port(seq, 0, remove_connection); +} + + +/* + * main.. + */ + +enum { + SUBSCRIBE, UNSUBSCRIBE, LIST, REMOVE_ALL +}; + +static const struct option long_option[] = { + {"disconnect", 0, NULL, 'd'}, + {"input", 0, NULL, 'i'}, + {"output", 0, NULL, 'o'}, + {"real", 1, NULL, 'r'}, + {"tick", 1, NULL, 't'}, + {"exclusive", 0, NULL, 'e'}, + {"list", 0, NULL, 'l'}, + {"removeall", 0, NULL, 'x'}, + {NULL, 0, NULL, 0}, +}; + +int main(int argc, char **argv) +{ + int c; + snd_seq_t *seq; + int queue = 0, convert_time = 0, convert_real = 0, exclusive = 0; + int command = SUBSCRIBE; + int list_perm = 0; + int client; + int list_subs = 0; + snd_seq_port_subscribe_t *subs; + snd_seq_addr_t sender, dest; + +#ifdef ENABLE_NLS + setlocale(LC_ALL, ""); + textdomain(PACKAGE); +#endif + + while ((c = getopt_long(argc, argv, "dior:t:elx", long_option, NULL)) != -1) { + switch (c) { + case 'd': + command = UNSUBSCRIBE; + break; + case 'i': + command = LIST; + list_perm |= LIST_INPUT; + break; + case 'o': + command = LIST; + list_perm |= LIST_OUTPUT; + break; + case 'e': + exclusive = 1; + break; + case 'r': + queue = atoi(optarg); + convert_time = 1; + convert_real = 1; + break; + case 't': + queue = atoi(optarg); + convert_time = 1; + convert_real = 0; + break; + case 'l': + command = LIST; + list_subs = 1; + break; + case 'x': + command = REMOVE_ALL; + break; + default: + usage(); + exit(1); + } + } + + if (snd_seq_open(&seq, "default", SND_SEQ_OPEN_DUPLEX, 0) < 0) { + fprintf(stderr, _("can't open sequencer\n")); + return 1; + } + + snd_lib_error_set_handler(error_handler); + + switch (command) { + case LIST: + do_search_port(seq, list_perm, + list_subs ? print_port_and_subs : print_port); + snd_seq_close(seq); + return 0; + case REMOVE_ALL: + remove_all_connections(seq); + snd_seq_close(seq); + return 0; + } + + /* connection or disconnection */ + + if (optind + 2 > argc) { + snd_seq_close(seq); + usage(); + exit(1); + } + + if ((client = snd_seq_client_id(seq)) < 0) { + snd_seq_close(seq); + fprintf(stderr, _("can't get client id\n")); + return 1; + } + + /* set client info */ + if (snd_seq_set_client_name(seq, "ALSA Connector") < 0) { + snd_seq_close(seq); + fprintf(stderr, _("can't set client info\n")); + return 1; + } + + /* set subscription */ + if (snd_seq_parse_address(seq, &sender, argv[optind]) < 0) { + snd_seq_close(seq); + fprintf(stderr, _("invalid sender address %s\n"), argv[optind]); + return 1; + } + if (snd_seq_parse_address(seq, &dest, argv[optind + 1]) < 0) { + snd_seq_close(seq); + fprintf(stderr, _("invalid destination address %s\n"), argv[optind + 1]); + return 1; + } + snd_seq_port_subscribe_alloca(&subs); + snd_seq_port_subscribe_set_sender(subs, &sender); + snd_seq_port_subscribe_set_dest(subs, &dest); + snd_seq_port_subscribe_set_queue(subs, queue); + snd_seq_port_subscribe_set_exclusive(subs, exclusive); + snd_seq_port_subscribe_set_time_update(subs, convert_time); + snd_seq_port_subscribe_set_time_real(subs, convert_real); + + if (command == UNSUBSCRIBE) { + if (snd_seq_get_port_subscription(seq, subs) < 0) { + snd_seq_close(seq); + fprintf(stderr, _("No subscription is found\n")); + return 1; + } + if (snd_seq_unsubscribe_port(seq, subs) < 0) { + snd_seq_close(seq); + fprintf(stderr, _("Disconnection failed (%s)\n"), snd_strerror(errno)); + return 1; + } + } else { + if (snd_seq_get_port_subscription(seq, subs) == 0) { + snd_seq_close(seq); + fprintf(stderr, _("Connection is already subscribed\n")); + return 1; + } + if (snd_seq_subscribe_port(seq, subs) < 0) { + snd_seq_close(seq); + fprintf(stderr, _("Connection failed (%s)\n"), snd_strerror(errno)); + return 1; + } + } + + snd_seq_close(seq); + + return 0; +} diff --git a/seq/aplaymidi/Makefile.am b/seq/aplaymidi/Makefile.am new file mode 100644 index 0000000..1fa063e --- /dev/null +++ b/seq/aplaymidi/Makefile.am @@ -0,0 +1,5 @@ +AM_CPPFLAGS = -I$(top_srcdir)/include +EXTRA_DIST = aplaymidi.1 arecordmidi.1 + +bin_PROGRAMS = aplaymidi arecordmidi +man_MANS = aplaymidi.1 arecordmidi.1 diff --git a/seq/aplaymidi/Makefile.in b/seq/aplaymidi/Makefile.in new file mode 100644 index 0000000..ba0b177 --- /dev/null +++ b/seq/aplaymidi/Makefile.in @@ -0,0 +1,728 @@ +# Makefile.in generated by automake 1.16.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994-2018 Free Software Foundation, Inc. + +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +VPATH = @srcdir@ +am__is_gnu_make = { \ + if test -z '$(MAKELEVEL)'; then \ + false; \ + elif test -n '$(MAKE_HOST)'; then \ + true; \ + elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ + true; \ + else \ + false; \ + fi; \ +} +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + esac; \ + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +bin_PROGRAMS = aplaymidi$(EXEEXT) arecordmidi$(EXEEXT) +subdir = seq/aplaymidi +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/gettext.m4 \ + $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/lib-ld.m4 \ + $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ + $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \ + $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/acinclude.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/include/aconfig.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +am__installdirs = "$(DESTDIR)$(bindir)" "$(DESTDIR)$(man1dir)" +PROGRAMS = $(bin_PROGRAMS) +aplaymidi_SOURCES = aplaymidi.c +aplaymidi_OBJECTS = aplaymidi.$(OBJEXT) +aplaymidi_LDADD = $(LDADD) +arecordmidi_SOURCES = arecordmidi.c +arecordmidi_OBJECTS = arecordmidi.$(OBJEXT) +arecordmidi_LDADD = $(LDADD) +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__maybe_remake_depfiles = depfiles +am__depfiles_remade = ./$(DEPDIR)/aplaymidi.Po \ + ./$(DEPDIR)/arecordmidi.Po +am__mv = mv -f +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +AM_V_CC = $(am__v_CC_@AM_V@) +am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) +am__v_CC_0 = @echo " CC " $@; +am__v_CC_1 = +CCLD = $(CC) +LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_CCLD = $(am__v_CCLD_@AM_V@) +am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) +am__v_CCLD_0 = @echo " CCLD " $@; +am__v_CCLD_1 = +SOURCES = aplaymidi.c arecordmidi.c +DIST_SOURCES = aplaymidi.c arecordmidi.c +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; +am__vpath_adj = case $$p in \ + $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ + *) f=$$p;; \ + esac; +am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; +am__install_max = 40 +am__nobase_strip_setup = \ + srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` +am__nobase_strip = \ + for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" +am__nobase_list = $(am__nobase_strip_setup); \ + for p in $$list; do echo "$$p $$p"; done | \ + sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ + $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ + if (++n[$$2] == $(am__install_max)) \ + { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ + END { for (dir in files) print dir, files[dir] }' +am__base_list = \ + sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ + sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' +am__uninstall_files_from_dir = { \ + test -z "$$files" \ + || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ + || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ + $(am__cd) "$$dir" && rm -f $$files; }; \ + } +man1dir = $(mandir)/man1 +NROFF = nroff +MANS = $(man_MANS) +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) +# Read a list of newline-separated strings from the standard input, +# and print each of them once, without duplicates. Input order is +# *not* preserved. +am__uniquify_input = $(AWK) '\ + BEGIN { nonempty = 0; } \ + { items[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in items) print i; }; } \ +' +# Make sure the list of sources is unique. This is necessary because, +# e.g., the same source file might be shared among _SOURCES variables +# for different programs/libraries. +am__define_uniq_tagged_files = \ + list='$(am__tagged_files)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | $(am__uniquify_input)` +ETAGS = etags +CTAGS = ctags +am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/depcomp +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +ALSACTL_DAEMONSWITCH = @ALSACTL_DAEMONSWITCH@ +ALSACTL_PIDFILE_DIR = @ALSACTL_PIDFILE_DIR@ +ALSA_CFLAGS = @ALSA_CFLAGS@ +ALSA_LIBS = @ALSA_LIBS@ +ALSA_TOPOLOGY_LIBS = @ALSA_TOPOLOGY_LIBS@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +ASOUND_LOCK_DIR = @ASOUND_LOCK_DIR@ +ASOUND_STATE_DIR = @ASOUND_STATE_DIR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CURSESINC = @CURSESINC@ +CURSESLIB = @CURSESLIB@ +CURSES_CFLAGS = @CURSES_CFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +FFTW_CFLAGS = @FFTW_CFLAGS@ +FFTW_INC = @FFTW_INC@ +FFTW_LIB = @FFTW_LIB@ +GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ +GMSGFMT = @GMSGFMT@ +GMSGFMT_015 = @GMSGFMT_015@ +GREP = @GREP@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +INTLLIBS = @INTLLIBS@ +INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@ +LDFLAGS = @LDFLAGS@ +LIBICONV = @LIBICONV@ +LIBINTL = @LIBINTL@ +LIBOBJS = @LIBOBJS@ +LIBRT = @LIBRT@ +LIBS = @LIBS@ +LN_S = @LN_S@ +LTLIBICONV = @LTLIBICONV@ +LTLIBINTL = @LTLIBINTL@ +LTLIBOBJS = @LTLIBOBJS@ +MAINT = @MAINT@ +MAKEINFO = @MAKEINFO@ +MKDIR_P = @MKDIR_P@ +MSGFMT = @MSGFMT@ +MSGFMT_015 = @MSGFMT_015@ +MSGMERGE = @MSGMERGE@ +NCURSESW_CFLAGS = @NCURSESW_CFLAGS@ +NCURSESW_LIBS = @NCURSESW_LIBS@ +NCURSES_CFLAGS = @NCURSES_CFLAGS@ +NCURSES_LIBS = @NCURSES_LIBS@ +OBJEXT = @OBJEXT@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ +POSUB = @POSUB@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +SND_UTIL_MAJOR = @SND_UTIL_MAJOR@ +SND_UTIL_MINOR = @SND_UTIL_MINOR@ +SND_UTIL_SUBMINOR = @SND_UTIL_SUBMINOR@ +SND_UTIL_VERSION = @SND_UTIL_VERSION@ +STRIP = @STRIP@ +SYSTEMD_CFLAGS = @SYSTEMD_CFLAGS@ +SYSTEMD_LIBS = @SYSTEMD_LIBS@ +TESTSOUND = @TESTSOUND@ +USE_NLS = @USE_NLS@ +VERSION = @VERSION@ +XGETTEXT = @XGETTEXT@ +XGETTEXT_015 = @XGETTEXT_015@ +XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_CC = @ac_ct_CC@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +mydatadir = @mydatadir@ +ncurses5_config = @ncurses5_config@ +ncursesw5_config = @ncursesw5_config@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +rst2man_available = @rst2man_available@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +systemdsystemunitdir = @systemdsystemunitdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +udevrulesdir = @udevrulesdir@ +xmlto_available = @xmlto_available@ +AM_CPPFLAGS = -I$(top_srcdir)/include +EXTRA_DIST = aplaymidi.1 arecordmidi.1 +man_MANS = aplaymidi.1 arecordmidi.1 +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .o .obj +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign seq/aplaymidi/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --foreign seq/aplaymidi/Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): +install-binPROGRAMS: $(bin_PROGRAMS) + @$(NORMAL_INSTALL) + @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(bindir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(bindir)" || exit 1; \ + fi; \ + for p in $$list; do echo "$$p $$p"; done | \ + sed 's/$(EXEEXT)$$//' | \ + while read p p1; do if test -f $$p \ + ; then echo "$$p"; echo "$$p"; else :; fi; \ + done | \ + sed -e 'p;s,.*/,,;n;h' \ + -e 's|.*|.|' \ + -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \ + sed 'N;N;N;s,\n, ,g' | \ + $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \ + { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \ + if ($$2 == $$4) files[d] = files[d] " " $$1; \ + else { print "f", $$3 "/" $$4, $$1; } } \ + END { for (d in files) print "f", d, files[d] }' | \ + while read type dir files; do \ + if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \ + test -z "$$files" || { \ + echo " $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(bindir)$$dir'"; \ + $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \ + } \ + ; done + +uninstall-binPROGRAMS: + @$(NORMAL_UNINSTALL) + @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ + files=`for p in $$list; do echo "$$p"; done | \ + sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \ + -e 's/$$/$(EXEEXT)/' \ + `; \ + test -n "$$list" || exit 0; \ + echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \ + cd "$(DESTDIR)$(bindir)" && rm -f $$files + +clean-binPROGRAMS: + -test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS) + +aplaymidi$(EXEEXT): $(aplaymidi_OBJECTS) $(aplaymidi_DEPENDENCIES) $(EXTRA_aplaymidi_DEPENDENCIES) + @rm -f aplaymidi$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(aplaymidi_OBJECTS) $(aplaymidi_LDADD) $(LIBS) + +arecordmidi$(EXEEXT): $(arecordmidi_OBJECTS) $(arecordmidi_DEPENDENCIES) $(EXTRA_arecordmidi_DEPENDENCIES) + @rm -f arecordmidi$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(arecordmidi_OBJECTS) $(arecordmidi_LDADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/aplaymidi.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/arecordmidi.Po@am__quote@ # am--include-marker + +$(am__depfiles_remade): + @$(MKDIR_P) $(@D) + @echo '# dummy' >$@-t && $(am__mv) $@-t $@ + +am--depfiles: $(am__depfiles_remade) + +.c.o: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< + +.c.obj: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` +install-man1: $(man_MANS) + @$(NORMAL_INSTALL) + @list1=''; \ + list2='$(man_MANS)'; \ + test -n "$(man1dir)" \ + && test -n "`echo $$list1$$list2`" \ + || exit 0; \ + echo " $(MKDIR_P) '$(DESTDIR)$(man1dir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(man1dir)" || exit 1; \ + { for i in $$list1; do echo "$$i"; done; \ + if test -n "$$list2"; then \ + for i in $$list2; do echo "$$i"; done \ + | sed -n '/\.1[a-z]*$$/p'; \ + fi; \ + } | while read p; do \ + if test -f $$p; then d=; else d="$(srcdir)/"; fi; \ + echo "$$d$$p"; echo "$$p"; \ + done | \ + sed -e 'n;s,.*/,,;p;h;s,.*\.,,;s,^[^1][0-9a-z]*$$,1,;x' \ + -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,' | \ + sed 'N;N;s,\n, ,g' | { \ + list=; while read file base inst; do \ + if test "$$base" = "$$inst"; then list="$$list $$file"; else \ + echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man1dir)/$$inst'"; \ + $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man1dir)/$$inst" || exit $$?; \ + fi; \ + done; \ + for i in $$list; do echo "$$i"; done | $(am__base_list) | \ + while read files; do \ + test -z "$$files" || { \ + echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(man1dir)'"; \ + $(INSTALL_DATA) $$files "$(DESTDIR)$(man1dir)" || exit $$?; }; \ + done; } + +uninstall-man1: + @$(NORMAL_UNINSTALL) + @list=''; test -n "$(man1dir)" || exit 0; \ + files=`{ for i in $$list; do echo "$$i"; done; \ + l2='$(man_MANS)'; for i in $$l2; do echo "$$i"; done | \ + sed -n '/\.1[a-z]*$$/p'; \ + } | sed -e 's,.*/,,;h;s,.*\.,,;s,^[^1][0-9a-z]*$$,1,;x' \ + -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,'`; \ + dir='$(DESTDIR)$(man1dir)'; $(am__uninstall_files_from_dir) + +ID: $(am__tagged_files) + $(am__define_uniq_tagged_files); mkid -fID $$unique +tags: tags-am +TAGS: tags + +tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + set x; \ + here=`pwd`; \ + $(am__define_uniq_tagged_files); \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: ctags-am + +CTAGS: ctags +ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + $(am__define_uniq_tagged_files); \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" +cscopelist: cscopelist-am + +cscopelist-am: $(am__tagged_files) + list='$(am__tagged_files)'; \ + case "$(srcdir)" in \ + [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ + *) sdir=$(subdir)/$(srcdir) ;; \ + esac; \ + for i in $$list; do \ + if test -f "$$i"; then \ + echo "$(subdir)/$$i"; \ + else \ + echo "$$sdir/$$i"; \ + fi; \ + done >> $(top_builddir)/cscope.files + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) distdir-am + +distdir-am: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(PROGRAMS) $(MANS) +installdirs: + for dir in "$(DESTDIR)$(bindir)" "$(DESTDIR)$(man1dir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ + done +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-binPROGRAMS clean-generic mostlyclean-am + +distclean: distclean-am + -rm -f ./$(DEPDIR)/aplaymidi.Po + -rm -f ./$(DEPDIR)/arecordmidi.Po + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: install-man + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: install-binPROGRAMS + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: install-man1 + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -f ./$(DEPDIR)/aplaymidi.Po + -rm -f ./$(DEPDIR)/arecordmidi.Po + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-binPROGRAMS uninstall-man + +uninstall-man: uninstall-man1 + +.MAKE: install-am install-strip + +.PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-am clean \ + clean-binPROGRAMS clean-generic cscopelist-am ctags ctags-am \ + distclean distclean-compile distclean-generic distclean-tags \ + distdir dvi dvi-am html html-am info info-am install \ + install-am install-binPROGRAMS install-data install-data-am \ + install-dvi install-dvi-am install-exec install-exec-am \ + install-html install-html-am install-info install-info-am \ + install-man install-man1 install-pdf install-pdf-am install-ps \ + install-ps-am install-strip installcheck installcheck-am \ + installdirs maintainer-clean maintainer-clean-generic \ + mostlyclean mostlyclean-compile mostlyclean-generic pdf pdf-am \ + ps ps-am tags tags-am uninstall uninstall-am \ + uninstall-binPROGRAMS uninstall-man uninstall-man1 + +.PRECIOUS: Makefile + + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/seq/aplaymidi/aplaymidi.1 b/seq/aplaymidi/aplaymidi.1 new file mode 100644 index 0000000..02fef9d --- /dev/null +++ b/seq/aplaymidi/aplaymidi.1 @@ -0,0 +1,63 @@ +.TH APLAYMIDI 1 "2 Nov 2011" + +.SH NAME +aplaymidi \- play Standard MIDI Files + +.SH SYNOPSIS +.B aplaymidi +\-p client:port[,...] [\-d delay] midifile ... + +.SH DESCRIPTION +.B aplaymidi +is a command-line utility that plays the specified MIDI file(s) to one +or more ALSA sequencer ports. + +.SH OPTIONS + +.TP +.I \-h, \-\-help +Prints a list of options. + +.TP +.I \-V, \-\-version +Prints the current version. + +.TP +.I \-l, \-\-list +Prints a list of possible output ports. + +.TP +.I \-p, \-\-port=client:port,... +Sets the sequencer port(s) to which the events in the MIDI file(s) are +sent. + +A client can be specified by its number, its name, or a prefix of its +name. A port is specified by its number; for port 0 of a client, the +":0" part of the port specification can be omitted. + +Multiple ports can be specified to allow playback of MIDI file(s) that +contain events for multiple devices (ports), as specified by "Port +Number" meta events. + +For compatibility with +.B pmidi(1), +the port specification is taken from the +.I ALSA_OUTPUT_PORTS +environment variable if none is given on the command line. + +.TP +.I \-d, \-\-delay=seconds +Specifies how long to wait after the end of each MIDI file, +to allow the last notes to die away. + +.SH BUGS +.B aplaymidi +handles "Port Number" meta events, but not "Port Name" meta events. + +.SH SEE ALSO +pmidi(1) +.br +playmidi(1) + +.SH AUTHOR +Clemens Ladisch diff --git a/seq/aplaymidi/aplaymidi.c b/seq/aplaymidi/aplaymidi.c new file mode 100644 index 0000000..e8491e1 --- /dev/null +++ b/seq/aplaymidi/aplaymidi.c @@ -0,0 +1,932 @@ +/* + * aplaymidi.c - play Standard MIDI Files to sequencer port(s) + * + * Copyright (c) 2004-2006 Clemens Ladisch + * + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +/* TODO: sequencer queue timer selection */ + +#include +#include +#include +#include +#include +#include +#include +#include "aconfig.h" +#include "version.h" + +/* + * 31.25 kbaud, one start bit, eight data bits, two stop bits. + * (The MIDI spec says one stop bit, but every transmitter uses two, just to be + * sure, so we better not exceed that to avoid overflowing the output buffer.) + */ +#define MIDI_BYTES_PER_SEC (31250 / (1 + 8 + 2)) + +/* + * A MIDI event after being parsed/loaded from the file. + * There could be made a case for using snd_seq_event_t instead. + */ +struct event { + struct event *next; /* linked list */ + + unsigned char type; /* SND_SEQ_EVENT_xxx */ + unsigned char port; /* port index */ + unsigned int tick; + union { + unsigned char d[3]; /* channel and data bytes */ + int tempo; + unsigned int length; /* length of sysex data */ + } data; + unsigned char sysex[0]; +}; + +struct track { + struct event *first_event; /* list of all events in this track */ + int end_tick; /* length of this track */ + + struct event *current_event; /* used while loading and playing */ +}; + +static snd_seq_t *seq; +static int client; +static int port_count; +static snd_seq_addr_t *ports; +static int queue; +static int end_delay = 2; +static const char *file_name; +static FILE *file; +static int file_offset; /* current offset in input file */ +static int num_tracks; +static struct track *tracks; +static int smpte_timing; + +/* prints an error message to stderr */ +static void errormsg(const char *msg, ...) +{ + va_list ap; + + va_start(ap, msg); + vfprintf(stderr, msg, ap); + va_end(ap); + fputc('\n', stderr); +} + +/* prints an error message to stderr, and dies */ +static void fatal(const char *msg, ...) +{ + va_list ap; + + va_start(ap, msg); + vfprintf(stderr, msg, ap); + va_end(ap); + fputc('\n', stderr); + exit(EXIT_FAILURE); +} + +/* memory allocation error handling */ +static void check_mem(void *p) +{ + if (!p) + fatal("Out of memory"); +} + +/* error handling for ALSA functions */ +static void check_snd(const char *operation, int err) +{ + if (err < 0) + fatal("Cannot %s - %s", operation, snd_strerror(err)); +} + +static void init_seq(void) +{ + int err; + + /* open sequencer */ + err = snd_seq_open(&seq, "default", SND_SEQ_OPEN_DUPLEX, 0); + check_snd("open sequencer", err); + + /* set our name (otherwise it's "Client-xxx") */ + err = snd_seq_set_client_name(seq, "aplaymidi"); + check_snd("set client name", err); + + /* find out who we actually are */ + client = snd_seq_client_id(seq); + check_snd("get client id", client); +} + +/* parses one or more port addresses from the string */ +static void parse_ports(const char *arg) +{ + char *buf, *s, *port_name; + int err; + + /* make a copy of the string because we're going to modify it */ + buf = strdup(arg); + check_mem(buf); + + for (port_name = s = buf; s; port_name = s + 1) { + /* Assume that ports are separated by commas. We don't use + * spaces because those are valid in client names. */ + s = strchr(port_name, ','); + if (s) + *s = '\0'; + + ++port_count; + ports = realloc(ports, port_count * sizeof(snd_seq_addr_t)); + check_mem(ports); + + err = snd_seq_parse_address(seq, &ports[port_count - 1], port_name); + if (err < 0) + fatal("Invalid port %s - %s", port_name, snd_strerror(err)); + } + + free(buf); +} + +static void create_source_port(void) +{ + snd_seq_port_info_t *pinfo; + int err; + + snd_seq_port_info_alloca(&pinfo); + + /* the first created port is 0 anyway, but let's make sure ... */ + snd_seq_port_info_set_port(pinfo, 0); + snd_seq_port_info_set_port_specified(pinfo, 1); + + snd_seq_port_info_set_name(pinfo, "aplaymidi"); + + snd_seq_port_info_set_capability(pinfo, 0); /* sic */ + snd_seq_port_info_set_type(pinfo, + SND_SEQ_PORT_TYPE_MIDI_GENERIC | + SND_SEQ_PORT_TYPE_APPLICATION); + + err = snd_seq_create_port(seq, pinfo); + check_snd("create port", err); +} + +static void create_queue(void) +{ + queue = snd_seq_alloc_named_queue(seq, "aplaymidi"); + check_snd("create queue", queue); + /* the queue is now locked, which is just fine */ +} + +static void connect_ports(void) +{ + int i, err; + + /* + * We send MIDI events with explicit destination addresses, so we don't + * need any connections to the playback ports. But we connect to those + * anyway to force any underlying RawMIDI ports to remain open while + * we're playing - otherwise, ALSA would reset the port after every + * event. + */ + for (i = 0; i < port_count; ++i) { + err = snd_seq_connect_to(seq, 0, ports[i].client, ports[i].port); + if (err < 0) + fatal("Cannot connect to port %d:%d - %s", + ports[i].client, ports[i].port, snd_strerror(err)); + } +} + +static int read_byte(void) +{ + ++file_offset; + return getc(file); +} + +/* reads a little-endian 32-bit integer */ +static int read_32_le(void) +{ + int value; + value = read_byte(); + value |= read_byte() << 8; + value |= read_byte() << 16; + value |= read_byte() << 24; + return !feof(file) ? value : -1; +} + +/* reads a 4-character identifier */ +static int read_id(void) +{ + return read_32_le(); +} +#define MAKE_ID(c1, c2, c3, c4) ((c1) | ((c2) << 8) | ((c3) << 16) | ((c4) << 24)) + +/* reads a fixed-size big-endian number */ +static int read_int(int bytes) +{ + int c, value = 0; + + do { + c = read_byte(); + if (c == EOF) + return -1; + value = (value << 8) | c; + } while (--bytes); + return value; +} + +/* reads a variable-length number */ +static int read_var(void) +{ + int value, c; + + c = read_byte(); + value = c & 0x7f; + if (c & 0x80) { + c = read_byte(); + value = (value << 7) | (c & 0x7f); + if (c & 0x80) { + c = read_byte(); + value = (value << 7) | (c & 0x7f); + if (c & 0x80) { + c = read_byte(); + value = (value << 7) | c; + if (c & 0x80) + return -1; + } + } + } + return !feof(file) ? value : -1; +} + +/* allocates a new event */ +static struct event *new_event(struct track *track, int sysex_length) +{ + struct event *event; + + event = malloc(sizeof(struct event) + sysex_length); + check_mem(event); + + event->next = NULL; + + /* append at the end of the track's linked list */ + if (track->current_event) + track->current_event->next = event; + else + track->first_event = event; + track->current_event = event; + + return event; +} + +static void skip(int bytes) +{ + while (bytes > 0) + read_byte(), --bytes; +} + +/* reads one complete track from the file */ +static int read_track(struct track *track, int track_end) +{ + int tick = 0; + unsigned char last_cmd = 0; + unsigned char port = 0; + + /* the current file position is after the track ID and length */ + while (file_offset < track_end) { + unsigned char cmd; + struct event *event; + int delta_ticks, len, c; + + delta_ticks = read_var(); + if (delta_ticks < 0) + break; + tick += delta_ticks; + + c = read_byte(); + if (c < 0) + break; + + if (c & 0x80) { + /* have command */ + cmd = c; + if (cmd < 0xf0) + last_cmd = cmd; + } else { + /* running status */ + ungetc(c, file); + file_offset--; + cmd = last_cmd; + if (!cmd) + goto _error; + } + + switch (cmd >> 4) { + /* maps SMF events to ALSA sequencer events */ + static const unsigned char cmd_type[] = { + [0x8] = SND_SEQ_EVENT_NOTEOFF, + [0x9] = SND_SEQ_EVENT_NOTEON, + [0xa] = SND_SEQ_EVENT_KEYPRESS, + [0xb] = SND_SEQ_EVENT_CONTROLLER, + [0xc] = SND_SEQ_EVENT_PGMCHANGE, + [0xd] = SND_SEQ_EVENT_CHANPRESS, + [0xe] = SND_SEQ_EVENT_PITCHBEND + }; + + case 0x8: /* channel msg with 2 parameter bytes */ + case 0x9: + case 0xa: + case 0xb: + case 0xe: + event = new_event(track, 0); + event->type = cmd_type[cmd >> 4]; + event->port = port; + event->tick = tick; + event->data.d[0] = cmd & 0x0f; + event->data.d[1] = read_byte() & 0x7f; + event->data.d[2] = read_byte() & 0x7f; + break; + + case 0xc: /* channel msg with 1 parameter byte */ + case 0xd: + event = new_event(track, 0); + event->type = cmd_type[cmd >> 4]; + event->port = port; + event->tick = tick; + event->data.d[0] = cmd & 0x0f; + event->data.d[1] = read_byte() & 0x7f; + break; + + case 0xf: + switch (cmd) { + case 0xf0: /* sysex */ + case 0xf7: /* continued sysex, or escaped commands */ + len = read_var(); + if (len < 0) + goto _error; + if (cmd == 0xf0) + ++len; + event = new_event(track, len); + event->type = SND_SEQ_EVENT_SYSEX; + event->port = port; + event->tick = tick; + event->data.length = len; + if (cmd == 0xf0) { + event->sysex[0] = 0xf0; + c = 1; + } else { + c = 0; + } + for (; c < len; ++c) + event->sysex[c] = read_byte(); + break; + + case 0xff: /* meta event */ + c = read_byte(); + len = read_var(); + if (len < 0) + goto _error; + + switch (c) { + case 0x21: /* port number */ + if (len < 1) + goto _error; + port = read_byte() % port_count; + skip(len - 1); + break; + + case 0x2f: /* end of track */ + track->end_tick = tick; + skip(track_end - file_offset); + return 1; + + case 0x51: /* tempo */ + if (len < 3) + goto _error; + if (smpte_timing) { + /* SMPTE timing doesn't change */ + skip(len); + } else { + event = new_event(track, 0); + event->type = SND_SEQ_EVENT_TEMPO; + event->port = port; + event->tick = tick; + event->data.tempo = read_byte() << 16; + event->data.tempo |= read_byte() << 8; + event->data.tempo |= read_byte(); + skip(len - 3); + } + break; + + default: /* ignore all other meta events */ + skip(len); + break; + } + break; + + default: /* invalid Fx command */ + goto _error; + } + break; + + default: /* cannot happen */ + goto _error; + } + } +_error: + errormsg("%s: invalid MIDI data (offset %#x)", file_name, file_offset); + return 0; +} + +/* reads an entire MIDI file */ +static int read_smf(void) +{ + int header_len, type, time_division, i, err; + snd_seq_queue_tempo_t *queue_tempo; + + /* the curren position is immediately after the "MThd" id */ + header_len = read_int(4); + if (header_len < 6) { +invalid_format: + errormsg("%s: invalid file format", file_name); + return 0; + } + + type = read_int(2); + if (type != 0 && type != 1) { + errormsg("%s: type %d format is not supported", file_name, type); + return 0; + } + + num_tracks = read_int(2); + if (num_tracks < 1 || num_tracks > 1000) { + errormsg("%s: invalid number of tracks (%d)", file_name, num_tracks); + num_tracks = 0; + return 0; + } + tracks = calloc(num_tracks, sizeof(struct track)); + if (!tracks) { + errormsg("out of memory"); + num_tracks = 0; + return 0; + } + + time_division = read_int(2); + if (time_division < 0) + goto invalid_format; + + /* interpret and set tempo */ + snd_seq_queue_tempo_alloca(&queue_tempo); + smpte_timing = !!(time_division & 0x8000); + if (!smpte_timing) { + /* time_division is ticks per quarter */ + snd_seq_queue_tempo_set_tempo(queue_tempo, 500000); /* default: 120 bpm */ + snd_seq_queue_tempo_set_ppq(queue_tempo, time_division); + } else { + /* upper byte is negative frames per second */ + i = 0x80 - ((time_division >> 8) & 0x7f); + /* lower byte is ticks per frame */ + time_division &= 0xff; + /* now pretend that we have quarter-note based timing */ + switch (i) { + case 24: + snd_seq_queue_tempo_set_tempo(queue_tempo, 500000); + snd_seq_queue_tempo_set_ppq(queue_tempo, 12 * time_division); + break; + case 25: + snd_seq_queue_tempo_set_tempo(queue_tempo, 400000); + snd_seq_queue_tempo_set_ppq(queue_tempo, 10 * time_division); + break; + case 29: /* 30 drop-frame */ + snd_seq_queue_tempo_set_tempo(queue_tempo, 100000000); + snd_seq_queue_tempo_set_ppq(queue_tempo, 2997 * time_division); + break; + case 30: + snd_seq_queue_tempo_set_tempo(queue_tempo, 500000); + snd_seq_queue_tempo_set_ppq(queue_tempo, 15 * time_division); + break; + default: + errormsg("%s: invalid number of SMPTE frames per second (%d)", + file_name, i); + return 0; + } + } + err = snd_seq_set_queue_tempo(seq, queue, queue_tempo); + if (err < 0) { + errormsg("Cannot set queue tempo (%u/%i)", + snd_seq_queue_tempo_get_tempo(queue_tempo), + snd_seq_queue_tempo_get_ppq(queue_tempo)); + return 0; + } + + /* read tracks */ + for (i = 0; i < num_tracks; ++i) { + int len; + + /* search for MTrk chunk */ + for (;;) { + int id = read_id(); + len = read_int(4); + if (feof(file)) { + errormsg("%s: unexpected end of file", file_name); + return 0; + } + if (len < 0 || len >= 0x10000000) { + errormsg("%s: invalid chunk length %d", file_name, len); + return 0; + } + if (id == MAKE_ID('M', 'T', 'r', 'k')) + break; + skip(len); + } + if (!read_track(&tracks[i], file_offset + len)) + return 0; + } + return 1; +} + +static int read_riff(void) +{ + /* skip file length */ + read_byte(); + read_byte(); + read_byte(); + read_byte(); + + /* check file type ("RMID" = RIFF MIDI) */ + if (read_id() != MAKE_ID('R', 'M', 'I', 'D')) { +invalid_format: + errormsg("%s: invalid file format", file_name); + return 0; + } + /* search for "data" chunk */ + for (;;) { + int id = read_id(); + int len = read_32_le(); + if (feof(file)) { +data_not_found: + errormsg("%s: data chunk not found", file_name); + return 0; + } + if (id == MAKE_ID('d', 'a', 't', 'a')) + break; + if (len < 0) + goto data_not_found; + skip((len + 1) & ~1); + } + /* the "data" chunk must contain data in SMF format */ + if (read_id() != MAKE_ID('M', 'T', 'h', 'd')) + goto invalid_format; + return read_smf(); +} + +static void cleanup_file_data(void) +{ + int i; + struct event *event; + + for (i = 0; i < num_tracks; ++i) { + event = tracks[i].first_event; + while (event) { + struct event *next = event->next; + free(event); + event = next; + } + } + num_tracks = 0; + free(tracks); + tracks = NULL; +} + +static void handle_big_sysex(snd_seq_event_t *ev) +{ + unsigned int length; + ssize_t event_size; + int err; + + length = ev->data.ext.len; + if (length > MIDI_BYTES_PER_SEC) + ev->data.ext.len = MIDI_BYTES_PER_SEC; + event_size = snd_seq_event_length(ev); + if (event_size + 1 > snd_seq_get_output_buffer_size(seq)) { + err = snd_seq_drain_output(seq); + check_snd("drain output", err); + err = snd_seq_set_output_buffer_size(seq, event_size + 1); + check_snd("set output buffer size", err); + } + while (length > MIDI_BYTES_PER_SEC) { + err = snd_seq_event_output(seq, ev); + check_snd("output event", err); + err = snd_seq_drain_output(seq); + check_snd("drain output", err); + err = snd_seq_sync_output_queue(seq); + check_snd("sync output", err); + if (sleep(1)) + fatal("aborted"); + ev->data.ext.ptr = (char *)ev->data.ext.ptr + MIDI_BYTES_PER_SEC; + length -= MIDI_BYTES_PER_SEC; + } + ev->data.ext.len = length; +} + +static void play_midi(void) +{ + snd_seq_event_t ev; + int i, max_tick, err; + + /* calculate length of the entire file */ + max_tick = -1; + for (i = 0; i < num_tracks; ++i) { + if (tracks[i].end_tick > max_tick) + max_tick = tracks[i].end_tick; + } + + /* initialize current position in each track */ + for (i = 0; i < num_tracks; ++i) + tracks[i].current_event = tracks[i].first_event; + + /* common settings for all our events */ + snd_seq_ev_clear(&ev); + ev.queue = queue; + ev.source.port = 0; + ev.flags = SND_SEQ_TIME_STAMP_TICK; + + err = snd_seq_start_queue(seq, queue, NULL); + check_snd("start queue", err); + /* The queue won't be started until the START_QUEUE event is + * actually drained to the kernel, which is exactly what we want. */ + + for (;;) { + struct event* event = NULL; + struct track* event_track = NULL; + int i, min_tick = max_tick + 1; + + /* search next event */ + for (i = 0; i < num_tracks; ++i) { + struct track *track = &tracks[i]; + struct event *e2 = track->current_event; + if (e2 && e2->tick < min_tick) { + min_tick = e2->tick; + event = e2; + event_track = track; + } + } + if (!event) + break; /* end of song reached */ + + /* advance pointer to next event */ + event_track->current_event = event->next; + + /* output the event */ + ev.type = event->type; + ev.time.tick = event->tick; + ev.dest = ports[event->port]; + switch (ev.type) { + case SND_SEQ_EVENT_NOTEON: + case SND_SEQ_EVENT_NOTEOFF: + case SND_SEQ_EVENT_KEYPRESS: + snd_seq_ev_set_fixed(&ev); + ev.data.note.channel = event->data.d[0]; + ev.data.note.note = event->data.d[1]; + ev.data.note.velocity = event->data.d[2]; + break; + case SND_SEQ_EVENT_CONTROLLER: + snd_seq_ev_set_fixed(&ev); + ev.data.control.channel = event->data.d[0]; + ev.data.control.param = event->data.d[1]; + ev.data.control.value = event->data.d[2]; + break; + case SND_SEQ_EVENT_PGMCHANGE: + case SND_SEQ_EVENT_CHANPRESS: + snd_seq_ev_set_fixed(&ev); + ev.data.control.channel = event->data.d[0]; + ev.data.control.value = event->data.d[1]; + break; + case SND_SEQ_EVENT_PITCHBEND: + snd_seq_ev_set_fixed(&ev); + ev.data.control.channel = event->data.d[0]; + ev.data.control.value = + ((event->data.d[1]) | + ((event->data.d[2]) << 7)) - 0x2000; + break; + case SND_SEQ_EVENT_SYSEX: + snd_seq_ev_set_variable(&ev, event->data.length, + event->sysex); + handle_big_sysex(&ev); + break; + case SND_SEQ_EVENT_TEMPO: + snd_seq_ev_set_fixed(&ev); + ev.dest.client = SND_SEQ_CLIENT_SYSTEM; + ev.dest.port = SND_SEQ_PORT_SYSTEM_TIMER; + ev.data.queue.queue = queue; + ev.data.queue.param.value = event->data.tempo; + break; + default: + fatal("Invalid event type %d!", ev.type); + } + + /* this blocks when the output pool has been filled */ + err = snd_seq_event_output(seq, &ev); + check_snd("output event", err); + } + + /* schedule queue stop at end of song */ + snd_seq_ev_set_fixed(&ev); + ev.type = SND_SEQ_EVENT_STOP; + ev.time.tick = max_tick; + ev.dest.client = SND_SEQ_CLIENT_SYSTEM; + ev.dest.port = SND_SEQ_PORT_SYSTEM_TIMER; + ev.data.queue.queue = queue; + err = snd_seq_event_output(seq, &ev); + check_snd("output event", err); + + /* make sure that the sequencer sees all our events */ + err = snd_seq_drain_output(seq); + check_snd("drain output", err); + + /* + * There are three possibilities how to wait until all events have + * been played: + * 1) send an event back to us (like pmidi does), and wait for it; + * 2) wait for the EVENT_STOP notification for our queue which is sent + * by the system timer port (this would require a subscription); + * 3) wait until the output pool is empty. + * The last is the simplest. + */ + err = snd_seq_sync_output_queue(seq); + check_snd("sync output", err); + + /* give the last notes time to die away */ + if (end_delay > 0) + sleep(end_delay); +} + +static void play_file(void) +{ + int ok; + + if (!strcmp(file_name, "-")) + file = stdin; + else + file = fopen(file_name, "rb"); + if (!file) { + errormsg("Cannot open %s - %s", file_name, strerror(errno)); + return; + } + + file_offset = 0; + ok = 0; + + switch (read_id()) { + case MAKE_ID('M', 'T', 'h', 'd'): + ok = read_smf(); + break; + case MAKE_ID('R', 'I', 'F', 'F'): + ok = read_riff(); + break; + default: + errormsg("%s is not a Standard MIDI File", file_name); + break; + } + + if (file != stdin) + fclose(file); + + if (ok) + play_midi(); + + cleanup_file_data(); +} + +static void list_ports(void) +{ + snd_seq_client_info_t *cinfo; + snd_seq_port_info_t *pinfo; + + snd_seq_client_info_alloca(&cinfo); + snd_seq_port_info_alloca(&pinfo); + + puts(" Port Client name Port name"); + + snd_seq_client_info_set_client(cinfo, -1); + while (snd_seq_query_next_client(seq, cinfo) >= 0) { + int client = snd_seq_client_info_get_client(cinfo); + + snd_seq_port_info_set_client(pinfo, client); + snd_seq_port_info_set_port(pinfo, -1); + while (snd_seq_query_next_port(seq, pinfo) >= 0) { + /* port must understand MIDI messages */ + if (!(snd_seq_port_info_get_type(pinfo) + & SND_SEQ_PORT_TYPE_MIDI_GENERIC)) + continue; + /* we need both WRITE and SUBS_WRITE */ + if ((snd_seq_port_info_get_capability(pinfo) + & (SND_SEQ_PORT_CAP_WRITE | SND_SEQ_PORT_CAP_SUBS_WRITE)) + != (SND_SEQ_PORT_CAP_WRITE | SND_SEQ_PORT_CAP_SUBS_WRITE)) + continue; + printf("%3d:%-3d %-32.32s %s\n", + snd_seq_port_info_get_client(pinfo), + snd_seq_port_info_get_port(pinfo), + snd_seq_client_info_get_name(cinfo), + snd_seq_port_info_get_name(pinfo)); + } + } +} + +static void usage(const char *argv0) +{ + printf( + "Usage: %s -p client:port[,...] [-d delay] midifile ...\n" + "-h, --help this help\n" + "-V, --version print current version\n" + "-l, --list list all possible output ports\n" + "-p, --port=client:port,... set port(s) to play to\n" + "-d, --delay=seconds delay after song ends\n", + argv0); +} + +static void version(void) +{ + puts("aplaymidi version " SND_UTIL_VERSION_STR); +} + +int main(int argc, char *argv[]) +{ + static const char short_options[] = "hVlp:d:"; + static const struct option long_options[] = { + {"help", 0, NULL, 'h'}, + {"version", 0, NULL, 'V'}, + {"list", 0, NULL, 'l'}, + {"port", 1, NULL, 'p'}, + {"delay", 1, NULL, 'd'}, + {0} + }; + int c; + int do_list = 0; + + init_seq(); + + while ((c = getopt_long(argc, argv, short_options, + long_options, NULL)) != -1) { + switch (c) { + case 'h': + usage(argv[0]); + return 0; + case 'V': + version(); + return 0; + case 'l': + do_list = 1; + break; + case 'p': + parse_ports(optarg); + break; + case 'd': + end_delay = atoi(optarg); + break; + default: + usage(argv[0]); + return 1; + } + } + + if (do_list) { + list_ports(); + } else { + if (port_count < 1) { + /* use env var for compatibility with pmidi */ + const char *ports_str = getenv("ALSA_OUTPUT_PORTS"); + if (ports_str) + parse_ports(ports_str); + if (port_count < 1) { + errormsg("Please specify at least one port with --port."); + return 1; + } + } + if (optind >= argc) { + errormsg("Please specify a file to play."); + return 1; + } + + create_source_port(); + create_queue(); + connect_ports(); + + for (; optind < argc; ++optind) { + file_name = argv[optind]; + play_file(); + } + } + snd_seq_close(seq); + return 0; +} diff --git a/seq/aplaymidi/arecordmidi.1 b/seq/aplaymidi/arecordmidi.1 new file mode 100644 index 0000000..78b3a3a --- /dev/null +++ b/seq/aplaymidi/arecordmidi.1 @@ -0,0 +1,82 @@ +.TH ARECORDMIDI 1 "17 Sep 2007" + +.SH NAME +arecordmidi \- record Standard MIDI Files + +.SH SYNOPSIS +.B arecordmidi +\-p client:port[,...] [options] midifile + +.SH DESCRIPTION +.B arecordmidi +is a command-line utility that records a Standard MIDI File from one or +more ALSA sequencer ports. + +To stop recording, press Ctrl+C. + +.SH OPTIONS + +.TP +.I \-h,\-\-help +Prints a list of options. + +.TP +.I \-V,\-\-version +Prints the current version. + +.TP +.I \-l,\-\-list +Prints a list of possible input ports. + +.TP +.I \-p,\-\-port=client:port,... +Sets the sequencer port(s) from which events are recorded. + +A client can be specified by its number, its name, or a prefix of its +name. A port is specified by its number; for port 0 of a client, the +":0" part of the port specification can be omitted. + +.TP +.I \-b,\-\-bpm=beats +Sets the musical tempo of the MIDI file, in beats per minute. +The default value is 120 BPM. + +.TP +.I \-f,\-\-fps=frames +Sets the SMPTE resolution, in frames per second. +Possible values are 24, 25, 29.97 (for 30 drop-frame), and 30. + +.TP +.I \-t,\-\-ticks=ticks +Sets the resolution of timestamps (ticks) in the MIDI file, +in ticks per beat (when using musical tempo) or ticks per frame +(when using SMPTE timing). +The default value is 384 ticks/beat or 40 ticks/frame, respectively. + +.TP +.I \-s,\-\-split\-channels +Specifies that the data for each MIDI channel should be written to a +separate track in the MIDI file. +This will result in a "format 1" file. +Otherwise, when there is only one track, +.B arecordmidi +will generate a "format 0" file. + +.TP +.I \-m,\-\-metronome=client:port +Plays a metronome signal on the specified sequencer port. + +Metronome sounds are played on channel 10, MIDI notes 33 & 34 (GM2/GS/XG +metronome standard notes), with velocity 100 and duration 1. + +.TP +.I \-i,\-\-timesig=numerator:denominator +Sets the time signature for the MIDI file and metronome. + +The time signature is specified as usual with two numbers, representing +the numerator and denominator of the time signature as it would be +notated. The denominator must be a power of two. Both numbers should be +separated by a colon. The time signature is 4:4 by default. + +.SH AUTHOR +Clemens Ladisch diff --git a/seq/aplaymidi/arecordmidi.c b/seq/aplaymidi/arecordmidi.c new file mode 100644 index 0000000..2034df7 --- /dev/null +++ b/seq/aplaymidi/arecordmidi.c @@ -0,0 +1,921 @@ +/* + * arecordmidi.c - record standard MIDI files from sequencer ports + * + * Copyright (c) 2004-2005 Clemens Ladisch + * + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +/* TODO: sequencer queue timer selection */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include "aconfig.h" +#include "version.h" + +#define BUFFER_SIZE 4088 + +/* linked list of buffers, stores data as in the .mid file */ +struct buffer { + struct buffer *next; + unsigned char buf[BUFFER_SIZE]; +}; + +struct smf_track { + int size; /* size of entire data */ + int cur_buf_size; /* size of cur_buf */ + struct buffer *cur_buf; + snd_seq_tick_time_t last_tick; /* end of track */ + unsigned char last_command; /* used for running status */ + int used; /* anything record on this track */ + struct buffer first_buf; /* list head */ +}; + +/* timing/sysex + 16 channels */ +#define TRACKS_PER_PORT 17 + +/* metronome settings */ +/* TODO: create options for this */ +#define METRONOME_CHANNEL 9 +#define METRONOME_STRONG_NOTE 34 +#define METRONOME_WEAK_NOTE 33 +#define METRONOME_VELOCITY 100 +#define METRONOME_PROGRAM 0 + +static snd_seq_t *seq; +static int client; +static int port_count; +static snd_seq_addr_t *ports; +static int queue; +static int smpte_timing = 0; +static int beats = 120; +static int frames; +static int ticks = 0; +static FILE *file; +static int channel_split; +static int num_tracks; +static struct smf_track *tracks; +static volatile sig_atomic_t stop = 0; +static int use_metronome = 0; +static snd_seq_addr_t metronome_port; +static int metronome_weak_note = METRONOME_WEAK_NOTE; +static int metronome_strong_note = METRONOME_STRONG_NOTE; +static int metronome_velocity = METRONOME_VELOCITY; +static int metronome_program = METRONOME_PROGRAM; +static int metronome_channel = METRONOME_CHANNEL; +static int ts_num = 4; /* time signature: numerator */ +static int ts_div = 4; /* time signature: denominator */ +static int ts_dd = 2; /* time signature: denominator as a power of two */ + +/* Parse a decimal number from a command line argument. */ +static long arg_parse_decimal_num(const char *str, int *err) +{ + long val; + char *endptr; + + errno = 0; + val = strtol(str, &endptr, 0); + if (errno > 0) { + *err = -errno; + return 0; + } + if (*endptr != '\0') { + *err = -EINVAL; + return 0; + } + + return val; +} + +/* prints an error message to stderr, and dies */ +static void fatal(const char *msg, ...) +{ + va_list ap; + + va_start(ap, msg); + vfprintf(stderr, msg, ap); + va_end(ap); + fputc('\n', stderr); + exit(EXIT_FAILURE); +} + +/* memory allocation error handling */ +static void check_mem(void *p) +{ + if (!p) + fatal("Out of memory"); +} + +/* error handling for ALSA functions */ +static void check_snd(const char *operation, int err) +{ + if (err < 0) + fatal("Cannot %s - %s", operation, snd_strerror(err)); +} + +static void init_seq(void) +{ + int err; + + /* open sequencer */ + err = snd_seq_open(&seq, "default", SND_SEQ_OPEN_DUPLEX, 0); + check_snd("open sequencer", err); + + /* find out our client's id */ + client = snd_seq_client_id(seq); + check_snd("get client id", client); + + /* set our client's name */ + err = snd_seq_set_client_name(seq, "arecordmidi"); + check_snd("set client name", err); +} + +/* parses one or more port addresses from the string */ +static void parse_ports(const char *arg) +{ + char *buf, *s, *port_name; + int err; + + /* make a copy of the string because we're going to modify it */ + buf = strdup(arg); + check_mem(buf); + + for (port_name = s = buf; s; port_name = s + 1) { + /* Assume that ports are separated by commas. We don't use + * spaces because those are valid in client names. */ + s = strchr(port_name, ','); + if (s) + *s = '\0'; + + ++port_count; + ports = realloc(ports, port_count * sizeof(snd_seq_addr_t)); + check_mem(ports); + + err = snd_seq_parse_address(seq, &ports[port_count - 1], port_name); + if (err < 0) + fatal("Invalid port %s - %s", port_name, snd_strerror(err)); + } + + free(buf); +} + +/* parses the metronome port address */ +static void init_metronome(const char *arg) +{ + int err; + + err = snd_seq_parse_address(seq, &metronome_port, arg); + if (err < 0) + fatal("Invalid port %s - %s", arg, snd_strerror(err)); + use_metronome = 1; +} + +/* parses time signature specification */ +static void time_signature(const char *arg) +{ + long x = 0; + char *sep; + + x = strtol(arg, &sep, 10); + if (x < 1 || x > 64 || *sep != ':') + fatal("Invalid time signature (%s)", arg); + ts_num = x; + x = strtol(++sep, NULL, 10); + if (x < 1 || x > 64) + fatal("Invalid time signature (%s)", arg); + ts_div = x; + for (ts_dd = 0; x > 1; x /= 2) + ++ts_dd; +} + +/* + * Metronome implementation + */ +static void metronome_note(unsigned char note, unsigned int tick) +{ + snd_seq_event_t ev; + snd_seq_ev_clear(&ev); + snd_seq_ev_set_note(&ev, metronome_channel, note, metronome_velocity, 1); + snd_seq_ev_schedule_tick(&ev, queue, 0, tick); + snd_seq_ev_set_source(&ev, port_count); + snd_seq_ev_set_subs(&ev); + snd_seq_event_output(seq, &ev); +} + +static void metronome_echo(unsigned int tick) +{ + snd_seq_event_t ev; + snd_seq_ev_clear(&ev); + ev.type = SND_SEQ_EVENT_USR0; + snd_seq_ev_schedule_tick(&ev, queue, 0, tick); + snd_seq_ev_set_source(&ev, port_count); + snd_seq_ev_set_dest(&ev, client, port_count); + snd_seq_event_output(seq, &ev); +} + +static void metronome_pattern(unsigned int tick) +{ + int j, t, duration; + + t = tick; + duration = ticks * 4 / ts_div; + for (j = 0; j < ts_num; j++) { + metronome_note(j ? metronome_weak_note : metronome_strong_note, t); + t += duration; + } + metronome_echo(t); + snd_seq_drain_output(seq); +} + +static void metronome_set_program(void) +{ + snd_seq_event_t ev; + + snd_seq_ev_clear(&ev); + snd_seq_ev_set_pgmchange(&ev, metronome_channel, metronome_program); + snd_seq_ev_set_source(&ev, port_count); + snd_seq_ev_set_subs(&ev); + snd_seq_event_output(seq, &ev); +} + +static void init_tracks(void) +{ + int i; + + /* MIDI RP-019 says we need at least one track per port */ + num_tracks = port_count; + /* Allocate one track for each possible channel. + * Empty tracks won't be written to the file. */ + if (channel_split) + num_tracks *= TRACKS_PER_PORT; + + tracks = calloc(num_tracks, sizeof(struct smf_track)); + check_mem(tracks); + for (i = 0; i < num_tracks; ++i) + tracks[i].cur_buf = &tracks[i].first_buf; +} + +static void create_queue(void) +{ + snd_seq_queue_tempo_t *tempo; + int err; + + queue = snd_seq_alloc_named_queue(seq, "arecordmidi"); + check_snd("create queue", queue); + + snd_seq_queue_tempo_alloca(&tempo); + if (!smpte_timing) { + snd_seq_queue_tempo_set_tempo(tempo, 60000000 / beats); + snd_seq_queue_tempo_set_ppq(tempo, ticks); + } else { + /* + * ALSA doesn't know about the SMPTE time divisions, so + * we pretend to have a musical tempo with the equivalent + * number of ticks/s. + */ + switch (frames) { + case 24: + snd_seq_queue_tempo_set_tempo(tempo, 500000); + snd_seq_queue_tempo_set_ppq(tempo, 12 * ticks); + break; + case 25: + snd_seq_queue_tempo_set_tempo(tempo, 400000); + snd_seq_queue_tempo_set_ppq(tempo, 10 * ticks); + break; + case 29: + snd_seq_queue_tempo_set_tempo(tempo, 100000000); + snd_seq_queue_tempo_set_ppq(tempo, 2997 * ticks); + break; + case 30: + snd_seq_queue_tempo_set_tempo(tempo, 500000); + snd_seq_queue_tempo_set_ppq(tempo, 15 * ticks); + break; + default: + fatal("Invalid SMPTE frames %d", frames); + } + } + err = snd_seq_set_queue_tempo(seq, queue, tempo); + if (err < 0) + fatal("Cannot set queue tempo (%u/%i)", + snd_seq_queue_tempo_get_tempo(tempo), + snd_seq_queue_tempo_get_ppq(tempo)); +} + +static void create_ports(void) +{ + snd_seq_port_info_t *pinfo; + int i, err; + char name[32]; + + snd_seq_port_info_alloca(&pinfo); + + /* common information for all our ports */ + snd_seq_port_info_set_capability(pinfo, + SND_SEQ_PORT_CAP_WRITE | + SND_SEQ_PORT_CAP_SUBS_WRITE); + snd_seq_port_info_set_type(pinfo, + SND_SEQ_PORT_TYPE_MIDI_GENERIC | + SND_SEQ_PORT_TYPE_APPLICATION); + snd_seq_port_info_set_midi_channels(pinfo, 16); + + /* we want to know when the events got delivered to us */ + snd_seq_port_info_set_timestamping(pinfo, 1); + snd_seq_port_info_set_timestamp_queue(pinfo, queue); + + /* our port number is the same as our port index */ + snd_seq_port_info_set_port_specified(pinfo, 1); + for (i = 0; i < port_count; ++i) { + snd_seq_port_info_set_port(pinfo, i); + + sprintf(name, "arecordmidi port %i", i); + snd_seq_port_info_set_name(pinfo, name); + + err = snd_seq_create_port(seq, pinfo); + check_snd("create port", err); + } + + /* create an optional metronome port */ + if (use_metronome) { + snd_seq_port_info_set_port(pinfo, port_count); + snd_seq_port_info_set_name(pinfo, "arecordmidi metronome"); + snd_seq_port_info_set_capability(pinfo, + SND_SEQ_PORT_CAP_READ | + SND_SEQ_PORT_CAP_WRITE); + snd_seq_port_info_set_type(pinfo, SND_SEQ_PORT_TYPE_APPLICATION); + snd_seq_port_info_set_midi_channels(pinfo, 0); + snd_seq_port_info_set_timestamping(pinfo, 0); + err = snd_seq_create_port(seq, pinfo); + check_snd("create metronome port", err); + } +} + +static void connect_ports(void) +{ + int i, err; + + for (i = 0; i < port_count; ++i) { + err = snd_seq_connect_from(seq, i, ports[i].client, ports[i].port); + if (err < 0) + fatal("Cannot connect from port %d:%d - %s", + ports[i].client, ports[i].port, snd_strerror(err)); + } + + /* subscribe the metronome port */ + if (use_metronome) { + err = snd_seq_connect_to(seq, port_count, metronome_port.client, metronome_port.port); + if (err < 0) + fatal("Cannot connect to port %d:%d - %s", + metronome_port.client, metronome_port.port, snd_strerror(err)); + } +} + +/* records a byte to be written to the .mid file */ +static void add_byte(struct smf_track *track, unsigned char byte) +{ + /* make sure we have enough room in the current buffer */ + if (track->cur_buf_size >= BUFFER_SIZE) { + track->cur_buf->next = calloc(1, sizeof(struct buffer)); + if (!track->cur_buf->next) + fatal("out of memory"); + track->cur_buf = track->cur_buf->next; + track->cur_buf_size = 0; + } + + track->cur_buf->buf[track->cur_buf_size++] = byte; + track->size++; +} + +/* record a variable-length quantity */ +static void var_value(struct smf_track *track, int v) +{ + if (v >= (1 << 28)) + add_byte(track, 0x80 | ((v >> 28) & 0x03)); + if (v >= (1 << 21)) + add_byte(track, 0x80 | ((v >> 21) & 0x7f)); + if (v >= (1 << 14)) + add_byte(track, 0x80 | ((v >> 14) & 0x7f)); + if (v >= (1 << 7)) + add_byte(track, 0x80 | ((v >> 7) & 0x7f)); + add_byte(track, v & 0x7f); +} + +/* record the delta time from the last event */ +static void delta_time(struct smf_track *track, const snd_seq_event_t *ev) +{ + int diff = ev->time.tick - track->last_tick; + if (diff < 0) + diff = 0; + var_value(track, diff); + track->last_tick = ev->time.tick; +} + +/* record a status byte (or not if we can use running status) */ +static void command(struct smf_track *track, unsigned char cmd) +{ + if (cmd != track->last_command) + add_byte(track, cmd); + track->last_command = cmd < 0xf0 ? cmd : 0; +} + +/* put port numbers into all tracks */ +static void record_port_numbers(void) +{ + int i; + + for (i = 0; i < num_tracks; ++i) { + var_value(&tracks[i], 0); + add_byte(&tracks[i], 0xff); + add_byte(&tracks[i], 0x21); + var_value(&tracks[i], 1); + if (channel_split) + add_byte(&tracks[i], i / TRACKS_PER_PORT); + else + add_byte(&tracks[i], i); + } +} + +static void record_event(const snd_seq_event_t *ev) +{ + unsigned int i; + struct smf_track *track; + + /* ignore events without proper timestamps */ + if (ev->queue != queue || !snd_seq_ev_is_tick(ev)) + return; + + /* determine which track to record to */ + i = ev->dest.port; + if (i == port_count) { + if (ev->type == SND_SEQ_EVENT_USR0) + metronome_pattern(ev->time.tick); + return; + } + if (channel_split) { + i *= TRACKS_PER_PORT; + if (snd_seq_ev_is_channel_type(ev)) + i += 1 + (ev->data.note.channel & 0xf); + } + if (i >= num_tracks) + return; + track = &tracks[i]; + + switch (ev->type) { + case SND_SEQ_EVENT_NOTEON: + delta_time(track, ev); + command(track, MIDI_CMD_NOTE_ON | (ev->data.note.channel & 0xf)); + add_byte(track, ev->data.note.note & 0x7f); + add_byte(track, ev->data.note.velocity & 0x7f); + break; + case SND_SEQ_EVENT_NOTEOFF: + delta_time(track, ev); + command(track, MIDI_CMD_NOTE_OFF | (ev->data.note.channel & 0xf)); + add_byte(track, ev->data.note.note & 0x7f); + add_byte(track, ev->data.note.velocity & 0x7f); + break; + case SND_SEQ_EVENT_KEYPRESS: + delta_time(track, ev); + command(track, MIDI_CMD_NOTE_PRESSURE | (ev->data.note.channel & 0xf)); + add_byte(track, ev->data.note.note & 0x7f); + add_byte(track, ev->data.note.velocity & 0x7f); + break; + case SND_SEQ_EVENT_CONTROLLER: + delta_time(track, ev); + command(track, MIDI_CMD_CONTROL | (ev->data.control.channel & 0xf)); + add_byte(track, ev->data.control.param & 0x7f); + add_byte(track, ev->data.control.value & 0x7f); + break; + case SND_SEQ_EVENT_PGMCHANGE: + delta_time(track, ev); + command(track, MIDI_CMD_PGM_CHANGE | (ev->data.control.channel & 0xf)); + add_byte(track, ev->data.control.value & 0x7f); + break; + case SND_SEQ_EVENT_CHANPRESS: + delta_time(track, ev); + command(track, MIDI_CMD_CHANNEL_PRESSURE | (ev->data.control.channel & 0xf)); + add_byte(track, ev->data.control.value & 0x7f); + break; + case SND_SEQ_EVENT_PITCHBEND: + delta_time(track, ev); + command(track, MIDI_CMD_BENDER | (ev->data.control.channel & 0xf)); + add_byte(track, (ev->data.control.value + 8192) & 0x7f); + add_byte(track, ((ev->data.control.value + 8192) >> 7) & 0x7f); + break; + case SND_SEQ_EVENT_CONTROL14: + /* create two commands for MSB and LSB */ + delta_time(track, ev); + command(track, MIDI_CMD_CONTROL | (ev->data.control.channel & 0xf)); + add_byte(track, ev->data.control.param & 0x7f); + add_byte(track, (ev->data.control.value >> 7) & 0x7f); + if ((ev->data.control.param & 0x7f) < 0x20) { + delta_time(track, ev); + /* running status */ + add_byte(track, (ev->data.control.param & 0x7f) + 0x20); + add_byte(track, ev->data.control.value & 0x7f); + } + break; + case SND_SEQ_EVENT_NONREGPARAM: + delta_time(track, ev); + command(track, MIDI_CMD_CONTROL | (ev->data.control.channel & 0xf)); + add_byte(track, MIDI_CTL_NONREG_PARM_NUM_LSB); + add_byte(track, ev->data.control.param & 0x7f); + delta_time(track, ev); + add_byte(track, MIDI_CTL_NONREG_PARM_NUM_MSB); + add_byte(track, (ev->data.control.param >> 7) & 0x7f); + delta_time(track, ev); + add_byte(track, MIDI_CTL_MSB_DATA_ENTRY); + add_byte(track, (ev->data.control.value >> 7) & 0x7f); + delta_time(track, ev); + add_byte(track, MIDI_CTL_LSB_DATA_ENTRY); + add_byte(track, ev->data.control.value & 0x7f); + break; + case SND_SEQ_EVENT_REGPARAM: + delta_time(track, ev); + command(track, MIDI_CMD_CONTROL | (ev->data.control.channel & 0xf)); + add_byte(track, MIDI_CTL_REGIST_PARM_NUM_LSB); + add_byte(track, ev->data.control.param & 0x7f); + delta_time(track, ev); + add_byte(track, MIDI_CTL_REGIST_PARM_NUM_MSB); + add_byte(track, (ev->data.control.param >> 7) & 0x7f); + delta_time(track, ev); + add_byte(track, MIDI_CTL_MSB_DATA_ENTRY); + add_byte(track, (ev->data.control.value >> 7) & 0x7f); + delta_time(track, ev); + add_byte(track, MIDI_CTL_LSB_DATA_ENTRY); + add_byte(track, ev->data.control.value & 0x7f); + break; +#if 0 /* ignore */ + case SND_SEQ_EVENT_SONGPOS: + case SND_SEQ_EVENT_SONGSEL: + case SND_SEQ_EVENT_QFRAME: + case SND_SEQ_EVENT_START: + case SND_SEQ_EVENT_CONTINUE: + case SND_SEQ_EVENT_STOP: + case SND_SEQ_EVENT_TUNE_REQUEST: + case SND_SEQ_EVENT_RESET: + case SND_SEQ_EVENT_SENSING: + break; +#endif + case SND_SEQ_EVENT_SYSEX: + if (ev->data.ext.len == 0) + break; + delta_time(track, ev); + if (*(unsigned char*)ev->data.ext.ptr == 0xf0) + command(track, 0xf0), i = 1; + else + command(track, 0xf7), i = 0; + var_value(track, ev->data.ext.len - i); + for (; i < ev->data.ext.len; ++i) + add_byte(track, ((unsigned char*)ev->data.ext.ptr)[i]); + break; + default: + return; + } + track->used = 1; +} + +static void finish_tracks(void) +{ + snd_seq_queue_status_t *queue_status; + int tick, i, err; + + snd_seq_queue_status_alloca(&queue_status); + + err = snd_seq_get_queue_status(seq, queue, queue_status); + check_snd("get queue status", err); + tick = snd_seq_queue_status_get_tick_time(queue_status); + + /* make length of first track the recording length */ + var_value(&tracks[0], tick - tracks[0].last_tick); + add_byte(&tracks[0], 0xff); + add_byte(&tracks[0], 0x2f); + var_value(&tracks[0], 0); + + /* finish other tracks */ + for (i = 1; i < num_tracks; ++i) { + var_value(&tracks[i], 0); + add_byte(&tracks[i], 0xff); + add_byte(&tracks[i], 0x2f); + var_value(&tracks[i], 0); + } +} + +static void write_file(void) +{ + int used_tracks, time_division, i; + struct buffer *buf; + + used_tracks = 0; + for (i = 0; i < num_tracks; ++i) + used_tracks += !!tracks[i].used; + + /* header id and length */ + fwrite("MThd\0\0\0\6", 1, 8, file); + /* type 0 or 1 */ + fputc(0, file); + fputc(used_tracks > 1 ? 1 : 0, file); + /* number of tracks */ + fputc((used_tracks >> 8) & 0xff, file); + fputc(used_tracks & 0xff, file); + /* time division */ + time_division = ticks; + if (smpte_timing) + time_division |= (0x100 - frames) << 8; + fputc(time_division >> 8, file); + fputc(time_division & 0xff, file); + + for (i = 0; i < num_tracks; ++i) { + if (!tracks[i].used) + continue; + /* track id */ + fwrite("MTrk", 1, 4, file); + /* data length */ + fputc((tracks[i].size >> 24) & 0xff, file); + fputc((tracks[i].size >> 16) & 0xff, file); + fputc((tracks[i].size >> 8) & 0xff, file); + fputc(tracks[i].size & 0xff, file); + /* track contents */ + for (buf = &tracks[i].first_buf; buf; buf = buf->next) + fwrite(buf->buf, 1, buf == tracks[i].cur_buf + ? tracks[i].cur_buf_size : BUFFER_SIZE, file); + } +} + +static void list_ports(void) +{ + snd_seq_client_info_t *cinfo; + snd_seq_port_info_t *pinfo; + + snd_seq_client_info_alloca(&cinfo); + snd_seq_port_info_alloca(&pinfo); + + puts(" Port Client name Port name"); + + snd_seq_client_info_set_client(cinfo, -1); + while (snd_seq_query_next_client(seq, cinfo) >= 0) { + int client = snd_seq_client_info_get_client(cinfo); + + if (client == SND_SEQ_CLIENT_SYSTEM) + continue; /* don't show system timer and announce ports */ + snd_seq_port_info_set_client(pinfo, client); + snd_seq_port_info_set_port(pinfo, -1); + while (snd_seq_query_next_port(seq, pinfo) >= 0) { + /* port must understand MIDI messages */ + if (!(snd_seq_port_info_get_type(pinfo) + & SND_SEQ_PORT_TYPE_MIDI_GENERIC)) + continue; + /* we need both READ and SUBS_READ */ + if ((snd_seq_port_info_get_capability(pinfo) + & (SND_SEQ_PORT_CAP_READ | SND_SEQ_PORT_CAP_SUBS_READ)) + != (SND_SEQ_PORT_CAP_READ | SND_SEQ_PORT_CAP_SUBS_READ)) + continue; + printf("%3d:%-3d %-32.32s %s\n", + snd_seq_port_info_get_client(pinfo), + snd_seq_port_info_get_port(pinfo), + snd_seq_client_info_get_name(cinfo), + snd_seq_port_info_get_name(pinfo)); + } + } +} + +static void help(const char *argv0) +{ + fprintf(stderr, "Usage: %s [options] outputfile\n" + "\nAvailable options:\n" + " -h,--help this help\n" + " -V,--version show version\n" + " -l,--list list input ports\n" + " -p,--port=client:port,... source port(s)\n" + " -b,--bpm=beats tempo in beats per minute\n" + " -f,--fps=frames resolution in frames per second (SMPTE)\n" + " -t,--ticks=ticks resolution in ticks per beat or frame\n" + " -s,--split-channels create a track for each channel\n" + " -m,--metronome=client:port play a metronome signal\n" + " -i,--timesig=nn:dd time signature\n" + " -n,--num-events=events fixed number of events to record, then exit\n", + argv0); +} + +static void version(void) +{ + fputs("arecordmidi version " SND_UTIL_VERSION_STR "\n", stderr); +} + +static void sighandler(int sig) +{ + stop = 1; +} + +int main(int argc, char *argv[]) +{ + static const char short_options[] = "hVlp:b:f:t:sdm:i:n:"; + static const struct option long_options[] = { + {"help", 0, NULL, 'h'}, + {"version", 0, NULL, 'V'}, + {"list", 0, NULL, 'l'}, + {"port", 1, NULL, 'p'}, + {"bpm", 1, NULL, 'b'}, + {"fps", 1, NULL, 'f'}, + {"ticks", 1, NULL, 't'}, + {"split-channels", 0, NULL, 's'}, + {"dump", 0, NULL, 'd'}, + {"metronome", 1, NULL, 'm'}, + {"timesig", 1, NULL, 'i'}, + {"num-events", 1, NULL, 'n'}, + {0} + }; + + char *filename = NULL; + int do_list = 0; + struct pollfd *pfds; + int npfds; + int c, err; + /* If |num_events| isn't specified, leave it at 0. */ + long num_events = 0; + long events_received = 0; + + init_seq(); + + while ((c = getopt_long(argc, argv, short_options, + long_options, NULL)) != -1) { + switch (c) { + case 'h': + help(argv[0]); + return 0; + case 'V': + version(); + return 0; + case 'l': + do_list = 1; + break; + case 'p': + parse_ports(optarg); + break; + case 'b': + beats = atoi(optarg); + if (beats < 4 || beats > 6000) + fatal("Invalid tempo"); + smpte_timing = 0; + break; + case 'f': + frames = atoi(optarg); + if (frames != 24 && frames != 25 && + frames != 29 && frames != 30) + fatal("Invalid number of frames/s"); + smpte_timing = 1; + break; + case 't': + ticks = atoi(optarg); + if (ticks < 1 || ticks > 0x7fff) + fatal("Invalid number of ticks"); + break; + case 's': + channel_split = 1; + break; + case 'd': + fputs("The --dump option isn't supported anymore, use aseqdump instead.\n", stderr); + break; + case 'm': + init_metronome(optarg); + break; + case 'i': + time_signature(optarg); + break; + case 'n': + err = 0; + num_events = arg_parse_decimal_num(optarg, &err); + if (err != 0) { + fatal("Couldn't parse num_events argument: %s\n", + strerror(-err)); + } + if (num_events <= 0) + fatal("num_events must be greater than 0"); + break; + default: + help(argv[0]); + return 1; + } + } + + if (do_list) { + list_ports(); + return 0; + } + + if (port_count < 1) { + fputs("Pleast specify a source port with --port.\n", stderr); + return 1; + } + + if (!ticks) + ticks = smpte_timing ? 40 : 384; + if (smpte_timing && ticks > 0xff) + ticks = 0xff; + + if (optind >= argc) { + fputs("Please specify a file to record to.\n", stderr); + return 1; + } + filename = argv[optind]; + + init_tracks(); + create_queue(); + create_ports(); + connect_ports(); + if (port_count > 1) + record_port_numbers(); + + /* record tempo */ + if (!smpte_timing) { + int usecs_per_quarter = 60000000 / beats; + var_value(&tracks[0], 0); /* delta time */ + add_byte(&tracks[0], 0xff); + add_byte(&tracks[0], 0x51); + var_value(&tracks[0], 3); + add_byte(&tracks[0], usecs_per_quarter >> 16); + add_byte(&tracks[0], usecs_per_quarter >> 8); + add_byte(&tracks[0], usecs_per_quarter); + + /* time signature */ + var_value(&tracks[0], 0); /* delta time */ + add_byte(&tracks[0], 0xff); + add_byte(&tracks[0], 0x58); + var_value(&tracks[0], 4); + add_byte(&tracks[0], ts_num); + add_byte(&tracks[0], ts_dd); + add_byte(&tracks[0], 24); /* MIDI clocks per metronome click */ + add_byte(&tracks[0], 8); /* notated 32nd-notes per MIDI quarter note */ + } + + /* always write at least one track */ + tracks[0].used = 1; + + file = fopen(filename, "wb"); + if (!file) + fatal("Cannot open %s - %s", filename, strerror(errno)); + + err = snd_seq_start_queue(seq, queue, NULL); + check_snd("start queue", err); + snd_seq_drain_output(seq); + + err = snd_seq_nonblock(seq, 1); + check_snd("set nonblock mode", err); + + if (use_metronome) { + metronome_set_program(); + metronome_pattern(0); + } + + signal(SIGINT, sighandler); + signal(SIGTERM, sighandler); + + npfds = snd_seq_poll_descriptors_count(seq, POLLIN); + pfds = alloca(sizeof(*pfds) * npfds); + for (;;) { + snd_seq_poll_descriptors(seq, pfds, npfds, POLLIN); + if (poll(pfds, npfds, -1) < 0) + break; + do { + snd_seq_event_t *event; + err = snd_seq_event_input(seq, &event); + if (err < 0) + break; + if (event) { + record_event(event); + events_received++; + } + } while (err > 0); + if (stop) + break; + if (num_events && (events_received == num_events)) + break; + } + + if (num_events && events_received < num_events) + fputs("Warning: Received signal before num_events\n", stdout); + + finish_tracks(); + write_file(); + + fclose(file); + snd_seq_close(seq); + return 0; +} diff --git a/seq/aseqdump/Makefile.am b/seq/aseqdump/Makefile.am new file mode 100644 index 0000000..4837ad9 --- /dev/null +++ b/seq/aseqdump/Makefile.am @@ -0,0 +1,5 @@ +AM_CPPFLAGS = -I$(top_srcdir)/include +EXTRA_DIST = aseqdump.1 + +bin_PROGRAMS = aseqdump +man_MANS = aseqdump.1 diff --git a/seq/aseqdump/Makefile.in b/seq/aseqdump/Makefile.in new file mode 100644 index 0000000..c4f146a --- /dev/null +++ b/seq/aseqdump/Makefile.in @@ -0,0 +1,717 @@ +# Makefile.in generated by automake 1.16.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994-2018 Free Software Foundation, Inc. + +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +VPATH = @srcdir@ +am__is_gnu_make = { \ + if test -z '$(MAKELEVEL)'; then \ + false; \ + elif test -n '$(MAKE_HOST)'; then \ + true; \ + elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ + true; \ + else \ + false; \ + fi; \ +} +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + esac; \ + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +bin_PROGRAMS = aseqdump$(EXEEXT) +subdir = seq/aseqdump +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/gettext.m4 \ + $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/lib-ld.m4 \ + $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ + $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \ + $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/acinclude.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/include/aconfig.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +am__installdirs = "$(DESTDIR)$(bindir)" "$(DESTDIR)$(man1dir)" +PROGRAMS = $(bin_PROGRAMS) +aseqdump_SOURCES = aseqdump.c +aseqdump_OBJECTS = aseqdump.$(OBJEXT) +aseqdump_LDADD = $(LDADD) +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__maybe_remake_depfiles = depfiles +am__depfiles_remade = ./$(DEPDIR)/aseqdump.Po +am__mv = mv -f +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +AM_V_CC = $(am__v_CC_@AM_V@) +am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) +am__v_CC_0 = @echo " CC " $@; +am__v_CC_1 = +CCLD = $(CC) +LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_CCLD = $(am__v_CCLD_@AM_V@) +am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) +am__v_CCLD_0 = @echo " CCLD " $@; +am__v_CCLD_1 = +SOURCES = aseqdump.c +DIST_SOURCES = aseqdump.c +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; +am__vpath_adj = case $$p in \ + $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ + *) f=$$p;; \ + esac; +am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; +am__install_max = 40 +am__nobase_strip_setup = \ + srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` +am__nobase_strip = \ + for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" +am__nobase_list = $(am__nobase_strip_setup); \ + for p in $$list; do echo "$$p $$p"; done | \ + sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ + $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ + if (++n[$$2] == $(am__install_max)) \ + { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ + END { for (dir in files) print dir, files[dir] }' +am__base_list = \ + sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ + sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' +am__uninstall_files_from_dir = { \ + test -z "$$files" \ + || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ + || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ + $(am__cd) "$$dir" && rm -f $$files; }; \ + } +man1dir = $(mandir)/man1 +NROFF = nroff +MANS = $(man_MANS) +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) +# Read a list of newline-separated strings from the standard input, +# and print each of them once, without duplicates. Input order is +# *not* preserved. +am__uniquify_input = $(AWK) '\ + BEGIN { nonempty = 0; } \ + { items[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in items) print i; }; } \ +' +# Make sure the list of sources is unique. This is necessary because, +# e.g., the same source file might be shared among _SOURCES variables +# for different programs/libraries. +am__define_uniq_tagged_files = \ + list='$(am__tagged_files)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | $(am__uniquify_input)` +ETAGS = etags +CTAGS = ctags +am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/depcomp +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +ALSACTL_DAEMONSWITCH = @ALSACTL_DAEMONSWITCH@ +ALSACTL_PIDFILE_DIR = @ALSACTL_PIDFILE_DIR@ +ALSA_CFLAGS = @ALSA_CFLAGS@ +ALSA_LIBS = @ALSA_LIBS@ +ALSA_TOPOLOGY_LIBS = @ALSA_TOPOLOGY_LIBS@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +ASOUND_LOCK_DIR = @ASOUND_LOCK_DIR@ +ASOUND_STATE_DIR = @ASOUND_STATE_DIR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CURSESINC = @CURSESINC@ +CURSESLIB = @CURSESLIB@ +CURSES_CFLAGS = @CURSES_CFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +FFTW_CFLAGS = @FFTW_CFLAGS@ +FFTW_INC = @FFTW_INC@ +FFTW_LIB = @FFTW_LIB@ +GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ +GMSGFMT = @GMSGFMT@ +GMSGFMT_015 = @GMSGFMT_015@ +GREP = @GREP@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +INTLLIBS = @INTLLIBS@ +INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@ +LDFLAGS = @LDFLAGS@ +LIBICONV = @LIBICONV@ +LIBINTL = @LIBINTL@ +LIBOBJS = @LIBOBJS@ +LIBRT = @LIBRT@ +LIBS = @LIBS@ +LN_S = @LN_S@ +LTLIBICONV = @LTLIBICONV@ +LTLIBINTL = @LTLIBINTL@ +LTLIBOBJS = @LTLIBOBJS@ +MAINT = @MAINT@ +MAKEINFO = @MAKEINFO@ +MKDIR_P = @MKDIR_P@ +MSGFMT = @MSGFMT@ +MSGFMT_015 = @MSGFMT_015@ +MSGMERGE = @MSGMERGE@ +NCURSESW_CFLAGS = @NCURSESW_CFLAGS@ +NCURSESW_LIBS = @NCURSESW_LIBS@ +NCURSES_CFLAGS = @NCURSES_CFLAGS@ +NCURSES_LIBS = @NCURSES_LIBS@ +OBJEXT = @OBJEXT@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ +POSUB = @POSUB@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +SND_UTIL_MAJOR = @SND_UTIL_MAJOR@ +SND_UTIL_MINOR = @SND_UTIL_MINOR@ +SND_UTIL_SUBMINOR = @SND_UTIL_SUBMINOR@ +SND_UTIL_VERSION = @SND_UTIL_VERSION@ +STRIP = @STRIP@ +SYSTEMD_CFLAGS = @SYSTEMD_CFLAGS@ +SYSTEMD_LIBS = @SYSTEMD_LIBS@ +TESTSOUND = @TESTSOUND@ +USE_NLS = @USE_NLS@ +VERSION = @VERSION@ +XGETTEXT = @XGETTEXT@ +XGETTEXT_015 = @XGETTEXT_015@ +XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_CC = @ac_ct_CC@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +mydatadir = @mydatadir@ +ncurses5_config = @ncurses5_config@ +ncursesw5_config = @ncursesw5_config@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +rst2man_available = @rst2man_available@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +systemdsystemunitdir = @systemdsystemunitdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +udevrulesdir = @udevrulesdir@ +xmlto_available = @xmlto_available@ +AM_CPPFLAGS = -I$(top_srcdir)/include +EXTRA_DIST = aseqdump.1 +man_MANS = aseqdump.1 +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .o .obj +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign seq/aseqdump/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --foreign seq/aseqdump/Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): +install-binPROGRAMS: $(bin_PROGRAMS) + @$(NORMAL_INSTALL) + @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(bindir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(bindir)" || exit 1; \ + fi; \ + for p in $$list; do echo "$$p $$p"; done | \ + sed 's/$(EXEEXT)$$//' | \ + while read p p1; do if test -f $$p \ + ; then echo "$$p"; echo "$$p"; else :; fi; \ + done | \ + sed -e 'p;s,.*/,,;n;h' \ + -e 's|.*|.|' \ + -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \ + sed 'N;N;N;s,\n, ,g' | \ + $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \ + { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \ + if ($$2 == $$4) files[d] = files[d] " " $$1; \ + else { print "f", $$3 "/" $$4, $$1; } } \ + END { for (d in files) print "f", d, files[d] }' | \ + while read type dir files; do \ + if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \ + test -z "$$files" || { \ + echo " $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(bindir)$$dir'"; \ + $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \ + } \ + ; done + +uninstall-binPROGRAMS: + @$(NORMAL_UNINSTALL) + @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ + files=`for p in $$list; do echo "$$p"; done | \ + sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \ + -e 's/$$/$(EXEEXT)/' \ + `; \ + test -n "$$list" || exit 0; \ + echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \ + cd "$(DESTDIR)$(bindir)" && rm -f $$files + +clean-binPROGRAMS: + -test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS) + +aseqdump$(EXEEXT): $(aseqdump_OBJECTS) $(aseqdump_DEPENDENCIES) $(EXTRA_aseqdump_DEPENDENCIES) + @rm -f aseqdump$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(aseqdump_OBJECTS) $(aseqdump_LDADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/aseqdump.Po@am__quote@ # am--include-marker + +$(am__depfiles_remade): + @$(MKDIR_P) $(@D) + @echo '# dummy' >$@-t && $(am__mv) $@-t $@ + +am--depfiles: $(am__depfiles_remade) + +.c.o: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< + +.c.obj: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` +install-man1: $(man_MANS) + @$(NORMAL_INSTALL) + @list1=''; \ + list2='$(man_MANS)'; \ + test -n "$(man1dir)" \ + && test -n "`echo $$list1$$list2`" \ + || exit 0; \ + echo " $(MKDIR_P) '$(DESTDIR)$(man1dir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(man1dir)" || exit 1; \ + { for i in $$list1; do echo "$$i"; done; \ + if test -n "$$list2"; then \ + for i in $$list2; do echo "$$i"; done \ + | sed -n '/\.1[a-z]*$$/p'; \ + fi; \ + } | while read p; do \ + if test -f $$p; then d=; else d="$(srcdir)/"; fi; \ + echo "$$d$$p"; echo "$$p"; \ + done | \ + sed -e 'n;s,.*/,,;p;h;s,.*\.,,;s,^[^1][0-9a-z]*$$,1,;x' \ + -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,' | \ + sed 'N;N;s,\n, ,g' | { \ + list=; while read file base inst; do \ + if test "$$base" = "$$inst"; then list="$$list $$file"; else \ + echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man1dir)/$$inst'"; \ + $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man1dir)/$$inst" || exit $$?; \ + fi; \ + done; \ + for i in $$list; do echo "$$i"; done | $(am__base_list) | \ + while read files; do \ + test -z "$$files" || { \ + echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(man1dir)'"; \ + $(INSTALL_DATA) $$files "$(DESTDIR)$(man1dir)" || exit $$?; }; \ + done; } + +uninstall-man1: + @$(NORMAL_UNINSTALL) + @list=''; test -n "$(man1dir)" || exit 0; \ + files=`{ for i in $$list; do echo "$$i"; done; \ + l2='$(man_MANS)'; for i in $$l2; do echo "$$i"; done | \ + sed -n '/\.1[a-z]*$$/p'; \ + } | sed -e 's,.*/,,;h;s,.*\.,,;s,^[^1][0-9a-z]*$$,1,;x' \ + -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,'`; \ + dir='$(DESTDIR)$(man1dir)'; $(am__uninstall_files_from_dir) + +ID: $(am__tagged_files) + $(am__define_uniq_tagged_files); mkid -fID $$unique +tags: tags-am +TAGS: tags + +tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + set x; \ + here=`pwd`; \ + $(am__define_uniq_tagged_files); \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: ctags-am + +CTAGS: ctags +ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + $(am__define_uniq_tagged_files); \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" +cscopelist: cscopelist-am + +cscopelist-am: $(am__tagged_files) + list='$(am__tagged_files)'; \ + case "$(srcdir)" in \ + [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ + *) sdir=$(subdir)/$(srcdir) ;; \ + esac; \ + for i in $$list; do \ + if test -f "$$i"; then \ + echo "$(subdir)/$$i"; \ + else \ + echo "$$sdir/$$i"; \ + fi; \ + done >> $(top_builddir)/cscope.files + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) distdir-am + +distdir-am: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(PROGRAMS) $(MANS) +installdirs: + for dir in "$(DESTDIR)$(bindir)" "$(DESTDIR)$(man1dir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ + done +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-binPROGRAMS clean-generic mostlyclean-am + +distclean: distclean-am + -rm -f ./$(DEPDIR)/aseqdump.Po + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: install-man + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: install-binPROGRAMS + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: install-man1 + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -f ./$(DEPDIR)/aseqdump.Po + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-binPROGRAMS uninstall-man + +uninstall-man: uninstall-man1 + +.MAKE: install-am install-strip + +.PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-am clean \ + clean-binPROGRAMS clean-generic cscopelist-am ctags ctags-am \ + distclean distclean-compile distclean-generic distclean-tags \ + distdir dvi dvi-am html html-am info info-am install \ + install-am install-binPROGRAMS install-data install-data-am \ + install-dvi install-dvi-am install-exec install-exec-am \ + install-html install-html-am install-info install-info-am \ + install-man install-man1 install-pdf install-pdf-am install-ps \ + install-ps-am install-strip installcheck installcheck-am \ + installdirs maintainer-clean maintainer-clean-generic \ + mostlyclean mostlyclean-compile mostlyclean-generic pdf pdf-am \ + ps ps-am tags tags-am uninstall uninstall-am \ + uninstall-binPROGRAMS uninstall-man uninstall-man1 + +.PRECIOUS: Makefile + + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/seq/aseqdump/aseqdump.1 b/seq/aseqdump/aseqdump.1 new file mode 100644 index 0000000..f6f2aa9 --- /dev/null +++ b/seq/aseqdump/aseqdump.1 @@ -0,0 +1,39 @@ +.TH ASEQDUMP 1 "19 Feb 2005" + +.SH NAME +aseqdump \- show the events received at an ALSA sequencer port + +.SH SYNOPSIS +.B aseqdump +[\fI\-p client:port,...\fP] + +.SH DESCRIPTION +.B aseqdump +is a command-line utility that prints the sequencer events it receives as text. + +To stop receiving, press Ctrl+C. + +.SH OPTIONS + +.TP +.I \-h,\-\-help +Prints a list of options. + +.TP +.I \-V,\-\-version +Prints the current version. + +.TP +.I \-l,\-\-list +Prints a list of possible input ports. + +.TP +.I \-p,\-\-port=client:port,... +Sets the sequencer port(s) from which events are received. + +A client can be specified by its number, its name, or a prefix of its +name. A port is specified by its number; for port 0 of a client, the +":0" part of the port specification can be omitted. + +.SH AUTHOR +Clemens Ladisch diff --git a/seq/aseqdump/aseqdump.c b/seq/aseqdump/aseqdump.c new file mode 100644 index 0000000..44ae3bb --- /dev/null +++ b/seq/aseqdump/aseqdump.c @@ -0,0 +1,438 @@ +/* + * aseqdump.c - show the events received at an ALSA sequencer port + * + * Copyright (c) 2005 Clemens Ladisch + * + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include "aconfig.h" +#include "version.h" + +static snd_seq_t *seq; +static int port_count; +static snd_seq_addr_t *ports; +static volatile sig_atomic_t stop = 0; + + +/* prints an error message to stderr, and dies */ +static void fatal(const char *msg, ...) +{ + va_list ap; + + va_start(ap, msg); + vfprintf(stderr, msg, ap); + va_end(ap); + fputc('\n', stderr); + exit(EXIT_FAILURE); +} + +/* memory allocation error handling */ +static void check_mem(void *p) +{ + if (!p) + fatal("Out of memory"); +} + +/* error handling for ALSA functions */ +static void check_snd(const char *operation, int err) +{ + if (err < 0) + fatal("Cannot %s - %s", operation, snd_strerror(err)); +} + +static void init_seq(void) +{ + int err; + + /* open sequencer */ + err = snd_seq_open(&seq, "default", SND_SEQ_OPEN_DUPLEX, 0); + check_snd("open sequencer", err); + + /* set our client's name */ + err = snd_seq_set_client_name(seq, "aseqdump"); + check_snd("set client name", err); +} + +/* parses one or more port addresses from the string */ +static void parse_ports(const char *arg) +{ + char *buf, *s, *port_name; + int err; + + /* make a copy of the string because we're going to modify it */ + buf = strdup(arg); + check_mem(buf); + + for (port_name = s = buf; s; port_name = s + 1) { + /* Assume that ports are separated by commas. We don't use + * spaces because those are valid in client names. */ + s = strchr(port_name, ','); + if (s) + *s = '\0'; + + ++port_count; + ports = realloc(ports, port_count * sizeof(snd_seq_addr_t)); + check_mem(ports); + + err = snd_seq_parse_address(seq, &ports[port_count - 1], port_name); + if (err < 0) + fatal("Invalid port %s - %s", port_name, snd_strerror(err)); + } + + free(buf); +} + +static void create_port(void) +{ + int err; + + err = snd_seq_create_simple_port(seq, "aseqdump", + SND_SEQ_PORT_CAP_WRITE | + SND_SEQ_PORT_CAP_SUBS_WRITE, + SND_SEQ_PORT_TYPE_MIDI_GENERIC | + SND_SEQ_PORT_TYPE_APPLICATION); + check_snd("create port", err); +} + +static void connect_ports(void) +{ + int i, err; + + for (i = 0; i < port_count; ++i) { + err = snd_seq_connect_from(seq, 0, ports[i].client, ports[i].port); + if (err < 0) + fatal("Cannot connect from port %d:%d - %s", + ports[i].client, ports[i].port, snd_strerror(err)); + } +} + +static void dump_event(const snd_seq_event_t *ev) +{ + printf("%3d:%-3d ", ev->source.client, ev->source.port); + switch (ev->type) { + case SND_SEQ_EVENT_NOTEON: + if (ev->data.note.velocity) + printf("Note on %2d, note %d, velocity %d\n", + ev->data.note.channel, ev->data.note.note, ev->data.note.velocity); + else + printf("Note off %2d, note %d\n", + ev->data.note.channel, ev->data.note.note); + break; + case SND_SEQ_EVENT_NOTEOFF: + printf("Note off %2d, note %d, velocity %d\n", + ev->data.note.channel, ev->data.note.note, ev->data.note.velocity); + break; + case SND_SEQ_EVENT_KEYPRESS: + printf("Polyphonic aftertouch %2d, note %d, value %d\n", + ev->data.note.channel, ev->data.note.note, ev->data.note.velocity); + break; + case SND_SEQ_EVENT_CONTROLLER: + printf("Control change %2d, controller %d, value %d\n", + ev->data.control.channel, ev->data.control.param, ev->data.control.value); + break; + case SND_SEQ_EVENT_PGMCHANGE: + printf("Program change %2d, program %d\n", + ev->data.control.channel, ev->data.control.value); + break; + case SND_SEQ_EVENT_CHANPRESS: + printf("Channel aftertouch %2d, value %d\n", + ev->data.control.channel, ev->data.control.value); + break; + case SND_SEQ_EVENT_PITCHBEND: + printf("Pitch bend %2d, value %d\n", + ev->data.control.channel, ev->data.control.value); + break; + case SND_SEQ_EVENT_CONTROL14: + printf("Control change %2d, controller %d, value %5d\n", + ev->data.control.channel, ev->data.control.param, ev->data.control.value); + break; + case SND_SEQ_EVENT_NONREGPARAM: + printf("Non-reg. parameter %2d, parameter %d, value %d\n", + ev->data.control.channel, ev->data.control.param, ev->data.control.value); + break; + case SND_SEQ_EVENT_REGPARAM: + printf("Reg. parameter %2d, parameter %d, value %d\n", + ev->data.control.channel, ev->data.control.param, ev->data.control.value); + break; + case SND_SEQ_EVENT_SONGPOS: + printf("Song position pointer value %d\n", + ev->data.control.value); + break; + case SND_SEQ_EVENT_SONGSEL: + printf("Song select value %d\n", + ev->data.control.value); + break; + case SND_SEQ_EVENT_QFRAME: + printf("MTC quarter frame %02xh\n", + ev->data.control.value); + break; + case SND_SEQ_EVENT_TIMESIGN: + // XXX how is this encoded? + printf("SMF time signature (%#010x)\n", + ev->data.control.value); + break; + case SND_SEQ_EVENT_KEYSIGN: + // XXX how is this encoded? + printf("SMF key signature (%#010x)\n", + ev->data.control.value); + break; + case SND_SEQ_EVENT_START: + if (ev->source.client == SND_SEQ_CLIENT_SYSTEM && + ev->source.port == SND_SEQ_PORT_SYSTEM_TIMER) + printf("Queue start queue %d\n", + ev->data.queue.queue); + else + printf("Start\n"); + break; + case SND_SEQ_EVENT_CONTINUE: + if (ev->source.client == SND_SEQ_CLIENT_SYSTEM && + ev->source.port == SND_SEQ_PORT_SYSTEM_TIMER) + printf("Queue continue queue %d\n", + ev->data.queue.queue); + else + printf("Continue\n"); + break; + case SND_SEQ_EVENT_STOP: + if (ev->source.client == SND_SEQ_CLIENT_SYSTEM && + ev->source.port == SND_SEQ_PORT_SYSTEM_TIMER) + printf("Queue stop queue %d\n", + ev->data.queue.queue); + else + printf("Stop\n"); + break; + case SND_SEQ_EVENT_SETPOS_TICK: + printf("Set tick queue pos. queue %d\n", ev->data.queue.queue); + break; + case SND_SEQ_EVENT_SETPOS_TIME: + printf("Set rt queue pos. queue %d\n", ev->data.queue.queue); + break; + case SND_SEQ_EVENT_TEMPO: + printf("Set queue tempo queue %d\n", ev->data.queue.queue); + break; + case SND_SEQ_EVENT_CLOCK: + printf("Clock\n"); + break; + case SND_SEQ_EVENT_TICK: + printf("Tick\n"); + break; + case SND_SEQ_EVENT_QUEUE_SKEW: + printf("Queue timer skew queue %d\n", ev->data.queue.queue); + break; + case SND_SEQ_EVENT_TUNE_REQUEST: + printf("Tune request\n"); + break; + case SND_SEQ_EVENT_RESET: + printf("Reset\n"); + break; + case SND_SEQ_EVENT_SENSING: + printf("Active Sensing\n"); + break; + case SND_SEQ_EVENT_CLIENT_START: + printf("Client start client %d\n", + ev->data.addr.client); + break; + case SND_SEQ_EVENT_CLIENT_EXIT: + printf("Client exit client %d\n", + ev->data.addr.client); + break; + case SND_SEQ_EVENT_CLIENT_CHANGE: + printf("Client changed client %d\n", + ev->data.addr.client); + break; + case SND_SEQ_EVENT_PORT_START: + printf("Port start %d:%d\n", + ev->data.addr.client, ev->data.addr.port); + break; + case SND_SEQ_EVENT_PORT_EXIT: + printf("Port exit %d:%d\n", + ev->data.addr.client, ev->data.addr.port); + break; + case SND_SEQ_EVENT_PORT_CHANGE: + printf("Port changed %d:%d\n", + ev->data.addr.client, ev->data.addr.port); + break; + case SND_SEQ_EVENT_PORT_SUBSCRIBED: + printf("Port subscribed %d:%d -> %d:%d\n", + ev->data.connect.sender.client, ev->data.connect.sender.port, + ev->data.connect.dest.client, ev->data.connect.dest.port); + break; + case SND_SEQ_EVENT_PORT_UNSUBSCRIBED: + printf("Port unsubscribed %d:%d -> %d:%d\n", + ev->data.connect.sender.client, ev->data.connect.sender.port, + ev->data.connect.dest.client, ev->data.connect.dest.port); + break; + case SND_SEQ_EVENT_SYSEX: + { + unsigned int i; + printf("System exclusive "); + for (i = 0; i < ev->data.ext.len; ++i) + printf(" %02X", ((unsigned char*)ev->data.ext.ptr)[i]); + printf("\n"); + } + break; + default: + printf("Event type %d\n", ev->type); + } +} + +static void list_ports(void) +{ + snd_seq_client_info_t *cinfo; + snd_seq_port_info_t *pinfo; + + snd_seq_client_info_alloca(&cinfo); + snd_seq_port_info_alloca(&pinfo); + + puts(" Port Client name Port name"); + + snd_seq_client_info_set_client(cinfo, -1); + while (snd_seq_query_next_client(seq, cinfo) >= 0) { + int client = snd_seq_client_info_get_client(cinfo); + + snd_seq_port_info_set_client(pinfo, client); + snd_seq_port_info_set_port(pinfo, -1); + while (snd_seq_query_next_port(seq, pinfo) >= 0) { + /* we need both READ and SUBS_READ */ + if ((snd_seq_port_info_get_capability(pinfo) + & (SND_SEQ_PORT_CAP_READ | SND_SEQ_PORT_CAP_SUBS_READ)) + != (SND_SEQ_PORT_CAP_READ | SND_SEQ_PORT_CAP_SUBS_READ)) + continue; + printf("%3d:%-3d %-32.32s %s\n", + snd_seq_port_info_get_client(pinfo), + snd_seq_port_info_get_port(pinfo), + snd_seq_client_info_get_name(cinfo), + snd_seq_port_info_get_name(pinfo)); + } + } +} + +static void help(const char *argv0) +{ + printf("Usage: %s [options]\n" + "\nAvailable options:\n" + " -h,--help this help\n" + " -V,--version show version\n" + " -l,--list list input ports\n" + " -p,--port=client:port,... source port(s)\n", + argv0); +} + +static void version(void) +{ + puts("aseqdump version " SND_UTIL_VERSION_STR); +} + +static void sighandler(int sig) +{ + stop = 1; +} + +int main(int argc, char *argv[]) +{ + static const char short_options[] = "hVlp:"; + static const struct option long_options[] = { + {"help", 0, NULL, 'h'}, + {"version", 0, NULL, 'V'}, + {"list", 0, NULL, 'l'}, + {"port", 1, NULL, 'p'}, + {0} + }; + + int do_list = 0; + struct pollfd *pfds; + int npfds; + int c, err; + + init_seq(); + + while ((c = getopt_long(argc, argv, short_options, + long_options, NULL)) != -1) { + switch (c) { + case 'h': + help(argv[0]); + return 0; + case 'V': + version(); + return 0; + case 'l': + do_list = 1; + break; + case 'p': + parse_ports(optarg); + break; + default: + help(argv[0]); + return 1; + } + } + if (optind < argc) { + help(argv[0]); + return 1; + } + + if (do_list) { + list_ports(); + return 0; + } + + create_port(); + connect_ports(); + + err = snd_seq_nonblock(seq, 1); + check_snd("set nonblock mode", err); + + if (port_count > 0) + printf("Waiting for data."); + else + printf("Waiting for data at port %d:0.", + snd_seq_client_id(seq)); + printf(" Press Ctrl+C to end.\n"); + printf("Source Event Ch Data\n"); + + signal(SIGINT, sighandler); + signal(SIGTERM, sighandler); + + npfds = snd_seq_poll_descriptors_count(seq, POLLIN); + pfds = alloca(sizeof(*pfds) * npfds); + for (;;) { + snd_seq_poll_descriptors(seq, pfds, npfds, POLLIN); + if (poll(pfds, npfds, -1) < 0) + break; + do { + snd_seq_event_t *event; + err = snd_seq_event_input(seq, &event); + if (err < 0) + break; + if (event) + dump_event(event); + } while (err > 0); + fflush(stdout); + if (stop) + break; + } + + snd_seq_close(seq); + return 0; +} diff --git a/seq/aseqnet/Makefile.am b/seq/aseqnet/Makefile.am new file mode 100644 index 0000000..852d1e9 --- /dev/null +++ b/seq/aseqnet/Makefile.am @@ -0,0 +1,7 @@ +AM_CPPFLAGS = -I$(top_srcdir)/include +EXTRA_DIST = README.aseqnet aseqnet.1 + +bin_PROGRAMS = aseqnet +aseqnet_SOURCES = aseqnet.c +aseqnet_LDADD = $(INTLLIBS) +man_MANS = aseqnet.1 diff --git a/seq/aseqnet/Makefile.in b/seq/aseqnet/Makefile.in new file mode 100644 index 0000000..ff24e45 --- /dev/null +++ b/seq/aseqnet/Makefile.in @@ -0,0 +1,720 @@ +# Makefile.in generated by automake 1.16.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994-2018 Free Software Foundation, Inc. + +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +VPATH = @srcdir@ +am__is_gnu_make = { \ + if test -z '$(MAKELEVEL)'; then \ + false; \ + elif test -n '$(MAKE_HOST)'; then \ + true; \ + elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ + true; \ + else \ + false; \ + fi; \ +} +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + esac; \ + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +bin_PROGRAMS = aseqnet$(EXEEXT) +subdir = seq/aseqnet +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/gettext.m4 \ + $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/lib-ld.m4 \ + $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ + $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \ + $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/acinclude.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/include/aconfig.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +am__installdirs = "$(DESTDIR)$(bindir)" "$(DESTDIR)$(man1dir)" +PROGRAMS = $(bin_PROGRAMS) +am_aseqnet_OBJECTS = aseqnet.$(OBJEXT) +aseqnet_OBJECTS = $(am_aseqnet_OBJECTS) +am__DEPENDENCIES_1 = +aseqnet_DEPENDENCIES = $(am__DEPENDENCIES_1) +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__maybe_remake_depfiles = depfiles +am__depfiles_remade = ./$(DEPDIR)/aseqnet.Po +am__mv = mv -f +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +AM_V_CC = $(am__v_CC_@AM_V@) +am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) +am__v_CC_0 = @echo " CC " $@; +am__v_CC_1 = +CCLD = $(CC) +LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_CCLD = $(am__v_CCLD_@AM_V@) +am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) +am__v_CCLD_0 = @echo " CCLD " $@; +am__v_CCLD_1 = +SOURCES = $(aseqnet_SOURCES) +DIST_SOURCES = $(aseqnet_SOURCES) +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; +am__vpath_adj = case $$p in \ + $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ + *) f=$$p;; \ + esac; +am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; +am__install_max = 40 +am__nobase_strip_setup = \ + srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` +am__nobase_strip = \ + for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" +am__nobase_list = $(am__nobase_strip_setup); \ + for p in $$list; do echo "$$p $$p"; done | \ + sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ + $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ + if (++n[$$2] == $(am__install_max)) \ + { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ + END { for (dir in files) print dir, files[dir] }' +am__base_list = \ + sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ + sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' +am__uninstall_files_from_dir = { \ + test -z "$$files" \ + || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ + || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ + $(am__cd) "$$dir" && rm -f $$files; }; \ + } +man1dir = $(mandir)/man1 +NROFF = nroff +MANS = $(man_MANS) +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) +# Read a list of newline-separated strings from the standard input, +# and print each of them once, without duplicates. Input order is +# *not* preserved. +am__uniquify_input = $(AWK) '\ + BEGIN { nonempty = 0; } \ + { items[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in items) print i; }; } \ +' +# Make sure the list of sources is unique. This is necessary because, +# e.g., the same source file might be shared among _SOURCES variables +# for different programs/libraries. +am__define_uniq_tagged_files = \ + list='$(am__tagged_files)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | $(am__uniquify_input)` +ETAGS = etags +CTAGS = ctags +am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/depcomp +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +ALSACTL_DAEMONSWITCH = @ALSACTL_DAEMONSWITCH@ +ALSACTL_PIDFILE_DIR = @ALSACTL_PIDFILE_DIR@ +ALSA_CFLAGS = @ALSA_CFLAGS@ +ALSA_LIBS = @ALSA_LIBS@ +ALSA_TOPOLOGY_LIBS = @ALSA_TOPOLOGY_LIBS@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +ASOUND_LOCK_DIR = @ASOUND_LOCK_DIR@ +ASOUND_STATE_DIR = @ASOUND_STATE_DIR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CURSESINC = @CURSESINC@ +CURSESLIB = @CURSESLIB@ +CURSES_CFLAGS = @CURSES_CFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +FFTW_CFLAGS = @FFTW_CFLAGS@ +FFTW_INC = @FFTW_INC@ +FFTW_LIB = @FFTW_LIB@ +GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ +GMSGFMT = @GMSGFMT@ +GMSGFMT_015 = @GMSGFMT_015@ +GREP = @GREP@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +INTLLIBS = @INTLLIBS@ +INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@ +LDFLAGS = @LDFLAGS@ +LIBICONV = @LIBICONV@ +LIBINTL = @LIBINTL@ +LIBOBJS = @LIBOBJS@ +LIBRT = @LIBRT@ +LIBS = @LIBS@ +LN_S = @LN_S@ +LTLIBICONV = @LTLIBICONV@ +LTLIBINTL = @LTLIBINTL@ +LTLIBOBJS = @LTLIBOBJS@ +MAINT = @MAINT@ +MAKEINFO = @MAKEINFO@ +MKDIR_P = @MKDIR_P@ +MSGFMT = @MSGFMT@ +MSGFMT_015 = @MSGFMT_015@ +MSGMERGE = @MSGMERGE@ +NCURSESW_CFLAGS = @NCURSESW_CFLAGS@ +NCURSESW_LIBS = @NCURSESW_LIBS@ +NCURSES_CFLAGS = @NCURSES_CFLAGS@ +NCURSES_LIBS = @NCURSES_LIBS@ +OBJEXT = @OBJEXT@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ +POSUB = @POSUB@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +SND_UTIL_MAJOR = @SND_UTIL_MAJOR@ +SND_UTIL_MINOR = @SND_UTIL_MINOR@ +SND_UTIL_SUBMINOR = @SND_UTIL_SUBMINOR@ +SND_UTIL_VERSION = @SND_UTIL_VERSION@ +STRIP = @STRIP@ +SYSTEMD_CFLAGS = @SYSTEMD_CFLAGS@ +SYSTEMD_LIBS = @SYSTEMD_LIBS@ +TESTSOUND = @TESTSOUND@ +USE_NLS = @USE_NLS@ +VERSION = @VERSION@ +XGETTEXT = @XGETTEXT@ +XGETTEXT_015 = @XGETTEXT_015@ +XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_CC = @ac_ct_CC@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +mydatadir = @mydatadir@ +ncurses5_config = @ncurses5_config@ +ncursesw5_config = @ncursesw5_config@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +rst2man_available = @rst2man_available@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +systemdsystemunitdir = @systemdsystemunitdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +udevrulesdir = @udevrulesdir@ +xmlto_available = @xmlto_available@ +AM_CPPFLAGS = -I$(top_srcdir)/include +EXTRA_DIST = README.aseqnet aseqnet.1 +aseqnet_SOURCES = aseqnet.c +aseqnet_LDADD = $(INTLLIBS) +man_MANS = aseqnet.1 +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .o .obj +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign seq/aseqnet/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --foreign seq/aseqnet/Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): +install-binPROGRAMS: $(bin_PROGRAMS) + @$(NORMAL_INSTALL) + @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(bindir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(bindir)" || exit 1; \ + fi; \ + for p in $$list; do echo "$$p $$p"; done | \ + sed 's/$(EXEEXT)$$//' | \ + while read p p1; do if test -f $$p \ + ; then echo "$$p"; echo "$$p"; else :; fi; \ + done | \ + sed -e 'p;s,.*/,,;n;h' \ + -e 's|.*|.|' \ + -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \ + sed 'N;N;N;s,\n, ,g' | \ + $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \ + { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \ + if ($$2 == $$4) files[d] = files[d] " " $$1; \ + else { print "f", $$3 "/" $$4, $$1; } } \ + END { for (d in files) print "f", d, files[d] }' | \ + while read type dir files; do \ + if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \ + test -z "$$files" || { \ + echo " $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(bindir)$$dir'"; \ + $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \ + } \ + ; done + +uninstall-binPROGRAMS: + @$(NORMAL_UNINSTALL) + @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ + files=`for p in $$list; do echo "$$p"; done | \ + sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \ + -e 's/$$/$(EXEEXT)/' \ + `; \ + test -n "$$list" || exit 0; \ + echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \ + cd "$(DESTDIR)$(bindir)" && rm -f $$files + +clean-binPROGRAMS: + -test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS) + +aseqnet$(EXEEXT): $(aseqnet_OBJECTS) $(aseqnet_DEPENDENCIES) $(EXTRA_aseqnet_DEPENDENCIES) + @rm -f aseqnet$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(aseqnet_OBJECTS) $(aseqnet_LDADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/aseqnet.Po@am__quote@ # am--include-marker + +$(am__depfiles_remade): + @$(MKDIR_P) $(@D) + @echo '# dummy' >$@-t && $(am__mv) $@-t $@ + +am--depfiles: $(am__depfiles_remade) + +.c.o: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< + +.c.obj: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` +install-man1: $(man_MANS) + @$(NORMAL_INSTALL) + @list1=''; \ + list2='$(man_MANS)'; \ + test -n "$(man1dir)" \ + && test -n "`echo $$list1$$list2`" \ + || exit 0; \ + echo " $(MKDIR_P) '$(DESTDIR)$(man1dir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(man1dir)" || exit 1; \ + { for i in $$list1; do echo "$$i"; done; \ + if test -n "$$list2"; then \ + for i in $$list2; do echo "$$i"; done \ + | sed -n '/\.1[a-z]*$$/p'; \ + fi; \ + } | while read p; do \ + if test -f $$p; then d=; else d="$(srcdir)/"; fi; \ + echo "$$d$$p"; echo "$$p"; \ + done | \ + sed -e 'n;s,.*/,,;p;h;s,.*\.,,;s,^[^1][0-9a-z]*$$,1,;x' \ + -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,' | \ + sed 'N;N;s,\n, ,g' | { \ + list=; while read file base inst; do \ + if test "$$base" = "$$inst"; then list="$$list $$file"; else \ + echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man1dir)/$$inst'"; \ + $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man1dir)/$$inst" || exit $$?; \ + fi; \ + done; \ + for i in $$list; do echo "$$i"; done | $(am__base_list) | \ + while read files; do \ + test -z "$$files" || { \ + echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(man1dir)'"; \ + $(INSTALL_DATA) $$files "$(DESTDIR)$(man1dir)" || exit $$?; }; \ + done; } + +uninstall-man1: + @$(NORMAL_UNINSTALL) + @list=''; test -n "$(man1dir)" || exit 0; \ + files=`{ for i in $$list; do echo "$$i"; done; \ + l2='$(man_MANS)'; for i in $$l2; do echo "$$i"; done | \ + sed -n '/\.1[a-z]*$$/p'; \ + } | sed -e 's,.*/,,;h;s,.*\.,,;s,^[^1][0-9a-z]*$$,1,;x' \ + -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,'`; \ + dir='$(DESTDIR)$(man1dir)'; $(am__uninstall_files_from_dir) + +ID: $(am__tagged_files) + $(am__define_uniq_tagged_files); mkid -fID $$unique +tags: tags-am +TAGS: tags + +tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + set x; \ + here=`pwd`; \ + $(am__define_uniq_tagged_files); \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: ctags-am + +CTAGS: ctags +ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + $(am__define_uniq_tagged_files); \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" +cscopelist: cscopelist-am + +cscopelist-am: $(am__tagged_files) + list='$(am__tagged_files)'; \ + case "$(srcdir)" in \ + [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ + *) sdir=$(subdir)/$(srcdir) ;; \ + esac; \ + for i in $$list; do \ + if test -f "$$i"; then \ + echo "$(subdir)/$$i"; \ + else \ + echo "$$sdir/$$i"; \ + fi; \ + done >> $(top_builddir)/cscope.files + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) distdir-am + +distdir-am: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(PROGRAMS) $(MANS) +installdirs: + for dir in "$(DESTDIR)$(bindir)" "$(DESTDIR)$(man1dir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ + done +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-binPROGRAMS clean-generic mostlyclean-am + +distclean: distclean-am + -rm -f ./$(DEPDIR)/aseqnet.Po + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: install-man + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: install-binPROGRAMS + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: install-man1 + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -f ./$(DEPDIR)/aseqnet.Po + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-binPROGRAMS uninstall-man + +uninstall-man: uninstall-man1 + +.MAKE: install-am install-strip + +.PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-am clean \ + clean-binPROGRAMS clean-generic cscopelist-am ctags ctags-am \ + distclean distclean-compile distclean-generic distclean-tags \ + distdir dvi dvi-am html html-am info info-am install \ + install-am install-binPROGRAMS install-data install-data-am \ + install-dvi install-dvi-am install-exec install-exec-am \ + install-html install-html-am install-info install-info-am \ + install-man install-man1 install-pdf install-pdf-am install-ps \ + install-ps-am install-strip installcheck installcheck-am \ + installdirs maintainer-clean maintainer-clean-generic \ + mostlyclean mostlyclean-compile mostlyclean-generic pdf pdf-am \ + ps ps-am tags tags-am uninstall uninstall-am \ + uninstall-binPROGRAMS uninstall-man uninstall-man1 + +.PRECIOUS: Makefile + + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/seq/aseqnet/README.aseqnet b/seq/aseqnet/README.aseqnet new file mode 100644 index 0000000..bd0b68e --- /dev/null +++ b/seq/aseqnet/README.aseqnet @@ -0,0 +1,53 @@ +================================================================ + ALSA sequencer connectors over network + ver.0.1 + Copyright (C) 1999-2000 Takashi Iwai +================================================================ + +* ASEQNET + +aseqnet is a sequencer client which sends/receives events over +network. Suppose two hosts (hostA and hostB) connected by network. +You need to run ALSA system on both hosts. Then, start aseqnet as a +server on hostA: + + hostA% aseqnet + sequencer opened: 128:0 + +A user client 128 with port 0 was opened. (The client number may +vary.) At next, start client on hostB. The argument is the hostname +where server is running. + + hostB% aseqnet hostA + sequencer opened: 132:0 + +Now events sent to hostA:128:0 is transferred to hostB:132:0, and vice +versa. + +You can connect these ports arbitrary to other sequencer ports. +For example, connect hostB:132:0 to a MIDI output device 65:0. The +aconnect utility can be used for this: + + hostB% aconnect 132:0 65:0 + +Events to hostA:128:0 will be delivered indirectly to hostB:65:0. +You'll hear MIDI sounds as following: + + hostA% pmidi -p 128:0 foo.mid + +The multiple clients may exist simultaneously. If hostC is connected +as a client to hostA, events from from hostA are sent to all connected +network clients, hostB and hostC. However, only one connection is +allowed from a client to a server. + +To disconnect network, stop all clients before server by ctrl-C or +sending signal to them. The server will automatically quit. + +The available options are: + + -p port : specify the TCP port number or TCP service name. + Default value is 40002. + -s addr : explicit read-subscription to the given address + (client:addr). + -d addr : explicit write-subscription to the given address. + -v : verbose mode. diff --git a/seq/aseqnet/aseqnet.1 b/seq/aseqnet/aseqnet.1 new file mode 100644 index 0000000..2cb6eb7 --- /dev/null +++ b/seq/aseqnet/aseqnet.1 @@ -0,0 +1,80 @@ +.TH aseqnet 1 "January 1, 2000" +.SH NAME +aseqnet \- ALSA sequencer connectors over network + +.SH SYNOPSIS +.B aseqnet +[remotehost] + +.SH DESCRIPTION +.B aseqnet +is an ALSA sequencer client which sends and receives event packets +over network. +Suppose two hosts connected by network, +.I hostA +as a server +and +.I hostB +as a client. +The ALSA sequencer system must be running on both hosts. +For creating the server port, run the following on hostA: +.IP "" 4 +hostA% aseqnet +.br +sequencer opened: 128:0 +.PP +Then a user client 128 with port 0 was opened on hostA. +(The client number may vary.) +For creating the (network-)client port, run +.B aseqnet +with the hostname of the server: +.IP "" 4 +hostB% aseqnet hostA +.br +sequencer opened: 132:0 +.PP +Now all events sent to hostA:128:0 are transferred to hostB:132:0, and vice +versa. +.PP +The ports created by +.B aseqnet +can be connected arbitrary to other sequencer ports via +.B aconnect(1). +For example, to connect hostB:132:0 to a MIDI output device 65:0: +.IP "" 4 +hostB% aconnect 132:0 65:0 +.PP +Then events to hostA:128:0 will be delivered to hostB:65:0. +The following command plays MIDI on +.I hostB. +.IP "" 4 +hostA% pmidi \-p 128:0 foo.mid +.PP +The multiple clients may exist simultaneously. If +.I hostC +is connected as a client to hostA, events from from hostA are sent +to all connected network clients, i.e. hostB and hostC. +However, only one connection is allowed from a client to a server. +.PP +To disconnect network, stop all clients before server by ctrl-C or +sending signal to them. The server will automatically quit. + +.SH OPTIONS +.TP +.B \-p port +Specify the TCP port number or TCP service name. +.TP +.B \-s addr +Subscribe to the given address for read automatically. +.TP +.B \-d addr +Subscribe to the given address for write automatically. +.TP +.B \-v +Verbose mode. + +.SH "SEE ALSO" +aconnect(1), pmidi(1) + +.SH AUTHOR +Takashi Iwai . diff --git a/seq/aseqnet/aseqnet.c b/seq/aseqnet/aseqnet.c new file mode 100644 index 0000000..70a1cfd --- /dev/null +++ b/seq/aseqnet/aseqnet.c @@ -0,0 +1,609 @@ +/* + * network server/client for ALSA sequencer + * ver.0.1 + * + * Copyright (C) 1999-2000 Takashi Iwai + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "aconfig.h" +#include "gettext.h" + +/* + * prototypes + */ +static void usage(void); +static void init_buf(void); +static void init_pollfds(void); +static void close_files(void); +static void init_seq(char *source, char *dest); +static int get_port(char *service); +static void sigterm_exit(int sig); +static void init_server(int port); +static void init_client(char *server, int port); +static void do_loop(void); +static int copy_local_to_remote(void); +static int copy_remote_to_local(int fd); + +/* + * default TCP port number + */ +#define DEFAULT_PORT 40002 + +/* + * local input buffer + */ +static char *readbuf; +static int max_rdlen; +static char *writebuf; +static int cur_wrlen, max_wrlen; + +#define MAX_BUF_EVENTS 200 +#define MAX_CONNECTION 10 + +static snd_seq_t *handle; +static struct pollfd *seqifds = NULL; +static struct pollfd *seqofds = NULL; +static struct pollfd *pollfds = NULL; +static int seqifds_count = 0; +static int seqofds_count = 0; +static int pollfds_count = 0; +static int sockfd, netfd[MAX_CONNECTION] = {[0 ... MAX_CONNECTION-1] = -1}; +static int max_connection; +static int cur_connected; +static int seq_port; + +static int server_mode; +static int verbose = 0; +static int info = 0; + + +/* + * main routine + */ + +static const struct option long_option[] = { + {"port", 1, NULL, 'p'}, + {"source", 1, NULL, 's'}, + {"dest", 1, NULL, 'd'}, + {"help", 0, NULL, 'h'}, + {"verbose", 0, NULL, 'v'}, + {"info", 0, NULL, 'i'}, + {NULL, 0, NULL, 0}, +}; + +int main(int argc, char **argv) +{ + int c; + int port = DEFAULT_PORT; + char *source = NULL, *dest = NULL; + +#ifdef ENABLE_NLS + setlocale(LC_ALL, ""); + textdomain(PACKAGE); +#endif + + while ((c = getopt_long(argc, argv, "p:s:d:vi", long_option, NULL)) != -1) { + switch (c) { + case 'p': + if (isdigit(*optarg)) + port = atoi(optarg); + else + port = get_port(optarg); + break; + case 's': + source = optarg; + break; + case 'd': + dest = optarg; + break; + case 'v': + verbose++; + break; + case 'i': + info++; + break; + default: + usage(); + exit(1); + } + } + + signal(SIGINT, sigterm_exit); + signal(SIGTERM, sigterm_exit); + + init_buf(); + init_seq(source, dest); + + if (optind >= argc) { + server_mode = 1; + max_connection = MAX_CONNECTION; + init_pollfds(); + init_server(port); + } else { + server_mode = 0; + max_connection = 1; + init_pollfds(); + init_client(argv[optind], port); + } + + do_loop(); + + close_files(); + + return 0; +} + + +/* + * print usage + */ +static void usage(void) +{ + printf(_("aseqnet - network client/server on ALSA sequencer\n")); + printf(_(" Copyright (C) 1999 Takashi Iwai\n")); + printf(_("usage:\n")); + printf(_(" server mode: aseqnet [-options]\n")); + printf(_(" client mode: aseqnet [-options] server_host\n")); + printf(_("options:\n")); + printf(_(" -p,--port # : specify TCP port (digit or service name)\n")); + printf(_(" -s,--source addr : read from given addr (client:port)\n")); + printf(_(" -d,--dest addr : write to given addr (client:port)\n")); + printf(_(" -v, --verbose : print verbose messages\n")); + printf(_(" -i, --info : print certain received events\n")); +} + + +/* + * allocate and initialize buffers + */ +static void init_buf(void) +{ + max_wrlen = MAX_BUF_EVENTS * sizeof(snd_seq_event_t); + max_rdlen = MAX_BUF_EVENTS * sizeof(snd_seq_event_t); + writebuf = malloc(max_wrlen); + readbuf = malloc(max_rdlen); + if (writebuf == NULL || readbuf == NULL) { + fprintf(stderr, _("can't malloc\n")); + exit(1); + } + memset(writebuf, 0, max_wrlen); + memset(readbuf, 0, max_rdlen); + cur_wrlen = 0; +} + +/* + * allocate and initialize poll array + */ +static void init_pollfds(void) +{ + pollfds_count = seqifds_count + seqofds_count + 1 + max_connection; + pollfds = (struct pollfd *)calloc(pollfds_count, sizeof(struct pollfd)); + assert(pollfds); +} + +/* + * close all files + */ +static void close_files(void) +{ + int i; + if (verbose) + fprintf(stderr, _("closing files..\n")); + for (i = 0; i < max_connection; i++) { + if (netfd[i] >= 0) + close(netfd[i]); + } + if (sockfd >= 0) + close(sockfd); +} + + +/* + * initialize sequencer + */ +static void init_seq(char *source, char *dest) +{ + snd_seq_addr_t addr; + int err, counti, counto; + + if (snd_seq_open(&handle, "default", SND_SEQ_OPEN_DUPLEX, 0) < 0) { + perror("snd_seq_open"); + exit(1); + } + if (seqifds) + free(seqifds); + if (seqofds) + free(seqofds); + counti = seqifds_count = snd_seq_poll_descriptors_count(handle, POLLIN); + assert(counti > 0); + counto = seqofds_count = snd_seq_poll_descriptors_count(handle, POLLOUT); + assert(counto > 0); + seqifds = (struct pollfd *)calloc(counti, sizeof(struct pollfd)); + assert(seqifds); + seqofds = (struct pollfd *)calloc(counto, sizeof(struct pollfd)); + assert(seqofds); + err = snd_seq_poll_descriptors(handle, seqifds, counti, POLLIN); + assert(err == counti); + err = snd_seq_poll_descriptors(handle, seqofds, counto, POLLOUT); + assert(err == counto); + + snd_seq_nonblock(handle, 1); + + /* set client info */ + if (server_mode) + snd_seq_set_client_name(handle, "Net Server"); + else + snd_seq_set_client_name(handle, "Net Client"); + + /* create a port */ + seq_port = snd_seq_create_simple_port(handle, "Network", + SND_SEQ_PORT_CAP_READ | + SND_SEQ_PORT_CAP_WRITE | + SND_SEQ_PORT_CAP_SUBS_READ | + SND_SEQ_PORT_CAP_SUBS_WRITE, + SND_SEQ_PORT_TYPE_MIDI_GENERIC); + if (seq_port < 0) { + perror("create seq port"); + exit(1); + } + if (verbose) + fprintf(stderr, _("sequencer opened: %d:%d\n"), + snd_seq_client_id(handle), seq_port); + + /* explicit subscriptions */ + if (source) { + /* read subscription */ + if (snd_seq_parse_address(handle, &addr, source) < 0) { + fprintf(stderr, _("invalid source address %s\n"), source); + exit(1); + } + if (snd_seq_connect_from(handle, seq_port, addr.client, addr.port)) { + perror("read subscription"); + exit(1); + } + } + if (dest) { + /* write subscription */ + if (snd_seq_parse_address(handle, &addr, dest) < 0) { + fprintf(stderr, _("invalid destination address %s\n"), dest); + exit(1); + } + if (snd_seq_connect_to(handle, seq_port, addr.client, addr.port)) { + perror("write subscription"); + exit(1); + } + } +} + + +/* + * convert from string to TCP port number + */ +static int get_port(char *service) +{ + struct servent *sp; + + if ((sp = getservbyname(service, "tcp")) == NULL){ + fprintf(stderr, _("service '%s' is not found in /etc/services\n"), service); + return -1; + } + return sp->s_port; +} + +/* + * signal handler + */ +static void sigterm_exit(int sig) +{ + close_files(); + exit(1); +} + + +/* + * initialize network server + */ +static void init_server(int port) +{ + int i; + int curstate = 1; + struct sockaddr_in addr; + + memset(&addr, 0, sizeof(addr)); + + addr.sin_family = AF_INET; + addr.sin_addr.s_addr = INADDR_ANY; + addr.sin_port = htons(port); + + sockfd = socket(AF_INET, SOCK_STREAM, 0); + if (sockfd < 0) { + perror("create socket"); + exit(1); + } + setsockopt(sockfd, SOL_SOCKET, SO_REUSEADDR, &curstate, sizeof(curstate)); + /* the return value is ignored.. */ + + if (bind(sockfd, (struct sockaddr *)&addr, sizeof(addr)) < 0) { + perror("can't bind"); + exit(1); + } + + if (listen(sockfd, 5) < 0) { + perror("can't listen"); + exit(1); + } + + cur_connected = 0; + for (i = 0; i < max_connection; i++) + netfd[i] = -1; +} + +/* + * start connection on server + */ +static void start_connection(void) +{ + struct sockaddr_in addr; + int i; + socklen_t addr_len; + + for (i = 0; i < max_connection; i++) { + if (netfd[i] < 0) + break; + } + if (i >= max_connection) { + fprintf(stderr, _("too many connections!\n")); + exit(1); + } + memset(&addr, 0, sizeof(addr)); + addr_len = sizeof(addr); + netfd[i] = accept(sockfd, (struct sockaddr *)&addr, &addr_len); + if (netfd[i] < 0) { + perror("accept"); + exit(1); + } + if (verbose) + fprintf(stderr, _("accepted[%d]\n"), netfd[i]); + cur_connected++; +} + +/* + * initialize network client + */ +static void init_client(char *server, int port) +{ + struct sockaddr_in addr; + struct hostent *host; + int curstate = 1; + int fd; + + if ((fd = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP)) < 0){ + perror("create socket"); + exit(1); + } + if (setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &curstate, sizeof(curstate)) < 0) { + perror("setsockopt"); + exit(1); + } + if ((host = gethostbyname(server)) == NULL){ + fprintf(stderr, _("can't get address %s\n"), server); + exit(1); + } + addr.sin_port = htons(port); + addr.sin_family = AF_INET; + memcpy(&addr.sin_addr, host->h_addr, host->h_length); + if (connect(fd, (struct sockaddr *)&addr, sizeof(addr)) < 0) { + perror("connect"); + exit(1); + } + if (verbose) + fprintf(stderr, _("ok.. connected\n")); + netfd[0] = fd; + cur_connected = 1; +} + +/* + * event loop + */ +static void do_loop(void) +{ + int i, rc, width; + int seqifd_ptr, sockfd_ptr = -1, netfd_ptr; + + for (;;) { + memset(pollfds, 0, pollfds_count * sizeof(struct pollfd)); + seqifd_ptr = 0; + memcpy(pollfds, seqifds, sizeof(*seqifds)*(width = seqifds_count)); + if (server_mode) { + sockfd_ptr = width; + pollfds[width].fd = sockfd; + pollfds[width].events = POLLIN; + width++; + } + netfd_ptr = width; + for (i = 0; i < max_connection; i++) { + if (netfd[i] >= 0) { + pollfds[width].fd = netfd[i]; + pollfds[width].events = POLLIN; + width++; + } + } + do { + rc = poll(pollfds, width, -1); + } while (rc <= 0 && errno == EINTR); + if (rc <= 0) { + perror("poll"); + exit(1); + } + if (server_mode) { + if (pollfds[sockfd_ptr].revents & (POLLIN|POLLOUT)) + start_connection(); + } + for (i = 0; i < seqifds_count; i++) + if (pollfds[seqifd_ptr + i].revents & (POLLIN|POLLOUT)) { + if (copy_local_to_remote()) + return; + break; + } + for (i = 0; i < max_connection; i++) { + if (netfd[i] < 0) + continue; + if (pollfds[netfd_ptr + i].revents & (POLLIN|POLLOUT)) { + if (copy_remote_to_local(netfd[i])) { + netfd[i] = -1; + cur_connected--; + if (cur_connected <= 0) + return; + } + } + } + } +} + + +/* + * flush write buffer - send data to the socket + */ +static void flush_writebuf(void) +{ + if (cur_wrlen) { + int i; + for (i = 0; i < max_connection; i++) { + if (netfd[i] >= 0) + write(netfd[i], writebuf, cur_wrlen); + } + cur_wrlen = 0; + } +} + +/* + * get space from write buffer + */ +static char *get_writebuf(int len) +{ + char *buf; + if (cur_wrlen + len >= max_wrlen) + flush_writebuf(); + buf = writebuf + cur_wrlen; + cur_wrlen += len; + return buf; +} + +static void print_event(snd_seq_event_t *ev) +{ + switch (ev->type) { + case SND_SEQ_EVENT_CONTROLLER: + printf(_("Channel %2d: Control event : %5d\n"), + ev->data.control.channel, ev->data.control.value); + break; + case SND_SEQ_EVENT_PITCHBEND: + printf(_("Channel %2d: Pitchbender : %5d\n"), + ev->data.control.channel, ev->data.control.value); + break; + case SND_SEQ_EVENT_NOTEON: + printf(_("Channel %2d: Note On event : %5d\n"), + ev->data.control.channel, ev->data.note.note); + break; + case SND_SEQ_EVENT_NOTEOFF: + printf(_("Channel %2d: Note Off event: %5d\n"), + ev->data.control.channel, ev->data.note.note); + break; + } +} + +#define EVENT_PACKET_SIZE 32 + +/* + * copy events from sequencer to port(s) + */ +static int copy_local_to_remote(void) +{ + int rc; + snd_seq_event_t *ev; + char *buf; + + while ((rc = snd_seq_event_input(handle, &ev)) >= 0 && ev) { + if (ev->type >= SND_SEQ_EVENT_CLIENT_START && + ! snd_seq_ev_is_variable_type(ev)) { + snd_seq_free_event(ev); + continue; + } + if (snd_seq_ev_is_variable(ev)) { + int len; + len = EVENT_PACKET_SIZE + ev->data.ext.len; + buf = get_writebuf(len); + memcpy(buf, ev, sizeof(snd_seq_event_t)); + memcpy(buf + EVENT_PACKET_SIZE, ev->data.ext.ptr, ev->data.ext.len); + } else { + buf = get_writebuf(EVENT_PACKET_SIZE); + memcpy(buf, ev, EVENT_PACKET_SIZE); + } + if (info) + print_event(ev); + snd_seq_free_event(ev); + } + flush_writebuf(); + return 0; +} + +/* + * copy events from a port to sequencer + */ +static int copy_remote_to_local(int fd) +{ + int count; + char *buf; + snd_seq_event_t *ev; + + count = read(fd, readbuf, MAX_BUF_EVENTS * sizeof(snd_seq_event_t)); + buf = readbuf; + + if (count == 0) { + if (verbose) + fprintf(stderr, _("disconnected\n")); + return 1; + } + + while (count > 0) { + ev = (snd_seq_event_t*)buf; + buf += EVENT_PACKET_SIZE; + count -= EVENT_PACKET_SIZE; + if (snd_seq_ev_is_variable(ev) && ev->data.ext.len > 0) { + ev->data.ext.ptr = buf; + buf += ev->data.ext.len; + count -= ev->data.ext.len; + } + snd_seq_ev_set_direct(ev); + snd_seq_ev_set_source(ev, seq_port); + snd_seq_ev_set_subs(ev); + if (info) + print_event(ev); + snd_seq_event_output(handle, ev); + } + + snd_seq_drain_output(handle); + return 0; +} + diff --git a/speaker-test/Makefile.am b/speaker-test/Makefile.am new file mode 100644 index 0000000..d53dbd6 --- /dev/null +++ b/speaker-test/Makefile.am @@ -0,0 +1,9 @@ +AM_CPPFLAGS = -I$(top_srcdir)/include +SUBDIRS= samples +LDADD = $(LIBINTL) -lm + +bin_PROGRAMS = speaker-test +speaker_test_SOURCES = speaker-test.c pink.c +man_MANS = speaker-test.1 +EXTRA_DIST = readme.txt speaker-test.1 pink.h + diff --git a/speaker-test/Makefile.in b/speaker-test/Makefile.in new file mode 100644 index 0000000..727e9ca --- /dev/null +++ b/speaker-test/Makefile.in @@ -0,0 +1,842 @@ +# Makefile.in generated by automake 1.16.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994-2018 Free Software Foundation, Inc. + +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +VPATH = @srcdir@ +am__is_gnu_make = { \ + if test -z '$(MAKELEVEL)'; then \ + false; \ + elif test -n '$(MAKE_HOST)'; then \ + true; \ + elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ + true; \ + else \ + false; \ + fi; \ +} +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + esac; \ + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +bin_PROGRAMS = speaker-test$(EXEEXT) +subdir = speaker-test +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/gettext.m4 \ + $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/lib-ld.m4 \ + $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ + $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \ + $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/acinclude.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/include/aconfig.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +am__installdirs = "$(DESTDIR)$(bindir)" "$(DESTDIR)$(man1dir)" +PROGRAMS = $(bin_PROGRAMS) +am_speaker_test_OBJECTS = speaker-test.$(OBJEXT) pink.$(OBJEXT) +speaker_test_OBJECTS = $(am_speaker_test_OBJECTS) +speaker_test_LDADD = $(LDADD) +am__DEPENDENCIES_1 = +speaker_test_DEPENDENCIES = $(am__DEPENDENCIES_1) +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__maybe_remake_depfiles = depfiles +am__depfiles_remade = ./$(DEPDIR)/pink.Po ./$(DEPDIR)/speaker-test.Po +am__mv = mv -f +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +AM_V_CC = $(am__v_CC_@AM_V@) +am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) +am__v_CC_0 = @echo " CC " $@; +am__v_CC_1 = +CCLD = $(CC) +LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_CCLD = $(am__v_CCLD_@AM_V@) +am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) +am__v_CCLD_0 = @echo " CCLD " $@; +am__v_CCLD_1 = +SOURCES = $(speaker_test_SOURCES) +DIST_SOURCES = $(speaker_test_SOURCES) +RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \ + ctags-recursive dvi-recursive html-recursive info-recursive \ + install-data-recursive install-dvi-recursive \ + install-exec-recursive install-html-recursive \ + install-info-recursive install-pdf-recursive \ + install-ps-recursive install-recursive installcheck-recursive \ + installdirs-recursive pdf-recursive ps-recursive \ + tags-recursive uninstall-recursive +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; +am__vpath_adj = case $$p in \ + $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ + *) f=$$p;; \ + esac; +am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; +am__install_max = 40 +am__nobase_strip_setup = \ + srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` +am__nobase_strip = \ + for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" +am__nobase_list = $(am__nobase_strip_setup); \ + for p in $$list; do echo "$$p $$p"; done | \ + sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ + $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ + if (++n[$$2] == $(am__install_max)) \ + { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ + END { for (dir in files) print dir, files[dir] }' +am__base_list = \ + sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ + sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' +am__uninstall_files_from_dir = { \ + test -z "$$files" \ + || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ + || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ + $(am__cd) "$$dir" && rm -f $$files; }; \ + } +man1dir = $(mandir)/man1 +NROFF = nroff +MANS = $(man_MANS) +RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ + distclean-recursive maintainer-clean-recursive +am__recursive_targets = \ + $(RECURSIVE_TARGETS) \ + $(RECURSIVE_CLEAN_TARGETS) \ + $(am__extra_recursive_targets) +AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \ + distdir distdir-am +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) +# Read a list of newline-separated strings from the standard input, +# and print each of them once, without duplicates. Input order is +# *not* preserved. +am__uniquify_input = $(AWK) '\ + BEGIN { nonempty = 0; } \ + { items[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in items) print i; }; } \ +' +# Make sure the list of sources is unique. This is necessary because, +# e.g., the same source file might be shared among _SOURCES variables +# for different programs/libraries. +am__define_uniq_tagged_files = \ + list='$(am__tagged_files)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | $(am__uniquify_input)` +ETAGS = etags +CTAGS = ctags +DIST_SUBDIRS = $(SUBDIRS) +am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/depcomp +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +am__relativize = \ + dir0=`pwd`; \ + sed_first='s,^\([^/]*\)/.*$$,\1,'; \ + sed_rest='s,^[^/]*/*,,'; \ + sed_last='s,^.*/\([^/]*\)$$,\1,'; \ + sed_butlast='s,/*[^/]*$$,,'; \ + while test -n "$$dir1"; do \ + first=`echo "$$dir1" | sed -e "$$sed_first"`; \ + if test "$$first" != "."; then \ + if test "$$first" = ".."; then \ + dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \ + dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \ + else \ + first2=`echo "$$dir2" | sed -e "$$sed_first"`; \ + if test "$$first2" = "$$first"; then \ + dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \ + else \ + dir2="../$$dir2"; \ + fi; \ + dir0="$$dir0"/"$$first"; \ + fi; \ + fi; \ + dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \ + done; \ + reldir="$$dir2" +ACLOCAL = @ACLOCAL@ +ALSACTL_DAEMONSWITCH = @ALSACTL_DAEMONSWITCH@ +ALSACTL_PIDFILE_DIR = @ALSACTL_PIDFILE_DIR@ +ALSA_CFLAGS = @ALSA_CFLAGS@ +ALSA_LIBS = @ALSA_LIBS@ +ALSA_TOPOLOGY_LIBS = @ALSA_TOPOLOGY_LIBS@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +ASOUND_LOCK_DIR = @ASOUND_LOCK_DIR@ +ASOUND_STATE_DIR = @ASOUND_STATE_DIR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CURSESINC = @CURSESINC@ +CURSESLIB = @CURSESLIB@ +CURSES_CFLAGS = @CURSES_CFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +FFTW_CFLAGS = @FFTW_CFLAGS@ +FFTW_INC = @FFTW_INC@ +FFTW_LIB = @FFTW_LIB@ +GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ +GMSGFMT = @GMSGFMT@ +GMSGFMT_015 = @GMSGFMT_015@ +GREP = @GREP@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +INTLLIBS = @INTLLIBS@ +INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@ +LDFLAGS = @LDFLAGS@ +LIBICONV = @LIBICONV@ +LIBINTL = @LIBINTL@ +LIBOBJS = @LIBOBJS@ +LIBRT = @LIBRT@ +LIBS = @LIBS@ +LN_S = @LN_S@ +LTLIBICONV = @LTLIBICONV@ +LTLIBINTL = @LTLIBINTL@ +LTLIBOBJS = @LTLIBOBJS@ +MAINT = @MAINT@ +MAKEINFO = @MAKEINFO@ +MKDIR_P = @MKDIR_P@ +MSGFMT = @MSGFMT@ +MSGFMT_015 = @MSGFMT_015@ +MSGMERGE = @MSGMERGE@ +NCURSESW_CFLAGS = @NCURSESW_CFLAGS@ +NCURSESW_LIBS = @NCURSESW_LIBS@ +NCURSES_CFLAGS = @NCURSES_CFLAGS@ +NCURSES_LIBS = @NCURSES_LIBS@ +OBJEXT = @OBJEXT@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ +POSUB = @POSUB@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +SND_UTIL_MAJOR = @SND_UTIL_MAJOR@ +SND_UTIL_MINOR = @SND_UTIL_MINOR@ +SND_UTIL_SUBMINOR = @SND_UTIL_SUBMINOR@ +SND_UTIL_VERSION = @SND_UTIL_VERSION@ +STRIP = @STRIP@ +SYSTEMD_CFLAGS = @SYSTEMD_CFLAGS@ +SYSTEMD_LIBS = @SYSTEMD_LIBS@ +TESTSOUND = @TESTSOUND@ +USE_NLS = @USE_NLS@ +VERSION = @VERSION@ +XGETTEXT = @XGETTEXT@ +XGETTEXT_015 = @XGETTEXT_015@ +XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_CC = @ac_ct_CC@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +mydatadir = @mydatadir@ +ncurses5_config = @ncurses5_config@ +ncursesw5_config = @ncursesw5_config@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +rst2man_available = @rst2man_available@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +systemdsystemunitdir = @systemdsystemunitdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +udevrulesdir = @udevrulesdir@ +xmlto_available = @xmlto_available@ +AM_CPPFLAGS = -I$(top_srcdir)/include +SUBDIRS = samples +LDADD = $(LIBINTL) -lm +speaker_test_SOURCES = speaker-test.c pink.c +man_MANS = speaker-test.1 +EXTRA_DIST = readme.txt speaker-test.1 pink.h +all: all-recursive + +.SUFFIXES: +.SUFFIXES: .c .o .obj +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign speaker-test/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --foreign speaker-test/Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): +install-binPROGRAMS: $(bin_PROGRAMS) + @$(NORMAL_INSTALL) + @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(bindir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(bindir)" || exit 1; \ + fi; \ + for p in $$list; do echo "$$p $$p"; done | \ + sed 's/$(EXEEXT)$$//' | \ + while read p p1; do if test -f $$p \ + ; then echo "$$p"; echo "$$p"; else :; fi; \ + done | \ + sed -e 'p;s,.*/,,;n;h' \ + -e 's|.*|.|' \ + -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \ + sed 'N;N;N;s,\n, ,g' | \ + $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \ + { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \ + if ($$2 == $$4) files[d] = files[d] " " $$1; \ + else { print "f", $$3 "/" $$4, $$1; } } \ + END { for (d in files) print "f", d, files[d] }' | \ + while read type dir files; do \ + if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \ + test -z "$$files" || { \ + echo " $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(bindir)$$dir'"; \ + $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \ + } \ + ; done + +uninstall-binPROGRAMS: + @$(NORMAL_UNINSTALL) + @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ + files=`for p in $$list; do echo "$$p"; done | \ + sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \ + -e 's/$$/$(EXEEXT)/' \ + `; \ + test -n "$$list" || exit 0; \ + echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \ + cd "$(DESTDIR)$(bindir)" && rm -f $$files + +clean-binPROGRAMS: + -test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS) + +speaker-test$(EXEEXT): $(speaker_test_OBJECTS) $(speaker_test_DEPENDENCIES) $(EXTRA_speaker_test_DEPENDENCIES) + @rm -f speaker-test$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(speaker_test_OBJECTS) $(speaker_test_LDADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pink.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/speaker-test.Po@am__quote@ # am--include-marker + +$(am__depfiles_remade): + @$(MKDIR_P) $(@D) + @echo '# dummy' >$@-t && $(am__mv) $@-t $@ + +am--depfiles: $(am__depfiles_remade) + +.c.o: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< + +.c.obj: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` +install-man1: $(man_MANS) + @$(NORMAL_INSTALL) + @list1=''; \ + list2='$(man_MANS)'; \ + test -n "$(man1dir)" \ + && test -n "`echo $$list1$$list2`" \ + || exit 0; \ + echo " $(MKDIR_P) '$(DESTDIR)$(man1dir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(man1dir)" || exit 1; \ + { for i in $$list1; do echo "$$i"; done; \ + if test -n "$$list2"; then \ + for i in $$list2; do echo "$$i"; done \ + | sed -n '/\.1[a-z]*$$/p'; \ + fi; \ + } | while read p; do \ + if test -f $$p; then d=; else d="$(srcdir)/"; fi; \ + echo "$$d$$p"; echo "$$p"; \ + done | \ + sed -e 'n;s,.*/,,;p;h;s,.*\.,,;s,^[^1][0-9a-z]*$$,1,;x' \ + -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,' | \ + sed 'N;N;s,\n, ,g' | { \ + list=; while read file base inst; do \ + if test "$$base" = "$$inst"; then list="$$list $$file"; else \ + echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man1dir)/$$inst'"; \ + $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man1dir)/$$inst" || exit $$?; \ + fi; \ + done; \ + for i in $$list; do echo "$$i"; done | $(am__base_list) | \ + while read files; do \ + test -z "$$files" || { \ + echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(man1dir)'"; \ + $(INSTALL_DATA) $$files "$(DESTDIR)$(man1dir)" || exit $$?; }; \ + done; } + +uninstall-man1: + @$(NORMAL_UNINSTALL) + @list=''; test -n "$(man1dir)" || exit 0; \ + files=`{ for i in $$list; do echo "$$i"; done; \ + l2='$(man_MANS)'; for i in $$l2; do echo "$$i"; done | \ + sed -n '/\.1[a-z]*$$/p'; \ + } | sed -e 's,.*/,,;h;s,.*\.,,;s,^[^1][0-9a-z]*$$,1,;x' \ + -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,'`; \ + dir='$(DESTDIR)$(man1dir)'; $(am__uninstall_files_from_dir) + +# This directory's subdirectories are mostly independent; you can cd +# into them and run 'make' without going through this Makefile. +# To change the values of 'make' variables: instead of editing Makefiles, +# (1) if the variable is set in 'config.status', edit 'config.status' +# (which will cause the Makefiles to be regenerated when you run 'make'); +# (2) otherwise, pass the desired values on the 'make' command line. +$(am__recursive_targets): + @fail=; \ + if $(am__make_keepgoing); then \ + failcom='fail=yes'; \ + else \ + failcom='exit 1'; \ + fi; \ + dot_seen=no; \ + target=`echo $@ | sed s/-recursive//`; \ + case "$@" in \ + distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ + *) list='$(SUBDIRS)' ;; \ + esac; \ + for subdir in $$list; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + dot_seen=yes; \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || eval $$failcom; \ + done; \ + if test "$$dot_seen" = "no"; then \ + $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ + fi; test -z "$$fail" + +ID: $(am__tagged_files) + $(am__define_uniq_tagged_files); mkid -fID $$unique +tags: tags-recursive +TAGS: tags + +tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + set x; \ + here=`pwd`; \ + if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ + include_option=--etags-include; \ + empty_fix=.; \ + else \ + include_option=--include; \ + empty_fix=; \ + fi; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test ! -f $$subdir/TAGS || \ + set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \ + fi; \ + done; \ + $(am__define_uniq_tagged_files); \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: ctags-recursive + +CTAGS: ctags +ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + $(am__define_uniq_tagged_files); \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" +cscopelist: cscopelist-recursive + +cscopelist-am: $(am__tagged_files) + list='$(am__tagged_files)'; \ + case "$(srcdir)" in \ + [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ + *) sdir=$(subdir)/$(srcdir) ;; \ + esac; \ + for i in $$list; do \ + if test -f "$$i"; then \ + echo "$(subdir)/$$i"; \ + else \ + echo "$$sdir/$$i"; \ + fi; \ + done >> $(top_builddir)/cscope.files + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) distdir-am + +distdir-am: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done + @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + $(am__make_dryrun) \ + || test -d "$(distdir)/$$subdir" \ + || $(MKDIR_P) "$(distdir)/$$subdir" \ + || exit 1; \ + dir1=$$subdir; dir2="$(distdir)/$$subdir"; \ + $(am__relativize); \ + new_distdir=$$reldir; \ + dir1=$$subdir; dir2="$(top_distdir)"; \ + $(am__relativize); \ + new_top_distdir=$$reldir; \ + echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \ + echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \ + ($(am__cd) $$subdir && \ + $(MAKE) $(AM_MAKEFLAGS) \ + top_distdir="$$new_top_distdir" \ + distdir="$$new_distdir" \ + am__remove_distdir=: \ + am__skip_length_check=: \ + am__skip_mode_fix=: \ + distdir) \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-recursive +all-am: Makefile $(PROGRAMS) $(MANS) +installdirs: installdirs-recursive +installdirs-am: + for dir in "$(DESTDIR)$(bindir)" "$(DESTDIR)$(man1dir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ + done +install: install-recursive +install-exec: install-exec-recursive +install-data: install-data-recursive +uninstall: uninstall-recursive + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-recursive +install-strip: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-recursive + +clean-am: clean-binPROGRAMS clean-generic mostlyclean-am + +distclean: distclean-recursive + -rm -f ./$(DEPDIR)/pink.Po + -rm -f ./$(DEPDIR)/speaker-test.Po + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-recursive + +dvi-am: + +html: html-recursive + +html-am: + +info: info-recursive + +info-am: + +install-data-am: install-man + +install-dvi: install-dvi-recursive + +install-dvi-am: + +install-exec-am: install-binPROGRAMS + +install-html: install-html-recursive + +install-html-am: + +install-info: install-info-recursive + +install-info-am: + +install-man: install-man1 + +install-pdf: install-pdf-recursive + +install-pdf-am: + +install-ps: install-ps-recursive + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-recursive + -rm -f ./$(DEPDIR)/pink.Po + -rm -f ./$(DEPDIR)/speaker-test.Po + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-recursive + +mostlyclean-am: mostlyclean-compile mostlyclean-generic + +pdf: pdf-recursive + +pdf-am: + +ps: ps-recursive + +ps-am: + +uninstall-am: uninstall-binPROGRAMS uninstall-man + +uninstall-man: uninstall-man1 + +.MAKE: $(am__recursive_targets) install-am install-strip + +.PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am \ + am--depfiles check check-am clean clean-binPROGRAMS \ + clean-generic cscopelist-am ctags ctags-am distclean \ + distclean-compile distclean-generic distclean-tags distdir dvi \ + dvi-am html html-am info info-am install install-am \ + install-binPROGRAMS install-data install-data-am install-dvi \ + install-dvi-am install-exec install-exec-am install-html \ + install-html-am install-info install-info-am install-man \ + install-man1 install-pdf install-pdf-am install-ps \ + install-ps-am install-strip installcheck installcheck-am \ + installdirs installdirs-am maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-compile \ + mostlyclean-generic pdf pdf-am ps ps-am tags tags-am uninstall \ + uninstall-am uninstall-binPROGRAMS uninstall-man \ + uninstall-man1 + +.PRECIOUS: Makefile + + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/speaker-test/pink.c b/speaker-test/pink.c new file mode 100644 index 0000000..ef30755 --- /dev/null +++ b/speaker-test/pink.c @@ -0,0 +1,96 @@ +/* + patest_pink.c + + generate Pink Noise using Gardner method. + Optimization suggested by James McCartney uses a tree + to select which random value to replace. + + x x x x x x x x x x x x x x x x + x x x x x x x x + x x x x + x x + x + + Tree is generated by counting trailing zeros in an increasing index. + When the index is zero, no random number is selected. + + This program uses the Portable Audio library which is under development. + For more information see: http://www.audiomulch.com/portaudio/ + + Author: Phil Burk, http://www.softsynth.com + + Revision History: + + Copyleft 1999 Phil Burk - No rights reserved. +*/ + +#include +#include +#include "pink.h" + +/************************************************************/ +/* Calculate pseudo-random 32 bit number based on linear congruential method. */ +static unsigned long generate_random_number( void ) +{ + static unsigned long rand_seed = 22222; /* Change this for different random sequences. */ + rand_seed = (rand_seed * 196314165) + 907633515; + return rand_seed; +} + +/* Setup PinkNoise structure for N rows of generators. */ +void initialize_pink_noise( pink_noise_t *pink, int num_rows ) +{ + int i; + long pmax; + pink->pink_index = 0; + pink->pink_index_mask = (1<pink_scalar = 1.0f / pmax; +/* Initialize rows. */ + for( i=0; ipink_rows[i] = 0; + pink->pink_running_sum = 0; +} + +/* generate Pink noise values between -1.0 and +1.0 */ +float generate_pink_noise_sample( pink_noise_t *pink ) +{ + long new_random; + long sum; + float output; + +/* Increment and mask index. */ + pink->pink_index = (pink->pink_index + 1) & pink->pink_index_mask; + +/* If index is zero, don't update any random values. */ + if( pink->pink_index != 0 ) + { + /* Determine how many trailing zeros in PinkIndex. */ + /* This algorithm will hang if n==0 so test first. */ + int num_zeros = 0; + int n = pink->pink_index; + while( (n & 1) == 0 ) + { + n = n >> 1; + num_zeros++; + } + + /* Replace the indexed ROWS random value. + * Subtract and add back to Running_sum instead of adding all the random + * values together. Only one changes each time. + */ + pink->pink_running_sum -= pink->pink_rows[num_zeros]; + new_random = ((long)generate_random_number()) >> PINK_RANDOM_SHIFT; + pink->pink_running_sum += new_random; + pink->pink_rows[num_zeros] = new_random; + } + +/* Add extra white noise value. */ + new_random = ((long)generate_random_number()) >> PINK_RANDOM_SHIFT; + sum = pink->pink_running_sum + new_random; + +/* Scale to range of -1.0 to 0.9999. */ + output = pink->pink_scalar * sum; + + return output; +} diff --git a/speaker-test/pink.h b/speaker-test/pink.h new file mode 100644 index 0000000..0d17f7a --- /dev/null +++ b/speaker-test/pink.h @@ -0,0 +1,15 @@ +#define PINK_MAX_RANDOM_ROWS (30) +#define PINK_RANDOM_BITS (24) +#define PINK_RANDOM_SHIFT ((sizeof(long)*8)-PINK_RANDOM_BITS) + +typedef struct +{ + long pink_rows[PINK_MAX_RANDOM_ROWS]; + long pink_running_sum; /* Used to optimize summing of generators. */ + int pink_index; /* Incremented each sample. */ + int pink_index_mask; /* Index wrapped by ANDing with this mask. */ + float pink_scalar; /* Used to scale within range of -1.0 to +1.0 */ +} pink_noise_t; + +void initialize_pink_noise( pink_noise_t *pink, int num_rows ); +float generate_pink_noise_sample( pink_noise_t *pink ); diff --git a/speaker-test/readme.txt b/speaker-test/readme.txt new file mode 100644 index 0000000..6774fe0 --- /dev/null +++ b/speaker-test/readme.txt @@ -0,0 +1,12 @@ +To make or build just type + +make + +To test: - +1) Just stereo sound from one stereo jack: - +./speaker-test -Dplug:front -c2 +2) A 4 speaker setup from two stereo jacks: - +./speaker-test -Dplug:surround40 -c4 +3) A 5.1 speaker setup from three stereo jacks: - +./speaker-test -Dplug:surround51 -c6 + diff --git a/speaker-test/samples/Front_Center.wav b/speaker-test/samples/Front_Center.wav new file mode 100644 index 0000000..4f12180 Binary files /dev/null and b/speaker-test/samples/Front_Center.wav differ diff --git a/speaker-test/samples/Front_Left.wav b/speaker-test/samples/Front_Left.wav new file mode 100644 index 0000000..9d6ebdd Binary files /dev/null and b/speaker-test/samples/Front_Left.wav differ diff --git a/speaker-test/samples/Front_Right.wav b/speaker-test/samples/Front_Right.wav new file mode 100644 index 0000000..441565c Binary files /dev/null and b/speaker-test/samples/Front_Right.wav differ diff --git a/speaker-test/samples/Makefile.am b/speaker-test/samples/Makefile.am new file mode 100644 index 0000000..8cc3546 --- /dev/null +++ b/speaker-test/samples/Makefile.am @@ -0,0 +1,20 @@ +sounddir = $(datadir)/sounds/alsa +wav_files = Front_Left.wav \ + Rear_Center.wav \ + Rear_Right.wav \ + Side_Right.wav \ + Front_Center.wav \ + Front_Right.wav \ + Noise.wav \ + Rear_Left.wav \ + Side_Left.wav +sound_DATA = $(wav_files) + +alsadir = $(datadir)/alsa/speaker-test +cfg_files = sample_map.csv + +alsa_DATA = $(cfg_files) + +EXTRA_DIST = \ + $(wav_files) \ + $(cfg_files) diff --git a/speaker-test/samples/Makefile.in b/speaker-test/samples/Makefile.in new file mode 100644 index 0000000..6d61352 --- /dev/null +++ b/speaker-test/samples/Makefile.in @@ -0,0 +1,562 @@ +# Makefile.in generated by automake 1.16.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994-2018 Free Software Foundation, Inc. + +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +VPATH = @srcdir@ +am__is_gnu_make = { \ + if test -z '$(MAKELEVEL)'; then \ + false; \ + elif test -n '$(MAKE_HOST)'; then \ + true; \ + elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ + true; \ + else \ + false; \ + fi; \ +} +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + esac; \ + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +subdir = speaker-test/samples +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/gettext.m4 \ + $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/lib-ld.m4 \ + $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ + $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \ + $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/acinclude.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/include/aconfig.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = +SOURCES = +DIST_SOURCES = +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; +am__vpath_adj = case $$p in \ + $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ + *) f=$$p;; \ + esac; +am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; +am__install_max = 40 +am__nobase_strip_setup = \ + srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` +am__nobase_strip = \ + for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" +am__nobase_list = $(am__nobase_strip_setup); \ + for p in $$list; do echo "$$p $$p"; done | \ + sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ + $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ + if (++n[$$2] == $(am__install_max)) \ + { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ + END { for (dir in files) print dir, files[dir] }' +am__base_list = \ + sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ + sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' +am__uninstall_files_from_dir = { \ + test -z "$$files" \ + || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ + || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ + $(am__cd) "$$dir" && rm -f $$files; }; \ + } +am__installdirs = "$(DESTDIR)$(alsadir)" "$(DESTDIR)$(sounddir)" +DATA = $(alsa_DATA) $(sound_DATA) +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) +am__DIST_COMMON = $(srcdir)/Makefile.in +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +ALSACTL_DAEMONSWITCH = @ALSACTL_DAEMONSWITCH@ +ALSACTL_PIDFILE_DIR = @ALSACTL_PIDFILE_DIR@ +ALSA_CFLAGS = @ALSA_CFLAGS@ +ALSA_LIBS = @ALSA_LIBS@ +ALSA_TOPOLOGY_LIBS = @ALSA_TOPOLOGY_LIBS@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +ASOUND_LOCK_DIR = @ASOUND_LOCK_DIR@ +ASOUND_STATE_DIR = @ASOUND_STATE_DIR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CURSESINC = @CURSESINC@ +CURSESLIB = @CURSESLIB@ +CURSES_CFLAGS = @CURSES_CFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +FFTW_CFLAGS = @FFTW_CFLAGS@ +FFTW_INC = @FFTW_INC@ +FFTW_LIB = @FFTW_LIB@ +GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ +GMSGFMT = @GMSGFMT@ +GMSGFMT_015 = @GMSGFMT_015@ +GREP = @GREP@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +INTLLIBS = @INTLLIBS@ +INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@ +LDFLAGS = @LDFLAGS@ +LIBICONV = @LIBICONV@ +LIBINTL = @LIBINTL@ +LIBOBJS = @LIBOBJS@ +LIBRT = @LIBRT@ +LIBS = @LIBS@ +LN_S = @LN_S@ +LTLIBICONV = @LTLIBICONV@ +LTLIBINTL = @LTLIBINTL@ +LTLIBOBJS = @LTLIBOBJS@ +MAINT = @MAINT@ +MAKEINFO = @MAKEINFO@ +MKDIR_P = @MKDIR_P@ +MSGFMT = @MSGFMT@ +MSGFMT_015 = @MSGFMT_015@ +MSGMERGE = @MSGMERGE@ +NCURSESW_CFLAGS = @NCURSESW_CFLAGS@ +NCURSESW_LIBS = @NCURSESW_LIBS@ +NCURSES_CFLAGS = @NCURSES_CFLAGS@ +NCURSES_LIBS = @NCURSES_LIBS@ +OBJEXT = @OBJEXT@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ +POSUB = @POSUB@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +SND_UTIL_MAJOR = @SND_UTIL_MAJOR@ +SND_UTIL_MINOR = @SND_UTIL_MINOR@ +SND_UTIL_SUBMINOR = @SND_UTIL_SUBMINOR@ +SND_UTIL_VERSION = @SND_UTIL_VERSION@ +STRIP = @STRIP@ +SYSTEMD_CFLAGS = @SYSTEMD_CFLAGS@ +SYSTEMD_LIBS = @SYSTEMD_LIBS@ +TESTSOUND = @TESTSOUND@ +USE_NLS = @USE_NLS@ +VERSION = @VERSION@ +XGETTEXT = @XGETTEXT@ +XGETTEXT_015 = @XGETTEXT_015@ +XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_CC = @ac_ct_CC@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +mydatadir = @mydatadir@ +ncurses5_config = @ncurses5_config@ +ncursesw5_config = @ncursesw5_config@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +rst2man_available = @rst2man_available@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +systemdsystemunitdir = @systemdsystemunitdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +udevrulesdir = @udevrulesdir@ +xmlto_available = @xmlto_available@ +sounddir = $(datadir)/sounds/alsa +wav_files = Front_Left.wav \ + Rear_Center.wav \ + Rear_Right.wav \ + Side_Right.wav \ + Front_Center.wav \ + Front_Right.wav \ + Noise.wav \ + Rear_Left.wav \ + Side_Left.wav + +sound_DATA = $(wav_files) +alsadir = $(datadir)/alsa/speaker-test +cfg_files = sample_map.csv +alsa_DATA = $(cfg_files) +EXTRA_DIST = \ + $(wav_files) \ + $(cfg_files) + +all: all-am + +.SUFFIXES: +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign speaker-test/samples/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --foreign speaker-test/samples/Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): +install-alsaDATA: $(alsa_DATA) + @$(NORMAL_INSTALL) + @list='$(alsa_DATA)'; test -n "$(alsadir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(alsadir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(alsadir)" || exit 1; \ + fi; \ + for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + echo "$$d$$p"; \ + done | $(am__base_list) | \ + while read files; do \ + echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(alsadir)'"; \ + $(INSTALL_DATA) $$files "$(DESTDIR)$(alsadir)" || exit $$?; \ + done + +uninstall-alsaDATA: + @$(NORMAL_UNINSTALL) + @list='$(alsa_DATA)'; test -n "$(alsadir)" || list=; \ + files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ + dir='$(DESTDIR)$(alsadir)'; $(am__uninstall_files_from_dir) +install-soundDATA: $(sound_DATA) + @$(NORMAL_INSTALL) + @list='$(sound_DATA)'; test -n "$(sounddir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(sounddir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(sounddir)" || exit 1; \ + fi; \ + for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + echo "$$d$$p"; \ + done | $(am__base_list) | \ + while read files; do \ + echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(sounddir)'"; \ + $(INSTALL_DATA) $$files "$(DESTDIR)$(sounddir)" || exit $$?; \ + done + +uninstall-soundDATA: + @$(NORMAL_UNINSTALL) + @list='$(sound_DATA)'; test -n "$(sounddir)" || list=; \ + files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ + dir='$(DESTDIR)$(sounddir)'; $(am__uninstall_files_from_dir) +tags TAGS: + +ctags CTAGS: + +cscope cscopelist: + + +distdir: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) distdir-am + +distdir-am: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(DATA) +installdirs: + for dir in "$(DESTDIR)$(alsadir)" "$(DESTDIR)$(sounddir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ + done +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic mostlyclean-am + +distclean: distclean-am + -rm -f Makefile +distclean-am: clean-am distclean-generic + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: install-alsaDATA install-soundDATA + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-generic + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-alsaDATA uninstall-soundDATA + +.MAKE: install-am install-strip + +.PHONY: all all-am check check-am clean clean-generic cscopelist-am \ + ctags-am distclean distclean-generic distdir dvi dvi-am html \ + html-am info info-am install install-alsaDATA install-am \ + install-data install-data-am install-dvi install-dvi-am \ + install-exec install-exec-am install-html install-html-am \ + install-info install-info-am install-man install-pdf \ + install-pdf-am install-ps install-ps-am install-soundDATA \ + install-strip installcheck installcheck-am installdirs \ + maintainer-clean maintainer-clean-generic mostlyclean \ + mostlyclean-generic pdf pdf-am ps ps-am tags-am uninstall \ + uninstall-alsaDATA uninstall-am uninstall-soundDATA + +.PRECIOUS: Makefile + + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/speaker-test/samples/Noise.wav b/speaker-test/samples/Noise.wav new file mode 100644 index 0000000..1898d34 Binary files /dev/null and b/speaker-test/samples/Noise.wav differ diff --git a/speaker-test/samples/Rear_Center.wav b/speaker-test/samples/Rear_Center.wav new file mode 100644 index 0000000..ee2c6da Binary files /dev/null and b/speaker-test/samples/Rear_Center.wav differ diff --git a/speaker-test/samples/Rear_Left.wav b/speaker-test/samples/Rear_Left.wav new file mode 100644 index 0000000..57d0311 Binary files /dev/null and b/speaker-test/samples/Rear_Left.wav differ diff --git a/speaker-test/samples/Rear_Right.wav b/speaker-test/samples/Rear_Right.wav new file mode 100644 index 0000000..692e646 Binary files /dev/null and b/speaker-test/samples/Rear_Right.wav differ diff --git a/speaker-test/samples/Side_Left.wav b/speaker-test/samples/Side_Left.wav new file mode 100644 index 0000000..9741f2c Binary files /dev/null and b/speaker-test/samples/Side_Left.wav differ diff --git a/speaker-test/samples/Side_Right.wav b/speaker-test/samples/Side_Right.wav new file mode 100644 index 0000000..b0e5b3a Binary files /dev/null and b/speaker-test/samples/Side_Right.wav differ diff --git a/speaker-test/samples/sample_map.csv b/speaker-test/samples/sample_map.csv new file mode 100644 index 0000000..20d8ed2 --- /dev/null +++ b/speaker-test/samples/sample_map.csv @@ -0,0 +1,2 @@ +0, "Front Left", "/usr/share/alsa/samples/Front_Left.wav" +1, "Front Right", "/usr/share/alsa/samples/Front_Right.wav" diff --git a/speaker-test/speaker-test.1 b/speaker-test/speaker-test.1 new file mode 100644 index 0000000..add6b21 --- /dev/null +++ b/speaker-test/speaker-test.1 @@ -0,0 +1,182 @@ +.\" -*- nroff -*- +.\" macros +.de EX \" Begin Example +. IP +. ft CW +. nf +. ne \\$1 +.. +.de EE \" End Example +. ft P +. fi +. PP +.. +.TH SPEAKER\-TEST 1 "April 2nd, 2011" speaker\-test +.SH NAME +speaker\-test \- command\-line speaker test tone generator for ALSA +.SH SYNOPSIS +.B speaker\-test [\-options] + +.SH DESCRIPTION +\fBspeaker\-test\fP generates a tone that can be used to test the speakers of a computer. + +\fBspeaker\-test\fP by default will test the \fIdefault\fP device. If you +want to test another sound device you will have first to get a list of +all of the sound cards in your system and the devices associated with +those cards. Notice that there might be for example, one device for +analog sound, one for digital sound and one for HDMI sound. +To get the list of available cards and devices you can run \fBaplay \-L\fR. + +.P \fBaplay\fR's output will be similar to this one: + +.nf +$ aplay \-L +null + Discard all samples (playback) or generate zero samples (capture) +default:CARD=ICH5 + Intel ICH5, Intel ICH5 + Default Audio Device +front:CARD=ICH5,DEV=0 + Intel ICH5, Intel ICH5 + Front speakers +surround40:CARD=ICH5,DEV=0 + Intel ICH5, Intel ICH5 + 4.0 Surround output to Front and Rear speakers +(...) +.fi + +.P Each of the devices is listed in the beginning of the definition so, +in the above example, there are four devices listed: null, default, front +and surround40. So, if you want to test the last device you can +run \fBspeaker\-test \-Dsurround40:ICH5 \-c 6\fR. The \fB\-c\fR option will +indicate that the six audio channels in the device have to be tested. + + + + + +.SH OPTIONS + +.TP +\fB\-c\fP | \fB\-\-channels\fP \fINUM\fP +\fINUM\fP channels in stream + +.TP +\fB\-D\fP | \fB\-\-device\fP \fINAME\fP +PCM device name \fINAME\fP + +.TP +\fB\-f\fP | \fB\-\-frequency\fP \fIFREQ\fP +sine wave of \fIFREQ\fP Hz + +.TP +\fB\-\-help\fP +Print usage help + +.TP +\fB\-b\fP | \fB\-\-buffer\fP \fITIME\fP +Use buffer size of \fITIME\fP microseconds. +When 0 is given, use the maximal buffer size. +The default value is 0. + +.TP +\fB\-p\fP | \fB\-\-period\fP \fITIME\fP +Use period size of \fITIME\fP microseconds. +When 0 is given, the periods given by \fB\-P\fP option is used. +The default value is 0. + +.TP +\fB\-P\fP | \fB\-\-nperiods\fP \fIPERIODS\fP +Use number of periods. The default value is 4. + +.TP +\fB\-r\fP | \fB\-\-rate\fP \fIRATE\fP +stream of \fIRATE\fP Hz + +.TP +\fB\-t\fP | \fB\-\-test\fP \fBpink\fP|\fBsine\fP|\fBwav\fP +\fB\-t pink\fP means use pink noise (default). + +Pink noise is perceptually uniform noise -- that is, it sounds like every frequency at once. If you can hear any tone it may indicate resonances in your speaker system or room. + +\fB\-t sine\fP means to use sine wave. + +\fB\-t wav\fP means to play WAV files, either pre-defined files or given via \fB\-w\fP option. + +You can pass the number from 1 to 3 as a backward compatibility. + +.TP +\fB\-l\fP | \fB\-\-nloops\fP \fICOUNT\fP + +Specifies the number of loops. Zero means to run infinitely. + +When \fB\-s\fP option below with a valid channel is given, \fBspeaker\-test\fP will perform +always a single-shot without looping. + +.TP +\fB\-s\fP | \fB\-\-speaker\fP \fICHANNEL\fP +Do a single-shot speaker test for the given channel. The channel number starts from 1. +The channel number corresponds to left, right, rear-left, rear-right, center, LFE, +side-left, side-right, and so on. + +For example, when 1 is passed, it tests the left channel only once rather than both channels +with looping. + +.TP +\fB\-w\fP | \fB\-\-wavfile\fP \fIFILE\fP +Use the given WAV file for the playback instead of pre-defined WAV files. + +.TP +\fB\-W\fP | \fB\-\-wavdir\fP \fIDIRECTORY\fP +Specify the directory containing WAV files for playback. +The default path is \fI/usr/share/sounds/alsa\fP. + +.TP +\fB\-m\fP | \fB\-\-chmap\fP \fIMAP\fP +Pass the channel map to override. +If the playback in a specific channel order or channel positions is +required, pass the channel position strings to this option. + +.TP +\fB\-X\fP | \fB\-\-force-frequency\fP +Allow supplied \fIFREQ\fP to be outside the default range of 30-8000Hz. A minimum of 1Hz is still enforced. + +.SH USAGE EXAMPLES + +Produce stereo sound from one stereo jack: +.EX + speaker\-test \-Dplug:front \-c2 +.EE + +Produce 4 speaker sound from two stereo jacks: +.EX + speaker\-test \-Dplug:surround40 \-c4 +.EE + +Produce 5.1 speaker sound from three stereo jacks: +.EX + speaker\-test \-Dplug:surround51 \-c6 +.EE + +To send a nice low 75Hz tone to the Woofer and then exit without touching any other speakers: +.EX + speaker\-test \-Dplug:surround51 \-c6 \-s1 \-f75 +.EE + +To do a 2\-speaker test using the spdif (coax or optical) output: +.EX + speaker\-test \-Dplug:spdif \-c2 +.EE + +Play in the order of front\-right and front-left from the front PCM +.EX + speaker\-test \-Dplug:front \-c2 \-mFR,FL +.EE + +.SH SEE ALSO +.BR aplay(1) + +.SH AUTHOR +The speaker\-test program was written by James Courtier-Dutton. +Pink noise support was added by Nathan Hurst. +Further extensions by Takashi Iwai. diff --git a/speaker-test/speaker-test.c b/speaker-test/speaker-test.c new file mode 100644 index 0000000..773af0a --- /dev/null +++ b/speaker-test/speaker-test.c @@ -0,0 +1,1250 @@ +/* + * Copyright (C) 2000-2004 James Courtier-Dutton + * Copyright (C) 2005 Nathan Hurst + * + * This file is part of the speaker-test tool. + * + * This small program sends a simple sinusoidal wave to your speakers. + * + * speaker-test is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * speaker-test is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + * + * + * Main program by James Courtier-Dutton (including some source code fragments from the alsa project.) + * Some cleanup from Daniel Caujolle-Bert + * Pink noise option added Nathan Hurst, + * based on generator by Phil Burk (pink.c) + * + * Changelog: + * 0.0.8 Added support for pink noise output. + * Changelog: + * 0.0.7 Added support for more than 6 channels. + * Changelog: + * 0.0.6 Added support for different sample formats. + * + * $Id: speaker_test.c,v 1.00 2003/11/26 19:43:38 jcdutton Exp $ + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define ALSA_PCM_NEW_HW_PARAMS_API +#define ALSA_PCM_NEW_SW_PARAMS_API +#include +#include +#include +#include "pink.h" +#include "aconfig.h" +#include "gettext.h" +#include "version.h" + +#ifdef ENABLE_NLS +#include +#endif + +#ifdef SND_CHMAP_API_VERSION +#define CONFIG_SUPPORT_CHMAP 1 +#endif + +enum { + TEST_PINK_NOISE = 1, + TEST_SINE, + TEST_WAV, + TEST_PATTERN, +}; + +#define MAX_CHANNELS 16 + +#if __BYTE_ORDER == __LITTLE_ENDIAN +#define COMPOSE_ID(a,b,c,d) ((a) | ((b)<<8) | ((c)<<16) | ((d)<<24)) +#define LE_SHORT(v) (v) +#define LE_INT(v) (v) +#define BE_SHORT(v) bswap_16(v) +#define BE_INT(v) bswap_32(v) +#else /* __BIG_ENDIAN */ +#define COMPOSE_ID(a,b,c,d) ((d) | ((c)<<8) | ((b)<<16) | ((a)<<24)) +#define LE_SHORT(v) bswap_16(v) +#define LE_INT(v) bswap_32(v) +#define BE_SHORT(v) (v) +#define BE_INT(v) (v) +#endif + +#define ARRAY_SIZE(x) (int)(sizeof(x)/sizeof(x[0])) + +static char *device = "default"; /* playback device */ +static snd_pcm_format_t format = SND_PCM_FORMAT_S16; /* sample format */ +static unsigned int rate = 48000; /* stream rate */ +static unsigned int channels = 1; /* count of channels */ +static unsigned int speaker = 0; /* count of channels */ +static unsigned int buffer_time = 0; /* ring buffer length in us */ +static unsigned int period_time = 0; /* period time in us */ +static unsigned int nperiods = 4; /* number of periods */ +static double freq = 440.0; /* sinusoidal wave frequency in Hz */ +static int test_type = TEST_PINK_NOISE; /* Test type. 1 = noise, 2 = sine wave */ +static float generator_scale = 0.8; /* Scale to use for sine volume */ +static snd_pcm_uframes_t buffer_size; +static snd_pcm_uframes_t period_size; +static const char *given_test_wav_file = NULL; +static char *wav_file_dir = SOUNDSDIR; +static int debug = 0; +static int force_frequency = 0; +static int in_aborting = 0; +static snd_pcm_t *pcm_handle = NULL; + +#ifdef CONFIG_SUPPORT_CHMAP +static snd_pcm_chmap_t *channel_map; +static int channel_map_set; +static int *ordered_channels; +#endif + +static const char *const channel_name[MAX_CHANNELS] = { + /* 0 */ N_("Front Left"), + /* 1 */ N_("Front Right"), + /* 2 */ N_("Rear Left"), + /* 3 */ N_("Rear Right"), + /* 4 */ N_("Center"), + /* 5 */ N_("LFE"), + /* 6 */ N_("Side Left"), + /* 7 */ N_("Side Right"), + /* 8 */ N_("Channel 9"), + /* 9 */ N_("Channel 10"), + /* 10 */ N_("Channel 11"), + /* 11 */ N_("Channel 12"), + /* 12 */ N_("Channel 13"), + /* 13 */ N_("Channel 14"), + /* 14 */ N_("Channel 15"), + /* 15 */ N_("Channel 16") +}; + +static const int channels4[] = { + 0, /* Front Left */ + 1, /* Front Right */ + 3, /* Rear Right */ + 2, /* Rear Left */ +}; +static const int channels6[] = { + 0, /* Front Left */ + 4, /* Center */ + 1, /* Front Right */ + 3, /* Rear Right */ + 2, /* Rear Left */ + 5, /* LFE */ +}; +static const int channels8[] = { + 0, /* Front Left */ + 4, /* Center */ + 1, /* Front Right */ + 7, /* Side Right */ + 3, /* Rear Right */ + 2, /* Rear Left */ + 6, /* Side Left */ + 5, /* LFE */ +}; + +#ifdef CONFIG_SUPPORT_CHMAP +/* circular clockwise and bottom-to-top order */ +static const int channel_order[] = { + [SND_CHMAP_FLW] = 10, + [SND_CHMAP_FL] = 20, + [SND_CHMAP_TFL] = 30, + [SND_CHMAP_FLC] = 40, + [SND_CHMAP_TFLC] = 50, + [SND_CHMAP_FC] = 60, + [SND_CHMAP_TFC] = 70, + [SND_CHMAP_FRC] = 80, + [SND_CHMAP_TFRC] = 90, + [SND_CHMAP_FR] = 100, + [SND_CHMAP_TFR] = 110, + [SND_CHMAP_FRW] = 120, + [SND_CHMAP_SR] = 130, + [SND_CHMAP_TSR] = 140, + [SND_CHMAP_RR] = 150, + [SND_CHMAP_TRR] = 160, + [SND_CHMAP_RRC] = 170, + [SND_CHMAP_RC] = 180, + [SND_CHMAP_TRC] = 190, + [SND_CHMAP_RLC] = 200, + [SND_CHMAP_RL] = 210, + [SND_CHMAP_TRL] = 220, + [SND_CHMAP_SL] = 230, + [SND_CHMAP_TSL] = 240, + [SND_CHMAP_BC] = 250, + [SND_CHMAP_TC] = 260, + [SND_CHMAP_LLFE] = 270, + [SND_CHMAP_LFE] = 280, + [SND_CHMAP_RLFE] = 290, + /* not in table = 10000 */ + [SND_CHMAP_UNKNOWN] = 20000, + [SND_CHMAP_NA] = 30000, +}; + +static int chpos_cmp(const void *chnum1p, const void *chnum2p) +{ + int chnum1 = *(int *)chnum1p; + int chnum2 = *(int *)chnum2p; + int chpos1 = channel_map->pos[chnum1]; + int chpos2 = channel_map->pos[chnum2]; + int weight1 = 10000; + int weight2 = 10000; + + if (chpos1 < ARRAY_SIZE(channel_order) && channel_order[chpos1]) + weight1 = channel_order[chpos1]; + if (chpos2 < ARRAY_SIZE(channel_order) && channel_order[chpos2]) + weight2 = channel_order[chpos2]; + + if (weight1 == weight2) { + /* order by channel number if both have the same position (e.g. UNKNOWN) + * or if neither is in channel_order[] */ + return chnum1 - chnum2; + } + + /* order according to channel_order[] */ + return weight1 - weight2; +} + +static int *order_channels(void) +{ + /* create a (playback order => channel number) table with channels ordered + * according to channel_order[] values */ + int i; + int *ordered_chs; + + ordered_chs = calloc(channel_map->channels, sizeof(*ordered_chs)); + if (!ordered_chs) + return NULL; + + for (i = 0; i < channel_map->channels; i++) + ordered_chs[i] = i; + + qsort(ordered_chs, channel_map->channels, sizeof(*ordered_chs), chpos_cmp); + + return ordered_chs; +} +#endif + +static int get_speaker_channel(int chn) +{ +#ifdef CONFIG_SUPPORT_CHMAP + if (channel_map_set || (ordered_channels && chn >= channel_map->channels)) + return chn; + if (ordered_channels) + return ordered_channels[chn]; +#endif + + switch (channels) { + case 4: + chn = channels4[chn]; + break; + case 6: + chn = channels6[chn]; + break; + case 8: + chn = channels8[chn]; + break; + } + + return chn; +} + +static const char *get_channel_name(int chn) +{ +#ifdef CONFIG_SUPPORT_CHMAP + if (channel_map) { + const char *name = NULL; + if (chn < channel_map->channels) + name = snd_pcm_chmap_long_name(channel_map->pos[chn]); + return name ? name : "Unknown"; + } +#endif + return gettext(channel_name[chn]); +} + +static const int supported_formats[] = { + SND_PCM_FORMAT_S8, + SND_PCM_FORMAT_S16_LE, + SND_PCM_FORMAT_S16_BE, + SND_PCM_FORMAT_FLOAT_LE, + SND_PCM_FORMAT_S24_3LE, + SND_PCM_FORMAT_S24_3BE, + SND_PCM_FORMAT_S32_LE, + SND_PCM_FORMAT_S32_BE, + -1 +}; + +typedef union { + float f; + int32_t i; +} value_t; + +static void do_generate(uint8_t *frames, int channel, int count, + value_t (*generate)(void *), void *arg) +{ + value_t res; + int chn; + int8_t *samp8 = (int8_t*) frames; + int16_t *samp16 = (int16_t*) frames; + int32_t *samp32 = (int32_t*) frames; + float *samp_f = (float*) frames; + + while (count-- > 0) { + for(chn=0;chn> 24; + break; + case SND_PCM_FORMAT_S16_LE: + *samp16++ = LE_SHORT(res.i >> 16); + break; + case SND_PCM_FORMAT_S16_BE: + *samp16++ = BE_SHORT(res.i >> 16); + break; + case SND_PCM_FORMAT_FLOAT_LE: + *samp_f++ = res.f; + break; + case SND_PCM_FORMAT_S24_3LE: + res.i >>= 8; + *samp8++ = LE_INT(res.i); + *samp8++ = LE_INT(res.i) >> 8; + *samp8++ = LE_INT(res.i) >> 16; + break; + case SND_PCM_FORMAT_S24_3BE: + res.i >>= 8; + *samp8++ = BE_INT(res.i); + *samp8++ = BE_INT(res.i) >> 8; + *samp8++ = BE_INT(res.i) >> 16; + break; + case SND_PCM_FORMAT_S32_LE: + *samp32++ = LE_INT(res.i); + break; + case SND_PCM_FORMAT_S32_BE: + *samp32++ = BE_INT(res.i); + break; + default: + ; + } + } + } +} + +/* + * Sine generator + */ +typedef struct { + double phase; + double max_phase; + double step; +} sine_t; + +static void init_sine(sine_t *sine) +{ + sine->phase = 0; + sine->max_phase = 1.0 / freq; + sine->step = 1.0 / (double)rate; +} + +static value_t generate_sine(void *arg) +{ + sine_t *sine = arg; + value_t res; + + res.f = sin((sine->phase * 2 * M_PI) / sine->max_phase - M_PI); + res.f *= generator_scale; + if (format != SND_PCM_FORMAT_FLOAT_LE) + res.i = res.f * INT32_MAX; + sine->phase += sine->step; + if (sine->phase >= sine->max_phase) + sine->phase -= sine->max_phase; + return res; +} + +/* Pink noise is a better test than sine wave because we can tell + * where pink noise is coming from more easily that a sine wave. + */ +static value_t generate_pink_noise(void *arg) +{ + pink_noise_t *pink = arg; + value_t res; + + res.f = generate_pink_noise_sample(pink) * generator_scale; + if (format != SND_PCM_FORMAT_FLOAT_LE) + res.i = res.f * INT32_MAX; + return res; +} + +/* + * useful for tests + */ +static value_t generate_pattern(void *arg) +{ + value_t res; + + res.i = *(int *)arg; + *(int *)arg = res.i + 1; + if (format != SND_PCM_FORMAT_FLOAT_LE) + res.f = (float)res.i / (float)INT32_MAX; + return res; +} + +static int set_hwparams(snd_pcm_t *handle, snd_pcm_hw_params_t *params, snd_pcm_access_t access) { + unsigned int rrate; + int err; + snd_pcm_uframes_t period_size_min; + snd_pcm_uframes_t period_size_max; + snd_pcm_uframes_t buffer_size_min; + snd_pcm_uframes_t buffer_size_max; + + /* choose all parameters */ + err = snd_pcm_hw_params_any(handle, params); + if (err < 0) { + fprintf(stderr, _("Broken configuration for playback: no configurations available: %s\n"), snd_strerror(err)); + return err; + } + + /* set the interleaved read/write format */ + err = snd_pcm_hw_params_set_access(handle, params, access); + if (err < 0) { + fprintf(stderr, _("Access type not available for playback: %s\n"), snd_strerror(err)); + return err; + } + + /* set the sample format */ + err = snd_pcm_hw_params_set_format(handle, params, format); + if (err < 0) { + fprintf(stderr, _("Sample format not available for playback: %s\n"), snd_strerror(err)); + return err; + } + + /* set the count of channels */ + err = snd_pcm_hw_params_set_channels(handle, params, channels); + if (err < 0) { + fprintf(stderr, _("Channels count (%i) not available for playbacks: %s\n"), channels, snd_strerror(err)); + return err; + } + + /* set the stream rate */ + rrate = rate; + err = snd_pcm_hw_params_set_rate(handle, params, rate, 0); + if (err < 0) { + fprintf(stderr, _("Rate %iHz not available for playback: %s\n"), rate, snd_strerror(err)); + return err; + } + + if (rrate != rate) { + fprintf(stderr, _("Rate doesn't match (requested %iHz, get %iHz, err %d)\n"), rate, rrate, err); + return -EINVAL; + } + + printf(_("Rate set to %iHz (requested %iHz)\n"), rrate, rate); + /* set the buffer time */ + err = snd_pcm_hw_params_get_buffer_size_min(params, &buffer_size_min); + err = snd_pcm_hw_params_get_buffer_size_max(params, &buffer_size_max); + err = snd_pcm_hw_params_get_period_size_min(params, &period_size_min, NULL); + err = snd_pcm_hw_params_get_period_size_max(params, &period_size_max, NULL); + printf(_("Buffer size range from %lu to %lu\n"),buffer_size_min, buffer_size_max); + printf(_("Period size range from %lu to %lu\n"),period_size_min, period_size_max); + if (period_time > 0) { + printf(_("Requested period time %u us\n"), period_time); + err = snd_pcm_hw_params_set_period_time_near(handle, params, &period_time, NULL); + if (err < 0) { + fprintf(stderr, _("Unable to set period time %u us for playback: %s\n"), + period_time, snd_strerror(err)); + return err; + } + } + if (buffer_time > 0) { + printf(_("Requested buffer time %u us\n"), buffer_time); + err = snd_pcm_hw_params_set_buffer_time_near(handle, params, &buffer_time, NULL); + if (err < 0) { + fprintf(stderr, _("Unable to set buffer time %u us for playback: %s\n"), + buffer_time, snd_strerror(err)); + return err; + } + } + if (! buffer_time && ! period_time) { + buffer_size = buffer_size_max; + if (! period_time) + buffer_size = (buffer_size / nperiods) * nperiods; + printf(_("Using max buffer size %lu\n"), buffer_size); + err = snd_pcm_hw_params_set_buffer_size_near(handle, params, &buffer_size); + if (err < 0) { + fprintf(stderr, _("Unable to set buffer size %lu for playback: %s\n"), + buffer_size, snd_strerror(err)); + return err; + } + } + if (! buffer_time || ! period_time) { + printf(_("Periods = %u\n"), nperiods); + err = snd_pcm_hw_params_set_periods_near(handle, params, &nperiods, NULL); + if (err < 0) { + fprintf(stderr, _("Unable to set nperiods %u for playback: %s\n"), + nperiods, snd_strerror(err)); + return err; + } + } + + /* write the parameters to device */ + err = snd_pcm_hw_params(handle, params); + if (err < 0) { + fprintf(stderr, _("Unable to set hw params for playback: %s\n"), snd_strerror(err)); + return err; + } + + snd_pcm_hw_params_get_buffer_size(params, &buffer_size); + snd_pcm_hw_params_get_period_size(params, &period_size, NULL); + printf(_("was set period_size = %lu\n"),period_size); + printf(_("was set buffer_size = %lu\n"),buffer_size); + if (2*period_size > buffer_size) { + fprintf(stderr, _("buffer to small, could not use\n")); + return -EINVAL; + } + + return 0; +} + +static int set_swparams(snd_pcm_t *handle, snd_pcm_sw_params_t *swparams) { + int err; + + /* get the current swparams */ + err = snd_pcm_sw_params_current(handle, swparams); + if (err < 0) { + fprintf(stderr, _("Unable to determine current swparams for playback: %s\n"), snd_strerror(err)); + return err; + } + + /* start the transfer when a buffer is full */ + err = snd_pcm_sw_params_set_start_threshold(handle, swparams, buffer_size); + if (err < 0) { + fprintf(stderr, _("Unable to set start threshold mode for playback: %s\n"), snd_strerror(err)); + return err; + } + + /* allow the transfer when at least period_size frames can be processed */ + err = snd_pcm_sw_params_set_avail_min(handle, swparams, period_size); + if (err < 0) { + fprintf(stderr, _("Unable to set avail min for playback: %s\n"), snd_strerror(err)); + return err; + } + + /* write the parameters to the playback device */ + err = snd_pcm_sw_params(handle, swparams); + if (err < 0) { + fprintf(stderr, _("Unable to set sw params for playback: %s\n"), snd_strerror(err)); + return err; + } + + return 0; +} + +#ifdef CONFIG_SUPPORT_CHMAP +static int config_chmap(snd_pcm_t *handle, const char *mapstr) +{ + int err; + + if (mapstr) { + channel_map = snd_pcm_chmap_parse_string(mapstr); + if (!channel_map) { + fprintf(stderr, _("Unable to parse channel map string: %s\n"), mapstr); + return -EINVAL; + } + err = snd_pcm_set_chmap(handle, channel_map); + if (err < 0) { + fprintf(stderr, _("Unable to set channel map: %s\n"), mapstr); + return err; + } + channel_map_set = 1; + return 0; + } + + channel_map = snd_pcm_get_chmap(handle); + + /* create a channel order table for default layouts */ + if (channel_map) + ordered_channels = order_channels(); + + return 0; +} +#endif + +/* + * Underrun and suspend recovery + */ + +static int xrun_recovery(snd_pcm_t *handle, int err) { + if (err == -EPIPE) { /* under-run */ + err = snd_pcm_prepare(handle); + if (err < 0) + fprintf(stderr, _("Can't recovery from underrun, prepare failed: %s\n"), snd_strerror(err)); + return 0; + } + else if (err == -ESTRPIPE) { + + while ((err = snd_pcm_resume(handle)) == -EAGAIN) + sleep(1); /* wait until the suspend flag is released */ + + if (err < 0) { + err = snd_pcm_prepare(handle); + if (err < 0) + fprintf(stderr, _("Can't recovery from suspend, prepare failed: %s\n"), snd_strerror(err)); + } + + return 0; + } + + return err; +} + +/* + * Handle WAV files + */ + +static const char *wav_file[MAX_CHANNELS]; +static int wav_file_size[MAX_CHANNELS]; + +struct wave_header { + struct { + uint32_t magic; + uint32_t length; + uint32_t type; + } hdr; + struct { + uint32_t type; + uint32_t length; + } chunk1; + struct { + uint16_t format; + uint16_t channels; + uint32_t rate; + uint32_t bytes_per_sec; + uint16_t sample_size; + uint16_t sample_bits; + } body; + struct { + uint32_t type; + uint32_t length; + } chunk; +}; + +#define WAV_RIFF COMPOSE_ID('R','I','F','F') +#define WAV_WAVE COMPOSE_ID('W','A','V','E') +#define WAV_FMT COMPOSE_ID('f','m','t',' ') +#define WAV_DATA COMPOSE_ID('d','a','t','a') +#define WAV_PCM_CODE 1 + +static const char *search_for_file(const char *name) +{ + char *file; + if (*name == '/') + return strdup(name); + file = malloc(strlen(wav_file_dir) + strlen(name) + 2); + if (file) + sprintf(file, "%s/%s", wav_file_dir, name); + return file; +} + +static int check_wav_file(int channel, const char *name) +{ + struct wave_header header; + int fd; + + wav_file[channel] = search_for_file(name); + if (! wav_file[channel]) { + fprintf(stderr, _("No enough memory\n")); + return -ENOMEM; + } + + if ((fd = open(wav_file[channel], O_RDONLY)) < 0) { + fprintf(stderr, _("Cannot open WAV file %s\n"), wav_file[channel]); + return -EINVAL; + } + if (read(fd, &header, sizeof(header)) < (int)sizeof(header)) { + fprintf(stderr, _("Invalid WAV file %s\n"), wav_file[channel]); + goto error; + } + + if (header.hdr.magic != WAV_RIFF || header.hdr.type != WAV_WAVE) { + fprintf(stderr, _("Not a WAV file: %s\n"), wav_file[channel]); + goto error; + } + if (header.body.format != LE_SHORT(WAV_PCM_CODE)) { + fprintf(stderr, _("Unsupported WAV format %d for %s\n"), + LE_SHORT(header.body.format), wav_file[channel]); + goto error; + } + if (header.body.channels != LE_SHORT(1)) { + fprintf(stderr, _("%s is not a mono stream (%d channels)\n"), + wav_file[channel], LE_SHORT(header.body.channels)); + goto error; + } + if (header.body.rate != LE_INT(rate)) { + fprintf(stderr, _("Sample rate doesn't match (%d) for %s\n"), + LE_INT(header.body.rate), wav_file[channel]); + goto error; + } + if (header.body.sample_bits != LE_SHORT(16)) { + fprintf(stderr, _("Unsupported sample format bits %d for %s\n"), + LE_SHORT(header.body.sample_bits), wav_file[channel]); + goto error; + } + if (header.chunk.type != WAV_DATA) { + fprintf(stderr, _("Invalid WAV file %s\n"), wav_file[channel]); + goto error; + } + wav_file_size[channel] = LE_INT(header.chunk.length); + close(fd); + return 0; + + error: + close(fd); + return -EINVAL; +} + +static int setup_wav_file(int chn) +{ + static const char *const wavs[MAX_CHANNELS] = { + "Front_Left.wav", + "Front_Right.wav", + "Rear_Left.wav", + "Rear_Right.wav", + "Front_Center.wav", + "Rear_Center.wav", /* FIXME: should be "Bass" or so */ + "Side_Left.wav", + "Side_Right.wav", + "Channel_9.wav", + "Channel_10.wav", + "Channel_11.wav", + "Channel_12.wav", + "Channel_13.wav", + "Channel_14.wav", + "Channel_15.wav", + "Channel_16.wav" + }; + + if (given_test_wav_file) + return check_wav_file(chn, given_test_wav_file); + +#ifdef CONFIG_SUPPORT_CHMAP + if (channel_map && chn < channel_map->channels) { + int channel = channel_map->pos[chn] - SND_CHMAP_FL; + if (channel >= 0 && channel < MAX_CHANNELS) + return check_wav_file(chn, wavs[channel]); + } +#endif + + return check_wav_file(chn, wavs[chn]); +} + +static int read_wav(uint16_t *buf, int channel, int offset, int bufsize) +{ + static FILE *wavfp = NULL; + int size; + + if (in_aborting) + return -EFAULT; + + if (! wav_file[channel]) { + fprintf(stderr, _("Undefined channel %d\n"), channel); + return -EINVAL; + } + + if (offset >= wav_file_size[channel]) + return 0; /* finished */ + + if (! offset) { + if (wavfp) + fclose(wavfp); + wavfp = fopen(wav_file[channel], "r"); + if (! wavfp) + return -errno; + if (fseek(wavfp, sizeof(struct wave_header), SEEK_SET) < 0) + return -errno; + } + if (offset + bufsize > wav_file_size[channel]) + bufsize = wav_file_size[channel] - offset; + bufsize /= channels; + for (size = 0; size < bufsize; size += 2) { + int chn; + for (chn = 0; chn < channels; chn++) { + if (chn == channel) { + if (fread(buf, 2, 1, wavfp) != 1) + return size; + } + else + *buf = 0; + buf++; + } + } + return size; +} + + +/* + * Transfer method - write only + */ + +static int write_buffer(snd_pcm_t *handle, uint8_t *ptr, int cptr) +{ + int err; + + while (cptr > 0 && !in_aborting) { + + err = snd_pcm_writei(handle, ptr, cptr); + + if (err == -EAGAIN) + continue; + + if (err < 0) { + fprintf(stderr, _("Write error: %d,%s\n"), err, snd_strerror(err)); + if ((err = xrun_recovery(handle, err)) < 0) { + fprintf(stderr, _("xrun_recovery failed: %d,%s\n"), err, snd_strerror(err)); + return err; + } + break; /* skip one period */ + } + + ptr += snd_pcm_frames_to_bytes(handle, err); + cptr -= err; + } + return 0; +} + +static int pattern; +static sine_t sine; +static pink_noise_t pink; + +static void init_loop(void) +{ + switch (test_type) { + case TEST_PINK_NOISE: + initialize_pink_noise(&pink, 16); + break; + case TEST_SINE: + init_sine(&sine); + break; + case TEST_PATTERN: + pattern = 0; + break; + } +} + +static int write_loop(snd_pcm_t *handle, int channel, int periods, uint8_t *frames) +{ + int err, n; + + fflush(stdout); + if (test_type == TEST_WAV) { + int bufsize = snd_pcm_frames_to_bytes(handle, period_size); + n = 0; + while ((err = read_wav((uint16_t *)frames, channel, n, bufsize)) > 0 && !in_aborting) { + n += err; + if ((err = write_buffer(handle, frames, + snd_pcm_bytes_to_frames(handle, err * channels))) < 0) + break; + } + if (buffer_size > n && !in_aborting) { + snd_pcm_drain(handle); + snd_pcm_prepare(handle); + } + return err; + } + + + if (periods <= 0) + periods = 1; + + for(n = 0; n < periods && !in_aborting; n++) { + if (test_type == TEST_PINK_NOISE) + do_generate(frames, channel, period_size, generate_pink_noise, &pink); + else if (test_type == TEST_PATTERN) + do_generate(frames, channel, period_size, generate_pattern, &pattern); + else + do_generate(frames, channel, period_size, generate_sine, &sine); + + if ((err = write_buffer(handle, frames, period_size)) < 0) + return err; + } + if (buffer_size > n * period_size && !in_aborting) { + snd_pcm_drain(handle); + snd_pcm_prepare(handle); + } + return 0; +} + +static int prg_exit(int code) +{ + if (pcm_handle) + snd_pcm_close(pcm_handle); + exit(code); + return code; +} + +static void signal_handler(int sig) +{ + if (in_aborting) + return; + + in_aborting = 1; + + if (pcm_handle) + snd_pcm_abort(pcm_handle); + if (sig == SIGABRT) { + pcm_handle = NULL; + prg_exit(EXIT_FAILURE); + } + signal(sig, signal_handler); +} + +static void help(void) +{ + const int *fmt; + + printf( + _("Usage: speaker-test [OPTION]... \n" + "-h,--help help\n" + "-D,--device playback device\n" + "-r,--rate stream rate in Hz\n" + "-c,--channels count of channels in stream\n" + "-f,--frequency sine wave frequency in Hz\n" + "-F,--format sample format\n" + "-b,--buffer ring buffer size in us\n" + "-p,--period period size in us\n" + "-P,--nperiods number of periods\n" + "-t,--test pink=use pink noise, sine=use sine wave, wav=WAV file\n" + "-l,--nloops specify number of loops to test, 0 = infinite\n" + "-s,--speaker single speaker test. Values 1=Left, 2=right, etc\n" + "-w,--wavfile Use the given WAV file as a test sound\n" + "-W,--wavdir Specify the directory containing WAV files\n" + "-m,--chmap Specify the channel map to override\n" + "-X,--force-frequency force frequencies outside the 30-8000hz range\n" + "-S,--scale Scale of generated test tones in percent (default=80)\n" + "\n")); + printf(_("Recognized sample formats are:")); + for (fmt = supported_formats; *fmt >= 0; fmt++) { + const char *s = snd_pcm_format_name(*fmt); + if (s) + printf(" %s", s); + } + + printf("\n\n"); +} + +int main(int argc, char *argv[]) { + snd_pcm_t *handle; + int err, morehelp; + snd_pcm_hw_params_t *hwparams; + snd_pcm_sw_params_t *swparams; + uint8_t *frames; + int chn; + const int *fmt; + double time1,time2,time3; + unsigned int n, nloops; + struct timeval tv1,tv2; + int speakeroptset = 0; +#ifdef CONFIG_SUPPORT_CHMAP + const char *chmap = NULL; +#endif + + static const struct option long_option[] = { + {"help", 0, NULL, 'h'}, + {"device", 1, NULL, 'D'}, + {"rate", 1, NULL, 'r'}, + {"channels", 1, NULL, 'c'}, + {"frequency", 1, NULL, 'f'}, + {"format", 1, NULL, 'F'}, + {"buffer", 1, NULL, 'b'}, + {"period", 1, NULL, 'p'}, + {"nperiods", 1, NULL, 'P'}, + {"test", 1, NULL, 't'}, + {"nloops", 1, NULL, 'l'}, + {"speaker", 1, NULL, 's'}, + {"wavfile", 1, NULL, 'w'}, + {"wavdir", 1, NULL, 'W'}, + {"debug", 0, NULL, 'd'}, + {"force-frequency", 0, NULL, 'X'}, + {"scale", 1, NULL, 'S'}, +#ifdef CONFIG_SUPPORT_CHMAP + {"chmap", 1, NULL, 'm'}, +#endif + {NULL, 0, NULL, 0 }, + }; + +#ifdef ENABLE_NLS + setlocale(LC_ALL, ""); + textdomain(PACKAGE); +#endif + + snd_pcm_hw_params_alloca(&hwparams); + snd_pcm_sw_params_alloca(&swparams); + + nloops = 0; + morehelp = 0; + + printf("\nspeaker-test %s\n\n", SND_UTIL_VERSION_STR); + while (1) { + int c; + + if ((c = getopt_long(argc, argv, "hD:r:c:f:F:b:p:P:t:l:s:w:W:d:XS:" +#ifdef CONFIG_SUPPORT_CHMAP + "m:" +#endif + , long_option, NULL)) < 0) + break; + + switch (c) { + case 'h': + morehelp++; + break; + case 'D': + device = strdup(optarg); + break; + case 'F': + format = snd_pcm_format_value(optarg); + for (fmt = supported_formats; *fmt >= 0; fmt++) + if (*fmt == format) + break; + if (*fmt < 0) { + fprintf(stderr, "Format %s is not supported...\n", snd_pcm_format_name(format)); + exit(EXIT_FAILURE); + } + break; + case 'r': + rate = atoi(optarg); + rate = rate < 4000 ? 4000 : rate; + rate = rate > 768000 ? 768000 : rate; + break; + case 'c': + channels = atoi(optarg); + channels = channels < 1 ? 1 : channels; + channels = channels > 1024 ? 1024 : channels; + break; + case 'f': + freq = atof(optarg); + break; + case 'b': + buffer_time = atoi(optarg); + buffer_time = buffer_time > 1000000 ? 1000000 : buffer_time; + break; + case 'p': + period_time = atoi(optarg); + period_time = period_time > 1000000 ? 1000000 : period_time; + break; + case 'P': + nperiods = atoi(optarg); + if (nperiods < 2 || nperiods > 1024) { + fprintf(stderr, _("Invalid number of periods %d\n"), nperiods); + exit(1); + } + break; + case 't': + if (*optarg == 'p') + test_type = TEST_PINK_NOISE; + else if (*optarg == 's') + test_type = TEST_SINE; + else if (*optarg == 'w') + test_type = TEST_WAV; + else if (*optarg == 't') + test_type = TEST_PATTERN; + else if (isdigit(*optarg)) { + test_type = atoi(optarg); + if (test_type < TEST_PINK_NOISE || test_type > TEST_PATTERN) { + fprintf(stderr, _("Invalid test type %s\n"), optarg); + exit(1); + } + } else { + fprintf(stderr, _("Invalid test type %s\n"), optarg); + exit(1); + } + break; + case 'l': + nloops = atoi(optarg); + break; + case 's': + speaker = atoi(optarg); + speaker = speaker < 1 ? 0 : speaker; + speakeroptset = 1; + break; + case 'w': + given_test_wav_file = optarg; + break; + case 'W': + wav_file_dir = optarg; + break; + case 'd': + debug = 1; + break; + case 'X': + force_frequency = 1; + break; +#ifdef CONFIG_SUPPORT_CHMAP + case 'm': + chmap = optarg; + break; +#endif + case 'S': + generator_scale = atoi(optarg) / 100.0; + break; + default: + fprintf(stderr, _("Unknown option '%c'\n"), c); + exit(EXIT_FAILURE); + break; + } + } + + if (morehelp) { + help(); + exit(EXIT_SUCCESS); + } + + if (speakeroptset) { + speaker = speaker > channels ? 0 : speaker; + if (speaker==0) { + fprintf(stderr, _("Invalid parameter for -s option.\n")); + exit(EXIT_FAILURE); + } + } + + if (!force_frequency) { + freq = freq < 30.0 ? 30.0 : freq; + freq = freq > 8000.0 ? 8000.0 : freq; + } else { + freq = freq < 1.0 ? 1.0 : freq; + } + + if (test_type == TEST_WAV) + format = SND_PCM_FORMAT_S16_LE; /* fixed format */ + + printf(_("Playback device is %s\n"), device); + printf(_("Stream parameters are %iHz, %s, %i channels\n"), rate, snd_pcm_format_name(format), channels); + switch (test_type) { + case TEST_PINK_NOISE: + printf(_("Using 16 octaves of pink noise\n")); + break; + case TEST_SINE: + printf(_("Sine wave rate is %.4fHz\n"), freq); + break; + case TEST_WAV: + printf(_("WAV file(s)\n")); + break; + + } + + signal(SIGINT, signal_handler); + signal(SIGTERM, signal_handler); + signal(SIGABRT, signal_handler); + + if ((err = snd_pcm_open(&handle, device, SND_PCM_STREAM_PLAYBACK, 0)) < 0) { + printf(_("Playback open error: %d,%s\n"), err,snd_strerror(err)); + prg_exit(EXIT_FAILURE); + } + pcm_handle = handle; + + if ((err = set_hwparams(handle, hwparams, SND_PCM_ACCESS_RW_INTERLEAVED)) < 0) { + printf(_("Setting of hwparams failed: %s\n"), snd_strerror(err)); + prg_exit(EXIT_FAILURE); + } + if ((err = set_swparams(handle, swparams)) < 0) { + printf(_("Setting of swparams failed: %s\n"), snd_strerror(err)); + prg_exit(EXIT_FAILURE); + } + +#ifdef CONFIG_SUPPORT_CHMAP + err = config_chmap(handle, chmap); + if (err < 0) + prg_exit(EXIT_FAILURE); +#endif + + if (debug) { + snd_output_t *log; + err = snd_output_stdio_attach(&log, stderr, 0); + if (err >= 0) { + snd_pcm_dump(handle, log); + snd_output_close(log); + } + } + + frames = malloc(snd_pcm_frames_to_bytes(handle, period_size)); + if (frames == NULL) { + fprintf(stderr, _("No enough memory\n")); + prg_exit(EXIT_FAILURE); + } + + init_loop(); + + if (speaker==0) { + + if (test_type == TEST_WAV) { + for (chn = 0; chn < channels; chn++) { + if (setup_wav_file(get_speaker_channel(chn)) < 0) + prg_exit(EXIT_FAILURE); + } + } + + for (n = 0; (! nloops || n < nloops) && !in_aborting; n++) { + + gettimeofday(&tv1, NULL); + for(chn = 0; chn < channels; chn++) { + int channel = get_speaker_channel(chn); + printf(" %d - %s\n", channel, get_channel_name(channel)); + + err = write_loop(handle, channel, ((rate*3)/period_size), frames); + + if (err < 0) { + fprintf(stderr, _("Transfer failed: %s\n"), snd_strerror(err)); + prg_exit(EXIT_SUCCESS); + } + } + gettimeofday(&tv2, NULL); + time1 = (double)tv1.tv_sec + ((double)tv1.tv_usec / 1000000.0); + time2 = (double)tv2.tv_sec + ((double)tv2.tv_usec / 1000000.0); + time3 = time2 - time1; + printf(_("Time per period = %lf\n"), time3 ); + } + } else { + chn = get_speaker_channel(speaker - 1); + + if (test_type == TEST_WAV) { + if (setup_wav_file(chn) < 0) + prg_exit(EXIT_FAILURE); + } + + printf(" - %s\n", get_channel_name(chn)); + err = write_loop(handle, chn, ((rate*5)/period_size), frames); + + if (err < 0) { + fprintf(stderr, _("Transfer failed: %s\n"), snd_strerror(err)); + } + } + + snd_pcm_drain(handle); + + free(frames); +#ifdef CONFIG_SUPPORT_CHMAP + free(ordered_channels); +#endif + + return prg_exit(EXIT_SUCCESS); +} diff --git a/test-driver b/test-driver new file mode 100755 index 0000000..b8521a4 --- /dev/null +++ b/test-driver @@ -0,0 +1,148 @@ +#! /bin/sh +# test-driver - basic testsuite driver script. + +scriptversion=2018-03-07.03; # UTC + +# Copyright (C) 2011-2018 Free Software Foundation, Inc. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +# This file is maintained in Automake, please report +# bugs to or send patches to +# . + +# Make unconditional expansion of undefined variables an error. This +# helps a lot in preventing typo-related bugs. +set -u + +usage_error () +{ + echo "$0: $*" >&2 + print_usage >&2 + exit 2 +} + +print_usage () +{ + cat <$log_file 2>&1 +estatus=$? + +if test $enable_hard_errors = no && test $estatus -eq 99; then + tweaked_estatus=1 +else + tweaked_estatus=$estatus +fi + +case $tweaked_estatus:$expect_failure in + 0:yes) col=$red res=XPASS recheck=yes gcopy=yes;; + 0:*) col=$grn res=PASS recheck=no gcopy=no;; + 77:*) col=$blu res=SKIP recheck=no gcopy=yes;; + 99:*) col=$mgn res=ERROR recheck=yes gcopy=yes;; + *:yes) col=$lgn res=XFAIL recheck=no gcopy=yes;; + *:*) col=$red res=FAIL recheck=yes gcopy=yes;; +esac + +# Report the test outcome and exit status in the logs, so that one can +# know whether the test passed or failed simply by looking at the '.log' +# file, without the need of also peaking into the corresponding '.trs' +# file (automake bug#11814). +echo "$res $test_name (exit status: $estatus)" >>$log_file + +# Report outcome to console. +echo "${col}${res}${std}: $test_name" + +# Register the test result, and other relevant metadata. +echo ":test-result: $res" > $trs_file +echo ":global-test-result: $res" >> $trs_file +echo ":recheck: $recheck" >> $trs_file +echo ":copy-in-global-log: $gcopy" >> $trs_file + +# Local Variables: +# mode: shell-script +# sh-indentation: 2 +# eval: (add-hook 'before-save-hook 'time-stamp) +# time-stamp-start: "scriptversion=" +# time-stamp-format: "%:y-%02m-%02d.%02H" +# time-stamp-time-zone: "UTC0" +# time-stamp-end: "; # UTC" +# End: diff --git a/topology/Makefile.am b/topology/Makefile.am new file mode 100644 index 0000000..a56c109 --- /dev/null +++ b/topology/Makefile.am @@ -0,0 +1,20 @@ +bin_PROGRAMS = \ + alsatplg + +if USE_RST2MAN +man_MANS = alsatplg.1 +endif + +%.1: %.rst + rst2man $< > $@ + +alsatplg_SOURCES = topology.c + +AM_CPPFLAGS = \ + -Wall -I$(top_srcdir)/include + +alsatplg_LDADD = $(ALSA_TOPOLOGY_LIBS) + +EXTRA_DIST = alsatplg.rst + +CLEANFILES = alsatplg.1 diff --git a/topology/Makefile.in b/topology/Makefile.in new file mode 100644 index 0000000..f896fd5 --- /dev/null +++ b/topology/Makefile.in @@ -0,0 +1,727 @@ +# Makefile.in generated by automake 1.16.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994-2018 Free Software Foundation, Inc. + +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +VPATH = @srcdir@ +am__is_gnu_make = { \ + if test -z '$(MAKELEVEL)'; then \ + false; \ + elif test -n '$(MAKE_HOST)'; then \ + true; \ + elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ + true; \ + else \ + false; \ + fi; \ +} +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + esac; \ + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +bin_PROGRAMS = alsatplg$(EXEEXT) +subdir = topology +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/gettext.m4 \ + $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/lib-ld.m4 \ + $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ + $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \ + $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/acinclude.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/include/aconfig.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +am__installdirs = "$(DESTDIR)$(bindir)" "$(DESTDIR)$(man1dir)" +PROGRAMS = $(bin_PROGRAMS) +am_alsatplg_OBJECTS = topology.$(OBJEXT) +alsatplg_OBJECTS = $(am_alsatplg_OBJECTS) +am__DEPENDENCIES_1 = +alsatplg_DEPENDENCIES = $(am__DEPENDENCIES_1) +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__maybe_remake_depfiles = depfiles +am__depfiles_remade = ./$(DEPDIR)/topology.Po +am__mv = mv -f +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +AM_V_CC = $(am__v_CC_@AM_V@) +am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) +am__v_CC_0 = @echo " CC " $@; +am__v_CC_1 = +CCLD = $(CC) +LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_CCLD = $(am__v_CCLD_@AM_V@) +am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) +am__v_CCLD_0 = @echo " CCLD " $@; +am__v_CCLD_1 = +SOURCES = $(alsatplg_SOURCES) +DIST_SOURCES = $(alsatplg_SOURCES) +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; +am__vpath_adj = case $$p in \ + $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ + *) f=$$p;; \ + esac; +am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; +am__install_max = 40 +am__nobase_strip_setup = \ + srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` +am__nobase_strip = \ + for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" +am__nobase_list = $(am__nobase_strip_setup); \ + for p in $$list; do echo "$$p $$p"; done | \ + sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ + $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ + if (++n[$$2] == $(am__install_max)) \ + { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ + END { for (dir in files) print dir, files[dir] }' +am__base_list = \ + sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ + sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' +am__uninstall_files_from_dir = { \ + test -z "$$files" \ + || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ + || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ + $(am__cd) "$$dir" && rm -f $$files; }; \ + } +man1dir = $(mandir)/man1 +NROFF = nroff +MANS = $(man_MANS) +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) +# Read a list of newline-separated strings from the standard input, +# and print each of them once, without duplicates. Input order is +# *not* preserved. +am__uniquify_input = $(AWK) '\ + BEGIN { nonempty = 0; } \ + { items[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in items) print i; }; } \ +' +# Make sure the list of sources is unique. This is necessary because, +# e.g., the same source file might be shared among _SOURCES variables +# for different programs/libraries. +am__define_uniq_tagged_files = \ + list='$(am__tagged_files)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | $(am__uniquify_input)` +ETAGS = etags +CTAGS = ctags +am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/depcomp +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +ALSACTL_DAEMONSWITCH = @ALSACTL_DAEMONSWITCH@ +ALSACTL_PIDFILE_DIR = @ALSACTL_PIDFILE_DIR@ +ALSA_CFLAGS = @ALSA_CFLAGS@ +ALSA_LIBS = @ALSA_LIBS@ +ALSA_TOPOLOGY_LIBS = @ALSA_TOPOLOGY_LIBS@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +ASOUND_LOCK_DIR = @ASOUND_LOCK_DIR@ +ASOUND_STATE_DIR = @ASOUND_STATE_DIR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CURSESINC = @CURSESINC@ +CURSESLIB = @CURSESLIB@ +CURSES_CFLAGS = @CURSES_CFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +FFTW_CFLAGS = @FFTW_CFLAGS@ +FFTW_INC = @FFTW_INC@ +FFTW_LIB = @FFTW_LIB@ +GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ +GMSGFMT = @GMSGFMT@ +GMSGFMT_015 = @GMSGFMT_015@ +GREP = @GREP@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +INTLLIBS = @INTLLIBS@ +INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@ +LDFLAGS = @LDFLAGS@ +LIBICONV = @LIBICONV@ +LIBINTL = @LIBINTL@ +LIBOBJS = @LIBOBJS@ +LIBRT = @LIBRT@ +LIBS = @LIBS@ +LN_S = @LN_S@ +LTLIBICONV = @LTLIBICONV@ +LTLIBINTL = @LTLIBINTL@ +LTLIBOBJS = @LTLIBOBJS@ +MAINT = @MAINT@ +MAKEINFO = @MAKEINFO@ +MKDIR_P = @MKDIR_P@ +MSGFMT = @MSGFMT@ +MSGFMT_015 = @MSGFMT_015@ +MSGMERGE = @MSGMERGE@ +NCURSESW_CFLAGS = @NCURSESW_CFLAGS@ +NCURSESW_LIBS = @NCURSESW_LIBS@ +NCURSES_CFLAGS = @NCURSES_CFLAGS@ +NCURSES_LIBS = @NCURSES_LIBS@ +OBJEXT = @OBJEXT@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ +POSUB = @POSUB@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +SND_UTIL_MAJOR = @SND_UTIL_MAJOR@ +SND_UTIL_MINOR = @SND_UTIL_MINOR@ +SND_UTIL_SUBMINOR = @SND_UTIL_SUBMINOR@ +SND_UTIL_VERSION = @SND_UTIL_VERSION@ +STRIP = @STRIP@ +SYSTEMD_CFLAGS = @SYSTEMD_CFLAGS@ +SYSTEMD_LIBS = @SYSTEMD_LIBS@ +TESTSOUND = @TESTSOUND@ +USE_NLS = @USE_NLS@ +VERSION = @VERSION@ +XGETTEXT = @XGETTEXT@ +XGETTEXT_015 = @XGETTEXT_015@ +XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_CC = @ac_ct_CC@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +mydatadir = @mydatadir@ +ncurses5_config = @ncurses5_config@ +ncursesw5_config = @ncursesw5_config@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +rst2man_available = @rst2man_available@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +systemdsystemunitdir = @systemdsystemunitdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +udevrulesdir = @udevrulesdir@ +xmlto_available = @xmlto_available@ +@USE_RST2MAN_TRUE@man_MANS = alsatplg.1 +alsatplg_SOURCES = topology.c +AM_CPPFLAGS = \ + -Wall -I$(top_srcdir)/include + +alsatplg_LDADD = $(ALSA_TOPOLOGY_LIBS) +EXTRA_DIST = alsatplg.rst +CLEANFILES = alsatplg.1 +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .o .obj +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign topology/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --foreign topology/Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): +install-binPROGRAMS: $(bin_PROGRAMS) + @$(NORMAL_INSTALL) + @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(bindir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(bindir)" || exit 1; \ + fi; \ + for p in $$list; do echo "$$p $$p"; done | \ + sed 's/$(EXEEXT)$$//' | \ + while read p p1; do if test -f $$p \ + ; then echo "$$p"; echo "$$p"; else :; fi; \ + done | \ + sed -e 'p;s,.*/,,;n;h' \ + -e 's|.*|.|' \ + -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \ + sed 'N;N;N;s,\n, ,g' | \ + $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \ + { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \ + if ($$2 == $$4) files[d] = files[d] " " $$1; \ + else { print "f", $$3 "/" $$4, $$1; } } \ + END { for (d in files) print "f", d, files[d] }' | \ + while read type dir files; do \ + if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \ + test -z "$$files" || { \ + echo " $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(bindir)$$dir'"; \ + $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \ + } \ + ; done + +uninstall-binPROGRAMS: + @$(NORMAL_UNINSTALL) + @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ + files=`for p in $$list; do echo "$$p"; done | \ + sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \ + -e 's/$$/$(EXEEXT)/' \ + `; \ + test -n "$$list" || exit 0; \ + echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \ + cd "$(DESTDIR)$(bindir)" && rm -f $$files + +clean-binPROGRAMS: + -test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS) + +alsatplg$(EXEEXT): $(alsatplg_OBJECTS) $(alsatplg_DEPENDENCIES) $(EXTRA_alsatplg_DEPENDENCIES) + @rm -f alsatplg$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(alsatplg_OBJECTS) $(alsatplg_LDADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/topology.Po@am__quote@ # am--include-marker + +$(am__depfiles_remade): + @$(MKDIR_P) $(@D) + @echo '# dummy' >$@-t && $(am__mv) $@-t $@ + +am--depfiles: $(am__depfiles_remade) + +.c.o: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< + +.c.obj: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` +install-man1: $(man_MANS) + @$(NORMAL_INSTALL) + @list1=''; \ + list2='$(man_MANS)'; \ + test -n "$(man1dir)" \ + && test -n "`echo $$list1$$list2`" \ + || exit 0; \ + echo " $(MKDIR_P) '$(DESTDIR)$(man1dir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(man1dir)" || exit 1; \ + { for i in $$list1; do echo "$$i"; done; \ + if test -n "$$list2"; then \ + for i in $$list2; do echo "$$i"; done \ + | sed -n '/\.1[a-z]*$$/p'; \ + fi; \ + } | while read p; do \ + if test -f $$p; then d=; else d="$(srcdir)/"; fi; \ + echo "$$d$$p"; echo "$$p"; \ + done | \ + sed -e 'n;s,.*/,,;p;h;s,.*\.,,;s,^[^1][0-9a-z]*$$,1,;x' \ + -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,' | \ + sed 'N;N;s,\n, ,g' | { \ + list=; while read file base inst; do \ + if test "$$base" = "$$inst"; then list="$$list $$file"; else \ + echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man1dir)/$$inst'"; \ + $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man1dir)/$$inst" || exit $$?; \ + fi; \ + done; \ + for i in $$list; do echo "$$i"; done | $(am__base_list) | \ + while read files; do \ + test -z "$$files" || { \ + echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(man1dir)'"; \ + $(INSTALL_DATA) $$files "$(DESTDIR)$(man1dir)" || exit $$?; }; \ + done; } + +uninstall-man1: + @$(NORMAL_UNINSTALL) + @list=''; test -n "$(man1dir)" || exit 0; \ + files=`{ for i in $$list; do echo "$$i"; done; \ + l2='$(man_MANS)'; for i in $$l2; do echo "$$i"; done | \ + sed -n '/\.1[a-z]*$$/p'; \ + } | sed -e 's,.*/,,;h;s,.*\.,,;s,^[^1][0-9a-z]*$$,1,;x' \ + -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,'`; \ + dir='$(DESTDIR)$(man1dir)'; $(am__uninstall_files_from_dir) + +ID: $(am__tagged_files) + $(am__define_uniq_tagged_files); mkid -fID $$unique +tags: tags-am +TAGS: tags + +tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + set x; \ + here=`pwd`; \ + $(am__define_uniq_tagged_files); \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: ctags-am + +CTAGS: ctags +ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + $(am__define_uniq_tagged_files); \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" +cscopelist: cscopelist-am + +cscopelist-am: $(am__tagged_files) + list='$(am__tagged_files)'; \ + case "$(srcdir)" in \ + [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ + *) sdir=$(subdir)/$(srcdir) ;; \ + esac; \ + for i in $$list; do \ + if test -f "$$i"; then \ + echo "$(subdir)/$$i"; \ + else \ + echo "$$sdir/$$i"; \ + fi; \ + done >> $(top_builddir)/cscope.files + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) distdir-am + +distdir-am: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(PROGRAMS) $(MANS) +installdirs: + for dir in "$(DESTDIR)$(bindir)" "$(DESTDIR)$(man1dir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ + done +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + +clean-generic: + -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-binPROGRAMS clean-generic mostlyclean-am + +distclean: distclean-am + -rm -f ./$(DEPDIR)/topology.Po + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: install-man + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: install-binPROGRAMS + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: install-man1 + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -f ./$(DEPDIR)/topology.Po + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-binPROGRAMS uninstall-man + +uninstall-man: uninstall-man1 + +.MAKE: install-am install-strip + +.PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-am clean \ + clean-binPROGRAMS clean-generic cscopelist-am ctags ctags-am \ + distclean distclean-compile distclean-generic distclean-tags \ + distdir dvi dvi-am html html-am info info-am install \ + install-am install-binPROGRAMS install-data install-data-am \ + install-dvi install-dvi-am install-exec install-exec-am \ + install-html install-html-am install-info install-info-am \ + install-man install-man1 install-pdf install-pdf-am install-ps \ + install-ps-am install-strip installcheck installcheck-am \ + installdirs maintainer-clean maintainer-clean-generic \ + mostlyclean mostlyclean-compile mostlyclean-generic pdf pdf-am \ + ps ps-am tags tags-am uninstall uninstall-am \ + uninstall-binPROGRAMS uninstall-man uninstall-man1 + +.PRECIOUS: Makefile + + +%.1: %.rst + rst2man $< > $@ + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/topology/alsatplg.rst b/topology/alsatplg.rst new file mode 100644 index 0000000..56324d5 --- /dev/null +++ b/topology/alsatplg.rst @@ -0,0 +1,102 @@ +========== + alsatplg +========== + +---------------------- +ALSA Topology Compiler +---------------------- + +:Author: Jaroslav Kysela +:Date: 2018-10-09 +:Copyright: GPLv2+ +:Manual section: 1 +:Manual group: General Commands Manual + +SYNOPSIS +======== + +*alsatplg* [command] + +DESCRIPTION +=========== + +alsatplg (ALSA Topology compiler) is a program to compile topology +configuration file to the binary file for the kernel drivers. + +Current audio drivers typically hard code topology information +in the driver sources: This tightly couples the audio driver +to the development board making it time consuming to modify +a driver to work on a different devices. The driver is also +tightly coupled to the DSP firmware version meaning extra care +is needed to keep the driver and firmware version in sync. +New firmware features also mean driver updates. + +The ALSA topology project removes the need for re-writing or +porting audio drivers to different devices or different firmwares: +Drivers have no hard coded topology data meaning a single driver +can be used on different devices by updating the topology data +from the file system. Firmware updates can be pushed without +having to update the drivers. The new firmware just needs +to include an updated topology file describing the update. + +OPTIONS +======= + +Available options: + + **-h**, **--help** + this help + + **-V**, **--version** + show the utility version and versions of used libraries + + **-c**, **--compile** `FILE` + source configuration file for the compilation + + **-d**, **--decode** `FILE` + source binary topology file for the decode + + **-n**, **--normalize** `FILE` + parse and save the configuration file in the normalized format + + **-u**, **--dump** `FILE` + parse and save the configuration file in the specified format + + **-o**, **--output** `FILE` + output file + + **-v**, **--verbose** `LEVEL` + set verbose level + + **-s**, **--sort** + sort the configuration identifiers (set for normalization) + + **-x**, **--nocheck** + save the configuration without additional integrity check + + **-z**, **--dapm-nosort** + do not sort DAPM graph items (like in version 1.2.1-) + + +FILES +===== + +The master topology files for each supported sound card are in +``/usr/share/alsa/topology``. + +For example, the master use case file for the `broadwell` card is in +``/usr/share/alsa/topology/broadwell/broadwell.conf``, this file +describes the audio hardware for the driver. + +For more details on the syntax of UCM files, see the alsa-lib source code: +http://git.alsa-project.org/?p=alsa-lib.git;a=blob;f=src/topology/parser.c + +SEE ALSO +======== + +* Topology Interface: http://www.alsa-project.org/alsa-doc/alsa-lib/group__topology.html + +BUGS +==== + +None known. diff --git a/topology/topology.c b/topology/topology.c new file mode 100644 index 0000000..d52b145 --- /dev/null +++ b/topology/topology.c @@ -0,0 +1,396 @@ +/* + Copyright(c) 2019 Red Hat Inc. + Copyright(c) 2014-2015 Intel Corporation + Copyright(c) 2010-2011 Texas Instruments Incorporated, + All rights reserved. + + This program is free software; you can redistribute it and/or modify + it under the terms of version 2 of the GNU General Public License as + published by the Free Software Foundation. + + This program is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. + The full GNU General Public License is included in this distribution + in the file called LICENSE.GPL. +*/ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include "gettext.h" +#include "version.h" + +static snd_output_t *log; + +static void usage(const char *name) +{ + printf( +_("Usage: %s [OPTIONS]...\n" +"\n" +"-h, --help help\n" +"-c, --compile=FILE compile configuration file\n" +"-d, --decode=FILE decode binary topology file\n" +"-n, --normalize=FILE normalize configuration file\n" +"-u, --dump=FILE dump (reparse) configuration file\n" +"-v, --verbose=LEVEL set verbosity level (0...1)\n" +"-o, --output=FILE set output file\n" +"-s, --sort sort the identifiers in the normalized output\n" +"-g, --group save configuration by group indexes\n" +"-x, --nocheck save configuration without additional integrity checks\n" +"-z, --dapm-nosort do not sort the DAPM widgets\n" +"-V, --version print version\n" +), name); +} + +static void version(const char *name) +{ + printf( +_("%s version %s\n" +"libasound version %s\n" +"libatopology version %s\n" +), name, SND_UTIL_VERSION_STR, + snd_asoundlib_version(), snd_tplg_version()); +} + +static int load(const char *source_file, void **dst, size_t *dst_size) +{ + int fd; + void *buf, *buf2; + size_t size, pos; + ssize_t r; + + if (strcmp(source_file, "-") == 0) { + fd = fileno(stdin); + } else { + fd = open(source_file, O_RDONLY); + if (fd < 0) { + fprintf(stderr, _("Unable to open input file '%s': %s\n"), + source_file, strerror(-errno)); + return 1; + } + } + + size = 16*1024; + pos = 0; + buf = malloc(size); + if (buf == NULL) + goto _nomem; + while (1) { + r = read(fd, buf + pos, size - pos); + if (r < 0 && (errno == EAGAIN || errno == EINTR)) + continue; + if (r <= 0) + break; + pos += r; + size += 8*1024; + buf2 = realloc(buf, size); + if (buf2 == NULL) { + free(buf); + goto _nomem; + } + buf = buf2; + } + if (r < 0) { + fprintf(stderr, _("Read error: %s\n"), strerror(-errno)); + goto _err; + } + + if (fd != fileno(stdin)) + close(fd); + + *dst = buf; + *dst_size = pos; + return 0; + +_nomem: + fprintf(stderr, _("No enough memory\n")); +_err: + if (fd != fileno(stdin)) + close(fd); + free(buf); + return 1; +} + +static int load_topology(snd_tplg_t **tplg, char *config, + size_t config_size, int cflags) +{ + int err; + + *tplg = snd_tplg_create(cflags); + if (*tplg == NULL) { + fprintf(stderr, _("failed to create new topology context\n")); + return 1; + } + + err = snd_tplg_load(*tplg, config, config_size); + if (err < 0) { + fprintf(stderr, _("Unable to load configuration: %s\n"), + snd_strerror(-err)); + snd_tplg_free(*tplg); + return 1; + } + + return 0; +} + +static int save(const char *output_file, void *buf, size_t size) +{ + char *fname = NULL; + int fd; + ssize_t r; + + if (strcmp(output_file, "-") == 0) { + fd = fileno(stdout); + } else { + fname = alloca(strlen(output_file) + 5); + strcpy(fname, output_file); + strcat(fname, ".new"); + fd = open(fname, O_RDWR | O_CREAT | O_TRUNC, S_IRUSR | S_IWUSR); + if (fd < 0) { + fprintf(stderr, _("Unable to open output file '%s': %s\n"), + fname, strerror(-errno)); + return 1; + } + } + + r = 0; + while (size > 0) { + r = write(fd, buf, size); + if (r < 0 && (errno == EAGAIN || errno == EINTR)) + continue; + if (r < 0) + break; + size -= r; + buf += r; + } + + if (r < 0) { + fprintf(stderr, _("Write error: %s\n"), strerror(-errno)); + if (fd != fileno(stdout)) { + if (fname && remove(fname)) + fprintf(stderr, _("Unable to remove file %s: %s\n"), + fname, strerror(-errno)); + close(fd); + } + return 1; + } + + if (fd != fileno(stdout)) + close(fd); + + if (fname && rename(fname, output_file)) { + fprintf(stderr, _("Unable to rename file '%s' to '%s': %s\n"), + fname, output_file, strerror(-errno)); + return 1; + } + + return 0; +} + +static int dump(const char *source_file, const char *output_file, int cflags, int sflags) +{ + snd_tplg_t *tplg; + char *config, *text; + size_t size; + int err; + + err = load(source_file, (void **)&config, &size); + if (err) + return err; + err = load_topology(&tplg, config, size, cflags); + free(config); + if (err) + return err; + err = snd_tplg_save(tplg, &text, sflags); + snd_tplg_free(tplg); + if (err < 0) { + fprintf(stderr, _("Unable to save parsed configuration: %s\n"), + snd_strerror(-err)); + return 1; + } + err = save(output_file, text, strlen(text)); + free(text); + return err; +} + +static int compile(const char *source_file, const char *output_file, int cflags) +{ + snd_tplg_t *tplg; + char *config; + void *bin; + size_t config_size, size; + int err; + + err = load(source_file, (void **)&config, &config_size); + if (err) + return err; + err = load_topology(&tplg, config, config_size, cflags); + free(config); + if (err) + return err; + err = snd_tplg_build_bin(tplg, &bin, &size); + snd_tplg_free(tplg); + if (err < 0 || size == 0) { + fprintf(stderr, _("failed to compile context %s: %s\n"), + source_file, snd_strerror(-err)); + return 1; + } + err = save(output_file, bin, size); + free(bin); + return err; +} + +static int decode(const char *source_file, const char *output_file, + int cflags, int dflags, int sflags) +{ + snd_tplg_t *tplg; + void *bin; + char *text; + size_t size; + int err; + + if (load(source_file, &bin, &size)) + return 1; + tplg = snd_tplg_create(cflags); + if (tplg == NULL) { + fprintf(stderr, _("failed to create new topology context\n")); + return 1; + } + err = snd_tplg_decode(tplg, bin, size, dflags); + free(bin); + if (err < 0) { + snd_tplg_free(tplg); + fprintf(stderr, _("failed to decode context %s: %s\n"), + source_file, snd_strerror(-err)); + return 1; + } + err = snd_tplg_save(tplg, &text, sflags); + snd_tplg_free(tplg); + if (err < 0) { + fprintf(stderr, _("Unable to save parsed configuration: %s\n"), + snd_strerror(-err)); + return 1; + } + err = save(output_file, text, strlen(text)); + free(text); + return err; +} + +int main(int argc, char *argv[]) +{ + static const char short_options[] = "hc:d:n:u:v:o:sgxzV"; + static const struct option long_options[] = { + {"help", 0, NULL, 'h'}, + {"verbose", 1, NULL, 'v'}, + {"compile", 1, NULL, 'c'}, + {"decode", 1, NULL, 'd'}, + {"normalize", 1, NULL, 'n'}, + {"dump", 1, NULL, 'u'}, + {"output", 1, NULL, 'o'}, + {"sort", 0, NULL, 's'}, + {"group", 0, NULL, 'g'}, + {"nocheck", 0, NULL, 'x'}, + {"dapm-nosort", 0, NULL, 'z'}, + {"version", 0, NULL, 'V'}, + {0, 0, 0, 0}, + }; + char *source_file = NULL; + char *output_file = NULL; + int c, err, op = 'c', cflags = 0, dflags = 0, sflags = 0, option_index; + +#ifdef ENABLE_NLS + setlocale(LC_ALL, ""); + textdomain(PACKAGE); +#endif + + err = snd_output_stdio_attach(&log, stderr, 0); + assert(err >= 0); + + while ((c = getopt_long(argc, argv, short_options, long_options, &option_index)) != -1) { + switch (c) { + case 'h': + usage(argv[0]); + return 0; + case 'v': + cflags |= SND_TPLG_CREATE_VERBOSE; + break; + case 'z': + cflags |= SND_TPLG_CREATE_DAPM_NOSORT; + break; + case 'c': + case 'd': + case 'n': + case 'u': + if (source_file) { + fprintf(stderr, _("Cannot combine operations (compile, normalize, dump)\n")); + return 1; + } + source_file = optarg; + op = c; + break; + case 'o': + output_file = optarg; + break; + case 's': + sflags |= SND_TPLG_SAVE_SORT; + break; + case 'g': + sflags |= SND_TPLG_SAVE_GROUPS; + break; + case 'x': + sflags |= SND_TPLG_SAVE_NOCHECK; + break; + case 'V': + version(argv[0]); + return 0; + default: + fprintf(stderr, _("Try `%s --help' for more information.\n"), argv[0]); + return 1; + } + } + + if (source_file == NULL || output_file == NULL) { + usage(argv[0]); + return 1; + } + + if (op == 'n') { + if (sflags != 0 && sflags != SND_TPLG_SAVE_SORT) { + fprintf(stderr, _("Wrong parameters for the normalize operation!\n")); + return 1; + } + /* normalize has predefined output */ + sflags = SND_TPLG_SAVE_SORT; + } + + switch (op) { + case 'c': + err = compile(source_file, output_file, cflags); + break; + case 'd': + err = decode(source_file, output_file, cflags, dflags, sflags); + break; + default: + err = dump(source_file, output_file, cflags, sflags); + break; + } + + snd_output_close(log); + return err ? 1 : 0; +} diff --git a/utils/Makefile.am b/utils/Makefile.am new file mode 100644 index 0000000..083e5b4 --- /dev/null +++ b/utils/Makefile.am @@ -0,0 +1,4 @@ +EXTRA_DIST = buildrpm + +rpm: buildrpm alsa-lib.spec + VERSION=$(VERSION) $(srcdir)/buildrpm diff --git a/utils/Makefile.in b/utils/Makefile.in new file mode 100644 index 0000000..e21653d --- /dev/null +++ b/utils/Makefile.in @@ -0,0 +1,473 @@ +# Makefile.in generated by automake 1.16.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994-2018 Free Software Foundation, Inc. + +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ +VPATH = @srcdir@ +am__is_gnu_make = { \ + if test -z '$(MAKELEVEL)'; then \ + false; \ + elif test -n '$(MAKE_HOST)'; then \ + true; \ + elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ + true; \ + else \ + false; \ + fi; \ +} +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + esac; \ + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +subdir = utils +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/gettext.m4 \ + $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/lib-ld.m4 \ + $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ + $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \ + $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/acinclude.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/include/aconfig.h +CONFIG_CLEAN_FILES = alsa-utils.spec +CONFIG_CLEAN_VPATH_FILES = +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = +SOURCES = +DIST_SOURCES = +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) +am__DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/alsa-utils.spec.in +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +ALSACTL_DAEMONSWITCH = @ALSACTL_DAEMONSWITCH@ +ALSACTL_PIDFILE_DIR = @ALSACTL_PIDFILE_DIR@ +ALSA_CFLAGS = @ALSA_CFLAGS@ +ALSA_LIBS = @ALSA_LIBS@ +ALSA_TOPOLOGY_LIBS = @ALSA_TOPOLOGY_LIBS@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +ASOUND_LOCK_DIR = @ASOUND_LOCK_DIR@ +ASOUND_STATE_DIR = @ASOUND_STATE_DIR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CURSESINC = @CURSESINC@ +CURSESLIB = @CURSESLIB@ +CURSES_CFLAGS = @CURSES_CFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +FFTW_CFLAGS = @FFTW_CFLAGS@ +FFTW_INC = @FFTW_INC@ +FFTW_LIB = @FFTW_LIB@ +GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ +GMSGFMT = @GMSGFMT@ +GMSGFMT_015 = @GMSGFMT_015@ +GREP = @GREP@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +INTLLIBS = @INTLLIBS@ +INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@ +LDFLAGS = @LDFLAGS@ +LIBICONV = @LIBICONV@ +LIBINTL = @LIBINTL@ +LIBOBJS = @LIBOBJS@ +LIBRT = @LIBRT@ +LIBS = @LIBS@ +LN_S = @LN_S@ +LTLIBICONV = @LTLIBICONV@ +LTLIBINTL = @LTLIBINTL@ +LTLIBOBJS = @LTLIBOBJS@ +MAINT = @MAINT@ +MAKEINFO = @MAKEINFO@ +MKDIR_P = @MKDIR_P@ +MSGFMT = @MSGFMT@ +MSGFMT_015 = @MSGFMT_015@ +MSGMERGE = @MSGMERGE@ +NCURSESW_CFLAGS = @NCURSESW_CFLAGS@ +NCURSESW_LIBS = @NCURSESW_LIBS@ +NCURSES_CFLAGS = @NCURSES_CFLAGS@ +NCURSES_LIBS = @NCURSES_LIBS@ +OBJEXT = @OBJEXT@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ +POSUB = @POSUB@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +SND_UTIL_MAJOR = @SND_UTIL_MAJOR@ +SND_UTIL_MINOR = @SND_UTIL_MINOR@ +SND_UTIL_SUBMINOR = @SND_UTIL_SUBMINOR@ +SND_UTIL_VERSION = @SND_UTIL_VERSION@ +STRIP = @STRIP@ +SYSTEMD_CFLAGS = @SYSTEMD_CFLAGS@ +SYSTEMD_LIBS = @SYSTEMD_LIBS@ +TESTSOUND = @TESTSOUND@ +USE_NLS = @USE_NLS@ +VERSION = @VERSION@ +XGETTEXT = @XGETTEXT@ +XGETTEXT_015 = @XGETTEXT_015@ +XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_CC = @ac_ct_CC@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +mydatadir = @mydatadir@ +ncurses5_config = @ncurses5_config@ +ncursesw5_config = @ncursesw5_config@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +rst2man_available = @rst2man_available@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +systemdsystemunitdir = @systemdsystemunitdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +udevrulesdir = @udevrulesdir@ +xmlto_available = @xmlto_available@ +EXTRA_DIST = buildrpm +all: all-am + +.SUFFIXES: +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign utils/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --foreign utils/Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): +alsa-utils.spec: $(top_builddir)/config.status $(srcdir)/alsa-utils.spec.in + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ +tags TAGS: + +ctags CTAGS: + +cscope cscopelist: + + +distdir: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) distdir-am + +distdir-am: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile +installdirs: +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic mostlyclean-am + +distclean: distclean-am + -rm -f Makefile +distclean-am: clean-am distclean-generic + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-generic + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: + +.MAKE: install-am install-strip + +.PHONY: all all-am check check-am clean clean-generic cscopelist-am \ + ctags-am distclean distclean-generic distdir dvi dvi-am html \ + html-am info info-am install install-am install-data \ + install-data-am install-dvi install-dvi-am install-exec \ + install-exec-am install-html install-html-am install-info \ + install-info-am install-man install-pdf install-pdf-am \ + install-ps install-ps-am install-strip installcheck \ + installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-generic pdf \ + pdf-am ps ps-am tags-am uninstall uninstall-am + +.PRECIOUS: Makefile + + +rpm: buildrpm alsa-lib.spec + VERSION=$(VERSION) $(srcdir)/buildrpm + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/utils/alsa-utils.spec.in b/utils/alsa-utils.spec.in new file mode 100644 index 0000000..8daf3ba --- /dev/null +++ b/utils/alsa-utils.spec.in @@ -0,0 +1,76 @@ +%define ver @VERSION@ +%define rel 1 + +Summary: Advanced Linux Sound Architecture (ALSA) - Utils +Name: alsa-utils +Version: %ver +Release: %rel +Copyright: GPL +Group: System/Libraries +Source: ftp://ftp.alsa-project.org/pub/utils/alsa-utils-%{ver}.tar.bz2 +BuildRoot: %{_tmppath}/%{name}-%{version}-root +URL: http://www.alsa-project.org +Requires: alsa-lib ncurses +BuildRequires: alsa-lib-devel ncurses-devel gettext + +%description + +Advanced Linux Sound Architecture (ALSA) - Utils + +%changelog +* Sun Oct 1 2006 Jaroslav Kysela +- add gettext to BuildRequires +- add more files (see alsa bug#2139) + +* Tue Nov 25 2003 Ronny V. Vindenes +- include all manpages + +* Thu Mar 6 2003 Ronny V. Vindenes + +- removed wrongly included doc file +- changed BuildRoot from /var/tmp to _tmppath +- use standard rpm macros for build & install section +- updated dependencies + +* Tue Nov 20 2001 Jaroslav Kysela + +- changed BuildRoot from /tmp to /var/tmp +- _prefix and _mandir macros are used for configure and mkdir +- DESTDIR is used for make install + +* Sun Nov 11 2001 Miroslav Benes + +- dangerous command "rpm -rf $RPM_BUILD_ROOT" checks $RPM_BUILD_ROOT variable +- unset key "Docdir" - on some new systems are documentation in /usr/share/doc + +* Mon May 28 1998 Helge Jensen + +- Made SPEC file + +%prep +%setup +%build +%configure +make + +%install +[ "$RPM_BUILD_ROOT" != "/" ] && rm -rf $RPM_BUILD_ROOT +%makeinstall + +%clean +[ "$RPM_BUILD_ROOT" != "/" ] && rm -rf $RPM_BUILD_ROOT + +%files +%defattr(-, root, root) + +%doc ChangeLog COPYING README + +%{_prefix}/sbin/* +%{_prefix}/bin/* +%{_mandir}/man?/* +%{_mandir}/fr/man?/* +%{_prefix}/share/alsa/speaker-test/* +%{_prefix}/share/locale/ja/LC_MESSAGES/* +%{_prefix}/share/locale/ru/LC_MESSAGES/* +%{_prefix}/share/man/fr/man8/alsaconf.8.gz +%{_prefix}/share/sounds/alsa/* diff --git a/utils/buildrpm b/utils/buildrpm new file mode 100644 index 0000000..3a9ab86 --- /dev/null +++ b/utils/buildrpm @@ -0,0 +1,44 @@ +#!/bin/bash + +source=. +version=`cat $source/../version` +package=$source/../alsa-utils-$version.tar.bz2 +packagedir=/usr/src/redhat +xrpmbuild=rpm +rpmbuild --usage 2> /dev/null > /dev/null && xrpmbuild=rpmbuild + +# SuSE path +if [ -d /usr/src/packages ]; then + packagedir=/usr/src/packages +fi + +make -C .. clean +make -C .. dist + +if [ ! -r $package ]; then + echo "Error: wrong package: $package" + exit 1 +fi + +cp -fv $package ${packagedir}/SOURCES + +if [ ! -r $source/buildrpm ]; then + echo "Error: invalid directory: $source" + exit 1 +fi + +if [ ! -d ${packagedir} ]; then + echo "Error: ${packagedir} directory not found" + exit 1 +fi + +if [ ! -r $source/alsadriver.spec ]; then + cd $source/.. + ./configure + cd utils +fi + +cp -fv $source/alsa-utils.spec ${packagedir}/SPECS +cd ${packagedir}/SPECS +$xrpmbuild -ba alsa-utils.spec +cd ${packagedir}