diff --git a/wmmixer-alsa-0.6 b/wmmixer-alsa-0.6 deleted file mode 160000 index 8c37204..0000000 --- a/wmmixer-alsa-0.6 +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 8c3720406c3c24b8b1f25b84796c116b32f3a2ca diff --git a/wmmixer-alsa/COPYING b/wmmixer-alsa/COPYING new file mode 100644 index 0000000..a43ea21 --- /dev/null +++ b/wmmixer-alsa/COPYING @@ -0,0 +1,339 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc. + 675 Mass Ave, Cambridge, MA 02139, 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 + + Appendix: 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) 19yy + + 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., 675 Mass Ave, Cambridge, MA 02139, 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) 19yy 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/wmmixer-alsa/Makefile b/wmmixer-alsa/Makefile new file mode 100644 index 0000000..2149153 --- /dev/null +++ b/wmmixer-alsa/Makefile @@ -0,0 +1,9 @@ +CC=gcc +CFLAGS= -I/usr/X11R6/include -g +OBJS=wmmixer-alsa.o mixer.o + +all: ${OBJS} + ${CC} -L/usr/X11R6/lib -g -lm -lXpm -lXext -lX11 -lasound ${OBJS} -o wmmixer-alsa + +clean: + rm -rf *.o *~ wmmixer-alsa diff --git a/wmmixer-alsa/README b/wmmixer-alsa/README new file mode 100644 index 0000000..7e74c57 --- /dev/null +++ b/wmmixer-alsa/README @@ -0,0 +1,12 @@ +wmmixer-alsa 0.6 by Martin Dahl + +A hacked version of wmmixer by Sam Hawker to make it use ALSA +(Advanced Linux Sound Architecture) in stead of the OSS sound +drivers in the linux kernel. To compile and run this program, +you will need to get alsa-driver and alsa-lib from +www.alsa-project.org ! + +To compile the program, just do a 'make', and then copy the +'wmmixer-alsa' program to your favourite location. + +See COPYING for licence details. diff --git a/wmmixer-alsa/XPM/CVS/Entries b/wmmixer-alsa/XPM/CVS/Entries new file mode 100644 index 0000000..7272672 --- /dev/null +++ b/wmmixer-alsa/XPM/CVS/Entries @@ -0,0 +1,4 @@ +/icons.xpm/1.1.1.1/Fri Jun 18 02:02:45 1999// +/tile.xpm/1.1.1.1/Fri Jun 18 02:02:46 1999// +/wmmixer.xpm/1.1.1.1/Fri Jun 18 02:02:46 1999// +D diff --git a/wmmixer-alsa/XPM/CVS/Repository b/wmmixer-alsa/XPM/CVS/Repository new file mode 100644 index 0000000..16659a1 --- /dev/null +++ b/wmmixer-alsa/XPM/CVS/Repository @@ -0,0 +1 @@ +wmmixer-alsa/XPM diff --git a/wmmixer-alsa/XPM/CVS/Root b/wmmixer-alsa/XPM/CVS/Root new file mode 100644 index 0000000..b401703 --- /dev/null +++ b/wmmixer-alsa/XPM/CVS/Root @@ -0,0 +1 @@ +:pserver:dahlm@cvs.bohemians.org:/home/cvsroot diff --git a/wmmixer-alsa/XPM/icons.xpm b/wmmixer-alsa/XPM/icons.xpm new file mode 100644 index 0000000..d34aac7 --- /dev/null +++ b/wmmixer-alsa/XPM/icons.xpm @@ -0,0 +1,29 @@ +/* XPM */ +static char * icons_xpm[] = { +"220 22 4 1", +" c #282828 s back_color", +". c #00ffff s led_color_high", +"X c #007b7b s led_color_low", +"o c #ffffff", +" ", +" ", +" .. ", +" .... X.. XXXXXX . . .. ", +" . . ...... X......X X..X. .. ........X X. .X . . ", +" . . ..XXX..... X............X. ..X.X. .. . ..X X.... X. .X . ", +" X. . . ..XXXX...... X....... . . . .X.X.. . . . . ... ..... .. . . . X. ", +" X... . . ............... ...XXX....o. .X............X. .X.. . .X. XX . X..X X...X .. .. . X... ", +" X..... . . .X.X.X.X X.X.X.X .XX.XXX...o... . X......X ..XX . . X. . . . X...X ...X X.X X..... ", +" X....... . . .X.X.X.X X.X.X.X .XXXXX...o.... . .XX . ..X . . . .... ...X ....X . X....... ", +" X......... .................... .X.X.X.X X.X.X.X .XXXX. .XXXX. X. .XX . .X. X . . . . X..X ...X .. X.X .. X......... ", +" X........... . . .X X X X X X X.X .XXXX. .XXXX. X. .XX . .X. . . . X...X .. ..X .... X........... ", +" X............. . . .X X X X X X X.X ....o...XXXXX. . .XX . .. . . . .... X.X . . . X............. ", +" X............... . . ...............X ...o...XX..XX. . .XX. . X. . . . .... X. . . . X............... ", +" ................. . . XXXXXXXXXXXXXXX .o....XXX... . ... .X. XX . X.... X. . . ................. ", +" . . ......XXXX.. .. . . . . . X....X X. X.X. ", +" . . .....XXX.. .. X... .X .. . .... X...... ", +" .... ...... .. . ...X .. .. .X ", +" . ...X ", +" ", +" ", +" "}; diff --git a/wmmixer-alsa/XPM/tile.xpm b/wmmixer-alsa/XPM/tile.xpm new file mode 100644 index 0000000..e65c234 --- /dev/null +++ b/wmmixer-alsa/XPM/tile.xpm @@ -0,0 +1,121 @@ +/* XPM */ +static char *tile_xpm[] = { +"64 64 54 1", +" c #F3CEF3CEF3CE", +". c #000000000000", +"X c #514461856185", +"o c #A289A289B2CA", +"O c #A289A289A289", +"+ c #A2899248B2CA", +"@ c #9248A289A289", +"# c #A2899248A289", +"$ c #92489248A289", +"% c #924892489248", +"& c #92488207A289", +"* c #820792489248", +"= c #924882079248", +"- c #820782079248", +"; c #820782078207", +": c #820771C69248", +"> c #618551446185", +", c #9248A289B2CA", +"< c #92489248B2CA", +"1 c #82079248A289", +"2 c #82078207A289", +"3 c #71C682079248", +"4 c #71C682078207", +"5 c #514451446185", +"6 c #514451445144", +"7 c #820771C68207", +"8 c #410351445144", +"9 c #514441035144", +"0 c #71C671C69248", +"q c #71C671C68207", +"w c #71C671C671C6", +"e c #410341035144", +"r c #71C661858207", +"t c #618571C68207", +"y c #410351444103", +"u c #410341034103", +"i c #618571C671C6", +"p c #410330C24103", +"a c #30C241034103", +"s c #71C6618571C6", +"d c #6185618571C6", +"f c #618561858207", +"g c #30C230C230C2", +"h c #618561856185", +"j c #30C230C24103", +"k c #5144618571C6", +"l c #30C2410330C2", +"z c #6185514471C6", +"x c #208130C230C2", +"c c #30C2208130C2", +"v c #5144514471C6", +"b c #2081208130C2", +"n c #208120812081", +"m c #410330C25144", +" .", +" X.", +" oOoO+O+O+O+@#$+@#$#$#$$$#$$%&%&%&%&*&*&*=-=*=-=-=--;---;:;:;>.", +" oo@o,o@o@o@+@+@<@$@$@$@$@$1$$$*$*$*&*&*2*&*2*-*-*-----3-3-4-X.", +" oO+OoO#O+@#@#@#$#@#$#%#$$%$%$%&%&*=%&*=*=*=-=-=--;-;-;:;:;:;5.", +" ,ooo@+@+@+@+@<@#@<@$$$$$$$$$*$1$*&*&*&*&*2*---*-----3---4:4:6.", +" +O+O+O+@#$#@#$#$#$$%$$$%&%&%&%&*=*&*=-=*=---=--;---;:;:4:;:45.", +" @o@o@o@+@+@<@$@$@$$$@$1$1$*$*$*&*&*2*=*2*-*-*-----4-3-4:4-4:6.", +" +O#O+@#@#@#$#$#$#%#%$%&%$%&%&*=*&*=*=*=-=-=--;-;-;:;:;:;:4745.", +" @+@+@+@+@<@#@$@$$$$$$$$$*$*$*&*&*&*&*2*---*-----3---4:4:4:4:8.", +" #O+@#$#@#$#$#$$%$$$%&%&%&%&*=*&*=-=-=---=--;:;-;:;:4:4:474:49.", +" @o@<@+@<@$@$@$$$$$1$1$*$*$*&*&*2*=*2*-*-*-----4-4-4:4:4:4:408.", +" +@#@#@#$#$#$$%#%$%&%$%&%&*=*&*=*=*=-=-=--;-;-;:;:;:;:474747q9.", +" @+@+@<@$$$@$$$$$1$$$*&*$*&*&*&*&*2*---------3-3-4:4:4:4:404q8.", +" #$#@#$#$#$$%$$$%&%&%&%&*=-&*=-=-=---=--;:;:;:;:4:4:474:47q7q9.", +" @#@<@$@$@$$$$$*$1$*$*$*&*&*2*-*2*-*-*-3---4-4-4:4:4:4:404q4q8.", +" #@#$#$#$$%$%$%&%$%&%&*=*=*=-=*=-=;=--;-;-;:;:47;:474747q7q7q9.", +" @<@$$$@$$$$$1$$$*&*&*&*&*&*=*2*---------4-3-4:4:4:4:404qq04q8.", +" #$#$#$$%$%$%&%&%&%&*=-&*=-=-=------;:;:;:;:4:4:47q747qqq7qqq9.", +" @$@$@$$$$$*$1$*$*$*&*&*2*-*-*---*-3-3-4-4-4:4:4:4:404q4q4qqq8.", +" #$#$$%$%$%&%&%&%&*=*=*=-=-=-=;=--;:;-;:;:474:474747q7q7qqwqw9.", +" $$@$$$$$*$$$*&*&*&*&*2*=*2*---------4-3-4:4:4:4:404qqq4qqqqqe.", +" #$$%$%$%&%&*&%&*=-&*=-=-=------;:;:;:;:4:4:47q7q7qqq7qqwrqqw9.", +" @$$$$$*$1$*&*$*2*&*2*-*-*-----3-3-4-4-4:4:404:404q4q4qqqqqtqy.", +" $%$%$%&%&%=%&*=*=*=-=-=--;=--;:;-;:;:474:474747q7q7qqwqwqwrwe.", +" $$$$*$1$*&*&*&*&*2*--2*-----3---4:3-4:4:4:4:404qqqqqqqqqtqtqu.", +" &%$%&%&*&*&*=-=*=-=-=--;---;:;:;:;:4:4:47q7q7qqq7qqwrqrwrwrip.", +" $$*$*$*&*&*2*&*2*-*-*-----3-3-4-4-4:4:404q404q4q4qtqqqiqtqiru.", +" $%&%&*=%&*=*=*=-=-=--;-;-;:;-;:;:474:47q747q7q7qqwqwqwrwrirwu.", +" *$1$*&*&*&*&*2*---*-----3---4:4:4:4:4:4:404qqqqqqqqqtqtqirira.", +" &%&*=*&*=-=*=-=-=--;---;:;:;:;:4:4:47q7q7qqqqqqwrqrwrwriririp.", +" *$*&*&*2*&*2*-*-*-----3-3-4-4-4:4:404q4q4qqq4qtqtqiqiqiriqira.", +" &*=*&*=*=*=-=-=--;-;-;:;:;:;:474:47q7q7q7q7qqwrwqwrwrirwrisip.", +" *&*&*&*&*2*---*-----3---4:4:4:4:404:404qqqqqqqqqtqtqiriririra.", +" =*&*=-=*=---=--;---;:;:4:;:474:47q7q7qqqqqqwrwrwrwriririsdrdp.", +" *&*2*=*2*-*-*-----4-3-4:4-4:4:404q4q4qqqqqtqtqiqiqiriqifirifa.", +" &*=*=*=-=-=--;-;-;:;:;:;:474747q7q7qqq7qqwrwqwrwrirwrisisisdp.", +" *&*&*2*---*-----3-3-4:4:4:4:404qq04qqqqqtqqqirtqiririririfida.", +" =-=-=---=--;:;-;:;:4:4:474:47q7q7qqqqqqwrwrwrwriririsdrdsdddp.", +" *=*2*-*-*-----4-4-4:4:4:4:404q4q4qqqqqtqtqiqiqiriqifififidida.", +" =*=-=-=--;-;-;:;:4:;:474747q7q7qqwqwqwrwqwrwrirwrisdsisdsdsdp.", +" *2*---------4-3-4:4:4:4:404qq04qqqqqtqqqiririririririfidddddg.", +" =---=--;:;:;:;:4:4:474:47q7q7qqqqqqwrwrwrwriririsdsdsddddddhj.", +" *---*-3---4-4-4:4:4:4:404q4q4qqqqqtqtqiqiqiririfififidddidkdl.", +" =;=--;:;-;:;:474:474747q7q7qqwqwqwrwrwrwrirwrisdsdsdsdsddhzhj.", +" --------4-3-4:4:4:4:404qq04qqqqqtqqqiririririfirifidddddddddx.", +" ---;:;:;:;:4:4:47q747qqq7qqwqqqwrwrirwriririsdsdsddddddhzhzhc.", +" --3-3-4-4-4:4:4:4:404q4q4qqqqqtqtqiriqiririfififidddddkdkdXdx.", +" -;:;-;:;:474:474747q7q7qqwqwqwrwrwrwrisisisdsdsdddsddhzhdhzhg.", +" ----4-3-4:4:4:4:404qqq4qqqqqtqtqiriririrififdfidddddkdddkzkdx.", +" :;:;:;:4:4:47q7q7qqq7qqwrqqwrwriririririsdsdsddddddhzhzhzhzXc.", +" 3-4-4-4:4:404:404q4q4qqqqqtqtqiriqiririfidididddddkdkdXdXdXzx.", +" -;:;:474:47q747q7q7qqwqwqwrwrirwrisisisdsdsddddddhzhdhzhzXzhc.", +" 4:4-4:4:4:4:404qqqqqqqqqtqtqiriririrififdfidddddkdddkzkdXzXzx.", +" :;:4:4:47q7q7qqq7qqwrqrwrwriririsirisdsdsddddddhzhzhzhzXzXzXc.", +" 4-4:4:404q404qqq4qtqqqiqtqiriqiririfidididddddkdkdXdXdXzXzXvx.", +" :474:47q7q7q7q7qqwrwqwrwrirwrisisisdsdsddddddhzhzhzhzXzhzX>5c.", +" 4:4:4:4:404qqqqqqqqqtqtqiririririfiddfidddddkdddXzkdXzXzXvXzx.", +" :4:47q7q7qqqqqqwrwrwrwriririsdrisdddsddddddhzhzXzhzXzXzX>5>5c.", +" 4:404q4q4qqqqqtqtqiqiqiriqiririfidididddddkdkdXzXdXzXzXvXvXvx.", +" :47q7q7q7q7qqwrwqwrwrirwrisisisdsdsddhdddhzhzhzhzXzXzX>5>5>5b.", +" 404:404qqqqqqqqqiqtqiririririfidddidddddkdkdXzkzXzXzXvXv5vX5n.", +" >65656569698989y9e9u9ueumueupupapaplpgjgjgjgcgcgcgcxcbcncnbnb.", +" ..............................................................."}; diff --git a/wmmixer-alsa/XPM/wmmixer.xpm b/wmmixer-alsa/XPM/wmmixer.xpm new file mode 100644 index 0000000..537436c --- /dev/null +++ b/wmmixer-alsa/XPM/wmmixer.xpm @@ -0,0 +1,74 @@ +/* XPM */ +static char * wmmixer_xpm[] = { +"64 64 7 1", +" c None", +". c #000000000000", +"X c #AEBAAAAAAEBA", +"o c #28A228A228A2 s back_color", +"O c #208120812081", +"+ c #F7DEF3CEFFFF", +"@ c #861782078E38", +" ", +" ", +" ", +" ", +" .........................X ........................X ", +" .ooooooooooooooooooooooooX .oooooooooooooooooooooooX ", +" .ooooooooooooooooooooooooX .oooooooooooooooooooooooX ", +" .ooooooooooooooooooooooooX .oooooooooooooooooooooooX ", +" .ooooooooooooooooooooooooX .oooooooooooooooooooooooX ", +" .ooooooooooooooooooooooooX .oooooooooooooooooooooooX ", +" .ooooooooooooooooooooooooX .oooooooooooooooooooooooX ", +" .ooooooooooooooooooooooooX .oooooooooooooooooooooooX ", +" .ooooooooooooooooooooooooX .oooooooooooooooooooooooX ", +" .ooooooooooooooooooooooooX .oooooooooooooooooooooooX ", +" .ooooooooooooooooooooooooX .oooooooooooooooooooooooX ", +" .ooooooooooooooooooooooooX .oooooooooooooooooooooooX ", +" .ooooooooooooooooooooooooX .oooooooooooooooooooooooX ", +" .ooooooooooooooooooooooooX .oooooooooooooooooooooooX ", +" .ooooooooooooooooooooooooX .oooooooooooooooooooooooX ", +" .ooooooooooooooooooooooooX .oooooooooooooooooooooooX ", +" .ooooooooooooooooooooooooX .oooooooooooooooooooooooX ", +" .ooooooooooooooooooooooooX .OooooooooooooooooooooooX ", +" .ooooooooooooooooooooooooX .oooooooooooooooooooooooX ", +" .ooooooooooooooooooooooooX .oooooooooooooooooooooooX ", +" .ooooooooooooooooooooooooX .oooooooooooooooooooooooX ", +" .ooooooooooooooooooooooooX .oooooooooooooooooooooooX ", +" .ooooooooooooooooooooooooX .oooooooooooooooooooooooX ", +" XXXXXXXXXXXXXXXXXXXXXXXXXX .oooooooooooooooooooooooX ", +" .oooooooooooooooooooooooX ", +" .oooooooooooooooooooooooX ", +" .oooooooooooooooooooooooX ", +" .oooooooooooooooooooooooX ", +" .......................... .oooooooooooooooooooooooX ", +" .+++++++++++@+++++++++++@X .oooooooooooooooooooooooX ", +" .+XXXXXXXXXX.+XXXXXXXXXX.X .OooooooooooooooooooooooX ", +" .+XXXXXX.XXX.+XXX.XXXXXX.X .OooooooooooooooooooooooX ", +" .+XXXXX..XXX.+XXX..XXXXX.X .OooooooooooooooooooooooX ", +" .+XXXX...XXX.+XXX...XXXX.X .oooooooooooooooooooooooX ", +" .+XXX....XXX.+XXX....XXX.X .oooooooooooooooooooooooX ", +" .+XXXX...XXX.+XXX...XXXX.X .oooooooooooooooooooooooX ", +" .+XXXXX..XXX.+XXX..XXXXX.X .oooooooooooooooooooooooX ", +" .+XXXXXX.XXX.+XXX.XXXXXX.X .oooooooooooooooooooooooX ", +" .+XXXXXXXXXX.+XXXXXXXXXX.X .oooooooooooooooooooooooX ", +" .@...........@...........X .oooooooooooooooooooooooX ", +" XXXXXXXXXXXXXXXXXXXXXXXXXX .oooooooooooooooooooooooX ", +" .oooooooooooooooooooooooX ", +" .......................... .oooooooooooooooooooooooX ", +" .+++++++++++++++++++++++@X .oooooooooooooooooooooooX ", +" .+XXXXXXXXXXXXXXXXXXXXXX.X .oooooooooooooooooooooooX ", +" .+XXXXXXXXXXXXX.XXXXXXXX.X .oooooooooooooooooooooooX ", +" .+XXXXXXXXX...X.XXXXXXXX.X .oooooooooooooooooooooooX ", +" .+XXXXXXXX..X...XXXXXXXX.X .oooooooooooooooooooooooX ", +" .+XXXXXXXX.XXX..XXXXXXXX.X .oooooooooooooooooooooooX ", +" .+XXXXXXXX..X...XXXXXXXX.X .oooooooooooooooooooooooX ", +" .+XXXXXXXXX...X.XXXXXXXX.X .oooooooooooooooooooooooX ", +" .+XXXXXXXXXXXXX.XXXXXXXX.X .oooooooooooooooooooooooX ", +" .+XXXXXXXXXXXXXXXXXXXXXX.X .oooooooooooooooooooooooX ", +" .@.......................X .oooooooooooooooooooooooX ", +" XXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXX ", +" ", +" ", +" ", +" ", +" "}; diff --git a/wmmixer-alsa/mixer.c b/wmmixer-alsa/mixer.c new file mode 100644 index 0000000..d454b50 --- /dev/null +++ b/wmmixer-alsa/mixer.c @@ -0,0 +1,91 @@ +#include "wmmixer-alsa.h" + +void init_mixer(void) +{ + int err; + if((err=snd_mixer_open(&mixer_handle,CARD_NUM,MIXER_NUM))<0) + { + fprintf(stderr,"Mixer open failed: %s\n",snd_strerror(err)); + return; + } + init_elements(); + return; +} + +void init_elements(void) +{ + int err,i; + count=0; + memset(&elements,0,sizeof(elements)); + if((err=snd_mixer_elements(mixer_handle,&elements))<0) + { + fprintf(stderr,"Elements error: %s\n",snd_strerror(err)); + return; + } + elements.pelements=(snd_mixer_eid_t *)malloc(elements.elements_over*sizeof(snd_mixer_eid_t)); + if(!elements.pelements) + { + fprintf(stderr,"Elements error: Not enough memory\n"); + return; + } + elements.elements_size=elements.elements_over; + elements.elements_over=elements.elements=0; + if((err=snd_mixer_elements(mixer_handle,&elements))<0) + { + fprintf(stderr,"Elements error: %s\n",snd_strerror(err)); + return; + } + for(i=0;ielement.eid=elements.pelements[i]; + if((err=snd_mixer_element_build(mixer_handle,&e->element))<0) + { + fprintf(stderr,"Element error: %s\n",snd_strerror(err)); + return; + } + e->info.eid=elements.pelements[i]; + if((err=snd_mixer_element_info_build(mixer_handle,&e->info))<0) + { + fprintf(stderr,"Element info error: %s\n",snd_strerror(err)); + return; + } + count++; + } + free((void *)elements.pelements); + return; +} + +elementinfo *add_element(void) +{ + if(!element) + { + element=(elementinfo *)malloc(sizeof(elementinfo)); + element->next=NULL; + element->prev=NULL; + memset(&element->info,0,sizeof(element->info)); + memset(&element->element,0,sizeof(element->element)); + return element; + } + else + { + elementinfo *e; + e=element; + while(e->next) + e=e->next; + e->next=(elementinfo *)malloc(sizeof(elementinfo)); + e->next->prev=e; + e=e->next; + e->next=NULL; + memset(&e->info,0,sizeof(e->info)); + memset(&e->element,0,sizeof(e->element)); + return e; + } +} diff --git a/wmmixer-alsa/wmmixer-alsa.c b/wmmixer-alsa/wmmixer-alsa.c new file mode 100644 index 0000000..13dba79 --- /dev/null +++ b/wmmixer-alsa/wmmixer-alsa.c @@ -0,0 +1,545 @@ +#include "wmmixer-alsa.h" + +int main(int argc, char **argv) +{ + XGCValues gcv; + unsigned long gcm; + int exact,left,right,device_index,i; + XpmAttributes xpmattr; + XpmColorSymbol xpmcsym[4]; + elementinfo *e; + + scanArgs(argc, argv); + initXWin(argc, argv); + exact=left=right=device_index=-1; + + init_mixer(); + cure=element; + e=element; + while(e) + { + if(!strcasecmp(e->info.eid.name,"Master Volume")) + e->icon=0; + else if(!strcasecmp(e->info.eid.name,"PCM Volume")) + e->icon=1; + else if(!strcasecmp(e->info.eid.name,"MIC Volume")) + e->icon=5; + else if(!strcasecmp(e->info.eid.name,"Line Volume")) + e->icon=4; + else if(!strcasecmp(e->info.eid.name,"CD Volume")) + e->icon=3; + else if(!strcasecmp(e->info.eid.name,"Synth Volume")) + e->icon=2; + else if(!strcasecmp(e->info.eid.name,"PC Speaker Volume")) + e->icon=6; + /* + * bass = 7 + * treble = 8 + */ + else + e->icon=9; + e=e->next; + } + + gcm=GCGraphicsExposures; + gcv.graphics_exposures=0; + gc_gc=XCreateGC(d_display, w_root, gcm, &gcv); + + color[0]=mixColor(ledcolor, 0, backcolor, 100); + color[1]=mixColor(ledcolor, 100, backcolor, 0); + color[2]=mixColor(ledcolor, 60, backcolor, 40); + color[3]=mixColor(ledcolor, 25, backcolor, 75); + + xpmcsym[0].name="back_color"; + xpmcsym[0].value=NULL;; + xpmcsym[0].pixel=color[0]; + xpmcsym[1].name="led_color_high"; + xpmcsym[1].value=NULL;; + xpmcsym[1].pixel=color[1]; + xpmcsym[2].name="led_color_med"; + xpmcsym[2].value=NULL;; + xpmcsym[2].pixel=color[2]; + xpmcsym[3].name="led_color_low"; + xpmcsym[3].value=NULL;; + xpmcsym[3].pixel=color[3]; + xpmattr.numsymbols=4; + xpmattr.colorsymbols=xpmcsym; + xpmattr.exactColors=0; + xpmattr.closeness=40000; + xpmattr.valuemask=XpmColorSymbols | XpmExactColors | XpmCloseness; + XpmCreatePixmapFromData(d_display, w_root, wmmixer_xpm, &pm_main, &pm_mask, &xpmattr); + XpmCreatePixmapFromData(d_display, w_root, tile_xpm, &pm_tile, NULL, &xpmattr); + XpmCreatePixmapFromData(d_display, w_root, icons_xpm, &pm_icon, NULL, &xpmattr); + pm_disp=XCreatePixmap(d_display, w_root, 64, 64, DefaultDepth(d_display, DefaultScreen(d_display))); + + if(wmaker || ushape || astep) + XShapeCombineMask(d_display, w_activewin, ShapeBounding, winsize/2-32, winsize/2-32, pm_mask, ShapeSet); + else + XCopyArea(d_display, pm_tile, pm_disp, gc_gc, 0, 0, 64, 64, 0, 0); + + XSetClipMask(d_display, gc_gc, pm_mask); + XCopyArea(d_display, pm_main, pm_disp, gc_gc, 0, 0, 64, 64, 0, 0); + XSetClipMask(d_display, gc_gc, None); + + if(count==0) + fprintf(stderr,"%s : Sorry, no supported channels found.\n", NAME); + else + { + int done=0; + XEvent xev; + + checkVol(); + XSelectInput(d_display, w_activewin, ExposureMask | ButtonPressMask | ButtonReleaseMask | ButtonMotionMask); + XMapWindow(d_display, w_main); + + while(!done) + { + while(XPending(d_display)) + { + XNextEvent(d_display, &xev); + switch(xev.type) + { + case Expose: + repaint(); + break; + case ButtonPress: + pressEvent(&xev.xbutton); + break; + case ButtonRelease: + releaseEvent(&xev.xbutton); + break; + case MotionNotify: + motionEvent(&xev.xmotion); + break; + case ClientMessage: + if(xev.xclient.data.l[0]==deleteWin) + done=1; + break; + } + } + + if(btnstate & (BTNPREV | BTNNEXT)) + { + rpttimer++; + if(rpttimer>=RPTINTERVAL) + { + if(btnstate & BTNNEXT) + { + cure=cure->next; + if(!cure) + cure=element; + } + else + { + cure=cure->prev; + if(!cure) + { + elementinfo *e; + e=element; + while(e->next) + e=e->next; + cure=e; + } + } + checkVol(); + rpttimer=0; + } + } + else + checkVol(); + XFlush(d_display); + usleep(50000); + } + } + XFreeGC(d_display, gc_gc); + XFreePixmap(d_display, pm_main); + XFreePixmap(d_display, pm_tile); + XFreePixmap(d_display, pm_disp); + XFreePixmap(d_display, pm_mask); + XFreePixmap(d_display, pm_icon); + freeXWin(); + return 0; +} + +void initXWin(int argc, char **argv) +{ + int pos; + XWMHints wmhints; + XSizeHints shints; + + winsize=astep ? ASTEPSIZE : NORMSIZE; + + if((d_display=XOpenDisplay(display))==NULL) + { + fprintf(stderr,"%s : Unable to open X display '%s'.\n", NAME, XDisplayName(display)); + exit(1); + } + _XA_GNUSTEP_WM_FUNC=XInternAtom(d_display, "_GNUSTEP_WM_FUNCTION", 0); + deleteWin=XInternAtom(d_display, "WM_DELETE_WINDOW", 0); + + w_root=DefaultRootWindow(d_display); + + shints.x=0; + shints.y=0; + shints.flags=0; + pos=(XWMGeometry(d_display, DefaultScreen(d_display), position, NULL, 0, &shints, &shints.x, &shints.y, &shints.width, &shints.height, &shints.win_gravity) & (XValue | YValue)); + shints.min_width=winsize; + shints.min_height=winsize; + shints.max_width=winsize; + shints.max_height=winsize; + shints.base_width=winsize; + shints.base_height=winsize; + shints.flags=PMinSize | PMaxSize | PBaseSize; + + createWin(&w_main, shints.x, shints.y); + + if(wmaker || astep || pos) + shints.flags |= USPosition; + if(wmaker) + { + wmhints.initial_state=WithdrawnState; + wmhints.flags=WindowGroupHint | StateHint | IconWindowHint; + createWin(&w_icon, shints.x, shints.y); + w_activewin=w_icon; + wmhints.icon_window=w_icon; + } + else + { + wmhints.initial_state=NormalState; + wmhints.flags=WindowGroupHint | StateHint; + w_activewin=w_main; + } + wmhints.window_group=w_main; + XSetWMHints(d_display, w_main, &wmhints); + XSetWMNormalHints(d_display, w_main, &shints); + XSetCommand(d_display, w_main, argv, argc); + XStoreName(d_display, w_main, NAME); + XSetIconName(d_display, w_main, NAME); + XSetWMProtocols(d_display, w_activewin, &deleteWin, 1); +} + +void freeXWin() +{ + XDestroyWindow(d_display, w_main); + if(wmaker) + XDestroyWindow(d_display, w_icon); + XCloseDisplay(d_display); +} + +void createWin(Window *win, int x, int y) +{ + XClassHint classHint; + *win=XCreateSimpleWindow(d_display, w_root, x, y, winsize, winsize, 0, 0, 0); + classHint.res_name=NAME; + classHint.res_class=CLASS; + XSetClassHint(d_display, *win, &classHint); +} + +unsigned long mixColor(char *colorname1, int prop1, char *colorname2, int prop2){ + XColor color, color1, color2; + XWindowAttributes winattr; + XGetWindowAttributes(d_display, w_root, &winattr); + XParseColor(d_display, winattr.colormap, colorname1, &color1); + XParseColor(d_display, winattr.colormap, colorname2, &color2); + color.pixel=0; + color.red=(color1.red*prop1+color2.red*prop2)/(prop1+prop2); + color.green=(color1.green*prop1+color2.green*prop2)/(prop1+prop2); + color.blue=(color1.blue*prop1+color2.blue*prop2)/(prop1+prop2); + color.flags=DoRed | DoGreen | DoBlue; + XAllocColor(d_display, winattr.colormap, &color); + return color.pixel; +} + +void show_params(void) +{ + fprintf(stdout,"wmmixer-alsa %s\t\tby Sam Hawker\n" + "\t\t\tAdded support for ALSA by\n" + "\t\t\tMartin Dahl \n\n" + "Usage: wmmixer-alsa [options]\n\n" + "\t-h\t\tDisplay this help screen\n" + "\t-w\t\tUse WithdrawnState\n" + "\t-s\t\tShaped window\n" + "\t-a\t\tUse smaller window\n" + "\t-l \t\tColor for led display\n" + "\t-b \t\tColor for background\n" + "\t-p \t\tWindow position\n" + "\t-d \t\tTarget display\n",VERSION); + exit(0); +} + +void scanArgs(int argc, char **argv) +{ + int x; + + memset(backcolor,0,32); + memset(ledcolor,0,32); + memset(display,0,32); + memset(position,0,32); + strncpy(ledcolor,LEDCOLOR,32); + strncpy(backcolor,BACKCOLOR,32); + strcpy(display,""); + strcpy(position,""); + wmaker=ushape=astep=0; + btnstate=rpttimer=0; + dragging=count=0; + + for(x=1;xelement.data.volume1.pvoices[0],cure->info.data.volume1.prange[0].min,cure->info.data.volume1.prange[0].max,0,100); + nr=convert_range(cure->element.data.volume1.pvoices[1],cure->info.data.volume1.prange[1].min,cure->info.data.volume1.prange[1].max,0,100); + + if(1) + { + curleft=nl; + curright=nr; + } + else + { + if(nl!=curleft||nr!=curright) + { + if(nl!=curleft) + { + curleft=nl; + drawLeft(); + } + if(nr!=curright) + { + curright=nr; + drawRight(); + } + } + } + update(); + repaint(); +} + +void setVol(int left, int right) +{ + int err; + callbacks(); + cure->element.data.volume1.pvoices[0]=convert_range(left,0,100,cure->info.data.volume1.prange[0].min,cure->info.data.volume1.prange[0].max); + if(cure->element.data.volume1.pvoices[0]>cure->info.data.volume1.prange[0].max) + cure->element.data.volume1.pvoices[0]=cure->info.data.volume1.prange[0].max; + if(cure->element.data.volume1.pvoices[0]info.data.volume1.prange[0].min) + cure->element.data.volume1.pvoices[0]=cure->info.data.volume1.prange[0].min; + cure->element.data.volume1.pvoices[1]=convert_range(right,0,100,cure->info.data.volume1.prange[1].min,cure->info.data.volume1.prange[1].max); + if(cure->element.data.volume1.pvoices[1]>cure->info.data.volume1.prange[1].max) + cure->element.data.volume1.pvoices[1]=cure->info.data.volume1.prange[1].max; + if((err=snd_mixer_element_write(mixer_handle,&cure->element))<0) + fprintf(stderr,"Mixer element write error: %s\n",snd_strerror(err)); + return; +} + +void callbacks(void) +{ + int err; + snd_mixer_callbacks_t callbacks; + memset(&callbacks,0,sizeof(callbacks)); + callbacks.rebuild=NULL; + callbacks.element=NULL; + callbacks.group=NULL; + if((err=snd_mixer_read(mixer_handle,&callbacks))<0) + { + fprintf(stderr,"Callbacks error: %s\n",snd_strerror(err)); + return; + } + return; +} + +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); +} + +void pressEvent(XButtonEvent *xev) +{ + int x=xev->x-(winsize/2-32); + int y=xev->y-(winsize/2-32); + if(x>=5 && y>=33 && x<=16 && y<=43) + { + cure=cure->prev; + if(!cure) + { + elementinfo *e; + e=element; + while(e->next) + e=e->next; + cure=e; + } + btnstate |= BTNPREV; + rpttimer=0; + drawBtns(BTNPREV); + checkVol(); + return; + } + if(x>=17 && y>=33 && x<=28 && y<=43) + { + cure=cure->next; + if(!cure) + cure=element; + btnstate|=BTNNEXT; + rpttimer=0; + drawBtns(BTNNEXT); + checkVol(); + return; + } + if(x>=37 && x<=56 && y>=8 && y<=56) + { + int v=((60-y)*100)/(2*25); + dragging=1; + if(x<=50) + setVol(v,curright); + if(x>=45) + setVol(curleft,v); + checkVol(); + return; + } +/* if(x>=5 && y>=47 && x<=28 && y<=57) + { + int nl,nr,flags; + mixer.DeviceSet(channel[curchannel]); + mixer.Read(&nl,&nr,&flags); + if(flags & SND_MIXER_DFLG_MUTE) + { + btnstate &= ~BTNREC; + flags &= ~SND_MIXER_DFLG_MUTE; + } + else + { + btnstate |= BTNREC; + flags |= SND_MIXER_DFLG_MUTE; + } + mixer.Write(nl,nr,flags); + checkVol(); + return; + }*/ +} + +void releaseEvent(XButtonEvent *xev) +{ + dragging=0; + btnstate &= ~(BTNPREV | BTNNEXT); + drawBtns(BTNPREV | BTNNEXT); + repaint(); +} + +void motionEvent(XMotionEvent *xev) +{ + int x=xev->x-(winsize/2-32); + int y=xev->y-(winsize/2-32); + if(x>=37 && x<=56 && y>=8 && dragging) + { + int v=((60-y)*100)/(2*25); + if(v<0) + v=0; + if(x<=50) + setVol(v,curright); + if(x>=45) + setVol(curleft,v); + checkVol(); + } +} + +void repaint() +{ + XEvent xev; + XCopyArea(d_display, pm_disp, w_activewin, gc_gc, 0, 0, 64, 64, winsize/2-32, winsize/2-32); + while(XCheckTypedEvent(d_display, Expose, &xev)); +} + +void update() +{ + XCopyArea(d_display, pm_icon, pm_disp, gc_gc, cure->icon*22, 0, 22, 22, 6, 5); + drawLeft(); + drawRight(); + drawBtns(BTNREC); +} + +void drawLeft() +{ + int i; + XSetForeground(d_display, gc_gc, color[1]); + for(i=0;i<25;i++) + { + if(i==(curleft*25)/100) + XSetForeground(d_display, gc_gc, color[3]); + XFillRectangle(d_display, pm_disp, gc_gc, 37, 55-2*i, 9, 1); + } +} + +void drawRight() +{ + int i; + XSetForeground(d_display, gc_gc, color[1]); + for(i=0;i<25;i++) + { + if(i==(curright*25)/100) + XSetForeground(d_display, gc_gc, color[3]); + XFillRectangle(d_display, pm_disp, gc_gc, 48, 55-2*i, 9, 1); + } +} + +void drawBtns(int btns) +{ + if(btns & BTNPREV) + drawBtn(5, 33, 12, 11, (btnstate & BTNPREV)); + if(btns & BTNNEXT) + drawBtn(17, 33, 12, 11, (btnstate & BTNNEXT)); + if(btns & BTNREC) + drawBtn(5, 47, 24, 11, (btnstate & BTNREC)); +} + +void drawBtn(int x, int y, int w, int h, int down) +{ + if(!down) + XCopyArea(d_display, pm_main, pm_disp, gc_gc, x, y, w, h, x, y); + else + { + XCopyArea(d_display, pm_main, pm_disp, gc_gc, x, y, 1, h-1, x+w-1, y+1); + XCopyArea(d_display, pm_main, pm_disp, gc_gc, x+w-1, y+1, 1, h-1, x, y); + XCopyArea(d_display, pm_main, pm_disp, gc_gc, x, y, w-1, 1, x+1, y+h-1); + XCopyArea(d_display, pm_main, pm_disp, gc_gc, x+1, y+h-1, w-1, 1, x, y); + } +} diff --git a/wmmixer-alsa/wmmixer-alsa.h b/wmmixer-alsa/wmmixer-alsa.h new file mode 100644 index 0000000..ec11894 --- /dev/null +++ b/wmmixer-alsa/wmmixer-alsa.h @@ -0,0 +1,112 @@ +#define NORMSIZE 64 +#define ASTEPSIZE 56 +#define NAME "wmmixer" +#define CLASS "WMMixer" + +#define BACKCOLOR "#282828" +#define LEDCOLOR "LightSeaGreen" + +#define CARD_NUM 0 +#define MIXER_NUM 0 + +#define VERSION "0.6" + +#include +#include +#include +#include +#include + +#include + +#include +#include +#include +#include +#include +#include + +Pixmap pm_main; +Pixmap pm_tile; +Pixmap pm_disp; +Pixmap pm_mask; +Pixmap pm_icon; + +#include "XPM/wmmixer.xpm" +#include "XPM/tile.xpm" +#include "XPM/icons.xpm" + +int wmaker; +int ushape; +int astep; +char display[32]; +char position[32]; +int winsize; + +char backcolor[32]; +char ledcolor[32]; + +Atom _XA_GNUSTEP_WM_FUNC; +Atom deleteWin; +Display *d_display; +Window w_icon; +Window w_main; +Window w_root; +Window w_activewin; + +GC gc_gc; +unsigned long color[4]; + +snd_mixer_t *mixer_handle; +snd_mixer_elements_t elements; + +typedef struct elementinfoStruct { + snd_mixer_element_info_t info; + snd_mixer_element_t element; + int icon; + struct elementinfoStruct *next; + struct elementinfoStruct *prev; +} elementinfo; + +elementinfo *element; +elementinfo *cure; + +int curchannel; +int curleft; +int curright; + +int btnstate; +#define BTNNEXT 1 +#define BTNPREV 2 +#define BTNREC 4 +#define RPTINTERVAL 5 + +int rpttimer; +int dragging; +int count; +int channel[80]; + +void initXWin(int argc, char **argv); +void freeXWin(); +void createWin(Window *win, int x, int y); +unsigned long getColor(char *colorname); +unsigned long mixColor(char *colorname1, int prop1, char *colorname2, int prop2); +void scanArgs(int argc, char **argv); + +void checkVol(void); +void setVol(int left, int right); +void callbacks(void); +int convert_range(int val, int omin, int omax, int nmin, int nmax); +void pressEvent(XButtonEvent *xev); +void releaseEvent(XButtonEvent *xev); +void motionEvent(XMotionEvent *xev); +void repaint(); +void update(); +void drawLeft(); +void drawRight(); +void drawBtns(int btns); +void drawBtn(int x, int y, int w, int h, int down); + +void init_mixer(void); +void init_elements(void); +elementinfo *add_element(void);